Quorum
Inherits: IQuorum, AbstractConsensus
State Variables
NUM_OF_VALIDATORS
The total number of validators.
See the numOfValidators function.
uint256 immutable NUM_OF_VALIDATORS
_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
_allVotes
Votes indexed by application contract address, and last processed block number.
See the numOfValidatorsInFavorOfAnyClaimInEpoch
and isValidatorInFavorOfAnyClaimInEpoch functions.
mapping(address => mapping(uint256 => Votes)) private _allVotes
_votes
Votes indexed by application contract address, last processed block number and machine 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.
Zero addresses in the validators array are prohibited.
Reverts if the epoch length is zero.
Reverts if the quorum would contain zero validators.
constructor(
address[] memory validators,
uint256 epochLength,
uint256 claimStagingPeriod
) AbstractConsensus(epochLength, claimStagingPeriod);
Parameters
| Name | Type | Description |
|---|---|---|
validators | address[] | The array of validator addresses |
epochLength | uint256 | The epoch length |
claimStagingPeriod | uint256 | The claim staging period |
submitClaim
function submitClaim(
address appContract,
uint256 lastProcessedBlockNumber,
bytes32 machineMerkleRoot,
MachineValidityProof calldata proof
) 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);
numOfValidatorsInFavorOfAnyClaimInEpoch
function numOfValidatorsInFavorOfAnyClaimInEpoch(
address appContract,
uint256 lastProcessedBlockNumber
) external view override returns (uint256);
isValidatorInFavorOfAnyClaimInEpoch
function isValidatorInFavorOfAnyClaimInEpoch(
address appContract,
uint256 lastProcessedBlockNumber,
uint256 id
) external view override returns (bool);
numOfValidatorsInFavorOf
function numOfValidatorsInFavorOf(
address appContract,
uint256 lastProcessedBlockNumber,
bytes32 machineMerkleRoot
) external view override returns (uint256);
isValidatorInFavorOf
function isValidatorInFavorOf(
address appContract,
uint256 lastProcessedBlockNumber,
bytes32 machineMerkleRoot,
uint256 id
) external view override returns (bool);
_getAllVotes
Get a Votes structure from storage from a given epoch.
function _getAllVotes(address appContract, uint256 lastProcessedBlockNumber)
internal
view
returns (Votes storage);
Parameters
| Name | Type | Description |
|---|---|---|
appContract | address | The application contract address |
lastProcessedBlockNumber | uint256 | The number of the last processed block |
Returns
| Name | Type | Description |
|---|---|---|
<none> | Votes | The Votes structure related to all claims in a given epoch |
_getVotes
Get a Votes structure from storage from a given claim.
function _getVotes(
address appContract,
uint256 lastProcessedBlockNumber,
bytes32 machineMerkleRoot
) internal view returns (Votes storage);
Parameters
| Name | Type | Description |
|---|---|---|
appContract | address | The application contract address |
lastProcessedBlockNumber | uint256 | The number of the last processed block |
machineMerkleRoot | bytes32 | The machine 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 |