Skip to content

Commit

Permalink
Query the block hashes only once
Browse files Browse the repository at this point in the history
  • Loading branch information
wborgeaud committed Jan 29, 2024
1 parent 1abe45e commit 78f80f9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion leader/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,8 @@ pub async fn gather_witness(tx: TxHash, provider: &Provider<Http>) -> Result<Vec
} else {
vec![]
};
// Block hashes
let block_hashes = get_block_hashes(block_number.into(), provider).await?;

let mut storage_mpts: HashMap<_, _> = storage_mpts
.iter()
Expand Down Expand Up @@ -415,7 +417,7 @@ pub async fn gather_witness(tx: TxHash, provider: &Provider<Http>) -> Result<Vec
withdrawals,
contract_code: contract_codes.clone(),
block_metadata: block_metadata.clone(),
block_hashes: get_block_hashes(block_number.into(), provider).await?,
block_hashes: block_hashes.clone(),
gas_used_before: gas_used,
gas_used_after: gas_used + receipt.gas_used.unwrap(),
checkpoint_state_trie_root: prev_block.state_root, // TODO: make it configurable
Expand Down

0 comments on commit 78f80f9

Please sign in to comment.