IQuorum
Inherits: IConsensus
A consensus model controlled by a small, immutable set of n 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.
function numOfValidators() external view returns (uint256);
validatorId
Get the ID of a validator.
Validators have IDs greater than zero.
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.
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 outputsMerkleRoot
) external view returns (uint256);
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> | 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 outputsMerkleRoot,
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 |
outputsMerkleRoot | bytes32 | The outputs Merkle root |
id | uint256 | The ID of the validator |
Returns
| Name | Type | Description |
|---|---|---|
<none> | bool | Whether validator is in favor of claim |