-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support Account Abstraction in Foundry #7128
Comments
#1232 related -- thinking about how to make this work for both |
Given https://eips.ethereum.org/EIPS/eip-7702 is included in the Prague/Electra network upgrade I think it makes sense to considering having support for account abstraction. @excaliborr would this specifically be related to supporting ERC-4337, given that one of the design goals of EIP-7702 is not conflicting with it? I feel a lot of account abstraction proposals are still up in the air. Feel free to leave thoughts / requirements related to how extensions in Foundry could look on #8266 |
I'll try to reignite this discussion, as EIP-7702 seems to be gaining traction (h/t Ithica), and take a crack at a proposal. I've been experimenting with EIP-7702 using the OpenFort CLI and want to contribute to adding support in Forge. Before making a full proposal, I'd like to clarify a few things:
This would help me focus the proposal on the most important aspects. I like the suggestion from @excaliborr on supporting gas sponsorship, however I think there is a lot of groundwork to do before introducing that. I'm interested in adding support for transaction batching in Forge. There seem to be two potential approaches:
Would it be helpful to focus on one of these approaches first? The pure EIP-7702 route might be simpler to start with, though the 4337 integration could offer more features later. |
Hey @evchip, thanks for your comment
In regards to transaction batching I think it is best discussed in #7452. |
@zerosnacks Thank you for clarifying the scope - focusing on EIP-7702 support first makes sense as a foundation. I've put together a proposal for implementing this in Foundry that aims to be both focused and extensible. The core goal would be enabling delegation and transaction batching through Forge scripts, with a clean interface like: function run() external {
// Set up delegation
address implementation = address(0x123);
uint256 nonce = vm.getNonce();
bytes memory delegation = vm.createDelegation(implementation, nonce);
vm.signDelegation(delegation);
// Execute batched transactions via delegation
vm.startDelegatedBroadcast(implementation);
// Transactions here will be batched and executed via the implementation
token.transfer(alice, amount);
token.transfer(bob, amount);
vm.stopDelegatedBroadcast();
} EIP-7702 Support for FoundryOverviewThis proposal outlines adding basic EIP-7702 support to Forge scripts, enabling EOAs to delegate their execution to contract implementations. This foundation will enable transaction batching and future account abstraction features. I propose implementing the core EIP-7702 functionality in three phases: Phase 1: Core EIP-7702 Transaction Support
Phase 2: Cheatcode Implementation
// Create an EIP-7702 authorization for delegation
function createDelegation(address implementation, uint256 nonce)
external returns (bytes memory);
// Sign the authorization as the authority (EOA)
function signDelegation(bytes memory authorization)
external returns (SignedAuthorization);
// Start collecting transactions for delegated execution
function startDelegatedBroadcast(address implementation) external;
// Stop collecting delegated transactions
function stopDelegatedBroadcast() external;
// In broadcast.rs
impl ScriptRunner {
fn handle_delegated_broadcast(&mut self, implementation: Address, txs: Vec) -> Result {
// Bundle transactions into single EIP-7702 tx
let delegated_tx = self.create_delegated_tx(implementation, self.current_auth, txs)?;
// Add to broadcast queue
self.transactions.push(delegated_tx);
Ok(())
}
}
Phase 3: Documentation & Examples
Future EnhancementsWhile out of scope for this initial implementation, the following features could be added later:
|
@evchip given that we don't yet have a common standard/implementation of batcher for 7702 I think it would make sense for now to start with simple support for attaching 7702 authorizations to transactions broadcasted in scripts. that way we could add |
@klkvr thanks for the feedback agreed that starting with basic authorization support makes sense. I'll start working towards that and open a draft PR once I have something of substance. |
Component
Forge
Describe the feature you would like
Adding account abstraction to foundry would allow users to leverage paymasters to submit transactions in their foundry scripts, this also allows developers to make gasless transactions to testnets without needing to find a faucet as paymaster providers can sponsor the testnet gas, and many do already!
Additional context
Hardhat Implementation
We have already built a plugin to add account abstraction scripting to hardhat and want to work on getting it implemented into foundry next, if you want to check out the hardhat plugin to see how it works check it out here.
Who we are?
We are Wonderland, the largest core development group in web3. Our commitment is to a financial future that's open, decentralized, and accessible to all.
Design
The design of how the scripts would work is open-ended and no way a final design, the goal is to discuss the best way to implement this feature.
Example code snippet:
Important Caveats
CreateXFactory
to do this.UserOperation
was successfulOpen ended questions for discussion:
The text was updated successfully, but these errors were encountered: