Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
feat: add VariableByteArray #88
feat: add VariableByteArray #88
Changes from 8 commits
a5dc939
bea9f61
466e264
056a523
20fbb41
18899e8
bfa3e63
339bc40
b0c15d0
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
do we need
FixLenBytesVec
as well? I think we will still have fixed length arrays where the fixed length is only determined at runtime.also for exactly to
left_pad_to_fixed
onVarLenBytesVec
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.
Do you have a use case in the near term? Otherwise maybe we can hold it until we really need it?
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.
BTW what's
left_pad_to_fixed
?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's used very frequently: https://github.com/axiom-crypto/axiom-eth/blob/574b5e644eafdac7ea8b27a18eb46da45ed3ceed/axiom-eth/src/batch_query/response/mod.rs#L83C18-L83C18
Common use case: we read in some "value" type such as
uint256
from RLP encoding, but then for other purposes we want to convert it to a fixed length format. It is also an intermediate step to evaluating a variable length byte array as a big-endian number.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.
since it's mainly used in query, we can also save it for a separate PR, but it does seem rather common
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.
OK will do it in a separate PR.
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.
maybe a little tedious, but since
VarLenBytes, VarLenBytesVec, FixLenBytes
cannot be constructed elsewhere, can you add in analog ofunsafe_to_byte
? For example the output of currentzkevm_keccak
will be guaranteed to be RLC of bytes, so you should be able to cast them to*Bytes
.Optional: analog of
load_byte
function just for convenience (this can also be added later)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.
Added. Will add
load_*
and conversion between these types later.