Skip to content

Commit 419192d

Browse files
authored
Fix etch cheatcode (#486)
1 parent 7f60f20 commit 419192d

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

crates/forge/tests/it/revive/cheats_individual.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,4 @@ revive_cheat_test!(test_coinbase, "CoinBase");
5050
revive_cheat_test!(test_set_custom_blockhash, "SetBlockhash");
5151
revive_cheat_test_original!(test_set_blockhash, "SetBlockhash");
5252
revive_cheat_test!(test_roll, "Roll");
53+
revive_cheat_test_original!(test_etch, "Etch");

crates/revive-strategy/src/cheatcodes/mod.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -442,10 +442,15 @@ impl CheatcodeInspectorStrategyRunner for PvmCheatcodeInspectorStrategyRunner {
442442
t if using_revive && is::<etchCall>(t) => {
443443
let etchCall { target, newRuntimeBytecode } =
444444
cheatcode.as_any().downcast_ref().unwrap();
445-
let ctx = get_context_ref_mut(ccx.state.strategy.context.as_mut());
446445

446+
if ccx.is_precompile(target) {
447+
return Err(precompile_error(target));
448+
}
449+
450+
let ctx = get_context_ref_mut(ccx.state.strategy.context.as_mut());
447451
ctx.externalities.etch_call(target, newRuntimeBytecode, ccx.ecx)?;
448-
Ok(Default::default())
452+
453+
cheatcode.dyn_apply(ccx, executor)
449454
}
450455

451456
t if is::<etchCall>(t) => {

0 commit comments

Comments
 (0)