EVM: Add support for dynamic call intents#52
Conversation
| */ | ||
| struct DynamicCallOperation { | ||
| uint256 chainId; | ||
| bytes[] calls; |
There was a problem hiding this comment.
Note: bytes[] instead of DynamicCall[] to avoid stack-too-deep error
| _transferFrom(transfer.token, operation.user, transfer.recipient, transfer.amount, isSmartAccount); | ||
| } | ||
|
|
||
| outputs = new bytes[](0); |
There was a problem hiding this comment.
We could include the balance diff instead (as we do in swaps). If we decide to do so, I'd do it in a separate PR.
| * The encoder follows standard ABI encoding rules, reconstructing | ||
| * the calldata heads and tails dynamically based on argument types. | ||
| */ | ||
| contract DynamicCallEncoder is IDynamicCallEncoder { |
There was a problem hiding this comment.
Should DynamicCallEncoder be a library instead of a contract?
If we keep it as a contract, we can update its reference in the Settler and change its behavior without redeploying the Settler. However, any changes to DynamicCallEncoder will probably be related to changes to DynamicCallTypes, and that would require redeploying the Settler anyway. So in practice, we’d likely have to redeploy the Settler anyways.
Also, note that the Settler will be upgradeable from now on.
Let me know what you think.
Co-authored-by: Facu Spagnuolo <facuspagnuolo@users.noreply.github.com>
| // Skip the ABI-encoded offset and length of the outer `bytes` to point at the inner payload | ||
| assembly { | ||
| result := add(result, 64) | ||
| } |
There was a problem hiding this comment.
Would it be possible to sth like
| } | |
| // Skip the ABI-encoded offset and length of the outer `bytes` to point at the inner payload | |
| result = abi.decode(result, (bytes)); |
There was a problem hiding this comment.
I thought they were equivalent. I changed it in evm: optimize SmartAccountsHandlerHelpers call because it consumes less gas.
Let me know if I should roll it back.
5fed564
into
evm/refactor-intents-with-operations
This PR introduces support for dynamic call intents, enabling calldata to be built on-chain from structured arguments instead of precomputed calldata.
Dynamic calls support:
The encoder reconstructs ABI calldata at execution time following the Aggregatable ABI Encoding approach proposed by OpenZeppelin, allowing intents to be composed, parameterized, and chained without relying on off-chain calldata generation. This unlocks more flexible and expressive intent definitions while preserving standard ABI semantics.