Skip to content

Conversation

@legion2002
Copy link
Collaborator

@legion2002 legion2002 commented Sep 3, 2025

Add CallSansTo batch execution support

Implements a new batch execution mode for calls that share a common target address,
optimizing gas usage and simplifying transaction construction.

Changes

Core Implementation:

  • Add CallSansTo struct with value and data fields (no individual to
    address)
  • New execution mode
    0x0100000000007821000300000000000000000000000000000000000000000000
  • _executeBatchCommonTo() function in ERC7821Ithaca that extracts shared to
    address
  • computeDigest() overload for CallSansTo arrays with shared target
  • Full signature validation and authorization support
  • If the to address passed to the function is set to address(0), it is replaced with address(this) onchain.

The new mode allows batching multiple calls to the same contract more efficiently
by specifying the target address once rather than per-call, reducing calldata size
and gas costs while maintaining full security guarantees.

@legion2002 legion2002 changed the title feat: add callSansTo support to ERC7821 execute feat: add commot to execution mode support to ERC7821 Sep 3, 2025
@legion2002 legion2002 changed the title feat: add commot to execution mode support to ERC7821 feat: add common to execution mode support to ERC7821 Sep 3, 2025
@legion2002 legion2002 changed the title feat: add common to execution mode support to ERC7821 feat: add common address execution mode support to ERC7821 Sep 3, 2025
}
bool isMultichain = nonce >> 240 == MULTICHAIN_NONCE_PREFIX;
bytes32 structHash = EfficientHashLib.hash(
uint256(EXECUTE_TYPEHASH), LibBit.toUint(isMultichain), uint256(a.hash()), nonce
Copy link
Contributor

Choose a reason for hiding this comment

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

isMultichain is redundant since we already get it from domain

}

bytes32[] memory a = EfficientHashLib.malloc(calls.length);
for (uint256 i; i < calls.length; ++i) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This means that someone can take a valid CallSansTo execution bundle and submit with the Call mode

Would prefer if we hash this a little differently to prevent that, its good design to only allow 1 possible way things can be executed with the same sig

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah good point, but does it matter if they are used interchangeably?
the nonce already does replay protection.

But yes maybe we should hash it separately, just to prevent footguns in the future

Copy link
Contributor

Choose a reason for hiding this comment

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

nothing obvious, but yep best to not have hanging things like this, there are attacks that could happen when you combine a bunch of hanging things


d.d.execute(_ERC7821_BATCH_SANS_TO_EXECUTION_MODE, t.executionData);

assertEq(targetFunctionPayloads.length, t.n);
Copy link
Contributor

Choose a reason for hiding this comment

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

redundant test

@howydev
Copy link
Contributor

howydev commented Sep 4, 2025

its not clear to me how this is flowing thru guarded executor, i might be missing something but either way lets add a spend limit test

@Vectorized
Copy link
Collaborator

Vectorized commented Sep 5, 2025

Wait, let me marinate first. Vectorized/solady#1485 (comment)

Imo, a native calldata compression like that in cdCompress will be better.

@legion2002 legion2002 added this to the next release milestone Sep 9, 2025
@jenpaff jenpaff modified the milestones: next release, v0.5.5 Sep 10, 2025
@legion2002 legion2002 modified the milestones: v0.5.5, v1.0.0 Sep 11, 2025
@legion2002 legion2002 self-assigned this Sep 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants