From 2a26d89f5e01d4fc80c95ed5c8482eca0800353d Mon Sep 17 00:00:00 2001 From: Alberto Benegiamo Date: Fri, 17 Feb 2023 17:23:16 +0100 Subject: [PATCH] Remove unused field `common.Config#Validators` (#2604) --- chains/manager.go | 2 -- snow/engine/avalanche/bootstrap/bootstrapper_test.go | 1 - snow/engine/avalanche/config_test.go | 3 ++- snow/engine/avalanche/getter/getter_test.go | 1 - snow/engine/avalanche/transitive_test.go | 3 --- snow/engine/common/config.go | 5 ++--- snow/engine/common/test_config.go | 1 - snow/engine/snowman/bootstrap/bootstrapper_test.go | 2 -- snow/engine/snowman/config_test.go | 3 ++- snow/engine/snowman/getter/getter_test.go | 1 - snow/engine/snowman/syncer/state_syncer_test.go | 1 - vms/platformvm/vm_test.go | 1 - 12 files changed, 6 insertions(+), 18 deletions(-) diff --git a/chains/manager.go b/chains/manager.go index 2b416ae4344a..c6a54019b297 100644 --- a/chains/manager.go +++ b/chains/manager.go @@ -687,7 +687,6 @@ func (m *manager) createAvalancheChain( commonCfg := common.Config{ Ctx: ctx, - Validators: vdrs, Beacons: beacons, SampleK: sampleK, StartupTracker: startupTracker, @@ -956,7 +955,6 @@ func (m *manager) createSnowmanChain( commonCfg := common.Config{ Ctx: ctx, - Validators: vdrs, Beacons: beacons, SampleK: sampleK, StartupTracker: startupTracker, diff --git a/snow/engine/avalanche/bootstrap/bootstrapper_test.go b/snow/engine/avalanche/bootstrap/bootstrapper_test.go index 9a59c10dbdc4..e0ccefb5891e 100644 --- a/snow/engine/avalanche/bootstrap/bootstrapper_test.go +++ b/snow/engine/avalanche/bootstrap/bootstrapper_test.go @@ -78,7 +78,6 @@ func newConfig(t *testing.T) (Config, ids.NodeID, *common.SenderTest, *vertex.Te commonConfig := common.Config{ Ctx: ctx, - Validators: peers, Beacons: peers, SampleK: peers.Len(), Alpha: peers.Weight()/2 + 1, diff --git a/snow/engine/avalanche/config_test.go b/snow/engine/avalanche/config_test.go index c20ea448bfba..93679027d255 100644 --- a/snow/engine/avalanche/config_test.go +++ b/snow/engine/avalanche/config_test.go @@ -13,6 +13,7 @@ import ( "github.com/ava-labs/avalanchego/snow/engine/avalanche/vertex" "github.com/ava-labs/avalanchego/snow/engine/common" "github.com/ava-labs/avalanchego/snow/engine/common/queue" + "github.com/ava-labs/avalanchego/snow/validators" ) func DefaultConfig() (common.Config, bootstrap.Config, Config) { @@ -34,7 +35,7 @@ func DefaultConfig() (common.Config, bootstrap.Config, Config) { VM: bootstrapConfig.VM, Manager: bootstrapConfig.Manager, Sender: bootstrapConfig.Sender, - Validators: bootstrapConfig.Validators, + Validators: validators.NewSet(), Params: avalanche.Parameters{ Parameters: snowball.Parameters{ K: 1, diff --git a/snow/engine/avalanche/getter/getter_test.go b/snow/engine/avalanche/getter/getter_test.go index 5a330946d519..16d7341b3ea4 100644 --- a/snow/engine/avalanche/getter/getter_test.go +++ b/snow/engine/avalanche/getter/getter_test.go @@ -44,7 +44,6 @@ func testSetup(t *testing.T) (*vertex.TestManager, *common.SenderTest, common.Co commonConfig := common.Config{ Ctx: snow.DefaultConsensusContextTest(), - Validators: peers, Beacons: peers, SampleK: peers.Len(), Alpha: peers.Weight()/2 + 1, diff --git a/snow/engine/avalanche/transitive_test.go b/snow/engine/avalanche/transitive_test.go index 8dcef37dc6da..3b14d064c851 100644 --- a/snow/engine/avalanche/transitive_test.go +++ b/snow/engine/avalanche/transitive_test.go @@ -2710,7 +2710,6 @@ func TestEngineBootstrappingIntoConsensus(t *testing.T) { vals.RegisterCallbackListener(startup) bootCfg.Beacons = vals - bootCfg.Validators = vals bootCfg.StartupTracker = startup engCfg.Validators = vals @@ -2987,7 +2986,6 @@ func TestEngineReBootstrapFails(t *testing.T) { vals.RegisterCallbackListener(startup) bootCfg.Beacons = vals - bootCfg.Validators = vals bootCfg.StartupTracker = startup engCfg.Validators = vals @@ -3152,7 +3150,6 @@ func TestEngineReBootstrappingIntoConsensus(t *testing.T) { vals.RegisterCallbackListener(startup) bootCfg.Beacons = vals - bootCfg.Validators = vals bootCfg.StartupTracker = startup engCfg.Validators = vals diff --git a/snow/engine/common/config.go b/snow/engine/common/config.go index 349f9b593887..c1a3f029fc59 100644 --- a/snow/engine/common/config.go +++ b/snow/engine/common/config.go @@ -14,9 +14,8 @@ import ( // Config wraps the common configurations that are needed by a Snow consensus // engine type Config struct { - Ctx *snow.ConsensusContext - Validators validators.Set - Beacons validators.Set + Ctx *snow.ConsensusContext + Beacons validators.Set SampleK int Alpha uint64 diff --git a/snow/engine/common/test_config.go b/snow/engine/common/test_config.go index 9ce78c80d2dc..2431ef9fd2df 100644 --- a/snow/engine/common/test_config.go +++ b/snow/engine/common/test_config.go @@ -30,7 +30,6 @@ func DefaultConfigTest() Config { return Config{ Ctx: snow.DefaultConsensusContextTest(), - Validators: validators.NewSet(), Beacons: beacons, StartupTracker: startupTracker, Sender: &SenderTest{}, diff --git a/snow/engine/snowman/bootstrap/bootstrapper_test.go b/snow/engine/snowman/bootstrap/bootstrapper_test.go index f2f701ee9ddc..475e75aa32f7 100644 --- a/snow/engine/snowman/bootstrap/bootstrapper_test.go +++ b/snow/engine/snowman/bootstrap/bootstrapper_test.go @@ -75,7 +75,6 @@ func newConfig(t *testing.T) (Config, ids.NodeID, *common.SenderTest, *block.Tes commonConfig := common.Config{ Ctx: ctx, - Validators: peers, Beacons: peers, SampleK: peers.Len(), Alpha: peers.Weight()/2 + 1, @@ -125,7 +124,6 @@ func TestBootstrapperStartsOnlyIfEnoughStakeIsConnected(t *testing.T) { commonCfg := common.Config{ Ctx: snow.DefaultConsensusContextTest(), - Validators: peers, Beacons: peers, SampleK: sampleK, Alpha: alpha, diff --git a/snow/engine/snowman/config_test.go b/snow/engine/snowman/config_test.go index a7f1d40ccf92..efa015d84a60 100644 --- a/snow/engine/snowman/config_test.go +++ b/snow/engine/snowman/config_test.go @@ -8,6 +8,7 @@ import ( "github.com/ava-labs/avalanchego/snow/consensus/snowman" "github.com/ava-labs/avalanchego/snow/engine/common" "github.com/ava-labs/avalanchego/snow/engine/snowman/block" + "github.com/ava-labs/avalanchego/snow/validators" ) func DefaultConfigs() Config { @@ -15,7 +16,7 @@ func DefaultConfigs() Config { return Config{ Ctx: commonCfg.Ctx, Sender: commonCfg.Sender, - Validators: commonCfg.Validators, + Validators: validators.NewSet(), VM: &block.TestVM{}, Params: snowball.Parameters{ K: 1, diff --git a/snow/engine/snowman/getter/getter_test.go b/snow/engine/snowman/getter/getter_test.go index 2ad7abfa4f54..5e66746c290a 100644 --- a/snow/engine/snowman/getter/getter_test.go +++ b/snow/engine/snowman/getter/getter_test.go @@ -67,7 +67,6 @@ func testSetup( commonConfig := common.Config{ Ctx: ctx, - Validators: peers, Beacons: peers, SampleK: peers.Len(), Alpha: peers.Weight()/2 + 1, diff --git a/snow/engine/snowman/syncer/state_syncer_test.go b/snow/engine/snowman/syncer/state_syncer_test.go index 52443e96e671..bbbeca9ff5ad 100644 --- a/snow/engine/snowman/syncer/state_syncer_test.go +++ b/snow/engine/snowman/syncer/state_syncer_test.go @@ -108,7 +108,6 @@ func TestStateSyncingStartsOnlyIfEnoughStakeIsConnected(t *testing.T) { commonCfg := common.Config{ Ctx: snow.DefaultConsensusContextTest(), - Validators: vdrs, Beacons: vdrs, SampleK: vdrs.Len(), Alpha: alpha, diff --git a/vms/platformvm/vm_test.go b/vms/platformvm/vm_test.go index ceb1c028a88f..58ec309a2442 100644 --- a/vms/platformvm/vm_test.go +++ b/vms/platformvm/vm_test.go @@ -1802,7 +1802,6 @@ func TestBootstrapPartiallyAccepted(t *testing.T) { consensus := &smcon.Topological{} commonCfg := common.Config{ Ctx: consensusCtx, - Validators: beacons, Beacons: beacons, SampleK: beacons.Len(), StartupTracker: startup,