Initialize Validator Set
Set up the initial validator set when converting a subnet to an L1
When converting an existing subnet to an L1 with sovereign validator management, you need to initialize the Validator Manager with the current validator set. This one-time operation bridges P-Chain subnet creation with L1 validator management using cryptographically verified conversion data.
How initializeValidatorSet Works
Function Implementation
You can view the full source code of the initializeValidatorSet
function here: ValidatorManager.sol#L211
Here you will find pseudo-code that covers the main logic in the function:
P-Chain Integration & Aggregated Signatures
The initialization leverages Avalanche Warp Messaging for security:
- P-Chain Validators Sign - The subnet's validators collectively sign the conversion data
- Aggregated Signature - Creates a threshold signature proving consensus
- Warp Precompile Verifies - The signature is verified before the contract receives it
- Contract Validates - Additional checks ensure data integrity
The conversion ID is derived through:
This ID must match the one in the P-Chain signed message, ensuring data hasn't been tampered with.
Understanding Conversion Data
The conversion data structure used by the function:
Required Information
To initialize, you'll need:
- Conversion Data: Current validator information from P-Chain
- Message Index: Position in the Warp message queue
- Proper Timing: Must be done before other operations
Initialization can only be done once! Make sure you have the correct validator data before proceeding.
Initialize Validator Set
Initialize Validator Set
Step 1: Aggregate Signature of Conversion Data
Enter the P-Chain Transaction ID of the ConvertSubnetToL1Tx of the L1 this Validator Manager it is for. It is needed to fetch the conversion data containing the initial validator set. This validator set will be set up in the validator manager contract so the consensus weight of these validators can be changed or they can be removed entirely if desired.
Step 2: Intialize the Validator Manager Contract State
With the aggregated signature, you can now initialize the Validator Manager contract state. This will set up the initial validator set and allow you to manage validators.Next Steps
Congratulations! You just set up your first Permissioned L1! In the next chapter you will learn how to manage this validator set:
- Query the validator set to verify state
- Add, Chnage Weight & Remove Validators
Is this guide helpful?