node icon indicating copy to clipboard operation
node copied to clipboard

Return CCTX status (finalization) back to universal app contract

Open fadeev opened this issue 1 year ago • 3 comments

A universal app making a call to a contract on a connected chain is an asynchronous process. It's calling the gateway and it doesn't really know if the call was successful or not (universal app has to assume it was successful if it didn't receive a revert).

What if instead a gateway call return a CCTX identifier (incrementing integer):

uint256 cctxId = gatewayZEVM.call(...)
// store cctxId in contract state

And once the tx is finalized on the connected chain, ZetaChain would call universal app's handler with the status.

function onFinalized(uint256 cctxId)

This will allow universal apps to get a confirmation that the call was successfully made without requiring a contract on a connected chain to use the gateway to send a message back.

This is somewhat related to https://github.com/zeta-chain/node/issues/2736

fadeev avatar Oct 04 '24 18:10 fadeev

This is somewhat related to https://github.com/zeta-chain/node/issues/2736

What difference do you see with this solution?

lumtis avatar Oct 07 '24 08:10 lumtis

Just realized there is no way right now to know what is the cctx ID when a smart contract does a deposit https://github.com/zeta-chain/node/issues/2971

lumtis avatar Oct 07 '24 09:10 lumtis

This is somewhat related to #2736

What difference do you see with this solution?

If a gateway returned CCTX ID (or just an incrementing integer that maps to a real CCTX ID) it will allow universal apps to keep track of CCTXs. Right now it's still possible if you create your own ID and put it into a message, but returning it from a gateway.call seems like a clean way of making it a part of the protocol.

fadeev avatar Oct 07 '24 09:10 fadeev