bytes32 BASE_WEIGHTED_MULTISIG_SLOT
struct BaseWeightedMultisigStorage {
uint256 epoch;
uint256 lastRotationTimestamp;
mapping(uint256 => bytes32) signersHashByEpoch;
mapping(bytes32 => uint256) epochBySignersHash;
}
uint256 previousSignersRetention
Previous signers retention. 0 means only the current signers are valid
bytes32 domainSeparator
The domain separator for the signer proof
uint256 minimumRotationDelay
The minimum delay required between rotations
constructor(uint256 previousSignersRetention_, bytes32 domainSeparator_, uint256 minimumRotationDelay_) internal
Initializes the contract. Ownership of this contract should be transferred to the Gateway contract after deployment.
Name | Type | Description |
---|---|---|
previousSignersRetention_ | uint256 | The number of previous signers to retain |
domainSeparator_ | bytes32 | The domain separator for the signer proof |
minimumRotationDelay_ | uint256 | The minimum delay required between rotations |
function epoch() external view returns (uint256)
This function returns the current signers epoch
Name | Type | Description |
---|---|---|
[0] | uint256 | uint256 The current signers epoch |
function signersHashByEpoch(uint256 signerEpoch) external view returns (bytes32)
This function returns the signers hash for a given epoch
Name | Type | Description |
---|---|---|
signerEpoch | uint256 | The given epoch |
Name | Type | Description |
---|---|---|
[0] | bytes32 | bytes32 The signers hash for the given epoch |
function epochBySignersHash(bytes32 signersHash) external view returns (uint256)
This function returns the epoch for a given signers hash
Name | Type | Description |
---|---|---|
signersHash | bytes32 | The signers hash |
Name | Type | Description |
---|---|---|
[0] | uint256 | uint256 The epoch for the given signers hash |
function lastRotationTimestamp() external view returns (uint256)
This function returns the timestamp for the last signer rotation
Name | Type | Description |
---|---|---|
[0] | uint256 | uint256 The last rotation timestamp |
function timeSinceRotation() external view returns (uint256)
This function returns the time elapsed (in secs) since the last rotation
Name | Type | Description |
---|---|---|
[0] | uint256 | uint256 The time since the last rotation |
function _validateProof(bytes32 dataHash, struct Proof proof) internal view returns (bool isLatestSigners)
This function takes dataHash and proof data and reverts if proof is invalid
The proof data should have signers, weights, threshold and signatures encoded The proof is only valid if the signers weight crosses the threshold and there are no redundant signatures The signers and signatures should be sorted by signer address in ascending order Example: abi.encode([0x11…, 0x22…, 0x33…], [1, 1, 1], 2, [signature1, signature3])
Name | Type | Description |
---|---|---|
dataHash | bytes32 | The hash of the message that was signed |
proof | struct Proof | The multisig proof data |
Name | Type | Description |
---|---|---|
isLatestSigners | bool | True if the proof is from the latest signer set |
function _rotateSigners(struct WeightedSigners newSigners, bool enforceRotationDelay) internal
This function rotates the current signers with a new set of signers
Rotation to repeated signers is not allowed. While the individual signer addresses and weights can be repeated, the nonce must be different. The signers should be sorted by signer address in ascending order
Name | Type | Description |
---|---|---|
newSigners | struct WeightedSigners | The new weighted signers data |
enforceRotationDelay | bool | If true, the minimum rotation delay will be enforced |
function _updateRotationTimestamp(bool enforceRotationDelay) internal
Updates the last rotation timestamp, and enforces the minimum rotation delay if specified
function _validateSignatures(bytes32 messageHash, struct WeightedSigners weightedSigners, bytes[] signatures) internal pure
This function takes messageHash and proof data and reverts if proof is invalid
The signers and signatures should be sorted by signer address in ascending order
Name | Type | Description |
---|---|---|
messageHash | bytes32 | The hash of the message that was signed |
weightedSigners | struct WeightedSigners | The weighted signers data |
signatures | bytes[] | The sorted signatures data |
function messageHashToSign(bytes32 signersHash, bytes32 dataHash) public view returns (bytes32)
Compute the message hash that is signed by the weighted signers
_Returns an Ethereum Signed Message, created from domainSeparator
, signersHash
, and dataHash
.
This replicates the behavior of the
https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_sign[eth_sign
]
JSON-RPC method.
See {recover}._
Name | Type | Description |
---|---|---|
signersHash | bytes32 | The hash of the weighted signers that sign off on the data |
dataHash | bytes32 | The hash of the data |
Name | Type | Description |
---|---|---|
[0] | bytes32 | The message hash to be signed |
function _validateSigners(struct WeightedSigners weightedSigners) internal pure
This function checks if the provided signers are valid, i.e sorted and contain no duplicates, with valid weights and threshold
If signers are invalid, the method will revert
Name | Type | Description |
---|---|---|
weightedSigners | struct WeightedSigners | The weighted signers |
function _baseWeightedMultisigStorage() internal pure returns (struct BaseWeightedMultisig.BaseWeightedMultisigStorage slot)
Gets the specific storage location for preventing upgrade collisions
Name | Type | Description |
---|---|---|
slot | struct BaseWeightedMultisig.BaseWeightedMultisigStorage | containing the BaseWeightedMultisigStorage struct |