Quorum
Inherits: IQuorum, AbstractConsensus
State Variables
_numOfValidators
The total number of validators.
See the numOfValidators
function.
uint256 private immutable _numOfValidators;
_validatorId
Validator IDs indexed by address.
See the validatorId
function.
Non-validators are assigned to ID zero.
Validators have IDs greater than zero.
mapping(address => uint256) private _validatorId;
_validatorById
Validator addresses indexed by ID.
See the validatorById
function.
Invalid IDs map to address zero.
mapping(uint256 => address) private _validatorById;
_votes
Votes indexed by application contract address, last processed block number and outputs Merkle root.
See the numOfValidatorsInFavorOf
and isValidatorInFavorOf
functions.
mapping(address => mapping(uint256 => mapping(bytes32 => Votes))) private _votes;
Functions
constructor
Duplicates in the validators
array are ignored.
Reverts if the epoch length is zero.
constructor(address[] memory validators, uint256 epochLength)
AbstractConsensus(epochLength);
Parameters
Name | Type | Description |
---|---|---|
validators | address[] | The array of validator addresses |
epochLength | uint256 | The epoch length |
submitClaim
function submitClaim(
address appContract,
uint256 lastProcessedBlockNumber,
bytes32 outputsMerkleRoot
) external override;
numOfValidators
function numOfValidators() external view override returns (uint256);
validatorId
function validatorId(address validator) external view override returns (uint256);
validatorById
function validatorById(uint256 id) external view override returns (address);
numOfValidatorsInFavorOf
function numOfValidatorsInFavorOf(
address appContract,
uint256 lastProcessedBlockNumber,
bytes32 outputsMerkleRoot
) external view override returns (uint256);
isValidatorInFavorOf
function isValidatorInFavorOf(
address appContract,
uint256 lastProcessedBlockNumber,
bytes32 outputsMerkleRoot,
uint256 id
) external view override returns (bool);
_getVotes
Get a Votes
structure from storage from a given claim.
function _getVotes(
address appContract,
uint256 lastProcessedBlockNumber,
bytes32 outputsMerkleRoot
) internal view returns (Votes storage);
Parameters
Name | Type | Description |
---|---|---|
appContract | address | The application contract address |
lastProcessedBlockNumber | uint256 | The number of the last processed block |
outputsMerkleRoot | bytes32 | The outputs Merkle root |
Returns
Name | Type | Description |
---|---|---|
<none> | Votes | The Votes structure related to a given claim |
supportsInterface
function supportsInterface(bytes4 interfaceId)
public
view
override(IERC165, AbstractConsensus)
returns (bool);
Structs
Votes
Votes in favor of a particular claim.
inFavorById
is a bitmap indexed by validator IDs.
struct Votes {
uint256 inFavorCount;
BitMaps.BitMap inFavorById;
}
Properties
Name | Type | Description |
---|---|---|
inFavorCount | uint256 | The number of validators in favor of the claim |
inFavorById | BitMaps.BitMap | The set of validators in favor of the claim |