ERC-4337 Account abstraction contracts that allow
the client (account owner) to
- pre-pay ETH for gas
- set allowed operators
- set allowed arbitrary smart contract functions to be called by operators
operators to
- call arbitrary (pre-approved by the client) smart contract functions as ERC-4337 UserOperations via EntryPoint using the client's pre-paid ETH to cover gas costs
curl -L https://foundry.paradigm.xyz | bash
source /Users/$USER/.bashrc
foundryup
forge test-
Anyone (deployer, does not matter who) deploys
ProofSubmitterFactory. -
Client creates
ProofSubmitterinstance by callingcreateProofSubmitterfunction. Client can send ETH with the samecreateProofSubmittercall or later viadepositToEntryPointfunction. -
Client sets operator via
setOperatorfunction. -
Client sets allowed smart contract functions via
setAllowedFunctionForContractfunction. -
Operator sends UserOperation to a ERC-4337 bundler with one of the allowed smart contract functions called via
executefunction. -
Client can withdraw remaining ETH from the
EntryPointat any time viawithdrawFromEntryPointfunction.
Some of the EigenLayer functions are already allowed by default:
startCheckpointon EigenPodverifyWithdrawalCredentialson EigenPodverifyCheckpointProofson EigenPodprocessClaimon RewardsCoordinator with the restriction that only the client can be the recipient.
However, for successfull execution
EigenPod functions require that
- the
ProofSubmittercontract owner is the pod owner setProofSubmitteron EigenPod has been called with the address of theProofSubmittercontract
RewardsCoordinator's processClaim requires that
setClaimerForon RewardsCoordinator has been called with the address of theProofSubmittercontract
So, the flow will be the following:
-
Client becomes an EigenLayer pod owner by calling
createPodon EigenPodManager. -
Client creates
ProofSubmitterinstance by callingcreateProofSubmitterfunction. Client can send ETH with the samecreateProofSubmittercall or later viadepositToEntryPointfunction. -
Client sets the P2P.org operator address via
setOperatorfunction on theirProofSubmittercontract instance. -
Client sets the
ProofSubmittercontract as a proofSubmitter for EigenPod by callingsetProofSubmitterfunction on EigenPod. -
Client sets the
ProofSubmittercontract as a claimer for RewardsCoordinator by callingsetClaimerForfunction on RewardsCoordinator. -
Client does an off-chain request (e.g. via P2P.org API) to submit a proofs for many validators.
-
P2P.org off-chain service generates all the required proofs.
-
P2P.org operator sends UserOperation to a ERC-4337 bundler with one of the allowed smart contract functions (e.g.
verifyCheckpointProofs) called via theProofSubmittercontractexecutefunction. -
The ERC-4337 bundler does the actual Ethereum transaction (call
verifyCheckpointProofson EigenPod via theEntryPoint'shandleOps, thenProofSubmitter'sexecute) and get compensated for its gas using the client's pre-paid ETH. -
P2P.org operator can repeat steps 7-9 for all the validators that the client has requested.