Skip to content

Commit

Permalink
Remove unused field common.Config#Validators (ava-labs#2604)
Browse files Browse the repository at this point in the history
  • Loading branch information
abi87 authored Feb 17, 2023
1 parent d2ba3bc commit 2a26d89
Show file tree
Hide file tree
Showing 12 changed files with 6 additions and 18 deletions.
2 changes: 0 additions & 2 deletions chains/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -687,7 +687,6 @@ func (m *manager) createAvalancheChain(

commonCfg := common.Config{
Ctx: ctx,
Validators: vdrs,
Beacons: beacons,
SampleK: sampleK,
StartupTracker: startupTracker,
Expand Down Expand Up @@ -956,7 +955,6 @@ func (m *manager) createSnowmanChain(

commonCfg := common.Config{
Ctx: ctx,
Validators: vdrs,
Beacons: beacons,
SampleK: sampleK,
StartupTracker: startupTracker,
Expand Down
1 change: 0 additions & 1 deletion snow/engine/avalanche/bootstrap/bootstrapper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 2 additions & 1 deletion snow/engine/avalanche/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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,
Expand Down
1 change: 0 additions & 1 deletion snow/engine/avalanche/getter/getter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 0 additions & 3 deletions snow/engine/avalanche/transitive_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2710,7 +2710,6 @@ func TestEngineBootstrappingIntoConsensus(t *testing.T) {
vals.RegisterCallbackListener(startup)

bootCfg.Beacons = vals
bootCfg.Validators = vals
bootCfg.StartupTracker = startup
engCfg.Validators = vals

Expand Down Expand Up @@ -2987,7 +2986,6 @@ func TestEngineReBootstrapFails(t *testing.T) {
vals.RegisterCallbackListener(startup)

bootCfg.Beacons = vals
bootCfg.Validators = vals
bootCfg.StartupTracker = startup
engCfg.Validators = vals

Expand Down Expand Up @@ -3152,7 +3150,6 @@ func TestEngineReBootstrappingIntoConsensus(t *testing.T) {
vals.RegisterCallbackListener(startup)

bootCfg.Beacons = vals
bootCfg.Validators = vals
bootCfg.StartupTracker = startup
engCfg.Validators = vals

Expand Down
5 changes: 2 additions & 3 deletions snow/engine/common/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion snow/engine/common/test_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ func DefaultConfigTest() Config {

return Config{
Ctx: snow.DefaultConsensusContextTest(),
Validators: validators.NewSet(),
Beacons: beacons,
StartupTracker: startupTracker,
Sender: &SenderTest{},
Expand Down
2 changes: 0 additions & 2 deletions snow/engine/snowman/bootstrap/bootstrapper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -125,7 +124,6 @@ func TestBootstrapperStartsOnlyIfEnoughStakeIsConnected(t *testing.T) {

commonCfg := common.Config{
Ctx: snow.DefaultConsensusContextTest(),
Validators: peers,
Beacons: peers,
SampleK: sampleK,
Alpha: alpha,
Expand Down
3 changes: 2 additions & 1 deletion snow/engine/snowman/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@ 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 {
commonCfg := common.DefaultConfigTest()
return Config{
Ctx: commonCfg.Ctx,
Sender: commonCfg.Sender,
Validators: commonCfg.Validators,
Validators: validators.NewSet(),
VM: &block.TestVM{},
Params: snowball.Parameters{
K: 1,
Expand Down
1 change: 0 additions & 1 deletion snow/engine/snowman/getter/getter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ func testSetup(

commonConfig := common.Config{
Ctx: ctx,
Validators: peers,
Beacons: peers,
SampleK: peers.Len(),
Alpha: peers.Weight()/2 + 1,
Expand Down
1 change: 0 additions & 1 deletion snow/engine/snowman/syncer/state_syncer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ func TestStateSyncingStartsOnlyIfEnoughStakeIsConnected(t *testing.T) {

commonCfg := common.Config{
Ctx: snow.DefaultConsensusContextTest(),
Validators: vdrs,
Beacons: vdrs,
SampleK: vdrs.Len(),
Alpha: alpha,
Expand Down
1 change: 0 additions & 1 deletion vms/platformvm/vm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 2a26d89

Please sign in to comment.