Update EndBlock parameters

* Update abci dependencies
* Modify references from Diffs to Changes
* Fixes issues #924
This commit is contained in:
Ethan Frey 2017-12-13 18:09:10 +01:00 committed by Ethan Buchman
parent 652d1e3de8
commit 4265a94bfe
5 changed files with 12 additions and 12 deletions

6
glide.lock generated
View File

@ -1,5 +1,5 @@
hash: f420f1f858100218dad50997d939eaaf129ff654a0648a47ddc60d626ab0b8e9
updated: 2017-12-10T05:37:46.41123196Z
hash: ff6e6786ec24ffac91df45d4a1cdcefae5280700667ca76b8b9b96f343d78c95
updated: 2017-12-13T18:04:10.05914801+01:00
imports:
- name: github.com/btcsuite/btcd
version: 2e60448ffcc6bf78332d1fe590260095f554dd78
@ -103,7 +103,7 @@ imports:
- leveldb/table
- leveldb/util
- name: github.com/tendermint/abci
version: fca2b508c185b855af1446ec4afc19bdfc7b315d
version: 895e14d6bd9cdad98eab4a051decbaad46f7eebd
subpackages:
- client
- example/code

View File

@ -18,7 +18,7 @@ import:
- package: github.com/spf13/viper
version: v1.0.0
- package: github.com/tendermint/abci
version: ~v0.8.0
version: feature/enhance-endblock
subpackages:
- client
- example/dummy

View File

@ -111,11 +111,11 @@ func execBlockOnProxyApp(txEventPublisher types.TxEventPublisher, proxyAppConn p
return nil, err
}
valDiff := abciResponses.EndBlock.Diffs
valChanges := abciResponses.EndBlock.Changes
logger.Info("Executed block", "height", block.Height, "validTxs", validTxs, "invalidTxs", invalidTxs)
if len(valDiff) > 0 {
logger.Info("Update to validator set", "updates", abci.ValidatorsString(valDiff))
if len(valChanges) > 0 {
logger.Info("Update to validator set", "updates", abci.ValidatorsString(valChanges))
}
return abciResponses, nil

View File

@ -238,8 +238,8 @@ func (s *State) SetBlockAndValidators(header *types.Header, blockPartsHeader typ
nextValSet := prevValSet.Copy()
// update the validator set with the latest abciResponses
if len(abciResponses.EndBlock.Diffs) > 0 {
err := updateValidators(nextValSet, abciResponses.EndBlock.Diffs)
if len(abciResponses.EndBlock.Changes) > 0 {
err := updateValidators(nextValSet, abciResponses.EndBlock.Changes)
if err != nil {
s.logger.Error("Error changing validator set", "err", err)
// TODO: err or carry on?

View File

@ -80,7 +80,7 @@ func TestABCIResponsesSaveLoad(t *testing.T) {
abciResponses := NewABCIResponses(block)
abciResponses.DeliverTx[0] = &abci.ResponseDeliverTx{Data: []byte("foo"), Tags: []*abci.KVPair{}}
abciResponses.DeliverTx[1] = &abci.ResponseDeliverTx{Data: []byte("bar"), Log: "ok", Tags: []*abci.KVPair{}}
abciResponses.EndBlock = &abci.ResponseEndBlock{Diffs: []*abci.Validator{
abciResponses.EndBlock = &abci.ResponseEndBlock{Changes: []*abci.Validator{
{
PubKey: crypto.GenPrivKeyEd25519().PubKey().Bytes(),
Power: 10,
@ -199,13 +199,13 @@ func makeHeaderPartsResponses(state *State, height int64,
_, val := state.Validators.GetByIndex(0)
abciResponses := &ABCIResponses{
Height: height,
EndBlock: &abci.ResponseEndBlock{Diffs: []*abci.Validator{}},
EndBlock: &abci.ResponseEndBlock{Changes: []*abci.Validator{}},
}
// if the pubkey is new, remove the old and add the new
if !bytes.Equal(pubkey.Bytes(), val.PubKey.Bytes()) {
abciResponses.EndBlock = &abci.ResponseEndBlock{
Diffs: []*abci.Validator{
Changes: []*abci.Validator{
{val.PubKey.Bytes(), 0},
{pubkey.Bytes(), 10},
},