Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to handle on ZetaChain results from connected chain calls #2736

Open
Tracked by #2994
lumtis opened this issue Aug 19, 2024 · 0 comments
Open
Tracked by #2994

Add ability to handle on ZetaChain results from connected chain calls #2736

lumtis opened this issue Aug 19, 2024 · 0 comments
Labels
feature:idea An early idea for a feature. Used as reference to follow new feature integrations feature:smart-contracts Related to extending smart contracts capability and interactions with ZEVM

Comments

@lumtis
Copy link
Member

lumtis commented Aug 19, 2024

Describe the Issue

New smart contract architecture provides ability to perform abritrary smart contract call on connected.
To fully take advantage of this feature, we should add ability to handle the result from the smart contract.

On smart contract

The solution would contains a lot of similarities with the revert management.
We first define a new interface called:

interface ResultReceiver {
    function onResult(ResultContext calldata resultContext, bytes calldata result) external;
}

The resultContext can store various data, but in particular, like revertContext, would contains an arbitrary message for the smart contract to be able to understand the origin, what call, the result belongs to

struct ResultContext {
    bytes resultMessage;
}

A resultOptions can be provided to instruct how to handle the results:

struct ResultOptions {
    address resultReceiver;
    bytes resultMessage;
}

The interface of call and withdrawAndCall is extended to allow provided a resultOptions. When provided result is processed.

During the calls, the gateway would include the result as part of the emitted event

        bytes memory result = _execute(destination, data);

        emit Executed(destination, msg.value, data, result);

On protocol

The protocol (ZetaClient included), read the result as part of the event, this data is added in the CCTX object along with the resultOptions

When resultOptions instructs to process result, at the outbound processing stage, the protocol calls the onResult hook.

A new CCTX status should be added: something like OutboundResultProcessingFailed

@lumtis lumtis added feature:idea An early idea for a feature. Used as reference to follow new feature integrations feature:smart-contracts Related to extending smart contracts capability and interactions with ZEVM labels Aug 19, 2024
@lumtis lumtis changed the title Provide ability to handle on ZetaChain results from connected chain calls Add ability to handle on ZetaChain results from connected chain calls Aug 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature:idea An early idea for a feature. Used as reference to follow new feature integrations feature:smart-contracts Related to extending smart contracts capability and interactions with ZEVM
Projects
None yet
Development

No branches or pull requests

1 participant