Origin Domain Callback Interaction #883
Replies: 3 comments 1 reply
-
As discussed in discord, need to include official transfer ID in (at least) the return call on the origin domain, so the origin domain contract can validate that the return call is the one it sent (and not a malicious imposter call)...
Well, we are calling
Batching should be done on the part of the consumer here. Basically, bus over as much data as you can in one go.
How would permissioning in this context concern anyone other than us? If someone not permissioned to do the callback does the callback, it sounds like that's a nomad/connext infra failure. Shouldn't only the
Can you explain how it could consume unbounded gas if we have a messaging size limit? Sry im wooshing |
Beta Was this translation helpful? Give feedback.
-
Going to address some of the open questions:
We will have to take the same approach as we do with our existing nomad integration -- batch if needed. It's likely the cost for this is much lower than the bridge router because it is a very lightweight router.
The enqueue of the promise into nomad will be implicit when the estimate gas using the SDK. We can expose the gas overhead as a constant for doing this. The more important (and difficult to incentivize) relay fee is the one for processing/executing the callback. If we don't include this as part of the The annoying part about handling this in our system is the callback address would have to store the fee and the fee amount as the
Can't -- should be isolated from the nomad agents.
Can easily expose similar properties re: origin and destination initiators. |
Beta Was this translation helpful? Give feedback.
-
Made into spec |
Beta Was this translation helpful? Give feedback.
-
Summary
Create a JS-style callback template for use in the
Connext.sol
contract. If the callback address is specified, the result fromExecutor.execute
will be returned to the callback address via Nomad, and a handler will be executed.Motivation
One of the great things about the Amarok upgrade is it can enable JS-style callbacks to respond to some call on a destination domain. The flow here (at a high level) would be:
callData
to be executed on a destination domainConnext.xcall(...)
callData
is executed on the destination domainConnext.sol
returns the result via aPromiseRouter
on nomad to the specified address on the origin domainIn this way contracts could handle something that happened on a different domain. Imagine a DAO initiates a crosschain call, but something on the destination domain is not executed properly. The callback on the origin domain could contain error-handling logic to address the failure.
Design Requirements
To be effective, the following goals must be met:
Proposed Solution
At a high level, the following should happen when a callback is provided:
xcall
callbackFee
is included, it should be transferred to the localPromiseRouter
and stored bytransactionId
execute
Executor.execute
function, if a callback address is provided it should callPromiseRouter.send(...)
to dispatch the callback to the origin chainPromiseRouter
should format the message and callHome.send
to dispatch the callback data through nomadhandle
which will store the message data onchain but will not execute the callback. The callback is not executed as a part of thehandle
function to avoid putting arbitrary gas obligations onto the nomad routersPromiseRouter.process
to execute the callback from the stored datarelayerFee
is paid directly to themsg.sender
If no callback is provided, the
execute
function should behave normally.PromiseRouter
andPromiseMessage
This design relies on a lightweight nomad
PromiseRouter
that is responsible for simply forwarding data across domains. The message structure should be flexible, but the length of the data should be capped to cap gas costs. The message can be prefixed with a single-byte version number to allow flexibility. The handler itself should have the following interface:The
PromiseMessage
should encode the callback address, transfer identifier, and calldata. Any information required about the transfer should also be included in this message.ICallback
Every contract that wishes to handle the return data from the destination domain should implement the following interface:
IConnext
The
IConnext.CallParams
should be updated to include:In
execute
it should:Test Cases
This is a minimum required list of tests, but more should be included.
Open Questions
Tasks
PromiseRouter
writtenPromiseMessage
writtenExecutor
Beta Was this translation helpful? Give feedback.
All reactions