IExecutionHub
Functions
execute
Attempts to prove inclusion of message into one of Snapshot Merkle Trees, previously submitted to this contract in a form of a signed Attestation. Proven message is immediately executed by passing its contents to the specified recipient.
*Will revert if any of these is true:
- Message is not meant to be executed on this chain
- Message was sent from this chain
- Message payload is not properly formatted.
- Snapshot root (reconstructed from message hash and proofs) is unknown
- Snapshot root is known, but was submitted by an inactive Notary
- Snapshot root is known, but optimistic period for a message hasn't passed
- Provided gas limit is lower than the one requested in the message
- Recipient doesn't implement a
handle
method (refer to IMessageRecipient.sol) - Recipient reverted upon receiving a message Note: refer to libs/memory/State.sol for details about Origin State's sub-leafs.*
function execute(
bytes memory msgPayload,
bytes32[] calldata originProof,
bytes32[] calldata snapProof,
uint8 stateIndex,
uint64 gasLimit
) external;
Parameters
Name | Type | Description |
---|---|---|
msgPayload | bytes | Raw payload with a formatted message to execute |
originProof | bytes32[] | Proof of inclusion of message in the Origin Merkle Tree |
snapProof | bytes32[] | Proof of inclusion of Origin State's Left Leaf into Snapshot Merkle Tree |
stateIndex | uint8 | Index of Origin State in the Snapshot |
gasLimit | uint64 | Gas limit for message execution |
getAttestationNonce
Returns attestation nonce for a given snapshot root.
Will return 0 if the root is unknown.
function getAttestationNonce(bytes32 snapRoot) external view returns (uint32 attNonce);
isValidReceipt
Checks the validity of the unsigned message receipt.
*Will revert if any of these is true:
- Receipt payload is not properly formatted.
- Receipt signer is not an active Notary.
- Receipt destination chain does not refer to this chain.*
function isValidReceipt(bytes memory rcptPayload) external view returns (bool isValid);
Parameters
Name | Type | Description |
---|---|---|
rcptPayload | bytes | Raw payload with Receipt data |
Returns
Name | Type | Description |
---|---|---|
isValid | bool | Whether the requested receipt is valid. |
messageStatus
Returns message execution status: None/Failed/Success.
function messageStatus(bytes32 messageHash) external view returns (MessageStatus status);
Parameters
Name | Type | Description |
---|---|---|
messageHash | bytes32 | Hash of the message payload |
Returns
Name | Type | Description |
---|---|---|
status | MessageStatus | Message execution status |
messageReceipt
Returns a formatted payload with the message receipt.
Notaries could derive the tips, and the tips proof using the message payload, and submit
the signed receipt with the proof of tips to Summit
in order to initiate tips distribution.
function messageReceipt(bytes32 messageHash) external view returns (bytes memory data);
Parameters
Name | Type | Description |
---|---|---|
messageHash | bytes32 | Hash of the message payload |
Returns
Name | Type | Description |
---|---|---|
data | bytes | Formatted payload with the message execution receipt |