diff --git a/evm/Cargo.toml b/evm/Cargo.toml index 7c179318..1327635d 100644 --- a/evm/Cargo.toml +++ b/evm/Cargo.toml @@ -7,7 +7,7 @@ edition = "2021" [dependencies] plonky2 = { path = "../plonky2", default-features = false, features = ["rand", "timing"] } plonky2_util = { path = "../util" } -eth_trie_utils = "0.2.1" +eth_trie_utils = "0.3.1" anyhow = "1.0.40" env_logger = "0.9.0" ethereum-types = "0.14.0" diff --git a/evm/src/cpu/kernel/tests/mpt/insert.rs b/evm/src/cpu/kernel/tests/mpt/insert.rs index 35ab6e80..c92a7e62 100644 --- a/evm/src/cpu/kernel/tests/mpt/insert.rs +++ b/evm/src/cpu/kernel/tests/mpt/insert.rs @@ -142,7 +142,7 @@ fn mpt_insert_branch_to_leaf_same_key() -> Result<()> { /// Note: The account's storage_root is ignored, as we can't insert a new storage_root without the /// accompanying trie data. An empty trie's storage_root is used instead. -fn test_state_trie(state_trie: PartialTrie, k: Nibbles, mut account: AccountRlp) -> Result<()> { +fn test_state_trie(mut state_trie: PartialTrie, k: Nibbles, mut account: AccountRlp) -> Result<()> { assert_eq!(k.count, 64); // Ignore any storage_root; see documentation note. @@ -207,8 +207,8 @@ fn test_state_trie(state_trie: PartialTrie, k: Nibbles, mut account: AccountRlp) ); let hash = H256::from_uint(&interpreter.stack()[0]); - let updated_trie = state_trie.insert(k, rlp::encode(&account).to_vec()); - let expected_state_trie_hash = updated_trie.calc_hash(); + state_trie.insert(k, rlp::encode(&account).to_vec()); + let expected_state_trie_hash = state_trie.calc_hash(); assert_eq!(hash, expected_state_trie_hash); Ok(()) diff --git a/evm/src/generation/mpt.rs b/evm/src/generation/mpt.rs index 4107b978..a5be1205 100644 --- a/evm/src/generation/mpt.rs +++ b/evm/src/generation/mpt.rs @@ -109,7 +109,7 @@ pub(crate) fn mpt_prover_inputs_state_trie( prover_inputs.push(U256::zero()); // value_present = 0 for (i, child) in children.iter().enumerate() { - let extended_key = key.merge(&Nibbles { + let extended_key = key.merge_nibbles(&Nibbles { count: 1, packed: i.into(), }); @@ -124,7 +124,7 @@ pub(crate) fn mpt_prover_inputs_state_trie( PartialTrie::Extension { nibbles, child } => { prover_inputs.push(nibbles.count.into()); prover_inputs.push(nibbles.packed); - let extended_key = key.merge(nibbles); + let extended_key = key.merge_nibbles(nibbles); mpt_prover_inputs_state_trie( child, extended_key,