Skip to content

Commit

Permalink
Merge branch 'implement-acp-77--set-subnet-validator-weight-tx' into …
Browse files Browse the repository at this point in the history
…implement-acp-77-warp-verification
  • Loading branch information
StephenButtolph authored Oct 4, 2024
2 parents 63155aa + 3178ec0 commit 1624af4
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions vms/platformvm/txs/executor/standard_tx_executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ var (
errEtnaUpgradeNotActive = errors.New("attempting to use an Etna-upgrade feature prior to activation")
errTransformSubnetTxPostEtna = errors.New("TransformSubnetTx is not permitted post-Etna")
errMaxNumActiveValidators = errors.New("already at the max number of active validators")

errStateCorruption = errors.New("state corruption")
)

type StandardTxExecutor struct {
Expand Down Expand Up @@ -877,9 +879,10 @@ func (e *StandardTxExecutor) SetSubnetValidatorWeightTx(tx *txs.SetSubnetValidat

accruedFees := e.State.GetAccruedFees()
if sov.EndAccumulatedFee <= accruedFees {
// This should never happen as the validator should have been
// evicted.
return fmt.Errorf("validator has insufficient funds to cover accrued fees")
// This check should be unreachable. However, including it ensures
// that AVAX can't get minted out of thin air due to state
// corruption.
return fmt.Errorf("%w: validator should have already been disabled", errStateCorruption)
}
remainingBalance := sov.EndAccumulatedFee - accruedFees

Expand Down

0 comments on commit 1624af4

Please sign in to comment.