-
Notifications
You must be signed in to change notification settings - Fork 248
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
Add bitvec-like generic support to the scale-bits type for use in codegen #718
Conversation
subxt/src/utils.rs
Outdated
// NOTE: We could reduce allocations if it would be possible to directly | ||
// decode from an `Input` type using a custom format (rather than default <u8, Lsb0>) | ||
// for the `Bits` type. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It definitely feels from this PR that we could improve scale_bits::decode_using_format_from
to work with that Input
trait rather than accepting an array of bytes; it'd be nice to be able to condense all of this decode logic into a few lines much like the encode
version below, and the only reason that you can't is that the interface in scale-bits isn't quite right :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Opened an issue for this here: paritytech/scale-decode#10
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great; love the approach and well commented (shame that scale-bits
doesn't provide the right interface to help with decoding, so we should fix that). Just a wee tweak and perhaps some tests to make sure that our encoding/decoding lines up with BitVec still to check compatibility.
Maybe with those tests especially it becomes worth turning utils
into a folder and moving this bits
to a separate file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! One tiny nit about util::bits
imports but great stuff!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice work, looks good
I have some minor comments which are optional to fix :P
Co-authored-by: Niklas Adolfsson <[email protected]>
Co-authored-by: Niklas Adolfsson <[email protected]>
Fixes #693
Hopefully this is in line with what was expected from #693 cc @jsdw