Skip to content

Commit

Permalink
Rename unwrap_flatten to unwrap_flat
Browse files Browse the repository at this point in the history
  • Loading branch information
slowli committed Sep 25, 2024
1 parent d477673 commit eee094c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 18 deletions.
26 changes: 9 additions & 17 deletions core/lib/types/src/api/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -754,21 +754,17 @@ pub enum CallTracerBlockResult {
}

impl CallTracerBlockResult {
pub fn unwrap_flatten(self) -> Vec<DebugCallFlat> {
pub fn unwrap_flat(self) -> Vec<DebugCallFlat> {
match self {
Self::CallTrace(_) => {
panic!("Result is a FlatCallTrace")
}
Self::FlatCallTrace(a) => a,
Self::CallTrace(_) => panic!("Result is a FlatCallTrace"),
Self::FlatCallTrace(trace) => trace,
}
}

pub fn unwrap_default(self) -> Vec<ResultDebugCall> {
match self {
Self::CallTrace(a) => a,
Self::FlatCallTrace(_) => {
panic!("Result is a CallTrace")
}
Self::CallTrace(trace) => trace,
Self::FlatCallTrace(_) => panic!("Result is a CallTrace"),
}
}
}
Expand All @@ -783,19 +779,15 @@ pub enum CallTracerResult {
impl CallTracerResult {
pub fn unwrap_flat(self) -> Vec<DebugCallFlat> {
match self {
Self::CallTrace(_) => {
panic!("Result is a FlatCallTrace")
}
Self::FlatCallTrace(a) => a,
Self::CallTrace(_) => panic!("Result is a FlatCallTrace"),
Self::FlatCallTrace(trace) => trace,
}
}

pub fn unwrap_default(self) -> DebugCall {
match self {
Self::CallTrace(a) => a,
Self::FlatCallTrace(_) => {
panic!("Result is a CallTrace")
}
Self::CallTrace(trace) => trace,
Self::FlatCallTrace(_) => panic!("Result is a CallTrace"),
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion core/node/api_server/src/web3/tests/debug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ impl HttpTest for TraceBlockFlatTest {
}),
)
.await?
.unwrap_flatten();
.unwrap_flat();

// A transaction with 2 nested calls will convert into 3 Flattened calls.
// Also in this test, all tx have the same # of nested calls
Expand Down

0 comments on commit eee094c

Please sign in to comment.