Skip to content

Commit 5804bad

Browse files
authored
Remove deadcode (#3086)
1 parent df27dfe commit 5804bad

File tree

4 files changed

+0
-57
lines changed

4 files changed

+0
-57
lines changed

database/helpers.go

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,6 @@ func GetID(db KeyValueReader, key []byte) (ids.ID, error) {
4141
return ids.ToID(b)
4242
}
4343

44-
func ParseID(b []byte) (ids.ID, error) {
45-
return ids.ToID(b)
46-
}
47-
4844
func PutUInt64(db KeyValueWriter, key []byte, val uint64) error {
4945
b := PackUInt64(val)
5046
return db.Put(key, b)
@@ -163,13 +159,6 @@ func Size(db Iteratee) (int, error) {
163159
return size, iterator.Error()
164160
}
165161

166-
func IsEmpty(db Iteratee) (bool, error) {
167-
iterator := db.NewIterator()
168-
defer iterator.Release()
169-
170-
return !iterator.Next(), iterator.Error()
171-
}
172-
173162
func AtomicClear(readerDB Iteratee, deleterDB KeyValueDeleter) error {
174163
return AtomicClearPrefix(readerDB, deleterDB, nil)
175164
}

network/p2p/gossip/gossip.go

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ var (
4242
_ Gossiper = (*PullGossiper[*testTx])(nil)
4343
_ Gossiper = (*NoOpGossiper)(nil)
4444

45-
_ Set[*testTx] = (*EmptySet[*testTx])(nil)
4645
_ Set[*testTx] = (*FullSet[*testTx])(nil)
4746

4847
ioTypeLabels = []string{ioLabel, typeLabel}
@@ -77,8 +76,6 @@ var (
7776
ErrInvalidDiscardedSize = errors.New("discarded size cannot be negative")
7877
ErrInvalidTargetGossipSize = errors.New("target gossip size cannot be negative")
7978
ErrInvalidRegossipFrequency = errors.New("re-gossip frequency cannot be negative")
80-
81-
errEmptySetCantAdd = errors.New("empty set can not add")
8279
)
8380

8481
// Gossiper gossips Gossipables to other nodes
@@ -603,26 +600,6 @@ func (t *TestGossiper) Gossip(ctx context.Context) error {
603600
return t.GossipF(ctx)
604601
}
605602

606-
type EmptySet[T Gossipable] struct{}
607-
608-
func (EmptySet[_]) Gossip(context.Context) error {
609-
return nil
610-
}
611-
612-
func (EmptySet[T]) Add(T) error {
613-
return errEmptySetCantAdd
614-
}
615-
616-
func (EmptySet[T]) Has(ids.ID) bool {
617-
return false
618-
}
619-
620-
func (EmptySet[T]) Iterate(func(gossipable T) bool) {}
621-
622-
func (EmptySet[_]) GetFilter() ([]byte, []byte) {
623-
return bloom.EmptyFilter.Marshal(), ids.Empty[:]
624-
}
625-
626603
type FullSet[T Gossipable] struct{}
627604

628605
func (FullSet[_]) Gossip(context.Context) error {

utils/hashing/hashing.go

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -38,22 +38,6 @@ func ComputeHash256(buf []byte) []byte {
3838
return arr[:]
3939
}
4040

41-
// ComputeHash256Ranges computes a cryptographically strong 256 bit hash of the input
42-
// byte slice in the ranges specified.
43-
// Example:
44-
// ComputeHash256Ranges({1, 2, 4, 8, 16}, {{1, 2}, {3, 5}}) is equivalent to
45-
// ComputeHash256({2, 8, 16}).
46-
func ComputeHash256Ranges(buf []byte, ranges [][2]int) []byte {
47-
hashBuilder := sha256.New()
48-
for _, r := range ranges {
49-
_, err := hashBuilder.Write(buf[r[0]:r[1]])
50-
if err != nil {
51-
panic(err)
52-
}
53-
}
54-
return hashBuilder.Sum(nil)
55-
}
56-
5741
// ComputeHash160Array computes a cryptographically strong 160 bit hash of the
5842
// input byte slice.
5943
func ComputeHash160Array(buf []byte) Hash160 {

vms/rpcchainvm/grpcutils/util.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,6 @@ import (
1717
tspb "google.golang.org/protobuf/types/known/timestamppb"
1818
)
1919

20-
func Errorf(code int, tmpl string, args ...interface{}) error {
21-
return GetGRPCErrorFromHTTPResponse(&httppb.HandleSimpleHTTPResponse{
22-
Code: int32(code),
23-
Body: []byte(fmt.Sprintf(tmpl, args...)),
24-
})
25-
}
26-
2720
// GetGRPCErrorFromHTTPResponse takes an HandleSimpleHTTPResponse as input and returns a gRPC error.
2821
func GetGRPCErrorFromHTTPResponse(resp *httppb.HandleSimpleHTTPResponse) error {
2922
a, err := anypb.New(resp)

0 commit comments

Comments
 (0)