Skip to content

Commit

Permalink
fixed todos
Browse files Browse the repository at this point in the history
  • Loading branch information
Filipp Makarov authored and Filipp Makarov committed Nov 21, 2024
1 parent 9871c6d commit ec065de
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
4 changes: 3 additions & 1 deletion test/base/TestBase.sol
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ abstract contract TestBase is CheatCodes, TestHelper, BaseEventsAndErrors {
// Review address kept
address constant SWAP_ROUTER_ADDRESS = address(0x2626664c2603336E57B271c5C0b26F421741e481);

uint32 internal constant _PRICE_MARKUP_DENOMINATOR = 1e6;

Vm.Wallet internal PAYMASTER_OWNER;
Vm.Wallet internal PAYMASTER_SIGNER;
Vm.Wallet internal PAYMASTER_FEE_COLLECTOR;
Expand Down Expand Up @@ -489,7 +491,7 @@ abstract contract TestBase is CheatCodes, TestHelper, BaseEventsAndErrors {
// Ensure that max 2% difference between what is should have been charged and what was charged
// this difference comes from difference of postop gas and estimated postop gas (paymaster.unaccountedGas)
// and from estimation of real penalty which is not emitted by EP :(
assertApproxEqRel(totalGasFeePaid + maxPenalty - realPenalty, gasPaidBySAInNativeTokens, 0.02e18);
assertApproxEqRel((totalGasFeePaid + maxPenalty - realPenalty) * priceMarkup / _PRICE_MARKUP_DENOMINATOR, gasPaidBySAInNativeTokens, 0.02e18);
}

function _toSingletonArray(address addr) internal pure returns (address[] memory) {
Expand Down
5 changes: 3 additions & 2 deletions test/unit/concrete/TestTokenPaymaster.Base.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,9 @@ contract TestTokenPaymasterBase is TestBase {
initialPaymasterEpBalance,
initialUserTokenBalance,
initialPaymasterTokenBalance,
2624042830,
100000,
// IF THIS CASE FAILS ON 2% TOLERANCE => PUT THE FRESH PRICE FROM ORACLE HERE
3344583445,
_PRICE_MARKUP_DENOMINATOR,
this.getMaxPenalty(ops[0]),
this.getRealPenalty(ops[0], gasValue, customGasPrice));
}
Expand Down
4 changes: 2 additions & 2 deletions test/unit/concrete/TestTokenPaymaster.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ contract TestTokenPaymaster is TestBase {
initialUserTokenBalance,
initialPaymasterTokenBalance,
1e18, // tokenPrice
100000,
_PRICE_MARKUP_DENOMINATOR,
this.getMaxPenalty(ops[0]),
this.getRealPenalty(ops[0], gasValue, customGasPrice));
}
Expand Down Expand Up @@ -525,7 +525,7 @@ contract TestTokenPaymaster is TestBase {
initialUserTokenBalance,
initialPaymasterTokenBalance,
1e18, // tokenPrice
100000,
_PRICE_MARKUP_DENOMINATOR,
this.getMaxPenalty(ops[0]),
this.getRealPenalty(ops[0], gasValue, customGasPrice));
}
Expand Down

0 comments on commit ec065de

Please sign in to comment.