From 3a8bcf87b2fcb063ea6b9ce4aa2ed0dcb5883201 Mon Sep 17 00:00:00 2001 From: William Banfield Date: Tue, 15 Mar 2022 13:46:56 -0400 Subject: [PATCH] add updated validator set to node test --- internal/state/store.go | 1 + node/node_test.go | 10 ++++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/internal/state/store.go b/internal/state/store.go index d9a591f6a..51197b8f8 100644 --- a/internal/state/store.go +++ b/internal/state/store.go @@ -159,6 +159,7 @@ func (store dbStore) save(state State, key []byte) error { } } // Save next validators. + fmt.Println("saving validators for height ", nextHeight+1) err := store.saveValidatorsInfo(nextHeight+1, state.LastHeightValidatorsChanged, state.NextValidators, batch) if err != nil { return err diff --git a/node/node_test.go b/node/node_test.go index eeeb01008..c87b87950 100644 --- a/node/node_test.go +++ b/node/node_test.go @@ -442,7 +442,7 @@ func TestMaxProposalBlockSize(t *testing.T) { require.NoError(t, err) defer os.RemoveAll(cfg.RootDir) - logger := log.NewNopLogger() + logger := log.NewTestingLogger(t) cc := abciclient.NewLocalClient(logger, kvstore.NewApplication()) proxyApp := proxy.New(cc, logger, proxy.NopMetrics()) @@ -497,10 +497,16 @@ func TestMaxProposalBlockSize(t *testing.T) { }, } + // save the updated validator set for use by the block executor. + state.LastBlockHeight = math.MaxInt64 - 3 + state.LastHeightValidatorsChanged = math.MaxInt64 - 1 + state.NextValidators = state.Validators.Copy() + require.NoError(t, stateStore.Save(state)) + timestamp := time.Date(math.MaxInt64, 0, 0, 0, 0, 0, math.MaxInt64, time.UTC) // change state in order to produce the largest accepted header state.LastBlockID = blockID - state.LastBlockHeight = math.MaxInt64 - 1 + state.LastBlockHeight = math.MaxInt64 - 2 state.LastBlockTime = timestamp state.LastResultsHash = tmhash.Sum([]byte("last_results_hash")) state.AppHash = tmhash.Sum([]byte("app_hash"))