Skip to content

Commit fc2d0f9

Browse files
Filipp MakarovFilipp Makarov
authored andcommitted
test: fix postop pm gas limit in tests
1 parent e24e750 commit fc2d0f9

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

test/unit/node-paymaster/percentage-premium/PercentagePremium_Test.t.sol

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ contract PercentagePremium_Paymaster_Test is BaseTest {
112112
uint128 pmValidationGasLimit = 15_000;
113113
// ~ 12_000 is raw PM.postOp gas spent
114114
// here we add more for emitting events in the wrapper + refunds etc in EP
115-
uint128 pmPostOpGasLimit = 37_000;
115+
uint128 pmPostOpGasLimit = 38_500;
116116

117117
bytes memory pmAndData = abi.encodePacked(
118118
address(EMITTING_NODE_PAYMASTER),
@@ -245,7 +245,7 @@ contract PercentagePremium_Paymaster_Test is BaseTest {
245245
)
246246
public
247247
view
248-
returns (uint256 meeNodeEarnings, uint256 expectedNodeEarnings, uint256 actualRefund)
248+
returns (uint256 meeNodeEarnings, uint256 expectedNodeEarnings, uint256 actualRefundIssuedByPM)
249249
{
250250
// parse UserOperationEvent
251251
(,, uint256 actualGasCostFromEP, uint256 actualGasUsedFromEP) =
@@ -262,17 +262,17 @@ contract PercentagePremium_Paymaster_Test is BaseTest {
262262
// nodePM does not charge for the penalty however because it still goes to the node EOA
263263
uint256 actualGasCost = gasCostPrePostOp + gasSpentInPostOp * actualGasPrice;
264264

265-
// NodePm doesn't charge for the penalty
266265
expectedNodeEarnings = getPremium(actualGasCost, meeNodePremiumPercentage);
267266

268267
// deposit decrease = refund to sponsor (if any) + gas cost refund to beneficiary (EXECUTOR_EOA) =>
269-
actualRefund = (nodePMDepositBefore - getDeposit(address(EMITTING_NODE_PAYMASTER))) - actualGasCostFromEP;
268+
actualRefundIssuedByPM =
269+
(nodePMDepositBefore - getDeposit(address(EMITTING_NODE_PAYMASTER))) - actualGasCostFromEP;
270+
// this above calculation is correct, tested via withdrawn events in EP
270271

271272
// earnings are (how much node receives in a payment userOp) minus (refund) minus (actual gas cost paid by
272-
// executor
273-
// EOA)
274-
meeNodeEarnings =
275-
applyPremium(maxGasCost, meeNodePremiumPercentage) - actualRefund - gasSpentByExecutorEOA * actualGasPrice;
273+
// executor EOA)
274+
meeNodeEarnings = applyPremium(maxGasCost, meeNodePremiumPercentage) - actualRefundIssuedByPM
275+
- gasSpentByExecutorEOA * actualGasPrice;
276276

277277
assertTrue(meeNodeEarnings > 0, "MEE_NODE should have earned something");
278278
assertTrue(

0 commit comments

Comments
 (0)