IConsensus
Provides consensus over the set of valid output Merkle root hashes for applications.
The latest output Merkle root hash is available after the machine processes every input. This hash can be later used to prove that any given output was ever produced by the machine.
After an epoch is finalized, a validator may submit a claim containing the application contract address, and the output Merkle root hash.
Validators may synchronize epoch finalization, but such mechanism is not specified by this interface.
A validator should be able to save transaction fees by not submitting a claim if it was...
- already submitted by the validator (see the
ClaimSubmission
event) or; - already accepted by the consensus (see the
ClaimAcceptance
event).
The acceptance criteria for claims may depend on the type of consensus, and is not specified by this interface. For example, a claim may be accepted if it was...
- submitted by an authority or;
- submitted by the majority of a quorum or;
- submitted and not proven wrong after some period of time or;
- submitted and proven correct through an on-chain tournament.
Functions
submitClaim
Submit a claim to the consensus.
MUST fire a ClaimSubmission
event.
MAY fire a ClaimAcceptance
event, if the acceptance criteria is met.
function submitClaim(address appContract, bytes32 claim) external;
Parameters
Name | Type | Description |
---|---|---|
appContract | address | The application contract address |
claim | bytes32 | The output Merkle root hash |
wasClaimAccepted
Check if an output Merkle root hash was ever accepted by the consensus for a particular application.
function wasClaimAccepted(address appContract, bytes32 claim) external view returns (bool);
Parameters
Name | Type | Description |
---|---|---|
appContract | address | The application contract address |
claim | bytes32 | The output Merkle root hash |
Events
ClaimSubmission
MUST trigger when a claim is submitted.
event ClaimSubmission(address indexed submitter, address indexed appContract, bytes32 claim);
Parameters
Name | Type | Description |
---|---|---|
submitter | address | The submitter address |
appContract | address | The application contract address |
claim | bytes32 | The output Merkle root hash |
ClaimAcceptance
MUST trigger when a claim is accepted.
MUST be triggered after some ClaimSubmission
event regarding appContract
.
event ClaimAcceptance(address indexed appContract, bytes32 claim);
Parameters
Name | Type | Description |
---|---|---|
appContract | address | The application contract address |
claim | bytes32 | The output Merkle root hash |