bcnmy / gasdaddy

MIT License
5 stars 3 forks source link

Sponsorship Paymaster Accounting and Gas limits testing on public testnet #29

Open livingrockrises opened 1 month ago

livingrockrises commented 1 month ago

Feature or Improvement Description

Test updated paymaster and finetune

Benefits & Outcomes

send several transactions using this paymaster for below cases

i. mint NFT/transfer erc20 with premium 0 (1e6) ii. do the above with premium 10% iii. do the above with premium 20% iv. check fee collector balance to verify premiums v. do transactions a few times to warm up the slots NOTE: postOpGasLimit must be higher than unaccountedGasCost set otherwise it will revert vi. catch possible reverts from bundler vii. accounting checks. make sure paymaster's deposit on entrypoint is always higher than sum of dappIdBalances

outcome is to set gas limits and unacocuntedGasCost in proper way such that paymaster always makes profit, and the dapp is charged accurately. do simulations on tenderly to figure out gas limits and set config accordingly, and then repeat the transactions.

Any References?

No response

Code of Conduct

livingrockrises commented 1 month ago

tx # 3. Slots have been warmed up Premium : 10%

Paymaster's current deposit on EP: 98684697396024771 Dapp's current balance on paymaster: 98560768558285575 Fee collector's current balance: 49663428787474

setting unaccounted EP gas to: 15000

tx hash: https://sepolia.basescan.org/tx/0xa3d598122ae7b0540b284049b03750fe6986ee63789be2efce95287d662e9654

tenderly: https://dashboard.tenderly.co/livingrock777/biconomy/tx/84532/0xa3d598122ae7b0540b284049b03750fe6986ee63789be2efce95287d662e9654/gas-usage

bundler paid: 0.000082001141128017 = 82001141000000 entrypoint paid to bundler: 0.000421575907908534 (huge difference) = 421575910000000

Paymaster’s balance on EP: 98263121488116237
 deducted for the paymaster: = 421575910000000

Dapp’s deposit on the paymaster: 98105931991836452 Deducted from the dapp: = 454836570000000 =

Fee collector's balance on pm: 79275906711265 fee collector's collected premium(bal change) = 29612478000000

Info from event: adjustedGasCost=charge: 325737257161707 (charged from the dapp would be more than this cause of penalties?) premium= 29612477923791 (not an exact match maybe cause of converting scientific notation..)

deducted from dapp = 454836570000000

Actual gas cost emitted by entrypoint: 421575907908534 (maybe it passes low to the postOp but then after penalties increases it and sends?) Gas limits we're sending postOpGasLimit: 66752 paymasterValidationGasLimit: 66752

livingrockrises commented 1 month ago

on latest deployed paymaster on base sepolia https://sepolia.basescan.org/address/0x00000005858b63176f39f9cfcb51ab4e97b84a2a

paymaster deposit on EP: 95683780960347448 dapp's deposit on paymaster: 95307748870958858 fee collector's balance on pm: 160847446785730

setting unaccounted gas : 15000

premium: 10%

https://sepolia.basescan.org/tx/0x5a7a59464ec0a4145777497750724f5b85379d187477d0f96fc3e1fa8e597a02

bundler paid: 0.000403925975380274 entry point paid to bundler: 0.002076357056800507

paymaster deposit on EP after: 93607423903546941 deduction: 2076357100000000

dapp's deposit on paymaster after: 93066911425721824 dapp's deduction: 2240837400000000

fee collector's balance on pm after: 306610093636566 fee collector's bal increase by: 145762650000000

Details from events: charge:- 1603389115359199 (won't match dapp's actual deduction..) premium:- 145762646850836

actualGasCost emitted by entrypoint- 2076357056800507

tenderly: https://dashboard.tenderly.co/livingrock777/biconomy/tx/84532/0x5a7a59464ec0a4145777497750724f5b85379d187477d0f96fc3e1fa8e597a02/gas-usage