From d5cf52bc5bbf75f988f8aada23fd12d0bcf7798a Mon Sep 17 00:00:00 2001 From: lourens linde <65844331+lokithe5th@users.noreply.github.com> Date: Fri, 19 Apr 2024 13:03:10 +0200 Subject: [PATCH] Feat: add vm.etch capability (#11) * Feat: add etch Tested locally. * Chore: update README --- README.md | 4 +++- src/Hevm.sol | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 5d31306..836858c 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,9 @@ Chimera addresses this problem by enabling a "write once, run everywhere" approa Chimera currently only supports cheatcodes implemented by [HEVM](https://hevm.dev/ds-test-tutorial.html?highlight=cheat#supported-cheat-codes). -Foundry has extended these and offers functionality not supported by the HEVM cheatcodes, subsequently these must be accounted for when adding Chimera to a Foundry project as they will cause issues when running Echidna and Medusa. If adding Chimera to an existing Foundry project ensure that there are no cheatcodes implemented that aren't supported by HEVM as they will throw the following error: `VM failed for unhandled reason, BadCheatCode `. +Foundry has extended these and offers functionality not supported by the HEVM cheatcodes, subsequently these must be accounted for when adding Chimera to a Foundry project as they will cause issues when running Echidna and Medusa. If adding Chimera to an existing Foundry project ensure that there are no cheatcodes implemented that aren't supported by HEVM as they will throw the following error: `VM failed for unhandled reason, BadCheatCode `. + +While **medusa** supports `etch`, echidna does not support it yet. Please note when using `etch` in an echidna environment it will not work as expected. ### Features diff --git a/src/Hevm.sol b/src/Hevm.sol index 8ee497a..059f9a1 100644 --- a/src/Hevm.sol +++ b/src/Hevm.sol @@ -46,6 +46,9 @@ interface IHevm { // Labels the address in traces function label(address addr, string calldata label) external; + + /// Sets an address' code. + function etch(address target, bytes calldata newRuntimeBytecode) external; } IHevm constant vm = IHevm(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);