Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
152 commits
Select commit Hold shift + click to select a range
94fb3e3
add indexdb
xqft Jan 14, 2025
2847cf8
rename InnerIndexDB to AuxIndexDB
xqft Jan 14, 2025
89ba179
add IndexDBError
xqft Jan 15, 2025
f5192c4
change Revm EVM error to ours
xqft Jan 15, 2025
9616b7d
replace from_exec impl with indexdb
xqft Jan 15, 2025
9d97192
Merge branch 'main' into l2/touched_state
xqft Jan 15, 2025
253ab7f
WIP add PreExecDB
xqft Jan 17, 2025
966706e
WIP add proofs in from_store()
xqft Jan 17, 2025
2135a08
WIP remove internal mutability
xqft Jan 17, 2025
eabd6a3
refactor
xqft Jan 17, 2025
9ffbc44
replace PreExecDB with CacheDB
xqft Jan 17, 2025
a308649
nits
xqft Jan 20, 2025
b0d214f
fix filter
xqft Jan 20, 2025
1b64809
add nonce and balance validations during pre-exec
xqft Jan 20, 2025
dd75353
put proofs inside executiondb
xqft Jan 20, 2025
389ddab
fix errors
xqft Jan 20, 2025
fec82ef
remove optiona_balance_check feature
xqft Jan 20, 2025
0405835
remove unused errors
xqft Jan 20, 2025
987e359
fix filter
xqft Jan 20, 2025
4a0a715
add db verification
xqft Jan 20, 2025
eb98e53
remove unused imports
xqft Jan 20, 2025
892060a
update sp1 prover
xqft Jan 20, 2025
d9aee43
Merge branch 'main' into l2/touched_state
xqft Jan 20, 2025
6f2169c
remove revm types
xqft Jan 21, 2025
d0669bf
add bench crate
xqft Jan 13, 2025
321d260
make a blocking rpc client
xqft Jan 21, 2025
76c5cff
create ToExecDB trait
xqft Jan 22, 2025
fdf6d9f
remove unnecessary store_wrapper
xqft Jan 22, 2025
297b7f4
WIP optimizing rpc db
xqft Jan 23, 2025
6a7c60c
cache storage
xqft Jan 23, 2025
c18e753
add timeout and retry
xqft Jan 23, 2025
e5f9876
update cargo lock
xqft Jan 23, 2025
b8c953e
remove blocking rpc
xqft Jan 24, 2025
f84063e
refactor rpc
xqft Jan 24, 2025
664804d
add storageAt request
xqft Jan 24, 2025
de11b0a
fix access list
xqft Jan 24, 2025
90d71a4
fetch latest block number
xqft Jan 24, 2025
99938c0
reqwest optimizations
xqft Jan 24, 2025
c7c6100
convert to exec db
xqft Jan 27, 2025
e918786
refactor retry logic
xqft Jan 27, 2025
ca13ac0
remove max retries
xqft Jan 27, 2025
d75f543
write db to file
xqft Jan 27, 2025
0ca8b8b
remove unnecesary nodes
xqft Jan 27, 2025
9133af8
add bincode
xqft Jan 27, 2025
e29975c
use rpc cache approach
xqft Jan 27, 2025
e99df38
remove use
xqft Jan 27, 2025
6e4e9ff
rewrite verify_db fn'
xqft Jan 28, 2025
119304e
cache block hashes
xqft Jan 28, 2025
d1d4aee
handle null storage values
xqft Jan 28, 2025
c4c2bc0
handle non-existing accounts
xqft Jan 29, 2025
0c35fcd
fix skipping an accounts proof
xqft Jan 29, 2025
3135fb7
Merge branch 'main' into l2/rpc_bench
xqft Jan 29, 2025
c5feb83
remove diff
xqft Jan 29, 2025
21e1d31
take into account non existing accounts
xqft Jan 30, 2025
86956e9
add potential child nodes, clean up
xqft Feb 4, 2025
753d2a2
add execute function to prover
xqft Feb 5, 2025
ef3a507
fix refcell borrow panics
xqft Feb 5, 2025
116a24f
process withdrawals with executiondb
xqft Feb 6, 2025
29abe57
fix beacon root call
xqft Feb 7, 2025
0a5979a
remove unused parameter
xqft Feb 7, 2025
b55abdd
add prove cli arg
xqft Feb 7, 2025
fda180f
better print in fetch
xqft Feb 7, 2025
97caa91
deactivate l2 feature in sp1
xqft Feb 7, 2025
cb38e96
refactor update tries
xqft Feb 7, 2025
2d577af
add missing imports
xqft Feb 7, 2025
8cd7710
add comments
xqft Feb 7, 2025
191cd87
remove unused dep
xqft Feb 7, 2025
ec38aeb
add cache
xqft Feb 7, 2025
e0a8074
update risc0 program
xqft Feb 7, 2025
7f64f16
Merge branch 'main' into l2/rpc_bench
xqft Feb 7, 2025
9025469
comment out gas
xqft Feb 7, 2025
a424818
fmt
xqft Feb 10, 2025
32da4e9
some clippy
xqft Feb 10, 2025
c078ba7
add timing
xqft Feb 10, 2025
2446201
update sp1
xqft Feb 10, 2025
21e2022
add makefile
xqft Feb 10, 2025
fae29b3
add env vars
xqft Feb 10, 2025
0718fe1
downgrade sp1
xqft Feb 10, 2025
b5c239e
add prove rules
xqft Feb 10, 2025
d639371
disable default features for core and vm
xqft Feb 10, 2025
79b3b7a
remove c-kzg dep from zkvm programs
xqft Feb 10, 2025
95fac58
fix imports
xqft Feb 10, 2025
e9173dc
fix elapsed time disp
xqft Feb 10, 2025
e560183
bump risc0
xqft Feb 10, 2025
febe737
add support for risc0
xqft Feb 10, 2025
075ac72
add block num env var
xqft Feb 10, 2025
77f88dc
remove exclusive compile err
xqft Feb 10, 2025
bc41c07
fix prev commit
xqft Feb 10, 2025
ec24436
fix cache deser
xqft Feb 10, 2025
7574ddd
Revert "fix cache deser"
xqft Feb 10, 2025
0838863
comment out requests_hash conditional serde
xqft Feb 10, 2025
0a4314f
bump sp1 version
xqft Feb 10, 2025
a86e66b
serialize into json
xqft Feb 11, 2025
58a741b
change file extension
xqft Feb 11, 2025
4c10ab7
create file
xqft Feb 11, 2025
71913fa
better final print
xqft Feb 11, 2025
8cc38b9
Merge branch 'main' into l2/rpc_bench
xqft Feb 11, 2025
603306f
Merge remote-tracking branch 'origin/main' into l2/rpc_bench
Oppen Feb 12, 2025
005f619
fix build (fails perf-sp1 and perf-risc0 tests)
Oppen Feb 12, 2025
9ae47e1
fix test build
Oppen Feb 12, 2025
e576b2b
fix beacon root call executing on perf_zkvm tests
xqft Feb 12, 2025
bf0779c
fix prover mode name
Oppen Feb 14, 2025
920d5a8
chore: update patches
Feb 18, 2025
eaac4a3
chore: update secp256k1
Feb 18, 2025
f4a2b48
add child nodes and exclusion proofs to executiondb from store
xqft Feb 19, 2025
732aeec
better comment for fn
xqft Feb 20, 2025
91d25d3
fix account final proofs
xqft Feb 20, 2025
0d35778
fix l2 feature not being applied in zkvm_interface crate
xqft Feb 20, 2025
5414090
fix clippy
xqft Feb 20, 2025
d7f5bfa
add todo
xqft Feb 20, 2025
6cf6925
Merge branch 'main' into l2/rpc_bench
xqft Feb 20, 2025
2317292
fix import
xqft Feb 20, 2025
d58b62c
Merge branch 'main' into l2/rpc_bench
xqft Feb 20, 2025
96bc842
use workspace deps in bench crate
xqft Feb 20, 2025
e7b94c8
remove unwrap
xqft Feb 20, 2025
05e22ff
fix imports on bench crate
xqft Feb 20, 2025
f9f7e43
fix bench
xqft Feb 20, 2025
f07971c
fix imports
xqft Feb 20, 2025
26fd4ac
use latest block num in rpc tests
xqft Feb 20, 2025
e8f5ac5
remove sp1 elf
xqft Feb 20, 2025
470283d
impl risc0 executor + fmt
xqft Feb 20, 2025
d40a55e
fix clippy
xqft Feb 20, 2025
a775640
Merge branch 'main' into l2/rpc_bench
xqft Feb 20, 2025
7bd85a0
fix imports
xqft Feb 20, 2025
613625b
fix import
xqft Feb 20, 2025
b6a0a67
fix clippy in build.rs
xqft Feb 20, 2025
8f8ec94
exclude clippy from bench crate
xqft Feb 20, 2025
0acbed9
skip zkvm program comp in clippy
xqft Feb 20, 2025
601066e
fix clippy on prover.rs
xqft Feb 20, 2025
75f2ead
exclude bench from test rule
xqft Feb 20, 2025
be5260b
uncomment requests_hash serde attribs
xqft Feb 20, 2025
00722d8
fix gitignore bench crate
xqft Feb 20, 2025
7e07a8d
fix bench crate name
xqft Feb 21, 2025
a7f68d7
serialize block to JSON
xqft Feb 21, 2025
8965541
chore: fix prover
Feb 21, 2025
8daa770
remove unused imports
xqft Feb 21, 2025
78eef55
Merge branch 'main' into l2/rpc_bench
xqft Feb 21, 2025
021ffc3
bump sp1 version
xqft Feb 21, 2025
e1bd02f
bump sp1 version
xqft Feb 21, 2025
d6cf9c3
Delete crates/l2/prover/zkvm/interface/sp1/.gitignore
xqft Feb 21, 2025
33bfb8d
replace cache by program input
xqft Feb 21, 2025
087b1eb
Revert "replace cache by program input"
xqft Feb 21, 2025
6877a61
Merge branch 'l2/fix_prover_requests_hash' into l2/rpc_bench
xqft Feb 21, 2025
a8b3447
serialize parent block header as json
xqft Feb 21, 2025
8cd4f42
Test
jrchatruc Feb 21, 2025
29d0ca9
Add L1 genesis for dev node (with Pectra disabled)
ilitteri Feb 24, 2025
0df02fb
Temporary disable Pectra in the L2
ilitteri Feb 24, 2025
5de4d37
Load dev L1 genesis
ilitteri Feb 24, 2025
aacfd2f
Revert "Test"
jrchatruc Feb 24, 2025
a3e701e
Merge branch 'temporary_fix' into l2/rpc_bench
jrchatruc Feb 24, 2025
a6cdb2f
Fix loadtest rlp file
jrchatruc Feb 24, 2025
64d81a0
fix perf_zkvm block to prove index
xqft Feb 24, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
rewrite verify_db fn'
  • Loading branch information
xqft committed Jan 28, 2025
commit 6e4e9ff0a17a0e46121f0f024d85b91cfa8b27cd
82 changes: 53 additions & 29 deletions crates/l2/prover/zkvm/interface/src/lib.rs
Original file line number Diff line number Diff line change
@@ -78,7 +78,10 @@ pub mod io {
pub mod trie {
use std::collections::HashMap;

use ethrex_core::{types::AccountState, Address, H160, H256, U256};
use ethrex_core::{
types::{AccountInfo, AccountState},
H160, U256,
};
use ethrex_rlp::{decode::RLPDecode, encode::RLPEncode, error::RLPDecodeError};
use ethrex_storage::{hash_address, hash_key, AccountUpdate};
use ethrex_trie::{Trie, TrieError};
@@ -102,42 +105,63 @@ pub mod trie {
state_trie: &Trie,
storage_tries: &HashMap<H160, Trie>,
) -> Result<bool, Error> {
for (address, account_info) in &db.accounts {
let storage_trie = storage_tries
.get(&address)
.ok_or(Error::MissingStorageTrie(*address))?;
let storage_root = storage_trie.hash_no_commit();

// verify account and storage trie are valid
let trie_account_state = match state_trie.get(&hash_address(&address)) {
// verifies that, for each stored account:
// 1. account is in state trie
// 2. account info (nonce, balance, code hash) is correct (the same as encoded in trie)
// 3. if there's any storage:
// 3.a. storage root is correct (the same as encoded in trie)
// 3.b. every value is in the storage trie
// 3.c. every value is correct (the same as encoded in trie)
for (address, db_account_info) in &db.accounts {
// 1. account is in state trie
let trie_account_state = match state_trie.get(&hash_address(address)) {
Ok(Some(encoded_state)) => AccountState::decode(&encoded_state)?,
Ok(None) | Err(TrieError::InconsistentTree) => return Ok(false), // account not in trie
Ok(None) | Err(TrieError::InconsistentTree) => {
return Ok(false);
}
Err(err) => return Err(err.into()),
};
let db_account_state = AccountState {
nonce: account_info.nonce,
balance: account_info.balance,
code_hash: account_info.code_hash,
storage_root,
let trie_account_info = AccountInfo {
nonce: trie_account_state.nonce,
balance: trie_account_state.balance,
code_hash: trie_account_state.code_hash,
};
if db_account_state != trie_account_state {

// 2. account info is correct
if db_account_info != &trie_account_info {
return Ok(false);
}

// verify storage
for (key, db_value) in db
.storage
.get(address)
.ok_or(Error::StorageNotFound(*address))?
{
let trie_value = match storage_trie.get(&hash_key(key)) {
Ok(Some(encoded)) => U256::decode(&encoded)?,
Ok(None) | Err(TrieError::InconsistentTree) => return Ok(false), // value not in trie
Err(err) => return Err(err.into()),
};
if *db_value != trie_value {
return Ok(false);
// 3. if there's any storage
match db.storage.get(address) {
Some(storage) if !storage.is_empty() => {
let storage_trie = storage_tries
.get(address)
.ok_or(Error::MissingStorageTrie(*address))?;
let storage_root = storage_trie.hash_no_commit();

// 3.a. storage root is correct
if storage_root != trie_account_state.storage_root {
return Ok(false);
}

for (key, db_value) in storage {
// 3.b. every value is in storage trie
let trie_value = match storage_trie.get(&hash_key(key)) {
Ok(Some(encoded)) => U256::decode(&encoded)?,
Ok(None) | Err(TrieError::InconsistentTree) => {
return Ok(false);
}
Err(err) => return Err(err.into()),
};

// 3.c. every value is correct
if db_value != &trie_value {
return Ok(false);
}
}
}
_ => {}
}
}