Browse Source

Merge pull request #2085 from tendermint/master

Merge 0.23.8 back into develop
pull/2107/head
Alexander Simmerl 7 years ago
committed by GitHub
parent
commit
4be6395ee0
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 104 additions and 25 deletions
  1. +17
    -0
      CHANGELOG.md
  2. +2
    -2
      blockchain/wire.go
  3. +46
    -0
      consensus/reactor_test.go
  4. +2
    -2
      consensus/types/wire.go
  5. +2
    -2
      consensus/wire.go
  6. +0
    -10
      evidence/wire.go
  7. +2
    -2
      lite/files/wire.go
  8. +1
    -3
      rpc/core/types/wire.go
  9. +20
    -1
      types/block_test.go
  10. +4
    -0
      types/evidence.go
  11. +6
    -1
      types/wire.go
  12. +2
    -2
      version/version.go

+ 17
- 0
CHANGELOG.md View File

@ -1,5 +1,22 @@
# Changelog
## 0.22.8
*July 26th, 2018*
BUG FIXES
- [consensus, blockchain] Fix 0.22.7 below.
## 0.22.7
*July 26th, 2018*
BUG FIXES
- [consensus, blockchain] Register the Evidence interface so it can be
marshalled/unmarshalled by the blockchain and consensus reactors
## 0.22.6
*July 24th, 2018*


+ 2
- 2
blockchain/wire.go View File

@ -2,12 +2,12 @@ package blockchain
import (
"github.com/tendermint/go-amino"
cryptoAmino "github.com/tendermint/tendermint/crypto/encoding/amino"
"github.com/tendermint/tendermint/types"
)
var cdc = amino.NewCodec()
func init() {
RegisterBlockchainMessages(cdc)
cryptoAmino.RegisterAmino(cdc)
types.RegisterBlockAmino(cdc)
}

+ 46
- 0
consensus/reactor_test.go View File

@ -13,6 +13,7 @@ import (
"github.com/tendermint/tendermint/abci/example/kvstore"
cmn "github.com/tendermint/tendermint/libs/common"
"github.com/tendermint/tendermint/libs/log"
sm "github.com/tendermint/tendermint/state"
cfg "github.com/tendermint/tendermint/config"
"github.com/tendermint/tendermint/p2p"
@ -91,6 +92,51 @@ func TestReactorBasic(t *testing.T) {
}, css)
}
// Ensure we can process blocks with evidence
func TestReactorWithEvidence(t *testing.T) {
N := 4
css := randConsensusNet(N, "consensus_reactor_test", newMockTickerFunc(true), newCounter)
evpool := mockEvidencePool{
t: t,
ev: []types.Evidence{types.NewMockGoodEvidence(1, 1, []byte("somone"))},
}
for i := 0; i < N; i++ {
css[i].evpool = evpool
}
reactors, eventChans, eventBuses := startConsensusNet(t, css, N)
defer stopConsensusNet(log.TestingLogger(), reactors, eventBuses)
// wait till everyone makes the first new block
timeoutWaitGroup(t, N, func(j int) {
<-eventChans[j]
}, css)
// second block should have evidence
timeoutWaitGroup(t, N, func(j int) {
<-eventChans[j]
}, css)
}
type mockEvidencePool struct {
height int
ev []types.Evidence
t *testing.T
}
func (m mockEvidencePool) PendingEvidence() []types.Evidence {
if m.height > 0 {
return m.ev
}
return nil
}
func (m mockEvidencePool) AddEvidence(types.Evidence) error { return nil }
func (m mockEvidencePool) Update(block *types.Block, state sm.State) {
m.height += 1
if m.height > 0 {
require.True(m.t, len(block.Evidence.Evidence) > 0)
}
}
// Ensure a testnet sends proposal heartbeats and makes blocks when there are txs
func TestReactorProposalHeartbeats(t *testing.T) {
N := 4


+ 2
- 2
consensus/types/wire.go View File

@ -2,11 +2,11 @@ package types
import (
"github.com/tendermint/go-amino"
cryptoAmino "github.com/tendermint/tendermint/crypto/encoding/amino"
"github.com/tendermint/tendermint/types"
)
var cdc = amino.NewCodec()
func init() {
cryptoAmino.RegisterAmino(cdc)
types.RegisterBlockAmino(cdc)
}

+ 2
- 2
consensus/wire.go View File

@ -2,7 +2,7 @@ package consensus
import (
"github.com/tendermint/go-amino"
cryptoAmino "github.com/tendermint/tendermint/crypto/encoding/amino"
"github.com/tendermint/tendermint/types"
)
var cdc = amino.NewCodec()
@ -10,5 +10,5 @@ var cdc = amino.NewCodec()
func init() {
RegisterConsensusMessages(cdc)
RegisterWALMessages(cdc)
cryptoAmino.RegisterAmino(cdc)
types.RegisterBlockAmino(cdc)
}

+ 0
- 10
evidence/wire.go View File

@ -12,14 +12,4 @@ func init() {
RegisterEvidenceMessages(cdc)
cryptoAmino.RegisterAmino(cdc)
types.RegisterEvidences(cdc)
RegisterMockEvidences(cdc) // For testing
}
//-------------------------------------------
func RegisterMockEvidences(cdc *amino.Codec) {
cdc.RegisterConcrete(types.MockGoodEvidence{},
"tendermint/MockGoodEvidence", nil)
cdc.RegisterConcrete(types.MockBadEvidence{},
"tendermint/MockBadEvidence", nil)
}

+ 2
- 2
lite/files/wire.go View File

@ -2,11 +2,11 @@ package files
import (
"github.com/tendermint/go-amino"
cryptoAmino "github.com/tendermint/tendermint/crypto/encoding/amino"
"github.com/tendermint/tendermint/types"
)
var cdc = amino.NewCodec()
func init() {
cryptoAmino.RegisterAmino(cdc)
types.RegisterBlockAmino(cdc)
}

+ 1
- 3
rpc/core/types/wire.go View File

@ -2,12 +2,10 @@ package core_types
import (
"github.com/tendermint/go-amino"
cryptoAmino "github.com/tendermint/tendermint/crypto/encoding/amino"
"github.com/tendermint/tendermint/types"
)
func RegisterAmino(cdc *amino.Codec) {
types.RegisterEventDatas(cdc)
types.RegisterEvidences(cdc)
cryptoAmino.RegisterAmino(cdc)
types.RegisterBlockAmino(cdc)
}

+ 20
- 1
types/block_test.go View File

@ -6,7 +6,7 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
crypto "github.com/tendermint/tendermint/crypto"
"github.com/tendermint/tendermint/crypto"
cmn "github.com/tendermint/tendermint/libs/common"
)
@ -101,6 +101,25 @@ func TestBlockMakePartSet(t *testing.T) {
assert.Equal(t, 1, partSet.Total())
}
func TestBlockMakePartSetWithEvidence(t *testing.T) {
assert.Nil(t, (*Block)(nil).MakePartSet(2))
txs := []Tx{Tx("foo"), Tx("bar")}
lastID := makeBlockIDRandom()
h := int64(3)
voteSet, valSet, vals := randVoteSet(h-1, 1, VoteTypePrecommit, 10, 1)
commit, err := MakeCommit(lastID, h-1, 1, voteSet, vals)
require.NoError(t, err)
ev := NewMockGoodEvidence(h, 0, valSet.Validators[0].Address)
evList := []Evidence{ev}
partSet := MakeBlock(h, txs, commit, evList).MakePartSet(1024)
assert.NotNil(t, partSet)
assert.Equal(t, 3, partSet.Total())
}
func TestBlockHashesTo(t *testing.T) {
assert.False(t, (*Block)(nil).HashesTo(nil))


+ 4
- 0
types/evidence.go View File

@ -41,6 +41,10 @@ type Evidence interface {
func RegisterEvidences(cdc *amino.Codec) {
cdc.RegisterInterface((*Evidence)(nil), nil)
cdc.RegisterConcrete(&DuplicateVoteEvidence{}, "tendermint/DuplicateVoteEvidence", nil)
// mocks
cdc.RegisterConcrete(MockGoodEvidence{}, "tendermint/MockGoodEvidence", nil)
cdc.RegisterConcrete(MockBadEvidence{}, "tendermint/MockBadEvidence", nil)
}
//-------------------------------------------


+ 6
- 1
types/wire.go View File

@ -2,11 +2,16 @@ package types
import (
"github.com/tendermint/go-amino"
cryptoAmino "github.com/tendermint/tendermint/crypto/encoding/amino"
"github.com/tendermint/tendermint/crypto/encoding/amino"
)
var cdc = amino.NewCodec()
func init() {
RegisterBlockAmino(cdc)
}
func RegisterBlockAmino(cdc *amino.Codec) {
cryptoAmino.RegisterAmino(cdc)
RegisterEvidences(cdc)
}

+ 2
- 2
version/version.go View File

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


Loading…
Cancel
Save