ValidatorDetails

Git Source

Modified from KRogLA's work for Lido.

State Variables

PUBKEY_LENGTH

The validator pubkey byte length.

uint256 internal constant PUBKEY_LENGTH = 48;

SIGNATURE_LENGTH

The validator signature byte length.

uint256 internal constant SIGNATURE_LENGTH = 96;

UINT40_MAX

The maximum uint40 value.

uint256 internal constant UINT40_MAX = type(uint40).max;

Functions

computeStorageKeyOffset

Compute the storage key offset.

function computeStorageKeyOffset(bytes32 position, uint8 operatorId, uint256 keyIndex)
    internal
    pure
    returns (uint256);

Parameters

saveValidatorDetails

Store operator details.

function saveValidatorDetails(
    bytes32 position,
    uint8 operatorId,
    uint256 startIndex,
    uint256 keysCount,
    bytes memory pubkeys,
    bytes memory signatures
) internal returns (uint40);

Parameters

Returns

swapValidatorDetails

Swap operator detail indexes in storage.

function swapValidatorDetails(
    bytes32 position,
    uint8 operatorId,
    uint256 startIndex1,
    uint256 startIndex2,
    uint256 keysCount
) internal;

Parameters

removeValidatorDetails

Remove validator details from storage.

function removeValidatorDetails(
    bytes32 position,
    uint8 operatorId,
    uint256 startIndex,
    uint256 keysCount,
    uint256 totalKeysCount
) internal returns (uint40);

Parameters

Returns

loadValidatorDetails

Load validator details from storage.

function loadValidatorDetails(
    bytes32 position,
    uint8 operatorId,
    uint256 startIndex,
    uint256 keysCount,
    bytes memory pubkeys,
    bytes memory signatures,
    uint256 bufferOffset
) internal view;

Parameters

allocateMemoryForPubKeys

Allocate memory for keyCount public keys.

function allocateMemoryForPubKeys(uint256 keyCount) internal pure returns (bytes memory);

Parameters

allocateMemory

Allocate memory for count validator details.

function allocateMemory(uint256 count) internal pure returns (bytes memory, bytes memory);

Parameters

Events

ValidatorDetailsAdded

Emitted when a new validator signing key is added.

event ValidatorDetailsAdded(uint8 indexed operatorId, bytes pubkey);

Parameters

ValidatorDetailsRemoved

Emitted when a validator signing key is removed.

event ValidatorDetailsRemoved(uint8 indexed operatorId, bytes pubkey);

Parameters

ValidatorDetailsSwapped

Emitted when the indexes of two validator signing keys are swapped.

event ValidatorDetailsSwapped(uint8 indexed operatorId, bytes pubkey1, bytes pubkey2);

Parameters

Errors

INVALID_KEYS_COUNT

Thrown when the number of keys is invalid.

error INVALID_KEYS_COUNT();

INDEXES_OVERLAP

Thrown when the indexes of keys overlap.

error INDEXES_OVERLAP();

LENGTH_MISMATCH

Thrown when the keys and signatures lengths mismatch.

error LENGTH_MISMATCH();

EMPTY_KEY

Thrown when the key is empty.

error EMPTY_KEY();

Last updated