-
Notifications
You must be signed in to change notification settings - Fork 320
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
rework transaction EffectHash
#2943
Conversation
EffectHash
EffectHash
7f0b8dc
to
8775065
Compare
EffectHash
EffectHash
|
83f2408
to
227d1dd
Compare
effect_hash = BLAKE2b-512(len(type_url) || type_url || proto_encode(proto)) | ||
``` |
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.
Might want to specify how the length is encoded
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 all fine and dandy
let personalization = TransactionBody::TYPE_URL; | ||
|
||
let mut state = blake2b_simd::State::new(); | ||
let length = personalization.len() as u64; | ||
state.update(&length.to_le_bytes()); | ||
state.update(personalization.as_bytes()); |
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 we factor this into a common method?
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.
Aesthetically I think it'd be nice if this used a u16 length for compactness but I'm not sure that that's actually a good idea. Probably best to not have to worry about the length.
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.
(Probably not important to block merging on this)
Closes #2808
Adds a section of documentation on transaction signing which describe the changes made in this PR