Skip to content

Commit

Permalink
Update based on comment
Browse files Browse the repository at this point in the history
  • Loading branch information
0x00101010 committed Sep 24, 2024
1 parent 83177bc commit 91e2557
Showing 1 changed file with 1 addition and 93 deletions.
94 changes: 1 addition & 93 deletions crates/rpc/rpc/src/debug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,7 @@ where
let mut keys = HashMap::new();
let _ = block_executor
.execute_with_state_witness(
(&block.clone().unseal(), block.difficulty).into(),
(&block.unseal(), block.difficulty).into(),
|statedb| {
for (address, account) in &statedb.cache.accounts {
let hashed_address = keccak256(address);
Expand Down Expand Up @@ -667,98 +667,6 @@ where
let state =
state_provider.witness(Default::default(), hashed_state).map_err(Into::into)?;
Ok(ExecutionWitness { state, keys: include_preimages.then_some(keys) })
// let evm_config = Call::evm_config(this.eth_api()).clone();
// let mut db =
// StateBuilder::new().with_database(StateProviderDatabase::new(state)).build();

// pre_block_beacon_root_contract_call(
// &mut db,
// &evm_config,
// &this.inner.provider.chain_spec(),
// &cfg,
// &block_env,
// block.parent_beacon_block_root,
// )
// .map_err(|err| EthApiError::Internal(err.into()))?;

// // apply eip-2935 blockhashes update
// pre_block_blockhashes_contract_call(
// &mut db,
// &evm_config,
// &this.inner.provider.chain_spec(),
// &cfg,
// &block_env,
// block.parent_hash,
// )
// .map_err(|err| EthApiError::Internal(err.into()))?;

// // Re-execute all of the transactions in the block to load all touched accounts
// into // the cache DB.
// for tx in block.into_transactions_ecrecovered() {
// let env = EnvWithHandlerCfg {
// env: Env::boxed(
// cfg.cfg_env.clone(),
// block_env.clone(),
// evm_config.tx_env(&tx),
// ),
// handler_cfg: cfg.handler_cfg,
// };

// let (res, _) = this.inner.eth_api.transact(&mut db, env)?;
// db.commit(res.state);
// }

// // No need to merge transitions and create the bundle state, we will use Revm's
// // cache directly.

// // Initialize a map of preimages.
// let mut state_preimages = HashMap::new();

// // Grab all account proofs for the data accessed during block execution.
// //
// // Note: We grab *all* accounts in the cache here, as the `BundleState` prunes
// // referenced accounts + storage slots. Cache is a superset of `BundleState`, so
// we // can just query it to get the latest state of all accounts
// and storage slots. let mut hashed_state =
// HashedPostState::default(); for (address, account) in
// db.cache.accounts { let hashed_address = keccak256(address);
// hashed_state.accounts.insert(
// hashed_address,
// account.account.as_ref().map(|a| a.info.clone().into()),
// );

// let storage = hashed_state
// .storages
// .entry(hashed_address)
// .or_insert_with(|| HashedStorage::new(account.status.was_destroyed()));

// if let Some(account) = account.account {
// if include_preimages {
// state_preimages
// .insert(hashed_address, alloy_rlp::encode(address).into());
// }

// for (slot, value) in account.storage {
// let slot = B256::from(slot);
// let hashed_slot = keccak256(slot);
// storage.storage.insert(hashed_slot, value);

// if include_preimages {
// state_preimages.insert(hashed_slot,
// alloy_rlp::encode(slot).into()); }
// }
// }
// }

// // Generate an execution witness for the aggregated state of accessed accounts.
// // Destruct the cache database to retrieve the state provider.
// let state_provider = db.database.into_inner();
// let state =
// state_provider.witness(Default::default(),
// hashed_state).map_err(Into::into)?;

// Ok(ExecutionWitness { state, keys: include_preimages.then_some(state_preimages)
// })
})
.await
}
Expand Down

0 comments on commit 91e2557

Please sign in to comment.