Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Quorum

Git Source

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

NameTypeDescription
validatorsaddress[]The array of validator addresses
epochLengthuint256The epoch length
claimStagingPerioduint256The 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

NameTypeDescription
appContractaddressThe application contract address
lastProcessedBlockNumberuint256The number of the last processed block

Returns

NameTypeDescription
<none>VotesThe 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

NameTypeDescription
appContractaddressThe application contract address
lastProcessedBlockNumberuint256The number of the last processed block
machineMerkleRootbytes32The machine Merkle root

Returns

NameTypeDescription
<none>VotesThe 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

NameTypeDescription
inFavorCountuint256The number of validators in favor of the claim
inFavorByIdBitMaps.BitMapThe set of validators in favor of the claim