Skip to content

Commit

Permalink
Requested PR changes for #18
Browse files Browse the repository at this point in the history
  • Loading branch information
BGluth committed Feb 16, 2024
1 parent e22b8e0 commit 51a306e
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions trace_decoder/src/decoding.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::{
collections::HashMap,
fmt::{self, Display, Formatter},
iter::{self, empty, once},
iter::once,
};

use ethereum_types::{Address, H256, U256};
Expand All @@ -20,8 +20,7 @@ use crate::{
processed_block_trace::{NodesUsedByTxn, ProcessedBlockTrace, StateTrieWrites, TxnMetaState},
types::{
HashedAccountAddr, HashedNodeAddr, HashedStorageAddrNibbles, OtherBlockData, TrieRootHash,
TxnIdx, TxnProofGenIR, EMPTY_ACCOUNT_BYTES_RLPED, EMPTY_TRIE_HASH,
ZERO_STORAGE_SLOT_VAL_RLPED,
TxnIdx, TxnProofGenIR, EMPTY_ACCOUNT_BYTES_RLPED, ZERO_STORAGE_SLOT_VAL_RLPED,
},
utils::{hash, update_val_if_some},
};
Expand Down Expand Up @@ -369,10 +368,7 @@ impl ProcessedBlockTrace {
// If we have no actual dummy proofs, then we create one and append it to the
// end of the block.
false => {
// Guaranteed to have a real txn.
let txn_idx_of_dummy_entry =
txn_ir.last().unwrap().txn_number_before.low_u64() as usize + 1;

// TODO: Decide if we want this allocation...
// To avoid double hashing the addrs, but I don't know if the extra `Vec`
// allocation is worth it.
let withdrawals_with_hashed_addrs: Vec<_> =
Expand Down Expand Up @@ -562,10 +558,10 @@ fn create_dummy_gen_input_common(
}

fn create_dummy_proof_trie_inputs(
final_trie_state: &PartialTrieState,
final_tries_at_end_of_block: &PartialTrieState,
state_trie: HashedPartialTrie,
) -> TrieInputs {
let partial_sub_storage_tries: Vec<_> = final_trie_state
let partial_sub_storage_tries: Vec<_> = final_tries_at_end_of_block
.storage
.iter()
.map(|(hashed_acc_addr, s_trie)| {
Expand All @@ -578,8 +574,12 @@ fn create_dummy_proof_trie_inputs(

TrieInputs {
state_trie,
transactions_trie: create_fully_hashed_out_sub_partial_trie(&final_trie_state.txn),
receipts_trie: create_fully_hashed_out_sub_partial_trie(&final_trie_state.receipt),
transactions_trie: create_fully_hashed_out_sub_partial_trie(
&final_tries_at_end_of_block.txn,
),
receipts_trie: create_fully_hashed_out_sub_partial_trie(
&final_tries_at_end_of_block.receipt,
),
storage_tries: partial_sub_storage_tries,
}
}
Expand Down

0 comments on commit 51a306e

Please sign in to comment.