mirror of
https://github.com/fluencelabs/tendermint
synced 2025-05-03 02:22:14 +00:00
commit
18acd77e40
@ -1,5 +1,14 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 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
|
## 0.22.6
|
||||||
|
|
||||||
*July 24th, 2018*
|
*July 24th, 2018*
|
||||||
|
@ -3,6 +3,7 @@ package blockchain
|
|||||||
import (
|
import (
|
||||||
"github.com/tendermint/go-amino"
|
"github.com/tendermint/go-amino"
|
||||||
cryptoAmino "github.com/tendermint/tendermint/crypto/encoding/amino"
|
cryptoAmino "github.com/tendermint/tendermint/crypto/encoding/amino"
|
||||||
|
"github.com/tendermint/tendermint/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
var cdc = amino.NewCodec()
|
var cdc = amino.NewCodec()
|
||||||
@ -10,4 +11,5 @@ var cdc = amino.NewCodec()
|
|||||||
func init() {
|
func init() {
|
||||||
RegisterBlockchainMessages(cdc)
|
RegisterBlockchainMessages(cdc)
|
||||||
cryptoAmino.RegisterAmino(cdc)
|
cryptoAmino.RegisterAmino(cdc)
|
||||||
|
types.RegisterEvidences(cdc)
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,7 @@ import (
|
|||||||
"github.com/tendermint/tendermint/abci/example/kvstore"
|
"github.com/tendermint/tendermint/abci/example/kvstore"
|
||||||
cmn "github.com/tendermint/tendermint/libs/common"
|
cmn "github.com/tendermint/tendermint/libs/common"
|
||||||
"github.com/tendermint/tendermint/libs/log"
|
"github.com/tendermint/tendermint/libs/log"
|
||||||
|
sm "github.com/tendermint/tendermint/state"
|
||||||
|
|
||||||
cfg "github.com/tendermint/tendermint/config"
|
cfg "github.com/tendermint/tendermint/config"
|
||||||
"github.com/tendermint/tendermint/p2p"
|
"github.com/tendermint/tendermint/p2p"
|
||||||
@ -91,6 +92,51 @@ func TestReactorBasic(t *testing.T) {
|
|||||||
}, css)
|
}, 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
|
// Ensure a testnet sends proposal heartbeats and makes blocks when there are txs
|
||||||
func TestReactorProposalHeartbeats(t *testing.T) {
|
func TestReactorProposalHeartbeats(t *testing.T) {
|
||||||
N := 4
|
N := 4
|
||||||
|
@ -3,10 +3,12 @@ package types
|
|||||||
import (
|
import (
|
||||||
"github.com/tendermint/go-amino"
|
"github.com/tendermint/go-amino"
|
||||||
cryptoAmino "github.com/tendermint/tendermint/crypto/encoding/amino"
|
cryptoAmino "github.com/tendermint/tendermint/crypto/encoding/amino"
|
||||||
|
"github.com/tendermint/tendermint/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
var cdc = amino.NewCodec()
|
var cdc = amino.NewCodec()
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
cryptoAmino.RegisterAmino(cdc)
|
cryptoAmino.RegisterAmino(cdc)
|
||||||
|
types.RegisterEvidences(cdc)
|
||||||
}
|
}
|
||||||
|
@ -12,14 +12,4 @@ func init() {
|
|||||||
RegisterEvidenceMessages(cdc)
|
RegisterEvidenceMessages(cdc)
|
||||||
cryptoAmino.RegisterAmino(cdc)
|
cryptoAmino.RegisterAmino(cdc)
|
||||||
types.RegisterEvidences(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)
|
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@ import (
|
|||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
crypto "github.com/tendermint/tendermint/crypto"
|
"github.com/tendermint/tendermint/crypto"
|
||||||
cmn "github.com/tendermint/tendermint/libs/common"
|
cmn "github.com/tendermint/tendermint/libs/common"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -101,6 +101,25 @@ func TestBlockMakePartSet(t *testing.T) {
|
|||||||
assert.Equal(t, 1, partSet.Total())
|
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) {
|
func TestBlockHashesTo(t *testing.T) {
|
||||||
assert.False(t, (*Block)(nil).HashesTo(nil))
|
assert.False(t, (*Block)(nil).HashesTo(nil))
|
||||||
|
|
||||||
|
@ -41,6 +41,10 @@ type Evidence interface {
|
|||||||
func RegisterEvidences(cdc *amino.Codec) {
|
func RegisterEvidences(cdc *amino.Codec) {
|
||||||
cdc.RegisterInterface((*Evidence)(nil), nil)
|
cdc.RegisterInterface((*Evidence)(nil), nil)
|
||||||
cdc.RegisterConcrete(&DuplicateVoteEvidence{}, "tendermint/DuplicateVoteEvidence", nil)
|
cdc.RegisterConcrete(&DuplicateVoteEvidence{}, "tendermint/DuplicateVoteEvidence", nil)
|
||||||
|
|
||||||
|
// mocks
|
||||||
|
cdc.RegisterConcrete(MockGoodEvidence{}, "tendermint/MockGoodEvidence", nil)
|
||||||
|
cdc.RegisterConcrete(MockBadEvidence{}, "tendermint/MockBadEvidence", nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------
|
//-------------------------------------------
|
||||||
|
@ -2,11 +2,12 @@ package types
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/tendermint/go-amino"
|
"github.com/tendermint/go-amino"
|
||||||
cryptoAmino "github.com/tendermint/tendermint/crypto/encoding/amino"
|
"github.com/tendermint/tendermint/crypto/encoding/amino"
|
||||||
)
|
)
|
||||||
|
|
||||||
var cdc = amino.NewCodec()
|
var cdc = amino.NewCodec()
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
cryptoAmino.RegisterAmino(cdc)
|
cryptoAmino.RegisterAmino(cdc)
|
||||||
|
RegisterEvidences(cdc)
|
||||||
}
|
}
|
||||||
|
@ -4,13 +4,13 @@ package version
|
|||||||
const (
|
const (
|
||||||
Maj = "0"
|
Maj = "0"
|
||||||
Min = "22"
|
Min = "22"
|
||||||
Fix = "6"
|
Fix = "7"
|
||||||
)
|
)
|
||||||
|
|
||||||
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.22.6"
|
Version = "0.22.7"
|
||||||
|
|
||||||
// GitCommit is the current HEAD set using ldflags.
|
// GitCommit is the current HEAD set using ldflags.
|
||||||
GitCommit string
|
GitCommit string
|
||||||
|
Loading…
x
Reference in New Issue
Block a user