Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 2 commits into from
Oct 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions crates/engine/invalid-block-hooks/src/witness.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
7 changes: 2 additions & 5 deletions crates/rpc/rpc-api/src/debug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
21 changes: 5 additions & 16 deletions crates/rpc/rpc/src/debug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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(),
Expand All @@ -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());
}
}
}
Expand All @@ -676,7 +666,7 @@ where
Ok(ExecutionWitness {
state: HashMap::from_iter(state.into_iter()),
codes,
keys: include_preimages.then_some(keys),
keys: Some(keys),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will change alloy definition later since we always wants keys

})
})
.await
Expand Down Expand Up @@ -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`
Expand Down
Loading