-
Notifications
You must be signed in to change notification settings - Fork 1.5k
feat: add stateless crate to expose stateless validation #15591
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
base: main
Are you sure you want to change the base?
Conversation
… `run` instead of checking for an empty output
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.
supportive,
some (pedantic) nits
for rlp_encoded in &witness.codes { | ||
let hash = keccak256(rlp_encoded); | ||
bytecode.insert(hash, Bytecode::new_raw(rlp_encoded.clone())); | ||
} |
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.
https://github.com/paradigmxyz/reth/pull/15591/files#r2040307201
same can be said about the bytecodes. there is no validation that all the bytecodes have corresponding leaves in the witness
Err(StatelessValidationError::PreStateRootMismatch { | ||
got: computed_root, | ||
expected: pre_state_root, | ||
}) |
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.
due to how reveal_witness
works, i think this is a noop
@@ -0,0 +1,42 @@ | |||
[package] |
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.
you'd want to make this crate no-std
compatible if it's intended to be run on risc v
// TODO: use Vec instead -- ancestors should be contiguous | ||
// TODO: so we can use the current_block_number and an offset to | ||
// TODO: get the block number of a particular ancestor |
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.
would getting rid of extra key hashing matter to the prover?
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.
I think it needs to be benchmarked first
trace!(target: "reth-stateless::evm", %address, %hashed_address, "retrieving account"); | ||
let Some(bytes) = self.trie.get_account_value(&hashed_address) else { | ||
trace!(target: "reth-stateless::evm", %address, %hashed_address, "no account found"); | ||
return Ok(None) |
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.
here we should prove that the leaf is indeed not present in the trie. currently, this might lead to invalid execution due to partial witness
if let Some(value) = self.trie.get_storage_slot_value(&hashed_address, &hashed_slot) { | ||
U256::decode(&mut value.as_slice())? | ||
} else { | ||
U256::ZERO |
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.
same here re non-existent leaf vs partial witness
b5871a1
to
5ed0fdf
Compare
This PR adds a method to stateless verify a block, given the ExecutionWitness and ancestor headers.