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
ProofSubmitter
instance by callingcreateProofSubmitter
function. Client can send ETH with the samecreateProofSubmitter
call or later viadepositToEntryPoint
function. -
Client sets operator via
setOperator
function. -
Client sets allowed smart contract functions via
setAllowedFunctionForContract
function. -
Operator sends UserOperation to a ERC-4337 bundler with one of the allowed smart contract functions called via
execute
function. -
Client can withdraw remaining ETH from the
EntryPoint
at any time viawithdrawFromEntryPoint
function.
Some of the EigenLayer functions are already allowed by default:
startCheckpoint
on EigenPodverifyWithdrawalCredentials
on EigenPodverifyCheckpointProofs
on EigenPodprocessClaim
on RewardsCoordinator with the restriction that only the client can be the recipient.
However, for successfull execution
EigenPod functions require that
- the
ProofSubmitter
contract owner is the pod owner setProofSubmitter
on EigenPod has been called with the address of theProofSubmitter
contract
RewardsCoordinator's processClaim
requires that
setClaimerFor
on RewardsCoordinator has been called with the address of theProofSubmitter
contract
So, the flow will be the following:
-
Client becomes an EigenLayer pod owner by calling
createPod
on EigenPodManager. -
Client creates
ProofSubmitter
instance by callingcreateProofSubmitter
function. Client can send ETH with the samecreateProofSubmitter
call or later viadepositToEntryPoint
function. -
Client sets the P2P.org operator address via
setOperator
function on theirProofSubmitter
contract instance. -
Client sets the
ProofSubmitter
contract as a proofSubmitter for EigenPod by callingsetProofSubmitter
function on EigenPod. -
Client sets the
ProofSubmitter
contract as a claimer for RewardsCoordinator by callingsetClaimerFor
function 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 theProofSubmitter
contractexecute
function. -
The ERC-4337 bundler does the actual Ethereum transaction (call
verifyCheckpointProofs
on 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.