-
Notifications
You must be signed in to change notification settings - Fork 1
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
Trim leading zeros for expected value #42
Conversation
Signed-off-by: Naohiro Yoshida <[email protected]>
light-client/src/commitment.rs
Outdated
let expected_value = expected_value.as_ref().map(|e| rlp::encode(e).to_vec()); | ||
let expected_value = expected_value | ||
.as_ref() | ||
.map(|e| rlp::encode(&trim_left_zero(e).to_vec()).to_vec()); |
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.
You can remove .to_vec()
.map(|e| rlp::encode(&trim_left_zero(e)).to_vec());
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.
Thanks. I fixed it.
let expected_value = expected_value.as_ref().map(|e| rlp::encode(e).to_vec()); | ||
let expected_value = expected_value | ||
.as_ref() | ||
.map(|e| rlp::encode(&trim_left_zero(e).to_vec()).to_vec()); | ||
if value != expected_value { | ||
return Err(Error::UnexpectedStateValue( |
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.
Can you add value
to UnexpectedStateValue
error? It would be helpful for debug.
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.
done
Signed-off-by: Naohiro Yoshida <[email protected]>
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.
@yoshidan LGTM👍
In BSC / ethereum, the leading zeros in the proof value is trimmed, so ELC also trims leading zeros.