Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
nkryuchkov committed Oct 30, 2024
1 parent 0139bb4 commit 64f0415
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 99 deletions.
8 changes: 4 additions & 4 deletions ibft/storage/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ func (i *ibftStorage) UpdateParticipants(identifier convert.MessageID, slot phas

existingParticipants, err := i.getParticipants(txn, identifier, slot)
if err != nil {
return false, fmt.Errorf("could not get participants %w", err)
return false, fmt.Errorf("get participants %w", err)
}

mergedParticipants := mergeParticipants(existingParticipants, newParticipants)
Expand All @@ -171,7 +171,7 @@ func (i *ibftStorage) UpdateParticipants(identifier convert.MessageID, slot phas
}

if err := i.saveParticipants(txn, identifier, slot, mergedParticipants); err != nil {
return false, fmt.Errorf("could not save participants: %w", err)
return false, fmt.Errorf("save participants: %w", err)
}

if err := txn.Commit(); err != nil {
Expand Down Expand Up @@ -224,10 +224,10 @@ func (i *ibftStorage) getParticipants(txn basedb.ReadWriter, identifier convert.
func (i *ibftStorage) saveParticipants(txn basedb.ReadWriter, identifier convert.MessageID, slot phase0.Slot, operators []spectypes.OperatorID) error {
bytes, err := encodeOperators(operators)
if err != nil {
return err
return fmt.Errorf("encode operators: %w", err)
}
if err := i.save(txn, bytes, participantsKey, identifier[:], uInt64ToByteSlice(uint64(slot))); err != nil {
return fmt.Errorf("could not save participants: %w", err)
return fmt.Errorf("save to DB: %w", err)
}

return nil
Expand Down
23 changes: 1 addition & 22 deletions protocol/v2/ssv/validator/non_committee_validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ func (ncv *CommitteeObserver) ProcessMessage(msg *queue.SSVMessage) error {

updated, err := roleStorage.UpdateParticipants(msgID, slot, quorum)
if err != nil {
return fmt.Errorf("could not save participants: %w", err)
return fmt.Errorf("update participants: %w", err)
}

if !updated {
Expand Down Expand Up @@ -186,27 +186,6 @@ func (ncv *CommitteeObserver) ProcessMessage(msg *queue.SSVMessage) error {
return nil
}

func mergeQuorums(quorum1, quorum2 []spectypes.OperatorID) []spectypes.OperatorID {
seen := make(map[spectypes.OperatorID]struct{})

for _, operatorID := range quorum1 {
seen[operatorID] = struct{}{}
}

for _, operatorID := range quorum2 {
seen[operatorID] = struct{}{}
}

result := make([]spectypes.OperatorID, 0, len(seen))
for operatorID := range seen {
result = append(result, operatorID)
}

slices.Sort(result)

return result
}

func (ncv *CommitteeObserver) getBeaconRoles(msg *queue.SSVMessage, root phase0.Root) []convert.RunnerRole {
if msg.MsgID.GetRoleType() == spectypes.RoleCommittee {
attester := ncv.attesterRoots.Get(root)
Expand Down
73 changes: 0 additions & 73 deletions protocol/v2/ssv/validator/non_committee_validator_test.go

This file was deleted.

0 comments on commit 64f0415

Please sign in to comment.