Skip to content
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

Add ERC: Minimal Batch Executor Interface #726

Open
wants to merge 31 commits into
base: master
Choose a base branch
from

Conversation

Vectorized
Copy link
Contributor

No description provided.

@eip-review-bot
Copy link
Collaborator

eip-review-bot commented Nov 21, 2024

File ERCS/erc-7821.md

Requires 1 more reviewers from @axic, @g11tech, @SamWilsn, @xinbenlv

@Vectorized Vectorized changed the title Add ERC: Minimal Batch Executor Interface for Delegations Add ERC: Minimal Batch Executor Interface Nov 21, 2024
ERCS/erc-9999.md Outdated

/// @dev Executes the `calls` and returns the results.
/// Reverts and bubbles up error if any call fails.
function execute(Call[] calldata calls, bytes calldata authData)
Copy link
Contributor

@zeroknots zeroknots Nov 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

consider using ERC7579 execute function here.

function execute(bytes32 mode, bytes calldata executionCalldata) external;

would be a shame if wallets need to integrate another pattern.

the authData could be just appended bytes in calldata to perform the signature check, and ERC-4337 based implementations of this ERC could utilize the same function signature with access control onlyEntryPoint while handling the signature validation in validateUserOp

this would also allow for implementations to utilize try-batched executions or delegatecalls as this is covered by the 7579 execution modes

I admit, appending the authData to the calldata is not the prettiest, but would yield great compatibility

minimalBatchExecutorVersion could also be ERC-7579's supportsExecutionMode

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This standard will only support regular calls, in an atomic fashion. Delegatecalls won't be supported.

If users want to make multiple try transactions, they can just sign multiple transactions with parallel nonces.

I think it will not be too hard for frontends that have already supported 7579 to support this ERC. They will still need to craft the array of executions.

Side question: Do we actually need ERC-165 for ERC-7579? I would strongly prefer to never use ERC-165.

@Vectorized
Copy link
Contributor Author

Converted to use 7579 style.

@Vectorized
Copy link
Contributor Author

Lemme fix the 7579 issue first. If it is not feasible to be fixed, i'll go back to the original.

@Vectorized
Copy link
Contributor Author

Ok, let's merge.

This should be good enough.

ERCS/erc-7821.md Outdated Show resolved Hide resolved
ERCS/erc-7821.md Outdated
results = new bytes[](calls.length);
for (uint256 i; i < calls.length; ++i) {
Call calldata c = calls[i];
results[i] = _execute(c.target, c.value, c.data);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: consider adding a special address (e.g., address(0)) where the contract would execute the transaction to self. This is a neat optimization when you must batch multiple calls on the account contract itself.

This is implemented in Safe's MultiSend contract: https://github.com/safe-global/safe-smart-account/blob/7f79aaf05c33df71d9cb687f0bc8a73fa39d25d5/contracts/libraries/MultiSend.sol#L50C17-L50C57

@Vectorized
Copy link
Contributor Author

@abcoathup @xinbenlv

Ready to merge.

///
/// `opData` may be used to store additional data for authentication,
/// paymaster data, gas limits, etc.
function execute(Call[] calldata calls, bytes calldata opData)
Copy link

@nlordell nlordell Nov 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAIU, looks like this should be this right?

Suggested change
function execute(Call[] calldata calls, bytes calldata opData)
function execute(bytes32 mode, bytes calldata executionData)

At least this is what the comment above, commit history (adopting 7579) and the reference implementation suggests.

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

Successfully merging this pull request may close these issues.

7 participants