Removing Validator
Theory walkthrough of removing a validator with ValidatorManager owned by an EOA, including L1 and P-Chain calls.
Removing a Validator
You're removing an existing Active validator in a PoA setup where the ValidatorManager
contract is owned by an EOA. The flow has two L1 calls with P-Chain processing in between.
Phase 1: Initiation (L1)
The owner calls initiateValidatorRemoval(validationID)
on ValidatorManager
.
Under the hood, the contract:
- Ensures the validator is currently Active
- Sets the validator status to
PendingRemoved
- Sets the end time of the current validation period to the current timestamp
- Persists updates and constructs a weight message with
weight = 0
- Sends a Warp message to the P-Chain (removal is encoded as a weight update to zero)
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
. Upon successful processing, it acknowledges the validator exit by signing and returns an L1ValidatorRegistrationMessage
with valid = 0
warped response.
The P-Chain processes the weight message (with weight set to 0 for removal):
And returns a registration message acknowledging the removal:
Phase 3: Completion (L1)
We finally will call the completeValidatorRemoval(messageIndex)
, where we will pass the message index of the response we received in step 2. The contract verifies the Warp message, confirms the registration status is false, updates the validator's status to Completed (if previously PendingRemoved
), removes the node from the registered mapping, persists updates, and emits CompletedValidatorRemoval
.
Anyone can call the completeValidatorRemoval(messageIndex)
with the signed message.
Sequence Diagram
Is this guide helpful?