ValidatorSetUpdates -> ValidatorUpdates
This commit is contained in:
parent
9a5b943e77
commit
c14d3982ac
|
@ -3,7 +3,7 @@
|
|||
## 0.9.0 (TBD)
|
||||
|
||||
BREAKING CHANGES:
|
||||
- [types] ResponseEndBlock: renamed Diffs field to ValidatorSetUpdates
|
||||
- [types] ResponseEndBlock: renamed Diffs field to ValidatorUpdates
|
||||
|
||||
FEATURES:
|
||||
- [types] ResponseEndBlock: added ConsensusParamUpdates
|
||||
|
|
18
Makefile
18
Makefile
|
@ -2,13 +2,12 @@ GOTOOLS = \
|
|||
github.com/mitchellh/gox \
|
||||
github.com/Masterminds/glide \
|
||||
github.com/alecthomas/gometalinter \
|
||||
github.com/ckaznocha/protoc-gen-lint \
|
||||
github.com/gogo/protobuf/protoc-gen-gogo \
|
||||
github.com/gogo/protobuf/gogoproto
|
||||
|
||||
INCLUDE = -I=. -I=${GOPATH}/src -I=${GOPATH}/src/github.com/gogo/protobuf/protobuf
|
||||
|
||||
all: install test
|
||||
all: protoc install test metalinter
|
||||
|
||||
PACKAGES=$(shell go list ./... | grep -v '/vendor/')
|
||||
|
||||
|
@ -27,7 +26,7 @@ protoc:
|
|||
## On "error while loading shared libraries: libprotobuf.so.14: cannot open shared object file: No such file or directory"
|
||||
## ldconfig (may require sudo)
|
||||
## https://stackoverflow.com/a/25518702
|
||||
protoc $(INCLUDE) --gogo_out=plugins=grpc:. --lint_out=. types/*.proto
|
||||
protoc $(INCLUDE) --gogo_out=plugins=grpc:. types/*.proto
|
||||
|
||||
install:
|
||||
@ go install ./cmd/...
|
||||
|
@ -41,15 +40,13 @@ dist:
|
|||
|
||||
test:
|
||||
@ find . -path ./vendor -prune -o -name "*.sock" -exec rm {} \;
|
||||
@ echo "==> Running linter"
|
||||
@ make metalinter_test
|
||||
@ echo "==> Running go test"
|
||||
@ go test $(PACKAGES)
|
||||
|
||||
test_race:
|
||||
@ find . -path ./vendor -prune -o -name "*.sock" -exec rm {} \;
|
||||
@ echo "==> Running go test --race"
|
||||
@go test -v -race $(PACKAGES)
|
||||
@ go test -v -race $(PACKAGES)
|
||||
|
||||
test_integrations:
|
||||
@ bash test.sh
|
||||
|
@ -62,19 +59,18 @@ get_deps:
|
|||
|
||||
ensure_tools:
|
||||
go get -u -v $(GOTOOLS)
|
||||
@gometalinter --install
|
||||
@ gometalinter --install
|
||||
|
||||
get_vendor_deps: ensure_tools
|
||||
@rm -rf vendor/
|
||||
@echo "--> Running glide install"
|
||||
@ glide install
|
||||
|
||||
metalinter:
|
||||
protoc $(INCLUDE) --lint_out=. types/*.proto
|
||||
metalinter_all:
|
||||
gometalinter --vendor --deadline=600s --enable-all --disable=lll ./...
|
||||
|
||||
metalinter_test:
|
||||
protoc $(INCLUDE) --lint_out=. types/*.proto
|
||||
metalinter:
|
||||
@ echo "==> Running linter"
|
||||
gometalinter --vendor --deadline=600s --disable-all \
|
||||
--enable=maligned \
|
||||
--enable=deadcode \
|
||||
|
|
|
@ -185,7 +185,7 @@ Here, we describe the requests and responses as function arguments and return va
|
|||
* __Arguments__:
|
||||
* `Height (int64)`: The block height that ended
|
||||
* __Returns__:
|
||||
* `ValidatorSetUpdates ([]Validator)`: Changes to validator set (set voting power to 0 to remove)
|
||||
* `ValidatorUpdates ([]Validator)`: Changes to validator set (set voting power to 0 to remove)
|
||||
* `ConsensusParamUpdates (ConsensusParams)`: Changes to consensus-critical time/size parameters
|
||||
* __Usage__:<br/>
|
||||
Signals the end of a block. Called prior to each Commit after all transactions. Validator set is updated with the result.
|
||||
|
|
|
@ -107,7 +107,7 @@ func TestPersistentDummyInfo(t *testing.T) {
|
|||
}
|
||||
|
||||
// add a validator, remove a validator, update a validator
|
||||
func TestValSetUpdates(t *testing.T) {
|
||||
func TestValUpdates(t *testing.T) {
|
||||
dir, err := ioutil.TempDir("/tmp", "abci-dummy-test") // TODO
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
|
@ -188,7 +188,7 @@ func makeApplyBlock(t *testing.T, dummy types.Application, heightInt int, diff [
|
|||
resEndBlock := dummy.EndBlock(types.RequestEndBlock{header.Height})
|
||||
dummy.Commit()
|
||||
|
||||
valsEqual(t, diff, resEndBlock.ValidatorSetUpdates)
|
||||
valsEqual(t, diff, resEndBlock.ValidatorUpdates)
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ type PersistentDummyApplication struct {
|
|||
app *DummyApplication
|
||||
|
||||
// validator set
|
||||
valSetUpdates []*types.Validator
|
||||
ValUpdates []*types.Validator
|
||||
|
||||
logger log.Logger
|
||||
}
|
||||
|
@ -71,7 +71,7 @@ func (app *PersistentDummyApplication) DeliverTx(tx []byte) types.ResponseDelive
|
|||
// format is "val:pubkey/power"
|
||||
if isValidatorTx(tx) {
|
||||
// update validators in the merkle tree
|
||||
// and in app.valSetUpdates
|
||||
// and in app.ValUpdates
|
||||
return app.execValidatorTx(tx)
|
||||
}
|
||||
|
||||
|
@ -119,13 +119,13 @@ func (app *PersistentDummyApplication) InitChain(req types.RequestInitChain) typ
|
|||
// Track the block hash and header information
|
||||
func (app *PersistentDummyApplication) BeginBlock(req types.RequestBeginBlock) types.ResponseBeginBlock {
|
||||
// reset valset changes
|
||||
app.valSetUpdates = make([]*types.Validator, 0)
|
||||
app.ValUpdates = make([]*types.Validator, 0)
|
||||
return types.ResponseBeginBlock{}
|
||||
}
|
||||
|
||||
// Update the validator set
|
||||
func (app *PersistentDummyApplication) EndBlock(req types.RequestEndBlock) types.ResponseEndBlock {
|
||||
return types.ResponseEndBlock{ValidatorSetUpdates: app.valSetUpdates}
|
||||
return types.ResponseEndBlock{ValidatorUpdates: app.ValUpdates}
|
||||
}
|
||||
|
||||
//---------------------------------------------
|
||||
|
@ -216,7 +216,7 @@ func (app *PersistentDummyApplication) updateValidator(v *types.Validator) types
|
|||
}
|
||||
|
||||
// we only update the changes array if we successfully updated the tree
|
||||
app.valSetUpdates = append(app.valSetUpdates, v)
|
||||
app.ValUpdates = append(app.ValUpdates, v)
|
||||
|
||||
return types.ResponseDeliverTx{Code: code.CodeTypeOK}
|
||||
}
|
||||
|
|
1120
types/types.pb.go
1120
types/types.pb.go
File diff suppressed because it is too large
Load Diff
|
@ -10,18 +10,18 @@ import "github.com/gogo/protobuf/gogoproto/gogo.proto";
|
|||
// Request types
|
||||
|
||||
message Request {
|
||||
oneof value{
|
||||
RequestEcho echo = 1;
|
||||
RequestFlush flush = 2;
|
||||
RequestInfo info = 3;
|
||||
RequestSetOption set_option = 4;
|
||||
RequestDeliverTx deliver_tx = 5;
|
||||
RequestCheckTx check_tx = 6;
|
||||
RequestCommit commit = 7;
|
||||
RequestQuery query = 8;
|
||||
RequestInitChain init_chain = 9;
|
||||
RequestBeginBlock begin_block = 10;
|
||||
oneof value {
|
||||
RequestEcho echo = 2;
|
||||
RequestFlush flush = 3;
|
||||
RequestInfo info = 4;
|
||||
RequestSetOption set_option = 5;
|
||||
RequestInitChain init_chain = 6;
|
||||
RequestQuery query = 7;
|
||||
RequestBeginBlock begin_block = 8;
|
||||
RequestCheckTx check_tx = 9;
|
||||
RequestDeliverTx deliver_tx = 19;
|
||||
RequestEndBlock end_block = 11;
|
||||
RequestCommit commit = 12;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -36,17 +36,13 @@ message RequestInfo {
|
|||
string version = 1;
|
||||
}
|
||||
|
||||
message RequestSetOption{
|
||||
message RequestSetOption {
|
||||
string key = 1;
|
||||
string value = 2;
|
||||
}
|
||||
|
||||
message RequestDeliverTx{
|
||||
bytes tx = 1;
|
||||
}
|
||||
|
||||
message RequestCheckTx{
|
||||
bytes tx = 1;
|
||||
message RequestInitChain {
|
||||
repeated Validator validators = 1;
|
||||
}
|
||||
|
||||
message RequestQuery{
|
||||
|
@ -56,46 +52,49 @@ message RequestQuery{
|
|||
bool prove = 4;
|
||||
}
|
||||
|
||||
message RequestCommit{
|
||||
}
|
||||
|
||||
message RequestInitChain{
|
||||
repeated Validator validators = 1;
|
||||
}
|
||||
|
||||
message RequestBeginBlock{
|
||||
message RequestBeginBlock {
|
||||
bytes hash = 1;
|
||||
Header header = 2;
|
||||
repeated int32 absent_validators = 3;
|
||||
repeated Evidence byzantine_validators = 4;
|
||||
}
|
||||
|
||||
message RequestCheckTx {
|
||||
bytes tx = 1;
|
||||
}
|
||||
|
||||
message RequestDeliverTx {
|
||||
bytes tx = 1;
|
||||
}
|
||||
|
||||
message RequestEndBlock{
|
||||
int64 height = 1;
|
||||
}
|
||||
|
||||
message RequestCommit {
|
||||
}
|
||||
|
||||
//----------------------------------------
|
||||
// Response types
|
||||
|
||||
|
||||
message Response {
|
||||
oneof value{
|
||||
oneof value {
|
||||
ResponseException exception = 1;
|
||||
ResponseEcho echo = 2;
|
||||
ResponseFlush flush = 3;
|
||||
ResponseInfo info = 4;
|
||||
ResponseSetOption set_option = 5;
|
||||
ResponseDeliverTx deliver_tx = 6;
|
||||
ResponseCheckTx check_tx = 7;
|
||||
ResponseCommit commit = 8;
|
||||
ResponseQuery query = 9;
|
||||
ResponseInitChain init_chain = 10;
|
||||
ResponseBeginBlock begin_block = 11;
|
||||
ResponseEndBlock end_block = 12;
|
||||
ResponseInitChain init_chain = 6;
|
||||
ResponseQuery query = 7;
|
||||
ResponseBeginBlock begin_block = 8;
|
||||
ResponseCheckTx check_tx = 9;
|
||||
ResponseDeliverTx deliver_tx = 10;
|
||||
ResponseEndBlock end_block = 11;
|
||||
ResponseCommit commit = 12;
|
||||
}
|
||||
}
|
||||
|
||||
message ResponseException{
|
||||
message ResponseException {
|
||||
string error = 1;
|
||||
}
|
||||
|
||||
|
@ -103,7 +102,7 @@ message ResponseEcho {
|
|||
string message = 1;
|
||||
}
|
||||
|
||||
message ResponseFlush{
|
||||
message ResponseFlush {
|
||||
}
|
||||
|
||||
message ResponseInfo {
|
||||
|
@ -113,81 +112,82 @@ message ResponseInfo {
|
|||
bytes last_block_app_hash = 4;
|
||||
}
|
||||
|
||||
message ResponseSetOption{
|
||||
message ResponseSetOption {
|
||||
uint32 code = 1;
|
||||
string log = 2;
|
||||
}
|
||||
|
||||
message ResponseDeliverTx{
|
||||
uint32 code = 1;
|
||||
bytes data = 2 [(gogoproto.customtype) = "github.com/tendermint/go-wire/data.Bytes", (gogoproto.nullable) = false];
|
||||
string log = 3;
|
||||
message ResponseInitChain {
|
||||
}
|
||||
|
||||
message ResponseQuery {
|
||||
uint32 code = 1;
|
||||
int64 index = 2;
|
||||
bytes key = 3 [(gogoproto.customtype) = "github.com/tendermint/go-wire/data.Bytes", (gogoproto.nullable) = false];
|
||||
bytes value = 4 [(gogoproto.customtype) = "github.com/tendermint/go-wire/data.Bytes", (gogoproto.nullable) = false];
|
||||
bytes proof = 5 [(gogoproto.customtype) = "github.com/tendermint/go-wire/data.Bytes", (gogoproto.nullable) = false];
|
||||
int64 height = 6;
|
||||
string log = 7;
|
||||
}
|
||||
|
||||
message ResponseBeginBlock {
|
||||
}
|
||||
|
||||
message ResponseCheckTx {
|
||||
uint32 code = 1;
|
||||
bytes data = 2 [(gogoproto.customtype) = "github.com/tendermint/go-wire/data.Bytes", (gogoproto.nullable) = false];
|
||||
string log = 3;
|
||||
int64 gas = 4;
|
||||
int64 fee = 5;
|
||||
}
|
||||
|
||||
message ResponseDeliverTx {
|
||||
uint32 code = 1;
|
||||
bytes data = 2 [(gogoproto.customtype) = "github.com/tendermint/go-wire/data.Bytes", (gogoproto.nullable) = false];
|
||||
string log = 3;
|
||||
repeated KVPair tags = 4;
|
||||
}
|
||||
|
||||
message ResponseCheckTx{
|
||||
uint32 code = 1;
|
||||
bytes data = 2 [(gogoproto.customtype) = "github.com/tendermint/go-wire/data.Bytes", (gogoproto.nullable) = false];
|
||||
string log = 3;
|
||||
int64 gas = 4;
|
||||
int64 fee = 5;
|
||||
}
|
||||
|
||||
message ResponseQuery{
|
||||
uint32 code = 1;
|
||||
int64 index = 2;
|
||||
bytes key = 3 [(gogoproto.customtype) = "github.com/tendermint/go-wire/data.Bytes", (gogoproto.nullable) = false];
|
||||
bytes value = 4 [(gogoproto.customtype) = "github.com/tendermint/go-wire/data.Bytes", (gogoproto.nullable) = false];
|
||||
bytes proof = 5 [(gogoproto.customtype) = "github.com/tendermint/go-wire/data.Bytes", (gogoproto.nullable) = false];
|
||||
int64 height = 6;
|
||||
string log = 7;
|
||||
}
|
||||
|
||||
message ResponseCommit{
|
||||
uint32 code = 1;
|
||||
bytes data = 2 [(gogoproto.customtype) = "github.com/tendermint/go-wire/data.Bytes", (gogoproto.nullable) = false];
|
||||
string log = 3;
|
||||
}
|
||||
|
||||
|
||||
message ResponseInitChain{
|
||||
}
|
||||
|
||||
message ResponseBeginBlock{
|
||||
}
|
||||
|
||||
message ResponseEndBlock{
|
||||
repeated Validator validator_set_updates = 1;
|
||||
message ResponseEndBlock {
|
||||
repeated Validator validator_updates = 1;
|
||||
ConsensusParams consensus_param_updates = 2;
|
||||
}
|
||||
|
||||
message ResponseCommit {
|
||||
uint32 code = 1;
|
||||
bytes data = 2 [(gogoproto.customtype) = "github.com/tendermint/go-wire/data.Bytes", (gogoproto.nullable) = false];
|
||||
string log = 3;
|
||||
}
|
||||
|
||||
//----------------------------------------
|
||||
// Misc.
|
||||
|
||||
// ConsensusParams contains all consensus-relevant parameters
|
||||
// that can be adjusted by the abci app
|
||||
message ConsensusParams{
|
||||
BlockSize block_size = 1;
|
||||
TxSize tx_size = 2;
|
||||
BlockGossip block_gossip = 3;
|
||||
message ConsensusParams {
|
||||
BlockSize block_size = 1;
|
||||
TxSize tx_size = 2;
|
||||
BlockGossip block_gossip = 3;
|
||||
}
|
||||
|
||||
// BlockSize contain limits on the block size.
|
||||
message BlockSize{
|
||||
// NOTE: must not be 0 nor greater than 100MB
|
||||
int32 max_bytes = 1;
|
||||
int32 max_txs = 2;
|
||||
int64 max_gas = 3;
|
||||
message BlockSize {
|
||||
int32 max_bytes = 1;
|
||||
int32 max_txs = 2;
|
||||
int64 max_gas = 3;
|
||||
}
|
||||
|
||||
// TxSize contain limits on the tx size.
|
||||
message TxSize{
|
||||
int32 max_bytes = 1;
|
||||
int64 max_gas = 2;
|
||||
int32 max_bytes = 1;
|
||||
int64 max_gas = 2;
|
||||
}
|
||||
|
||||
// BlockGossip determine consensus critical
|
||||
// elements of how blocks are gossiped
|
||||
message BlockGossip{
|
||||
// Note: must not be 0
|
||||
int32 block_part_size_bytes = 1;
|
||||
// Note: must not be 0
|
||||
int32 block_part_size_bytes = 1;
|
||||
}
|
||||
|
||||
//----------------------------------------
|
||||
|
|
Loading…
Reference in New Issue