-
Notifications
You must be signed in to change notification settings - Fork 224
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
Fix header.hash for height 1 #438
Conversation
|
||
Hash::Sha256(simple_hash_from_byte_vectors(fields_bytes)) | ||
} | ||
} | ||
|
||
fn bytes_enc(bytes: &[u8]) -> Vec<u8> { | ||
let mut chain_id_enc = vec![]; | ||
prost_amino::encode_length_delimiter(bytes.len(), &mut chain_id_enc).unwrap(); |
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.
The problem was here: we length-encoded even zero length bytes. In this particular case the app_hash
.
ea9cd4e
to
454fc00
Compare
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.
Great stuff @liamsi!
I took the liberty of pushing a commit that deduplicates the header hashing code in the light-client
crate by just calling to the tender mint::lite::types::Header::hash
method. We will want to revisit where such code lives as part of #437 but for now it seems okay to me to leave it in the Header
trait.
Thanks @romac! I Forgot that this was copied over. The deduplication should probably go in the other direction (into the light-client crate) but it makes sense to have only one tested and working implementation in place 👍 |
closes #436