simplify config handling

This commit is contained in:
Callum Waters
2022-06-15 12:38:20 +02:00
parent f0b0f34f3f
commit 27d139cdb9
32 changed files with 321 additions and 761 deletions
+5 -55
View File
@@ -2,7 +2,6 @@ package blocksync
import (
"context"
"os"
"testing"
"time"
@@ -13,7 +12,6 @@ import (
abciclient "github.com/tendermint/tendermint/abci/client"
abci "github.com/tendermint/tendermint/abci/types"
"github.com/tendermint/tendermint/config"
"github.com/tendermint/tendermint/internal/consensus"
"github.com/tendermint/tendermint/internal/eventbus"
mpmocks "github.com/tendermint/tendermint/internal/mempool/mocks"
@@ -253,12 +251,8 @@ func TestReactor_AbruptDisconnect(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
cfg, err := config.ResetTestRoot(t.TempDir(), "block_sync_reactor_test")
require.NoError(t, err)
defer os.RemoveAll(cfg.RootDir)
valSet, privVals := factory.ValidatorSet(ctx, t, 1, 30)
genDoc := factory.GenesisDoc(cfg, time.Now(), valSet.Validators, factory.ConsensusParams())
genDoc := factory.GenesisDoc(factory.DefaultTestChainID, time.Now(), valSet.Validators, factory.ConsensusParams())
maxBlockHeight := int64(64)
rts := setup(ctx, t, genDoc, privVals[0], []int64{maxBlockHeight, 0})
@@ -293,12 +287,8 @@ func TestReactor_SyncTime(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
cfg, err := config.ResetTestRoot(t.TempDir(), "block_sync_reactor_test")
require.NoError(t, err)
defer os.RemoveAll(cfg.RootDir)
valSet, privVals := factory.ValidatorSet(ctx, t, 1, 30)
genDoc := factory.GenesisDoc(cfg, time.Now(), valSet.Validators, factory.ConsensusParams())
genDoc := factory.GenesisDoc(factory.DefaultTestChainID, time.Now(), valSet.Validators, factory.ConsensusParams())
maxBlockHeight := int64(101)
rts := setup(ctx, t, genDoc, privVals[0], []int64{maxBlockHeight, 0})
@@ -321,12 +311,8 @@ func TestReactor_NoBlockResponse(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
cfg, err := config.ResetTestRoot(t.TempDir(), "block_sync_reactor_test")
require.NoError(t, err)
defer os.RemoveAll(cfg.RootDir)
valSet, privVals := factory.ValidatorSet(ctx, t, 1, 30)
genDoc := factory.GenesisDoc(cfg, time.Now(), valSet.Validators, factory.ConsensusParams())
genDoc := factory.GenesisDoc(factory.DefaultTestChainID, time.Now(), valSet.Validators, factory.ConsensusParams())
maxBlockHeight := int64(65)
rts := setup(ctx, t, genDoc, privVals[0], []int64{maxBlockHeight, 0})
@@ -373,13 +359,9 @@ func TestReactor_BadBlockStopsPeer(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
cfg, err := config.ResetTestRoot(t.TempDir(), "block_sync_reactor_test")
require.NoError(t, err)
defer os.RemoveAll(cfg.RootDir)
maxBlockHeight := int64(48)
valSet, privVals := factory.ValidatorSet(ctx, t, 1, 30)
genDoc := factory.GenesisDoc(cfg, time.Now(), valSet.Validators, factory.ConsensusParams())
genDoc := factory.GenesisDoc(factory.DefaultTestChainID, time.Now(), valSet.Validators, factory.ConsensusParams())
rts := setup(ctx, t, genDoc, privVals[0], []int64{maxBlockHeight, 0, 0, 0, 0})
@@ -414,7 +396,7 @@ func TestReactor_BadBlockStopsPeer(t *testing.T) {
// XXX: This causes a potential race condition.
// See: https://github.com/tendermint/tendermint/issues/6005
valSet, otherPrivVals := factory.ValidatorSet(ctx, t, 1, 30)
otherGenDoc := factory.GenesisDoc(cfg, time.Now(), valSet.Validators, factory.ConsensusParams())
otherGenDoc := factory.GenesisDoc(factory.DefaultTestChainID, time.Now(), valSet.Validators, factory.ConsensusParams())
newNode := rts.network.MakeNode(ctx, t, p2ptest.NodeOptions{
MaxPeers: uint16(len(rts.nodes) + 1),
MaxConnected: uint16(len(rts.nodes) + 1),
@@ -445,35 +427,3 @@ func TestReactor_BadBlockStopsPeer(t *testing.T) {
len(rts.reactors[newNode.NodeID].pool.peers),
)
}
/*
func TestReactorReceivesNoExtendedCommit(t *testing.T) {
blockDB := dbm.NewMemDB()
stateDB := dbm.NewMemDB()
stateStore := sm.NewStore(stateDB)
blockStore := store.NewBlockStore(blockDB)
blockExec := sm.NewBlockExecutor(
stateStore,
log.NewNopLogger(),
rts.app[nodeID],
mp,
sm.EmptyEvidencePool{},
blockStore,
eventbus,
sm.NopMetrics(),
)
NewReactor(
log.NewNopLogger(),
stateStore,
blockExec,
blockStore,
nil,
chCreator,
func(ctx context.Context) *p2p.PeerUpdates { return rts.peerUpdates[nodeID] },
rts.blockSync,
consensus.NopMetrics(),
nil, // eventbus, can be nil
)
}
*/
+1 -3
View File
@@ -40,15 +40,13 @@ func TestByzantinePrevoteEquivocation(t *testing.T) {
ctx, cancel := context.WithTimeout(context.Background(), 20*time.Second)
defer cancel()
config := configSetup(t)
nValidators := 4
prevoteHeight := int64(2)
testName := "consensus_byzantine_test"
tickerFunc := newMockTickerFunc(true)
valSet, privVals := factory.ValidatorSet(ctx, t, nValidators, 30)
genDoc := factory.GenesisDoc(config, time.Now(), valSet.Validators, factory.ConsensusParams())
genDoc := factory.GenesisDoc(factory.DefaultTestChainID, time.Now(), valSet.Validators, factory.ConsensusParams())
states := make([]*State, nValidators)
for i := 0; i < nValidators; i++ {
+5 -5
View File
@@ -557,7 +557,7 @@ func makeState(ctx context.Context, t *testing.T, args makeStateArgs) (*State, [
c = args.consensusParams
}
state, privVals := makeGenesisState(ctx, t, args.config, genesisStateArgs{
state, privVals := makeGenesisState(ctx, t, genesisStateArgs{
Params: c,
Validators: validators,
})
@@ -803,7 +803,7 @@ func makeConsensusState(
tempDir := t.TempDir()
valSet, privVals := factory.ValidatorSet(ctx, t, nValidators, 30)
genDoc := factory.GenesisDoc(cfg, time.Now(), valSet.Validators, factory.ConsensusParams())
genDoc := factory.GenesisDoc(factory.DefaultTestChainID, time.Now(), valSet.Validators, factory.ConsensusParams())
css := make([]*State, nValidators)
logger := consensusLogger()
@@ -863,7 +863,7 @@ func randConsensusNetWithPeers(
t.Helper()
valSet, privVals := factory.ValidatorSet(ctx, t, nValidators, testMinPower)
genDoc := factory.GenesisDoc(cfg, time.Now(), valSet.Validators, factory.ConsensusParams())
genDoc := factory.GenesisDoc(factory.DefaultTestChainID, time.Now(), valSet.Validators, factory.ConsensusParams())
css := make([]*State, nPeers)
t.Helper()
logger := consensusLogger()
@@ -924,7 +924,7 @@ type genesisStateArgs struct {
Time time.Time
}
func makeGenesisState(ctx context.Context, t *testing.T, cfg *config.Config, args genesisStateArgs) (sm.State, []types.PrivValidator) {
func makeGenesisState(ctx context.Context, t *testing.T, args genesisStateArgs) (sm.State, []types.PrivValidator) {
t.Helper()
if args.Power == 0 {
args.Power = 1
@@ -939,7 +939,7 @@ func makeGenesisState(ctx context.Context, t *testing.T, cfg *config.Config, arg
if args.Time.IsZero() {
args.Time = time.Now()
}
genDoc := factory.GenesisDoc(cfg, args.Time, valSet.Validators, args.Params)
genDoc := factory.GenesisDoc(factory.DefaultTestChainID, args.Time, valSet.Validators, args.Params)
s0, err := sm.MakeGenesisState(genDoc)
require.NoError(t, err)
return s0, privValidators
+5 -9
View File
@@ -35,14 +35,12 @@ func TestMempoolNoProgressUntilTxsAvailable(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
baseConfig := configSetup(t)
config, err := ResetConfig(t.TempDir(), "consensus_mempool_txs_available_test")
require.NoError(t, err)
t.Cleanup(func() { _ = os.RemoveAll(config.RootDir) })
config.Consensus.CreateEmptyBlocks = false
state, privVals := makeGenesisState(ctx, t, baseConfig, genesisStateArgs{
state, privVals := makeGenesisState(ctx, t, genesisStateArgs{
Validators: 1,
Power: 10,
Params: factory.ConsensusParams()})
@@ -61,7 +59,6 @@ func TestMempoolNoProgressUntilTxsAvailable(t *testing.T) {
}
func TestMempoolProgressAfterCreateEmptyBlocksInterval(t *testing.T) {
baseConfig := configSetup(t)
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
@@ -70,7 +67,7 @@ func TestMempoolProgressAfterCreateEmptyBlocksInterval(t *testing.T) {
t.Cleanup(func() { _ = os.RemoveAll(config.RootDir) })
config.Consensus.CreateEmptyBlocksInterval = ensureTimeout
state, privVals := makeGenesisState(ctx, t, baseConfig, genesisStateArgs{
state, privVals := makeGenesisState(ctx, t, genesisStateArgs{
Validators: 1,
Power: 10,
Params: factory.ConsensusParams()})
@@ -87,7 +84,6 @@ func TestMempoolProgressAfterCreateEmptyBlocksInterval(t *testing.T) {
}
func TestMempoolProgressInHigherRound(t *testing.T) {
baseConfig := configSetup(t)
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
@@ -96,7 +92,7 @@ func TestMempoolProgressInHigherRound(t *testing.T) {
t.Cleanup(func() { _ = os.RemoveAll(config.RootDir) })
config.Consensus.CreateEmptyBlocks = false
state, privVals := makeGenesisState(ctx, t, baseConfig, genesisStateArgs{
state, privVals := makeGenesisState(ctx, t, genesisStateArgs{
Validators: 1,
Power: 10,
Params: factory.ConsensusParams()})
@@ -150,7 +146,7 @@ func TestMempoolTxConcurrentWithCommit(t *testing.T) {
config := configSetup(t)
logger := log.NewNopLogger()
state, privVals := makeGenesisState(ctx, t, config, genesisStateArgs{
state, privVals := makeGenesisState(ctx, t, genesisStateArgs{
Validators: 1,
Power: 10,
Params: factory.ConsensusParams(),
@@ -188,7 +184,7 @@ func TestMempoolRmBadTx(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
state, privVals := makeGenesisState(ctx, t, config, genesisStateArgs{
state, privVals := makeGenesisState(ctx, t, genesisStateArgs{
Validators: 1,
Power: 10,
Params: factory.ConsensusParams()})
+2 -3
View File
@@ -90,7 +90,6 @@ type pbtsTestConfiguration struct {
func newPBTSTestHarness(ctx context.Context, t *testing.T, tc pbtsTestConfiguration) pbtsTestHarness {
t.Helper()
const validators = 4
cfg := configSetup(t)
clock := new(tmtimemocks.Source)
if tc.genesisTime.IsZero() {
@@ -110,7 +109,7 @@ func newPBTSTestHarness(ctx context.Context, t *testing.T, tc pbtsTestConfigurat
consensusParams.Timeout.Propose = tc.timeoutPropose
consensusParams.Synchrony = tc.synchronyParams
state, privVals := makeGenesisState(ctx, t, cfg, genesisStateArgs{
state, privVals := makeGenesisState(ctx, t, genesisStateArgs{
Params: consensusParams,
Time: tc.genesisTime,
Validators: validators,
@@ -137,7 +136,7 @@ func newPBTSTestHarness(ctx context.Context, t *testing.T, tc pbtsTestConfigurat
otherValidators: vss[1:],
validatorClock: clock,
currentHeight: 1,
chainID: cfg.ChainID(),
chainID: factory.DefaultTestChainID,
roundCh: subscribe(ctx, t, cs.eventBus, types.EventQueryNewRound),
ensureProposalCh: subscribe(ctx, t, cs.eventBus, types.EventQueryCompleteProposal),
blockCh: subscribe(ctx, t, cs.eventBus, types.EventQueryNewBlock),
+2 -4
View File
@@ -444,14 +444,12 @@ func TestReactorWithEvidence(t *testing.T) {
ctx, cancel := context.WithTimeout(context.Background(), time.Minute)
defer cancel()
cfg := configSetup(t)
n := 2
testName := "consensus_reactor_test"
tickerFunc := newMockTickerFunc(true)
valSet, privVals := factory.ValidatorSet(ctx, t, n, 30)
genDoc := factory.GenesisDoc(cfg, time.Now(), valSet.Validators, factory.ConsensusParams())
genDoc := factory.GenesisDoc(factory.DefaultTestChainID, time.Now(), valSet.Validators, factory.ConsensusParams())
states := make([]*State, n)
logger := consensusLogger()
@@ -493,7 +491,7 @@ func TestReactorWithEvidence(t *testing.T) {
// everyone includes evidence of another double signing
vIdx := (i + 1) % n
ev, err := types.NewMockDuplicateVoteEvidenceWithValidator(ctx, 1, defaultTestTime, privVals[vIdx], cfg.ChainID())
ev, err := types.NewMockDuplicateVoteEvidenceWithValidator(ctx, 1, defaultTestTime, privVals[vIdx], factory.DefaultTestChainID)
require.NoError(t, err)
evpool := &statemocks.EvidencePool{}
evpool.On("CheckEvidence", ctx, mock.AnythingOfType("types.EvidenceList")).Return(nil)
+10 -10
View File
@@ -364,7 +364,7 @@ func setupSimulator(ctx context.Context, t *testing.T) *simulatorTestSuite {
ensureNewProposal(t, proposalCh, height, round)
rs := css[0].GetRoundState()
signAddVotes(ctx, t, css[0], tmproto.PrecommitType, sim.Config.ChainID(),
signAddVotes(ctx, t, css[0], tmproto.PrecommitType, factory.DefaultTestChainID,
types.BlockID{Hash: rs.ProposalBlock.Hash(), PartSetHeader: rs.ProposalBlockParts.Header()},
vss[1:nVals]...)
@@ -388,7 +388,7 @@ func setupSimulator(ctx context.Context, t *testing.T) *simulatorTestSuite {
proposal := types.NewProposal(vss[1].Height, round, -1, blockID, propBlock.Header.Time)
p := proposal.ToProto()
if err := vss[1].SignProposal(ctx, cfg.ChainID(), p); err != nil {
if err := vss[1].SignProposal(ctx, factory.DefaultTestChainID, p); err != nil {
t.Fatal("failed to sign bad proposal", err)
}
proposal.Signature = p.Signature
@@ -399,7 +399,7 @@ func setupSimulator(ctx context.Context, t *testing.T) *simulatorTestSuite {
}
ensureNewProposal(t, proposalCh, height, round)
rs = css[0].GetRoundState()
signAddVotes(ctx, t, css[0], tmproto.PrecommitType, sim.Config.ChainID(),
signAddVotes(ctx, t, css[0], tmproto.PrecommitType, factory.DefaultTestChainID,
types.BlockID{Hash: rs.ProposalBlock.Hash(), PartSetHeader: rs.ProposalBlockParts.Header()},
vss[1:nVals]...)
ensureNewRound(t, newRoundCh, height+1, 0)
@@ -422,7 +422,7 @@ func setupSimulator(ctx context.Context, t *testing.T) *simulatorTestSuite {
proposal = types.NewProposal(vss[2].Height, round, -1, blockID, propBlock.Header.Time)
p = proposal.ToProto()
if err := vss[2].SignProposal(ctx, cfg.ChainID(), p); err != nil {
if err := vss[2].SignProposal(ctx, factory.DefaultTestChainID, p); err != nil {
t.Fatal("failed to sign bad proposal", err)
}
proposal.Signature = p.Signature
@@ -433,7 +433,7 @@ func setupSimulator(ctx context.Context, t *testing.T) *simulatorTestSuite {
}
ensureNewProposal(t, proposalCh, height, round)
rs = css[0].GetRoundState()
signAddVotes(ctx, t, css[0], tmproto.PrecommitType, sim.Config.ChainID(),
signAddVotes(ctx, t, css[0], tmproto.PrecommitType, factory.DefaultTestChainID,
types.BlockID{Hash: rs.ProposalBlock.Hash(), PartSetHeader: rs.ProposalBlockParts.Header()},
vss[1:nVals]...)
ensureNewRound(t, newRoundCh, height+1, 0)
@@ -485,7 +485,7 @@ func setupSimulator(ctx context.Context, t *testing.T) *simulatorTestSuite {
proposal = types.NewProposal(vss[3].Height, round, -1, blockID, propBlock.Header.Time)
p = proposal.ToProto()
if err := vss[3].SignProposal(ctx, cfg.ChainID(), p); err != nil {
if err := vss[3].SignProposal(ctx, factory.DefaultTestChainID, p); err != nil {
t.Fatal("failed to sign bad proposal", err)
}
proposal.Signature = p.Signature
@@ -506,7 +506,7 @@ func setupSimulator(ctx context.Context, t *testing.T) *simulatorTestSuite {
continue
}
signAddVotes(ctx, t, css[0],
tmproto.PrecommitType, sim.Config.ChainID(),
tmproto.PrecommitType, factory.DefaultTestChainID,
types.BlockID{Hash: rs.ProposalBlock.Hash(), PartSetHeader: rs.ProposalBlockParts.Header()},
newVss[i])
}
@@ -531,7 +531,7 @@ func setupSimulator(ctx context.Context, t *testing.T) *simulatorTestSuite {
continue
}
signAddVotes(ctx, t, css[0],
tmproto.PrecommitType, sim.Config.ChainID(),
tmproto.PrecommitType, factory.DefaultTestChainID,
types.BlockID{Hash: rs.ProposalBlock.Hash(), PartSetHeader: rs.ProposalBlockParts.Header()},
newVss[i])
}
@@ -556,7 +556,7 @@ func setupSimulator(ctx context.Context, t *testing.T) *simulatorTestSuite {
require.NotEqual(t, -1, selfIndex)
proposal = types.NewProposal(vss[1].Height, round, -1, blockID, propBlock.Header.Time)
p = proposal.ToProto()
if err := vss[1].SignProposal(ctx, cfg.ChainID(), p); err != nil {
if err := vss[1].SignProposal(ctx, factory.DefaultTestChainID, p); err != nil {
t.Fatal("failed to sign bad proposal", err)
}
proposal.Signature = p.Signature
@@ -572,7 +572,7 @@ func setupSimulator(ctx context.Context, t *testing.T) *simulatorTestSuite {
continue
}
signAddVotes(ctx, t, css[0],
tmproto.PrecommitType, sim.Config.ChainID(),
tmproto.PrecommitType, factory.DefaultTestChainID,
types.BlockID{Hash: rs.ProposalBlock.Hash(), PartSetHeader: rs.ProposalBlockParts.Header()},
newVss[i])
}
+101 -101
View File
@@ -95,7 +95,7 @@ func TestStateProposerSelection0(t *testing.T) {
ensureNewProposal(t, proposalCh, height, round)
rs := cs1.GetRoundState()
signAddVotes(ctx, t, cs1, tmproto.PrecommitType, config.ChainID(), types.BlockID{
signAddVotes(ctx, t, cs1, tmproto.PrecommitType, factory.DefaultTestChainID, types.BlockID{
Hash: rs.ProposalBlock.Hash(),
PartSetHeader: rs.ProposalBlockParts.Header(),
}, vss[1:]...)
@@ -141,7 +141,7 @@ func TestStateProposerSelection2(t *testing.T) {
int(i+2)%len(vss),
prop.Address)
signAddVotes(ctx, t, cs1, tmproto.PrecommitType, config.ChainID(), types.BlockID{}, vss[1:]...)
signAddVotes(ctx, t, cs1, tmproto.PrecommitType, factory.DefaultTestChainID, types.BlockID{}, vss[1:]...)
ensureNewRound(t, newRoundCh, height, i+round+1) // wait for the new round event each round
incrementRound(vss[1:]...)
}
@@ -239,7 +239,7 @@ func TestStateBadProposal(t *testing.T) {
blockID := types.BlockID{Hash: propBlock.Hash(), PartSetHeader: propBlockParts.Header()}
proposal := types.NewProposal(vs2.Height, round, -1, blockID, propBlock.Header.Time)
p := proposal.ToProto()
err = vs2.SignProposal(ctx, config.ChainID(), p)
err = vs2.SignProposal(ctx, factory.DefaultTestChainID, p)
require.NoError(t, err)
proposal.Signature = p.Signature
@@ -258,13 +258,13 @@ func TestStateBadProposal(t *testing.T) {
ensurePrevoteMatch(t, voteCh, height, round, nil)
// add bad prevote from vs2 and wait for it
signAddVotes(ctx, t, cs1, tmproto.PrevoteType, config.ChainID(), blockID, vs2)
signAddVotes(ctx, t, cs1, tmproto.PrevoteType, factory.DefaultTestChainID, blockID, vs2)
ensurePrevote(t, voteCh, height, round)
// wait for precommit
ensurePrecommit(t, voteCh, height, round)
validatePrecommit(ctx, t, cs1, round, -1, vss[0], nil, nil)
signAddVotes(ctx, t, cs1, tmproto.PrecommitType, config.ChainID(), blockID, vs2)
signAddVotes(ctx, t, cs1, tmproto.PrecommitType, factory.DefaultTestChainID, blockID, vs2)
}
func TestStateOversizedBlock(t *testing.T) {
@@ -296,7 +296,7 @@ func TestStateOversizedBlock(t *testing.T) {
blockID := types.BlockID{Hash: propBlock.Hash(), PartSetHeader: propBlockParts.Header()}
proposal := types.NewProposal(height, round, -1, blockID, propBlock.Header.Time)
p := proposal.ToProto()
err = vs2.SignProposal(ctx, config.ChainID(), p)
err = vs2.SignProposal(ctx, factory.DefaultTestChainID, p)
require.NoError(t, err)
proposal.Signature = p.Signature
@@ -319,11 +319,11 @@ func TestStateOversizedBlock(t *testing.T) {
// and then should send nil prevote and precommit regardless of whether other validators prevote and
// precommit on it
ensurePrevoteMatch(t, voteCh, height, round, nil)
signAddVotes(ctx, t, cs1, tmproto.PrevoteType, config.ChainID(), blockID, vs2)
signAddVotes(ctx, t, cs1, tmproto.PrevoteType, factory.DefaultTestChainID, blockID, vs2)
ensurePrevote(t, voteCh, height, round)
ensurePrecommit(t, voteCh, height, round)
validatePrecommit(ctx, t, cs1, round, -1, vss[0], nil, nil)
signAddVotes(ctx, t, cs1, tmproto.PrecommitType, config.ChainID(), blockID, vs2)
signAddVotes(ctx, t, cs1, tmproto.PrecommitType, factory.DefaultTestChainID, blockID, vs2)
}
//----------------------------------------------------------------------------------------------------
@@ -401,7 +401,7 @@ func TestStateFullRound2(t *testing.T) {
blockID := types.BlockID{Hash: rs.ProposalBlock.Hash(), PartSetHeader: rs.ProposalBlockParts.Header()}
// prevote arrives from vs2:
signAddVotes(ctx, t, cs1, tmproto.PrevoteType, config.ChainID(), blockID, vs2)
signAddVotes(ctx, t, cs1, tmproto.PrevoteType, factory.DefaultTestChainID, blockID, vs2)
ensurePrevote(t, voteCh, height, round) // prevote
ensurePrecommit(t, voteCh, height, round) // precommit
@@ -411,7 +411,7 @@ func TestStateFullRound2(t *testing.T) {
// we should be stuck in limbo waiting for more precommits
// precommit arrives from vs2:
signAddVotes(ctx, t, cs1, tmproto.PrecommitType, config.ChainID(), blockID, vs2)
signAddVotes(ctx, t, cs1, tmproto.PrecommitType, factory.DefaultTestChainID, blockID, vs2)
ensurePrecommit(t, voteCh, height, round)
// wait to finish commit, propose in next height
@@ -461,7 +461,7 @@ func TestStateLock_NoPOL(t *testing.T) {
// we should now be stuck in limbo forever, waiting for more prevotes
// prevote arrives from vs2:
signAddVotes(ctx, t, cs1, tmproto.PrevoteType, config.ChainID(), initialBlockID, vs2)
signAddVotes(ctx, t, cs1, tmproto.PrevoteType, factory.DefaultTestChainID, initialBlockID, vs2)
ensurePrevote(t, voteCh, height, round) // prevote
validatePrevote(ctx, t, cs1, round, vss[0], initialBlockID.Hash)
@@ -474,7 +474,7 @@ func TestStateLock_NoPOL(t *testing.T) {
hash := make([]byte, len(initialBlockID.Hash))
copy(hash, initialBlockID.Hash)
hash[0] = (hash[0] + 1) % 255
signAddVotes(ctx, t, cs1, tmproto.PrecommitType, config.ChainID(), types.BlockID{
signAddVotes(ctx, t, cs1, tmproto.PrecommitType, factory.DefaultTestChainID, types.BlockID{
Hash: hash,
PartSetHeader: initialBlockID.PartSetHeader,
}, vs2)
@@ -509,7 +509,7 @@ func TestStateLock_NoPOL(t *testing.T) {
partSet, err := rs.LockedBlock.MakePartSet(partSize)
require.NoError(t, err)
conflictingBlockID := types.BlockID{Hash: hash, PartSetHeader: partSet.Header()}
signAddVotes(ctx, t, cs1, tmproto.PrevoteType, config.ChainID(), conflictingBlockID, vs2)
signAddVotes(ctx, t, cs1, tmproto.PrevoteType, factory.DefaultTestChainID, conflictingBlockID, vs2)
ensurePrevote(t, voteCh, height, round)
// now we're going to enter prevote again, but with invalid args
@@ -521,7 +521,7 @@ func TestStateLock_NoPOL(t *testing.T) {
validatePrecommit(ctx, t, cs1, round, 0, vss[0], nil, initialBlockID.Hash)
// add conflicting precommit from vs2
signAddVotes(ctx, t, cs1, tmproto.PrecommitType, config.ChainID(), conflictingBlockID, vs2)
signAddVotes(ctx, t, cs1, tmproto.PrecommitType, factory.DefaultTestChainID, conflictingBlockID, vs2)
ensurePrecommit(t, voteCh, height, round)
// (note we're entering precommit for a second time this round, but with invalid args
@@ -550,7 +550,7 @@ func TestStateLock_NoPOL(t *testing.T) {
partSet, err = rs.ProposalBlock.MakePartSet(partSize)
require.NoError(t, err)
newBlockID := types.BlockID{Hash: hash, PartSetHeader: partSet.Header()}
signAddVotes(ctx, t, cs1, tmproto.PrevoteType, config.ChainID(), newBlockID, vs2)
signAddVotes(ctx, t, cs1, tmproto.PrevoteType, factory.DefaultTestChainID, newBlockID, vs2)
ensurePrevote(t, voteCh, height, round)
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.voteTimeout(round).Nanoseconds())
@@ -563,7 +563,7 @@ func TestStateLock_NoPOL(t *testing.T) {
t,
cs1,
tmproto.PrecommitType,
config.ChainID(),
factory.DefaultTestChainID,
newBlockID,
vs2) // NOTE: conflicting precommits at same height
ensurePrecommit(t, voteCh, height, round)
@@ -604,7 +604,7 @@ func TestStateLock_NoPOL(t *testing.T) {
validatePrevote(ctx, t, cs1, 3, vss[0], nil)
// prevote for proposed block
signAddVotes(ctx, t, cs1, tmproto.PrevoteType, config.ChainID(), propBlockID, vs2)
signAddVotes(ctx, t, cs1, tmproto.PrevoteType, factory.DefaultTestChainID, propBlockID, vs2)
ensurePrevote(t, voteCh, height, round)
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.voteTimeout(round).Nanoseconds())
@@ -616,7 +616,7 @@ func TestStateLock_NoPOL(t *testing.T) {
t,
cs1,
tmproto.PrecommitType,
config.ChainID(),
factory.DefaultTestChainID,
propBlockID,
vs2) // NOTE: conflicting precommits at same height
ensurePrecommit(t, voteCh, height, round)
@@ -671,7 +671,7 @@ func TestStateLock_POLUpdateLock(t *testing.T) {
ensurePrevote(t, voteCh, height, round)
signAddVotes(ctx, t, cs1, tmproto.PrevoteType, config.ChainID(), initialBlockID, vs2, vs3, vs4)
signAddVotes(ctx, t, cs1, tmproto.PrevoteType, factory.DefaultTestChainID, initialBlockID, vs2, vs3, vs4)
// check that the validator generates a Lock event.
ensureLock(t, lockCh, height, round)
@@ -681,7 +681,7 @@ func TestStateLock_POLUpdateLock(t *testing.T) {
validatePrecommit(ctx, t, cs1, round, round, vss[0], initialBlockID.Hash, initialBlockID.Hash)
// add precommits from the rest of the validators.
signAddVotes(ctx, t, cs1, tmproto.PrecommitType, config.ChainID(), types.BlockID{}, vs2, vs3, vs4)
signAddVotes(ctx, t, cs1, tmproto.PrecommitType, factory.DefaultTestChainID, types.BlockID{}, vs2, vs3, vs4)
// timeout to new round.
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.voteTimeout(round).Nanoseconds())
@@ -721,7 +721,7 @@ func TestStateLock_POLUpdateLock(t *testing.T) {
ensurePrevoteMatch(t, voteCh, height, round, nil)
// Add prevotes from the remainder of the validators for the new locked block.
signAddVotes(ctx, t, cs1, tmproto.PrevoteType, config.ChainID(), r1BlockID, vs2, vs3, vs4)
signAddVotes(ctx, t, cs1, tmproto.PrevoteType, factory.DefaultTestChainID, r1BlockID, vs2, vs3, vs4)
// Check that we lock on a new block.
ensureLock(t, lockCh, height, round)
@@ -777,7 +777,7 @@ func TestStateLock_POLRelock(t *testing.T) {
ensurePrevote(t, voteCh, height, round)
signAddVotes(ctx, t, cs1, tmproto.PrevoteType, config.ChainID(), blockID, vs2, vs3, vs4)
signAddVotes(ctx, t, cs1, tmproto.PrevoteType, factory.DefaultTestChainID, blockID, vs2, vs3, vs4)
// check that the validator generates a Lock event.
ensureLock(t, lockCh, height, round)
@@ -787,7 +787,7 @@ func TestStateLock_POLRelock(t *testing.T) {
validatePrecommit(ctx, t, cs1, round, round, vss[0], blockID.Hash, blockID.Hash)
// add precommits from the rest of the validators.
signAddVotes(ctx, t, cs1, tmproto.PrecommitType, config.ChainID(), types.BlockID{}, vs2, vs3, vs4)
signAddVotes(ctx, t, cs1, tmproto.PrecommitType, factory.DefaultTestChainID, types.BlockID{}, vs2, vs3, vs4)
// timeout to new round.
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.voteTimeout(round).Nanoseconds())
@@ -820,7 +820,7 @@ func TestStateLock_POLRelock(t *testing.T) {
validatePrevote(ctx, t, cs1, round, vss[0], blockID.Hash)
// Add prevotes from the remainder of the validators for the locked block.
signAddVotes(ctx, t, cs1, tmproto.PrevoteType, config.ChainID(), blockID, vs2, vs3, vs4)
signAddVotes(ctx, t, cs1, tmproto.PrevoteType, factory.DefaultTestChainID, blockID, vs2, vs3, vs4)
// Check that we relock.
ensureRelock(t, relockCh, height, round)
@@ -872,7 +872,7 @@ func TestStateLock_PrevoteNilWhenLockedAndMissProposal(t *testing.T) {
ensurePrevote(t, voteCh, height, round)
signAddVotes(ctx, t, cs1, tmproto.PrevoteType, config.ChainID(), blockID, vs2, vs3, vs4)
signAddVotes(ctx, t, cs1, tmproto.PrevoteType, factory.DefaultTestChainID, blockID, vs2, vs3, vs4)
// check that the validator generates a Lock event.
ensureLock(t, lockCh, height, round)
@@ -882,7 +882,7 @@ func TestStateLock_PrevoteNilWhenLockedAndMissProposal(t *testing.T) {
validatePrecommit(ctx, t, cs1, round, round, vss[0], blockID.Hash, blockID.Hash)
// add precommits from the rest of the validators.
signAddVotes(ctx, t, cs1, tmproto.PrecommitType, config.ChainID(), types.BlockID{}, vs2, vs3, vs4)
signAddVotes(ctx, t, cs1, tmproto.PrecommitType, factory.DefaultTestChainID, types.BlockID{}, vs2, vs3, vs4)
// timeout to new round.
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.voteTimeout(round).Nanoseconds())
@@ -905,7 +905,7 @@ func TestStateLock_PrevoteNilWhenLockedAndMissProposal(t *testing.T) {
validatePrevote(ctx, t, cs1, round, vss[0], nil)
// Add prevotes from the remainder of the validators nil.
signAddVotes(ctx, t, cs1, tmproto.PrevoteType, config.ChainID(), types.BlockID{}, vs2, vs3, vs4)
signAddVotes(ctx, t, cs1, tmproto.PrevoteType, factory.DefaultTestChainID, types.BlockID{}, vs2, vs3, vs4)
ensurePrecommit(t, voteCh, height, round)
// We should now be locked on the same block but with an updated locked round.
validatePrecommit(ctx, t, cs1, round, 0, vss[0], nil, blockID.Hash)
@@ -958,7 +958,7 @@ func TestStateLock_PrevoteNilWhenLockedAndDifferentProposal(t *testing.T) {
ensurePrevote(t, voteCh, height, round)
signAddVotes(ctx, t, cs1, tmproto.PrevoteType, config.ChainID(), blockID, vs2, vs3, vs4)
signAddVotes(ctx, t, cs1, tmproto.PrevoteType, factory.DefaultTestChainID, blockID, vs2, vs3, vs4)
// check that the validator generates a Lock event.
ensureLock(t, lockCh, height, round)
@@ -968,7 +968,7 @@ func TestStateLock_PrevoteNilWhenLockedAndDifferentProposal(t *testing.T) {
validatePrecommit(ctx, t, cs1, round, round, vss[0], blockID.Hash, blockID.Hash)
// add precommits from the rest of the validators.
signAddVotes(ctx, t, cs1, tmproto.PrecommitType, config.ChainID(), types.BlockID{}, vs2, vs3, vs4)
signAddVotes(ctx, t, cs1, tmproto.PrecommitType, factory.DefaultTestChainID, types.BlockID{}, vs2, vs3, vs4)
// timeout to new round.
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.voteTimeout(round).Nanoseconds())
@@ -1001,7 +1001,7 @@ func TestStateLock_PrevoteNilWhenLockedAndDifferentProposal(t *testing.T) {
validatePrevote(ctx, t, cs1, round, vss[0], nil)
// Add prevotes from the remainder of the validators for nil.
signAddVotes(ctx, t, cs1, tmproto.PrevoteType, config.ChainID(), types.BlockID{}, vs2, vs3, vs4)
signAddVotes(ctx, t, cs1, tmproto.PrevoteType, factory.DefaultTestChainID, types.BlockID{}, vs2, vs3, vs4)
// We should now be locked on the same block but prevote nil.
ensurePrecommit(t, voteCh, height, round)
@@ -1060,7 +1060,7 @@ func TestStateLock_POLDoesNotUnlock(t *testing.T) {
ensurePrevoteMatch(t, voteCh, height, round, blockID.Hash)
signAddVotes(ctx, t, cs1, tmproto.PrevoteType, config.ChainID(), blockID, vs2, vs3, vs4)
signAddVotes(ctx, t, cs1, tmproto.PrevoteType, factory.DefaultTestChainID, blockID, vs2, vs3, vs4)
// the validator should have locked a block in this round.
ensureLock(t, lockCh, height, round)
@@ -1075,8 +1075,8 @@ func TestStateLock_POLDoesNotUnlock(t *testing.T) {
// This ensures that the validator being tested does not commit the block.
// We do not want the validator to commit the block because we want the test
// test to proceeds to the next consensus round.
signAddVotes(ctx, t, cs1, tmproto.PrecommitType, config.ChainID(), types.BlockID{}, vs2, vs4)
signAddVotes(ctx, t, cs1, tmproto.PrecommitType, config.ChainID(), blockID, vs3)
signAddVotes(ctx, t, cs1, tmproto.PrecommitType, factory.DefaultTestChainID, types.BlockID{}, vs2, vs4)
signAddVotes(ctx, t, cs1, tmproto.PrecommitType, factory.DefaultTestChainID, blockID, vs3)
// timeout to new round
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.voteTimeout(round).Nanoseconds())
@@ -1105,14 +1105,14 @@ func TestStateLock_POLDoesNotUnlock(t *testing.T) {
ensurePrevoteMatch(t, voteCh, height, round, nil)
// add >2/3 prevotes for nil from all other validators
signAddVotes(ctx, t, cs1, tmproto.PrevoteType, config.ChainID(), types.BlockID{}, vs2, vs3, vs4)
signAddVotes(ctx, t, cs1, tmproto.PrevoteType, factory.DefaultTestChainID, types.BlockID{}, vs2, vs3, vs4)
ensurePrecommit(t, voteCh, height, round)
// verify that we haven't update our locked block since the first round
validatePrecommit(ctx, t, cs1, round, 0, vss[0], nil, blockID.Hash)
signAddVotes(ctx, t, cs1, tmproto.PrecommitType, config.ChainID(), types.BlockID{}, vs2, vs3, vs4)
signAddVotes(ctx, t, cs1, tmproto.PrecommitType, factory.DefaultTestChainID, types.BlockID{}, vs2, vs3, vs4)
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.voteTimeout(round).Nanoseconds())
/*
@@ -1138,7 +1138,7 @@ func TestStateLock_POLDoesNotUnlock(t *testing.T) {
ensurePrevote(t, voteCh, height, round)
validatePrevote(ctx, t, cs1, round, vss[0], nil)
signAddVotes(ctx, t, cs1, tmproto.PrevoteType, config.ChainID(), types.BlockID{}, vs2, vs3, vs4)
signAddVotes(ctx, t, cs1, tmproto.PrevoteType, factory.DefaultTestChainID, types.BlockID{}, vs2, vs3, vs4)
ensurePrecommit(t, voteCh, height, round)
@@ -1189,14 +1189,14 @@ func TestStateLock_MissingProposalWhenPOLSeenDoesNotUpdateLock(t *testing.T) {
ensurePrevote(t, voteCh, height, round) // prevote
signAddVotes(ctx, t, cs1, tmproto.PrevoteType, config.ChainID(), firstBlockID, vs2, vs3, vs4)
signAddVotes(ctx, t, cs1, tmproto.PrevoteType, factory.DefaultTestChainID, firstBlockID, vs2, vs3, vs4)
ensurePrecommit(t, voteCh, height, round) // our precommit
// the proposed block should now be locked and our precommit added
validatePrecommit(ctx, t, cs1, round, round, vss[0], firstBlockID.Hash, firstBlockID.Hash)
// add precommits from the rest
signAddVotes(ctx, t, cs1, tmproto.PrecommitType, config.ChainID(), types.BlockID{}, vs2, vs3, vs4)
signAddVotes(ctx, t, cs1, tmproto.PrecommitType, factory.DefaultTestChainID, types.BlockID{}, vs2, vs3, vs4)
// timeout to new round
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.voteTimeout(round).Nanoseconds())
@@ -1229,7 +1229,7 @@ func TestStateLock_MissingProposalWhenPOLSeenDoesNotUpdateLock(t *testing.T) {
ensurePrevoteMatch(t, voteCh, height, round, nil)
// now lets add prevotes from everyone else for the new block
signAddVotes(ctx, t, cs1, tmproto.PrevoteType, config.ChainID(), secondBlockID, vs2, vs3, vs4)
signAddVotes(ctx, t, cs1, tmproto.PrevoteType, factory.DefaultTestChainID, secondBlockID, vs2, vs3, vs4)
ensurePrecommit(t, voteCh, height, round)
validatePrecommit(ctx, t, cs1, round, 0, vss[0], nil, firstBlockID.Hash)
@@ -1275,13 +1275,13 @@ func TestStateLock_DoesNotLockOnOldProposal(t *testing.T) {
ensurePrevote(t, voteCh, height, round)
signAddVotes(ctx, t, cs1, tmproto.PrevoteType, config.ChainID(), types.BlockID{}, vs2, vs3, vs4)
signAddVotes(ctx, t, cs1, tmproto.PrevoteType, factory.DefaultTestChainID, types.BlockID{}, vs2, vs3, vs4)
// The proposed block should not have been locked.
ensurePrecommit(t, voteCh, height, round)
validatePrecommit(ctx, t, cs1, round, -1, vss[0], nil, nil)
signAddVotes(ctx, t, cs1, tmproto.PrecommitType, config.ChainID(), types.BlockID{}, vs2, vs3, vs4)
signAddVotes(ctx, t, cs1, tmproto.PrecommitType, factory.DefaultTestChainID, types.BlockID{}, vs2, vs3, vs4)
incrementRound(vs2, vs3, vs4)
@@ -1303,7 +1303,7 @@ func TestStateLock_DoesNotLockOnOldProposal(t *testing.T) {
validatePrevote(ctx, t, cs1, round, vss[0], nil) // All validators prevote for the old block.
// All validators prevote for the old block.
signAddVotes(ctx, t, cs1, tmproto.PrevoteType, config.ChainID(), firstBlockID, vs2, vs3, vs4)
signAddVotes(ctx, t, cs1, tmproto.PrevoteType, factory.DefaultTestChainID, firstBlockID, vs2, vs3, vs4)
// Make sure that cs1 did not lock on the block since it did not receive a proposal for it.
ensurePrecommit(t, voteCh, height, round)
@@ -1348,12 +1348,12 @@ func TestStateLock_POLSafety1(t *testing.T) {
require.NoError(t, err)
blockID := types.BlockID{Hash: propBlock.Hash(), PartSetHeader: partSet.Header()}
// the others sign a polka but we don't see it
prevotes := signVotes(ctx, t, tmproto.PrevoteType, config.ChainID(),
prevotes := signVotes(ctx, t, tmproto.PrevoteType, factory.DefaultTestChainID,
blockID,
vs2, vs3, vs4)
// we do see them precommit nil
signAddVotes(ctx, t, cs1, tmproto.PrecommitType, config.ChainID(), types.BlockID{}, vs2, vs3, vs4)
signAddVotes(ctx, t, cs1, tmproto.PrecommitType, factory.DefaultTestChainID, types.BlockID{}, vs2, vs3, vs4)
// cs1 precommit nil
ensurePrecommit(t, voteCh, height, round)
@@ -1390,13 +1390,13 @@ func TestStateLock_POLSafety1(t *testing.T) {
ensurePrevoteMatch(t, voteCh, height, round, r2BlockID.Hash)
// now we see the others prevote for it, so we should lock on it
signAddVotes(ctx, t, cs1, tmproto.PrevoteType, config.ChainID(), r2BlockID, vs2, vs3, vs4)
signAddVotes(ctx, t, cs1, tmproto.PrevoteType, factory.DefaultTestChainID, r2BlockID, vs2, vs3, vs4)
ensurePrecommit(t, voteCh, height, round)
// we should have precommitted
validatePrecommit(ctx, t, cs1, round, round, vss[0], r2BlockID.Hash, r2BlockID.Hash)
signAddVotes(ctx, t, cs1, tmproto.PrecommitType, config.ChainID(), types.BlockID{}, vs2, vs3, vs4)
signAddVotes(ctx, t, cs1, tmproto.PrecommitType, factory.DefaultTestChainID, types.BlockID{}, vs2, vs3, vs4)
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.voteTimeout(round).Nanoseconds())
@@ -1459,7 +1459,7 @@ func TestStateLock_POLSafety2(t *testing.T) {
propBlockID0 := types.BlockID{Hash: propBlockHash0, PartSetHeader: propBlockParts0.Header()}
// the others sign a polka but we don't see it
prevotes := signVotes(ctx, t, tmproto.PrevoteType, config.ChainID(), propBlockID0, vs2, vs3, vs4)
prevotes := signVotes(ctx, t, tmproto.PrevoteType, factory.DefaultTestChainID, propBlockID0, vs2, vs3, vs4)
// the block for round 1
prop1, propBlock1 := decideProposal(ctx, t, cs1, vs2, vs2.Height, vs2.Round+1)
@@ -1481,15 +1481,15 @@ func TestStateLock_POLSafety2(t *testing.T) {
ensurePrevoteMatch(t, voteCh, height, round, propBlockID1.Hash)
signAddVotes(ctx, t, cs1, tmproto.PrevoteType, config.ChainID(), propBlockID1, vs2, vs3, vs4)
signAddVotes(ctx, t, cs1, tmproto.PrevoteType, factory.DefaultTestChainID, propBlockID1, vs2, vs3, vs4)
ensurePrecommit(t, voteCh, height, round)
// the proposed block should now be locked and our precommit added
validatePrecommit(ctx, t, cs1, round, round, vss[0], propBlockID1.Hash, propBlockID1.Hash)
// add precommits from the rest
signAddVotes(ctx, t, cs1, tmproto.PrecommitType, config.ChainID(), types.BlockID{}, vs2, vs4)
signAddVotes(ctx, t, cs1, tmproto.PrecommitType, config.ChainID(), propBlockID1, vs3)
signAddVotes(ctx, t, cs1, tmproto.PrecommitType, factory.DefaultTestChainID, types.BlockID{}, vs2, vs4)
signAddVotes(ctx, t, cs1, tmproto.PrecommitType, factory.DefaultTestChainID, propBlockID1, vs3)
incrementRound(vs2, vs3, vs4)
@@ -1500,7 +1500,7 @@ func TestStateLock_POLSafety2(t *testing.T) {
// in round 2 we see the polkad block from round 0
newProp := types.NewProposal(height, round, 0, propBlockID0, propBlock0.Header.Time)
p := newProp.ToProto()
err = vs3.SignProposal(ctx, config.ChainID(), p)
err = vs3.SignProposal(ctx, factory.DefaultTestChainID, p)
require.NoError(t, err)
newProp.Signature = p.Signature
@@ -1568,7 +1568,7 @@ func TestState_PrevotePOLFromPreviousRound(t *testing.T) {
ensurePrevote(t, voteCh, height, round)
signAddVotes(ctx, t, cs1, tmproto.PrevoteType, config.ChainID(), r0BlockID, vs2, vs3, vs4)
signAddVotes(ctx, t, cs1, tmproto.PrevoteType, factory.DefaultTestChainID, r0BlockID, vs2, vs3, vs4)
// check that the validator generates a Lock event.
ensureLock(t, lockCh, height, round)
@@ -1578,7 +1578,7 @@ func TestState_PrevotePOLFromPreviousRound(t *testing.T) {
validatePrecommit(ctx, t, cs1, round, round, vss[0], r0BlockID.Hash, r0BlockID.Hash)
// add precommits from the rest of the validators.
signAddVotes(ctx, t, cs1, tmproto.PrecommitType, config.ChainID(), types.BlockID{}, vs2, vs3, vs4)
signAddVotes(ctx, t, cs1, tmproto.PrecommitType, factory.DefaultTestChainID, types.BlockID{}, vs2, vs3, vs4)
// timeout to new round.
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.voteTimeout(round).Nanoseconds())
@@ -1612,12 +1612,12 @@ func TestState_PrevotePOLFromPreviousRound(t *testing.T) {
ensureNewRound(t, newRoundCh, height, round)
signAddVotes(ctx, t, cs1, tmproto.PrevoteType, config.ChainID(), r1BlockID, vs2, vs3, vs4)
signAddVotes(ctx, t, cs1, tmproto.PrevoteType, factory.DefaultTestChainID, r1BlockID, vs2, vs3, vs4)
ensurePrevote(t, voteCh, height, round)
validatePrevote(ctx, t, cs1, round, vss[0], nil)
signAddVotes(ctx, t, cs1, tmproto.PrecommitType, config.ChainID(), types.BlockID{}, vs2, vs3, vs4)
signAddVotes(ctx, t, cs1, tmproto.PrecommitType, factory.DefaultTestChainID, types.BlockID{}, vs2, vs3, vs4)
ensurePrecommit(t, voteCh, height, round)
@@ -1656,7 +1656,7 @@ func TestState_PrevotePOLFromPreviousRound(t *testing.T) {
ensurePrevote(t, voteCh, height, round)
validatePrevote(ctx, t, cs1, round, vss[0], r1BlockID.Hash)
signAddVotes(ctx, t, cs1, tmproto.PrevoteType, config.ChainID(), types.BlockID{}, vs2, vs3, vs4)
signAddVotes(ctx, t, cs1, tmproto.PrevoteType, factory.DefaultTestChainID, types.BlockID{}, vs2, vs3, vs4)
// cs1 did not receive a POL within this round, so it should remain locked
// on the block from round 0.
@@ -1706,14 +1706,14 @@ func TestProposeValidBlock(t *testing.T) {
ensurePrevoteMatch(t, voteCh, height, round, blockID.Hash)
// the others sign a polka
signAddVotes(ctx, t, cs1, tmproto.PrevoteType, config.ChainID(), blockID, vs2, vs3, vs4)
signAddVotes(ctx, t, cs1, tmproto.PrevoteType, factory.DefaultTestChainID, blockID, vs2, vs3, vs4)
ensurePrecommit(t, voteCh, height, round)
// we should have precommitted the proposed block in this round.
validatePrecommit(ctx, t, cs1, round, round, vss[0], blockID.Hash, blockID.Hash)
signAddVotes(ctx, t, cs1, tmproto.PrecommitType, config.ChainID(), types.BlockID{}, vs2, vs3, vs4)
signAddVotes(ctx, t, cs1, tmproto.PrecommitType, factory.DefaultTestChainID, types.BlockID{}, vs2, vs3, vs4)
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.voteTimeout(round).Nanoseconds())
@@ -1728,7 +1728,7 @@ func TestProposeValidBlock(t *testing.T) {
// We did not see a valid proposal within this round, so prevote nil.
ensurePrevoteMatch(t, voteCh, height, round, nil)
signAddVotes(ctx, t, cs1, tmproto.PrecommitType, config.ChainID(), types.BlockID{}, vs2, vs3, vs4)
signAddVotes(ctx, t, cs1, tmproto.PrecommitType, factory.DefaultTestChainID, types.BlockID{}, vs2, vs3, vs4)
ensurePrecommit(t, voteCh, height, round)
// we should have precommitted nil during this round because we received
@@ -1738,7 +1738,7 @@ func TestProposeValidBlock(t *testing.T) {
incrementRound(vs2, vs3, vs4)
incrementRound(vs2, vs3, vs4)
signAddVotes(ctx, t, cs1, tmproto.PrecommitType, config.ChainID(), types.BlockID{}, vs2, vs3, vs4)
signAddVotes(ctx, t, cs1, tmproto.PrecommitType, factory.DefaultTestChainID, types.BlockID{}, vs2, vs3, vs4)
round += 2 // increment by multiple rounds
@@ -1798,10 +1798,10 @@ func TestSetValidBlockOnDelayedPrevote(t *testing.T) {
ensurePrevoteMatch(t, voteCh, height, round, blockID.Hash)
// vs2 send prevote for propBlock
signAddVotes(ctx, t, cs1, tmproto.PrevoteType, config.ChainID(), blockID, vs2)
signAddVotes(ctx, t, cs1, tmproto.PrevoteType, factory.DefaultTestChainID, blockID, vs2)
// vs3 send prevote nil
signAddVotes(ctx, t, cs1, tmproto.PrevoteType, config.ChainID(), types.BlockID{}, vs3)
signAddVotes(ctx, t, cs1, tmproto.PrevoteType, factory.DefaultTestChainID, types.BlockID{}, vs3)
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.voteTimeout(round).Nanoseconds())
@@ -1816,7 +1816,7 @@ func TestSetValidBlockOnDelayedPrevote(t *testing.T) {
assert.True(t, rs.ValidRound == -1)
// vs2 send (delayed) prevote for propBlock
signAddVotes(ctx, t, cs1, tmproto.PrevoteType, config.ChainID(), blockID, vs4)
signAddVotes(ctx, t, cs1, tmproto.PrevoteType, factory.DefaultTestChainID, blockID, vs4)
ensureNewValidBlock(t, validBlockCh, height, round)
@@ -1870,7 +1870,7 @@ func TestSetValidBlockOnDelayedProposal(t *testing.T) {
}
// vs2, vs3 and vs4 send prevote for propBlock
signAddVotes(ctx, t, cs1, tmproto.PrevoteType, config.ChainID(), blockID, vs2, vs3, vs4)
signAddVotes(ctx, t, cs1, tmproto.PrevoteType, factory.DefaultTestChainID, blockID, vs2, vs3, vs4)
ensureNewValidBlock(t, validBlockCh, height, round)
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.voteTimeout(round).Nanoseconds())
@@ -2010,10 +2010,10 @@ func TestFinalizeBlockCalled(t *testing.T) {
}
}
signAddVotes(ctx, t, cs1, tmproto.PrevoteType, config.ChainID(), blockID, vss[1:]...)
signAddVotes(ctx, t, cs1, tmproto.PrevoteType, factory.DefaultTestChainID, blockID, vss[1:]...)
ensurePrevoteMatch(t, voteCh, height, round, rs.ProposalBlock.Hash())
signAddVotes(ctx, t, cs1, tmproto.PrecommitType, config.ChainID(), blockID, vss[1:]...)
signAddVotes(ctx, t, cs1, tmproto.PrecommitType, factory.DefaultTestChainID, blockID, vss[1:]...)
ensurePrecommit(t, voteCh, height, round)
ensureNewRound(t, newRoundCh, nextHeight, nextRound)
@@ -2089,7 +2089,7 @@ func TestExtendVoteCalledWhenEnabled(t *testing.T) {
Hash: rs.ProposalBlock.Hash(),
PartSetHeader: rs.ProposalBlockParts.Header(),
}
signAddVotes(ctx, t, cs1, tmproto.PrevoteType, config.ChainID(), blockID, vss[1:]...)
signAddVotes(ctx, t, cs1, tmproto.PrevoteType, factory.DefaultTestChainID, blockID, vss[1:]...)
ensurePrevoteMatch(t, voteCh, height, round, blockID.Hash)
ensurePrecommit(t, voteCh, height, round)
@@ -2103,7 +2103,7 @@ func TestExtendVoteCalledWhenEnabled(t *testing.T) {
m.AssertNotCalled(t, "ExtendVote", mock.Anything, mock.Anything)
}
signAddVotes(ctx, t, cs1, tmproto.PrecommitType, config.ChainID(), blockID, vss[1:]...)
signAddVotes(ctx, t, cs1, tmproto.PrecommitType, factory.DefaultTestChainID, blockID, vss[1:]...)
ensureNewRound(t, newRoundCh, height+1, 0)
m.AssertExpectations(t)
@@ -2166,7 +2166,7 @@ func TestVerifyVoteExtensionNotCalledOnAbsentPrecommit(t *testing.T) {
Hash: rs.ProposalBlock.Hash(),
PartSetHeader: rs.ProposalBlockParts.Header(),
}
signAddVotes(ctx, t, cs1, tmproto.PrevoteType, config.ChainID(), blockID, vss...)
signAddVotes(ctx, t, cs1, tmproto.PrevoteType, factory.DefaultTestChainID, blockID, vss...)
ensurePrevoteMatch(t, voteCh, height, round, blockID.Hash)
ensurePrecommit(t, voteCh, height, round)
@@ -2177,7 +2177,7 @@ func TestVerifyVoteExtensionNotCalledOnAbsentPrecommit(t *testing.T) {
})
m.On("Commit", mock.Anything).Return(&abci.ResponseCommit{}, nil).Maybe()
signAddVotes(ctx, t, cs1, tmproto.PrecommitType, config.ChainID(), blockID, vss[2:]...)
signAddVotes(ctx, t, cs1, tmproto.PrecommitType, factory.DefaultTestChainID, blockID, vss[2:]...)
ensureNewRound(t, newRoundCh, height+1, 0)
m.AssertExpectations(t)
@@ -2254,11 +2254,11 @@ func TestPrepareProposalReceivesVoteExtensions(t *testing.T) {
Hash: rs.ProposalBlock.Hash(),
PartSetHeader: rs.ProposalBlockParts.Header(),
}
signAddVotes(ctx, t, cs1, tmproto.PrevoteType, config.ChainID(), blockID, vss[1:]...)
signAddVotes(ctx, t, cs1, tmproto.PrevoteType, factory.DefaultTestChainID, blockID, vss[1:]...)
// create a precommit for each validator with the associated vote extension.
for i, vs := range vss[1:] {
signAddPrecommitWithExtension(ctx, t, cs1, config.ChainID(), blockID, voteExtensions[i+1], vs)
signAddPrecommitWithExtension(ctx, t, cs1, factory.DefaultTestChainID, blockID, voteExtensions[i+1], vs)
}
ensurePrevote(t, voteCh, height, round)
@@ -2275,7 +2275,7 @@ func TestPrepareProposalReceivesVoteExtensions(t *testing.T) {
incrementRound(vss[1:]...)
round = 3
signAddVotes(ctx, t, cs1, tmproto.PrecommitType, config.ChainID(), types.BlockID{}, vss[1:]...)
signAddVotes(ctx, t, cs1, tmproto.PrecommitType, factory.DefaultTestChainID, types.BlockID{}, vss[1:]...)
ensureNewRound(t, newRoundCh, height, round)
ensureNewProposal(t, proposalCh, height, round)
@@ -2387,7 +2387,7 @@ func TestVoteExtensionEnableHeight(t *testing.T) {
}
// sign all of the votes
signAddVotes(ctx, t, cs1, tmproto.PrevoteType, config.ChainID(), blockID, vss[1:]...)
signAddVotes(ctx, t, cs1, tmproto.PrevoteType, factory.DefaultTestChainID, blockID, vss[1:]...)
ensurePrevoteMatch(t, voteCh, height, round, rs.ProposalBlock.Hash())
var ext []byte
@@ -2396,7 +2396,7 @@ func TestVoteExtensionEnableHeight(t *testing.T) {
}
for _, vs := range vss[1:] {
vote, err := vs.signVote(ctx, tmproto.PrecommitType, config.ChainID(), blockID, ext)
vote, err := vs.signVote(ctx, tmproto.PrecommitType, factory.DefaultTestChainID, blockID, ext)
if !testCase.hasExtension {
vote.ExtensionSignature = nil
}
@@ -2435,7 +2435,7 @@ func TestWaitingTimeoutOnNilPolka(t *testing.T) {
startTestRound(ctx, cs1, height, round)
ensureNewRound(t, newRoundCh, height, round)
signAddVotes(ctx, t, cs1, tmproto.PrecommitType, config.ChainID(), types.BlockID{}, vs2, vs3, vs4)
signAddVotes(ctx, t, cs1, tmproto.PrecommitType, factory.DefaultTestChainID, types.BlockID{}, vs2, vs3, vs4)
ensureNewTimeout(t, timeoutWaitCh, height, round, cs1.voteTimeout(round).Nanoseconds())
ensureNewRound(t, newRoundCh, height, round+1)
@@ -2467,7 +2467,7 @@ func TestWaitingTimeoutProposeOnNewRound(t *testing.T) {
ensurePrevote(t, voteCh, height, round)
incrementRound(vss[1:]...)
signAddVotes(ctx, t, cs1, tmproto.PrevoteType, config.ChainID(), types.BlockID{}, vs2, vs3, vs4)
signAddVotes(ctx, t, cs1, tmproto.PrevoteType, factory.DefaultTestChainID, types.BlockID{}, vs2, vs3, vs4)
round++ // moving to the next round
ensureNewRound(t, newRoundCh, height, round)
@@ -2506,7 +2506,7 @@ func TestRoundSkipOnNilPolkaFromHigherRound(t *testing.T) {
ensurePrevote(t, voteCh, height, round)
incrementRound(vss[1:]...)
signAddVotes(ctx, t, cs1, tmproto.PrecommitType, config.ChainID(), types.BlockID{}, vs2, vs3, vs4)
signAddVotes(ctx, t, cs1, tmproto.PrecommitType, factory.DefaultTestChainID, types.BlockID{}, vs2, vs3, vs4)
round++ // moving to the next round
ensureNewRound(t, newRoundCh, height, round)
@@ -2544,7 +2544,7 @@ func TestWaitTimeoutProposeOnNilPolkaForTheCurrentRound(t *testing.T) {
ensureNewRound(t, newRoundCh, height, round)
incrementRound(vss[1:]...)
signAddVotes(ctx, t, cs1, tmproto.PrevoteType, config.ChainID(), types.BlockID{}, vs2, vs3, vs4)
signAddVotes(ctx, t, cs1, tmproto.PrevoteType, factory.DefaultTestChainID, types.BlockID{}, vs2, vs3, vs4)
ensureNewTimeout(t, timeoutProposeCh, height, round, cs1.proposeTimeout(round).Nanoseconds())
@@ -2582,7 +2582,7 @@ func TestEmitNewValidBlockEventOnCommitWithoutBlock(t *testing.T) {
ensureNewRound(t, newRoundCh, height, round)
// vs2, vs3 and vs4 send precommit for propBlock
signAddVotes(ctx, t, cs1, tmproto.PrecommitType, config.ChainID(), blockID, vs2, vs3, vs4)
signAddVotes(ctx, t, cs1, tmproto.PrecommitType, factory.DefaultTestChainID, blockID, vs2, vs3, vs4)
ensureNewValidBlock(t, validBlockCh, height, round)
rs := cs1.GetRoundState()
@@ -2623,7 +2623,7 @@ func TestCommitFromPreviousRound(t *testing.T) {
ensureNewRound(t, newRoundCh, height, round)
// vs2, vs3 and vs4 send precommit for propBlock for the previous round
signAddVotes(ctx, t, cs1, tmproto.PrecommitType, config.ChainID(), blockID, vs2, vs3, vs4)
signAddVotes(ctx, t, cs1, tmproto.PrecommitType, factory.DefaultTestChainID, blockID, vs2, vs3, vs4)
ensureNewValidBlock(t, validBlockCh, height, round)
@@ -2692,15 +2692,15 @@ func TestStartNextHeightCorrectlyAfterTimeout(t *testing.T) {
ensurePrevoteMatch(t, voteCh, height, round, blockID.Hash)
signAddVotes(ctx, t, cs1, tmproto.PrevoteType, config.ChainID(), blockID, vs2, vs3, vs4)
signAddVotes(ctx, t, cs1, tmproto.PrevoteType, factory.DefaultTestChainID, blockID, vs2, vs3, vs4)
ensurePrecommit(t, voteCh, height, round)
// the proposed block should now be locked and our precommit added
validatePrecommit(ctx, t, cs1, round, round, vss[0], blockID.Hash, blockID.Hash)
// add precommits
signAddVotes(ctx, t, cs1, tmproto.PrecommitType, config.ChainID(), types.BlockID{}, vs2)
signAddVotes(ctx, t, cs1, tmproto.PrecommitType, config.ChainID(), blockID, vs3)
signAddVotes(ctx, t, cs1, tmproto.PrecommitType, factory.DefaultTestChainID, types.BlockID{}, vs2)
signAddVotes(ctx, t, cs1, tmproto.PrecommitType, factory.DefaultTestChainID, blockID, vs3)
// wait till timeout occurs
ensureNewTimeout(t, precommitTimeoutCh, height, round, cs1.voteTimeout(round).Nanoseconds())
@@ -2708,7 +2708,7 @@ func TestStartNextHeightCorrectlyAfterTimeout(t *testing.T) {
ensureNewRound(t, newRoundCh, height, round+1)
// majority is now reached
signAddVotes(ctx, t, cs1, tmproto.PrecommitType, config.ChainID(), blockID, vs4)
signAddVotes(ctx, t, cs1, tmproto.PrecommitType, factory.DefaultTestChainID, blockID, vs4)
ensureNewBlockHeader(t, newBlockHeader, height, blockID.Hash)
@@ -2757,15 +2757,15 @@ func TestResetTimeoutPrecommitUponNewHeight(t *testing.T) {
ensurePrevoteMatch(t, voteCh, height, round, blockID.Hash)
signAddVotes(ctx, t, cs1, tmproto.PrevoteType, config.ChainID(), blockID, vs2, vs3, vs4)
signAddVotes(ctx, t, cs1, tmproto.PrevoteType, factory.DefaultTestChainID, blockID, vs2, vs3, vs4)
ensurePrecommit(t, voteCh, height, round)
validatePrecommit(ctx, t, cs1, round, round, vss[0], blockID.Hash, blockID.Hash)
// add precommits
signAddVotes(ctx, t, cs1, tmproto.PrecommitType, config.ChainID(), types.BlockID{}, vs2)
signAddVotes(ctx, t, cs1, tmproto.PrecommitType, config.ChainID(), blockID, vs3)
signAddVotes(ctx, t, cs1, tmproto.PrecommitType, config.ChainID(), blockID, vs4)
signAddVotes(ctx, t, cs1, tmproto.PrecommitType, factory.DefaultTestChainID, types.BlockID{}, vs2)
signAddVotes(ctx, t, cs1, tmproto.PrecommitType, factory.DefaultTestChainID, blockID, vs3)
signAddVotes(ctx, t, cs1, tmproto.PrecommitType, factory.DefaultTestChainID, blockID, vs4)
ensureNewBlockHeader(t, newBlockHeader, height, blockID.Hash)
@@ -2827,17 +2827,17 @@ func TestStateHalt1(t *testing.T) {
ensurePrevote(t, voteCh, height, round)
signAddVotes(ctx, t, cs1, tmproto.PrevoteType, config.ChainID(), blockID, vs2, vs3, vs4)
signAddVotes(ctx, t, cs1, tmproto.PrevoteType, factory.DefaultTestChainID, blockID, vs2, vs3, vs4)
ensurePrecommit(t, voteCh, height, round)
// the proposed block should now be locked and our precommit added
validatePrecommit(ctx, t, cs1, round, round, vss[0], propBlock.Hash(), propBlock.Hash())
// add precommits from the rest
signAddVotes(ctx, t, cs1, tmproto.PrecommitType, config.ChainID(), types.BlockID{}, vs2) // didnt receive proposal
signAddVotes(ctx, t, cs1, tmproto.PrecommitType, config.ChainID(), blockID, vs3)
signAddVotes(ctx, t, cs1, tmproto.PrecommitType, factory.DefaultTestChainID, types.BlockID{}, vs2) // didnt receive proposal
signAddVotes(ctx, t, cs1, tmproto.PrecommitType, factory.DefaultTestChainID, blockID, vs3)
// we receive this later, but vs3 might receive it earlier and with ours will go to commit!
precommit4 := signVote(ctx, t, vs4, tmproto.PrecommitType, config.ChainID(), blockID)
precommit4 := signVote(ctx, t, vs4, tmproto.PrecommitType, factory.DefaultTestChainID, blockID)
incrementRound(vs2, vs3, vs4)
@@ -2928,7 +2928,7 @@ func TestStateOutputVoteStats(t *testing.T) {
Hash: randBytes,
}
vote := signVote(ctx, t, vss[1], tmproto.PrecommitType, config.ChainID(), blockID)
vote := signVote(ctx, t, vss[1], tmproto.PrecommitType, factory.DefaultTestChainID, blockID)
voteMessage := &VoteMessage{vote}
cs.handleMsg(ctx, msgInfo{voteMessage, peerID, tmtime.Now()})
@@ -2942,7 +2942,7 @@ func TestStateOutputVoteStats(t *testing.T) {
// sending the vote for the bigger height
incrementHeight(vss[1])
vote = signVote(ctx, t, vss[1], tmproto.PrecommitType, config.ChainID(), blockID)
vote = signVote(ctx, t, vss[1], tmproto.PrecommitType, factory.DefaultTestChainID, blockID)
cs.handleMsg(ctx, msgInfo{&VoteMessage{vote}, peerID, tmtime.Now()})
@@ -2968,7 +2968,7 @@ func TestSignSameVoteTwice(t *testing.T) {
t,
vss[1],
tmproto.PrecommitType,
config.ChainID(),
factory.DefaultTestChainID,
types.BlockID{
Hash: randBytes,
@@ -2980,7 +2980,7 @@ func TestSignSameVoteTwice(t *testing.T) {
t,
vss[1],
tmproto.PrecommitType,
config.ChainID(),
factory.DefaultTestChainID,
types.BlockID{
Hash: randBytes,
@@ -3021,7 +3021,7 @@ func TestStateTimestamp_ProposalNotMatch(t *testing.T) {
// Create a proposal with a timestamp that does not match the timestamp of the block.
proposal := types.NewProposal(vs2.Height, round, -1, blockID, propBlock.Header.Time.Add(time.Millisecond))
p := proposal.ToProto()
err = vs2.SignProposal(ctx, config.ChainID(), p)
err = vs2.SignProposal(ctx, factory.DefaultTestChainID, p)
require.NoError(t, err)
proposal.Signature = p.Signature
require.NoError(t, cs1.SetProposalAndBlock(ctx, proposal, propBlock, propBlockParts, "some peer"))
@@ -3029,7 +3029,7 @@ func TestStateTimestamp_ProposalNotMatch(t *testing.T) {
startTestRound(ctx, cs1, height, round)
ensureProposal(t, proposalCh, height, round, blockID)
signAddVotes(ctx, t, cs1, tmproto.PrevoteType, config.ChainID(), blockID, vs2, vs3, vs4)
signAddVotes(ctx, t, cs1, tmproto.PrevoteType, factory.DefaultTestChainID, blockID, vs2, vs3, vs4)
// ensure that the validator prevotes nil.
ensurePrevote(t, voteCh, height, round)
@@ -3069,7 +3069,7 @@ func TestStateTimestamp_ProposalMatch(t *testing.T) {
// Create a proposal with a timestamp that matches the timestamp of the block.
proposal := types.NewProposal(vs2.Height, round, -1, blockID, propBlock.Header.Time)
p := proposal.ToProto()
err = vs2.SignProposal(ctx, config.ChainID(), p)
err = vs2.SignProposal(ctx, factory.DefaultTestChainID, p)
require.NoError(t, err)
proposal.Signature = p.Signature
require.NoError(t, cs1.SetProposalAndBlock(ctx, proposal, propBlock, propBlockParts, "some peer"))
@@ -3077,7 +3077,7 @@ func TestStateTimestamp_ProposalMatch(t *testing.T) {
startTestRound(ctx, cs1, height, round)
ensureProposal(t, proposalCh, height, round, blockID)
signAddVotes(ctx, t, cs1, tmproto.PrevoteType, config.ChainID(), blockID, vs2, vs3, vs4)
signAddVotes(ctx, t, cs1, tmproto.PrevoteType, factory.DefaultTestChainID, blockID, vs2, vs3, vs4)
// ensure that the validator prevotes the block.
ensurePrevote(t, voteCh, height, round)
@@ -6,7 +6,6 @@ import (
"github.com/stretchr/testify/require"
"github.com/tendermint/tendermint/config"
"github.com/tendermint/tendermint/crypto"
"github.com/tendermint/tendermint/internal/test/factory"
tmrand "github.com/tendermint/tendermint/libs/rand"
@@ -16,17 +15,12 @@ import (
)
func TestPeerCatchupRounds(t *testing.T) {
cfg, err := config.ResetTestRoot(t.TempDir(), "consensus_height_vote_set_test")
if err != nil {
t.Fatal(err)
}
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
valSet, privVals := factory.ValidatorSet(ctx, t, 10, 1)
chainID := cfg.ChainID()
chainID := factory.DefaultTestChainID
hvs := NewExtendedHeightVoteSet(chainID, 1, valSet)
vote999_0 := makeVoteHR(ctx, t, 1, 0, 999, privVals, chainID)
+1 -1
View File
@@ -114,7 +114,7 @@ func TestDispatcherTimeOutWaitingOnLightBlock(t *testing.T) {
func TestDispatcherProviders(t *testing.T) {
t.Cleanup(leaktest.Check(t))
chainID := "test-chain"
chainID := factory.DefaultTestChainID
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
+1 -1
View File
@@ -12,7 +12,7 @@ import (
)
const (
DefaultTestChainID = "test-chain"
DefaultTestChainID = "test_chain"
)
var (
+2 -3
View File
@@ -3,12 +3,11 @@ package factory
import (
"time"
cfg "github.com/tendermint/tendermint/config"
"github.com/tendermint/tendermint/types"
)
func GenesisDoc(
config *cfg.Config,
chainID string,
time time.Time,
validators []*types.Validator,
consensusParams *types.ConsensusParams,
@@ -26,7 +25,7 @@ func GenesisDoc(
return &types.GenesisDoc{
GenesisTime: time,
InitialHeight: 1,
ChainID: config.ChainID(),
ChainID: chainID,
Validators: genesisValidators,
ConsensusParams: consensusParams,
}