Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Secure API JSON RPC ID can be integer or string #314

Merged
merged 2 commits into from
Jan 24, 2020

Conversation

quentinlesceller
Copy link
Member

@quentinlesceller quentinlesceller commented Jan 22, 2020

Fixes #312 and #313.
uint64 are now serialized as string and can be deserialized either from integer or string.

@quentinlesceller quentinlesceller changed the title Fix #313 Secure API JSON RPC ID can be integer or string Jan 22, 2020
@yeastplume
Copy link
Member

Looks good (small test complication failure), but I'm wondering if it's more correct to leave the id as a u32 and just provide a 'string_or_u32' formatter as well. JS usually only supports 32 bit literals (which is why all u64s throughout the API are returned and accepted as strings).

@quentinlesceller
Copy link
Member Author

True, that's one way to do it. But since easyjson-rpc https://github.com/mimblewimble/easy-jsonrpc/blob/master/src/lib.rs#L468 uses u64 internally, wouldn't it be logical to also use u64?

@yeastplume
Copy link
Member

Yeah, I don't think it makes a huge difference. Thanks for fixing!

@yeastplume yeastplume merged commit 3091bd9 into mimblewimble:master Jan 24, 2020
antiochp pushed a commit to antiochp/grin-wallet that referenced this pull request Aug 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

API v3: ID is sometimes int or string
2 participants