Skip to content

Commit

Permalink
Merge pull request #33 from xJonathanLEI/dev/assert_state_root
Browse files Browse the repository at this point in the history
chore: resume state root assertion
  • Loading branch information
puma314 authored Aug 27, 2024
2 parents 6699f67 + 4616281 commit fc424d5
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 13 deletions.
6 changes: 1 addition & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ A minimal implementation of generating zero-knowledge proofs of EVM block execut

> [!CAUTION]
>
> This repository is still an active work-in-progress and is not audited or meant for production usage. In particular, there are some edge cases in Ethereum state root computation due to complications with the Merkle Patricia Trie (MPT) that result in the state root computation being slightly incorrect (we're actively working on fixing this). However, the prover time should still be an accurate estimate of proving costs in practice.
> This repository is still an active work-in-progress and is not audited or meant for production usage.
## Getting Started

Expand Down Expand Up @@ -145,10 +145,6 @@ cd ./bin/client-op
cargo prove build --ignore-rust-version
```

**Why does the program say "The state root doesn't match"?**

As mentioned in the introduction, this repository is still a work in progress and some edge cases in the Ethereum MPT result in the state root computation being slightly incorrect for certain blocks. We're actively working on fixing this, but running these client programs on Ethereum and Optimism blocks still provides a very good estimate of realistic cycle count and proving workloads.

**What are good testing blocks**

A good small block to test on for Ethereum mainnet is: `20526624`.
5 changes: 1 addition & 4 deletions crates/executor/client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,7 @@ impl ClientExecutor {
rsp_mpt::compute_state_root(&executor_outcome, &input.dirty_storage_proofs, &witness_db)
})?;
if state_root != input.current_block.state_root {
// TODO: comment this check back in, but leaving it out for now so that we can
// get rough cycle counts.
println!("The state root doesn't match.");
// eyre::bail!("mismatched state root");
eyre::bail!("mismatched state root");
}

// Derive the block header.
Expand Down
5 changes: 1 addition & 4 deletions crates/executor/host/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,7 @@ impl<T: Transport + Clone, P: Provider<T> + Clone> HostExecutor<T, P> {
let state_root =
rsp_mpt::compute_state_root(&executor_outcome, &dirty_storage_proofs, &rpc_db)?;
if state_root != current_block.state_root {
// TODO: comment this check back in, but leaving it out for now so that we can
// get rough cycle counts.
println!("The state root doesn't match.");
// eyre::bail!("mismatched state root");
eyre::bail!("mismatched state root");
}

// Derive the block header.
Expand Down

0 comments on commit fc424d5

Please sign in to comment.