Delegated execution and multicalls #738
Replies: 4 comments 2 replies
-
General feedback:
|
Beta Was this translation helpful? Give feedback.
-
I'd consider allowing failure decisions at every step instead of requiring a global one. This would enable patterns like:
|
Beta Was this translation helpful? Give feedback.
-
This reminds me of the Cosmos transaction model which also consists of multiple messages. As far as I can tell from the lifecycle they do not allow different abortion behaviour per message, though. |
Beta Was this translation helpful? Give feedback.
-
Further thought on this revealed that handling replay and nonces is complicated and undermines the utility quite a bit. I'm putting this aside for now, since I don't see an easy implementation. |
Beta Was this translation helpful? Give feedback.
-
Motivation
Many on-chain interactions require messages to be sent to more than one actor. One common example is approving a token allocation before then calling another contract to use
TransferFrom
to pull tokens from the caller’s balance. Sending these as two separate top-level messages is a poor user experience, and requires two signature verifications. A multicall is a name for a mechanism where a single top-level message can make multiple invocations to different actors with only a single signature verification.Independently, some applications would benefit from delegation of execution, where one party submits (and pays gas for) a message on behalf of another. A motivating example is the proposed direction creation of datacap allocations by clients in #730. In the current flow, SPs submit deal proposals that are internally signed by the client. A similar flow could be achieved for datacap allocations if the SP could submit an allocation message signed by the client. In some blockchains, the account abstraction mechanism is powerful enough to achieve that, but current plans for Filecoin (#388) are simpler. Filecoin can achieve a similar result with a standardised delegated execution method.
These two needs can be solved together, because delegated execution would also benefit from multicalls.
Proposal
Standardise a method for delegated execution and implement it in the built-in account actor. The same method may be implemented by smart-contract wallets in the future.
Edit 2023-06-26: added
Value
toCall
.The Execute method makes zero or more invocations to other actors.
The specified calls are executed in order. If one exits with a non-zero exit code, actor must either:
Note that Execute always exits with a status code of OK unless the failure handling is ABORT and a call fails.
The return value from Execute includes the exit code and return value from all calls that were executed. For calls that were not executed due to STOP failure semantics, the exit code must be
FRC42_hash('ExecuteStop')
.Discussion
Multicalls and delegated execution could be implemented as separate methods. Unless multicalls were also built-in to the delegated execution method (i.e. this proposal), a delegated multicall would require two levels of indirection: Delegate → Execute → Calls. If multicalls are built in to the delegated execution, a distinct multicall method is redundant.
For the cited use case of datacap allocations, an alternative to delegated execution is to build something directly into the verified registry actor whereby an SP could submit a signed voucher for an allocation that is checked explicitly by the verified registry. The proposed standard delegated execution method is a general pattern that could solve this problem for other, future use cases, without requiring explicit foresight and implementation for each one.
We need to decide whether to implement this method in the built-in multisig and EVMAccount actors too.
Beta Was this translation helpful? Give feedback.
All reactions