Skip to content

Commit

Permalink
Add codes in execution witness return
Browse files Browse the repository at this point in the history
  • Loading branch information
0x00101010 committed Oct 3, 2024
1 parent 6b261db commit 33e7f51
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion crates/rpc/rpc/src/debug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -621,10 +621,18 @@ where

let mut hashed_state = HashedPostState::default();
let mut keys = HashMap::default();
let mut codes = HashMap::default();
let _ = block_executor
.execute_with_state_witness(
(&block.clone().unseal(), block.difficulty).into(),
|statedb| {
codes = statedb
.cache
.contracts
.iter()
.map(|(hash, code)| (*hash, code.bytes()))
.collect();

for (address, account) in &statedb.cache.accounts {
let hashed_address = keccak256(address);
hashed_state.accounts.insert(
Expand Down Expand Up @@ -667,7 +675,7 @@ where
state_provider.witness(Default::default(), hashed_state).map_err(Into::into)?;
Ok(ExecutionWitness {
state: HashMap::from_iter(state.into_iter()),
codes: Default::default(),
codes,
keys: include_preimages.then_some(keys),
})
})
Expand Down

0 comments on commit 33e7f51

Please sign in to comment.