Browse Source

ValidatorSetUpdates -> ValidatorUpdates

pull/972/head
Anton Kaliaev 7 years ago
parent
commit
0ffd60b8cf
No known key found for this signature in database GPG Key ID: 7B6881D965918214
6 changed files with 23 additions and 23 deletions
  1. +12
    -12
      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
  6. +2
    -2
      types/protobuf.go

+ 12
- 12
glide.lock View File

@ -1,5 +1,5 @@
hash: ff6e6786ec24ffac91df45d4a1cdcefae5280700667ca76b8b9b96f343d78c95
updated: 2017-12-19T18:45:37.28268356Z
hash: bd982742a0aee39426f3866914a59f7c47e68dc8dedb87219e2099c0d9c19f7e
updated: 2017-12-21T17:45:25.372327218Z
imports: imports:
- name: github.com/btcsuite/btcd - name: github.com/btcsuite/btcd
version: 2e60448ffcc6bf78332d1fe590260095f554dd78 version: 2e60448ffcc6bf78332d1fe590260095f554dd78
@ -10,7 +10,7 @@ imports:
- name: github.com/fsnotify/fsnotify - name: github.com/fsnotify/fsnotify
version: 4da3e2cfbabc9f751898f250b49f2439785783a1 version: 4da3e2cfbabc9f751898f250b49f2439785783a1
- name: github.com/go-kit/kit - name: github.com/go-kit/kit
version: e3b2152e0063c5f05efea89ecbe297852af2a92d
version: 953e747656a7bbb5e1f998608b460458958b70cc
subpackages: subpackages:
- log - log
- log/level - log/level
@ -68,7 +68,7 @@ imports:
- name: github.com/mitchellh/mapstructure - name: github.com/mitchellh/mapstructure
version: 06020f85339e21b2478f756a78e295255ffa4d6a version: 06020f85339e21b2478f756a78e295255ffa4d6a
- name: github.com/pelletier/go-toml - name: github.com/pelletier/go-toml
version: 4e9e0ee19b60b13eb79915933f44d8ed5f268bdd
version: b8b5e7696574464b2f9bf303a7b37781bb52889f
- name: github.com/pkg/errors - name: github.com/pkg/errors
version: 645ef00459ed84a119197bfb8d8205042c6df63d version: 645ef00459ed84a119197bfb8d8205042c6df63d
- name: github.com/rcrowley/go-metrics - name: github.com/rcrowley/go-metrics
@ -88,7 +88,7 @@ imports:
- name: github.com/spf13/viper - name: github.com/spf13/viper
version: 25b30aa063fc18e48662b86996252eabdcf2f0c7 version: 25b30aa063fc18e48662b86996252eabdcf2f0c7
- name: github.com/syndtr/goleveldb - name: github.com/syndtr/goleveldb
version: adf24ef3f94bd13ec4163060b21a5678f22b429b
version: 34011bf325bce385408353a30b101fe5e923eb6e
subpackages: subpackages:
- leveldb - leveldb
- leveldb/cache - leveldb/cache
@ -103,7 +103,7 @@ imports:
- leveldb/table - leveldb/table
- leveldb/util - leveldb/util
- name: github.com/tendermint/abci - name: github.com/tendermint/abci
version: 66296fe11aaa518381c6cd7160bc6318e28c4e02
version: e4b9f1abe794a2117a59738a1294e09b46d0fa00
subpackages: subpackages:
- client - client
- example/code - example/code
@ -144,7 +144,7 @@ imports:
- pubsub/query - pubsub/query
- test - test
- name: golang.org/x/crypto - name: golang.org/x/crypto
version: 94eea52f7b742c7cbe0b03b22f0c4c8631ece122
version: d585fd2cc9195196078f516b69daff6744ef5e84
subpackages: subpackages:
- curve25519 - curve25519
- nacl/box - nacl/box
@ -155,7 +155,7 @@ imports:
- ripemd160 - ripemd160
- salsa20/salsa - salsa20/salsa
- name: golang.org/x/net - name: golang.org/x/net
version: a8b9294777976932365dabb6640cf1468d95c70f
version: d866cfc389cec985d6fda2859936a575a55a3ab6
subpackages: subpackages:
- context - context
- http2 - http2
@ -165,18 +165,18 @@ imports:
- lex/httplex - lex/httplex
- trace - trace
- name: golang.org/x/sys - name: golang.org/x/sys
version: 8b4580aae2a0dd0c231a45d3ccb8434ff533b840
version: d818ba11af4465e00c1998bd3f8a55603b422290
subpackages: subpackages:
- unix - unix
- name: golang.org/x/text - name: golang.org/x/text
version: 75cc3cad82b5f47d3fb229ddda8c5167da14f294
version: eb22672bea55af56d225d4e35405f4d2e9f062a0
subpackages: subpackages:
- secure/bidirule - secure/bidirule
- transform - transform
- unicode/bidi - unicode/bidi
- unicode/norm - unicode/norm
- name: google.golang.org/genproto - name: google.golang.org/genproto
version: 7f0da29060c682909f650ad8ed4e515bd74fa12a
version: a8101f21cf983e773d0c1133ebc5424792003214
subpackages: subpackages:
- googleapis/rpc/status - googleapis/rpc/status
- name: google.golang.org/grpc - name: google.golang.org/grpc
@ -199,7 +199,7 @@ imports:
- tap - tap
- transport - transport
- name: gopkg.in/go-playground/validator.v9 - name: gopkg.in/go-playground/validator.v9
version: 61caf9d3038e1af346dbf5c2e16f6678e1548364
version: b1f51f36f1c98cc97f777d6fc9d4b05eaa0cabb5
- name: gopkg.in/yaml.v2 - name: gopkg.in/yaml.v2
version: 287cf08546ab5e7e37d55a84f7ed3fd1db036de5 version: 287cf08546ab5e7e37d55a84f7ed3fd1db036de5
testImports: testImports:


+ 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: feature/enhance-endblock
version: develop
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
} }
valSetUpdates := abciResponses.EndBlock.ValidatorSetUpdates
valUpdates := abciResponses.EndBlock.ValidatorUpdates
logger.Info("Executed block", "height", block.Height, "validTxs", validTxs, "invalidTxs", invalidTxs) logger.Info("Executed block", "height", block.Height, "validTxs", validTxs, "invalidTxs", invalidTxs)
if len(valSetUpdates) > 0 {
logger.Info("Updates to validator set", "updates", abci.ValidatorsString(valSetUpdates))
if len(valUpdates) > 0 {
logger.Info("Updates to validators", "updates", abci.ValidatorsString(valUpdates))
} }
return abciResponses, nil return abciResponses, nil


+ 2
- 2
state/state.go View File

@ -241,8 +241,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.ValidatorSetUpdates) > 0 {
err := updateValidators(nextValSet, abciResponses.EndBlock.ValidatorSetUpdates)
if len(abciResponses.EndBlock.ValidatorUpdates) > 0 {
err := updateValidators(nextValSet, abciResponses.EndBlock.ValidatorUpdates)
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{ValidatorSetUpdates: []*abci.Validator{
abciResponses.EndBlock = &abci.ResponseEndBlock{ValidatorUpdates: []*abci.Validator{
{ {
PubKey: crypto.GenPrivKeyEd25519().PubKey().Bytes(), PubKey: crypto.GenPrivKeyEd25519().PubKey().Bytes(),
Power: 10, Power: 10,
@ -264,13 +264,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{ValidatorSetUpdates: []*abci.Validator{}},
EndBlock: &abci.ResponseEndBlock{ValidatorUpdates: []*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{
ValidatorSetUpdates: []*abci.Validator{
ValidatorUpdates: []*abci.Validator{
{val.PubKey.Bytes(), 0}, {val.PubKey.Bytes(), 0},
{pubkey.Bytes(), 10}, {pubkey.Bytes(), 10},
}, },


+ 2
- 2
types/protobuf.go View File

@ -12,11 +12,11 @@ type tm2pb struct{}
func (tm2pb) Header(header *Header) *types.Header { func (tm2pb) Header(header *Header) *types.Header {
return &types.Header{ return &types.Header{
ChainId: header.ChainID,
ChainID: header.ChainID,
Height: header.Height, Height: header.Height,
Time: header.Time.Unix(), Time: header.Time.Unix(),
NumTxs: int32(header.NumTxs), // XXX: overflow NumTxs: int32(header.NumTxs), // XXX: overflow
LastBlockId: TM2PB.BlockID(header.LastBlockID),
LastBlockID: TM2PB.BlockID(header.LastBlockID),
LastCommitHash: header.LastCommitHash, LastCommitHash: header.LastCommitHash,
DataHash: header.DataHash, DataHash: header.DataHash,
AppHash: header.AppHash, AppHash: header.AppHash,


Loading…
Cancel
Save