From 50bf4bd841c58fdc60ba547cf2108ce0c3bfbfef Mon Sep 17 00:00:00 2001 From: syntrust Date: Fri, 6 Sep 2024 11:14:52 +0800 Subject: [PATCH] minor --- contracts/test/StorageContractTest.t.sol | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/contracts/test/StorageContractTest.t.sol b/contracts/test/StorageContractTest.t.sol index d030c87..97af33c 100644 --- a/contracts/test/StorageContractTest.t.sol +++ b/contracts/test/StorageContractTest.t.sol @@ -64,8 +64,7 @@ contract StorageContractTest is Test { assertEq(miner.balance, reward); } - function testReentrancy() public { - vm.pauseGasMetering(); + function testReentrancy() public noGasMetering { uint256 prefund = 1000; // Without reentrancy protection, the fund could be drained by 29 times re-entrances given current params. vm.deal(address(storageContract), prefund); @@ -97,10 +96,7 @@ contract StorageContractTest is Test { } } -contract Attacker { - // cannot access imported vm directly - address internal constant VM_ADDRESS = address(uint160(uint256(keccak256("hevm cheat code")))); - Vm vm = Vm(VM_ADDRESS); +contract Attacker is Test { TestStorageContract storageContract; uint256 blockNumber = 1; uint256 count = 0;