Skip to content

Commit

Permalink
Remove balance check before updating withdrawable mapping, rerun snap…
Browse files Browse the repository at this point in the history
…shot
  • Loading branch information
stevieraykatz committed Apr 4, 2024
1 parent cc07e70 commit be99d35
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 18 deletions.
30 changes: 15 additions & 15 deletions .gas-snapshot
Original file line number Diff line number Diff line change
Expand Up @@ -4,35 +4,35 @@ IsValidWithdrawalSignature:test_returnsTrueWithValidSignature() (gas: 51016)
OwnerWithdrawTest:test_revertsIfNotOwner() (gas: 15305)
OwnerWithdrawTest:test_transfersERC20Successfully(uint256) (runs: 256, μ: 97271, ~: 99711)
OwnerWithdrawTest:test_transfersETHSuccessfully(uint256) (runs: 256, μ: 51418, ~: 53415)
PostOpTest:test_RevertsIfPostOpFailed(uint256,uint256,uint256) (runs: 256, μ: 97011, ~: 99394)
PostOpTest:test_RevertsIfPostOpFailed(uint256,uint256,uint256) (runs: 256, μ: 97243, ~: 99371)
PostOpTest:test_entryPointAddStake(uint112,uint32) (runs: 256, μ: 56233, ~: 56233)
PostOpTest:test_entryPointDeposit(uint112) (runs: 256, μ: 32405, ~: 32962)
PostOpTest:test_entryPointDeposit(uint112) (runs: 256, μ: 32479, ~: 32962)
PostOpTest:test_entryPointUnlockStake() (gas: 54888)
PostOpTest:test_entryPointWithdraw(uint112) (runs: 256, μ: 63350, ~: 65300)
PostOpTest:test_entryPointWithdraw(uint112) (runs: 256, μ: 63200, ~: 65300)
PostOpTest:test_entryPointWithdrawStake() (gas: 71803)
PostOpTest:test_paymasterPaysForOp() (gas: 210686)
PostOpTest:test_transfersExcess(uint256,uint256,uint256,uint256) (runs: 256, μ: 112459, ~: 113511)
PostOpTest:test_paymasterPaysForOp() (gas: 210663)
PostOpTest:test_transfersExcess(uint256,uint256,uint256,uint256) (runs: 256, μ: 112479, ~: 113488)
SetMaxWithdrawDenominator:test_emitsCorrectly(uint256) (runs: 256, μ: 19851, ~: 20191)
SetMaxWithdrawDenominator:test_reverts_whenNotCalledByOwner() (gas: 12257)
SetMaxWithdrawDenominator:test_setsMaxWithdrawPercent(uint256) (runs: 256, μ: 19209, ~: 19549)
Simulate:test() (gas: 12114)
ValidatePaymasterUserOpTest:test_emitsCorrectly(address,uint256,uint256) (runs: 256, μ: 102114, ~: 103497)
ValidatePaymasterUserOpTest:test_recordsNonceUsed(uint256) (runs: 256, μ: 112181, ~: 113270)
ValidatePaymasterUserOpTest:test_returns1sIfWrongSignature() (gas: 96321)
ValidatePaymasterUserOpTest:test_returnsCorrectly() (gas: 91208)
ValidatePaymasterUserOpTest:test_emitsCorrectly(address,uint256,uint256) (runs: 256, μ: 104697, ~: 106080)
ValidatePaymasterUserOpTest:test_recordsNonceUsed(uint256) (runs: 256, μ: 112158, ~: 113247)
ValidatePaymasterUserOpTest:test_returns1sIfWrongSignature() (gas: 96298)
ValidatePaymasterUserOpTest:test_returnsCorrectly() (gas: 91185)
ValidatePaymasterUserOpTest:test_revertsIfMaxCostMoreThanRequested() (gas: 39141)
ValidatePaymasterUserOpTest:test_revertsIfNonceUsed() (gas: 103525)
ValidatePaymasterUserOpTest:test_revertsIfNonceUsed() (gas: 103502)
ValidatePaymasterUserOpTest:test_revertsIfWithdrawAssetNotZero() (gas: 55952)
ValidatePaymasterUserOpTest:test_reverts_whenWithdrawExceedsMaxAllowed(uint256,uint256,uint256) (runs: 256, μ: 100819, ~: 100992)
ValidatePaymasterUserOpTest:test_reverts_whenWithdrawExceedsMaxAllowed(uint256,uint256,uint256) (runs: 256, μ: 100830, ~: 100992)
ValidateTest:test_receive() (gas: 14687)
WithdrawGasExcess:test_RevertsIfNoExcess(uint256) (runs: 256, μ: 70550, ~: 70813)
WithdrawGasExcess:test_transferExcess(uint256,uint256,uint256) (runs: 256, μ: 104313, ~: 104313)
WithdrawGasExcess:test_RevertsIfNoExcess(uint256) (runs: 256, μ: 71133, ~: 71396)
WithdrawGasExcess:test_transferExcess(uint256,uint256,uint256) (runs: 256, μ: 104290, ~: 104290)
WithdrawTest:test_emitsCorrectly(address,uint256,uint256) (runs: 256, μ: 118018, ~: 121375)
WithdrawTest:test_emitsCorrectlyERC20Withdraw(address,uint256,uint256) (runs: 256, μ: 161737, ~: 164780)
WithdrawTest:test_emitsCorrectlyERC20Withdraw(address,uint256,uint256) (runs: 256, μ: 161748, ~: 164780)
WithdrawTest:test_recordsNonceUsed(uint256) (runs: 256, μ: 111379, ~: 112468)
WithdrawTest:test_revertsIfExpired(uint48,uint256) (runs: 256, μ: 28345, ~: 28455)
WithdrawTest:test_revertsIfNonceUsed() (gas: 100227)
WithdrawTest:test_revertsIfWrongSignature() (gas: 36875)
WithdrawTest:test_reverts_whenWithdrawExceedsMaxAllowed(uint256,uint256,uint256) (runs: 256, μ: 89535, ~: 89472)
WithdrawTest:test_reverts_whenWithdrawExceedsMaxAllowed(uint256,uint256,uint256) (runs: 256, μ: 89538, ~: 89472)
WithdrawTest:test_transfersERC20Successfully(uint256) (runs: 256, μ: 140633, ~: 143073)
WithdrawTest:test_transfersETHSuccessfully(uint256) (runs: 256, μ: 91699, ~: 93696)
4 changes: 1 addition & 3 deletions src/MagicSpend.sol
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,7 @@ contract MagicSpend is Ownable, IPaymaster {
validationData = (sigFailed ? 1 : 0) | (uint256(withdrawRequest.expiry) << 160);

// NOTE: Do not include the gas part in withdrawable funds as it will be handled in `postOp()`.
if (withdrawAmount > maxCost) {
_withdrawable[userOp.sender] += withdrawAmount - maxCost;
}
_withdrawable[userOp.sender] += withdrawAmount - maxCost;
context = abi.encode(maxCost, userOp.sender);
}

Expand Down

0 comments on commit be99d35

Please sign in to comment.