Skip to content
This repository has been archived by the owner on Nov 8, 2023. It is now read-only.

Allow "gasless transactions" (make Irene the paymaster?) #142

Open
geoknee opened this issue Oct 18, 2023 · 6 comments
Open

Allow "gasless transactions" (make Irene the paymaster?) #142

geoknee opened this issue Oct 18, 2023 · 6 comments
Assignees

Comments

@geoknee
Copy link
Contributor

geoknee commented Oct 18, 2023

If she isn't already.

Basically we want to be elligible for a prize from polygon around "gasless transactions" https://ethglobal.com/events/ethonline2023/prizes#polygon

@geoknee geoknee self-assigned this Oct 19, 2023
@geoknee
Copy link
Contributor Author

geoknee commented Oct 19, 2023

I wonder if in we are already in fact doing gasless transactions? W manually deposited funds into the entrypoint(s) on behalf of alice and bob (using hardhat signer 0, or presumably some manually funded EOA we span up). Neither Alice nor Bob pays gas in our demo (from what I can make out).

In theory, in our demo Irene acts as bundler and can get reimbursed for spending the gas on submitting to the entrypoint. However, doing some experiments, it seems that Irene is not getting reimbursed (at least not directly). More investigation needed.

@lalexgap
Copy link
Contributor

lalexgap commented Oct 19, 2023

There definitely is some reimbursement going on, which gets paid out to the beneficiary address passed into HandleUserOps. Originally that address was point to Alice's SCW wallet, so we'd see Alice get a balance of 9.000000003473999872 when performing an L1 pay.

I think the amount that gets refunded is based on preVerificationGas. Based on my reading of ERC-4337 preverificatonGas is a fixed value (IE: it doesn't scale with the actual gas costs), so I suspect our preverificatonGas is just too low to compensate Irene fully for the cost of submitting the transaction.

In the real world preVerificationGas would be an amount to compensate the bundler for submitting the UserOp (probably in a batch) and any other overheads they have running the bundler.

@lalexgap
Copy link
Contributor

Another important thing to note is that as part of our deploy we deposit into the entrypoint for Alice and Bob's SCW.

So that is most likely where the fees are being paid out from and why we don't see the gas fees coming out from the account balance.

@geoknee
Copy link
Contributor Author

geoknee commented Oct 19, 2023

Thanks for the input @lalexgap. I'll try and increase the preverificationGas and see whether we can make it free or net positive for Irene to submit transactions.

@lalexgap
Copy link
Contributor

I think if we want proper "gasless" transactions we need to use a paymaster, since right now Alice and Bob do end up paying for "gas" (if my assumption from above is correct, and the gas is being deducted from their entrypoint balance).

For a "gasless transaction"

  • We'd create a paymaster and get the paymaster to deposit into the entrypoint
  • We would not deposit into the entrypoint for Alice and Bob
  • We'd update the UserOp to specify the paymaster
  • Any execution gas fees would be deducted from the paymaster's entrypoint balance.

@lalexgap
Copy link
Contributor

I think this would implementing a paymaster contract. The Entrypoint is designed to call into this contract

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants