Compare commits

...

4 Commits

Author SHA1 Message Date
Ethan Buchman
90eda9bfb6 changelog and version 2018-10-17 22:11:19 -04:00
Alessio Treglia
1ad379aa87 Update CHANGELOG_PENDING.md 2018-10-17 18:57:37 -07:00
Anton Kaliaev
72201676b2 set next validators along with validators while replay (#2637)
Closes #2634
2018-10-17 18:54:38 -07:00
Alessio Treglia
adf8cea09e Pass nil to NewValidatorSet() when genesis file's Validators field is nil (#2617)
Closes: #2616
2018-10-17 18:54:07 -07:00
5 changed files with 46 additions and 15 deletions

View File

@@ -1,5 +1,14 @@
# Changelog # Changelog
## v0.25.1
*October 17, 2018*
BUG FIXES:
- [state] [\#2616](https://github.com/tendermint/tendermint/issues/2616) Fix panic when genesis file's `validators` field is nil
- [consensus] [\#2634](https://github.com/tendermint/tendermint/issues/2634) Set `NextValidators` during replay
## v0.25.0 ## v0.25.0
*September 22, 2018* *September 22, 2018*
@@ -164,8 +173,8 @@ BUG FIXES:
*August 22nd, 2018* *August 22nd, 2018*
BUG FIXES: BUG FIXES:
- [libs/autofile] \#2261 Fix log rotation so it actually happens. - [libs/autofile] [\#2261](https://github.com/tendermint/tendermint/issues/2261) Fix log rotation so it actually happens.
- Fixes issues with consensus WAL growing unbounded ala \#2259 - Fixes issues with consensus WAL growing unbounded ala [\#2259](https://github.com/tendermint/tendermint/issues/2259)
## 0.23.0 ## 0.23.0

View File

@@ -287,6 +287,7 @@ func (h *Handshaker) ReplayBlocks(state sm.State, appHash []byte, appBlockHeight
return nil, err return nil, err
} }
state.Validators = types.NewValidatorSet(vals) state.Validators = types.NewValidatorSet(vals)
state.NextValidators = types.NewValidatorSet(vals)
} }
if res.ConsensusParams != nil { if res.ConsensusParams != nil {
state.ConsensusParams = types.PB2TM.ConsensusParams(res.ConsensusParams) state.ConsensusParams = types.PB2TM.ConsensusParams(res.ConsensusParams)

View File

@@ -198,17 +198,25 @@ func MakeGenesisState(genDoc *types.GenesisDoc) (State, error) {
} }
// Make validators slice // Make validators slice
validators := make([]*types.Validator, len(genDoc.Validators)) var validatorSet, nextValidatorSet *types.ValidatorSet
for i, val := range genDoc.Validators { if genDoc.Validators == nil {
pubKey := val.PubKey validatorSet = types.NewValidatorSet(nil)
address := pubKey.Address() nextValidatorSet = types.NewValidatorSet(nil)
} else {
validators := make([]*types.Validator, len(genDoc.Validators))
for i, val := range genDoc.Validators {
pubKey := val.PubKey
address := pubKey.Address()
// Make validator // Make validator
validators[i] = &types.Validator{ validators[i] = &types.Validator{
Address: address, Address: address,
PubKey: pubKey, PubKey: pubKey,
VotingPower: val.Power, VotingPower: val.Power,
}
} }
validatorSet = types.NewValidatorSet(validators)
nextValidatorSet = types.NewValidatorSet(validators).CopyIncrementAccum(1)
} }
return State{ return State{
@@ -219,8 +227,8 @@ func MakeGenesisState(genDoc *types.GenesisDoc) (State, error) {
LastBlockID: types.BlockID{}, LastBlockID: types.BlockID{},
LastBlockTime: genDoc.GenesisTime, LastBlockTime: genDoc.GenesisTime,
NextValidators: types.NewValidatorSet(validators).CopyIncrementAccum(1), NextValidators: nextValidatorSet,
Validators: types.NewValidatorSet(validators), Validators: validatorSet,
LastValidators: types.NewValidatorSet(nil), LastValidators: types.NewValidatorSet(nil),
LastHeightValidatorsChanged: 1, LastHeightValidatorsChanged: 1,

View File

@@ -48,6 +48,19 @@ func TestStateCopy(t *testing.T) {
%v`, state)) %v`, state))
} }
//TestMakeGenesisStateNilValidators tests state's consistency when genesis file's validators field is nil.
func TestMakeGenesisStateNilValidators(t *testing.T) {
doc := types.GenesisDoc{
ChainID: "dummy",
Validators: nil,
}
require.Nil(t, doc.ValidateAndComplete())
state, err := MakeGenesisState(&doc)
require.Nil(t, err)
require.Equal(t, 0, len(state.Validators.Validators))
require.Equal(t, 0, len(state.NextValidators.Validators))
}
// TestStateSaveLoad tests saving and loading State from a db. // TestStateSaveLoad tests saving and loading State from a db.
func TestStateSaveLoad(t *testing.T) { func TestStateSaveLoad(t *testing.T) {
tearDown, stateDB, state := setupTestCase(t) tearDown, stateDB, state := setupTestCase(t)

View File

@@ -4,13 +4,13 @@ package version
const ( const (
Maj = "0" Maj = "0"
Min = "25" Min = "25"
Fix = "0" Fix = "1"
) )
var ( var (
// Version is the current version of Tendermint // Version is the current version of Tendermint
// Must be a string because scripts like dist.sh read this file. // Must be a string because scripts like dist.sh read this file.
Version = "0.25.0" Version = "0.25.1"
// GitCommit is the current HEAD set using ldflags. // GitCommit is the current HEAD set using ldflags.
GitCommit string GitCommit string