Introduction

Hi, I'm cardene, a software engineer and technical writer focused on blockchain and AI.

I've also authored Japanese technical books on specification-driven development with LLMs and decentralized application (DApp) development.

I also build and publish a variety of tools, libraries, and open-source projects.

This article examines ACP99, which proposes a contract standard for managing the validator set of an Avalanche L1, including validator registration, removal, and weight updates, from an Avalanche EVM chain.

This article translates, summarizes, and expands on the following specification.

I also cover various EIPs, BIPs, SLIPs, CAIPs, ENSIPs, RFCs, and ACPs.

Overview

ACP99Manager is a proposed standard for a Validator Manager, a smart contract that manages validators and can be deployed on any Avalanche EVM chain. It builds on the mechanisms introduced in ACP77 (Reinventing Subnets), on which its implementability originally depended.

For more on ACP77, see the following article.

[ACP77] Moving Validator Management to the L1

ACP77 enables an L1 validator set stored on the P-Chain to be managed from any chain in the Avalanche network. When converting a Subnet into an L1 using ConvertSubnetToL1Tx, a validator manager can be designated by a (blockchainID, address) pair. The designated on-chain program is responsible for sending ICM messages included in P-Chain transactions such as RegisterL1ValidatorTx and SetL1ValidatorWeightTx.

Whenever the validator set changes, the P-Chain can sign an AddressedCall to notify contracts that track the set. The receiving contract must interpret the message and take the appropriate action. ACP77 defines two such P-Chain notification payloads: L1ValidatorRegistrationMessage and L1ValidatorWeightMessage.

Given these mechanisms and the prevalence of EVM-based chains on Avalanche Mainnet, ACP99Manager is proposed as a standard Solidity contract specification with the following responsibilities.

Responsibility Description
Maintain validator set information Store relevant information about the current L1 validator set in the contract.
Send updates to the P-Chain Generate AddressedCall messages defined in ACP-77 to communicate updates to the P-Chain.
Interpret and apply notifications Process notifications from the P-Chain correctly and update the validator set accordingly.
Integrate with other security models Support integration with different security models, such as Proof-of-Stake.

Making an audited, open-source reference implementation available aims to lower the cost of launching an Avalanche L1. Once deployed, the ACP99Manager implementation contract can be specified as the Address in ConvertSubnetToL1Tx.

Motivation

ACP77 (Reinventing Subnets) introduces a mechanism to manage an L1 validator set stored on the P-Chain from any chain in the Avalanche network. When a Subnet is converted to an L1 using ConvertSubnetToL1Tx, a validator manager is specified as a (blockchainID, address) pair. The designated program can send ICM messages used in RegisterL1ValidatorTx and SetL1ValidatorWeightTx on the P-Chain, enabling validator registration, weight changes, and removal.

Whenever the validator set changes, the P-Chain is willing to sign an AddressedCall to notify contracts tracking the set. The receiving contract must process the message correctly and apply the necessary updates. The two notification payloads defined by ACP77 are L1ValidatorRegistrationMessage and L1ValidatorWeightMessage.

Because many Avalanche Mainnet chains are EVM-based, a reusable Solidity implementation is useful. ACP99Manager proposes a common specification with the following advantages.

  • Consolidating validator set management into one specification reduces implementation costs.
  • Different security models, such as Proof-of-Stake, can be integrated more easily.
  • Providing an audited, open-source reference implementation can lower the barrier to launching L1s.

An implementation of ACP99Manager can be deployed and designated as the Address in ConvertSubnetToL1Tx to establish validator management in conjunction with the P-Chain. Relaying the relevant ICM messages and implementing the appropriate authorization and initialization logic are still required.

Specification

Type Definitions

ConversionData

javascript
struct ConversionData {
    bytes32 subnetID;
    bytes32 validatorManagerBlockchainID;
    address validatorManagerAddress;
    InitialValidator[] initialValidators;
}

A struct representing the data used to convert a Subnet into an L1 on the P-Chain.

The data is used to compute the hash authenticated by the P-Chain. The validator manager verifies it against the authenticated conversion ID and uses the included initial validator information to initialize the L1 validator set.

Parameters

  • subnetID
    • The 32-byte ID identifying the Subnet.
  • validatorManagerBlockchainID
    • The ID of the blockchain on which the validator manager operates.
  • validatorManagerAddress
    • The address of the validator manager contract.
  • initialValidators
    • The list of initial validators.

InitialValidator

javascript
struct InitialValidator {
    bytes nodeID;
    bytes blsPublicKey;
    uint64 weight;
}

A struct specifying an initial validator. It holds information about a validator initially registered when the Subnet is converted into an L1.

Parameters

  • nodeID
    • The ID identifying the node.
  • blsPublicKey
    • The validator's BLS public key.
  • weight
    • The validator's weight.

ValidatorStatus

javascript
enum ValidatorStatus {
    Unknown,
    PendingAdded,
    Active,
    PendingRemoved,
    Completed,
    Invalidated
}

An enum representing a validator's state. It tracks the stages of the validator's lifecycle, such as pending registration, active operation, and pending removal.

Parameters

  • Unknown
    • Unknown state.
  • PendingAdded
    • Pending addition.
  • Active
    • Active.
  • PendingRemoved
    • Pending removal.
  • Completed
    • Completed.
  • Invalidated
    • Invalidated.

PChainOwner

javascript
struct PChainOwner {
    uint32 threshold;
    address[] addresses;
}

A struct representing the validator's remaining balance owner or disable owner. P-Chain addresses are 20 bytes long, so they are represented using the same address type as Ethereum addresses.

Parameters

  • threshold
    • The minimum number of signatures required for authorization.
  • addresses
    • An array of associated P-Chain addresses.

Validator

javascript
struct Validator {
    ValidatorStatus status;
    bytes nodeID;
    uint64 startingWeight;
    uint64 sentNonce;
    uint64 receivedNonce;
    uint64 weight;
    uint64 startTime;
    uint64 endTime;
}

A struct holding a validator's lifecycle information. It tracks status, weight, start time, end time, and related information throughout the period from registration to removal.

Parameters

  • status
    • The validator's state.
  • nodeID
    • The node ID.
  • startingWeight
    • The weight at registration.
  • sentNonce
    • The latest nonce sent by the manager.
  • receivedNonce
    • The latest nonce received from the P-Chain.
  • weight
    • The current weight.
  • startTime
    • The start time of validation.
  • endTime
    • The end time of validation.

Events

RegisteredInitialValidator

javascript
event RegisteredInitialValidator(
    bytes32 indexed validationID,
    bytes20 indexed nodeID,
    bytes32 indexed subnetID,
    uint64 weight,
    uint32 index
);

Emitted when an initial validator is registered. It is emitted for an initial validator included in the conversion data. The subnetID and index can be used as supporting information when requesting signatures for that validator's eventual removal.

Parameters

  • validationID
    • The ID identifying the validator.
  • nodeID
    • The node ID.
  • subnetID
    • The Subnet ID.
  • weight
    • The validator's weight.
  • index
    • The index of the initial validator.

InitiatedValidatorRegistration

javascript
event InitiatedValidatorRegistration(
    bytes32 indexed validationID,
    bytes20 indexed nodeID,
    bytes32 registrationMessageID,
    uint64 registrationExpiry,
    uint64 weight
);

Emitted when validator registration begins. It signals an attempt to register a new validator. The manager does not yet consider the validator active before registration is completed.

Parameters

  • validationID
    • The ID identifying the validator.
  • nodeID
    • The node ID.
  • registrationMessageID
    • The registration message ID.
  • registrationExpiry
    • The registration expiration time.
  • weight
    • The validator's weight.

CompletedValidatorRegistration

javascript
event CompletedValidatorRegistration(bytes32 indexed validationID, uint64 weight);

Emitted when validator registration is completed. It indicates that the P-Chain's acknowledgment has been processed and the manager considers the validator registered.

Parameters

  • validationID
    • The ID identifying the validator.
  • weight
    • The validator's weight.

InitiatedValidatorRemoval

javascript
event InitiatedValidatorRemoval(
    bytes32 indexed validationID,
    bytes32 validatorWeightMessageID,
    uint64 weight,
    uint64 endTime
);

Emitted when validator removal begins. It signals that the removal process has started, but the P-Chain acknowledgment has not yet been processed.

Parameters

  • validationID
    • The ID of the validator to remove.
  • validatorWeightMessageID
    • The weight update message ID.
  • weight
    • The validator's weight.
  • endTime
    • The end time.

CompletedValidatorRemoval

javascript
event CompletedValidatorRemoval(bytes32 indexed validationID);

Emitted when validator removal is completed. It indicates that the acknowledgment of removal on the P-Chain has been processed.

Parameters

  • validationID
    • The ID of the removed validator.

InitiatedValidatorWeightUpdate

javascript
event InitiatedValidatorWeightUpdate(
    bytes32 indexed validationID, uint64 nonce, bytes32 weightUpdateMessageID, uint64 weight
);

Emitted when a validator weight update is initiated.

Parameters

  • validationID
    • The validator ID.
  • nonce
    • The update nonce.
  • weightUpdateMessageID
    • The weight update message ID.
  • weight
    • The new weight.

CompletedValidatorWeightUpdate

javascript
event CompletedValidatorWeightUpdate(bytes32 indexed validationID, uint64 nonce, uint64 weight);

Emitted when a validator weight update is completed. It indicates that the acknowledgment from the P-Chain has been processed and the new weight is recognized by the manager.

Parameters

  • validationID
    • The validator ID.
  • nonce
    • The update nonce.
  • weight
    • The new weight.

Functions

subnetID

javascript
function subnetID() public view returns (bytes32 id);

Returns the Subnet ID of the L1 managed by this validator manager. The result identifies the Subnet associated with the contract.

Returns

  • id
    • The Subnet ID.

getValidator

javascript
function getValidator(bytes32 validationID)
    public
    view
    returns (Validator memory validator);

Returns validator information for the specified validation ID.

Parameters

  • validationID
    • The ID identifying the validator.

Returns

  • validator
    • The Validator struct.

l1TotalWeight

javascript
function l1TotalWeight() public view returns (uint64 weight);

Returns the total weight of the current L1 validator set. It represents the combined weight of all active validators.

Returns

  • weight
    • The total weight.

initializeValidatorSet

javascript
function initializeValidatorSet(
    ConversionData calldata conversionData,
    uint32 messsageIndex
) public;

Initializes the validator set. It consumes a SubnetToL1ConversionMessage from the P-Chain to establish the initial L1 validator set. The supplied conversionData is verified, and a RegisteredInitialValidator event is emitted for each initial validator.

Parameters

  • conversionData
    • The data used in the Subnet conversion, from which the conversion ID is recomputed for verification against the P-Chain's conversion ID.
  • messsageIndex
    • The index of the ICM message.
    • The ConversionID in the SubnetToL1ConversionMessage must match the ID computed from conversionData.

completeValidatorRegistration

javascript
function completeValidatorRegistration(uint32 messageIndex)
    public
    returns (bytes32 validationID);

Completes validator registration. The function consumes and processes an L1ValidatorRegistrationMessage from the P-Chain to complete registration on the manager chain. The validator should not be considered active by the manager until this function succeeds. On success, it emits CompletedValidatorRegistration.

Parameters

  • messageIndex
    • The index of the L1ValidatorRegistrationMessage.

Returns

  • validationID
    • The ID of the registered validator.

completeValidatorRemoval

javascript
function completeValidatorRemoval(uint32 messageIndex)
    public
    returns (bytes32 validationID);

Completes validator removal. The function consumes the P-Chain's acknowledgment that the specified validator has been removed. The ACP99 function documentation calls this a RegisterL1ValidatorMessage; ACP77 names the P-Chain registration-status notification L1ValidatorRegistrationMessage. On success, the function emits CompletedValidatorRemoval.

Parameters

  • messageIndex
    • The index of the message acknowledging removal, named RegisterL1ValidatorMessage in the ACP99 function documentation.

Returns

  • validationID
    • The ID of the removed validator.

completeValidatorWeightUpdate

javascript
function completeValidatorWeightUpdate(uint32 messageIndex)
    public
    returns (bytes32 validationID, uint64 nonce);

Completes a validator weight update. The function consumes and processes an L1ValidatorWeightMessage from the P-Chain acknowledging the weight change. The manager should not consider the weight update effective until this function succeeds. On success, it emits CompletedValidatorWeightUpdate.

Parameters

  • messageIndex
    • The index of the L1ValidatorWeightMessage.

Returns

  • validationID
    • The ID of the updated validator.
  • nonce
    • The nonce associated with the update.

Internal Functions

_initiateValidatorRegistration

javascript
function _initiateValidatorRegistration(
    bytes memory nodeID,
    bytes memory blsPublicKey,
    PChainOwner memory remainingBalanceOwner,
    PChainOwner memory disableOwner,
    uint64 weight
) internal returns (bytes32 validationID);

An internal function that initiates validator registration. It issues a RegisterL1ValidatorMessage to add a new validator. Calling this function alone does not make the validator active in the manager. completeValidatorRegistration must subsequently be called successfully. On success, it emits InitiatedValidatorRegistration.

Parameters

  • nodeID
    • The ID of the node to register.
  • blsPublicKey
    • The validator's BLS public key.
  • remainingBalanceOwner
    • Information about the remaining balance owner.
  • disableOwner
    • Information about the owner authorized to disable the validator.
  • weight
    • The node's weight.

Returns

  • validationID
    • The ID of the validator whose registration was initiated.

_initiateValidatorRemoval

javascript
function _initiateValidatorRemoval(bytes32 validationID) internal;

An internal function that initiates validator removal. It issues an L1ValidatorWeightMessage setting the specified validator's weight to zero, starting the removal process. The manager should consider the validator inactive immediately upon successful initiation, even though P-Chain removal must still be acknowledged. On success, it emits InitiatedValidatorRemoval.

Parameters

  • validationID
    • The ID of the validator to remove.

_initiateValidatorWeightUpdate

javascript
function _initiateValidatorWeightUpdate(
    bytes32 validationID,
    uint64 weight
) internal returns (uint64 nonce, bytes32 messageID);

An internal function that initiates a validator weight update. It issues an L1ValidatorWeightMessage specifying a new, nonzero weight for the validator. The manager does not consider the update effective immediately after initiation; it is recognized after a successful call to completeValidatorWeightUpdate. On success, the function emits InitiatedValidatorWeightUpdate.

Parameters

  • validationID
    • The ID of the validator whose weight is to change.
  • weight
    • The new weight.

Returns

  • nonce
    • The nonce associated with this update.
  • messageID
    • The ID of the weight update message.

About DisableL1ValidatorTx

In addition to the removal process described above, a validator can be disabled directly on the P-Chain by issuing DisableL1ValidatorTx.

This privileged transaction can be issued by the validator's DisableOwner to recover the unspent balance associated with a validator of a failed L1. It is therefore not intended to be called from the usual ACP99Manager contract.

Backwards Compatibility

ACP99Manager is a reference contract specification and does not itself change the behavior of the Avalanche protocol. Adoption does not by itself require changes to existing node or chain configurations or a network upgrade. Each project can decide whether to implement or use an ACP99Manager contract, assuming the underlying ACP77 functionality is available.

Reference Implementation

The reference implementation is provided in Ava Labs' ICMContracts repository. In the original proposal, updating this implementation to conform to ACP99Manager was a prerequisite for marking the ACP Implementable. The official ACP now lists its status as Activated.

Example Integrations

ACP99Manager is designed to fit into different architectures. ACP99 presents two examples that demonstrate different architectural approaches.

Multi-contract Design

This design separates the contract implementing ACP99Manager from the security module contracts implementing security models such as PoS or PoA. Each ACP99Manager implementation is associated with one or more security modules. Only those modules are authorized to call the functions that initiate validator set changes (initiateValidatorRegistration and initiateValidatorWeightUpdate). When validator addition, removal, or weight modification is initiated, the ACP99Manager implementation calls the corresponding security module function (handleValidatorRegistration or handleValidatorWeightChange) as part of the integration flow. For security, the proposal recommends that the security modules reference an immutable ACP99Manager address.

The security module determines what action to take once validator registration, removal, or a weight update has been confirmed on the P-Chain. For example, a PoS L1 might start a withdrawal waiting period or allocate rewards.

---
title: ACP-99 Multi-contract Architecture with a PoA Security Module
---
graph LR
  Safe(Safe multisig)
  SecurityModule(ACP99PoAModule)
  Manager(ACP99Manager)
  P(P-Chain)

  subgraph "Manager chain"
    Safe
    SecurityModule
    Manager
  end
  Safe -.->|Own| SecurityModule
  Safe -.->|Own| Manager
  SecurityModule <-.->|Reference| Manager
  Safe -->|addValidator| SecurityModule
  SecurityModule -->|initiateValidatorRegistration| Manager
  Manager -->|sendWarpMessage| P
  P -->|completeValidatorRegistration| Manager
  Manager -->|handleValidatorRegistration| SecurityModule

A security module following this architecture can implement various models, including PoS and Liquid PoS. The specification of the modules themselves is outside this ACP's scope. The proposal identifies a work-in-progress implementation in the SuzakuContractsLibrary, with updates anticipated based on discussion until the ACP was considered Implementable. Ava Labs' V2 Validator Manager also uses this architecture for a PoS module, available in the ICMContractsRepository.

Single-contract Design

In this design, a base class implements ACP99Manager, while a derived class implements a particular security model, such as PoA. The diagram below uses PoAValidatorManager as the derived class, but it could be replaced with a class implementing another model, such as PoS.

---
title: ACP-99 Single-Contract Architecture implementing PoA
---
  classDiagram
  class ACP99Manager {
    initializeValidatorSet
    initiateValidatorRegistration
    completeValidatorRegistration
    initiateValidatorWeightUpdate
    completeValidatorWeightUpdate
  }
  <<abstract>> ACP99Manager

  class ValidatorManager {
    completeValidatorRegistration
  }
  <<abstract>> ValidatorManager
  class PoAValidatorManager {
    initiateValidatorRegistration
    initiateEndValidation
    completeEndValidation
  }

  ACP99Manager <|--ValidatorManager
  ValidatorManager <|-- PoAValidatorManager

Although no reference implementation is provided specifically for this architecture, Ava Labs' V1 ValidatorManager implements much of the functionality described in ACP99. It predates the specification and has some differences, so it should be treated only as an approximate conceptual model of the standard.

Security Considerations

Auditing ACP99Manager and its reference implementations is important for the future of the Avalanche ecosystem. Many L1s may rely on these contracts for their security, making specification compliance and implementation correctness high priorities. Reviews and verification throughout design, implementation, and operation help prevent unexpected behavior and the introduction of vulnerabilities.

Open Questions

Should the Manager Chain Retain Historical Validator Set Information?

Whether getValidator returns historical validator information is left to the implementer.

Information such as past validator performance and weight changes may be useful, but it is not required by every application. For example, a PoA (Proof-of-Authority) model does not necessarily need historical validator uptime data, so retaining such information in the contract may offer little benefit.

Historical information can be retrieved from archive nodes or off-chain tools such as block explorers. It therefore need not be retained at the contract level unless an application requires it.

Should ACP99Manager Include Churn Control?

The Ava Labs ValidatorManager implementation includes a churn control mechanism.

It prevents excessive validator weight from being added or removed within a short period. Abrupt changes in validator membership or weight can increase the risk of consensus failures. Restricting changes to certain bounds can therefore help maintain network stability.

On the other hand, such controls may not be necessary for every implementation or use case. Some PoA models may not need large-scale churn controls, so there is an argument for retaining design flexibility. Whether churn control should be mandatory is recorded as an open question in the proposal.

Conclusion

ACP99 proposes a standard for managing the validator set of an Avalanche L1 from an EVM chain, including validator registration, removal, and weight updates.

If you have questions, feel free to contact me via Twitter DM.

Twitter @cardene777

I also publish on other platforms.

https://chaldene.net/