-
Notifications
You must be signed in to change notification settings - Fork 32
/
IStateHub.sol
40 lines (36 loc) · 1.98 KB
/
IStateHub.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
// SPDX-License-Identifier: MIT
pragma solidity 0.8.17;
interface IStateHub {
/**
* @notice Check that a given state is valid: matches the historical state of Origin contract.
* Note: any Agent including an invalid state in their snapshot will be slashed
* upon providing the snapshot and agent signature for it to Origin contract.
* @dev Will revert if any of these is true:
* - State payload is not properly formatted.
* @param statePayload Raw payload with state data
* @return isValid Whether the provided state is valid
*/
function isValidState(bytes memory statePayload) external view returns (bool isValid);
/**
* @notice Returns the amount of saved states so far.
* @dev This includes the initial state of "empty Origin Merkle Tree".
*/
function statesAmount() external view returns (uint256);
/**
* @notice Suggest the data (state after latest sent message) to sign for an Agent.
* Note: signing the suggested state data will will never lead to slashing of the actor,
* assuming they have confirmed that the block, which number is included in the data,
* is not subject to reorganization (which is different for every observed chain).
* @return statePayload Raw payload with the latest state data
*/
function suggestLatestState() external view returns (bytes memory statePayload);
/**
* @notice Given the historical nonce, suggest the state data to sign for an Agent.
* Note: signing the suggested state data will will never lead to slashing of the actor,
* assuming they have confirmed that the block, which number is included in the data,
* is not subject to reorganization (which is different for every observed chain).
* @param nonce Historical nonce to form a state
* @return statePayload Raw payload with historical state data
*/
function suggestState(uint32 nonce) external view returns (bytes memory statePayload);
}