From 626af493c66d8ffacfb174a43212a7079484e380 Mon Sep 17 00:00:00 2001 From: shahafn Date: Thu, 8 Feb 2024 23:38:05 +0200 Subject: [PATCH] TPM: making config public (#438) * Making config public --- contracts/samples/TokenPaymaster.sol | 2 +- reports/gas-checker.txt | 4 ++-- test/samples/TokenPaymaster.test.ts | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/contracts/samples/TokenPaymaster.sol b/contracts/samples/TokenPaymaster.sol index 3eb9ff4f9..1d4c50d63 100644 --- a/contracts/samples/TokenPaymaster.sol +++ b/contracts/samples/TokenPaymaster.sol @@ -50,7 +50,7 @@ contract TokenPaymaster is BasePaymaster, UniswapHelper, OracleHelper { /// @notice All 'price' variables are multiplied by this value to avoid rounding up uint256 private constant PRICE_DENOMINATOR = 1e26; - TokenPaymasterConfig private tokenPaymasterConfig; + TokenPaymasterConfig public tokenPaymasterConfig; /// @notice Initializes the TokenPaymaster contract with the given parameters. /// @param _token The ERC20 token used for transaction fee payments. diff --git a/reports/gas-checker.txt b/reports/gas-checker.txt index 8e5d9ba47..e8909ae54 100644 --- a/reports/gas-checker.txt +++ b/reports/gas-checker.txt @@ -46,10 +46,10 @@ ╟────────────────────────────────┼───────┼───────────────┼────────────────┼─────────────────────╢ ║ token paymaster │ 1 │ 128754 │ │ ║ ╟────────────────────────────────┼───────┼───────────────┼────────────────┼─────────────────────╢ -║ token paymaster with diff │ 2 │ │ 66351 │ 37372 ║ +║ token paymaster with diff │ 2 │ │ 66363 │ 37384 ║ ╟────────────────────────────────┼───────┼───────────────┼────────────────┼─────────────────────╢ ║ token paymaster │ 10 │ 726214 │ │ ║ ╟────────────────────────────────┼───────┼───────────────┼────────────────┼─────────────────────╢ -║ token paymaster with diff │ 11 │ │ 66467 │ 37488 ║ +║ token paymaster with diff │ 11 │ │ 66431 │ 37452 ║ ╚════════════════════════════════╧═══════╧═══════════════╧════════════════╧═════════════════════╝ diff --git a/test/samples/TokenPaymaster.test.ts b/test/samples/TokenPaymaster.test.ts index b20dceb39..4210b01cf 100644 --- a/test/samples/TokenPaymaster.test.ts +++ b/test/samples/TokenPaymaster.test.ts @@ -159,11 +159,12 @@ describe('TokenPaymaster', function () { it('paymaster should reject if postOpGaSLimit is too low', async () => { const snapshot = await ethers.provider.send('evm_snapshot', []) + const config = await paymaster.tokenPaymasterConfig() let op = await fillUserOp({ sender: account.address, paymaster: paymasterAddress, paymasterVerificationGasLimit: 3e5, - paymasterPostOpGasLimit: 4000, // too low + paymasterPostOpGasLimit: config.refundPostopCost - 1, // too low callData }, entryPoint) op = signUserOp(op, accountOwner, entryPoint.address, chainId)