-
Notifications
You must be signed in to change notification settings - Fork 298
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
Add blockhash opcode #1208
Add blockhash opcode #1208
Conversation
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 great!
// stack: cur_block_number, block_number, retdest | ||
DUP1 DUP3 %increment GT %jumpi(zero_hash) // if block_number >= cur_block_number | ||
// stack: cur_block_number, block_number, retdest | ||
DUP2 PUSH 256 ADD |
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.
This should be an addition with an overflow check.
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.
As mentioned in the following comments, I left this as is and added the overflow check on block_number
directly.
f7a9157
to
9a06fc9
Compare
This PR implements the BLOCKHASH opcode, following @wborgeaud's second suggestion in this issue. It includes links between proofs, a couple of unit tests and the challenger observing the additional public values (the previous and current block hashes).
closes #1173