IStatementInbox

Git Source

Functions

submitStateReportWithSnapshot

Accepts a Guard's state report signature, a Snapshot containing the reported State, as well as Notary signature for the Snapshot.

StateReport is a Guard statement saying "Reported state is invalid".

  • This results in an opened Dispute between the Guard and the Notary.
  • Note: Guard could (but doesn't have to) form a StateReport and use other values from verifyStateWithSnapshot() successful call that led to Notary being slashed in remote Origin.

Will revert if any of these is true:

  • State Report signer is not an active Guard.
  • Snapshot payload is not properly formatted.
  • Snapshot signer is not an active Notary.
  • State index is out of range.
  • The Guard or the Notary are already in a Dispute
function submitStateReportWithSnapshot(
    uint8 stateIndex,
    bytes memory srSignature,
    bytes memory snapPayload,
    bytes memory snapSignature
) external returns (bool wasAccepted);

Parameters

NameTypeDescription
stateIndexuint8Index of the reported State in the Snapshot
srSignaturebytesGuard signature for the report
snapPayloadbytesRaw payload with Snapshot data
snapSignaturebytesNotary signature for the Snapshot

Returns

NameTypeDescription
wasAcceptedboolWhether the Report was accepted (resulting in Dispute between the agents)

submitStateReportWithAttestation

Accepts a Guard's state report signature, a Snapshot containing the reported State, as well as Notary signature for the Attestation created from this Snapshot.

StateReport is a Guard statement saying "Reported state is invalid".

  • This results in an opened Dispute between the Guard and the Notary.
  • Note: Guard could (but doesn't have to) form a StateReport and use other values from verifyStateWithAttestation() successful call that led to Notary being slashed in remote Origin.

Will revert if any of these is true:

  • State Report signer is not an active Guard.
  • Snapshot payload is not properly formatted.
  • State index is out of range.
  • Attestation payload is not properly formatted.
  • Attestation signer is not an active Notary.
  • Attestation's snapshot root is not equal to Merkle Root derived from the Snapshot.
  • The Guard or the Notary are already in a Dispute
function submitStateReportWithAttestation(
    uint8 stateIndex,
    bytes memory srSignature,
    bytes memory snapPayload,
    bytes memory attPayload,
    bytes memory attSignature
) external returns (bool wasAccepted);

Parameters

NameTypeDescription
stateIndexuint8Index of the reported State in the Snapshot
srSignaturebytesGuard signature for the report
snapPayloadbytesRaw payload with Snapshot data
attPayloadbytesRaw payload with Attestation data
attSignaturebytesNotary signature for the Attestation

Returns

NameTypeDescription
wasAcceptedboolWhether the Report was accepted (resulting in Dispute between the agents)

submitStateReportWithSnapshotProof

Accepts a Guard's state report signature, a proof of inclusion of the reported State in an Attestation, as well as Notary signature for the Attestation.

StateReport is a Guard statement saying "Reported state is invalid".

  • This results in an opened Dispute between the Guard and the Notary.
  • Note: Guard could (but doesn't have to) form a StateReport and use other values from verifyStateWithSnapshotProof() successful call that led to Notary being slashed in remote Origin.

Will revert if any of these is true:

  • State payload is not properly formatted.
  • State Report signer is not an active Guard.
  • Attestation payload is not properly formatted.
  • Attestation signer is not an active Notary.
  • Attestation's snapshot root is not equal to Merkle Root derived from State and Snapshot Proof.
  • Snapshot Proof's first element does not match the State metadata.
  • Snapshot Proof length exceeds Snapshot Tree Height.
  • State index is out of range.
  • The Guard or the Notary are already in a Dispute
function submitStateReportWithSnapshotProof(
    uint8 stateIndex,
    bytes memory statePayload,
    bytes memory srSignature,
    bytes32[] memory snapProof,
    bytes memory attPayload,
    bytes memory attSignature
) external returns (bool wasAccepted);

Parameters

NameTypeDescription
stateIndexuint8Index of the reported State in the Snapshot
statePayloadbytesRaw payload with State data that Guard reports as invalid
srSignaturebytesGuard signature for the report
snapProofbytes32[]Proof of inclusion of reported State's Left Leaf into Snapshot Merkle Tree
attPayloadbytesRaw payload with Attestation data
attSignaturebytesNotary signature for the Attestation

Returns

NameTypeDescription
wasAcceptedboolWhether the Report was accepted (resulting in Dispute between the agents)

verifyReceipt

Verifies a message receipt signed by the Notary.

  • Does nothing, if the receipt is valid (matches the saved receipt data for the referenced message).
  • Slashes the Notary, if the receipt is invalid.

Will revert if any of these is true:

  • Receipt payload is not properly formatted.
  • Receipt signer is not an active Notary.
  • Receipt's destination chain does not refer to this chain.
function verifyReceipt(bytes memory rcptPayload, bytes memory rcptSignature) external returns (bool isValidReceipt);

Parameters

NameTypeDescription
rcptPayloadbytesRaw payload with Receipt data
rcptSignaturebytesNotary signature for the receipt

Returns

NameTypeDescription
isValidReceiptboolWhether the provided receipt is valid. Notary is slashed, if return value is FALSE.

verifyReceiptReport

Verifies a Guard's receipt report signature.

  • Does nothing, if the report is valid (if the reported receipt is invalid).
  • Slashes the Guard, if the report is invalid (if the reported receipt is valid).

Will revert if any of these is true:

  • Receipt payload is not properly formatted.
  • Receipt Report signer is not an active Guard.
  • Receipt does not refer to this chain.
function verifyReceiptReport(bytes memory rcptPayload, bytes memory rrSignature)
    external
    returns (bool isValidReport);

Parameters

NameTypeDescription
rcptPayloadbytesRaw payload with Receipt data that Guard reports as invalid
rrSignaturebytesGuard signature for the report

Returns

NameTypeDescription
isValidReportboolWhether the provided report is valid. Guard is slashed, if return value is FALSE.

verifyStateWithAttestation

Verifies a state from the snapshot, that was used for the Notary-signed attestation.

  • Does nothing, if the state is valid (matches the historical state of this contract).
  • Slashes the Notary, if the state is invalid.

Will revert if any of these is true:

  • Attestation payload is not properly formatted.
  • Attestation signer is not an active Notary.
  • Attestation's snapshot root is not equal to Merkle Root derived from the Snapshot.
  • Snapshot payload is not properly formatted.
  • State index is out of range.
  • State does not refer to this chain.
function verifyStateWithAttestation(
    uint8 stateIndex,
    bytes memory snapPayload,
    bytes memory attPayload,
    bytes memory attSignature
) external returns (bool isValidState);

Parameters

NameTypeDescription
stateIndexuint8State index to check
snapPayloadbytesRaw payload with snapshot data
attPayloadbytesRaw payload with Attestation data
attSignaturebytesNotary signature for the attestation

Returns

NameTypeDescription
isValidStateboolWhether the provided state is valid. Notary is slashed, if return value is FALSE.

verifyStateWithSnapshotProof

Verifies a state from the snapshot, that was used for the Notary-signed attestation.

  • Does nothing, if the state is valid (matches the historical state of this contract).
  • Slashes the Notary, if the state is invalid.

Will revert if any of these is true:

  • Attestation payload is not properly formatted.
  • Attestation signer is not an active Notary.
  • Attestation's snapshot root is not equal to Merkle Root derived from State and Snapshot Proof.
  • Snapshot Proof's first element does not match the State metadata.
  • Snapshot Proof length exceeds Snapshot Tree Height.
  • State payload is not properly formatted.
  • State index is out of range.
  • State does not refer to this chain.
function verifyStateWithSnapshotProof(
    uint8 stateIndex,
    bytes memory statePayload,
    bytes32[] memory snapProof,
    bytes memory attPayload,
    bytes memory attSignature
) external returns (bool isValidState);

Parameters

NameTypeDescription
stateIndexuint8Index of state in the snapshot
statePayloadbytesRaw payload with State data to check
snapProofbytes32[]Proof of inclusion of provided State's Left Leaf into Snapshot Merkle Tree
attPayloadbytesRaw payload with Attestation data
attSignaturebytesNotary signature for the attestation

Returns

NameTypeDescription
isValidStateboolWhether the provided state is valid. Notary is slashed, if return value is FALSE.

verifyStateWithSnapshot

Verifies a state from the snapshot (a list of states) signed by a Guard or a Notary.

  • Does nothing, if the state is valid (matches the historical state of this contract).
  • Slashes the Agent, if the state is invalid.

Will revert if any of these is true:

  • Snapshot payload is not properly formatted.
  • Snapshot signer is not an active Agent.
  • State index is out of range.
  • State does not refer to this chain.
function verifyStateWithSnapshot(uint8 stateIndex, bytes memory snapPayload, bytes memory snapSignature)
    external
    returns (bool isValidState);

Parameters

NameTypeDescription
stateIndexuint8State index to check
snapPayloadbytesRaw payload with snapshot data
snapSignaturebytesAgent signature for the snapshot

Returns

NameTypeDescription
isValidStateboolWhether the provided state is valid. Agent is slashed, if return value is FALSE.

verifyStateReport

Verifies a Guard's state report signature.

  • Does nothing, if the report is valid (if the reported state is invalid).
  • Slashes the Guard, if the report is invalid (if the reported state is valid).

Will revert if any of these is true:

  • State payload is not properly formatted.
  • State Report signer is not an active Guard.
  • Reported State does not refer to this chain.
function verifyStateReport(bytes memory statePayload, bytes memory srSignature) external returns (bool isValidReport);

Parameters

NameTypeDescription
statePayloadbytesRaw payload with State data that Guard reports as invalid
srSignaturebytesGuard signature for the report

Returns

NameTypeDescription
isValidReportboolWhether the provided report is valid. Guard is slashed, if return value is FALSE.

getReportsAmount

Returns the amount of Guard Reports stored in StatementInbox.

Only reports that led to opening a Dispute are stored.

function getReportsAmount() external view returns (uint256);

getGuardReport

Returns the Guard report with the given index stored in StatementInbox.

Only reports that led to opening a Dispute are stored.

Will revert if report with given index doesn't exist.

function getGuardReport(uint256 index)
    external
    view
    returns (bytes memory statementPayload, bytes memory reportSignature);

Parameters

NameTypeDescription
indexuint256Report index

Returns

NameTypeDescription
statementPayloadbytesRaw payload with statement that Guard reported as invalid
reportSignaturebytesGuard signature for the report

getStoredSignature

Returns the signature with the given index stored in StatementInbox.

Will revert if signature with given index doesn't exist.

function getStoredSignature(uint256 index) external view returns (bytes memory);

Parameters

NameTypeDescription
indexuint256Signature index

Returns

NameTypeDescription
<none>bytesRaw payload with signature