diff --git a/contracts/token/BiconomyTokenPaymaster.sol b/contracts/token/BiconomyTokenPaymaster.sol index 18b7024..99d57a9 100644 --- a/contracts/token/BiconomyTokenPaymaster.sol +++ b/contracts/token/BiconomyTokenPaymaster.sol @@ -582,20 +582,15 @@ contract BiconomyTokenPaymaster is ); // emit UserOperationSponsored(account, address(feeToken), charge, actualGasCost); } else { - // In case transferFrom failed in first handlePostOp call, attempt to charge the tokens again - bytes memory _data = abi.encodeWithSelector( - feeToken.transferFrom.selector, + /*SafeTransferLib.safeTransferFrom( + address(feeToken), account, feeReceiver, charge - ); - (bool success, ) = address(feeToken).call(_data); - if (!success) { - // In case above transferFrom failed, pay with deposit / notify at least - // Sender could be banned indefinitely or for certain period - emit TokenPaymentDue(address(feeToken), account, charge); - // Do nothing else here to not revert the whole bundle and harm reputation - } + );*/ + // or just revert + require(0 == 1, "PostOpRevertedBLAHBLAHBLAHBLAHBLAHBLAHBLAHBLAHBLAH"); + // revert PostOpRevertedBLAHBLAHBLAHBLAHBLAHBLAHBLAHBLAHBLAH(); } // console.log("gas used for postop: %s", gas - gasleft()); } diff --git a/contracts/token/TokenPaymasterErrors.sol b/contracts/token/TokenPaymasterErrors.sol index c6df0ac..96cb049 100644 --- a/contracts/token/TokenPaymasterErrors.sol +++ b/contracts/token/TokenPaymasterErrors.sol @@ -56,5 +56,5 @@ contract TokenPaymasterErrors { error CannotBeUnrealisticValue(); - error DEXRouterCannotBeZero(); + error PostOpRevertedBLAHBLAHBLAHBLAHBLAHBLAHBLAHBLAHBLAH(); } diff --git a/test/bundler-integration/token-paymaster/biconomy-token-paymaster-specs.ts b/test/bundler-integration/token-paymaster/biconomy-token-paymaster-specs.ts index 5d313c4..870f044 100644 --- a/test/bundler-integration/token-paymaster/biconomy-token-paymaster-specs.ts +++ b/test/bundler-integration/token-paymaster/biconomy-token-paymaster-specs.ts @@ -235,7 +235,7 @@ describe("Biconomy Token Paymaster (with Bundler)", function () { userSCW, token, paymasterAddress, - ethers.constants.MaxUint256 + ethers.constants.Zero ), preVerificationGas: 55000, }, @@ -277,14 +277,23 @@ describe("Biconomy Token Paymaster (with Bundler)", function () { userOp.signature = signatureWithModuleAddress; - await environment.sendUserOperation(userOp, entryPoint.address); + const bundlerResponse = await environment.sendUserOperation( + userOp, + entryPoint.address + ); + console.log(bundlerResponse); + + const receipt = await environment.getUserOperationReceipt( + bundlerResponse.result + ); + console.log(receipt); - const ev = await getUserOpEvent(entryPoint); - expect(ev.args.success).to.be.true; + // const ev = await getUserOpEvent(entryPoint); + // expect(ev.args.success).to.be.true; - await expect( + /* await expect( entryPoint.handleOps([userOp], await offchainSigner.getAddress()) - ).to.be.reverted; + ).to.be.reverted; */ }); }); }); diff --git a/test/token-paymaster/biconomy-token-paymaster-specs.ts b/test/token-paymaster/biconomy-token-paymaster-specs.ts index 8cb5c05..68b6ff7 100644 --- a/test/token-paymaster/biconomy-token-paymaster-specs.ts +++ b/test/token-paymaster/biconomy-token-paymaster-specs.ts @@ -282,7 +282,7 @@ describe("Biconomy Token Paymaster", function () { userSCW, token, paymasterAddress, - ethers.constants.MaxUint256 + ethers.constants.Zero ), }, walletOwner, @@ -328,7 +328,17 @@ describe("Biconomy Token Paymaster", function () { .mul(userOp.maxFeePerGas); const preTokenBalanceForAccount = await token.balanceOf(walletAddress); - const tx = await entryPoint.handleOps( + await expect( + entryPoint.handleOps([userOp], await offchainSigner.getAddress()) + // ).to.be.revertedWithCustomError(sampleTokenPaymaster, "PostOpReverted"); + ) + .to.be.revertedWithCustomError(entryPoint, "FailedOp") + .withArgs( + 0, + "AA50 postOp reverted: PostOpRevertedBLAHBLAHBLAHBLAHBLAHBLAHBLAHBLAHBLAH" + ); + + /* const tx = await entryPoint.handleOps( [userOp], await offchainSigner.getAddress() ); @@ -354,11 +364,11 @@ describe("Biconomy Token Paymaster", function () { await expect( entryPoint.handleOps([userOp], await offchainSigner.getAddress()) - ).to.be.reverted; + ).to.be.reverted; */ }); }); - describe("Negative scenarios: invalid and wrong signatures", () => { + /* describe("Negative scenarios: invalid and wrong signatures", () => { it("should revert on invalid signature length", async () => { const userSCW: any = BiconomyAccountImplementation__factory.connect( walletAddress, @@ -835,5 +845,5 @@ describe("Biconomy Token Paymaster", function () { // Add test cases for pulling ether out of paymaster contract // Add test cases for batch withdraw tokens }); - }); + }); */ });