-
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 random
value to block metadata and fix sys_prevrandao
#1207
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.
Thanks for implementing this! Looks great, but there's just one missing thing: block_random
is not set in set_block_metadata_target
.
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.
Should sys_prevrandao
be removed from syscall_stubs.asm
and put in (for example) metadata.asm
instead?
@@ -336,6 +346,9 @@ impl BlockMetadataTarget { | |||
builder.connect(bm0.block_timestamp, bm1.block_timestamp); | |||
builder.connect(bm0.block_number, bm1.block_number); | |||
builder.connect(bm0.block_difficulty, bm1.block_difficulty); | |||
for i in 0..8 { | |||
builder.connect(bm0.block_random[i], bm1.block_random[i]); |
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.
block_random
is connected here, but it isn't set in set_block_metadata_target
. This leads to a generators not run
error in a recursive proof.
@@ -10,11 +10,9 @@ global sys_blockhash: | |||
EXIT_KERNEL | |||
|
|||
// This is a temporary version that returns the block difficulty (i.e. the old version of this opcode). |
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.
Shouldn't this comment be deleted or updated?
# Conflicts: # evm/src/cpu/kernel/constants/global_metadata.rs # evm/src/get_challenges.rs # evm/src/proof.rs # evm/src/recursive_verifier.rs
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 good!
evm/tests/log_opcode.rs
Outdated
@@ -791,6 +793,7 @@ fn test_two_txn() -> anyhow::Result<()> { | |||
block_timestamp: 0x03e8.into(), | |||
block_number: 1.into(), | |||
block_difficulty: 0x020000.into(), | |||
block_random: H256::from_low_u64_le(0x020000), |
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.
tiny nit: we're using H256::from_uint(n.into())
in other places, though doesn't really matter.
See #1204 for details.