Skip to content

Commit 90a13f3

Browse files
Remove put gossip (#2790)
1 parent dc03622 commit 90a13f3

File tree

21 files changed

+66
-412
lines changed

21 files changed

+66
-412
lines changed

chains/manager.go

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -607,16 +607,6 @@ func (m *manager) createAvalancheChain(
607607
avalancheMessageSender = sender.Trace(avalancheMessageSender, m.Tracer)
608608
}
609609

610-
err = m.VertexAcceptorGroup.RegisterAcceptor(
611-
ctx.ChainID,
612-
"gossip",
613-
avalancheMessageSender,
614-
false,
615-
)
616-
if err != nil { // Set up the event dispatcher
617-
return nil, fmt.Errorf("problem initializing event dispatcher: %w", err)
618-
}
619-
620610
// Passes messages from the snowman engines to the network
621611
snowmanMessageSender, err := sender.New(
622612
ctx,
@@ -635,16 +625,6 @@ func (m *manager) createAvalancheChain(
635625
snowmanMessageSender = sender.Trace(snowmanMessageSender, m.Tracer)
636626
}
637627

638-
err = m.BlockAcceptorGroup.RegisterAcceptor(
639-
ctx.ChainID,
640-
"gossip",
641-
snowmanMessageSender,
642-
false,
643-
)
644-
if err != nil { // Set up the event dispatcher
645-
return nil, fmt.Errorf("problem initializing event dispatcher: %w", err)
646-
}
647-
648628
chainConfig, err := m.getChainConfig(ctx.ChainID)
649629
if err != nil {
650630
return nil, fmt.Errorf("error while fetching chain config: %w", err)
@@ -1000,16 +980,6 @@ func (m *manager) createSnowmanChain(
1000980
messageSender = sender.Trace(messageSender, m.Tracer)
1001981
}
1002982

1003-
err = m.BlockAcceptorGroup.RegisterAcceptor(
1004-
ctx.ChainID,
1005-
"gossip",
1006-
messageSender,
1007-
false,
1008-
)
1009-
if err != nil { // Set up the event dispatcher
1010-
return nil, fmt.Errorf("problem initializing event dispatcher: %w", err)
1011-
}
1012-
1013983
var (
1014984
bootstrapFunc func()
1015985
subnetConnector = validators.UnhandledSubnetConnector

chains/subnets_test.go

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -117,16 +117,12 @@ func TestSubnetConfigs(t *testing.T) {
117117
config: map[ids.ID]subnets.Config{
118118
constants.PrimaryNetworkID: {},
119119
testSubnetID: {
120-
GossipConfig: subnets.GossipConfig{
121-
AcceptedFrontierValidatorSize: 123456789,
122-
},
120+
ValidatorOnly: true,
123121
},
124122
},
125123
subnetID: testSubnetID,
126124
want: subnets.Config{
127-
GossipConfig: subnets.GossipConfig{
128-
AcceptedFrontierValidatorSize: 123456789,
129-
},
125+
ValidatorOnly: true,
130126
},
131127
},
132128
}

config/config.go

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,7 @@ const (
5353
chainUpgradeFileName = "upgrade"
5454
subnetConfigFileExt = ".json"
5555

56-
keystoreDeprecationMsg = "keystore API is deprecated"
57-
acceptedFrontierGossipDeprecationMsg = "push-based accepted frontier gossip is deprecated"
56+
keystoreDeprecationMsg = "keystore API is deprecated"
5857
)
5958

6059
var (
@@ -64,13 +63,6 @@ var (
6463
deprecatedKeys = map[string]string{
6564
KeystoreAPIEnabledKey: keystoreDeprecationMsg,
6665

67-
ConsensusGossipAcceptedFrontierValidatorSizeKey: acceptedFrontierGossipDeprecationMsg,
68-
ConsensusGossipAcceptedFrontierNonValidatorSizeKey: acceptedFrontierGossipDeprecationMsg,
69-
ConsensusGossipAcceptedFrontierPeerSizeKey: acceptedFrontierGossipDeprecationMsg,
70-
ConsensusGossipOnAcceptValidatorSizeKey: acceptedFrontierGossipDeprecationMsg,
71-
ConsensusGossipOnAcceptNonValidatorSizeKey: acceptedFrontierGossipDeprecationMsg,
72-
ConsensusGossipOnAcceptPeerSizeKey: acceptedFrontierGossipDeprecationMsg,
73-
7466
SnowRogueCommitThresholdKey: commitThresholdDeprecationMsg,
7567
SnowVirtuousCommitThresholdKey: commitThresholdDeprecationMsg,
7668
}
@@ -257,17 +249,6 @@ func getAdaptiveTimeoutConfig(v *viper.Viper) (timer.AdaptiveTimeoutConfig, erro
257249
return config, nil
258250
}
259251

260-
func getGossipConfig(v *viper.Viper) subnets.GossipConfig {
261-
return subnets.GossipConfig{
262-
AcceptedFrontierValidatorSize: uint(v.GetUint32(ConsensusGossipAcceptedFrontierValidatorSizeKey)),
263-
AcceptedFrontierNonValidatorSize: uint(v.GetUint32(ConsensusGossipAcceptedFrontierNonValidatorSizeKey)),
264-
AcceptedFrontierPeerSize: uint(v.GetUint32(ConsensusGossipAcceptedFrontierPeerSizeKey)),
265-
OnAcceptValidatorSize: uint(v.GetUint32(ConsensusGossipOnAcceptValidatorSizeKey)),
266-
OnAcceptNonValidatorSize: uint(v.GetUint32(ConsensusGossipOnAcceptNonValidatorSizeKey)),
267-
OnAcceptPeerSize: uint(v.GetUint32(ConsensusGossipOnAcceptPeerSizeKey)),
268-
}
269-
}
270-
271252
func getNetworkConfig(
272253
v *viper.Viper,
273254
networkID uint32,
@@ -1112,7 +1093,6 @@ func getDefaultSubnetConfig(v *viper.Viper) subnets.Config {
11121093
return subnets.Config{
11131094
ConsensusParameters: getConsensusConfig(v),
11141095
ValidatorOnly: false,
1115-
GossipConfig: getGossipConfig(v),
11161096
ProposerMinBlockDelay: proposervm.DefaultMinBlockDelay,
11171097
ProposerNumHistoricalBlocks: proposervm.DefaultNumHistoricalBlocks,
11181098
}

config/config_test.go

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import (
2020
"github.com/ava-labs/avalanchego/ids"
2121
"github.com/ava-labs/avalanchego/snow/consensus/snowball"
2222
"github.com/ava-labs/avalanchego/subnets"
23-
"github.com/ava-labs/avalanchego/utils/constants"
2423
)
2524

2625
func TestGetChainConfigsFromFiles(t *testing.T) {
@@ -420,20 +419,6 @@ func TestGetSubnetConfigsFromFile(t *testing.T) {
420419
},
421420
expectedErr: nil,
422421
},
423-
"gossip config": {
424-
fileName: "2Ctt6eGAeo4MLqTmGa7AdRecuVMPGWEX9wSsCLBYrLhX4a394i.json",
425-
givenJSON: `{"gossipOnAcceptValidatorSize": 100 }`,
426-
testF: func(require *require.Assertions, given map[ids.ID]subnets.Config) {
427-
id, _ := ids.FromString("2Ctt6eGAeo4MLqTmGa7AdRecuVMPGWEX9wSsCLBYrLhX4a394i")
428-
config, ok := given[id]
429-
require.True(ok)
430-
require.Equal(uint(100), config.GossipConfig.OnAcceptValidatorSize)
431-
// must still respect defaults
432-
require.Equal(20, config.ConsensusParameters.K)
433-
require.Equal(uint(constants.DefaultConsensusGossipOnAcceptPeerSize), config.GossipConfig.OnAcceptPeerSize)
434-
},
435-
expectedErr: nil,
436-
},
437422
}
438423

439424
for name, test := range tests {
@@ -528,7 +513,6 @@ func TestGetSubnetConfigsFromFlags(t *testing.T) {
528513
require.Equal(20, config.ConsensusParameters.AlphaConfidence)
529514
require.Equal(30, config.ConsensusParameters.K)
530515
// must still respect defaults
531-
require.Equal(uint(constants.DefaultConsensusGossipAcceptedFrontierPeerSize), config.GossipConfig.AcceptedFrontierPeerSize)
532516
require.Equal(256, config.ConsensusParameters.MaxOutstandingItems)
533517
},
534518
expectedErr: nil,

config/flags.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -183,12 +183,6 @@ func addNodeFlags(fs *pflag.FlagSet) {
183183
fs.Uint(ConsensusAppConcurrencyKey, constants.DefaultConsensusAppConcurrency, "Maximum number of goroutines to use when handling App messages on a chain")
184184
fs.Duration(ConsensusShutdownTimeoutKey, constants.DefaultConsensusShutdownTimeout, "Timeout before killing an unresponsive chain")
185185
fs.Duration(ConsensusFrontierPollFrequencyKey, constants.DefaultFrontierPollFrequency, "Frequency of polling for new consensus frontiers")
186-
fs.Uint(ConsensusGossipAcceptedFrontierValidatorSizeKey, constants.DefaultConsensusGossipAcceptedFrontierValidatorSize, "Number of validators to gossip to when gossiping accepted frontier")
187-
fs.Uint(ConsensusGossipAcceptedFrontierNonValidatorSizeKey, constants.DefaultConsensusGossipAcceptedFrontierNonValidatorSize, "Number of non-validators to gossip to when gossiping accepted frontier")
188-
fs.Uint(ConsensusGossipAcceptedFrontierPeerSizeKey, constants.DefaultConsensusGossipAcceptedFrontierPeerSize, "Number of peers to gossip to when gossiping accepted frontier")
189-
fs.Uint(ConsensusGossipOnAcceptValidatorSizeKey, constants.DefaultConsensusGossipOnAcceptValidatorSize, "Number of validators to gossip to each accepted container to")
190-
fs.Uint(ConsensusGossipOnAcceptNonValidatorSizeKey, constants.DefaultConsensusGossipOnAcceptNonValidatorSize, "Number of non-validators to gossip to each accepted container to")
191-
fs.Uint(ConsensusGossipOnAcceptPeerSizeKey, constants.DefaultConsensusGossipOnAcceptPeerSize, "Number of peers to gossip to each accepted container to")
192186

193187
// Inbound Throttling
194188
fs.Uint64(InboundThrottlerAtLargeAllocSizeKey, constants.DefaultInboundThrottlerAtLargeAllocSize, "Size, in bytes, of at-large byte allocation in inbound message throttler")

config/keys.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -141,12 +141,6 @@ const (
141141
ConsensusAppConcurrencyKey = "consensus-app-concurrency"
142142
ConsensusShutdownTimeoutKey = "consensus-shutdown-timeout"
143143
ConsensusFrontierPollFrequencyKey = "consensus-frontier-poll-frequency"
144-
ConsensusGossipAcceptedFrontierValidatorSizeKey = "consensus-accepted-frontier-gossip-validator-size"
145-
ConsensusGossipAcceptedFrontierNonValidatorSizeKey = "consensus-accepted-frontier-gossip-non-validator-size"
146-
ConsensusGossipAcceptedFrontierPeerSizeKey = "consensus-accepted-frontier-gossip-peer-size"
147-
ConsensusGossipOnAcceptValidatorSizeKey = "consensus-on-accept-gossip-validator-size"
148-
ConsensusGossipOnAcceptNonValidatorSizeKey = "consensus-on-accept-gossip-non-validator-size"
149-
ConsensusGossipOnAcceptPeerSizeKey = "consensus-on-accept-gossip-peer-size"
150144
ProposerVMUseCurrentHeightKey = "proposervm-use-current-height"
151145
FdLimitKey = "fd-limit"
152146
IndexEnabledKey = "index-enabled"

message/fields.go

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import (
99

1010
"github.com/ava-labs/avalanchego/ids"
1111
"github.com/ava-labs/avalanchego/proto/pb/p2p"
12-
"github.com/ava-labs/avalanchego/utils/constants"
1312
)
1413

1514
var (
@@ -106,14 +105,10 @@ func GetRequestID(m any) (uint32, bool) {
106105
return requestID, true
107106
}
108107

109-
// AppGossip is the only message currently not containing a requestID
110-
// Here we assign the requestID already in use for gossiped containers
111-
// to allow a uniform handling of all messages
112-
if _, ok := m.(*p2p.AppGossip); ok {
113-
return constants.GossipMsgRequestID, true
114-
}
115-
116-
return 0, false
108+
// AppGossip is the only inbound message not containing a requestID. For
109+
// ease of handling, imagine that it does have a requestID.
110+
_, ok := m.(*p2p.AppGossip)
111+
return 0, ok
117112
}
118113

119114
type engineTypeGetter interface {

snow/engine/common/mock_sender.go

Lines changed: 0 additions & 27 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

snow/engine/common/no_ops_handlers.go

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import (
1111

1212
"github.com/ava-labs/avalanchego/ids"
1313
"github.com/ava-labs/avalanchego/message"
14-
"github.com/ava-labs/avalanchego/utils/constants"
1514
"github.com/ava-labs/avalanchego/utils/logging"
1615
"github.com/ava-labs/avalanchego/utils/set"
1716
"github.com/ava-labs/avalanchego/version"
@@ -180,21 +179,12 @@ func NewNoOpPutHandler(log logging.Logger) PutHandler {
180179
}
181180

182181
func (nop *noOpPutHandler) Put(_ context.Context, nodeID ids.NodeID, requestID uint32, _ []byte) error {
183-
if requestID == constants.GossipMsgRequestID {
184-
nop.log.Verbo("dropping request",
185-
zap.String("reason", "unhandled by this gear"),
186-
zap.Stringer("messageOp", message.PutOp),
187-
zap.Stringer("nodeID", nodeID),
188-
zap.Uint32("requestID", requestID),
189-
)
190-
} else {
191-
nop.log.Debug("dropping request",
192-
zap.String("reason", "unhandled by this gear"),
193-
zap.Stringer("messageOp", message.PutOp),
194-
zap.Stringer("nodeID", nodeID),
195-
zap.Uint32("requestID", requestID),
196-
)
197-
}
182+
nop.log.Debug("dropping request",
183+
zap.String("reason", "unhandled by this gear"),
184+
zap.Stringer("messageOp", message.PutOp),
185+
zap.Stringer("nodeID", nodeID),
186+
zap.Uint32("requestID", requestID),
187+
)
198188
return nil
199189
}
200190

snow/engine/common/sender.go

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import (
77
"context"
88

99
"github.com/ava-labs/avalanchego/ids"
10-
"github.com/ava-labs/avalanchego/snow"
1110
"github.com/ava-labs/avalanchego/utils/set"
1211
)
1312

@@ -35,15 +34,12 @@ import (
3534
// time the requestID space has been exhausted, the beginning of the requestID
3635
// space is free of conflicts.
3736
type Sender interface {
38-
snow.Acceptor
39-
4037
StateSummarySender
4138
AcceptedStateSummarySender
4239
FrontierSender
4340
AcceptedSender
4441
FetchSender
4542
QuerySender
46-
Gossiper
4743
AppSender
4844
}
4945

@@ -160,13 +156,6 @@ type QuerySender interface {
160156
)
161157
}
162158

163-
// Gossiper defines how a consensus engine gossips a container on the accepted
164-
// frontier to other nodes
165-
type Gossiper interface {
166-
// Gossip the provided container throughout the network
167-
SendGossip(ctx context.Context, container []byte)
168-
}
169-
170159
// NetworkAppSender sends VM-level messages to nodes in the network.
171160
type NetworkAppSender interface {
172161
// Send an application-level request.

0 commit comments

Comments
 (0)