Skip to content
This repository was archived by the owner on Nov 6, 2020. It is now read-only.

Commit c190092

Browse files
authored
Warn if genesis constructor revert (#11550)
1 parent 5c3c979 commit c190092

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

ethcore/spec/src/spec.rs

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,22 @@ fn run_constructors<T: Backend>(
175175
let schedule = machine.schedule(env_info.number);
176176
let mut exec = Executive::new(&mut state, &env_info, &machine, &schedule);
177177
// failing create is not a bug
178-
if let Err(e) = exec.create(params, &mut substate, &mut NoopTracer, &mut NoopVMTracer) {
179-
warn!(target: "spec", "Genesis constructor execution at {} failed: {}.", address, e);
178+
match exec.create(params, &mut substate, &mut NoopTracer, &mut NoopVMTracer) {
179+
Ok(r) if !r.apply_state =>
180+
warn!(
181+
target: "spec",
182+
"Genesis constructor execution at {} failed: {}.",
183+
address,
184+
vm::Error::Reverted
185+
),
186+
Err(e) =>
187+
warn!(
188+
target: "spec",
189+
"Genesis constructor execution at {} failed: {}.",
190+
address,
191+
e
192+
),
193+
_ => ()
180194
}
181195
}
182196

0 commit comments

Comments
 (0)