Browse Source

Update EndBlock parameters

* Update abci dependencies
* Modify references from Diffs to Changes
* Fixes issues #924
pull/972/head
Ethan Frey 7 years ago
committed by Ethan Buchman
parent
commit
4265a94bfe
5 changed files with 12 additions and 12 deletions
  1. +3
    -3
      glide.lock
  2. +1
    -1
      glide.yaml
  3. +3
    -3
      state/execution.go
  4. +2
    -2
      state/state.go
  5. +3
    -3
      state/state_test.go

+ 3
- 3
glide.lock 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: imports:
- name: github.com/btcsuite/btcd - name: github.com/btcsuite/btcd
version: 2e60448ffcc6bf78332d1fe590260095f554dd78 version: 2e60448ffcc6bf78332d1fe590260095f554dd78
@ -103,7 +103,7 @@ imports:
- leveldb/table - leveldb/table
- leveldb/util - leveldb/util
- name: github.com/tendermint/abci - name: github.com/tendermint/abci
version: fca2b508c185b855af1446ec4afc19bdfc7b315d
version: 895e14d6bd9cdad98eab4a051decbaad46f7eebd
subpackages: subpackages:
- client - client
- example/code - example/code


+ 1
- 1
glide.yaml View File

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


+ 3
- 3
state/execution.go View File

@ -111,11 +111,11 @@ func execBlockOnProxyApp(txEventPublisher types.TxEventPublisher, proxyAppConn p
return nil, err return nil, err
} }
valDiff := abciResponses.EndBlock.Diffs
valChanges := abciResponses.EndBlock.Changes
logger.Info("Executed block", "height", block.Height, "validTxs", validTxs, "invalidTxs", invalidTxs) 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 return abciResponses, nil


+ 2
- 2
state/state.go View File

@ -238,8 +238,8 @@ func (s *State) SetBlockAndValidators(header *types.Header, blockPartsHeader typ
nextValSet := prevValSet.Copy() nextValSet := prevValSet.Copy()
// update the validator set with the latest abciResponses // 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 { if err != nil {
s.logger.Error("Error changing validator set", "err", err) s.logger.Error("Error changing validator set", "err", err)
// TODO: err or carry on? // TODO: err or carry on?


+ 3
- 3
state/state_test.go View File

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


Loading…
Cancel
Save