Skip to content

Commit

Permalink
fix merge
Browse files Browse the repository at this point in the history
  • Loading branch information
StephenButtolph committed Oct 26, 2024
1 parent 38ee164 commit d2137ef
Showing 1 changed file with 0 additions and 27 deletions.
27 changes: 0 additions & 27 deletions vms/platformvm/state/subnet_only_validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,13 @@ import (
safemath "github.com/ava-labs/avalanchego/utils/math"
)

// subnetIDNodeID = [subnetID] + [nodeID]
const subnetIDNodeIDEntryLength = ids.IDLen + ids.NodeIDLen

var (
_ btree.LessFunc[SubnetOnlyValidator] = SubnetOnlyValidator.Less
_ utils.Sortable[SubnetOnlyValidator] = SubnetOnlyValidator{}

ErrMutatedSubnetOnlyValidator = errors.New("subnet only validator contains mutated constant fields")
ErrConflictingSubnetOnlyValidator = errors.New("subnet only validator contains conflicting subnetID + nodeID pair")
ErrDuplicateSubnetOnlyValidator = errors.New("subnet only validator contains duplicate subnetID + nodeID pair")

errUnexpectedSubnetIDNodeIDLength = fmt.Errorf("expected subnetID+nodeID entry length %d", subnetIDNodeIDEntryLength)
)

type SubnetOnlyValidators interface {
Expand Down Expand Up @@ -175,28 +170,6 @@ func deleteSubnetOnlyValidator(db database.KeyValueDeleter, validationID ids.ID)
return db.Delete(validationID[:])
}

type subnetIDNodeID struct {
subnetID ids.ID
nodeID ids.NodeID
}

func (s *subnetIDNodeID) Marshal() []byte {
data := make([]byte, subnetIDNodeIDEntryLength)
copy(data, s.subnetID[:])
copy(data[ids.IDLen:], s.nodeID[:])
return data
}

func (s *subnetIDNodeID) Unmarshal(data []byte) error {
if len(data) != subnetIDNodeIDEntryLength {
return errUnexpectedSubnetIDNodeIDLength
}

copy(s.subnetID[:], data)
copy(s.nodeID[:], data[ids.IDLen:])
return nil
}

type subnetOnlyValidatorsDiff struct {
numAddedActive int // May be negative
modifiedTotalWeight map[ids.ID]uint64 // subnetID -> totalWeight
Expand Down

0 comments on commit d2137ef

Please sign in to comment.