Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 3 additions & 3 deletions .github/workflows/pr_perf_blocks_exec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
id: cache
with:
path: bin/ethrex-${{ matrix.branch }}
key: binary-${{ github.event.pull_request[matrix.branch].sha }}
key: binary-${{ matrix.branch }}-${{ github.run_id }}-${{ github.run_attempt }}

- name: Checkout sources
uses: actions/checkout@v4
Expand Down Expand Up @@ -67,13 +67,13 @@ jobs:
uses: actions/cache/restore@v3
with:
path: bin/ethrex-base
key: binary-${{ github.event.pull_request.base.sha }}
key: binary-base-${{ github.run_id }}-${{ github.run_attempt }}

- name: Fetch HEAD binary
uses: actions/cache/restore@v3
with:
path: bin/ethrex-head
key: binary-${{ github.event.pull_request.head.sha }}
key: binary-head-${{ github.run_id }}-${{ github.run_attempt }}

- name: Benchmark against main
id: run-benchmarks
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

### 2025-11-12

- Only mark individual values as dirty instead of the whole trie [#5282](https://github.com/lambdaclass/ethrex/pull/5282)
- Separate Account and storage Column families in rocksdb [#5055](https://github.com/lambdaclass/ethrex/pull/5055)
- Avoid copying while reading account code [#5289](https://github.com/lambdaclass/ethrex/pull/5289)
- Cache `BLOBBASEFEE` opcode value [#5288](https://github.com/lambdaclass/ethrex/pull/5288)
Expand Down
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions crates/common/trie/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ smallvec = { version = "1.10.0", features = ["const_generics", "union"] }
digest = "0.10.6"
lazy_static.workspace = true
crossbeam.workspace = true
rustc-hash.workspace = true

[features]
default = []
Expand Down
27 changes: 13 additions & 14 deletions crates/common/trie/trie.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ use ethereum_types::H256;
use ethrex_crypto::keccak::keccak_hash;
use ethrex_rlp::constants::RLP_NULL;
use ethrex_rlp::encode::RLPEncode;
use std::collections::{BTreeMap, HashSet};
use rustc_hash::FxHashSet;
use std::collections::BTreeMap;
use std::sync::{Arc, Mutex};

pub use self::db::{InMemoryTrieDB, TrieDB};
Expand Down Expand Up @@ -52,8 +53,8 @@ pub type TrieNode = (Nibbles, NodeRLP);
pub struct Trie {
db: Box<dyn TrieDB>,
pub root: NodeRef,
pending_removal: HashSet<Nibbles>,
dirty: bool,
pending_removal: FxHashSet<Nibbles>,
dirty: FxHashSet<Nibbles>,
}

impl Default for Trie {
Expand All @@ -68,8 +69,8 @@ impl Trie {
Self {
db,
root: NodeRef::default(),
pending_removal: HashSet::new(),
dirty: false,
pending_removal: Default::default(),
dirty: Default::default(),
}
}

Expand All @@ -82,8 +83,8 @@ impl Trie {
} else {
Default::default()
},
pending_removal: HashSet::new(),
dirty: false,
pending_removal: Default::default(),
dirty: Default::default(),
}
}

Expand All @@ -99,7 +100,7 @@ impl Trie {
pub fn get(&self, pathrlp: &PathRLP) -> Result<Option<ValueRLP>, TrieError> {
let path = Nibbles::from_bytes(pathrlp);

if pathrlp.len() == 32 && !self.dirty && self.db().flatkeyvalue_computed(path.clone()) {
if !self.dirty.contains(&path) && self.db().flatkeyvalue_computed(path.clone()) {
let Some(value_rlp) = self.db.get(path)? else {
return Ok(None);
};
Expand Down Expand Up @@ -128,7 +129,7 @@ impl Trie {
pub fn insert(&mut self, path: PathRLP, value: ValueRLP) -> Result<(), TrieError> {
let path = Nibbles::from_bytes(&path);
self.pending_removal.remove(&path);
self.dirty = true;
self.dirty.insert(path.clone());

if self.root.is_valid() {
// If the trie is not empty, call the root node's insertion logic.
Expand All @@ -150,13 +151,11 @@ impl Trie {
/// Remove a value from the trie given its RLP-encoded path.
/// Returns the value if it was succesfully removed or None if it wasn't part of the trie
pub fn remove(&mut self, path: &PathRLP) -> Result<Option<ValueRLP>, TrieError> {
self.dirty.insert(Nibbles::from_bytes(path));
if !self.root.is_valid() {
return Ok(None);
}
if path.len() == 32 {
self.pending_removal.insert(Nibbles::from_bytes(path));
}
self.dirty = true;
self.pending_removal.insert(Nibbles::from_bytes(path));

// If the trie is not empty, call the root node's removal logic.
let (is_trie_empty, value) = self
Expand Down Expand Up @@ -281,7 +280,7 @@ impl Trie {
if self.root.is_valid() {
let encoded_root = self.get_root_node(Nibbles::default())?.encode_to_vec();

let mut node_path = HashSet::new();
let mut node_path: FxHashSet<_> = Default::default();
for path in paths {
let mut nodes = self.get_proof(path)?;
nodes.swap_remove(0);
Expand Down
1 change: 1 addition & 0 deletions crates/l2/prover/src/guest_program/src/risc0/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions crates/l2/prover/src/guest_program/src/sp1/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions crates/l2/tee/quote-gen/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

50 changes: 23 additions & 27 deletions tooling/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.