Skip to content

Commit

Permalink
Move validators.TestManager to validatorstest.Manager (#3408)
Browse files Browse the repository at this point in the history
  • Loading branch information
StephenButtolph authored Sep 23, 2024
1 parent 75fc684 commit 46bbf0d
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 45 deletions.
4 changes: 2 additions & 2 deletions vms/platformvm/block/builder/helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@ import (
"github.com/ava-labs/avalanchego/vms/platformvm/txs/mempool"
"github.com/ava-labs/avalanchego/vms/platformvm/txs/txstest"
"github.com/ava-labs/avalanchego/vms/platformvm/utxo"
"github.com/ava-labs/avalanchego/vms/platformvm/validators/validatorstest"
"github.com/ava-labs/avalanchego/vms/secp256k1fx"
"github.com/ava-labs/avalanchego/wallet/chain/p/wallet"

blockexecutor "github.com/ava-labs/avalanchego/vms/platformvm/block/executor"
txexecutor "github.com/ava-labs/avalanchego/vms/platformvm/txs/executor"
pvalidators "github.com/ava-labs/avalanchego/vms/platformvm/validators"
)

const (
Expand Down Expand Up @@ -153,7 +153,7 @@ func newEnvironment(t *testing.T, f upgradetest.Fork) *environment { //nolint:un
metrics,
res.state,
&res.backend,
pvalidators.TestManager,
validatorstest.Manager,
)

txVerifier := network.NewLockedTxVerifier(&res.ctx.Lock, res.blkManager)
Expand Down
12 changes: 6 additions & 6 deletions vms/platformvm/block/executor/acceptor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
"github.com/ava-labs/avalanchego/vms/platformvm/metrics"
"github.com/ava-labs/avalanchego/vms/platformvm/state"
"github.com/ava-labs/avalanchego/vms/platformvm/txs"
"github.com/ava-labs/avalanchego/vms/platformvm/validators"
"github.com/ava-labs/avalanchego/vms/platformvm/validators/validatorstest"
"github.com/ava-labs/avalanchego/vms/secp256k1fx"
)

Expand Down Expand Up @@ -62,7 +62,7 @@ func TestAcceptorVisitProposalBlock(t *testing.T) {
state: s,
},
metrics: metrics.Noop,
validators: validators.TestManager,
validators: validatorstest.Manager,
}

require.NoError(acceptor.ApricotProposalBlock(blk))
Expand Down Expand Up @@ -97,7 +97,7 @@ func TestAcceptorVisitAtomicBlock(t *testing.T) {
},
},
metrics: metrics.Noop,
validators: validators.TestManager,
validators: validatorstest.Manager,
}

blk, err := block.NewApricotAtomicBlock(
Expand Down Expand Up @@ -177,7 +177,7 @@ func TestAcceptorVisitStandardBlock(t *testing.T) {
},
},
metrics: metrics.Noop,
validators: validators.TestManager,
validators: validatorstest.Manager,
}

blk, err := block.NewBanffStandardBlock(
Expand Down Expand Up @@ -266,7 +266,7 @@ func TestAcceptorVisitCommitBlock(t *testing.T) {
},
},
metrics: metrics.Noop,
validators: validators.TestManager,
validators: validatorstest.Manager,
bootstrapped: &utils.Atomic[bool]{},
}

Expand Down Expand Up @@ -376,7 +376,7 @@ func TestAcceptorVisitAbortBlock(t *testing.T) {
},
},
metrics: metrics.Noop,
validators: validators.TestManager,
validators: validatorstest.Manager,
bootstrapped: &utils.Atomic[bool]{},
}

Expand Down
7 changes: 3 additions & 4 deletions vms/platformvm/block/executor/helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,9 @@ import (
"github.com/ava-labs/avalanchego/vms/platformvm/txs/mempool"
"github.com/ava-labs/avalanchego/vms/platformvm/txs/txstest"
"github.com/ava-labs/avalanchego/vms/platformvm/utxo"
"github.com/ava-labs/avalanchego/vms/platformvm/validators/validatorstest"
"github.com/ava-labs/avalanchego/vms/secp256k1fx"
"github.com/ava-labs/avalanchego/wallet/chain/p/wallet"

pvalidators "github.com/ava-labs/avalanchego/vms/platformvm/validators"
)

const (
Expand Down Expand Up @@ -166,7 +165,7 @@ func newEnvironment(t *testing.T, ctrl *gomock.Controller, f upgradetest.Fork) *
metrics,
res.state,
res.backend,
pvalidators.TestManager,
validatorstest.Manager,
)
addSubnet(t, res)
} else {
Expand All @@ -175,7 +174,7 @@ func newEnvironment(t *testing.T, ctrl *gomock.Controller, f upgradetest.Fork) *
metrics,
res.mockedState,
res.backend,
pvalidators.TestManager,
validatorstest.Manager,
)
// we do not add any subnet to state, since we can mock
// whatever we need
Expand Down
33 changes: 0 additions & 33 deletions vms/platformvm/validators/test_manager.go

This file was deleted.

35 changes: 35 additions & 0 deletions vms/platformvm/validators/validatorstest/manager.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved.
// See the file LICENSE for licensing terms.

package validatorstest

import (
"context"

"github.com/ava-labs/avalanchego/ids"

snowvalidators "github.com/ava-labs/avalanchego/snow/validators"
vmvalidators "github.com/ava-labs/avalanchego/vms/platformvm/validators"
)

var Manager vmvalidators.Manager = manager{}

type manager struct{}

func (manager) GetMinimumHeight(context.Context) (uint64, error) {
return 0, nil
}

func (manager) GetCurrentHeight(context.Context) (uint64, error) {
return 0, nil
}

func (manager) GetSubnetID(context.Context, ids.ID) (ids.ID, error) {
return ids.Empty, nil
}

func (manager) GetValidatorSet(context.Context, uint64, ids.ID) (map[ids.NodeID]*snowvalidators.GetValidatorOutput, error) {
return nil, nil
}

func (manager) OnAcceptedBlockID(ids.ID) {}

0 comments on commit 46bbf0d

Please sign in to comment.