chore(rpc): remove include_preimage param on debug_execution_witness (#11466)

This commit is contained in:
Francis Li
2024-10-03 11:38:55 -07:00
committed by GitHub
parent b4d5adeeb1
commit ab06997986
3 changed files with 9 additions and 27 deletions

View File

@@ -170,12 +170,8 @@ where
if let Some(healthy_node_client) = &self.healthy_node_client {
// Compare the witness against the healthy node.
let healthy_node_witness = futures::executor::block_on(async move {
DebugApiClient::debug_execution_witness(
healthy_node_client,
block.number.into(),
true,
)
.await
DebugApiClient::debug_execution_witness(healthy_node_client, block.number.into())
.await
})?;
let healthy_path = self.save_file(

View File

@@ -140,11 +140,8 @@ pub trait DebugApi {
/// The first argument is the block number or block hash. The second argument is a boolean
/// indicating whether to include the preimages of keys in the response.
#[method(name = "executionWitness")]
async fn debug_execution_witness(
&self,
block: BlockNumberOrTag,
include_preimages: bool,
) -> RpcResult<ExecutionWitness>;
async fn debug_execution_witness(&self, block: BlockNumberOrTag)
-> RpcResult<ExecutionWitness>;
/// Sets the logging backtrace location. When a backtrace location is set and a log message is
/// emitted at that location, the stack of the goroutine executing the log statement will

View File

@@ -603,7 +603,6 @@ where
pub async fn debug_execution_witness(
&self,
block_id: BlockNumberOrTag,
include_preimages: bool,
) -> Result<ExecutionWitness, Eth::Error> {
let this = self.clone();
let block = this
@@ -622,6 +621,7 @@ 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(),
@@ -646,24 +646,14 @@ where
);
if let Some(account) = &account.account {
if include_preimages {
keys.insert(
hashed_address,
alloy_rlp::encode(address).into(),
);
}
keys.insert(hashed_address, address.to_vec().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 {
keys.insert(
hashed_slot,
alloy_rlp::encode(slot).into(),
);
}
keys.insert(hashed_slot, slot.into());
}
}
}
@@ -676,7 +666,7 @@ where
Ok(ExecutionWitness {
state: HashMap::from_iter(state.into_iter()),
codes,
keys: include_preimages.then_some(keys),
keys: Some(keys),
})
})
.await
@@ -974,10 +964,9 @@ where
async fn debug_execution_witness(
&self,
block: BlockNumberOrTag,
include_preimages: bool,
) -> RpcResult<ExecutionWitness> {
let _permit = self.acquire_trace_permit().await;
Self::debug_execution_witness(self, block, include_preimages).await.map_err(Into::into)
Self::debug_execution_witness(self, block).await.map_err(Into::into)
}
/// Handler for `debug_traceCall`