diff --git a/.gas-snapshot b/.gas-snapshot index b8e332a8..163409a7 100644 --- a/.gas-snapshot +++ b/.gas-snapshot @@ -116,19 +116,19 @@ ERC1155Test:testSafeTransferFromToEOA(uint256,uint256,bytes,uint256,address,byte ERC1155Test:testSafeTransferFromToERC1155Recipient() (gas: 739583) ERC1155Test:testSafeTransferFromToERC1155Recipient(uint256,uint256,bytes,uint256,bytes) (runs: 256, μ: 769591, ~: 765729) ERC20Invariants:invariantBalanceSum() (runs: 256, calls: 3840, reverts: 2388) -ERC20Test:invariantMetadata() (runs: 256, calls: 3840, reverts: 2606) +ERC20Test:invariantMetadata() (runs: 256, calls: 3840, reverts: 2583) ERC20Test:testApprove() (gas: 31058) ERC20Test:testApprove(address,uint256) (runs: 256, μ: 30424, ~: 31280) ERC20Test:testBurn() (gas: 56970) ERC20Test:testBurn(address,uint256,uint256) (runs: 256, μ: 56678, ~: 59645) ERC20Test:testFailBurnInsufficientBalance(address,uint256,uint256) (runs: 256, μ: 51897, ~: 55492) -ERC20Test:testFailPermitBadDeadline() (gas: 36924) +ERC20Test:testFailPermitBadDeadline() (gas: 36935) ERC20Test:testFailPermitBadDeadline(uint256,address,uint256,uint256) (runs: 256, μ: 32148, ~: 37218) ERC20Test:testFailPermitBadNonce() (gas: 36874) ERC20Test:testFailPermitBadNonce(uint256,address,uint256,uint256,uint256) (runs: 256, μ: 31628, ~: 37187) -ERC20Test:testFailPermitPastDeadline() (gas: 10938) +ERC20Test:testFailPermitPastDeadline() (gas: 11191) ERC20Test:testFailPermitPastDeadline(uint256,address,uint256,uint256) (runs: 256, μ: 12037, ~: 13101) -ERC20Test:testFailPermitReplay() (gas: 66285) +ERC20Test:testFailPermitReplay() (gas: 66274) ERC20Test:testFailPermitReplay(uint256,address,uint256,uint256) (runs: 256, μ: 57071, ~: 66592) ERC20Test:testFailTransferFromInsufficientAllowance() (gas: 80882) ERC20Test:testFailTransferFromInsufficientAllowance(address,uint256,uint256) (runs: 256, μ: 79858, ~: 83393) @@ -137,7 +137,7 @@ ERC20Test:testFailTransferFromInsufficientBalance(address,uint256,uint256) (runs ERC20Test:testFailTransferInsufficientBalance() (gas: 52806) ERC20Test:testFailTransferInsufficientBalance(address,uint256,uint256) (runs: 256, μ: 51720, ~: 55310) ERC20Test:testInfiniteApproveTransferFrom() (gas: 89793) -ERC20Test:testMetadata(string,string,uint8) (runs: 256, μ: 870618, ~: 863277) +ERC20Test:testMetadata(string,string,uint8) (runs: 256, μ: 869914, ~: 863277) ERC20Test:testMint() (gas: 53746) ERC20Test:testMint(address,uint256) (runs: 256, μ: 52214, ~: 53925) ERC20Test:testPermit() (gas: 63193) @@ -145,7 +145,7 @@ ERC20Test:testPermit(uint248,address,uint256,uint256) (runs: 256, μ: 62584, ~: ERC20Test:testTransfer() (gas: 60272) ERC20Test:testTransfer(address,uint256) (runs: 256, μ: 58773, ~: 60484) ERC20Test:testTransferFrom() (gas: 83777) -ERC20Test:testTransferFrom(address,uint256,uint256) (runs: 256, μ: 86464, ~: 92841) +ERC20Test:testTransferFrom(address,uint256,uint256) (runs: 256, μ: 86308, ~: 92841) ERC4626Test:invariantMetadata() (runs: 256, calls: 3840, reverts: 2885) ERC4626Test:testFailDepositWithNoApproval() (gas: 13357) ERC4626Test:testFailDepositWithNotEnoughApproval() (gas: 86993) diff --git a/src/test/ERC20.t.sol b/src/test/ERC20.t.sol index 5c04f109..1506d8cf 100644 --- a/src/test/ERC20.t.sol +++ b/src/test/ERC20.t.sol @@ -172,6 +172,7 @@ contract ERC20Test is DSTestPlus { } function testFailPermitPastDeadline() public { + uint256 oldTimestamp = block.timestamp; uint256 privateKey = 0xBEEF; address owner = hevm.addr(privateKey); @@ -181,12 +182,13 @@ contract ERC20Test is DSTestPlus { abi.encodePacked( "\x19\x01", token.DOMAIN_SEPARATOR(), - keccak256(abi.encode(PERMIT_TYPEHASH, owner, address(0xCAFE), 1e18, 0, block.timestamp - 1)) + keccak256(abi.encode(PERMIT_TYPEHASH, owner, address(0xCAFE), 1e18, 0, oldTimestamp)) ) ) ); - token.permit(owner, address(0xCAFE), 1e18, block.timestamp - 1, v, r, s); + hevm.warp(block.timestamp + 1); + token.permit(owner, address(0xCAFE), 1e18, oldTimestamp, v, r, s); } function testFailPermitReplay() public {