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

Is there a reason why account value should be left-padded? #12

Open
LogvinovLeon opened this issue Feb 12, 2024 · 1 comment
Open

Is there a reason why account value should be left-padded? #12

LogvinovLeon opened this issue Feb 12, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@LogvinovLeon
Copy link
Contributor

This library assumes that account value is left padded while proof is right padded.
I wanted to ask - if there is a specific reason for it.
As far as I see - noir code doesn't make use of the left-paddingness of account and just immediately converts it back to a right-padded value. Also rust code needs to implement left_pad function while right padding just concats with the zero vec.

Unless I miss something here - switching to right-padded values will make rust code simpler and circuit smaller

@ax0
Copy link
Contributor

ax0 commented Feb 14, 2024

Thanks for bringing this up! The initial motivation was to mirror the storage proof structure where values are naturally represented as left-padded big-endian byte arrays, but even in that case the value embedded in a proof is itself RLP-encoded so that a case could be made for right-padded. In any case, I agree that it would make sense to move to right-padded values for state proofs, which would result in a constraint reduction of around 9k.

@ax0 ax0 added the enhancement New feature or request label Feb 14, 2024
ax0 added a commit that referenced this issue Feb 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants