-
Notifications
You must be signed in to change notification settings - Fork 32
/
IExecutionHub.sol
70 lines (63 loc) · 3.59 KB
/
IExecutionHub.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
// SPDX-License-Identifier: MIT
pragma solidity 0.8.17;
import {MessageStatus} from "../libs/Structures.sol";
interface IExecutionHub {
/**
* @notice 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.
* @dev 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.
* @param msgPayload Raw payload with a formatted message to execute
* @param originProof Proof of inclusion of message in the Origin Merkle Tree
* @param snapProof Proof of inclusion of Origin State's Left Leaf into Snapshot Merkle Tree
* @param stateIndex Index of Origin State in the Snapshot
* @param gasLimit Gas limit for message execution
*/
function execute(
bytes memory msgPayload,
bytes32[] calldata originProof,
bytes32[] calldata snapProof,
uint8 stateIndex,
uint64 gasLimit
) external;
// ═══════════════════════════════════════════════════ VIEWS ═══════════════════════════════════════════════════════
/**
* @notice Returns attestation nonce for a given snapshot root.
* @dev Will return 0 if the root is unknown.
*/
function getAttestationNonce(bytes32 snapRoot) external view returns (uint32 attNonce);
/**
* @notice Checks the validity of the unsigned message receipt.
* @dev 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.
* @param rcptPayload Raw payload with Receipt data
* @return isValid Whether the requested receipt is valid.
*/
function isValidReceipt(bytes memory rcptPayload) external view returns (bool isValid);
/**
* @notice Returns message execution status: None/Failed/Success.
* @param messageHash Hash of the message payload
* @return status Message execution status
*/
function messageStatus(bytes32 messageHash) external view returns (MessageStatus status);
/**
* @notice Returns a formatted payload with the message receipt.
* @dev 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.
* @param messageHash Hash of the message payload
* @return data Formatted payload with the message execution receipt
*/
function messageReceipt(bytes32 messageHash) external view returns (bytes memory data);
}