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.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
Create a JS-style callback template for use in the
Connext.solcontract. If the callback address is specified, the result fromExecutor.executewill 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:
callDatato be executed on a destination domainConnext.xcall(...)callDatais executed on the destination domainConnext.solreturns the result via aPromiseRouteron 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:
xcallcallbackFeeis included, it should be transferred to the localPromiseRouterand stored bytransactionIdexecuteExecutor.executefunction, if a callback address is provided it should callPromiseRouter.send(...)to dispatch the callback to the origin chainPromiseRoutershould format the message and callHome.sendto dispatch the callback data through nomadhandlewhich will store the message data onchain but will not execute the callback. The callback is not executed as a part of thehandlefunction to avoid putting arbitrary gas obligations onto the nomad routersPromiseRouter.processto execute the callback from the stored datarelayerFeeis paid directly to themsg.senderIf no callback is provided, the
executefunction should behave normally.PromiseRouterandPromiseMessageThis design relies on a lightweight nomad
PromiseRouterthat 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
PromiseMessageshould encode the callback address, transfer identifier, and calldata. Any information required about the transfer should also be included in this message.ICallbackEvery contract that wishes to handle the return data from the destination domain should implement the following interface:
IConnextThe
IConnext.CallParamsshould be updated to include:In
executeit should:Test Cases
This is a minimum required list of tests, but more should be included.
Open Questions
Tasks
PromiseRouterwrittenPromiseMessagewrittenExecutorBeta Was this translation helpful? Give feedback.
All reactions