ISnapshotHub
Functions
isValidAttestation
Check that a given attestation is valid: matches the historical attestation derived from an accepted Notary snapshot.
*Will revert if any of these is true:
- Attestation payload is not properly formatted.*
function isValidAttestation(bytes memory attPayload) external view returns (bool isValid);
Parameters
| Name | Type | Description |
|---|---|---|
attPayload | bytes | Raw payload with attestation data |
Returns
| Name | Type | Description |
|---|---|---|
isValid | bool | Whether the provided attestation is valid |
getAttestation
Returns saved attestation with the given nonce.
Reverts if attestation with given nonce hasn't been created yet.
function getAttestation(uint32 attNonce)
external
view
returns (bytes memory attPayload, bytes32 agentRoot, uint256[] memory snapGas);
Parameters
| Name | Type | Description |
|---|---|---|
attNonce | uint32 | Nonce for the attestation |
Returns
| Name | Type | Description |
|---|---|---|
attPayload | bytes | Raw payload with formatted Attestation data |
agentRoot | bytes32 | Agent root hash used for the attestation |
snapGas | uint256[] | Snapshot gas data used for the attestation |
getLatestAgentState
Returns the state with the highest known nonce submitted by a given Agent.
function getLatestAgentState(uint32 origin, address agent) external view returns (bytes memory statePayload);
Parameters
| Name | Type | Description |
|---|---|---|
origin | uint32 | Domain of origin chain |
agent | address | Agent address |
Returns
| Name | Type | Description |
|---|---|---|
statePayload | bytes | Raw payload with agent's latest state for origin |
getLatestNotaryAttestation
Returns latest saved attestation for a Notary.
function getLatestNotaryAttestation(address notary)
external
view
returns (bytes memory attPayload, bytes32 agentRoot, uint256[] memory snapGas);
Parameters
| Name | Type | Description |
|---|---|---|
notary | address | Notary address |
Returns
| Name | Type | Description |
|---|---|---|
attPayload | bytes | Raw payload with formatted Attestation data |
agentRoot | bytes32 | Agent root hash used for the attestation |
snapGas | uint256[] | Snapshot gas data used for the attestation |
getGuardSnapshot
Returns Guard snapshot from the list of all accepted Guard snapshots.
Reverts if snapshot with given index hasn't been accepted yet.
function getGuardSnapshot(uint256 index) external view returns (bytes memory snapPayload, bytes memory snapSignature);
Parameters
| Name | Type | Description |
|---|---|---|
index | uint256 | Snapshot index in the list of all Guard snapshots |
Returns
| Name | Type | Description |
|---|---|---|
snapPayload | bytes | Raw payload with Guard snapshot |
snapSignature | bytes | Raw payload with Guard signature for snapshot |
getNotarySnapshot
Returns Notary snapshot from the list of all accepted Guard snapshots.
Reverts if snapshot with given index hasn't been accepted yet.
function getNotarySnapshot(uint256 index)
external
view
returns (bytes memory snapPayload, bytes memory snapSignature);
Parameters
| Name | Type | Description |
|---|---|---|
index | uint256 | Snapshot index in the list of all Notary snapshots |
Returns
| Name | Type | Description |
|---|---|---|
snapPayload | bytes | Raw payload with Notary snapshot |
snapSignature | bytes | Raw payload with Notary signature for snapshot |
getNotarySnapshot
Returns Notary snapshot that was used for creating a given attestation.
*Reverts if any of these is true:
- Attestation payload is not properly formatted.
- Attestation is invalid (doesn't have a matching Notary snapshot).*
function getNotarySnapshot(bytes memory attPayload)
external
view
returns (bytes memory snapPayload, bytes memory snapSignature);
Parameters
| Name | Type | Description |
|---|---|---|
attPayload | bytes | Raw payload with attestation data |
Returns
| Name | Type | Description |
|---|---|---|
snapPayload | bytes | Raw payload with Notary snapshot |
snapSignature | bytes | Raw payload with Notary signature for snapshot |
getSnapshotProof
Returns proof of inclusion of (root, origin) fields of a given snapshot's state into the Snapshot Merkle Tree for a given attestation.
*Reverts if any of these is true:
- Attestation with given nonce hasn't been created yet.
- State index is out of range of snapshot list.*
function getSnapshotProof(uint32 attNonce, uint8 stateIndex) external view returns (bytes32[] memory snapProof);
Parameters
| Name | Type | Description |
|---|---|---|
attNonce | uint32 | Nonce for the attestation |
stateIndex | uint8 | Index of state in the attestation's snapshot |
Returns
| Name | Type | Description |
|---|---|---|
snapProof | bytes32[] | The snapshot proof |