IConsensusRegistry
Author: Matter Labs
Note: security-contact: security@matterlabs.dev
Functions
add
function add(
address _nodeOwner,
uint32 _validatorWeight,
BLS12_381PublicKey calldata _validatorPubKey,
BLS12_381Signature calldata _validatorPoP,
uint32 _attesterWeight,
Secp256k1PublicKey calldata _attesterPubKey
) external;
deactivate
function deactivate(address _nodeOwner) external;
activate
function activate(address _nodeOwner) external;
remove
function remove(address _nodeOwner) external;
changeValidatorWeight
function changeValidatorWeight(address _nodeOwner, uint32 _weight) external;
changeAttesterWeight
function changeAttesterWeight(address _nodeOwner, uint32 _weight) external;
changeValidatorKey
function changeValidatorKey(
address _nodeOwner,
BLS12_381PublicKey calldata _pubKey,
BLS12_381Signature calldata _pop
) external;
changeAttesterKey
function changeAttesterKey(
address _nodeOwner,
Secp256k1PublicKey calldata _pubKey
) external;
commitAttesterCommittee
function commitAttesterCommittee() external;
commitValidatorCommittee
function commitValidatorCommittee() external;
getAttesterCommittee
function getAttesterCommittee()
external
view
returns (CommitteeAttester[] memory);
getValidatorCommittee
function getValidatorCommittee()
external
view
returns (CommitteeValidator[] memory);
Events
NodeAdded
event NodeAdded(
address indexed nodeOwner,
uint32 validatorWeight,
BLS12_381PublicKey validatorPubKey,
BLS12_381Signature validatorPoP,
uint32 attesterWeight,
Secp256k1PublicKey attesterPubKey
);
NodeDeactivated
event NodeDeactivated(address indexed nodeOwner);
NodeActivated
event NodeActivated(address indexed nodeOwner);
NodeRemoved
event NodeRemoved(address indexed nodeOwner);
NodeDeleted
event NodeDeleted(address indexed nodeOwner);
NodeValidatorWeightChanged
event NodeValidatorWeightChanged(address indexed nodeOwner, uint32 newWeight);
NodeAttesterWeightChanged
event NodeAttesterWeightChanged(address indexed nodeOwner, uint32 newWeight);
NodeValidatorKeyChanged
event NodeValidatorKeyChanged(
address indexed nodeOwner,
BLS12_381PublicKey newPubKey,
BLS12_381Signature newPoP
);
NodeAttesterKeyChanged
event NodeAttesterKeyChanged(
address indexed nodeOwner, Secp256k1PublicKey newPubKey
);
ValidatorsCommitted
event ValidatorsCommitted(uint32 commit);
AttestersCommitted
event AttestersCommitted(uint32 commit);
Errors
UnauthorizedOnlyOwnerOrNodeOwner
error UnauthorizedOnlyOwnerOrNodeOwner();
NodeOwnerExists
error NodeOwnerExists();
NodeOwnerDoesNotExist
error NodeOwnerDoesNotExist();
NodeOwnerNotFound
error NodeOwnerNotFound();
ValidatorPubKeyExists
error ValidatorPubKeyExists();
AttesterPubKeyExists
error AttesterPubKeyExists();
InvalidInputNodeOwnerAddress
error InvalidInputNodeOwnerAddress();
InvalidInputBLS12_381PublicKey
error InvalidInputBLS12_381PublicKey();
InvalidInputBLS12_381Signature
error InvalidInputBLS12_381Signature();
InvalidInputSecp256k1PublicKey
error InvalidInputSecp256k1PublicKey();
Structs
Node
Represents a consensus node.
struct Node {
uint32 attesterLastUpdateCommit;
uint32 validatorLastUpdateCommit;
uint32 nodeOwnerIdx;
AttesterAttr attesterLatest;
AttesterAttr attesterSnapshot;
ValidatorAttr validatorLatest;
ValidatorAttr validatorSnapshot;
}
Properties
Name | Type | Description |
---|---|---|
attesterLastUpdateCommit | uint32 | The latest attestersCommit where the node's attester attributes were updated. |
validatorLastUpdateCommit | uint32 | The latest validatorsCommit where the node's validator attributes were updated. |
nodeOwnerIdx | uint32 | Index of the node owner within the array of node owners. |
attesterLatest | AttesterAttr | Attester attributes to read if node.attesterLastUpdateCommit < attestersCommit . |
attesterSnapshot | AttesterAttr | Attester attributes to read if node.attesterLastUpdateCommit == attestersCommit . |
validatorLatest | ValidatorAttr | Validator attributes to read if node.validatorLastUpdateCommit < validatorsCommit . |
validatorSnapshot | ValidatorAttr | Validator attributes to read if node.validatorLastUpdateCommit == validatorsCommit . |
AttesterAttr
Represents the attester attributes of a consensus node.
struct AttesterAttr {
bool active;
bool removed;
uint32 weight;
Secp256k1PublicKey pubKey;
}
Properties
Name | Type | Description |
---|---|---|
active | bool | A flag stating if the attester is active. |
removed | bool | A flag stating if the attester has been removed (and is pending a deletion). |
weight | uint32 | Attester's voting weight. |
pubKey | Secp256k1PublicKey | Attester's Secp256k1 public key. |
CommitteeAttester
Represents an attester within a committee.
struct CommitteeAttester {
uint32 weight;
Secp256k1PublicKey pubKey;
}
Properties
Name | Type | Description |
---|---|---|
weight | uint32 | Attester's voting weight. |
pubKey | Secp256k1PublicKey | Attester's Secp256k1 public key. |
ValidatorAttr
Represents the validator attributes of a consensus node.
struct ValidatorAttr {
bool active;
bool removed;
uint32 weight;
BLS12_381PublicKey pubKey;
BLS12_381Signature proofOfPossession;
}
Properties
Name | Type | Description |
---|---|---|
active | bool | A flag stating if the validator is active. |
removed | bool | A flag stating if the validator has been removed (and is pending a deletion). |
weight | uint32 | Validator's voting weight. |
pubKey | BLS12_381PublicKey | Validator's BLS12-381 public key. |
proofOfPossession | BLS12_381Signature | Validator's Proof-of-possession (a signature over the public key). |
CommitteeValidator
Represents a validator within a committee.
struct CommitteeValidator {
uint32 weight;
BLS12_381PublicKey pubKey;
BLS12_381Signature proofOfPossession;
}
Properties
Name | Type | Description |
---|---|---|
weight | uint32 | Validator's voting weight. |
pubKey | BLS12_381PublicKey | Validator's BLS12-381 public key. |
proofOfPossession | BLS12_381Signature | Validator's Proof-of-possession (a signature over the public key). |
BLS12_381PublicKey
Represents BLS12_381 public key.
struct BLS12_381PublicKey {
bytes32 a;
bytes32 b;
bytes32 c;
}
Properties
Name | Type | Description |
---|---|---|
a | bytes32 | First component of the BLS12-381 public key. |
b | bytes32 | Second component of the BLS12-381 public key. |
c | bytes32 | Third component of the BLS12-381 public key. |
BLS12_381Signature
Represents BLS12_381 signature.
struct BLS12_381Signature {
bytes32 a;
bytes16 b;
}
Properties
Name | Type | Description |
---|---|---|
a | bytes32 | First component of the BLS12-381 signature. |
b | bytes16 | Second component of the BLS12-381 signature. |
Secp256k1PublicKey
Represents Secp256k1 public key.
struct Secp256k1PublicKey {
bytes1 tag;
bytes32 x;
}
Properties
Name | Type | Description |
---|---|---|
tag | bytes1 | Y-coordinate's even/odd indicator of the Secp256k1 public key. |
x | bytes32 | X-coordinate component of the Secp256k1 public key. |