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

IQuorum

Git Source

Inherits: IConsensus

A consensus model controlled by a small, immutable set of n (>= 1) validators.

You can know the value of n by calling the numOfValidators function.

Upon construction, each validator is assigned a unique number between 1 and n. These numbers are used internally instead of addresses for gas optimization reasons.

You can list the validators in the quorum by calling the validatorById function for each ID from 1 to n.

Functions

numOfValidators

Get the number of validators.

The number of validators is greater than or equal to 1.

function numOfValidators() external view returns (uint256);

validatorId

Get the ID of a validator.

Validators are assigned IDs between 1 and N, the total number of validators.

Non-validators are assigned to ID zero.

function validatorId(address validator) external view returns (uint256);

Parameters

NameTypeDescription
validatoraddressThe validator address

validatorById

Get the address of a validator by its ID.

Validator IDs range from 1 to N, the total number of validators.

Valid IDs do not map to address zero.

Invalid IDs map to address zero.

function validatorById(uint256 id) external view returns (address);

Parameters

NameTypeDescription
iduint256The validator ID

numOfValidatorsInFavorOfAnyClaimInEpoch

Get the number of validators in favor of any claim in a given epoch.

function numOfValidatorsInFavorOfAnyClaimInEpoch(
    address appContract,
    uint256 lastProcessedBlockNumber
) external view returns (uint256);

Parameters

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

Returns

NameTypeDescription
<none>uint256Number of validators in favor of any claim in the epoch

isValidatorInFavorOfAnyClaimInEpoch

Check whether a validator is in favor of any claim in a given epoch.

Assumes the provided ID is valid.

function isValidatorInFavorOfAnyClaimInEpoch(
    address appContract,
    uint256 lastProcessedBlockNumber,
    uint256 id
) external view returns (bool);

Parameters

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

Returns

NameTypeDescription
<none>boolWhether validator is in favor of any claim in the epoch

numOfValidatorsInFavorOf

Get the number of validators in favor of a claim.

function numOfValidatorsInFavorOf(
    address appContract,
    uint256 lastProcessedBlockNumber,
    bytes32 machineMerkleRoot
) external view returns (uint256);

Parameters

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

Returns

NameTypeDescription
<none>uint256Number of validators in favor of claim

isValidatorInFavorOf

Check whether a validator is in favor of a claim.

Assumes the provided ID is valid.

function isValidatorInFavorOf(
    address appContract,
    uint256 lastProcessedBlockNumber,
    bytes32 machineMerkleRoot,
    uint256 id
) external view returns (bool);

Parameters

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

Returns

NameTypeDescription
<none>boolWhether validator is in favor of claim

Errors

CallerIsNotValidator

This error is raised whenever submitClaim is called by someone who is not a validator.

error CallerIsNotValidator(address caller);

Parameters

NameTypeDescription
calleraddressThe caller address