IExecutionHub

Git Source

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

NameTypeDescription
msgPayloadbytesRaw payload with a formatted message to execute
originProofbytes32[]Proof of inclusion of message in the Origin Merkle Tree
snapProofbytes32[]Proof of inclusion of Origin State's Left Leaf into Snapshot Merkle Tree
stateIndexuint8Index of Origin State in the Snapshot
gasLimituint64Gas 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

NameTypeDescription
rcptPayloadbytesRaw payload with Receipt data

Returns

NameTypeDescription
isValidboolWhether the requested receipt is valid.

messageStatus

Returns message execution status: None/Failed/Success.

function messageStatus(bytes32 messageHash) external view returns (MessageStatus status);

Parameters

NameTypeDescription
messageHashbytes32Hash of the message payload

Returns

NameTypeDescription
statusMessageStatusMessage 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

NameTypeDescription
messageHashbytes32Hash of the message payload

Returns

NameTypeDescription
databytesFormatted payload with the message execution receipt