Changing Weight

Theory walkthrough of changing a validator's weight with ValidatorManager owned by an EOA, including L1 and P-Chain calls.

Changing a Validator’s Weight

You’re changing an existing validator’s weight in a PoA setup where the ValidatorManager contract is owned by an EOA. The process mirrors registration: initiation on L1, processing on the P-Chain, and completion on L1.

Phase 1: Initiation (L1)

The owner calls initiateValidatorWeightUpdate(validationID, newWeight) on ValidatorManager.

Under the hood, the contract:

  • Ensures the validator is currently Active
  • Enforces churn constraints so the delta does not exceed the configured maximum churn percentage
  • Increments the validator's sent nonce
  • Updates the pending weight in storage and constructs a weight message
  • Sends a Warp message to the P-Chain

Phase 2: P-Chain Processing

We then will sign and submit the L1ValidatorWeightMessage warped response we got from the last step to the P-Chain, this executes a SetL1ValidatorWeightTx, and upon success signs and returns an L1ValidatorWeightMessage warped response.

The P-Chain processes the following message structure:

type L1ValidatorWeight struct {
	payload
 
	ValidationID ids.ID `serialize:"true" json:"validationID"`
	Nonce        uint64 `serialize:"true" json:"nonce"`
	Weight       uint64 `serialize:"true" json:"weight"`
}

Phase 3: Completion (L1)

We finally will call the completeValidatorWeightUpdate(messageIndex), where we will pass the message index of the response we received in step 2. The contract verifies the Warp message and nonce correspondence, updates the received nonce, and emits CompletedValidatorWeightUpdate.

Anyone can call the completeValidatorWeightUpdate(messageIndex) with the signed message.

Sequence Diagram

Is this guide helpful?

Report Issue

On this page