AbstractConsensus
Inherits: IConsensus, ERC165
Abstract implementation of IConsensus
State Variables
_epochLength
The epoch length
uint256 private immutable _epochLength;
_validOutputsMerkleRoots
Indexes accepted claims by application contract address.
mapping(address => mapping(bytes32 => bool)) private _validOutputsMerkleRoots;
Functions
constructor
Reverts if the epoch length is zero.
constructor(uint256 epochLength);
Parameters
Name | Type | Description |
---|---|---|
epochLength | uint256 | The epoch length |
isOutputsMerkleRootValid
Check whether an outputs Merkle root is valid.
function isOutputsMerkleRootValid(address appContract, bytes32 outputsMerkleRoot)
public
view
override
returns (bool);
Parameters
Name | Type | Description |
---|---|---|
appContract | address | The application contract address |
outputsMerkleRoot | bytes32 | The outputs Merkle root |
getEpochLength
Get the epoch length, in number of base layer blocks.
The epoch number of a block is defined as the integer division of the block number by the epoch length.
function getEpochLength() public view override returns (uint256);
supportsInterface
function supportsInterface(bytes4 interfaceId)
public
view
virtual
override(IERC165, ERC165)
returns (bool);
_acceptClaim
Accept a claim.
Emits a ClaimAccepted
event.
function _acceptClaim(
address appContract,
uint256 lastProcessedBlockNumber,
bytes32 outputsMerkleRoot
) internal;
Parameters
Name | Type | Description |
---|---|---|
appContract | address | The application contract address |
lastProcessedBlockNumber | uint256 | The number of the last processed block |
outputsMerkleRoot | bytes32 | The output Merkle root hash |