Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(deps): bump github.com/dgraph-io/ristretto from 0.1.1 to 1.0.0 #4192

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmd/gossamer/commands/prune_state_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"strings"
"testing"

"github.com/dgraph-io/badger/v2"
"github.com/dgraph-io/badger/v4"
"github.com/stretchr/testify/require"
)

Expand Down
2 changes: 1 addition & 1 deletion dot/network/discovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"time"

ethmetrics "github.com/ethereum/go-ethereum/metrics"
badger "github.com/ipfs/go-ds-badger2"
badger "github.com/ipfs/go-ds-badger4"
kaddht "github.com/libp2p/go-libp2p-kad-dht"
"github.com/libp2p/go-libp2p-kad-dht/dual"
libp2phost "github.com/libp2p/go-libp2p/core/host"
Expand Down
2 changes: 1 addition & 1 deletion dot/network/discovery_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"testing"
"time"

badger "github.com/ipfs/go-ds-badger2"
badger "github.com/ipfs/go-ds-badger4"
"github.com/libp2p/go-libp2p/core/peer"
"github.com/libp2p/go-libp2p/core/protocol"
"github.com/libp2p/go-libp2p/core/routing"
Expand Down
6 changes: 3 additions & 3 deletions dot/network/host.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
"github.com/ChainSafe/gossamer/dot/peerset"
"github.com/ChainSafe/gossamer/internal/pubip"
"github.com/dgraph-io/ristretto"
badger "github.com/ipfs/go-ds-badger2"
badger "github.com/ipfs/go-ds-badger4"
"github.com/libp2p/go-libp2p"
libp2phost "github.com/libp2p/go-libp2p/core/host"
"github.com/libp2p/go-libp2p/core/metrics"
Expand Down Expand Up @@ -235,11 +235,11 @@ func newHost(ctx context.Context, cfg *Config) (*host, error) {
}

cacheSize := 64 << 20 // 64 MB
config := ristretto.Config{
config := ristretto.Config[[]byte, string]{
NumCounters: int64(float64(cacheSize) * 0.05 * 2),
MaxCost: int64(float64(cacheSize) * 0.95),
BufferItems: 64,
Cost: func(value interface{}) int64 {
Cost: func(_ string) int64 {
return int64(1)
},
}
Expand Down
4 changes: 2 additions & 2 deletions dot/network/message_cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ var msgCacheTTL = 5 * time.Minute

// messageCache is used to detect duplicated messages per peer.
type messageCache struct {
cache *ristretto.Cache
cache *ristretto.Cache[[]byte, string]
ttl time.Duration
}

// newMessageCache creates a new messageCache which takes config and TTL duration.
func newMessageCache(config ristretto.Config, ttl time.Duration) (*messageCache, error) {
func newMessageCache(config ristretto.Config[[]byte, string], ttl time.Duration) (*messageCache, error) {
cache, err := ristretto.NewCache(&config)
if err != nil {
return nil, err
Expand Down
4 changes: 2 additions & 2 deletions dot/network/message_cache_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ func TestMessageCache(t *testing.T) {
t.Parallel()

cacheSize := 64 << 20 // 64 MB
msgCache, err := newMessageCache(ristretto.Config{
msgCache, err := newMessageCache(ristretto.Config[[]byte, string]{
NumCounters: int64(float64(cacheSize) * 0.05 * 2),
MaxCost: int64(float64(cacheSize) * 0.95),
BufferItems: 64,
Cost: func(value interface{}) int64 {
Cost: func(value string) int64 {
return int64(1)
},
}, 800*time.Millisecond)
Expand Down
13 changes: 6 additions & 7 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ require (
github.com/centrifuge/go-substrate-rpc-client/v4 v4.1.0
github.com/cockroachdb/pebble v1.1.2
github.com/cosmos/go-bip39 v1.0.0
github.com/dgraph-io/badger/v2 v2.2007.4
github.com/dgraph-io/ristretto v0.1.1
github.com/dgraph-io/badger/v4 v4.3.0
github.com/dgraph-io/ristretto v1.0.0
github.com/disiqueira/gotree v1.0.0
github.com/ethereum/go-ethereum v1.14.9
github.com/fatih/color v1.17.0
Expand All @@ -22,7 +22,7 @@ require (
github.com/gorilla/rpc v1.2.1
github.com/gorilla/websocket v1.5.3
github.com/gtank/merlin v0.1.1
github.com/ipfs/go-ds-badger2 v0.1.3
github.com/ipfs/go-ds-badger4 v0.1.5
github.com/jpillora/backoff v1.0.0
github.com/jpillora/ipfilter v1.2.9
github.com/karlseguin/ccache/v3 v3.0.5
Expand Down Expand Up @@ -55,7 +55,6 @@ require (
github.com/benbjohnson/clock v1.3.5 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/btcsuite/btcd/btcec/v2 v2.3.4 // indirect
github.com/cespare/xxhash v1.1.0 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/cockroachdb/errors v1.11.3 // indirect
github.com/cockroachdb/fifo v0.0.0-20240606204812-0bbfbd93a7ce // indirect
Expand All @@ -70,7 +69,6 @@ require (
github.com/decred/base58 v1.0.5 // indirect
github.com/decred/dcrd/crypto/blake256 v1.0.1 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 // indirect
github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2 // indirect
github.com/docker/go-units v0.5.0 // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/elastic/gosigar v0.14.3 // indirect
Expand All @@ -87,9 +85,10 @@ require (
github.com/go-task/slim-sprig/v3 v3.0.0 // indirect
github.com/godbus/dbus/v5 v5.1.0 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb // indirect
github.com/google/flatbuffers v1.12.1 // indirect
github.com/google/gopacket v1.1.19 // indirect
github.com/google/pprof v0.0.0-20240727154555-813a5fbdbec8 // indirect
github.com/gtank/ristretto255 v0.1.2 // indirect
Expand Down Expand Up @@ -207,7 +206,7 @@ require (
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.27.0 // indirect
golang.org/x/mod v0.19.0 // indirect
golang.org/x/net v0.27.0 // indirect
golang.org/x/net v0.28.0 // indirect
golang.org/x/sync v0.8.0 // indirect
golang.org/x/sys v0.25.0 // indirect
golang.org/x/text v0.18.0 // indirect
Expand Down
Loading
Loading