ISnapshotHub

Git Source

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

NameTypeDescription
attPayloadbytesRaw payload with attestation data

Returns

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

NameTypeDescription
attNonceuint32Nonce for the attestation

Returns

NameTypeDescription
attPayloadbytesRaw payload with formatted Attestation data
agentRootbytes32Agent root hash used for the attestation
snapGasuint256[]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

NameTypeDescription
originuint32Domain of origin chain
agentaddressAgent address

Returns

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

NameTypeDescription
notaryaddressNotary address

Returns

NameTypeDescription
attPayloadbytesRaw payload with formatted Attestation data
agentRootbytes32Agent root hash used for the attestation
snapGasuint256[]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

NameTypeDescription
indexuint256Snapshot index in the list of all Guard snapshots

Returns

NameTypeDescription
snapPayloadbytesRaw payload with Guard snapshot
snapSignaturebytesRaw 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

NameTypeDescription
indexuint256Snapshot index in the list of all Notary snapshots

Returns

NameTypeDescription
snapPayloadbytesRaw payload with Notary snapshot
snapSignaturebytesRaw 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

NameTypeDescription
attPayloadbytesRaw payload with attestation data

Returns

NameTypeDescription
snapPayloadbytesRaw payload with Notary snapshot
snapSignaturebytesRaw 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

NameTypeDescription
attNonceuint32Nonce for the attestation
stateIndexuint8Index of state in the attestation's snapshot

Returns

NameTypeDescription
snapProofbytes32[]The snapshot proof