From 4fd2eebb4f56f8fa94b5405d7d0f950122cb834c Mon Sep 17 00:00:00 2001 From: kopy-kat Date: Sat, 19 Oct 2024 17:55:31 +0800 Subject: [PATCH] feat: update deprecated cheatcodes --- README.md | 4 ++-- package.json | 2 +- src/Simulator.sol | 8 ++++---- src/lib/Vm.sol | 8 ++++---- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 492ee4f..c817684 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,10 @@ # ERC4337 Validation -**A library to validate the [ERC-4337 rules](https://github.com/eth-infinitism/account-abstraction/blob/develop/erc/ERCS/erc-7562.md) within Foundry** +**A library to validate the [ERC-4337 rules](https://eips.ethereum.org/EIPS/eip-7562) within Foundry** This library allows you to validate: -- [ ] Banned opcodes +- [x] Banned opcodes - [x] Banned storage locations - [x] Disallowed `*CALLs` - [x] Disallowed use of `EXT*` opcodes diff --git a/package.json b/package.json index ef28c4f..cb55f61 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@rhinestone/erc4337-validation", - "version": "0.0.1-alpha.5", + "version": "0.0.2", "description": "A library to validate the ERC-4337 rules within Foundry", "license": "MIT", "author": { diff --git a/src/Simulator.sol b/src/Simulator.sol index e016b3e..ca09e75 100644 --- a/src/Simulator.sol +++ b/src/Simulator.sol @@ -11,14 +11,14 @@ import { } from "./lib/ERC4337.sol"; import { VmSafe } from "forge-std/Vm.sol"; import { - snapshot, + snapshotState, startMappingRecording, startDebugTraceRecording, startStateDiffRecording, stopAndReturnStateDiff, stopMappingRecording, stopAndReturnDebugTraceRecording, - revertTo, + revertToState, expectRevert } from "./lib/Vm.sol"; import { ERC4337SpecsParser } from "./SpecsParser.sol"; @@ -144,7 +144,7 @@ library Simulator { */ function _preSimulation() internal { // Create snapshot to revert to after simulation - uint256 snapShotId = snapshot(); + uint256 snapShotId = snapshotState(); // Store the snapshot id so that it can be reverted to after simulation bytes32 snapShotSlot = keccak256(abi.encodePacked("Simulator.SnapshotId")); @@ -183,6 +183,6 @@ library Simulator { } // Revert to snapshot - revertTo(snapShotId); + revertToState(snapShotId); } } diff --git a/src/lib/Vm.sol b/src/lib/Vm.sol index eb1219d..682d2f3 100644 --- a/src/lib/Vm.sol +++ b/src/lib/Vm.sol @@ -13,12 +13,12 @@ function getLabel(address addr) view returns (string memory) { return Vm(VM_ADDR).getLabel(addr); } -function snapshot() returns (uint256) { - return Vm(VM_ADDR).snapshot(); +function snapshotState() returns (uint256) { + return Vm(VM_ADDR).snapshotState(); } -function revertTo(uint256 id) returns (bool) { - return Vm(VM_ADDR).revertTo(id); +function revertToState(uint256 id) returns (bool) { + return Vm(VM_ADDR).revertToState(id); } function startStateDiffRecording() {