-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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 an interger overflow in message_proof when looking beyond genesis #1392
Changes from 4 commits
33a425d
04fa978
0f122dd
df4a08a
14bc8ff
01faab2
3b01f04
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -205,7 +205,12 @@ pub fn message_proof<T: MessageProofData + ?Sized>( | |
None => return Ok(None), | ||
}; | ||
|
||
let verifiable_commit_block_height = *commit_block_header.height() - 1u32.into(); | ||
let block_heigth = *commit_block_header.height(); | ||
if block_heigth == 0u32.into() { | ||
xgreenx marked this conversation as resolved.
Show resolved
Hide resolved
|
||
// Cannot look beyond the genesis block | ||
return Ok(None) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe it is better to return an error?=) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I understood that // TODO: Do we want to return `Option` here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, I left this question=D I don't know why we want to return |
||
} | ||
let verifiable_commit_block_height = block_heigth - 1u32.into(); | ||
xgreenx marked this conversation as resolved.
Show resolved
Hide resolved
|
||
let block_proof = database.block_history_proof( | ||
message_block_header.height(), | ||
&verifiable_commit_block_height, | ||
|
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.
Hmm, actually, you should be able to use Genesis Block to generate proofs, but because it is a specific use case, we need to define how we want to do that and what the proof should look like.
It is not related to this PR and should be solved during #816