Skip to content

Commit 6231d8a

Browse files
committed
add testcase
Signed-off-by: jsvisa <delweng@gmail.com>
1 parent a6d51d3 commit 6231d8a

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

tests/it/geth.rs

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ use revm::{
1414
},
1515
DatabaseCommit,
1616
};
17-
use revm_inspectors::tracing::{MuxInspector, TracingInspector, TracingInspectorConfig};
17+
use revm_inspectors::tracing::{
18+
js::JsInspector, MuxInspector, TracingInspector, TracingInspectorConfig,
19+
};
1820

1921
#[test]
2022
fn test_geth_calltracer_logs() {
@@ -106,23 +108,28 @@ fn test_geth_calltracer_logs() {
106108
.geth_builder()
107109
.geth_call_traces(CallConfig::default().with_log(), res.result.gas_used());
108110

109-
// three subcalls
111+
// top-level call succeeded, no log and three subcalls
110112
assert_eq!(call_frame.calls.len(), 3);
111-
112-
// top-level call emitted one log
113113
assert_eq!(call_frame.logs.len(), 1);
114+
assert!(call_frame.error.is_none());
114115

115-
// first call failed, no logs
116+
// first subcall failed, and no logs
116117
assert!(call_frame.calls[0].logs.is_empty());
118+
assert!(call_frame.calls[0].error.is_some());
117119

118-
// second call failed, with a two nested subcalls that emitted logs, but none should be included
120+
// second subcall failed, with a two nested subcalls that emitted logs, but none should be
121+
// included
119122
assert_eq!(call_frame.calls[1].calls.len(), 1);
120123
assert!(call_frame.calls[1].logs.is_empty());
124+
assert!(call_frame.calls[1].error.is_some());
121125
assert!(call_frame.calls[1].calls[0].logs.is_empty());
126+
assert!(call_frame.calls[1].calls[0].error.is_none());
122127
assert!(call_frame.calls[1].calls[0].calls[0].logs.is_empty());
128+
assert!(call_frame.calls[1].calls[0].calls[0].error.is_none());
123129

124-
// third call succeeded, one log
130+
// third subcall succeeded, one log
125131
assert_eq!(call_frame.calls[2].logs.len(), 1);
132+
assert!(call_frame.calls[2].error.is_none());
126133
}
127134

128135
#[test]
@@ -423,11 +430,9 @@ fn test_geth_jstracer_op_gascost() {
423430
);
424431
let mut insp = JsInspector::new(code.to_string(), serde_json::Value::Null).unwrap();
425432
let (res, _) = inspect(&mut db, env.clone(), &mut insp).unwrap();
426-
println!("result: {:?}", res);
427433
assert!(res.result.is_success());
428434

429435
let result = insp.json_result(res, &env, &db).unwrap();
430-
println!("result: {}", result.to_string());
431436

432437
assert!(!result["error"].as_bool().unwrap());
433438
assert_eq!(

0 commit comments

Comments
 (0)