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

Remove put gossip #2790

Merged
merged 6 commits into from
Mar 6, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
Remove put gossip
  • Loading branch information
StephenButtolph committed Feb 29, 2024
commit 89724086e8874c8954c1cca6a854c686bd346615
30 changes: 0 additions & 30 deletions chains/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -607,16 +607,6 @@ func (m *manager) createAvalancheChain(
avalancheMessageSender = sender.Trace(avalancheMessageSender, m.Tracer)
}

err = m.VertexAcceptorGroup.RegisterAcceptor(
ctx.ChainID,
"gossip",
avalancheMessageSender,
false,
)
if err != nil { // Set up the event dispatcher
return nil, fmt.Errorf("problem initializing event dispatcher: %w", err)
}

// Passes messages from the snowman engines to the network
snowmanMessageSender, err := sender.New(
ctx,
Expand All @@ -635,16 +625,6 @@ func (m *manager) createAvalancheChain(
snowmanMessageSender = sender.Trace(snowmanMessageSender, m.Tracer)
}

err = m.BlockAcceptorGroup.RegisterAcceptor(
ctx.ChainID,
"gossip",
snowmanMessageSender,
false,
)
if err != nil { // Set up the event dispatcher
return nil, fmt.Errorf("problem initializing event dispatcher: %w", err)
}

chainConfig, err := m.getChainConfig(ctx.ChainID)
if err != nil {
return nil, fmt.Errorf("error while fetching chain config: %w", err)
Expand Down Expand Up @@ -999,16 +979,6 @@ func (m *manager) createSnowmanChain(
messageSender = sender.Trace(messageSender, m.Tracer)
}

err = m.BlockAcceptorGroup.RegisterAcceptor(
ctx.ChainID,
"gossip",
messageSender,
false,
)
if err != nil { // Set up the event dispatcher
return nil, fmt.Errorf("problem initializing event dispatcher: %w", err)
}

var (
bootstrapFunc func()
subnetConnector = validators.UnhandledSubnetConnector
Expand Down
8 changes: 2 additions & 6 deletions chains/subnets_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,16 +117,12 @@ func TestSubnetConfigs(t *testing.T) {
config: map[ids.ID]subnets.Config{
constants.PrimaryNetworkID: {},
testSubnetID: {
GossipConfig: subnets.GossipConfig{
AcceptedFrontierValidatorSize: 123456789,
},
ValidatorOnly: true,
},
},
subnetID: testSubnetID,
want: subnets.Config{
GossipConfig: subnets.GossipConfig{
AcceptedFrontierValidatorSize: 123456789,
},
ValidatorOnly: true,
},
},
}
Expand Down
19 changes: 0 additions & 19 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,6 @@ var (
deprecatedKeys = map[string]string{
KeystoreAPIEnabledKey: keystoreDeprecationMsg,

ConsensusGossipAcceptedFrontierValidatorSizeKey: acceptedFrontierGossipDeprecationMsg,
ConsensusGossipAcceptedFrontierNonValidatorSizeKey: acceptedFrontierGossipDeprecationMsg,
ConsensusGossipAcceptedFrontierPeerSizeKey: acceptedFrontierGossipDeprecationMsg,
ConsensusGossipOnAcceptValidatorSizeKey: acceptedFrontierGossipDeprecationMsg,
ConsensusGossipOnAcceptNonValidatorSizeKey: acceptedFrontierGossipDeprecationMsg,
ConsensusGossipOnAcceptPeerSizeKey: acceptedFrontierGossipDeprecationMsg,

NetworkPeerListValidatorGossipSizeKey: peerListPushGossipDeprecationMsg,
NetworkPeerListNonValidatorGossipSizeKey: peerListPushGossipDeprecationMsg,
NetworkPeerListPeersGossipSizeKey: peerListPushGossipDeprecationMsg,
Expand Down Expand Up @@ -263,17 +256,6 @@ func getAdaptiveTimeoutConfig(v *viper.Viper) (timer.AdaptiveTimeoutConfig, erro
return config, nil
}

func getGossipConfig(v *viper.Viper) subnets.GossipConfig {
return subnets.GossipConfig{
AcceptedFrontierValidatorSize: uint(v.GetUint32(ConsensusGossipAcceptedFrontierValidatorSizeKey)),
AcceptedFrontierNonValidatorSize: uint(v.GetUint32(ConsensusGossipAcceptedFrontierNonValidatorSizeKey)),
AcceptedFrontierPeerSize: uint(v.GetUint32(ConsensusGossipAcceptedFrontierPeerSizeKey)),
OnAcceptValidatorSize: uint(v.GetUint32(ConsensusGossipOnAcceptValidatorSizeKey)),
OnAcceptNonValidatorSize: uint(v.GetUint32(ConsensusGossipOnAcceptNonValidatorSizeKey)),
OnAcceptPeerSize: uint(v.GetUint32(ConsensusGossipOnAcceptPeerSizeKey)),
}
}

func getNetworkConfig(
v *viper.Viper,
networkID uint32,
Expand Down Expand Up @@ -1124,7 +1106,6 @@ func getDefaultSubnetConfig(v *viper.Viper) subnets.Config {
return subnets.Config{
ConsensusParameters: getConsensusConfig(v),
ValidatorOnly: false,
GossipConfig: getGossipConfig(v),
ProposerMinBlockDelay: proposervm.DefaultMinBlockDelay,
ProposerNumHistoricalBlocks: proposervm.DefaultNumHistoricalBlocks,
}
Expand Down
16 changes: 0 additions & 16 deletions config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import (
"github.com/ava-labs/avalanchego/ids"
"github.com/ava-labs/avalanchego/snow/consensus/snowball"
"github.com/ava-labs/avalanchego/subnets"
"github.com/ava-labs/avalanchego/utils/constants"
)

func TestGetChainConfigsFromFiles(t *testing.T) {
Expand Down Expand Up @@ -420,20 +419,6 @@ func TestGetSubnetConfigsFromFile(t *testing.T) {
},
expectedErr: nil,
},
"gossip config": {
fileName: "2Ctt6eGAeo4MLqTmGa7AdRecuVMPGWEX9wSsCLBYrLhX4a394i.json",
givenJSON: `{"gossipOnAcceptValidatorSize": 100 }`,
testF: func(require *require.Assertions, given map[ids.ID]subnets.Config) {
id, _ := ids.FromString("2Ctt6eGAeo4MLqTmGa7AdRecuVMPGWEX9wSsCLBYrLhX4a394i")
config, ok := given[id]
require.True(ok)
require.Equal(uint(100), config.GossipConfig.OnAcceptValidatorSize)
// must still respect defaults
require.Equal(20, config.ConsensusParameters.K)
require.Equal(uint(constants.DefaultConsensusGossipOnAcceptPeerSize), config.GossipConfig.OnAcceptPeerSize)
},
expectedErr: nil,
},
}

for name, test := range tests {
Expand Down Expand Up @@ -528,7 +513,6 @@ func TestGetSubnetConfigsFromFlags(t *testing.T) {
require.Equal(20, config.ConsensusParameters.AlphaConfidence)
require.Equal(30, config.ConsensusParameters.K)
// must still respect defaults
require.Equal(uint(constants.DefaultConsensusGossipAcceptedFrontierPeerSize), config.GossipConfig.AcceptedFrontierPeerSize)
require.Equal(256, config.ConsensusParameters.MaxOutstandingItems)
},
expectedErr: nil,
Expand Down
6 changes: 0 additions & 6 deletions config/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,12 +187,6 @@ func addNodeFlags(fs *pflag.FlagSet) {
fs.Uint(ConsensusAppConcurrencyKey, constants.DefaultConsensusAppConcurrency, "Maximum number of goroutines to use when handling App messages on a chain")
fs.Duration(ConsensusShutdownTimeoutKey, constants.DefaultConsensusShutdownTimeout, "Timeout before killing an unresponsive chain")
fs.Duration(ConsensusFrontierPollFrequencyKey, constants.DefaultFrontierPollFrequency, "Frequency of polling for new consensus frontiers")
fs.Uint(ConsensusGossipAcceptedFrontierValidatorSizeKey, constants.DefaultConsensusGossipAcceptedFrontierValidatorSize, "Number of validators to gossip to when gossiping accepted frontier")
fs.Uint(ConsensusGossipAcceptedFrontierNonValidatorSizeKey, constants.DefaultConsensusGossipAcceptedFrontierNonValidatorSize, "Number of non-validators to gossip to when gossiping accepted frontier")
fs.Uint(ConsensusGossipAcceptedFrontierPeerSizeKey, constants.DefaultConsensusGossipAcceptedFrontierPeerSize, "Number of peers to gossip to when gossiping accepted frontier")
fs.Uint(ConsensusGossipOnAcceptValidatorSizeKey, constants.DefaultConsensusGossipOnAcceptValidatorSize, "Number of validators to gossip to each accepted container to")
fs.Uint(ConsensusGossipOnAcceptNonValidatorSizeKey, constants.DefaultConsensusGossipOnAcceptNonValidatorSize, "Number of non-validators to gossip to each accepted container to")
fs.Uint(ConsensusGossipOnAcceptPeerSizeKey, constants.DefaultConsensusGossipOnAcceptPeerSize, "Number of peers to gossip to each accepted container to")

// Inbound Throttling
fs.Uint64(InboundThrottlerAtLargeAllocSizeKey, constants.DefaultInboundThrottlerAtLargeAllocSize, "Size, in bytes, of at-large byte allocation in inbound message throttler")
Expand Down
6 changes: 0 additions & 6 deletions config/keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,12 +145,6 @@ const (
ConsensusAppConcurrencyKey = "consensus-app-concurrency"
ConsensusShutdownTimeoutKey = "consensus-shutdown-timeout"
ConsensusFrontierPollFrequencyKey = "consensus-frontier-poll-frequency"
ConsensusGossipAcceptedFrontierValidatorSizeKey = "consensus-accepted-frontier-gossip-validator-size"
ConsensusGossipAcceptedFrontierNonValidatorSizeKey = "consensus-accepted-frontier-gossip-non-validator-size"
ConsensusGossipAcceptedFrontierPeerSizeKey = "consensus-accepted-frontier-gossip-peer-size"
ConsensusGossipOnAcceptValidatorSizeKey = "consensus-on-accept-gossip-validator-size"
ConsensusGossipOnAcceptNonValidatorSizeKey = "consensus-on-accept-gossip-non-validator-size"
ConsensusGossipOnAcceptPeerSizeKey = "consensus-on-accept-gossip-peer-size"
ProposerVMUseCurrentHeightKey = "proposervm-use-current-height"
FdLimitKey = "fd-limit"
IndexEnabledKey = "index-enabled"
Expand Down
13 changes: 4 additions & 9 deletions message/fields.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (

"github.com/ava-labs/avalanchego/ids"
"github.com/ava-labs/avalanchego/proto/pb/p2p"
"github.com/ava-labs/avalanchego/utils/constants"
)

var (
Expand Down Expand Up @@ -106,14 +105,10 @@ func GetRequestID(m any) (uint32, bool) {
return requestID, true
}

// AppGossip is the only message currently not containing a requestID
// Here we assign the requestID already in use for gossiped containers
// to allow a uniform handling of all messages
if _, ok := m.(*p2p.AppGossip); ok {
return constants.GossipMsgRequestID, true
}

return 0, false
// AppGossip is the only inbound message not containing a requestID. For
// ease of handling, imagine that it does have a requestID.
_, ok := m.(*p2p.AppGossip)
return 0, ok
}

type engineTypeGetter interface {
Expand Down
22 changes: 6 additions & 16 deletions snow/engine/common/no_ops_handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (

"github.com/ava-labs/avalanchego/ids"
"github.com/ava-labs/avalanchego/message"
"github.com/ava-labs/avalanchego/utils/constants"
"github.com/ava-labs/avalanchego/utils/logging"
"github.com/ava-labs/avalanchego/utils/set"
"github.com/ava-labs/avalanchego/version"
Expand Down Expand Up @@ -180,21 +179,12 @@ func NewNoOpPutHandler(log logging.Logger) PutHandler {
}

func (nop *noOpPutHandler) Put(_ context.Context, nodeID ids.NodeID, requestID uint32, _ []byte) error {
if requestID == constants.GossipMsgRequestID {
nop.log.Verbo("dropping request",
zap.String("reason", "unhandled by this gear"),
zap.Stringer("messageOp", message.PutOp),
zap.Stringer("nodeID", nodeID),
zap.Uint32("requestID", requestID),
)
} else {
nop.log.Debug("dropping request",
zap.String("reason", "unhandled by this gear"),
zap.Stringer("messageOp", message.PutOp),
zap.Stringer("nodeID", nodeID),
zap.Uint32("requestID", requestID),
)
}
nop.log.Debug("dropping request",
zap.String("reason", "unhandled by this gear"),
zap.Stringer("messageOp", message.PutOp),
zap.Stringer("nodeID", nodeID),
zap.Uint32("requestID", requestID),
)
return nil
}

Expand Down
11 changes: 0 additions & 11 deletions snow/engine/common/sender.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"context"

"github.com/ava-labs/avalanchego/ids"
"github.com/ava-labs/avalanchego/snow"
"github.com/ava-labs/avalanchego/utils/set"
)

Expand Down Expand Up @@ -35,15 +34,12 @@ import (
// time the requestID space has been exhausted, the beginning of the requestID
// space is free of conflicts.
type Sender interface {
snow.Acceptor

StateSummarySender
AcceptedStateSummarySender
FrontierSender
AcceptedSender
FetchSender
QuerySender
Gossiper
AppSender
}

Expand Down Expand Up @@ -160,13 +156,6 @@ type QuerySender interface {
)
}

// Gossiper defines how a consensus engine gossips a container on the accepted
// frontier to other nodes
type Gossiper interface {
// Gossip the provided container throughout the network
SendGossip(ctx context.Context, container []byte)
}

// NetworkAppSender sends VM-level messages to nodes in the network.
type NetworkAppSender interface {
// Send an application-level request.
Expand Down
14 changes: 0 additions & 14 deletions snow/engine/common/test_sender.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ type SenderTest struct {
CantSendGetAccepted, CantSendAccepted,
CantSendGet, CantSendGetAncestors, CantSendPut, CantSendAncestors,
CantSendPullQuery, CantSendPushQuery, CantSendChits,
CantSendGossip,
CantSendAppRequest, CantSendAppResponse, CantSendAppError,
CantSendAppGossip, CantSendAppGossipSpecific,
CantSendCrossChainAppRequest, CantSendCrossChainAppResponse, CantSendCrossChainAppError bool
Expand All @@ -58,7 +57,6 @@ type SenderTest struct {
SendPushQueryF func(context.Context, set.Set[ids.NodeID], uint32, []byte, uint64)
SendPullQueryF func(context.Context, set.Set[ids.NodeID], uint32, ids.ID, uint64)
SendChitsF func(context.Context, ids.NodeID, uint32, ids.ID, ids.ID, ids.ID)
SendGossipF func(context.Context, []byte)
SendAppRequestF func(context.Context, set.Set[ids.NodeID], uint32, []byte) error
SendAppResponseF func(context.Context, ids.NodeID, uint32, []byte) error
SendAppErrorF func(context.Context, ids.NodeID, uint32, int32, string) error
Expand Down Expand Up @@ -87,7 +85,6 @@ func (s *SenderTest) Default(cant bool) {
s.CantSendPullQuery = cant
s.CantSendPushQuery = cant
s.CantSendChits = cant
s.CantSendGossip = cant
s.CantSendAppRequest = cant
s.CantSendAppResponse = cant
s.CantSendAppGossip = cant
Expand Down Expand Up @@ -277,17 +274,6 @@ func (s *SenderTest) SendChits(ctx context.Context, vdr ids.NodeID, requestID ui
}
}

// SendGossip calls SendGossipF if it was initialized. If it wasn't initialized
// and this function shouldn't be called and testing was initialized, then
// testing will fail.
func (s *SenderTest) SendGossip(ctx context.Context, container []byte) {
if s.SendGossipF != nil {
s.SendGossipF(ctx, container)
} else if s.CantSendGossip && s.T != nil {
require.FailNow(s.T, "Unexpectedly called SendGossip")
}
}

// SendCrossChainAppRequest calls SendCrossChainAppRequestF if it was
// initialized. If it wasn't initialized and this function shouldn't be called
// and testing was initialized, then testing will fail.
Expand Down
2 changes: 0 additions & 2 deletions snow/engine/snowman/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import (
const (
pullGossipSource = "pull_gossip"
pushGossipSource = "push_gossip"
putGossipSource = "put_gossip"
builtSource = "built"
unknownSource = "unknown"
)
Expand Down Expand Up @@ -141,7 +140,6 @@ func (m *metrics) Initialize(namespace string, reg prometheus.Registerer) error
// Register the labels
m.issued.WithLabelValues(pullGossipSource)
m.issued.WithLabelValues(pushGossipSource)
m.issued.WithLabelValues(putGossipSource)
m.issued.WithLabelValues(builtSource)
m.issued.WithLabelValues(unknownSource)

Expand Down
Loading
Loading