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

Drop outbound gossip requests for non-validators #334

Merged
merged 3 commits into from
Sep 13, 2023
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 go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.20

require (
github.com/VictoriaMetrics/fastcache v1.10.0
github.com/ava-labs/avalanchego v1.10.10-rc.2
github.com/ava-labs/avalanchego v1.10.10-rc.4
github.com/cespare/cp v0.1.0
github.com/cockroachdb/pebble v0.0.0-20230209160836-829675f94811
github.com/davecgh/go-spew v1.1.1
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156 h1:eMwmnE/GDgah
github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM=
github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY=
github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8=
github.com/ava-labs/avalanchego v1.10.10-rc.2 h1:nlHc1JwKb5TEc9oqPU2exvOpazhxr11N2ym/LzYxv4k=
github.com/ava-labs/avalanchego v1.10.10-rc.2/go.mod h1:BN97sZppDSvIMIfEjrLTjdPTFkGLkb0ISJHEcoxMMNk=
github.com/ava-labs/avalanchego v1.10.10-rc.4 h1:1oxQf1boQDliJspfGBqsYsqg91d4F3qiFTnwnp+EruY=
github.com/ava-labs/avalanchego v1.10.10-rc.4/go.mod h1:BN97sZppDSvIMIfEjrLTjdPTFkGLkb0ISJHEcoxMMNk=
github.com/aymerick/raymond v2.0.3-0.20180322193309-b565731e1464+incompatible/go.mod h1:osfaiScAUVup+UC9Nfq76eWqDhXlp+4UYaA8uhTBO6g=
github.com/benbjohnson/clock v1.3.0 h1:ip6w0uFQkncKQ979AypyG0ER7mqUSBdKLOgAle/AT8A=
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
Expand Down
25 changes: 19 additions & 6 deletions plugin/evm/vm.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,12 +142,12 @@ const (
maxValidatorSetStaleness = time.Minute
throttlingPeriod = 10 * time.Second
throttlingLimit = 2
gossipFrequency = 10 * time.Second
)

var (
ethTxGossipConfig = gossip.Config{
Namespace: "eth_tx_gossip",
Frequency: 10 * time.Second,
PollSize: 10,
}
ethTxGossipHandlerConfig = gossip.HandlerConfig{
Expand All @@ -157,7 +157,6 @@ var (

atomicTxGossipConfig = gossip.Config{
Namespace: "atomic_tx_gossip",
Frequency: 10 * time.Second,
PollSize: 10,
}
atomicTxGossipHandlerConfig = gossip.HandlerConfig{
Expand Down Expand Up @@ -1056,7 +1055,11 @@ func (vm *VM) initBlockBuilding() error {
return err
}

ethTxGossiper, err := gossip.NewGossiper[GossipEthTx, *GossipEthTx](
var (
ethTxGossiper gossip.Gossiper
atomicTxGossiper gossip.Gossiper
)
ethTxGossiper, err = gossip.NewPullGossiper[GossipEthTx, *GossipEthTx](
ethTxGossipConfig,
vm.ctx.Log,
ethTxPool,
Expand All @@ -1066,14 +1069,19 @@ func (vm *VM) initBlockBuilding() error {
if err != nil {
return err
}
ethTxGossiper = gossip.ValidatorGossiper{
Gossiper: ethTxGossiper,
NodeID: vm.ctx.NodeID,
Validators: vm.validators,
}

vm.shutdownWg.Add(1)
go func() {
ethTxGossiper.Gossip(ctx)
gossip.Every(ctx, vm.ctx.Log, ethTxGossiper, gossipFrequency)
vm.shutdownWg.Done()
}()

atomicTxGossiper, err := gossip.NewGossiper[GossipAtomicTx, *GossipAtomicTx](
atomicTxGossiper, err = gossip.NewPullGossiper[GossipAtomicTx, *GossipAtomicTx](
atomicTxGossipConfig,
vm.ctx.Log,
vm.mempool,
Expand All @@ -1083,10 +1091,15 @@ func (vm *VM) initBlockBuilding() error {
if err != nil {
return err
}
atomicTxGossiper = gossip.ValidatorGossiper{
Gossiper: atomicTxGossiper,
NodeID: vm.ctx.NodeID,
Validators: vm.validators,
}

vm.shutdownWg.Add(1)
go func() {
atomicTxGossiper.Gossip(ctx)
gossip.Every(ctx, vm.ctx.Log, atomicTxGossiper, gossipFrequency)
vm.shutdownWg.Done()
}()

Expand Down
2 changes: 1 addition & 1 deletion scripts/versions.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env bash

# Don't export them as they're used in the context of other calls
avalanche_version=${AVALANCHE_VERSION:-'v1.10.10-rc.2'}
avalanche_version=${AVALANCHE_VERSION:-'v1.10.10-rc.4'}