Skip to content
This repository has been archived by the owner on Jul 5, 2024. It is now read-only.

Commit

Permalink
Fix review suggestions from @ed255
Browse files Browse the repository at this point in the history
- Renames ResultGethExecTraces and ResultGethExecTrace.
- Fix `From<GethExecStep` impl for `GethExecStepInternal`.

Co-authored-by: Eduard S. eduardsanou@posteo.net
  • Loading branch information
CPerezz committed Nov 17, 2021
1 parent c8f9513 commit 1df58d8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 16 deletions.
21 changes: 6 additions & 15 deletions bus-mapping/src/eth_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,28 +183,19 @@ impl From<GethExecStep> for GethExecStepInternal {
.stack
.0
.iter()
.map(|stack_elem| {
DebugU256::from_big_endian(&stack_elem.to_be_bytes())
})
.map(|stack_elem| DebugU256(stack_elem.0))
.collect(),
memory: step
.memory
.0
.iter()
.map(|mem_elem| {
DebugU256::from_big_endian(&mem_elem.to_be_bytes())
})
.chunks(32)
.map(|word| DebugU256::from_big_endian(word))
.collect(),
storage: step
.storage
.0
.iter()
.map(|(k, v)| {
(
DebugU256::from_big_endian(&k.to_be_bytes()),
DebugU256::from_big_endian(&v.to_be_bytes()),
)
})
.map(|(k, v)| (DebugU256(k.0), DebugU256(v.0)))
.collect(),
}
}
Expand Down Expand Up @@ -257,13 +248,13 @@ impl<'de> Deserialize<'de> for GethExecStep {
/// `debug_traceBlockByHash` and `debug_traceBlockByNumber` Geth JSON-RPC calls.
#[derive(Clone, Debug, Eq, PartialEq, Deserialize, Serialize)]
#[doc(hidden)]
pub(crate) struct ResultGethExecTrace(pub(crate) Vec<ResultGethExecStep>);
pub(crate) struct ResultGethExecTraces(pub(crate) Vec<ResultGethExecTrace>);

/// Helper type built to deal with the weird `result` field added between `GethExecutionTrace`s in
/// `debug_traceBlockByHash` and `debug_traceBlockByNumber` Geth JSON-RPC calls.
#[derive(Clone, Debug, Eq, PartialEq, Deserialize, Serialize)]
#[doc(hidden)]
pub(crate) struct ResultGethExecStep {
pub(crate) struct ResultGethExecTrace {
pub(crate) result: GethExecTrace,
}

Expand Down
2 changes: 1 addition & 1 deletion bus-mapping/src/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ impl<P: JsonRpcClient> GethClient<P> {
block_num: BlockNumber,
) -> Result<Vec<GethExecTrace>, Error> {
let num = block_num.serialize();
let resp: ResultGethExecTrace = self
let resp: ResultGethExecTraces = self
.0
.request("debug_traceBlockByNumber", [num])
.await
Expand Down

0 comments on commit 1df58d8

Please sign in to comment.