IQuorum
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
| Name | Type | Description |
|---|---|---|
validator | address | The 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
| Name | Type | Description |
|---|---|---|
id | uint256 | The 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
| Name | Type | Description |
|---|---|---|
appContract | address | The application contract address |
lastProcessedBlockNumber | uint256 | The number of the last processed block |
Returns
| Name | Type | Description |
|---|---|---|
<none> | uint256 | Number 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
| Name | Type | Description |
|---|---|---|
appContract | address | The application contract address |
lastProcessedBlockNumber | uint256 | The number of the last processed block |
id | uint256 | The ID of the validator |
Returns
| Name | Type | Description |
|---|---|---|
<none> | bool | Whether 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
| 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> | uint256 | Number 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
| Name | Type | Description |
|---|---|---|
appContract | address | The application contract address |
lastProcessedBlockNumber | uint256 | The number of the last processed block |
machineMerkleRoot | bytes32 | The machine Merkle root |
id | uint256 | The ID of the validator |
Returns
| Name | Type | Description |
|---|---|---|
<none> | bool | Whether 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
| Name | Type | Description |
|---|---|---|
caller | address | The caller address |