Merge pull request #245 from tendermint/bucky/validator-types

Request/ResponseValidator, update Header
This commit is contained in:
Ethan Buchman 2018-05-23 22:18:45 -04:00 committed by GitHub
commit 927c16281c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 294 additions and 931 deletions

View File

@ -94,9 +94,6 @@ test_cli:
# test the cli against the examples in the tutorial at tendermint.com # test the cli against the examples in the tutorial at tendermint.com
@ bash tests/test_cli/test.sh @ bash tests/test_cli/test.sh
fmt:
@ go fmt ./...
######################################## ########################################
### Formatting, linting, and vetting ### Formatting, linting, and vetting

View File

@ -1,4 +0,0 @@
# Dummy
DEPRECATED. See KVStore

View File

@ -1,36 +0,0 @@
package dummy
import (
"github.com/tendermint/abci/types"
cmn "github.com/tendermint/tmlibs/common"
)
// RandVal creates one random validator, with a key derived
// from the input value
func RandVal(i int) types.Validator {
pubkey := cmn.RandBytes(33)
power := cmn.RandUint16() + 1
return types.Validator{pubkey, int64(power)}
}
// RandVals returns a list of cnt validators for initializing
// the application. Note that the keys are deterministically
// derived from the index in the array, while the power is
// random (Change this if not desired)
func RandVals(cnt int) []types.Validator {
res := make([]types.Validator, cnt)
for i := 0; i < cnt; i++ {
res[i] = RandVal(i)
}
return res
}
// InitDummy initializes the dummy app with some data,
// which allows tests to pass and is fine as long as you
// don't make any tx that modify the validator state
func InitDummy(app *PersistentDummyApplication) {
app.InitChain(types.RequestInitChain{
Validators: RandVals(1),
GenesisBytes: []byte("[]"),
})
}

View File

@ -1,126 +0,0 @@
package dummy
import (
"bytes"
"encoding/binary"
"encoding/json"
"fmt"
"github.com/tendermint/abci/example/code"
"github.com/tendermint/abci/types"
cmn "github.com/tendermint/tmlibs/common"
dbm "github.com/tendermint/tmlibs/db"
)
var (
stateKey = []byte("stateKey")
kvPairPrefixKey = []byte("kvPairKey:")
)
type State struct {
db dbm.DB
Size int64 `json:"size"`
Height int64 `json:"height"`
AppHash []byte `json:"app_hash"`
}
func loadState(db dbm.DB) State {
stateBytes := db.Get(stateKey)
var state State
if len(stateBytes) != 0 {
err := json.Unmarshal(stateBytes, &state)
if err != nil {
panic(err)
}
}
state.db = db
return state
}
func saveState(state State) {
stateBytes, err := json.Marshal(state)
if err != nil {
panic(err)
}
state.db.Set(stateKey, stateBytes)
}
func prefixKey(key []byte) []byte {
return append(kvPairPrefixKey, key...)
}
//---------------------------------------------------
var _ types.Application = (*DummyApplication)(nil)
type DummyApplication struct {
types.BaseApplication
state State
}
func NewDummyApplication() *DummyApplication {
state := loadState(dbm.NewMemDB())
return &DummyApplication{state: state}
}
func (app *DummyApplication) Info(req types.RequestInfo) (resInfo types.ResponseInfo) {
return types.ResponseInfo{Data: fmt.Sprintf("{\"size\":%v}", app.state.Size)}
}
// tx is either "key=value" or just arbitrary bytes
func (app *DummyApplication) DeliverTx(tx []byte) types.ResponseDeliverTx {
var key, value []byte
parts := bytes.Split(tx, []byte("="))
if len(parts) == 2 {
key, value = parts[0], parts[1]
} else {
key, value = tx, tx
}
app.state.db.Set(prefixKey(key), value)
app.state.Size += 1
tags := []cmn.KVPair{
{[]byte("app.creator"), []byte("jae")},
{[]byte("app.key"), key},
}
return types.ResponseDeliverTx{Code: code.CodeTypeOK, Tags: tags}
}
func (app *DummyApplication) CheckTx(tx []byte) types.ResponseCheckTx {
return types.ResponseCheckTx{Code: code.CodeTypeOK}
}
func (app *DummyApplication) Commit() types.ResponseCommit {
// Using a memdb - just return the big endian size of the db
appHash := make([]byte, 8)
binary.PutVarint(appHash, app.state.Size)
app.state.AppHash = appHash
app.state.Height += 1
saveState(app.state)
return types.ResponseCommit{Data: appHash}
}
func (app *DummyApplication) Query(reqQuery types.RequestQuery) (resQuery types.ResponseQuery) {
if reqQuery.Prove {
value := app.state.db.Get(prefixKey(reqQuery.Data))
resQuery.Index = -1 // TODO make Proof return index
resQuery.Key = reqQuery.Data
resQuery.Value = value
if value != nil {
resQuery.Log = "exists"
} else {
resQuery.Log = "does not exist"
}
return
} else {
value := app.state.db.Get(prefixKey(reqQuery.Data))
resQuery.Value = value
if value != nil {
resQuery.Log = "exists"
} else {
resQuery.Log = "does not exist"
}
return
}
}

View File

@ -1,310 +0,0 @@
package dummy
import (
"bytes"
"io/ioutil"
"sort"
"testing"
"github.com/stretchr/testify/require"
cmn "github.com/tendermint/tmlibs/common"
"github.com/tendermint/tmlibs/log"
abcicli "github.com/tendermint/abci/client"
"github.com/tendermint/abci/example/code"
abciserver "github.com/tendermint/abci/server"
"github.com/tendermint/abci/types"
)
func testDummy(t *testing.T, app types.Application, tx []byte, key, value string) {
ar := app.DeliverTx(tx)
require.False(t, ar.IsErr(), ar)
// repeating tx doesn't raise error
ar = app.DeliverTx(tx)
require.False(t, ar.IsErr(), ar)
// make sure query is fine
resQuery := app.Query(types.RequestQuery{
Path: "/store",
Data: []byte(key),
})
require.Equal(t, code.CodeTypeOK, resQuery.Code)
require.Equal(t, value, string(resQuery.Value))
// make sure proof is fine
resQuery = app.Query(types.RequestQuery{
Path: "/store",
Data: []byte(key),
Prove: true,
})
require.EqualValues(t, code.CodeTypeOK, resQuery.Code)
require.Equal(t, value, string(resQuery.Value))
}
func TestDummyKV(t *testing.T) {
dummy := NewDummyApplication()
key := "abc"
value := key
tx := []byte(key)
testDummy(t, dummy, tx, key, value)
value = "def"
tx = []byte(key + "=" + value)
testDummy(t, dummy, tx, key, value)
}
func TestPersistentDummyKV(t *testing.T) {
dir, err := ioutil.TempDir("/tmp", "abci-dummy-test") // TODO
if err != nil {
t.Fatal(err)
}
dummy := NewPersistentDummyApplication(dir)
key := "abc"
value := key
tx := []byte(key)
testDummy(t, dummy, tx, key, value)
value = "def"
tx = []byte(key + "=" + value)
testDummy(t, dummy, tx, key, value)
}
func TestPersistentDummyInfo(t *testing.T) {
dir, err := ioutil.TempDir("/tmp", "abci-dummy-test") // TODO
if err != nil {
t.Fatal(err)
}
dummy := NewPersistentDummyApplication(dir)
InitDummy(dummy)
height := int64(0)
resInfo := dummy.Info(types.RequestInfo{})
if resInfo.LastBlockHeight != height {
t.Fatalf("expected height of %d, got %d", height, resInfo.LastBlockHeight)
}
// make and apply block
height = int64(1)
hash := []byte("foo")
header := types.Header{
Height: int64(height),
}
dummy.BeginBlock(types.RequestBeginBlock{hash, header, nil, nil})
dummy.EndBlock(types.RequestEndBlock{header.Height})
dummy.Commit()
resInfo = dummy.Info(types.RequestInfo{})
if resInfo.LastBlockHeight != height {
t.Fatalf("expected height of %d, got %d", height, resInfo.LastBlockHeight)
}
}
// add a validator, remove a validator, update a validator
func TestValUpdates(t *testing.T) {
dir, err := ioutil.TempDir("/tmp", "abci-dummy-test") // TODO
if err != nil {
t.Fatal(err)
}
dummy := NewPersistentDummyApplication(dir)
// init with some validators
total := 10
nInit := 5
vals := RandVals(total)
// iniitalize with the first nInit
dummy.InitChain(types.RequestInitChain{
Validators: vals[:nInit],
})
vals1, vals2 := vals[:nInit], dummy.Validators()
valsEqual(t, vals1, vals2)
var v1, v2, v3 types.Validator
// add some validators
v1, v2 = vals[nInit], vals[nInit+1]
diff := []types.Validator{v1, v2}
tx1 := MakeValSetChangeTx(v1.PubKey, v1.Power)
tx2 := MakeValSetChangeTx(v2.PubKey, v2.Power)
makeApplyBlock(t, dummy, 1, diff, tx1, tx2)
vals1, vals2 = vals[:nInit+2], dummy.Validators()
valsEqual(t, vals1, vals2)
// remove some validators
v1, v2, v3 = vals[nInit-2], vals[nInit-1], vals[nInit]
v1.Power = 0
v2.Power = 0
v3.Power = 0
diff = []types.Validator{v1, v2, v3}
tx1 = MakeValSetChangeTx(v1.PubKey, v1.Power)
tx2 = MakeValSetChangeTx(v2.PubKey, v2.Power)
tx3 := MakeValSetChangeTx(v3.PubKey, v3.Power)
makeApplyBlock(t, dummy, 2, diff, tx1, tx2, tx3)
vals1 = append(vals[:nInit-2], vals[nInit+1])
vals2 = dummy.Validators()
valsEqual(t, vals1, vals2)
// update some validators
v1 = vals[0]
if v1.Power == 5 {
v1.Power = 6
} else {
v1.Power = 5
}
diff = []types.Validator{v1}
tx1 = MakeValSetChangeTx(v1.PubKey, v1.Power)
makeApplyBlock(t, dummy, 3, diff, tx1)
vals1 = append([]types.Validator{v1}, vals1[1:]...)
vals2 = dummy.Validators()
valsEqual(t, vals1, vals2)
}
func makeApplyBlock(t *testing.T, dummy types.Application, heightInt int, diff []types.Validator, txs ...[]byte) {
// make and apply block
height := int64(heightInt)
hash := []byte("foo")
header := types.Header{
Height: height,
}
dummy.BeginBlock(types.RequestBeginBlock{hash, header, nil, nil})
for _, tx := range txs {
if r := dummy.DeliverTx(tx); r.IsErr() {
t.Fatal(r)
}
}
resEndBlock := dummy.EndBlock(types.RequestEndBlock{header.Height})
dummy.Commit()
valsEqual(t, diff, resEndBlock.ValidatorUpdates)
}
// order doesn't matter
func valsEqual(t *testing.T, vals1, vals2 []types.Validator) {
if len(vals1) != len(vals2) {
t.Fatalf("vals dont match in len. got %d, expected %d", len(vals2), len(vals1))
}
sort.Sort(types.Validators(vals1))
sort.Sort(types.Validators(vals2))
for i, v1 := range vals1 {
v2 := vals2[i]
if !bytes.Equal(v1.PubKey, v2.PubKey) ||
v1.Power != v2.Power {
t.Fatalf("vals dont match at index %d. got %X/%d , expected %X/%d", i, v2.PubKey, v2.Power, v1.PubKey, v1.Power)
}
}
}
func makeSocketClientServer(app types.Application, name string) (abcicli.Client, cmn.Service, error) {
// Start the listener
socket := cmn.Fmt("unix://%s.sock", name)
logger := log.TestingLogger()
server := abciserver.NewSocketServer(socket, app)
server.SetLogger(logger.With("module", "abci-server"))
if err := server.Start(); err != nil {
return nil, nil, err
}
// Connect to the socket
client := abcicli.NewSocketClient(socket, false)
client.SetLogger(logger.With("module", "abci-client"))
if err := client.Start(); err != nil {
server.Stop()
return nil, nil, err
}
return client, server, nil
}
func makeGRPCClientServer(app types.Application, name string) (abcicli.Client, cmn.Service, error) {
// Start the listener
socket := cmn.Fmt("unix://%s.sock", name)
logger := log.TestingLogger()
gapp := types.NewGRPCApplication(app)
server := abciserver.NewGRPCServer(socket, gapp)
server.SetLogger(logger.With("module", "abci-server"))
if err := server.Start(); err != nil {
return nil, nil, err
}
client := abcicli.NewGRPCClient(socket, true)
client.SetLogger(logger.With("module", "abci-client"))
if err := client.Start(); err != nil {
server.Stop()
return nil, nil, err
}
return client, server, nil
}
func TestClientServer(t *testing.T) {
// set up socket app
dummy := NewDummyApplication()
client, server, err := makeSocketClientServer(dummy, "dummy-socket")
require.Nil(t, err)
defer server.Stop()
defer client.Stop()
runClientTests(t, client)
// set up grpc app
dummy = NewDummyApplication()
gclient, gserver, err := makeGRPCClientServer(dummy, "dummy-grpc")
require.Nil(t, err)
defer gserver.Stop()
defer gclient.Stop()
runClientTests(t, gclient)
}
func runClientTests(t *testing.T, client abcicli.Client) {
// run some tests....
key := "abc"
value := key
tx := []byte(key)
testClient(t, client, tx, key, value)
value = "def"
tx = []byte(key + "=" + value)
testClient(t, client, tx, key, value)
}
func testClient(t *testing.T, app abcicli.Client, tx []byte, key, value string) {
ar, err := app.DeliverTxSync(tx)
require.NoError(t, err)
require.False(t, ar.IsErr(), ar)
// repeating tx doesn't raise error
ar, err = app.DeliverTxSync(tx)
require.NoError(t, err)
require.False(t, ar.IsErr(), ar)
// make sure query is fine
resQuery, err := app.QuerySync(types.RequestQuery{
Path: "/store",
Data: []byte(key),
})
require.Nil(t, err)
require.Equal(t, code.CodeTypeOK, resQuery.Code)
require.Equal(t, value, string(resQuery.Value))
// make sure proof is fine
resQuery, err = app.QuerySync(types.RequestQuery{
Path: "/store",
Data: []byte(key),
Prove: true,
})
require.Nil(t, err)
require.Equal(t, code.CodeTypeOK, resQuery.Code)
require.Equal(t, value, string(resQuery.Value))
}

View File

@ -1,205 +0,0 @@
package dummy
import (
"bytes"
"encoding/hex"
"fmt"
"strconv"
"strings"
"github.com/tendermint/abci/example/code"
"github.com/tendermint/abci/types"
cmn "github.com/tendermint/tmlibs/common"
dbm "github.com/tendermint/tmlibs/db"
"github.com/tendermint/tmlibs/log"
)
const (
ValidatorSetChangePrefix string = "val:"
)
//-----------------------------------------
var _ types.Application = (*PersistentDummyApplication)(nil)
type PersistentDummyApplication struct {
app *DummyApplication
// validator set
ValUpdates []types.Validator
logger log.Logger
}
func NewPersistentDummyApplication(dbDir string) *PersistentDummyApplication {
name := "dummy"
db, err := dbm.NewGoLevelDB(name, dbDir)
if err != nil {
panic(err)
}
state := loadState(db)
return &PersistentDummyApplication{
app: &DummyApplication{state: state},
logger: log.NewNopLogger(),
}
}
func (app *PersistentDummyApplication) SetLogger(l log.Logger) {
app.logger = l
}
func (app *PersistentDummyApplication) Info(req types.RequestInfo) types.ResponseInfo {
res := app.app.Info(req)
res.LastBlockHeight = app.app.state.Height
res.LastBlockAppHash = app.app.state.AppHash
return res
}
func (app *PersistentDummyApplication) SetOption(req types.RequestSetOption) types.ResponseSetOption {
return app.app.SetOption(req)
}
// tx is either "val:pubkey/power" or "key=value" or just arbitrary bytes
func (app *PersistentDummyApplication) DeliverTx(tx []byte) types.ResponseDeliverTx {
// if it starts with "val:", update the validator set
// format is "val:pubkey/power"
if isValidatorTx(tx) {
// update validators in the merkle tree
// and in app.ValUpdates
return app.execValidatorTx(tx)
}
// otherwise, update the key-value store
return app.app.DeliverTx(tx)
}
func (app *PersistentDummyApplication) CheckTx(tx []byte) types.ResponseCheckTx {
return app.app.CheckTx(tx)
}
// Commit will panic if InitChain was not called
func (app *PersistentDummyApplication) Commit() types.ResponseCommit {
return app.app.Commit()
}
func (app *PersistentDummyApplication) Query(reqQuery types.RequestQuery) types.ResponseQuery {
return app.app.Query(reqQuery)
}
// Save the validators in the merkle tree
func (app *PersistentDummyApplication) InitChain(req types.RequestInitChain) types.ResponseInitChain {
for _, v := range req.Validators {
r := app.updateValidator(v)
if r.IsErr() {
app.logger.Error("Error updating validators", "r", r)
}
}
return types.ResponseInitChain{}
}
// Track the block hash and header information
func (app *PersistentDummyApplication) BeginBlock(req types.RequestBeginBlock) types.ResponseBeginBlock {
// reset valset changes
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{ValidatorUpdates: app.ValUpdates}
}
//---------------------------------------------
// update validators
func (app *PersistentDummyApplication) Validators() (validators []types.Validator) {
itr := app.app.state.db.Iterator(nil, nil)
for ; itr.Valid(); itr.Next() {
if isValidatorTx(itr.Key()) {
validator := new(types.Validator)
err := types.ReadMessage(bytes.NewBuffer(itr.Value()), validator)
if err != nil {
panic(err)
}
validators = append(validators, *validator)
}
}
return
}
func MakeValSetChangeTx(pubkey []byte, power int64) []byte {
return []byte(cmn.Fmt("val:%X/%d", pubkey, power))
}
func isValidatorTx(tx []byte) bool {
return strings.HasPrefix(string(tx), ValidatorSetChangePrefix)
}
// format is "val:pubkey1/power1,addr2/power2,addr3/power3"tx
func (app *PersistentDummyApplication) execValidatorTx(tx []byte) types.ResponseDeliverTx {
tx = tx[len(ValidatorSetChangePrefix):]
//get the pubkey and power
pubKeyAndPower := strings.Split(string(tx), "/")
if len(pubKeyAndPower) != 2 {
return types.ResponseDeliverTx{
Code: code.CodeTypeEncodingError,
Log: fmt.Sprintf("Expected 'pubkey/power'. Got %v", pubKeyAndPower)}
}
pubkeyS, powerS := pubKeyAndPower[0], pubKeyAndPower[1]
// decode the pubkey, ensuring its go-crypto encoded
pubkey, err := hex.DecodeString(pubkeyS)
if err != nil {
return types.ResponseDeliverTx{
Code: code.CodeTypeEncodingError,
Log: fmt.Sprintf("Pubkey (%s) is invalid hex", pubkeyS)}
}
/*_, err = crypto.PubKeyFromBytes(pubkey)
if err != nil {
return types.ResponseDeliverTx{
Code: code.CodeTypeEncodingError,
Log: fmt.Sprintf("Pubkey (%X) is invalid go-crypto encoded", pubkey)}
}*/
// decode the power
power, err := strconv.ParseInt(powerS, 10, 64)
if err != nil {
return types.ResponseDeliverTx{
Code: code.CodeTypeEncodingError,
Log: fmt.Sprintf("Power (%s) is not an int", powerS)}
}
// update
return app.updateValidator(types.Validator{pubkey, power})
}
// add, update, or remove a validator
func (app *PersistentDummyApplication) updateValidator(v types.Validator) types.ResponseDeliverTx {
key := []byte("val:" + string(v.PubKey))
if v.Power == 0 {
// remove validator
if !app.app.state.db.Has(key) {
return types.ResponseDeliverTx{
Code: code.CodeTypeUnauthorized,
Log: fmt.Sprintf("Cannot remove non-existent validator %X", key)}
}
app.app.state.db.Delete(key)
} else {
// add or update validator
value := bytes.NewBuffer(make([]byte, 0))
if err := types.WriteMessage(&v, value); err != nil {
return types.ResponseDeliverTx{
Code: code.CodeTypeEncodingError,
Log: fmt.Sprintf("Error encoding validator: %v", err)}
}
app.app.state.db.Set(key, value.Bytes())
}
// we only update the changes array if we successfully updated the tree
app.ValUpdates = append(app.ValUpdates, v)
return types.ResponseDeliverTx{Code: code.CodeTypeOK}
}

View File

@ -8,9 +8,12 @@ import (
// RandVal creates one random validator, with a key derived // RandVal creates one random validator, with a key derived
// from the input value // from the input value
func RandVal(i int) types.Validator { func RandVal(i int) types.Validator {
pubkey := cmn.RandBytes(33) addr := cmn.RandBytes(20)
pubkey := cmn.RandBytes(32)
power := cmn.RandUint16() + 1 power := cmn.RandUint16() + 1
return types.Validator{pubkey, int64(power)} v := types.Ed25519Validator(pubkey, int64(power))
v.Address = addr
return v
} }
// RandVals returns a list of cnt validators for initializing // RandVals returns a list of cnt validators for initializing

View File

@ -198,7 +198,7 @@ func valsEqual(t *testing.T, vals1, vals2 []types.Validator) {
sort.Sort(types.Validators(vals2)) sort.Sort(types.Validators(vals2))
for i, v1 := range vals1 { for i, v1 := range vals1 {
v2 := vals2[i] v2 := vals2[i]
if !bytes.Equal(v1.PubKey, v2.PubKey) || if !bytes.Equal(v1.PubKey.Data, v2.PubKey.Data) ||
v1.Power != v2.Power { v1.Power != v2.Power {
t.Fatalf("vals dont match at index %d. got %X/%d , expected %X/%d", i, v2.PubKey, v2.Power, v1.PubKey, v1.Power) t.Fatalf("vals dont match at index %d. got %X/%d , expected %X/%d", i, v2.PubKey, v2.Power, v1.PubKey, v1.Power)
} }

View File

@ -129,15 +129,16 @@ func (app *PersistentKVStoreApplication) Validators() (validators []types.Valida
return return
} }
func MakeValSetChangeTx(pubkey []byte, power int64) []byte { func MakeValSetChangeTx(pubkey types.PubKey, power int64) []byte {
return []byte(cmn.Fmt("val:%X/%d", pubkey, power)) return []byte(cmn.Fmt("val:%X/%d", pubkey.Data, power))
} }
func isValidatorTx(tx []byte) bool { func isValidatorTx(tx []byte) bool {
return strings.HasPrefix(string(tx), ValidatorSetChangePrefix) return strings.HasPrefix(string(tx), ValidatorSetChangePrefix)
} }
// format is "val:pubkey1/power1,addr2/power2,addr3/power3"tx // format is "val:pubkey/power"
// pubkey is raw 32-byte ed25519 key
func (app *PersistentKVStoreApplication) execValidatorTx(tx []byte) types.ResponseDeliverTx { func (app *PersistentKVStoreApplication) execValidatorTx(tx []byte) types.ResponseDeliverTx {
tx = tx[len(ValidatorSetChangePrefix):] tx = tx[len(ValidatorSetChangePrefix):]
@ -150,19 +151,13 @@ func (app *PersistentKVStoreApplication) execValidatorTx(tx []byte) types.Respon
} }
pubkeyS, powerS := pubKeyAndPower[0], pubKeyAndPower[1] pubkeyS, powerS := pubKeyAndPower[0], pubKeyAndPower[1]
// decode the pubkey, ensuring its go-crypto encoded // decode the pubkey
pubkey, err := hex.DecodeString(pubkeyS) pubkey, err := hex.DecodeString(pubkeyS)
if err != nil { if err != nil {
return types.ResponseDeliverTx{ return types.ResponseDeliverTx{
Code: code.CodeTypeEncodingError, Code: code.CodeTypeEncodingError,
Log: fmt.Sprintf("Pubkey (%s) is invalid hex", pubkeyS)} Log: fmt.Sprintf("Pubkey (%s) is invalid hex", pubkeyS)}
} }
/*_, err = crypto.PubKeyFromBytes(pubkey)
if err != nil {
return types.ResponseDeliverTx{
Code: code.CodeTypeEncodingError,
Log: fmt.Sprintf("Pubkey (%X) is invalid go-crypto encoded", pubkey)}
}*/
// decode the power // decode the power
power, err := strconv.ParseInt(powerS, 10, 64) power, err := strconv.ParseInt(powerS, 10, 64)
@ -173,12 +168,12 @@ func (app *PersistentKVStoreApplication) execValidatorTx(tx []byte) types.Respon
} }
// update // update
return app.updateValidator(types.Validator{pubkey, power}) return app.updateValidator(types.Ed25519Validator(pubkey, int64(power)))
} }
// add, update, or remove a validator // add, update, or remove a validator
func (app *PersistentKVStoreApplication) updateValidator(v types.Validator) types.ResponseDeliverTx { func (app *PersistentKVStoreApplication) updateValidator(v types.Validator) types.ResponseDeliverTx {
key := []byte("val:" + string(v.PubKey)) key := []byte("val:" + string(v.PubKey.Data))
if v.Power == 0 { if v.Power == 0 {
// remove validator // remove validator
if !app.app.state.db.Has(key) { if !app.app.state.db.Has(key) {

View File

@ -16,7 +16,7 @@ func InitChain(client abcicli.Client) error {
for i := 0; i < total; i++ { for i := 0; i < total; i++ {
pubkey := cmn.RandBytes(33) pubkey := cmn.RandBytes(33)
power := cmn.RandInt() power := cmn.RandInt()
vals[i] = types.Validator{pubkey, int64(power)} vals[i] = types.Ed25519Validator(pubkey, int64(power))
} }
_, err := client.InitChainSync(types.RequestInitChain{ _, err := client.InitChainSync(types.RequestInitChain{
Validators: vals, Validators: vals,

16
types/pubkey.go Normal file
View File

@ -0,0 +1,16 @@
package types
const (
PubKeyEd25519 = "ed25519"
)
func Ed25519Validator(pubkey []byte, power int64) Validator {
return Validator{
// Address:
PubKey: PubKey{
Type: PubKeyEd25519,
Data: pubkey,
},
Power: power,
}
}

View File

@ -38,9 +38,9 @@ It has these top-level messages:
TxSize TxSize
BlockGossip BlockGossip
Header Header
BlockID
PartSetHeader
Validator Validator
SigningValidator
PubKey
Evidence Evidence
*/ */
//nolint: gas //nolint: gas
@ -596,10 +596,10 @@ func (m *RequestQuery) GetProve() bool {
} }
type RequestBeginBlock struct { type RequestBeginBlock struct {
Hash []byte `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"` Hash []byte `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"`
Header Header `protobuf:"bytes,2,opt,name=header" json:"header"` Header Header `protobuf:"bytes,2,opt,name=header" json:"header"`
AbsentValidators [][]byte `protobuf:"bytes,3,rep,name=absent_validators,json=absentValidators" json:"absent_validators,omitempty"` Validators []*SigningValidator `protobuf:"bytes,3,rep,name=validators" json:"validators,omitempty"`
ByzantineValidators []Evidence `protobuf:"bytes,4,rep,name=byzantine_validators,json=byzantineValidators" json:"byzantine_validators"` ByzantineValidators []Evidence `protobuf:"bytes,4,rep,name=byzantine_validators,json=byzantineValidators" json:"byzantine_validators"`
} }
func (m *RequestBeginBlock) Reset() { *m = RequestBeginBlock{} } func (m *RequestBeginBlock) Reset() { *m = RequestBeginBlock{} }
@ -621,9 +621,9 @@ func (m *RequestBeginBlock) GetHeader() Header {
return Header{} return Header{}
} }
func (m *RequestBeginBlock) GetAbsentValidators() [][]byte { func (m *RequestBeginBlock) GetValidators() []*SigningValidator {
if m != nil { if m != nil {
return m.AbsentValidators return m.Validators
} }
return nil return nil
} }
@ -1646,16 +1646,20 @@ func (m *BlockGossip) GetBlockPartSizeBytes() int32 {
return 0 return 0
} }
// just the minimum the app might need
type Header struct { type Header struct {
ChainID string `protobuf:"bytes,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` // basics
Height int64 `protobuf:"varint,2,opt,name=height,proto3" json:"height,omitempty"` ChainID string `protobuf:"bytes,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"`
Time int64 `protobuf:"varint,3,opt,name=time,proto3" json:"time,omitempty"` Height int64 `protobuf:"varint,2,opt,name=height,proto3" json:"height,omitempty"`
NumTxs int32 `protobuf:"varint,4,opt,name=num_txs,json=numTxs,proto3" json:"num_txs,omitempty"` Time int64 `protobuf:"varint,3,opt,name=time,proto3" json:"time,omitempty"`
LastBlockID BlockID `protobuf:"bytes,5,opt,name=last_block_id,json=lastBlockId" json:"last_block_id"` // txs
LastCommitHash []byte `protobuf:"bytes,6,opt,name=last_commit_hash,json=lastCommitHash,proto3" json:"last_commit_hash,omitempty"` NumTxs int32 `protobuf:"varint,4,opt,name=num_txs,json=numTxs,proto3" json:"num_txs,omitempty"`
DataHash []byte `protobuf:"bytes,7,opt,name=data_hash,json=dataHash,proto3" json:"data_hash,omitempty"` TotalTxs int64 `protobuf:"varint,5,opt,name=total_txs,json=totalTxs,proto3" json:"total_txs,omitempty"`
ValidatorsHash []byte `protobuf:"bytes,8,opt,name=validators_hash,json=validatorsHash,proto3" json:"validators_hash,omitempty"` // hashes
AppHash []byte `protobuf:"bytes,9,opt,name=app_hash,json=appHash,proto3" json:"app_hash,omitempty"` LastBlockHash []byte `protobuf:"bytes,6,opt,name=last_block_hash,json=lastBlockHash,proto3" json:"last_block_hash,omitempty"`
AppHash []byte `protobuf:"bytes,7,opt,name=app_hash,json=appHash,proto3" json:"app_hash,omitempty"`
// consensus
Proposer *Validator `protobuf:"bytes,8,opt,name=proposer" json:"proposer,omitempty"`
} }
func (m *Header) Reset() { *m = Header{} } func (m *Header) Reset() { *m = Header{} }
@ -1691,30 +1695,16 @@ func (m *Header) GetNumTxs() int32 {
return 0 return 0
} }
func (m *Header) GetLastBlockID() BlockID { func (m *Header) GetTotalTxs() int64 {
if m != nil { if m != nil {
return m.LastBlockID return m.TotalTxs
} }
return BlockID{} return 0
} }
func (m *Header) GetLastCommitHash() []byte { func (m *Header) GetLastBlockHash() []byte {
if m != nil { if m != nil {
return m.LastCommitHash return m.LastBlockHash
}
return nil
}
func (m *Header) GetDataHash() []byte {
if m != nil {
return m.DataHash
}
return nil
}
func (m *Header) GetValidatorsHash() []byte {
if m != nil {
return m.ValidatorsHash
} }
return nil return nil
} }
@ -1726,69 +1716,37 @@ func (m *Header) GetAppHash() []byte {
return nil return nil
} }
type BlockID struct { func (m *Header) GetProposer() *Validator {
Hash []byte `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"`
Parts PartSetHeader `protobuf:"bytes,2,opt,name=parts" json:"parts"`
}
func (m *BlockID) Reset() { *m = BlockID{} }
func (m *BlockID) String() string { return proto.CompactTextString(m) }
func (*BlockID) ProtoMessage() {}
func (*BlockID) Descriptor() ([]byte, []int) { return fileDescriptorTypes, []int{30} }
func (m *BlockID) GetHash() []byte {
if m != nil { if m != nil {
return m.Hash return m.Proposer
}
return nil
}
func (m *BlockID) GetParts() PartSetHeader {
if m != nil {
return m.Parts
}
return PartSetHeader{}
}
type PartSetHeader struct {
Total int32 `protobuf:"varint,1,opt,name=total,proto3" json:"total,omitempty"`
Hash []byte `protobuf:"bytes,2,opt,name=hash,proto3" json:"hash,omitempty"`
}
func (m *PartSetHeader) Reset() { *m = PartSetHeader{} }
func (m *PartSetHeader) String() string { return proto.CompactTextString(m) }
func (*PartSetHeader) ProtoMessage() {}
func (*PartSetHeader) Descriptor() ([]byte, []int) { return fileDescriptorTypes, []int{31} }
func (m *PartSetHeader) GetTotal() int32 {
if m != nil {
return m.Total
}
return 0
}
func (m *PartSetHeader) GetHash() []byte {
if m != nil {
return m.Hash
} }
return nil return nil
} }
// Validator
type Validator struct { type Validator struct {
PubKey []byte `protobuf:"bytes,1,opt,name=pub_key,json=pubKey,proto3" json:"pub_key,omitempty"` Address []byte `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"`
Power int64 `protobuf:"varint,2,opt,name=power,proto3" json:"power,omitempty"` PubKey PubKey `protobuf:"bytes,2,opt,name=pub_key,json=pubKey" json:"pub_key"`
Power int64 `protobuf:"varint,3,opt,name=power,proto3" json:"power,omitempty"`
} }
func (m *Validator) Reset() { *m = Validator{} } func (m *Validator) Reset() { *m = Validator{} }
func (m *Validator) String() string { return proto.CompactTextString(m) } func (m *Validator) String() string { return proto.CompactTextString(m) }
func (*Validator) ProtoMessage() {} func (*Validator) ProtoMessage() {}
func (*Validator) Descriptor() ([]byte, []int) { return fileDescriptorTypes, []int{32} } func (*Validator) Descriptor() ([]byte, []int) { return fileDescriptorTypes, []int{30} }
func (m *Validator) GetPubKey() []byte { func (m *Validator) GetAddress() []byte {
if m != nil {
return m.Address
}
return nil
}
func (m *Validator) GetPubKey() PubKey {
if m != nil { if m != nil {
return m.PubKey return m.PubKey
} }
return nil return PubKey{}
} }
func (m *Validator) GetPower() int64 { func (m *Validator) GetPower() int64 {
@ -1798,11 +1756,61 @@ func (m *Validator) GetPower() int64 {
return 0 return 0
} }
// Validator with an extra bool
type SigningValidator struct {
Validator *Validator `protobuf:"bytes,1,opt,name=validator" json:"validator,omitempty"`
SignedLastBlock bool `protobuf:"varint,2,opt,name=signed_last_block,json=signedLastBlock,proto3" json:"signed_last_block,omitempty"`
}
func (m *SigningValidator) Reset() { *m = SigningValidator{} }
func (m *SigningValidator) String() string { return proto.CompactTextString(m) }
func (*SigningValidator) ProtoMessage() {}
func (*SigningValidator) Descriptor() ([]byte, []int) { return fileDescriptorTypes, []int{31} }
func (m *SigningValidator) GetValidator() *Validator {
if m != nil {
return m.Validator
}
return nil
}
func (m *SigningValidator) GetSignedLastBlock() bool {
if m != nil {
return m.SignedLastBlock
}
return false
}
type PubKey struct {
Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"`
Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"`
}
func (m *PubKey) Reset() { *m = PubKey{} }
func (m *PubKey) String() string { return proto.CompactTextString(m) }
func (*PubKey) ProtoMessage() {}
func (*PubKey) Descriptor() ([]byte, []int) { return fileDescriptorTypes, []int{32} }
func (m *PubKey) GetType() string {
if m != nil {
return m.Type
}
return ""
}
func (m *PubKey) GetData() []byte {
if m != nil {
return m.Data
}
return nil
}
type Evidence struct { type Evidence struct {
Type []byte `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"`
PubKey []byte `protobuf:"bytes,2,opt,name=pub_key,json=pubKey,proto3" json:"pub_key,omitempty"` Validator *Validator `protobuf:"bytes,2,opt,name=validator" json:"validator,omitempty"`
Height int64 `protobuf:"varint,3,opt,name=height,proto3" json:"height,omitempty"` Height int64 `protobuf:"varint,3,opt,name=height,proto3" json:"height,omitempty"`
Time int64 `protobuf:"varint,4,opt,name=time,proto3" json:"time,omitempty"` Time int64 `protobuf:"varint,4,opt,name=time,proto3" json:"time,omitempty"`
TotalVotingPower int64 `protobuf:"varint,5,opt,name=total_voting_power,json=totalVotingPower,proto3" json:"total_voting_power,omitempty"`
} }
func (m *Evidence) Reset() { *m = Evidence{} } func (m *Evidence) Reset() { *m = Evidence{} }
@ -1810,16 +1818,16 @@ func (m *Evidence) String() string { return proto.CompactTextString(m
func (*Evidence) ProtoMessage() {} func (*Evidence) ProtoMessage() {}
func (*Evidence) Descriptor() ([]byte, []int) { return fileDescriptorTypes, []int{33} } func (*Evidence) Descriptor() ([]byte, []int) { return fileDescriptorTypes, []int{33} }
func (m *Evidence) GetType() []byte { func (m *Evidence) GetType() string {
if m != nil { if m != nil {
return m.Type return m.Type
} }
return nil return ""
} }
func (m *Evidence) GetPubKey() []byte { func (m *Evidence) GetValidator() *Validator {
if m != nil { if m != nil {
return m.PubKey return m.Validator
} }
return nil return nil
} }
@ -1838,6 +1846,13 @@ func (m *Evidence) GetTime() int64 {
return 0 return 0
} }
func (m *Evidence) GetTotalVotingPower() int64 {
if m != nil {
return m.TotalVotingPower
}
return 0
}
func init() { func init() {
proto.RegisterType((*Request)(nil), "types.Request") proto.RegisterType((*Request)(nil), "types.Request")
proto.RegisterType((*RequestEcho)(nil), "types.RequestEcho") proto.RegisterType((*RequestEcho)(nil), "types.RequestEcho")
@ -1869,9 +1884,9 @@ func init() {
proto.RegisterType((*TxSize)(nil), "types.TxSize") proto.RegisterType((*TxSize)(nil), "types.TxSize")
proto.RegisterType((*BlockGossip)(nil), "types.BlockGossip") proto.RegisterType((*BlockGossip)(nil), "types.BlockGossip")
proto.RegisterType((*Header)(nil), "types.Header") proto.RegisterType((*Header)(nil), "types.Header")
proto.RegisterType((*BlockID)(nil), "types.BlockID")
proto.RegisterType((*PartSetHeader)(nil), "types.PartSetHeader")
proto.RegisterType((*Validator)(nil), "types.Validator") proto.RegisterType((*Validator)(nil), "types.Validator")
proto.RegisterType((*SigningValidator)(nil), "types.SigningValidator")
proto.RegisterType((*PubKey)(nil), "types.PubKey")
proto.RegisterType((*Evidence)(nil), "types.Evidence") proto.RegisterType((*Evidence)(nil), "types.Evidence")
} }
@ -2280,117 +2295,117 @@ var _ABCIApplication_serviceDesc = grpc.ServiceDesc{
func init() { proto.RegisterFile("types/types.proto", fileDescriptorTypes) } func init() { proto.RegisterFile("types/types.proto", fileDescriptorTypes) }
var fileDescriptorTypes = []byte{ var fileDescriptorTypes = []byte{
// 1784 bytes of a gzipped FileDescriptorProto // 1789 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe4, 0x58, 0xcd, 0x72, 0x1b, 0xc7, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe4, 0x58, 0x4b, 0x73, 0x1c, 0x49,
0x11, 0x26, 0xfe, 0xb1, 0x0d, 0x10, 0x24, 0x87, 0xfa, 0x81, 0xe0, 0x4a, 0x89, 0xb5, 0x49, 0xd9, 0x11, 0xd6, 0xbc, 0xa7, 0x53, 0x4f, 0x97, 0xfc, 0x18, 0xcf, 0x06, 0x61, 0x47, 0x43, 0x18, 0x99,
0x60, 0x24, 0x13, 0x09, 0x1d, 0xa9, 0x44, 0x39, 0xe5, 0x0a, 0x41, 0x2a, 0x02, 0x4a, 0x49, 0xcc, 0xd5, 0x6a, 0x40, 0x8b, 0x8d, 0xbd, 0x4b, 0x6c, 0x20, 0x69, 0xcd, 0x8e, 0xc2, 0x3c, 0x44, 0xdb,
0xac, 0x65, 0xa5, 0x2a, 0x17, 0xd4, 0x60, 0x77, 0x08, 0x6c, 0x09, 0xfb, 0x63, 0xcc, 0x80, 0x06, 0x6b, 0x22, 0xb8, 0x4c, 0xd4, 0x4c, 0x97, 0x7a, 0x2a, 0x3c, 0xd3, 0xdd, 0xdb, 0x55, 0xa3, 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0x56, 0xf5, 0xfa, 0xd3, 0xaf, 0xbc, 0xb8, 0xb0, 0x47, 0xd0, 0x8e, 0x51, 0xbf, 0xf2,
0x34, 0x32, 0x29, 0x15, 0x37, 0x3d, 0x28, 0xf5, 0x36, 0x5e, 0x8e, 0xc8, 0x29, 0x40, 0xaa, 0xca, 0x89, 0xa4, 0x5f, 0x3d, 0xd9, 0xa3, 0x93, 0xd9, 0xbc, 0xb9, 0xee, 0x85, 0xaa, 0xbf, 0xf6, 0x86,
0xda, 0xf8, 0x52, 0xd4, 0xdb, 0x7c, 0xe9, 0x21, 0x9f, 0x42, 0x33, 0xb9, 0xc8, 0x16, 0xbf, 0xe0, 0xc5, 0x4e, 0x00, 0x72, 0xa3, 0xda, 0xda, 0xa7, 0xa7, 0xfe, 0xfa, 0x9b, 0x13, 0xfb, 0x18, 0xba,
0xf4, 0x36, 0xdd, 0x43, 0xa6, 0x75, 0xf9, 0xca, 0xf7, 0xc9, 0x7f, 0x03, 0x00, 0x00, 0xff, 0xff, 0xd9, 0x6d, 0xb8, 0xfa, 0x49, 0xa8, 0xbf, 0xee, 0x32, 0x33, 0x6e, 0xd3, 0xb3, 0xe1, 0x87, 0xff,
0x0e, 0x79, 0xb0, 0x4d, 0x61, 0x14, 0x00, 0x00, 0x09, 0x00, 0x00, 0xff, 0xff, 0x39, 0xa6, 0xae, 0x4d, 0xb2, 0x14, 0x00, 0x00,
} }

View File

@ -61,7 +61,7 @@ message RequestQuery {
message RequestBeginBlock { message RequestBeginBlock {
bytes hash = 1; bytes hash = 1;
Header header = 2 [(gogoproto.nullable)=false]; Header header = 2 [(gogoproto.nullable)=false];
repeated bytes absent_validators = 3; repeated SigningValidator validators = 3;
repeated Evidence byzantine_validators = 4 [(gogoproto.nullable)=false]; repeated Evidence byzantine_validators = 4 [(gogoproto.nullable)=false];
} }
@ -214,38 +214,49 @@ message BlockGossip {
//---------------------------------------- //----------------------------------------
// Blockchain Types // Blockchain Types
// just the minimum the app might need
message Header { message Header {
// basics
string chain_id = 1 [(gogoproto.customname)="ChainID"]; string chain_id = 1 [(gogoproto.customname)="ChainID"];
int64 height = 2; int64 height = 2;
int64 time = 3; int64 time = 3;
// txs
int32 num_txs = 4; int32 num_txs = 4;
BlockID last_block_id = 5 [(gogoproto.customname)="LastBlockID", (gogoproto.nullable)=false]; int64 total_txs = 5;
bytes last_commit_hash = 6;
bytes data_hash = 7; // hashes
bytes validators_hash = 8; bytes last_block_hash = 6;
bytes app_hash = 9; bytes app_hash = 7;
}
// consensus
message BlockID { Validator proposer = 8;
bytes hash = 1;
PartSetHeader parts = 2 [(gogoproto.nullable)=false];
}
message PartSetHeader {
int32 total = 1;
bytes hash = 2;
} }
// Validator
message Validator { message Validator {
bytes pub_key = 1; bytes address = 1;
int64 power = 2; PubKey pub_key = 2 [(gogoproto.nullable)=false];
int64 power = 3;
}
// Validator with an extra bool
message SigningValidator {
Validator validator = 1;
bool signed_last_block = 2;
}
message PubKey {
string type = 1;
bytes data = 2;
} }
message Evidence { message Evidence {
bytes type = 1; string type = 1;
bytes pub_key = 2; Validator validator = 2;
int64 height = 3; int64 height = 3;
int64 time = 4; int64 time = 4;
int64 total_voting_power = 5;
} }
//---------------------------------------- //----------------------------------------

View File

@ -4,6 +4,8 @@ import (
"bytes" "bytes"
"encoding/json" "encoding/json"
"sort" "sort"
cmn "github.com/tendermint/tmlibs/common"
) )
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
@ -25,7 +27,7 @@ func (v Validators) Len() int {
// XXX: doesn't distinguish same validator with different power // XXX: doesn't distinguish same validator with different power
func (v Validators) Less(i, j int) bool { func (v Validators) Less(i, j int) bool {
return bytes.Compare(v[i].PubKey, v[j].PubKey) <= 0 return bytes.Compare(v[i].PubKey.Data, v[j].PubKey.Data) <= 0
} }
func (v Validators) Swap(i, j int) { func (v Validators) Swap(i, j int) {
@ -37,7 +39,11 @@ func (v Validators) Swap(i, j int) {
func ValidatorsString(vs Validators) string { func ValidatorsString(vs Validators) string {
s := make([]validatorPretty, len(vs)) s := make([]validatorPretty, len(vs))
for i, v := range vs { for i, v := range vs {
s[i] = validatorPretty(v) s[i] = validatorPretty{
Address: v.Address,
PubKey: v.PubKey.Data,
Power: v.Power,
}
} }
b, err := json.Marshal(s) b, err := json.Marshal(s)
if err != nil { if err != nil {
@ -47,6 +53,7 @@ func ValidatorsString(vs Validators) string {
} }
type validatorPretty struct { type validatorPretty struct {
PubKey []byte `json:"pub_key"` Address cmn.HexBytes `json:"address"`
Power int64 `json:"power"` PubKey []byte `json:"pub_key"`
Power int64 `json:"power"`
} }