From dec703bd01256d0924286256a3de991aeb1c0b0e Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Sat, 1 Feb 2020 14:34:19 -0500 Subject: [PATCH 01/46] Migrate staking types to proto --- go.mod | 1 + .../proto/tendermint/abci/types/types.proto | 350 ++ .../tendermint/crypto/merkle/merkle.proto | 31 + .../proto/tendermint/libs/kv/types.proto | 29 + types/types.pb.go | 553 +- types/types.proto | 12 + x/staking/types/codec.go | 30 +- x/staking/types/commission.go | 38 +- x/staking/types/delegation.go | 207 +- x/staking/types/historical_info.go | 40 +- x/staking/types/params.go | 53 +- x/staking/types/types.pb.go | 4790 +++++++++++++++++ x/staking/types/types.proto | 273 + x/staking/types/validator.go | 193 +- 14 files changed, 6302 insertions(+), 298 deletions(-) create mode 100644 third_party/proto/tendermint/abci/types/types.proto create mode 100644 third_party/proto/tendermint/crypto/merkle/merkle.proto create mode 100644 third_party/proto/tendermint/libs/kv/types.proto create mode 100644 x/staking/types/types.pb.go create mode 100644 x/staking/types/types.proto diff --git a/go.mod b/go.mod index 6ebb9fdde282..77bb6bda0ee1 100644 --- a/go.mod +++ b/go.mod @@ -9,6 +9,7 @@ require ( github.com/cosmos/ledger-cosmos-go v0.11.1 github.com/gogo/protobuf v1.3.1 github.com/golang/mock v1.3.1-0.20190508161146-9fa652df1129 + github.com/golang/protobuf v1.3.2 github.com/gorilla/mux v1.7.3 github.com/hashicorp/golang-lru v0.5.4 github.com/mattn/go-isatty v0.0.12 diff --git a/third_party/proto/tendermint/abci/types/types.proto b/third_party/proto/tendermint/abci/types/types.proto new file mode 100644 index 000000000000..eff32d4c5322 --- /dev/null +++ b/third_party/proto/tendermint/abci/types/types.proto @@ -0,0 +1,350 @@ +syntax = "proto3"; +package tendermint.abci.types; +option go_package = "github.com/tendermint/tendermint/abci/types"; + +// For more information on gogo.proto, see: +// https://github.com/gogo/protobuf/blob/master/extensions.md +import "third_party/proto/gogoproto/gogo.proto"; +import "third_party/proto/tendermint/crypto/merkle/merkle.proto"; +import "third_party/proto/tendermint/libs/kv/types.proto"; +import "google/protobuf/timestamp.proto"; +import "google/protobuf/duration.proto"; + +// This file is copied from http://github.com/tendermint/abci +// NOTE: When using custom types, mind the warnings. +// https://github.com/gogo/protobuf/blob/master/custom_types.md#warnings-and-issues + +option (gogoproto.marshaler_all) = true; +option (gogoproto.unmarshaler_all) = true; +option (gogoproto.sizer_all) = true; +option (gogoproto.goproto_registration) = true; + +// Generate tests +option (gogoproto.populate_all) = true; +option (gogoproto.equal_all) = true; +option (gogoproto.testgen_all) = true; + +//---------------------------------------- +// Request types + +message Request { + 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; + } +} + +message RequestEcho { string message = 1; } + +message RequestFlush {} + +message RequestInfo { + string version = 1; + uint64 block_version = 2; + uint64 p2p_version = 3; +} + +// nondeterministic +message RequestSetOption { + string key = 1; + string value = 2; +} + +message RequestInitChain { + google.protobuf.Timestamp time = 1 + [ (gogoproto.nullable) = false, (gogoproto.stdtime) = true ]; + string chain_id = 2; + ConsensusParams consensus_params = 3; + repeated ValidatorUpdate validators = 4 [ (gogoproto.nullable) = false ]; + bytes app_state_bytes = 5; +} + +message RequestQuery { + bytes data = 1; + string path = 2; + int64 height = 3; + bool prove = 4; +} + +message RequestBeginBlock { + bytes hash = 1; + Header header = 2 [ (gogoproto.nullable) = false ]; + LastCommitInfo last_commit_info = 3 [ (gogoproto.nullable) = false ]; + repeated Evidence byzantine_validators = 4 [ (gogoproto.nullable) = false ]; +} + +enum CheckTxType { + New = 0; + Recheck = 1; +} + +message RequestCheckTx { + bytes tx = 1; + CheckTxType type = 2; +} + +message RequestDeliverTx { bytes tx = 1; } + +message RequestEndBlock { int64 height = 1; } + +message RequestCommit {} + +//---------------------------------------- +// Response types + +message Response { + oneof value { + ResponseException exception = 1; + ResponseEcho echo = 2; + ResponseFlush flush = 3; + ResponseInfo info = 4; + ResponseSetOption set_option = 5; + 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; + } +} + +// nondeterministic +message ResponseException { string error = 1; } + +message ResponseEcho { string message = 1; } + +message ResponseFlush {} + +message ResponseInfo { + string data = 1; + + string version = 2; + uint64 app_version = 3; + + int64 last_block_height = 4; + bytes last_block_app_hash = 5; +} + +// nondeterministic +message ResponseSetOption { + uint32 code = 1; + // bytes data = 2; + string log = 3; + string info = 4; +} + +message ResponseInitChain { + ConsensusParams consensus_params = 1; + repeated ValidatorUpdate validators = 2 [ (gogoproto.nullable) = false ]; +} + +message ResponseQuery { + uint32 code = 1; + // bytes data = 2; // use "value" instead. + string log = 3; // nondeterministic + string info = 4; // nondeterministic + int64 index = 5; + bytes key = 6; + bytes value = 7; + tendermint.crypto.merkle.Proof proof = 8; + int64 height = 9; + string codespace = 10; +} + +message ResponseBeginBlock { + repeated Event events = 1 [ + (gogoproto.nullable) = false, + (gogoproto.jsontag) = "events,omitempty" + ]; +} + +message ResponseCheckTx { + uint32 code = 1; + bytes data = 2; + string log = 3; // nondeterministic + string info = 4; // nondeterministic + int64 gas_wanted = 5; + int64 gas_used = 6; + repeated Event events = 7 [ + (gogoproto.nullable) = false, + (gogoproto.jsontag) = "events,omitempty" + ]; + string codespace = 8; +} + +message ResponseDeliverTx { + uint32 code = 1; + bytes data = 2; + string log = 3; // nondeterministic + string info = 4; // nondeterministic + int64 gas_wanted = 5; + int64 gas_used = 6; + repeated Event events = 7 [ + (gogoproto.nullable) = false, + (gogoproto.jsontag) = "events,omitempty" + ]; + string codespace = 8; +} + +message ResponseEndBlock { + repeated ValidatorUpdate validator_updates = 1 + [ (gogoproto.nullable) = false ]; + ConsensusParams consensus_param_updates = 2; + repeated Event events = 3 [ + (gogoproto.nullable) = false, + (gogoproto.jsontag) = "events,omitempty" + ]; +} + +message ResponseCommit { + // reserve 1 + bytes data = 2; +} + +//---------------------------------------- +// Misc. + +// ConsensusParams contains all consensus-relevant parameters +// that can be adjusted by the abci app +message ConsensusParams { + BlockParams block = 1; + EvidenceParams evidence = 2; + ValidatorParams validator = 3; +} + +// BlockParams contains limits on the block size. +message BlockParams { + // Note: must be greater than 0 + int64 max_bytes = 1; + // Note: must be greater or equal to -1 + int64 max_gas = 2; +} + +message EvidenceParams { + // Note: must be greater than 0 + int64 max_age_num_blocks = 1; + google.protobuf.Duration max_age_duration = 2 + [ (gogoproto.nullable) = false, (gogoproto.stdduration) = true ]; +} + +// ValidatorParams contains limits on validators. +message ValidatorParams { repeated string pub_key_types = 1; } + +message LastCommitInfo { + int32 round = 1; + repeated VoteInfo votes = 2 [ (gogoproto.nullable) = false ]; +} + +message Event { + string type = 1; + repeated tendermint.libs.kv.Pair attributes = 2 [ + (gogoproto.nullable) = false, + (gogoproto.jsontag) = "attributes,omitempty" + ]; +} + +//---------------------------------------- +// Blockchain Types + +message Header { + // basic block info + Version version = 1 [ (gogoproto.nullable) = false ]; + string chain_id = 2 [ (gogoproto.customname) = "ChainID" ]; + int64 height = 3; + google.protobuf.Timestamp time = 4 + [ (gogoproto.nullable) = false, (gogoproto.stdtime) = true ]; + + // prev block info + BlockID last_block_id = 5 [ (gogoproto.nullable) = false ]; + + // hashes of block data + bytes last_commit_hash = 6; // commit from validators from the last block + bytes data_hash = 7; // transactions + + // hashes from the app output from the prev block + bytes validators_hash = 8; // validators for the current block + bytes next_validators_hash = 9; // validators for the next block + bytes consensus_hash = 10; // consensus params for current block + bytes app_hash = 11; // state after txs from the previous block + bytes last_results_hash = + 12; // root hash of all results from the txs from the previous block + + // consensus info + bytes evidence_hash = 13; // evidence included in the block + bytes proposer_address = 14; // original proposer of the block +} + +message Version { + uint64 Block = 1; + uint64 App = 2; +} + +message BlockID { + bytes hash = 1; + PartSetHeader parts_header = 2 [ (gogoproto.nullable) = false ]; +} + +message PartSetHeader { + int32 total = 1; + bytes hash = 2; +} + +// Validator +message Validator { + bytes address = 1; + // PubKey pub_key = 2 [(gogoproto.nullable)=false]; + int64 power = 3; +} + +// ValidatorUpdate +message ValidatorUpdate { + PubKey pub_key = 1 [ (gogoproto.nullable) = false ]; + int64 power = 2; +} + +// VoteInfo +message VoteInfo { + Validator validator = 1 [ (gogoproto.nullable) = false ]; + bool signed_last_block = 2; +} + +message PubKey { + string type = 1; + bytes data = 2; +} + +message Evidence { + string type = 1; + Validator validator = 2 [ (gogoproto.nullable) = false ]; + int64 height = 3; + google.protobuf.Timestamp time = 4 + [ (gogoproto.nullable) = false, (gogoproto.stdtime) = true ]; + int64 total_voting_power = 5; +} + +//---------------------------------------- +// Service Definition + +service ABCIApplication { + rpc Echo(RequestEcho) returns (ResponseEcho); + rpc Flush(RequestFlush) returns (ResponseFlush); + rpc Info(RequestInfo) returns (ResponseInfo); + rpc SetOption(RequestSetOption) returns (ResponseSetOption); + rpc DeliverTx(RequestDeliverTx) returns (ResponseDeliverTx); + rpc CheckTx(RequestCheckTx) returns (ResponseCheckTx); + rpc Query(RequestQuery) returns (ResponseQuery); + rpc Commit(RequestCommit) returns (ResponseCommit); + rpc InitChain(RequestInitChain) returns (ResponseInitChain); + rpc BeginBlock(RequestBeginBlock) returns (ResponseBeginBlock); + rpc EndBlock(RequestEndBlock) returns (ResponseEndBlock); +} diff --git a/third_party/proto/tendermint/crypto/merkle/merkle.proto b/third_party/proto/tendermint/crypto/merkle/merkle.proto new file mode 100644 index 000000000000..9dbb2be074e8 --- /dev/null +++ b/third_party/proto/tendermint/crypto/merkle/merkle.proto @@ -0,0 +1,31 @@ +syntax = "proto3"; +package tendermint.crypto.merkle; +option go_package = "github.com/tendermint/tendermint/crypto/merkle"; + +// For more information on gogo.proto, see: +// https://github.com/gogo/protobuf/blob/master/extensions.md +import "third_party/proto/gogoproto/gogo.proto"; + +option (gogoproto.marshaler_all) = true; +option (gogoproto.unmarshaler_all) = true; +option (gogoproto.sizer_all) = true; + +option (gogoproto.populate_all) = true; +option (gogoproto.equal_all) = true; + +//---------------------------------------- +// Message types + +// ProofOp defines an operation used for calculating Merkle root +// The data could be arbitrary format, providing nessecary data +// for example neighbouring node hash +message ProofOp { + string type = 1; + bytes key = 2; + bytes data = 3; +} + +// Proof is Merkle proof defined by the list of ProofOps +message Proof { + repeated ProofOp ops = 1 [(gogoproto.nullable)=false]; +} diff --git a/third_party/proto/tendermint/libs/kv/types.proto b/third_party/proto/tendermint/libs/kv/types.proto new file mode 100644 index 000000000000..247022798347 --- /dev/null +++ b/third_party/proto/tendermint/libs/kv/types.proto @@ -0,0 +1,29 @@ +syntax = "proto3"; +package tendermint.libs.kv; +option go_package = "github.com/tendermint/tendermint/libs/kv"; + +import "third_party/proto/gogoproto/gogo.proto"; + +option (gogoproto.marshaler_all) = true; +option (gogoproto.unmarshaler_all) = true; +option (gogoproto.sizer_all) = true; +option (gogoproto.goproto_registration) = true; +// Generate tests +option (gogoproto.populate_all) = true; +option (gogoproto.equal_all) = true; +option (gogoproto.testgen_all) = true; + +//---------------------------------------- +// Abstract types + +// Define these here for compatibility but use tmlibs/common.KVPair. +message Pair { + bytes key = 1; + bytes value = 2; +} + +// Define these here for compatibility but use tmlibs/common.KI64Pair. +message KI64Pair { + bytes key = 1; + int64 value = 2; +} diff --git a/types/types.pb.go b/types/types.pb.go index 4ea0bfeec523..2f7560431406 100644 --- a/types/types.pb.go +++ b/types/types.pb.go @@ -4,12 +4,15 @@ package types import ( + bytes "bytes" fmt "fmt" _ "github.com/gogo/protobuf/gogoproto" proto "github.com/gogo/protobuf/proto" io "io" math "math" math_bits "math/bits" + reflect "reflect" + strings "strings" ) // Reference imports to suppress errors if they are not otherwise used. @@ -119,15 +122,115 @@ func (m *DecCoin) GetDenom() string { return "" } +// PublicKey defines a type to represent raw public key bytes. +type PublicKey struct { + // Types that are valid to be assigned to Pub: + // *PublicKey_Ed25519 + // *PublicKey_Secp256K1 + // *PublicKey_Sr25519 + Pub isPublicKey_Pub `protobuf_oneof:"pub"` +} + +func (m *PublicKey) Reset() { *m = PublicKey{} } +func (*PublicKey) ProtoMessage() {} +func (*PublicKey) Descriptor() ([]byte, []int) { + return fileDescriptor_2c0f90c600ad7e2e, []int{2} +} +func (m *PublicKey) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *PublicKey) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_PublicKey.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *PublicKey) XXX_Merge(src proto.Message) { + xxx_messageInfo_PublicKey.Merge(m, src) +} +func (m *PublicKey) XXX_Size() int { + return m.Size() +} +func (m *PublicKey) XXX_DiscardUnknown() { + xxx_messageInfo_PublicKey.DiscardUnknown(m) +} + +var xxx_messageInfo_PublicKey proto.InternalMessageInfo + +type isPublicKey_Pub interface { + isPublicKey_Pub() + Equal(interface{}) bool + MarshalTo([]byte) (int, error) + Size() int +} + +type PublicKey_Ed25519 struct { + Ed25519 []byte `protobuf:"bytes,1,opt,name=ed25519,proto3,oneof" json:"ed25519,omitempty"` +} +type PublicKey_Secp256K1 struct { + Secp256K1 []byte `protobuf:"bytes,2,opt,name=secp256k1,proto3,oneof" json:"secp256k1,omitempty"` +} +type PublicKey_Sr25519 struct { + Sr25519 []byte `protobuf:"bytes,3,opt,name=sr25519,proto3,oneof" json:"sr25519,omitempty"` +} + +func (*PublicKey_Ed25519) isPublicKey_Pub() {} +func (*PublicKey_Secp256K1) isPublicKey_Pub() {} +func (*PublicKey_Sr25519) isPublicKey_Pub() {} + +func (m *PublicKey) GetPub() isPublicKey_Pub { + if m != nil { + return m.Pub + } + return nil +} + +func (m *PublicKey) GetEd25519() []byte { + if x, ok := m.GetPub().(*PublicKey_Ed25519); ok { + return x.Ed25519 + } + return nil +} + +func (m *PublicKey) GetSecp256K1() []byte { + if x, ok := m.GetPub().(*PublicKey_Secp256K1); ok { + return x.Secp256K1 + } + return nil +} + +func (m *PublicKey) GetSr25519() []byte { + if x, ok := m.GetPub().(*PublicKey_Sr25519); ok { + return x.Sr25519 + } + return nil +} + +// XXX_OneofWrappers is for the internal use of the proto package. +func (*PublicKey) XXX_OneofWrappers() []interface{} { + return []interface{}{ + (*PublicKey_Ed25519)(nil), + (*PublicKey_Secp256K1)(nil), + (*PublicKey_Sr25519)(nil), + } +} + func init() { proto.RegisterType((*Coin)(nil), "cosmos_sdk.v1.Coin") proto.RegisterType((*DecCoin)(nil), "cosmos_sdk.v1.DecCoin") + proto.RegisterType((*PublicKey)(nil), "cosmos_sdk.v1.PublicKey") } func init() { proto.RegisterFile("types/types.proto", fileDescriptor_2c0f90c600ad7e2e) } var fileDescriptor_2c0f90c600ad7e2e = []byte{ - // 214 bytes of a gzipped FileDescriptorProto + // 293 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x2c, 0xa9, 0x2c, 0x48, 0x2d, 0xd6, 0x07, 0x93, 0x7a, 0x05, 0x45, 0xf9, 0x25, 0xf9, 0x42, 0xbc, 0xc9, 0xf9, 0xc5, 0xb9, 0xf9, 0xc5, 0xf1, 0xc5, 0x29, 0xd9, 0x7a, 0x65, 0x86, 0x52, 0x6a, 0x25, 0x19, 0x99, 0x45, 0x29, @@ -136,14 +239,121 @@ var fileDescriptor_2c0f90c600ad7e2e = []byte{ 0x5e, 0x7e, 0xae, 0x04, 0xa3, 0x02, 0xa3, 0x06, 0x67, 0x10, 0x84, 0x23, 0xa4, 0xcc, 0xc5, 0x96, 0x98, 0x9b, 0x5f, 0x9a, 0x57, 0x22, 0xc1, 0x04, 0x12, 0x76, 0xe2, 0x3e, 0x71, 0x4f, 0x9e, 0xe1, 0xd6, 0x3d, 0x79, 0x66, 0xcf, 0xbc, 0x92, 0x20, 0xa8, 0x94, 0x92, 0x0b, 0x17, 0xbb, 0x4b, 0x6a, - 0x32, 0x39, 0xa6, 0xb8, 0xa4, 0x26, 0xc3, 0x4c, 0x71, 0x72, 0xb9, 0xf1, 0x50, 0x8e, 0xa1, 0xe1, - 0x91, 0x1c, 0xc3, 0x89, 0x47, 0x72, 0x8c, 0x17, 0x1e, 0xc9, 0x31, 0x3e, 0x78, 0x24, 0xc7, 0x38, - 0xe1, 0xb1, 0x1c, 0xc3, 0x85, 0xc7, 0x72, 0x0c, 0x37, 0x1e, 0xcb, 0x31, 0x44, 0x29, 0xa5, 0x67, - 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0xea, 0x43, 0x3c, 0x0b, 0xa5, 0x74, 0x8b, 0x53, - 0xb2, 0x21, 0x61, 0x91, 0xc4, 0x06, 0xf6, 0x95, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0x8d, 0xc6, - 0x8c, 0x7d, 0x21, 0x01, 0x00, 0x00, + 0x32, 0x39, 0xa6, 0xb8, 0xa4, 0x26, 0xc3, 0x4d, 0x29, 0xe1, 0xe2, 0x0c, 0x28, 0x4d, 0xca, 0xc9, + 0x4c, 0xf6, 0x4e, 0xad, 0x14, 0x92, 0xe2, 0x62, 0x4f, 0x4d, 0x31, 0x32, 0x35, 0x35, 0xb4, 0x04, + 0x9b, 0xc4, 0xe3, 0xc1, 0x10, 0x04, 0x13, 0x10, 0x92, 0xe3, 0xe2, 0x2c, 0x4e, 0x4d, 0x2e, 0x30, + 0x32, 0x35, 0xcb, 0x36, 0x04, 0x1b, 0x08, 0x92, 0x45, 0x08, 0x81, 0xf4, 0x16, 0x17, 0x41, 0xf4, + 0x32, 0xc3, 0xf4, 0x42, 0x05, 0xac, 0x38, 0x5e, 0x2c, 0x90, 0x67, 0x6c, 0xb8, 0xa3, 0xc0, 0xe8, + 0xc4, 0xca, 0xc5, 0x5c, 0x50, 0x9a, 0xe4, 0xe4, 0x72, 0xe3, 0xa1, 0x1c, 0x43, 0xc3, 0x23, 0x39, + 0x86, 0x13, 0x8f, 0xe4, 0x18, 0x2f, 0x3c, 0x92, 0x63, 0x7c, 0xf0, 0x48, 0x8e, 0x71, 0xc2, 0x63, + 0x39, 0x86, 0x0b, 0x8f, 0xe5, 0x18, 0x6e, 0x3c, 0x96, 0x63, 0x88, 0x52, 0x4a, 0xcf, 0x2c, 0xc9, + 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x87, 0x04, 0x31, 0x94, 0xd2, 0x2d, 0x4e, 0xc9, 0x86, + 0xc4, 0x40, 0x12, 0x1b, 0x38, 0x2c, 0x8d, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0x83, 0x31, 0xbe, + 0xbf, 0x97, 0x01, 0x00, 0x00, } +func (this *PublicKey) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*PublicKey) + if !ok { + that2, ok := that.(PublicKey) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if that1.Pub == nil { + if this.Pub != nil { + return false + } + } else if this.Pub == nil { + return false + } else if !this.Pub.Equal(that1.Pub) { + return false + } + return true +} +func (this *PublicKey_Ed25519) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*PublicKey_Ed25519) + if !ok { + that2, ok := that.(PublicKey_Ed25519) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !bytes.Equal(this.Ed25519, that1.Ed25519) { + return false + } + return true +} +func (this *PublicKey_Secp256K1) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*PublicKey_Secp256K1) + if !ok { + that2, ok := that.(PublicKey_Secp256K1) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !bytes.Equal(this.Secp256K1, that1.Secp256K1) { + return false + } + return true +} +func (this *PublicKey_Sr25519) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*PublicKey_Sr25519) + if !ok { + that2, ok := that.(PublicKey_Sr25519) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !bytes.Equal(this.Sr25519, that1.Sr25519) { + return false + } + return true +} func (m *Coin) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -224,6 +434,86 @@ func (m *DecCoin) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *PublicKey) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *PublicKey) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PublicKey) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pub != nil { + { + size := m.Pub.Size() + i -= size + if _, err := m.Pub.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + } + } + return len(dAtA) - i, nil +} + +func (m *PublicKey_Ed25519) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PublicKey_Ed25519) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.Ed25519 != nil { + i -= len(m.Ed25519) + copy(dAtA[i:], m.Ed25519) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Ed25519))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} +func (m *PublicKey_Secp256K1) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PublicKey_Secp256K1) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.Secp256K1 != nil { + i -= len(m.Secp256K1) + copy(dAtA[i:], m.Secp256K1) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Secp256K1))) + i-- + dAtA[i] = 0x12 + } + return len(dAtA) - i, nil +} +func (m *PublicKey_Sr25519) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PublicKey_Sr25519) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.Sr25519 != nil { + i -= len(m.Sr25519) + copy(dAtA[i:], m.Sr25519) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Sr25519))) + i-- + dAtA[i] = 0x1a + } + return len(dAtA) - i, nil +} func encodeVarintTypes(dAtA []byte, offset int, v uint64) int { offset -= sovTypes(v) base := offset @@ -265,12 +555,109 @@ func (m *DecCoin) Size() (n int) { return n } +func (m *PublicKey) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Pub != nil { + n += m.Pub.Size() + } + return n +} + +func (m *PublicKey_Ed25519) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Ed25519 != nil { + l = len(m.Ed25519) + n += 1 + l + sovTypes(uint64(l)) + } + return n +} +func (m *PublicKey_Secp256K1) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Secp256K1 != nil { + l = len(m.Secp256K1) + n += 1 + l + sovTypes(uint64(l)) + } + return n +} +func (m *PublicKey_Sr25519) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Sr25519 != nil { + l = len(m.Sr25519) + n += 1 + l + sovTypes(uint64(l)) + } + return n +} + func sovTypes(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } func sozTypes(x uint64) (n int) { return sovTypes(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } +func (this *PublicKey) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&PublicKey{`, + `Pub:` + fmt.Sprintf("%v", this.Pub) + `,`, + `}`, + }, "") + return s +} +func (this *PublicKey_Ed25519) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&PublicKey_Ed25519{`, + `Ed25519:` + fmt.Sprintf("%v", this.Ed25519) + `,`, + `}`, + }, "") + return s +} +func (this *PublicKey_Secp256K1) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&PublicKey_Secp256K1{`, + `Secp256K1:` + fmt.Sprintf("%v", this.Secp256K1) + `,`, + `}`, + }, "") + return s +} +func (this *PublicKey_Sr25519) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&PublicKey_Sr25519{`, + `Sr25519:` + fmt.Sprintf("%v", this.Sr25519) + `,`, + `}`, + }, "") + return s +} +func valueToStringTypes(v interface{}) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("*%v", pv) +} func (m *Coin) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -509,6 +896,158 @@ func (m *DecCoin) Unmarshal(dAtA []byte) error { } return nil } +func (m *PublicKey) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: PublicKey: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PublicKey: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Ed25519", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := make([]byte, postIndex-iNdEx) + copy(v, dAtA[iNdEx:postIndex]) + m.Pub = &PublicKey_Ed25519{v} + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Secp256K1", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := make([]byte, postIndex-iNdEx) + copy(v, dAtA[iNdEx:postIndex]) + m.Pub = &PublicKey_Secp256K1{v} + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sr25519", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := make([]byte, postIndex-iNdEx) + copy(v, dAtA[iNdEx:postIndex]) + m.Pub = &PublicKey_Sr25519{v} + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipTypes(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/types/types.proto b/types/types.proto index 49da4e5c69f9..a9b3dcb1ee62 100644 --- a/types/types.proto +++ b/types/types.proto @@ -24,3 +24,15 @@ message DecCoin { string denom = 1; string amount = 2 [ (gogoproto.customtype) = "Dec", (gogoproto.nullable) = false ]; } + +// PublicKey defines a type to represent raw public key bytes. +message PublicKey { + option (gogoproto.equal) = true; + option (gogoproto.stringer) = true; + + oneof pub { + bytes ed25519 = 1; + bytes secp256k1 = 2; + bytes sr25519 = 3; + } +} \ No newline at end of file diff --git a/x/staking/types/codec.go b/x/staking/types/codec.go index 6fadfd9a68f9..9832789b6971 100644 --- a/x/staking/types/codec.go +++ b/x/staking/types/codec.go @@ -4,7 +4,22 @@ import ( "github.com/cosmos/cosmos-sdk/codec" ) -// Register concrete types on codec codec +type Codec struct { + codec.Marshaler + + // Keep reference to the amino codec to allow backwards compatibility along + // with type, and interface registration. + amino *codec.Codec +} + +func NewCodec(amino *codec.Codec) *Codec { + return &Codec{Marshaler: codec.NewHybridCodec(amino), amino: amino} +} + +// ---------------------------------------------------------------------------- + +// RegisterCodec registers all the necessary staking module concrete types and +// interfaces with the provided codec reference. func RegisterCodec(cdc *codec.Codec) { cdc.RegisterConcrete(MsgCreateValidator{}, "cosmos-sdk/MsgCreateValidator", nil) cdc.RegisterConcrete(MsgEditValidator{}, "cosmos-sdk/MsgEditValidator", nil) @@ -13,12 +28,13 @@ func RegisterCodec(cdc *codec.Codec) { cdc.RegisterConcrete(MsgBeginRedelegate{}, "cosmos-sdk/MsgBeginRedelegate", nil) } -// generic sealed codec to be used throughout this module -var ModuleCdc *codec.Codec +// ModuleCdc defines a staking module global Amino codec. +var ModuleCdc *Codec func init() { - ModuleCdc = codec.New() - RegisterCodec(ModuleCdc) - codec.RegisterCrypto(ModuleCdc) - ModuleCdc.Seal() + ModuleCdc = NewCodec(codec.New()) + + RegisterCodec(ModuleCdc.amino) + codec.RegisterCrypto(ModuleCdc.amino) + ModuleCdc.amino.Seal() } diff --git a/x/staking/types/commission.go b/x/staking/types/commission.go index 38ab8e06a703..270670a744b5 100644 --- a/x/staking/types/commission.go +++ b/x/staking/types/commission.go @@ -1,26 +1,10 @@ package types import ( - "fmt" "time" sdk "github.com/cosmos/cosmos-sdk/types" -) - -type ( - // Commission defines a commission parameters for a given validator. - Commission struct { - CommissionRates `json:"commission_rates" yaml:"commission_rates"` - UpdateTime time.Time `json:"update_time" yaml:"update_time"` // the last time the commission rate was changed - } - - // CommissionRates defines the initial commission rates to be used for creating a - // validator. - CommissionRates struct { - Rate sdk.Dec `json:"rate" yaml:"rate"` // the commission rate charged to delegators, as a fraction - MaxRate sdk.Dec `json:"max_rate" yaml:"max_rate"` // maximum commission rate which validator can ever charge, as a fraction - MaxChangeRate sdk.Dec `json:"max_change_rate" yaml:"max_change_rate"` // maximum daily increase of the validator commission, as a fraction - } + yaml "gopkg.in/yaml.v2" ) // NewCommissionRates returns an initialized validator commission rates. @@ -49,20 +33,16 @@ func NewCommissionWithTime(rate, maxRate, maxChangeRate sdk.Dec, updatedAt time. } } -// Equal checks if the given Commission object is equal to the receiving -// Commission object. -func (c Commission) Equal(c2 Commission) bool { - return c.Rate.Equal(c2.Rate) && - c.MaxRate.Equal(c2.MaxRate) && - c.MaxChangeRate.Equal(c2.MaxChangeRate) && - c.UpdateTime.Equal(c2.UpdateTime) +// String implements the Stringer interface for a Commission object. +func (c Commission) String() string { + out, _ := yaml.Marshal(c) + return string(out) } -// String implements the Stringer interface for a Commission. -func (c Commission) String() string { - return fmt.Sprintf("rate: %s, maxRate: %s, maxChangeRate: %s, updateTime: %s", - c.Rate, c.MaxRate, c.MaxChangeRate, c.UpdateTime, - ) +// String implements the Stringer interface for a CommissionRates object. +func (cr CommissionRates) String() string { + out, _ := yaml.Marshal(cr) + return string(out) } // Validate performs basic sanity validation checks of initial commission diff --git a/x/staking/types/delegation.go b/x/staking/types/delegation.go index 672edd5a90ed..bdb3193ebe9c 100644 --- a/x/staking/types/delegation.go +++ b/x/staking/types/delegation.go @@ -1,7 +1,6 @@ package types import ( - "bytes" "encoding/json" "fmt" "strings" @@ -10,41 +9,26 @@ import ( "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/staking/exported" + yaml "gopkg.in/yaml.v2" ) -// DVPair is struct that just has a delegator-validator pair with no other data. -// It is intended to be used as a marshalable pointer. For example, a DVPair can be used to construct the -// key to getting an UnbondingDelegation from state. -type DVPair struct { - DelegatorAddress sdk.AccAddress - ValidatorAddress sdk.ValAddress -} - -// DVVTriplet is struct that just has a delegator-validator-validator triplet with no other data. -// It is intended to be used as a marshalable pointer. For example, a DVVTriplet can be used to construct the -// key to getting a Redelegation from state. -type DVVTriplet struct { - DelegatorAddress sdk.AccAddress - ValidatorSrcAddress sdk.ValAddress - ValidatorDstAddress sdk.ValAddress -} - // Implements Delegation interface var _ exported.DelegationI = Delegation{} -// Delegation represents the bond with tokens held by an account. It is -// owned by one delegator, and is associated with the voting power of one -// validator. -type Delegation struct { - DelegatorAddress sdk.AccAddress `json:"delegator_address" yaml:"delegator_address"` - ValidatorAddress sdk.ValAddress `json:"validator_address" yaml:"validator_address"` - Shares sdk.Dec `json:"shares" yaml:"shares"` +// String implements the Stringer interface for a DVPair object. +func (dv DVPair) String() string { + out, _ := yaml.Marshal(dv) + return string(out) } -// NewDelegation creates a new delegation object -func NewDelegation(delegatorAddr sdk.AccAddress, validatorAddr sdk.ValAddress, - shares sdk.Dec) Delegation { +// String implements the Stringer interface for a DVVTriplet object. +func (dvv DVVTriplet) String() string { + out, _ := yaml.Marshal(dvv) + return string(out) +} +// NewDelegation creates a new delegation object +func NewDelegation(delegatorAddr sdk.AccAddress, validatorAddr sdk.ValAddress, shares sdk.Dec) Delegation { return Delegation{ DelegatorAddress: delegatorAddr, ValidatorAddress: validatorAddr, @@ -53,13 +37,13 @@ func NewDelegation(delegatorAddr sdk.AccAddress, validatorAddr sdk.ValAddress, } // MustMarshalDelegation returns the delegation bytes. Panics if fails -func MustMarshalDelegation(cdc *codec.Codec, delegation Delegation) []byte { - return cdc.MustMarshalBinaryLengthPrefixed(delegation) +func MustMarshalDelegation(cdc codec.Marshaler, delegation Delegation) []byte { + return cdc.MustMarshalBinaryLengthPrefixed(&delegation) } // MustUnmarshalDelegation return the unmarshaled delegation from bytes. // Panics if fails. -func MustUnmarshalDelegation(cdc *codec.Codec, value []byte) Delegation { +func MustUnmarshalDelegation(cdc codec.Marshaler, value []byte) Delegation { delegation, err := UnmarshalDelegation(cdc, value) if err != nil { panic(err) @@ -68,18 +52,11 @@ func MustUnmarshalDelegation(cdc *codec.Codec, value []byte) Delegation { } // return the delegation -func UnmarshalDelegation(cdc *codec.Codec, value []byte) (delegation Delegation, err error) { +func UnmarshalDelegation(cdc codec.Marshaler, value []byte) (delegation Delegation, err error) { err = cdc.UnmarshalBinaryLengthPrefixed(value, &delegation) return delegation, err } -// nolint -func (d Delegation) Equal(d2 Delegation) bool { - return bytes.Equal(d.DelegatorAddress, d2.DelegatorAddress) && - bytes.Equal(d.ValidatorAddress, d2.ValidatorAddress) && - d.Shares.Equal(d2.Shares) -} - // nolint - for Delegation func (d Delegation) GetDelegatorAddr() sdk.AccAddress { return d.DelegatorAddress } func (d Delegation) GetValidatorAddr() sdk.ValAddress { return d.ValidatorAddress } @@ -87,11 +64,8 @@ func (d Delegation) GetShares() sdk.Dec { return d.Shares } // String returns a human readable string representation of a Delegation. func (d Delegation) String() string { - return fmt.Sprintf(`Delegation: - Delegator: %s - Validator: %s - Shares: %s`, d.DelegatorAddress, - d.ValidatorAddress, d.Shares) + out, _ := yaml.Marshal(d) + return string(out) } // Delegations is a collection of delegations @@ -104,20 +78,19 @@ func (d Delegations) String() (out string) { return strings.TrimSpace(out) } -// UnbondingDelegation stores all of a single delegator's unbonding bonds -// for a single validator in an time-ordered list -type UnbondingDelegation struct { - DelegatorAddress sdk.AccAddress `json:"delegator_address" yaml:"delegator_address"` // delegator - ValidatorAddress sdk.ValAddress `json:"validator_address" yaml:"validator_address"` // validator unbonding from operator addr - Entries []UnbondingDelegationEntry `json:"entries" yaml:"entries"` // unbonding delegation entries +func NewUnbondingDelegationEntry(creationHeight int64, completionTime time.Time, balance sdk.Int) UnbondingDelegationEntry { + return UnbondingDelegationEntry{ + CreationHeight: creationHeight, + CompletionTime: completionTime, + InitialBalance: balance, + Balance: balance, + } } -// UnbondingDelegationEntry - entry to an UnbondingDelegation -type UnbondingDelegationEntry struct { - CreationHeight int64 `json:"creation_height" yaml:"creation_height"` // height which the unbonding took place - CompletionTime time.Time `json:"completion_time" yaml:"completion_time"` // time at which the unbonding delegation will complete - InitialBalance sdk.Int `json:"initial_balance" yaml:"initial_balance"` // atoms initially scheduled to receive at completion - Balance sdk.Int `json:"balance" yaml:"balance"` // atoms to receive at completion +// String implements the stringer interface for a UnbondingDelegationEntry. +func (ubd UnbondingDelegationEntry) String() string { + out, _ := yaml.Marshal(ubd) + return string(out) } // IsMature - is the current entry mature @@ -126,34 +99,22 @@ func (e UnbondingDelegationEntry) IsMature(currentTime time.Time) bool { } // NewUnbondingDelegation - create a new unbonding delegation object -func NewUnbondingDelegation(delegatorAddr sdk.AccAddress, - validatorAddr sdk.ValAddress, creationHeight int64, minTime time.Time, - balance sdk.Int) UnbondingDelegation { +func NewUnbondingDelegation( + delegatorAddr sdk.AccAddress, validatorAddr sdk.ValAddress, + creationHeight int64, minTime time.Time, balance sdk.Int, +) UnbondingDelegation { - entry := NewUnbondingDelegationEntry(creationHeight, minTime, balance) return UnbondingDelegation{ DelegatorAddress: delegatorAddr, ValidatorAddress: validatorAddr, - Entries: []UnbondingDelegationEntry{entry}, - } -} - -// NewUnbondingDelegationEntry - create a new unbonding delegation object -func NewUnbondingDelegationEntry(creationHeight int64, completionTime time.Time, - balance sdk.Int) UnbondingDelegationEntry { - - return UnbondingDelegationEntry{ - CreationHeight: creationHeight, - CompletionTime: completionTime, - InitialBalance: balance, - Balance: balance, + Entries: []UnbondingDelegationEntry{ + NewUnbondingDelegationEntry(creationHeight, minTime, balance), + }, } } // AddEntry - append entry to the unbonding delegation -func (d *UnbondingDelegation) AddEntry(creationHeight int64, - minTime time.Time, balance sdk.Int) { - +func (d *UnbondingDelegation) AddEntry(creationHeight int64, minTime time.Time, balance sdk.Int) { entry := NewUnbondingDelegationEntry(creationHeight, minTime, balance) d.Entries = append(d.Entries, entry) } @@ -164,12 +125,12 @@ func (d *UnbondingDelegation) RemoveEntry(i int64) { } // return the unbonding delegation -func MustMarshalUBD(cdc *codec.Codec, ubd UnbondingDelegation) []byte { - return cdc.MustMarshalBinaryLengthPrefixed(ubd) +func MustMarshalUBD(cdc codec.Marshaler, ubd UnbondingDelegation) []byte { + return cdc.MustMarshalBinaryLengthPrefixed(&ubd) } // unmarshal a unbonding delegation from a store value -func MustUnmarshalUBD(cdc *codec.Codec, value []byte) UnbondingDelegation { +func MustUnmarshalUBD(cdc codec.Marshaler, value []byte) UnbondingDelegation { ubd, err := UnmarshalUBD(cdc, value) if err != nil { panic(err) @@ -178,19 +139,11 @@ func MustUnmarshalUBD(cdc *codec.Codec, value []byte) UnbondingDelegation { } // unmarshal a unbonding delegation from a store value -func UnmarshalUBD(cdc *codec.Codec, value []byte) (ubd UnbondingDelegation, err error) { +func UnmarshalUBD(cdc codec.Marshaler, value []byte) (ubd UnbondingDelegation, err error) { err = cdc.UnmarshalBinaryLengthPrefixed(value, &ubd) return ubd, err } -// nolint -// inefficient but only used in testing -func (d UnbondingDelegation) Equal(d2 UnbondingDelegation) bool { - bz1 := ModuleCdc.MustMarshalBinaryLengthPrefixed(&d) - bz2 := ModuleCdc.MustMarshalBinaryLengthPrefixed(&d2) - return bytes.Equal(bz1, bz2) -} - // String returns a human readable string representation of an UnbondingDelegation. func (d UnbondingDelegation) String() string { out := fmt.Sprintf(`Unbonding Delegations between: @@ -217,46 +170,7 @@ func (ubds UnbondingDelegations) String() (out string) { return strings.TrimSpace(out) } -// Redelegation contains the list of a particular delegator's -// redelegating bonds from a particular source validator to a -// particular destination validator -type Redelegation struct { - DelegatorAddress sdk.AccAddress `json:"delegator_address" yaml:"delegator_address"` // delegator - ValidatorSrcAddress sdk.ValAddress `json:"validator_src_address" yaml:"validator_src_address"` // validator redelegation source operator addr - ValidatorDstAddress sdk.ValAddress `json:"validator_dst_address" yaml:"validator_dst_address"` // validator redelegation destination operator addr - Entries []RedelegationEntry `json:"entries" yaml:"entries"` // redelegation entries -} - -// RedelegationEntry - entry to a Redelegation -type RedelegationEntry struct { - CreationHeight int64 `json:"creation_height" yaml:"creation_height"` // height at which the redelegation took place - CompletionTime time.Time `json:"completion_time" yaml:"completion_time"` // time at which the redelegation will complete - InitialBalance sdk.Int `json:"initial_balance" yaml:"initial_balance"` // initial balance when redelegation started - SharesDst sdk.Dec `json:"shares_dst" yaml:"shares_dst"` // amount of destination-validator shares created by redelegation -} - -// NewRedelegation - create a new redelegation object -func NewRedelegation(delegatorAddr sdk.AccAddress, validatorSrcAddr, - validatorDstAddr sdk.ValAddress, creationHeight int64, - minTime time.Time, balance sdk.Int, - sharesDst sdk.Dec) Redelegation { - - entry := NewRedelegationEntry(creationHeight, - minTime, balance, sharesDst) - - return Redelegation{ - DelegatorAddress: delegatorAddr, - ValidatorSrcAddress: validatorSrcAddr, - ValidatorDstAddress: validatorDstAddr, - Entries: []RedelegationEntry{entry}, - } -} - -// NewRedelegationEntry - create a new redelegation object -func NewRedelegationEntry(creationHeight int64, - completionTime time.Time, balance sdk.Int, - sharesDst sdk.Dec) RedelegationEntry { - +func NewRedelegationEntry(creationHeight int64, completionTime time.Time, balance sdk.Int, sharesDst sdk.Dec) RedelegationEntry { return RedelegationEntry{ CreationHeight: creationHeight, CompletionTime: completionTime, @@ -265,11 +179,32 @@ func NewRedelegationEntry(creationHeight int64, } } +// String implements the Stringer interface for a RedelegationEntry object. +func (red RedelegationEntry) String() string { + out, _ := yaml.Marshal(red) + return string(out) +} + // IsMature - is the current entry mature func (e RedelegationEntry) IsMature(currentTime time.Time) bool { return !e.CompletionTime.After(currentTime) } +func NewRedelegation( + delegatorAddr sdk.AccAddress, validatorSrcAddr, validatorDstAddr sdk.ValAddress, + creationHeight int64, minTime time.Time, balance sdk.Int, sharesDst sdk.Dec, +) Redelegation { + + return Redelegation{ + DelegatorAddress: delegatorAddr, + ValidatorSrcAddress: validatorSrcAddr, + ValidatorDstAddress: validatorDstAddr, + Entries: []RedelegationEntry{ + NewRedelegationEntry(creationHeight, minTime, balance, sharesDst), + }, + } +} + // AddEntry - append entry to the unbonding delegation func (d *Redelegation) AddEntry(creationHeight int64, minTime time.Time, balance sdk.Int, @@ -285,12 +220,12 @@ func (d *Redelegation) RemoveEntry(i int64) { } // MustMarshalRED returns the Redelegation bytes. Panics if fails. -func MustMarshalRED(cdc *codec.Codec, red Redelegation) []byte { - return cdc.MustMarshalBinaryLengthPrefixed(red) +func MustMarshalRED(cdc codec.Marshaler, red Redelegation) []byte { + return cdc.MustMarshalBinaryLengthPrefixed(&red) } // MustUnmarshalRED unmarshals a redelegation from a store value. Panics if fails. -func MustUnmarshalRED(cdc *codec.Codec, value []byte) Redelegation { +func MustUnmarshalRED(cdc codec.Marshaler, value []byte) Redelegation { red, err := UnmarshalRED(cdc, value) if err != nil { panic(err) @@ -299,19 +234,11 @@ func MustUnmarshalRED(cdc *codec.Codec, value []byte) Redelegation { } // UnmarshalRED unmarshals a redelegation from a store value -func UnmarshalRED(cdc *codec.Codec, value []byte) (red Redelegation, err error) { +func UnmarshalRED(cdc codec.Marshaler, value []byte) (red Redelegation, err error) { err = cdc.UnmarshalBinaryLengthPrefixed(value, &red) return red, err } -// nolint -// inefficient but only used in tests -func (d Redelegation) Equal(d2 Redelegation) bool { - bz1 := ModuleCdc.MustMarshalBinaryLengthPrefixed(&d) - bz2 := ModuleCdc.MustMarshalBinaryLengthPrefixed(&d2) - return bytes.Equal(bz1, bz2) -} - // String returns a human readable string representation of a Redelegation. func (d Redelegation) String() string { out := fmt.Sprintf(`Redelegations between: diff --git a/x/staking/types/historical_info.go b/x/staking/types/historical_info.go index 1c08caebcde6..58215b1eb53f 100644 --- a/x/staking/types/historical_info.go +++ b/x/staking/types/historical_info.go @@ -25,13 +25,37 @@ func NewHistoricalInfo(header abci.Header, valSet Validators) HistoricalInfo { } } +// ToProto converts a HistoricalInfo into a HistoricalInfoProto type. +func (hi HistoricalInfo) ToProto() HistoricalInfoProto { + valsetProto := make([]ValidatorProto, len(hi.ValSet)) + for i, val := range hi.ValSet { + valsetProto[i] = val.ToProto() + } + + return HistoricalInfoProto{ + Header: hi.Header, + Valset: valsetProto, + } +} + +// ToHistoricalInfo converts a HistoricalInfoProto to a HistoricalInfo type. +func (hip HistoricalInfoProto) ToHistoricalInfo() HistoricalInfo { + valset := make(Validators, len(hip.Valset)) + for i, valProto := range hip.Valset { + valset[i] = valProto.ToValidator() + } + + return NewHistoricalInfo(hip.Header, valset) +} + // MustMarshalHistoricalInfo wll marshal historical info and panic on error -func MustMarshalHistoricalInfo(cdc *codec.Codec, hi HistoricalInfo) []byte { - return cdc.MustMarshalBinaryLengthPrefixed(hi) +func MustMarshalHistoricalInfo(cdc codec.Marshaler, hi HistoricalInfo) []byte { + hiProto := hi.ToProto() + return cdc.MustMarshalBinaryLengthPrefixed(&hiProto) } // MustUnmarshalHistoricalInfo wll unmarshal historical info and panic on error -func MustUnmarshalHistoricalInfo(cdc *codec.Codec, value []byte) HistoricalInfo { +func MustUnmarshalHistoricalInfo(cdc codec.Marshaler, value []byte) HistoricalInfo { hi, err := UnmarshalHistoricalInfo(cdc, value) if err != nil { panic(err) @@ -40,9 +64,13 @@ func MustUnmarshalHistoricalInfo(cdc *codec.Codec, value []byte) HistoricalInfo } // UnmarshalHistoricalInfo will unmarshal historical info and return any error -func UnmarshalHistoricalInfo(cdc *codec.Codec, value []byte) (hi HistoricalInfo, err error) { - err = cdc.UnmarshalBinaryLengthPrefixed(value, &hi) - return hi, err +func UnmarshalHistoricalInfo(cdc codec.Marshaler, value []byte) (hi HistoricalInfo, err error) { + hip := HistoricalInfoProto{} + if err := cdc.UnmarshalBinaryLengthPrefixed(value, &hip); err != nil { + return HistoricalInfo{}, err + } + + return hip.ToHistoricalInfo(), nil } // ValidateBasic will ensure HistoricalInfo is not nil and sorted diff --git a/x/staking/types/params.go b/x/staking/types/params.go index f3aefb404899..ae3dd7cf8ae7 100644 --- a/x/staking/types/params.go +++ b/x/staking/types/params.go @@ -1,7 +1,6 @@ package types import ( - "bytes" "errors" "fmt" "strings" @@ -10,6 +9,7 @@ import ( "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/params" + yaml "gopkg.in/yaml.v2" ) // Staking params default values @@ -20,14 +20,14 @@ const ( DefaultUnbondingTime time.Duration = time.Hour * 24 * 7 * 3 // Default maximum number of bonded validators - DefaultMaxValidators uint16 = 100 + DefaultMaxValidators uint32 = 100 // Default maximum entries in a UBD/RED pair - DefaultMaxEntries uint16 = 7 + DefaultMaxEntries uint32 = 7 // DefaultHistorical entries is 0 since it must only be non-zero for // IBC connected chains - DefaultHistoricalEntries uint16 = 0 + DefaultHistoricalEntries uint32 = 0 ) // nolint - Keys for parameter access @@ -41,18 +41,10 @@ var ( var _ params.ParamSet = (*Params)(nil) -// Params defines the high level settings for staking -type Params struct { - UnbondingTime time.Duration `json:"unbonding_time" yaml:"unbonding_time"` // time duration of unbonding - MaxValidators uint16 `json:"max_validators" yaml:"max_validators"` // maximum number of validators (max uint16 = 65535) - MaxEntries uint16 `json:"max_entries" yaml:"max_entries"` // max entries for either unbonding delegation or redelegation (per pair/trio) - HistoricalEntries uint16 `json:"historical_entries" yaml:"historical_entries"` // number of historical entries to persist - BondDenom string `json:"bond_denom" yaml:"bond_denom"` // bondable coin denomination -} - // NewParams creates a new Params instance -func NewParams(unbondingTime time.Duration, maxValidators, maxEntries, historicalEntries uint16, - bondDenom string) Params { +func NewParams( + unbondingTime time.Duration, maxValidators, maxEntries, historicalEntries uint32, bondDenom string, +) Params { return Params{ UnbondingTime: unbondingTime, @@ -74,28 +66,21 @@ func (p *Params) ParamSetPairs() params.ParamSetPairs { } } -// Equal returns a boolean determining if two Param types are identical. -// TODO: This is slower than comparing struct fields directly -func (p Params) Equal(p2 Params) bool { - bz1 := ModuleCdc.MustMarshalBinaryLengthPrefixed(&p) - bz2 := ModuleCdc.MustMarshalBinaryLengthPrefixed(&p2) - return bytes.Equal(bz1, bz2) -} - // DefaultParams returns a default set of parameters. func DefaultParams() Params { - return NewParams(DefaultUnbondingTime, DefaultMaxValidators, DefaultMaxEntries, DefaultHistoricalEntries, sdk.DefaultBondDenom) + return NewParams( + DefaultUnbondingTime, + DefaultMaxValidators, + DefaultMaxEntries, + DefaultHistoricalEntries, + sdk.DefaultBondDenom, + ) } // String returns a human readable string representation of the parameters. func (p Params) String() string { - return fmt.Sprintf(`Params: - Unbonding Time: %s - Max Validators: %d - Max Entries: %d - Historical Entries: %d - Bonded Coin Denom: %s`, p.UnbondingTime, - p.MaxValidators, p.MaxEntries, p.HistoricalEntries, p.BondDenom) + out, _ := yaml.Marshal(p) + return string(out) } // unmarshal the current staking params value from store key or panic @@ -148,7 +133,7 @@ func validateUnbondingTime(i interface{}) error { } func validateMaxValidators(i interface{}) error { - v, ok := i.(uint16) + v, ok := i.(uint32) if !ok { return fmt.Errorf("invalid parameter type: %T", i) } @@ -161,7 +146,7 @@ func validateMaxValidators(i interface{}) error { } func validateMaxEntries(i interface{}) error { - v, ok := i.(uint16) + v, ok := i.(uint32) if !ok { return fmt.Errorf("invalid parameter type: %T", i) } @@ -174,7 +159,7 @@ func validateMaxEntries(i interface{}) error { } func validateHistoricalEntries(i interface{}) error { - _, ok := i.(uint16) + _, ok := i.(uint32) if !ok { return fmt.Errorf("invalid parameter type: %T", i) } diff --git a/x/staking/types/types.pb.go b/x/staking/types/types.pb.go new file mode 100644 index 000000000000..55d2ae2322a7 --- /dev/null +++ b/x/staking/types/types.pb.go @@ -0,0 +1,4790 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: x/staking/types/types.proto + +package types + +import ( + bytes "bytes" + fmt "fmt" + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" + types1 "github.com/cosmos/cosmos-sdk/types" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" + _ "github.com/golang/protobuf/ptypes/duration" + _ "github.com/golang/protobuf/ptypes/timestamp" + types "github.com/tendermint/tendermint/abci/types" + io "io" + math "math" + math_bits "math/bits" + time "time" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf +var _ = time.Kitchen + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// HistoricalInfoProto contains the historical information that gets stored at +// each height. +type HistoricalInfoProto struct { + Header types.Header `protobuf:"bytes,1,opt,name=header,proto3" json:"header"` + Valset []ValidatorProto `protobuf:"bytes,2,rep,name=valset,proto3" json:"valset"` +} + +func (m *HistoricalInfoProto) Reset() { *m = HistoricalInfoProto{} } +func (m *HistoricalInfoProto) String() string { return proto.CompactTextString(m) } +func (*HistoricalInfoProto) ProtoMessage() {} +func (*HistoricalInfoProto) Descriptor() ([]byte, []int) { + return fileDescriptor_c669c0a3ee1b124c, []int{0} +} +func (m *HistoricalInfoProto) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *HistoricalInfoProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_HistoricalInfoProto.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *HistoricalInfoProto) XXX_Merge(src proto.Message) { + xxx_messageInfo_HistoricalInfoProto.Merge(m, src) +} +func (m *HistoricalInfoProto) XXX_Size() int { + return m.Size() +} +func (m *HistoricalInfoProto) XXX_DiscardUnknown() { + xxx_messageInfo_HistoricalInfoProto.DiscardUnknown(m) +} + +var xxx_messageInfo_HistoricalInfoProto proto.InternalMessageInfo + +func (m *HistoricalInfoProto) GetHeader() types.Header { + if m != nil { + return m.Header + } + return types.Header{} +} + +func (m *HistoricalInfoProto) GetValset() []ValidatorProto { + if m != nil { + return m.Valset + } + return nil +} + +// CommissionRates defines the initial commission rates to be used for creating +// a validator. +type CommissionRates struct { + Rate github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,1,opt,name=rate,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"rate"` + MaxRate github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=max_rate,json=maxRate,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"max_rate" yaml:"max_rate"` + MaxChangeRate github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=max_change_rate,json=maxChangeRate,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"max_change_rate" yaml:"max_change_rate"` +} + +func (m *CommissionRates) Reset() { *m = CommissionRates{} } +func (*CommissionRates) ProtoMessage() {} +func (*CommissionRates) Descriptor() ([]byte, []int) { + return fileDescriptor_c669c0a3ee1b124c, []int{1} +} +func (m *CommissionRates) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *CommissionRates) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_CommissionRates.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *CommissionRates) XXX_Merge(src proto.Message) { + xxx_messageInfo_CommissionRates.Merge(m, src) +} +func (m *CommissionRates) XXX_Size() int { + return m.Size() +} +func (m *CommissionRates) XXX_DiscardUnknown() { + xxx_messageInfo_CommissionRates.DiscardUnknown(m) +} + +var xxx_messageInfo_CommissionRates proto.InternalMessageInfo + +// Commission defines a commission parameters for a given validator. +type Commission struct { + CommissionRates `protobuf:"bytes,1,opt,name=commission_rates,json=commissionRates,proto3,embedded=commission_rates" json:"commission_rates"` + UpdateTime time.Time `protobuf:"bytes,2,opt,name=update_time,json=updateTime,proto3,stdtime" json:"update_time" yaml:"update_time"` +} + +func (m *Commission) Reset() { *m = Commission{} } +func (*Commission) ProtoMessage() {} +func (*Commission) Descriptor() ([]byte, []int) { + return fileDescriptor_c669c0a3ee1b124c, []int{2} +} +func (m *Commission) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Commission) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Commission.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Commission) XXX_Merge(src proto.Message) { + xxx_messageInfo_Commission.Merge(m, src) +} +func (m *Commission) XXX_Size() int { + return m.Size() +} +func (m *Commission) XXX_DiscardUnknown() { + xxx_messageInfo_Commission.DiscardUnknown(m) +} + +var xxx_messageInfo_Commission proto.InternalMessageInfo + +func (m *Commission) GetUpdateTime() time.Time { + if m != nil { + return m.UpdateTime + } + return time.Time{} +} + +// Description defines a validator description. +type Description struct { + Moniker string `protobuf:"bytes,1,opt,name=moniker,proto3" json:"moniker,omitempty"` + Identity string `protobuf:"bytes,2,opt,name=identity,proto3" json:"identity,omitempty"` + Website string `protobuf:"bytes,3,opt,name=website,proto3" json:"website,omitempty"` + SecurityContact string `protobuf:"bytes,4,opt,name=security_contact,json=securityContact,proto3" json:"security_contact,omitempty" yaml:"security_contact"` + Details string `protobuf:"bytes,5,opt,name=details,proto3" json:"details,omitempty"` +} + +func (m *Description) Reset() { *m = Description{} } +func (*Description) ProtoMessage() {} +func (*Description) Descriptor() ([]byte, []int) { + return fileDescriptor_c669c0a3ee1b124c, []int{3} +} +func (m *Description) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Description) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Description.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Description) XXX_Merge(src proto.Message) { + xxx_messageInfo_Description.Merge(m, src) +} +func (m *Description) XXX_Size() int { + return m.Size() +} +func (m *Description) XXX_DiscardUnknown() { + xxx_messageInfo_Description.DiscardUnknown(m) +} + +var xxx_messageInfo_Description proto.InternalMessageInfo + +func (m *Description) GetMoniker() string { + if m != nil { + return m.Moniker + } + return "" +} + +func (m *Description) GetIdentity() string { + if m != nil { + return m.Identity + } + return "" +} + +func (m *Description) GetWebsite() string { + if m != nil { + return m.Website + } + return "" +} + +func (m *Description) GetSecurityContact() string { + if m != nil { + return m.SecurityContact + } + return "" +} + +func (m *Description) GetDetails() string { + if m != nil { + return m.Details + } + return "" +} + +// ValidatorProto defines the Protocol buffer equivalent of the Validator type. +type ValidatorProto struct { + OperatorAddress github_com_cosmos_cosmos_sdk_types.ValAddress `protobuf:"bytes,1,opt,name=operator_address,json=operatorAddress,proto3,casttype=github.com/cosmos/cosmos-sdk/types.ValAddress" json:"operator_address,omitempty" yaml:"operator_address"` + // TODO: We can remove cosmos_sdk.v1.PublicKey in favor of the primitive bytes + // once Tendermint supports pubkeys as slices. + ConsensusPubkey types1.PublicKey `protobuf:"bytes,2,opt,name=consensus_pubkey,json=consensusPubkey,proto3" json:"consensus_pubkey" yaml:"consensus_pubkey"` + Jailed bool `protobuf:"varint,3,opt,name=jailed,proto3" json:"jailed,omitempty"` + Status []byte `protobuf:"bytes,4,opt,name=status,proto3" json:"status,omitempty"` + Tokens github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,5,opt,name=tokens,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"tokens"` + DelegatorShares github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,6,opt,name=delegator_shares,json=delegatorShares,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"delegator_shares" yaml:"delegator_shares"` + Description Description `protobuf:"bytes,7,opt,name=description,proto3" json:"description"` + UnbondingHeight int64 `protobuf:"varint,8,opt,name=unbonding_height,json=unbondingHeight,proto3" json:"unbonding_height,omitempty" yaml:"unbonding_height"` + UnbondingTime time.Time `protobuf:"bytes,9,opt,name=unbonding_time,json=unbondingTime,proto3,stdtime" json:"unbonding_time" yaml:"unbonding_time"` + Commission Commission `protobuf:"bytes,10,opt,name=commission,proto3" json:"commission"` + MinSelfDelegation github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,11,opt,name=min_self_delegation,json=minSelfDelegation,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"min_self_delegation" yaml:"min_self_delegation"` +} + +func (m *ValidatorProto) Reset() { *m = ValidatorProto{} } +func (m *ValidatorProto) String() string { return proto.CompactTextString(m) } +func (*ValidatorProto) ProtoMessage() {} +func (*ValidatorProto) Descriptor() ([]byte, []int) { + return fileDescriptor_c669c0a3ee1b124c, []int{4} +} +func (m *ValidatorProto) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ValidatorProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ValidatorProto.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ValidatorProto) XXX_Merge(src proto.Message) { + xxx_messageInfo_ValidatorProto.Merge(m, src) +} +func (m *ValidatorProto) XXX_Size() int { + return m.Size() +} +func (m *ValidatorProto) XXX_DiscardUnknown() { + xxx_messageInfo_ValidatorProto.DiscardUnknown(m) +} + +var xxx_messageInfo_ValidatorProto proto.InternalMessageInfo + +func (m *ValidatorProto) GetOperatorAddress() github_com_cosmos_cosmos_sdk_types.ValAddress { + if m != nil { + return m.OperatorAddress + } + return nil +} + +func (m *ValidatorProto) GetConsensusPubkey() types1.PublicKey { + if m != nil { + return m.ConsensusPubkey + } + return types1.PublicKey{} +} + +func (m *ValidatorProto) GetJailed() bool { + if m != nil { + return m.Jailed + } + return false +} + +func (m *ValidatorProto) GetStatus() []byte { + if m != nil { + return m.Status + } + return nil +} + +func (m *ValidatorProto) GetDescription() Description { + if m != nil { + return m.Description + } + return Description{} +} + +func (m *ValidatorProto) GetUnbondingHeight() int64 { + if m != nil { + return m.UnbondingHeight + } + return 0 +} + +func (m *ValidatorProto) GetUnbondingTime() time.Time { + if m != nil { + return m.UnbondingTime + } + return time.Time{} +} + +func (m *ValidatorProto) GetCommission() Commission { + if m != nil { + return m.Commission + } + return Commission{} +} + +// DVPair is struct that just has a delegator-validator pair with no other data. +// It is intended to be used as a marshalable pointer. For example, a DVPair can +// be used to construct the key to getting an UnbondingDelegation from state. +type DVPair struct { + DelegatorAddress github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"delegator_address,omitempty" yaml:"delegator_address"` + ValidatorAddress github_com_cosmos_cosmos_sdk_types.ValAddress `protobuf:"bytes,2,opt,name=validator_address,json=validatorAddress,proto3,casttype=github.com/cosmos/cosmos-sdk/types.ValAddress" json:"validator_address,omitempty" yaml:"validator_address"` +} + +func (m *DVPair) Reset() { *m = DVPair{} } +func (*DVPair) ProtoMessage() {} +func (*DVPair) Descriptor() ([]byte, []int) { + return fileDescriptor_c669c0a3ee1b124c, []int{5} +} +func (m *DVPair) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *DVPair) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_DVPair.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *DVPair) XXX_Merge(src proto.Message) { + xxx_messageInfo_DVPair.Merge(m, src) +} +func (m *DVPair) XXX_Size() int { + return m.Size() +} +func (m *DVPair) XXX_DiscardUnknown() { + xxx_messageInfo_DVPair.DiscardUnknown(m) +} + +var xxx_messageInfo_DVPair proto.InternalMessageInfo + +func (m *DVPair) GetDelegatorAddress() github_com_cosmos_cosmos_sdk_types.AccAddress { + if m != nil { + return m.DelegatorAddress + } + return nil +} + +func (m *DVPair) GetValidatorAddress() github_com_cosmos_cosmos_sdk_types.ValAddress { + if m != nil { + return m.ValidatorAddress + } + return nil +} + +// DVVTriplet is struct that just has a delegator-validator-validator triplet +// with no other data. It is intended to be used as a marshalable pointer. For +// example, a DVVTriplet can be used to construct the key to getting a +// Redelegation from state. +type DVVTriplet struct { + DelegatorAddress github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"delegator_address,omitempty" yaml:"delegator_address"` + ValidatorSrcAddress github_com_cosmos_cosmos_sdk_types.ValAddress `protobuf:"bytes,2,opt,name=validator_src_address,json=validatorSrcAddress,proto3,casttype=github.com/cosmos/cosmos-sdk/types.ValAddress" json:"validator_src_address,omitempty" yaml:"validator_src_address"` + ValidatorDstAddress github_com_cosmos_cosmos_sdk_types.ValAddress `protobuf:"bytes,3,opt,name=validator_dst_address,json=validatorDstAddress,proto3,casttype=github.com/cosmos/cosmos-sdk/types.ValAddress" json:"validator_dst_address,omitempty" yaml:"validator_dst_address"` +} + +func (m *DVVTriplet) Reset() { *m = DVVTriplet{} } +func (*DVVTriplet) ProtoMessage() {} +func (*DVVTriplet) Descriptor() ([]byte, []int) { + return fileDescriptor_c669c0a3ee1b124c, []int{6} +} +func (m *DVVTriplet) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *DVVTriplet) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_DVVTriplet.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *DVVTriplet) XXX_Merge(src proto.Message) { + xxx_messageInfo_DVVTriplet.Merge(m, src) +} +func (m *DVVTriplet) XXX_Size() int { + return m.Size() +} +func (m *DVVTriplet) XXX_DiscardUnknown() { + xxx_messageInfo_DVVTriplet.DiscardUnknown(m) +} + +var xxx_messageInfo_DVVTriplet proto.InternalMessageInfo + +func (m *DVVTriplet) GetDelegatorAddress() github_com_cosmos_cosmos_sdk_types.AccAddress { + if m != nil { + return m.DelegatorAddress + } + return nil +} + +func (m *DVVTriplet) GetValidatorSrcAddress() github_com_cosmos_cosmos_sdk_types.ValAddress { + if m != nil { + return m.ValidatorSrcAddress + } + return nil +} + +func (m *DVVTriplet) GetValidatorDstAddress() github_com_cosmos_cosmos_sdk_types.ValAddress { + if m != nil { + return m.ValidatorDstAddress + } + return nil +} + +// Delegation represents the bond with tokens held by an account. It is +// owned by one delegator, and is associated with the voting power of one +// validator. +type Delegation struct { + DelegatorAddress github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"delegator_address,omitempty" yaml:"delegator_address"` + ValidatorAddress github_com_cosmos_cosmos_sdk_types.ValAddress `protobuf:"bytes,2,opt,name=validator_address,json=validatorAddress,proto3,casttype=github.com/cosmos/cosmos-sdk/types.ValAddress" json:"validator_address,omitempty" yaml:"validator_address"` + Shares github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=shares,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"shares"` +} + +func (m *Delegation) Reset() { *m = Delegation{} } +func (*Delegation) ProtoMessage() {} +func (*Delegation) Descriptor() ([]byte, []int) { + return fileDescriptor_c669c0a3ee1b124c, []int{7} +} +func (m *Delegation) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Delegation) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Delegation.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Delegation) XXX_Merge(src proto.Message) { + xxx_messageInfo_Delegation.Merge(m, src) +} +func (m *Delegation) XXX_Size() int { + return m.Size() +} +func (m *Delegation) XXX_DiscardUnknown() { + xxx_messageInfo_Delegation.DiscardUnknown(m) +} + +var xxx_messageInfo_Delegation proto.InternalMessageInfo + +func (m *Delegation) GetDelegatorAddress() github_com_cosmos_cosmos_sdk_types.AccAddress { + if m != nil { + return m.DelegatorAddress + } + return nil +} + +func (m *Delegation) GetValidatorAddress() github_com_cosmos_cosmos_sdk_types.ValAddress { + if m != nil { + return m.ValidatorAddress + } + return nil +} + +// UnbondingDelegation stores all of a single delegator's unbonding bonds +// for a single validator in an time-ordered list +type UnbondingDelegation struct { + DelegatorAddress github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"delegator_address,omitempty" yaml:"delegator_address"` + ValidatorAddress github_com_cosmos_cosmos_sdk_types.ValAddress `protobuf:"bytes,2,opt,name=validator_address,json=validatorAddress,proto3,casttype=github.com/cosmos/cosmos-sdk/types.ValAddress" json:"validator_address,omitempty" yaml:"validator_address"` + Entries []UnbondingDelegationEntry `protobuf:"bytes,3,rep,name=entries,proto3" json:"entries"` +} + +func (m *UnbondingDelegation) Reset() { *m = UnbondingDelegation{} } +func (*UnbondingDelegation) ProtoMessage() {} +func (*UnbondingDelegation) Descriptor() ([]byte, []int) { + return fileDescriptor_c669c0a3ee1b124c, []int{8} +} +func (m *UnbondingDelegation) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *UnbondingDelegation) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_UnbondingDelegation.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *UnbondingDelegation) XXX_Merge(src proto.Message) { + xxx_messageInfo_UnbondingDelegation.Merge(m, src) +} +func (m *UnbondingDelegation) XXX_Size() int { + return m.Size() +} +func (m *UnbondingDelegation) XXX_DiscardUnknown() { + xxx_messageInfo_UnbondingDelegation.DiscardUnknown(m) +} + +var xxx_messageInfo_UnbondingDelegation proto.InternalMessageInfo + +func (m *UnbondingDelegation) GetDelegatorAddress() github_com_cosmos_cosmos_sdk_types.AccAddress { + if m != nil { + return m.DelegatorAddress + } + return nil +} + +func (m *UnbondingDelegation) GetValidatorAddress() github_com_cosmos_cosmos_sdk_types.ValAddress { + if m != nil { + return m.ValidatorAddress + } + return nil +} + +func (m *UnbondingDelegation) GetEntries() []UnbondingDelegationEntry { + if m != nil { + return m.Entries + } + return nil +} + +// UnbondingDelegationEntry defines an unbonding object with relevant metadata. +type UnbondingDelegationEntry struct { + CreationHeight int64 `protobuf:"varint,1,opt,name=creation_height,json=creationHeight,proto3" json:"creation_height,omitempty" yaml:"creation_height"` + CompletionTime time.Time `protobuf:"bytes,2,opt,name=completion_time,json=completionTime,proto3,stdtime" json:"completion_time" yaml:"completion_time"` + InitialBalance github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,3,opt,name=initial_balance,json=initialBalance,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"initial_balance" yaml:"initial_balance"` + Balance github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,4,opt,name=balance,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"balance"` +} + +func (m *UnbondingDelegationEntry) Reset() { *m = UnbondingDelegationEntry{} } +func (*UnbondingDelegationEntry) ProtoMessage() {} +func (*UnbondingDelegationEntry) Descriptor() ([]byte, []int) { + return fileDescriptor_c669c0a3ee1b124c, []int{9} +} +func (m *UnbondingDelegationEntry) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *UnbondingDelegationEntry) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_UnbondingDelegationEntry.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *UnbondingDelegationEntry) XXX_Merge(src proto.Message) { + xxx_messageInfo_UnbondingDelegationEntry.Merge(m, src) +} +func (m *UnbondingDelegationEntry) XXX_Size() int { + return m.Size() +} +func (m *UnbondingDelegationEntry) XXX_DiscardUnknown() { + xxx_messageInfo_UnbondingDelegationEntry.DiscardUnknown(m) +} + +var xxx_messageInfo_UnbondingDelegationEntry proto.InternalMessageInfo + +func (m *UnbondingDelegationEntry) GetCreationHeight() int64 { + if m != nil { + return m.CreationHeight + } + return 0 +} + +func (m *UnbondingDelegationEntry) GetCompletionTime() time.Time { + if m != nil { + return m.CompletionTime + } + return time.Time{} +} + +// RedelegationEntry defines a redelegation object with relevant metadata. +type RedelegationEntry struct { + CreationHeight int64 `protobuf:"varint,1,opt,name=creation_height,json=creationHeight,proto3" json:"creation_height,omitempty" yaml:"creation_height"` + CompletionTime time.Time `protobuf:"bytes,2,opt,name=completion_time,json=completionTime,proto3,stdtime" json:"completion_time" yaml:"completion_time"` + InitialBalance github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,3,opt,name=initial_balance,json=initialBalance,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"initial_balance" yaml:"initial_balance"` + SharesDst github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,4,opt,name=shares_dst,json=sharesDst,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"shares_dst"` +} + +func (m *RedelegationEntry) Reset() { *m = RedelegationEntry{} } +func (*RedelegationEntry) ProtoMessage() {} +func (*RedelegationEntry) Descriptor() ([]byte, []int) { + return fileDescriptor_c669c0a3ee1b124c, []int{10} +} +func (m *RedelegationEntry) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *RedelegationEntry) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_RedelegationEntry.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *RedelegationEntry) XXX_Merge(src proto.Message) { + xxx_messageInfo_RedelegationEntry.Merge(m, src) +} +func (m *RedelegationEntry) XXX_Size() int { + return m.Size() +} +func (m *RedelegationEntry) XXX_DiscardUnknown() { + xxx_messageInfo_RedelegationEntry.DiscardUnknown(m) +} + +var xxx_messageInfo_RedelegationEntry proto.InternalMessageInfo + +func (m *RedelegationEntry) GetCreationHeight() int64 { + if m != nil { + return m.CreationHeight + } + return 0 +} + +func (m *RedelegationEntry) GetCompletionTime() time.Time { + if m != nil { + return m.CompletionTime + } + return time.Time{} +} + +// Redelegation contains the list of a particular delegator's redelegating bonds +// from a particular source validator to a particular destination validator. +type Redelegation struct { + DelegatorAddress github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"delegator_address,omitempty" yaml:"delegator_address"` + ValidatorSrcAddress github_com_cosmos_cosmos_sdk_types.ValAddress `protobuf:"bytes,2,opt,name=validator_src_address,json=validatorSrcAddress,proto3,casttype=github.com/cosmos/cosmos-sdk/types.ValAddress" json:"validator_src_address,omitempty" yaml:"validator_src_address"` + ValidatorDstAddress github_com_cosmos_cosmos_sdk_types.ValAddress `protobuf:"bytes,3,opt,name=validator_dst_address,json=validatorDstAddress,proto3,casttype=github.com/cosmos/cosmos-sdk/types.ValAddress" json:"validator_dst_address,omitempty" yaml:"validator_dst_address"` + Entries []RedelegationEntry `protobuf:"bytes,4,rep,name=entries,proto3" json:"entries"` +} + +func (m *Redelegation) Reset() { *m = Redelegation{} } +func (*Redelegation) ProtoMessage() {} +func (*Redelegation) Descriptor() ([]byte, []int) { + return fileDescriptor_c669c0a3ee1b124c, []int{11} +} +func (m *Redelegation) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Redelegation) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Redelegation.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Redelegation) XXX_Merge(src proto.Message) { + xxx_messageInfo_Redelegation.Merge(m, src) +} +func (m *Redelegation) XXX_Size() int { + return m.Size() +} +func (m *Redelegation) XXX_DiscardUnknown() { + xxx_messageInfo_Redelegation.DiscardUnknown(m) +} + +var xxx_messageInfo_Redelegation proto.InternalMessageInfo + +func (m *Redelegation) GetDelegatorAddress() github_com_cosmos_cosmos_sdk_types.AccAddress { + if m != nil { + return m.DelegatorAddress + } + return nil +} + +func (m *Redelegation) GetValidatorSrcAddress() github_com_cosmos_cosmos_sdk_types.ValAddress { + if m != nil { + return m.ValidatorSrcAddress + } + return nil +} + +func (m *Redelegation) GetValidatorDstAddress() github_com_cosmos_cosmos_sdk_types.ValAddress { + if m != nil { + return m.ValidatorDstAddress + } + return nil +} + +func (m *Redelegation) GetEntries() []RedelegationEntry { + if m != nil { + return m.Entries + } + return nil +} + +// Params defines the parameters for the staking module. +type Params struct { + UnbondingTime time.Duration `protobuf:"bytes,1,opt,name=unbonding_time,json=unbondingTime,proto3,stdduration" json:"unbonding_time" yaml:"unbonding_time"` + MaxValidators uint32 `protobuf:"varint,2,opt,name=max_validators,json=maxValidators,proto3" json:"max_validators,omitempty" yaml:"max_validators"` + MaxEntries uint32 `protobuf:"varint,3,opt,name=max_entries,json=maxEntries,proto3" json:"max_entries,omitempty" yaml:"max_entries"` + HistoricalEntries uint32 `protobuf:"varint,4,opt,name=historical_entries,json=historicalEntries,proto3" json:"historical_entries,omitempty" yaml:"historical_entries"` + BondDenom string `protobuf:"bytes,5,opt,name=bond_denom,json=bondDenom,proto3" json:"bond_denom,omitempty" yaml:"bond_denom"` +} + +func (m *Params) Reset() { *m = Params{} } +func (*Params) ProtoMessage() {} +func (*Params) Descriptor() ([]byte, []int) { + return fileDescriptor_c669c0a3ee1b124c, []int{12} +} +func (m *Params) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Params.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Params) XXX_Merge(src proto.Message) { + xxx_messageInfo_Params.Merge(m, src) +} +func (m *Params) XXX_Size() int { + return m.Size() +} +func (m *Params) XXX_DiscardUnknown() { + xxx_messageInfo_Params.DiscardUnknown(m) +} + +var xxx_messageInfo_Params proto.InternalMessageInfo + +func (m *Params) GetUnbondingTime() time.Duration { + if m != nil { + return m.UnbondingTime + } + return 0 +} + +func (m *Params) GetMaxValidators() uint32 { + if m != nil { + return m.MaxValidators + } + return 0 +} + +func (m *Params) GetMaxEntries() uint32 { + if m != nil { + return m.MaxEntries + } + return 0 +} + +func (m *Params) GetHistoricalEntries() uint32 { + if m != nil { + return m.HistoricalEntries + } + return 0 +} + +func (m *Params) GetBondDenom() string { + if m != nil { + return m.BondDenom + } + return "" +} + +func init() { + proto.RegisterType((*HistoricalInfoProto)(nil), "cosmos_sdk.x.staking.v1.HistoricalInfoProto") + proto.RegisterType((*CommissionRates)(nil), "cosmos_sdk.x.staking.v1.CommissionRates") + proto.RegisterType((*Commission)(nil), "cosmos_sdk.x.staking.v1.Commission") + proto.RegisterType((*Description)(nil), "cosmos_sdk.x.staking.v1.Description") + proto.RegisterType((*ValidatorProto)(nil), "cosmos_sdk.x.staking.v1.ValidatorProto") + proto.RegisterType((*DVPair)(nil), "cosmos_sdk.x.staking.v1.DVPair") + proto.RegisterType((*DVVTriplet)(nil), "cosmos_sdk.x.staking.v1.DVVTriplet") + proto.RegisterType((*Delegation)(nil), "cosmos_sdk.x.staking.v1.Delegation") + proto.RegisterType((*UnbondingDelegation)(nil), "cosmos_sdk.x.staking.v1.UnbondingDelegation") + proto.RegisterType((*UnbondingDelegationEntry)(nil), "cosmos_sdk.x.staking.v1.UnbondingDelegationEntry") + proto.RegisterType((*RedelegationEntry)(nil), "cosmos_sdk.x.staking.v1.RedelegationEntry") + proto.RegisterType((*Redelegation)(nil), "cosmos_sdk.x.staking.v1.Redelegation") + proto.RegisterType((*Params)(nil), "cosmos_sdk.x.staking.v1.Params") +} + +func init() { proto.RegisterFile("x/staking/types/types.proto", fileDescriptor_c669c0a3ee1b124c) } + +var fileDescriptor_c669c0a3ee1b124c = []byte{ + // 1409 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x58, 0xcb, 0x6f, 0x1b, 0x45, + 0x18, 0xcf, 0xda, 0xc1, 0x49, 0xc6, 0x6d, 0x1c, 0x4f, 0xd4, 0xd6, 0x75, 0xa9, 0xb7, 0x2c, 0xa8, + 0x44, 0x88, 0xae, 0xd5, 0x16, 0x09, 0xa9, 0x5c, 0xa8, 0xe3, 0x56,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x46, 0x52, 0x74, 0x86, 0x75, 0xdc, 0x47, 0xfd, 0x75, 0x01, + 0x70, 0x8b, 0x57, 0x16, 0xef, 0x3f, 0xd0, 0xe7, 0x84, 0xc7, 0xbe, 0xd7, 0x00, 0x48, 0x3c, 0x06, + 0x3f, 0x02, 0x2b, 0xce, 0x78, 0x25, 0x74, 0xa9, 0x0a, 0xea, 0xda, 0xd4, 0xb8, 0x64, 0x1c, 0xde, + 0x58, 0xe4, 0xbb, 0x7e, 0x34, 0xd4, 0x35, 0xab, 0xe4, 0x64, 0x62, 0xf1, 0x01, 0x28, 0xf6, 0xba, + 0x2e, 0x62, 0xd8, 0xe6, 0xe9, 0x28, 0x5c, 0x59, 0xbc, 0x54, 0x35, 0x65, 0x2a, 0x9a, 0x71, 0x2a, + 0x9a, 0xb7, 0xe3, 0x5c, 0x6d, 0xd4, 0x38, 0xd7, 0x68, 0xa8, 0x43, 0x79, 0xae, 0x94, 0xb2, 0x71, + 0xef, 0x67, 0x5d, 0xb3, 0x80, 0x44, 0xb8, 0x42, 0xea, 0x50, 0xdf, 0x69, 0xa0, 0xd8, 0xc4, 0xd4, + 0x89, 0x48, 0x97, 0x67, 0x34, 0xac, 0x80, 0x05, 0x3f, 0x0c, 0xc8, 0x9e, 0xca, 0xd0, 0x25, 0x2b, + 0x5e, 0xc2, 0x2a, 0x58, 0x24, 0x2e, 0x0e, 0x18, 0x61, 0x03, 0x19, 0x58, 0x6b, 0xbc, 0xe6, 0x5a, + 0x77, 0x70, 0x8b, 0x92, 0x38, 0x1c, 0x56, 0xbc, 0x84, 0xd7, 0xc1, 0x0a, 0xc5, 0x4e, 0x2f, 0x22, + 0x6c, 0x60, 0x3b, 0x61, 0xc0, 0x90, 0xc3, 0x2a, 0xf3, 0x22, 0x62, 0x67, 0x46, 0x43, 0xfd, 0x94, + 0xdc, 0x6b, 0x56, 0xc2, 0xb0, 0x4a, 0x31, 0xb4, 0x2e, 0x11, 0x6e, 0xc1, 0xc5, 0x0c, 0x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x73, 0x67, 0xe7, 0x76, 0x44, 0xba, + 0x1e, 0x66, 0xff, 0xaa, 0x43, 0x3e, 0xd3, 0xc0, 0x89, 0xe4, 0xb8, 0x34, 0x72, 0x32, 0x5e, 0xb9, + 0x39, 0x1a, 0xea, 0x2f, 0x66, 0xbd, 0x92, 0x12, 0x3b, 0x84, 0x67, 0x56, 0xc7, 0x44, 0xb7, 0x22, + 0xe7, 0xe9, 0xfb, 0x70, 0x29, 0x1b, 0xef, 0x23, 0x3f, 0x7d, 0x1f, 0x29, 0xb1, 0x7f, 0xb4, 0x8f, + 0x26, 0x65, 0x93, 0x41, 0xfa, 0x21, 0x07, 0x40, 0x92, 0xc6, 0xff, 0xd7, 0xac, 0xe5, 0x13, 0x44, + 0xf5, 0xfb, 0xfc, 0xa1, 0x2e, 0x89, 0x4a, 0x3b, 0xe5, 0xd8, 0xdf, 0x72, 0x60, 0xf5, 0xbd, 0xb8, + 0xd7, 0x1d, 0x79, 0x18, 0xde, 0x04, 0x0b, 0x38, 0x60, 0x11, 0x11, 0x2e, 0xe6, 0xd7, 0xfc, 0x8b, + 0x53, 0xdb, 0xfc, 0x53, 0xdc, 0x76, 0x2d, 0x60, 0xd1, 0x40, 0x35, 0xfd, 0x98, 0x27, 0xe5, 0xec, + 0x2f, 0xf3, 0xa0, 0x32, 0x4d, 0x0b, 0xae, 0x83, 0x92, 0x13, 0x61, 0x01, 0xc4, 0x03, 0x51, 0x13, + 0x03, 0xb1, 0x9a, 0x5c, 0x97, 0x33, 0x02, 0x86, 0xb5, 0x1c, 0x23, 0x6a, 0x1c, 0xb6, 0x01, 0xbf, + 0xca, 0xf2, 0x46, 0xc6, 0xa5, 0x9e, 0xf3, 0xee, 0x6a, 0xa8, 0x79, 0x18, 0x1b, 0x39, 0x48, 0x20, + 0x07, 0xe2, 0x72, 0x82, 0x8a, 0x89, 0xf8, 0x09, 0x28, 0x91, 0x80, 0x30, 0x82, 0x3c, 0xbb, 0x85, + 0x3c, 0x14, 0x38, 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x65, 0x0c, 0xab, 0x9c, 0x80, 0x31, 0xdb, 0x1b, + 0x00, 0xf0, 0x73, 0xd9, 0x2e, 0x0e, 0x42, 0x5f, 0xbd, 0x52, 0x9e, 0x18, 0x0d, 0xf5, 0xb2, 0x64, + 0x49, 0x9e, 0x19, 0xd6, 0x12, 0x5f, 0x34, 0xf9, 0xef, 0xc4, 0xf1, 0x8d, 0xeb, 0x0f, 0x1f, 0xd7, + 0xb4, 0x47, 0x8f, 0x6b, 0xda, 0x2f, 0x8f, 0x6b, 0xda, 0xbd, 0x27, 0xb5, 0xb9, 0x47, 0x4f, 0x6a, + 0x73, 0x3f, 0x3e, 0xa9, 0xcd, 0xbd, 0xff, 0xfa, 0xdf, 0x26, 0x4b, 0xe6, 0x1b, 0x62, 0xab, 0x20, + 0xa2, 0x72, 0xf9, 0xaf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x8e, 0x7c, 0xff, 0xbb, 0x5d, 0x14, 0x00, + 0x00, +} + +func (this *HistoricalInfoProto) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*HistoricalInfoProto) + if !ok { + that2, ok := that.(HistoricalInfoProto) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.Header.Equal(&that1.Header) { + return false + } + if len(this.Valset) != len(that1.Valset) { + return false + } + for i := range this.Valset { + if !this.Valset[i].Equal(&that1.Valset[i]) { + return false + } + } + return true +} +func (this *CommissionRates) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*CommissionRates) + if !ok { + that2, ok := that.(CommissionRates) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.Rate.Equal(that1.Rate) { + return false + } + if !this.MaxRate.Equal(that1.MaxRate) { + return false + } + if !this.MaxChangeRate.Equal(that1.MaxChangeRate) { + return false + } + return true +} +func (this *Commission) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Commission) + if !ok { + that2, ok := that.(Commission) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.CommissionRates.Equal(&that1.CommissionRates) { + return false + } + if !this.UpdateTime.Equal(that1.UpdateTime) { + return false + } + return true +} +func (this *Description) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Description) + if !ok { + that2, ok := that.(Description) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Moniker != that1.Moniker { + return false + } + if this.Identity != that1.Identity { + return false + } + if this.Website != that1.Website { + return false + } + if this.SecurityContact != that1.SecurityContact { + return false + } + if this.Details != that1.Details { + return false + } + return true +} +func (this *ValidatorProto) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*ValidatorProto) + if !ok { + that2, ok := that.(ValidatorProto) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !bytes.Equal(this.OperatorAddress, that1.OperatorAddress) { + return false + } + if !this.ConsensusPubkey.Equal(&that1.ConsensusPubkey) { + return false + } + if this.Jailed != that1.Jailed { + return false + } + if !bytes.Equal(this.Status, that1.Status) { + return false + } + if !this.Tokens.Equal(that1.Tokens) { + return false + } + if !this.DelegatorShares.Equal(that1.DelegatorShares) { + return false + } + if !this.Description.Equal(&that1.Description) { + return false + } + if this.UnbondingHeight != that1.UnbondingHeight { + return false + } + if !this.UnbondingTime.Equal(that1.UnbondingTime) { + return false + } + if !this.Commission.Equal(&that1.Commission) { + return false + } + if !this.MinSelfDelegation.Equal(that1.MinSelfDelegation) { + return false + } + return true +} +func (this *DVPair) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*DVPair) + if !ok { + that2, ok := that.(DVPair) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !bytes.Equal(this.DelegatorAddress, that1.DelegatorAddress) { + return false + } + if !bytes.Equal(this.ValidatorAddress, that1.ValidatorAddress) { + return false + } + return true +} +func (this *DVVTriplet) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*DVVTriplet) + if !ok { + that2, ok := that.(DVVTriplet) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !bytes.Equal(this.DelegatorAddress, that1.DelegatorAddress) { + return false + } + if !bytes.Equal(this.ValidatorSrcAddress, that1.ValidatorSrcAddress) { + return false + } + if !bytes.Equal(this.ValidatorDstAddress, that1.ValidatorDstAddress) { + return false + } + return true +} +func (this *Delegation) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Delegation) + if !ok { + that2, ok := that.(Delegation) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !bytes.Equal(this.DelegatorAddress, that1.DelegatorAddress) { + return false + } + if !bytes.Equal(this.ValidatorAddress, that1.ValidatorAddress) { + return false + } + if !this.Shares.Equal(that1.Shares) { + return false + } + return true +} +func (this *UnbondingDelegation) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*UnbondingDelegation) + if !ok { + that2, ok := that.(UnbondingDelegation) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !bytes.Equal(this.DelegatorAddress, that1.DelegatorAddress) { + return false + } + if !bytes.Equal(this.ValidatorAddress, that1.ValidatorAddress) { + return false + } + if len(this.Entries) != len(that1.Entries) { + return false + } + for i := range this.Entries { + if !this.Entries[i].Equal(&that1.Entries[i]) { + return false + } + } + return true +} +func (this *UnbondingDelegationEntry) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*UnbondingDelegationEntry) + if !ok { + that2, ok := that.(UnbondingDelegationEntry) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.CreationHeight != that1.CreationHeight { + return false + } + if !this.CompletionTime.Equal(that1.CompletionTime) { + return false + } + if !this.InitialBalance.Equal(that1.InitialBalance) { + return false + } + if !this.Balance.Equal(that1.Balance) { + return false + } + return true +} +func (this *RedelegationEntry) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*RedelegationEntry) + if !ok { + that2, ok := that.(RedelegationEntry) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.CreationHeight != that1.CreationHeight { + return false + } + if !this.CompletionTime.Equal(that1.CompletionTime) { + return false + } + if !this.InitialBalance.Equal(that1.InitialBalance) { + return false + } + if !this.SharesDst.Equal(that1.SharesDst) { + return false + } + return true +} +func (this *Redelegation) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Redelegation) + if !ok { + that2, ok := that.(Redelegation) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !bytes.Equal(this.DelegatorAddress, that1.DelegatorAddress) { + return false + } + if !bytes.Equal(this.ValidatorSrcAddress, that1.ValidatorSrcAddress) { + return false + } + if !bytes.Equal(this.ValidatorDstAddress, that1.ValidatorDstAddress) { + return false + } + if len(this.Entries) != len(that1.Entries) { + return false + } + for i := range this.Entries { + if !this.Entries[i].Equal(&that1.Entries[i]) { + return false + } + } + return true +} +func (this *Params) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Params) + if !ok { + that2, ok := that.(Params) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.UnbondingTime != that1.UnbondingTime { + return false + } + if this.MaxValidators != that1.MaxValidators { + return false + } + if this.MaxEntries != that1.MaxEntries { + return false + } + if this.HistoricalEntries != that1.HistoricalEntries { + return false + } + if this.BondDenom != that1.BondDenom { + return false + } + return true +} +func (m *HistoricalInfoProto) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *HistoricalInfoProto) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *HistoricalInfoProto) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Valset) > 0 { + for iNdEx := len(m.Valset) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Valset[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + { + size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *CommissionRates) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *CommissionRates) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *CommissionRates) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.MaxChangeRate.Size() + i -= size + if _, err := m.MaxChangeRate.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + { + size := m.MaxRate.Size() + i -= size + if _, err := m.MaxRate.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + { + size := m.Rate.Size() + i -= size + if _, err := m.Rate.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *Commission) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Commission) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Commission) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + n2, err2 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.UpdateTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.UpdateTime):]) + if err2 != nil { + return 0, err2 + } + i -= n2 + i = encodeVarintTypes(dAtA, i, uint64(n2)) + i-- + dAtA[i] = 0x12 + { + size, err := m.CommissionRates.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *Description) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Description) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Description) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Details) > 0 { + i -= len(m.Details) + copy(dAtA[i:], m.Details) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Details))) + i-- + dAtA[i] = 0x2a + } + if len(m.SecurityContact) > 0 { + i -= len(m.SecurityContact) + copy(dAtA[i:], m.SecurityContact) + i = encodeVarintTypes(dAtA, i, uint64(len(m.SecurityContact))) + i-- + dAtA[i] = 0x22 + } + if len(m.Website) > 0 { + i -= len(m.Website) + copy(dAtA[i:], m.Website) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Website))) + i-- + dAtA[i] = 0x1a + } + if len(m.Identity) > 0 { + i -= len(m.Identity) + copy(dAtA[i:], m.Identity) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Identity))) + i-- + dAtA[i] = 0x12 + } + if len(m.Moniker) > 0 { + i -= len(m.Moniker) + copy(dAtA[i:], m.Moniker) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Moniker))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *ValidatorProto) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ValidatorProto) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ValidatorProto) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.MinSelfDelegation.Size() + i -= size + if _, err := m.MinSelfDelegation.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x5a + { + size, err := m.Commission.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x52 + n5, err5 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.UnbondingTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.UnbondingTime):]) + if err5 != nil { + return 0, err5 + } + i -= n5 + i = encodeVarintTypes(dAtA, i, uint64(n5)) + i-- + dAtA[i] = 0x4a + if m.UnbondingHeight != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.UnbondingHeight)) + i-- + dAtA[i] = 0x40 + } + { + size, err := m.Description.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x3a + { + size := m.DelegatorShares.Size() + i -= size + if _, err := m.DelegatorShares.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x32 + { + size := m.Tokens.Size() + i -= size + if _, err := m.Tokens.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + if len(m.Status) > 0 { + i -= len(m.Status) + copy(dAtA[i:], m.Status) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Status))) + i-- + dAtA[i] = 0x22 + } + if m.Jailed { + i-- + if m.Jailed { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x18 + } + { + size, err := m.ConsensusPubkey.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.OperatorAddress) > 0 { + i -= len(m.OperatorAddress) + copy(dAtA[i:], m.OperatorAddress) + i = encodeVarintTypes(dAtA, i, uint64(len(m.OperatorAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *DVPair) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *DVPair) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *DVPair) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.ValidatorAddress) > 0 { + i -= len(m.ValidatorAddress) + copy(dAtA[i:], m.ValidatorAddress) + i = encodeVarintTypes(dAtA, i, uint64(len(m.ValidatorAddress))) + i-- + dAtA[i] = 0x12 + } + if len(m.DelegatorAddress) > 0 { + i -= len(m.DelegatorAddress) + copy(dAtA[i:], m.DelegatorAddress) + i = encodeVarintTypes(dAtA, i, uint64(len(m.DelegatorAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *DVVTriplet) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *DVVTriplet) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *DVVTriplet) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.ValidatorDstAddress) > 0 { + i -= len(m.ValidatorDstAddress) + copy(dAtA[i:], m.ValidatorDstAddress) + i = encodeVarintTypes(dAtA, i, uint64(len(m.ValidatorDstAddress))) + i-- + dAtA[i] = 0x1a + } + if len(m.ValidatorSrcAddress) > 0 { + i -= len(m.ValidatorSrcAddress) + copy(dAtA[i:], m.ValidatorSrcAddress) + i = encodeVarintTypes(dAtA, i, uint64(len(m.ValidatorSrcAddress))) + i-- + dAtA[i] = 0x12 + } + if len(m.DelegatorAddress) > 0 { + i -= len(m.DelegatorAddress) + copy(dAtA[i:], m.DelegatorAddress) + i = encodeVarintTypes(dAtA, i, uint64(len(m.DelegatorAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Delegation) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Delegation) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Delegation) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.Shares.Size() + i -= size + if _, err := m.Shares.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + if len(m.ValidatorAddress) > 0 { + i -= len(m.ValidatorAddress) + copy(dAtA[i:], m.ValidatorAddress) + i = encodeVarintTypes(dAtA, i, uint64(len(m.ValidatorAddress))) + i-- + dAtA[i] = 0x12 + } + if len(m.DelegatorAddress) > 0 { + i -= len(m.DelegatorAddress) + copy(dAtA[i:], m.DelegatorAddress) + i = encodeVarintTypes(dAtA, i, uint64(len(m.DelegatorAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *UnbondingDelegation) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *UnbondingDelegation) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *UnbondingDelegation) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Entries) > 0 { + for iNdEx := len(m.Entries) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Entries[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + } + if len(m.ValidatorAddress) > 0 { + i -= len(m.ValidatorAddress) + copy(dAtA[i:], m.ValidatorAddress) + i = encodeVarintTypes(dAtA, i, uint64(len(m.ValidatorAddress))) + i-- + dAtA[i] = 0x12 + } + if len(m.DelegatorAddress) > 0 { + i -= len(m.DelegatorAddress) + copy(dAtA[i:], m.DelegatorAddress) + i = encodeVarintTypes(dAtA, i, uint64(len(m.DelegatorAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *UnbondingDelegationEntry) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *UnbondingDelegationEntry) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *UnbondingDelegationEntry) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.Balance.Size() + i -= size + if _, err := m.Balance.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + { + size := m.InitialBalance.Size() + i -= size + if _, err := m.InitialBalance.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + n8, err8 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.CompletionTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.CompletionTime):]) + if err8 != nil { + return 0, err8 + } + i -= n8 + i = encodeVarintTypes(dAtA, i, uint64(n8)) + i-- + dAtA[i] = 0x12 + if m.CreationHeight != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.CreationHeight)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *RedelegationEntry) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *RedelegationEntry) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *RedelegationEntry) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.SharesDst.Size() + i -= size + if _, err := m.SharesDst.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + { + size := m.InitialBalance.Size() + i -= size + if _, err := m.InitialBalance.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + n9, err9 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.CompletionTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.CompletionTime):]) + if err9 != nil { + return 0, err9 + } + i -= n9 + i = encodeVarintTypes(dAtA, i, uint64(n9)) + i-- + dAtA[i] = 0x12 + if m.CreationHeight != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.CreationHeight)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *Redelegation) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Redelegation) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Redelegation) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Entries) > 0 { + for iNdEx := len(m.Entries) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Entries[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + } + if len(m.ValidatorDstAddress) > 0 { + i -= len(m.ValidatorDstAddress) + copy(dAtA[i:], m.ValidatorDstAddress) + i = encodeVarintTypes(dAtA, i, uint64(len(m.ValidatorDstAddress))) + i-- + dAtA[i] = 0x1a + } + if len(m.ValidatorSrcAddress) > 0 { + i -= len(m.ValidatorSrcAddress) + copy(dAtA[i:], m.ValidatorSrcAddress) + i = encodeVarintTypes(dAtA, i, uint64(len(m.ValidatorSrcAddress))) + i-- + dAtA[i] = 0x12 + } + if len(m.DelegatorAddress) > 0 { + i -= len(m.DelegatorAddress) + copy(dAtA[i:], m.DelegatorAddress) + i = encodeVarintTypes(dAtA, i, uint64(len(m.DelegatorAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Params) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Params) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.BondDenom) > 0 { + i -= len(m.BondDenom) + copy(dAtA[i:], m.BondDenom) + i = encodeVarintTypes(dAtA, i, uint64(len(m.BondDenom))) + i-- + dAtA[i] = 0x2a + } + if m.HistoricalEntries != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.HistoricalEntries)) + i-- + dAtA[i] = 0x20 + } + if m.MaxEntries != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.MaxEntries)) + i-- + dAtA[i] = 0x18 + } + if m.MaxValidators != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.MaxValidators)) + i-- + dAtA[i] = 0x10 + } + n10, err10 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.UnbondingTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.UnbondingTime):]) + if err10 != nil { + return 0, err10 + } + i -= n10 + i = encodeVarintTypes(dAtA, i, uint64(n10)) + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func encodeVarintTypes(dAtA []byte, offset int, v uint64) int { + offset -= sovTypes(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *HistoricalInfoProto) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Header.Size() + n += 1 + l + sovTypes(uint64(l)) + if len(m.Valset) > 0 { + for _, e := range m.Valset { + l = e.Size() + n += 1 + l + sovTypes(uint64(l)) + } + } + return n +} + +func (m *CommissionRates) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Rate.Size() + n += 1 + l + sovTypes(uint64(l)) + l = m.MaxRate.Size() + n += 1 + l + sovTypes(uint64(l)) + l = m.MaxChangeRate.Size() + n += 1 + l + sovTypes(uint64(l)) + return n +} + +func (m *Commission) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.CommissionRates.Size() + n += 1 + l + sovTypes(uint64(l)) + l = github_com_gogo_protobuf_types.SizeOfStdTime(m.UpdateTime) + n += 1 + l + sovTypes(uint64(l)) + return n +} + +func (m *Description) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Moniker) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.Identity) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.Website) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.SecurityContact) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.Details) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + return n +} + +func (m *ValidatorProto) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.OperatorAddress) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = m.ConsensusPubkey.Size() + n += 1 + l + sovTypes(uint64(l)) + if m.Jailed { + n += 2 + } + l = len(m.Status) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = m.Tokens.Size() + n += 1 + l + sovTypes(uint64(l)) + l = m.DelegatorShares.Size() + n += 1 + l + sovTypes(uint64(l)) + l = m.Description.Size() + n += 1 + l + sovTypes(uint64(l)) + if m.UnbondingHeight != 0 { + n += 1 + sovTypes(uint64(m.UnbondingHeight)) + } + l = github_com_gogo_protobuf_types.SizeOfStdTime(m.UnbondingTime) + n += 1 + l + sovTypes(uint64(l)) + l = m.Commission.Size() + n += 1 + l + sovTypes(uint64(l)) + l = m.MinSelfDelegation.Size() + n += 1 + l + sovTypes(uint64(l)) + return n +} + +func (m *DVPair) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.DelegatorAddress) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.ValidatorAddress) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + return n +} + +func (m *DVVTriplet) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.DelegatorAddress) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.ValidatorSrcAddress) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.ValidatorDstAddress) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + return n +} + +func (m *Delegation) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.DelegatorAddress) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.ValidatorAddress) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = m.Shares.Size() + n += 1 + l + sovTypes(uint64(l)) + return n +} + +func (m *UnbondingDelegation) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.DelegatorAddress) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.ValidatorAddress) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + if len(m.Entries) > 0 { + for _, e := range m.Entries { + l = e.Size() + n += 1 + l + sovTypes(uint64(l)) + } + } + return n +} + +func (m *UnbondingDelegationEntry) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.CreationHeight != 0 { + n += 1 + sovTypes(uint64(m.CreationHeight)) + } + l = github_com_gogo_protobuf_types.SizeOfStdTime(m.CompletionTime) + n += 1 + l + sovTypes(uint64(l)) + l = m.InitialBalance.Size() + n += 1 + l + sovTypes(uint64(l)) + l = m.Balance.Size() + n += 1 + l + sovTypes(uint64(l)) + return n +} + +func (m *RedelegationEntry) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.CreationHeight != 0 { + n += 1 + sovTypes(uint64(m.CreationHeight)) + } + l = github_com_gogo_protobuf_types.SizeOfStdTime(m.CompletionTime) + n += 1 + l + sovTypes(uint64(l)) + l = m.InitialBalance.Size() + n += 1 + l + sovTypes(uint64(l)) + l = m.SharesDst.Size() + n += 1 + l + sovTypes(uint64(l)) + return n +} + +func (m *Redelegation) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.DelegatorAddress) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.ValidatorSrcAddress) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.ValidatorDstAddress) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + if len(m.Entries) > 0 { + for _, e := range m.Entries { + l = e.Size() + n += 1 + l + sovTypes(uint64(l)) + } + } + return n +} + +func (m *Params) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = github_com_gogo_protobuf_types.SizeOfStdDuration(m.UnbondingTime) + n += 1 + l + sovTypes(uint64(l)) + if m.MaxValidators != 0 { + n += 1 + sovTypes(uint64(m.MaxValidators)) + } + if m.MaxEntries != 0 { + n += 1 + sovTypes(uint64(m.MaxEntries)) + } + if m.HistoricalEntries != 0 { + n += 1 + sovTypes(uint64(m.HistoricalEntries)) + } + l = len(m.BondDenom) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + return n +} + +func sovTypes(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozTypes(x uint64) (n int) { + return sovTypes(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *HistoricalInfoProto) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: HistoricalInfoProto: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: HistoricalInfoProto: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Header.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Valset", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Valset = append(m.Valset, ValidatorProto{}) + if err := m.Valset[len(m.Valset)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *CommissionRates) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: CommissionRates: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CommissionRates: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Rate", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Rate.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MaxRate", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.MaxRate.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MaxChangeRate", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.MaxChangeRate.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Commission) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Commission: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Commission: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommissionRates", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CommissionRates.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field UpdateTime", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.UpdateTime, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Description) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Description: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Description: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Moniker", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Moniker = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Identity", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Identity = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Website", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Website = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SecurityContact", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SecurityContact = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Details", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Details = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ValidatorProto) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ValidatorProto: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ValidatorProto: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OperatorAddress", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.OperatorAddress = append(m.OperatorAddress[:0], dAtA[iNdEx:postIndex]...) + if m.OperatorAddress == nil { + m.OperatorAddress = []byte{} + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ConsensusPubkey", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ConsensusPubkey.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Jailed", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Jailed = bool(v != 0) + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Status = append(m.Status[:0], dAtA[iNdEx:postIndex]...) + if m.Status == nil { + m.Status = []byte{} + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Tokens", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Tokens.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DelegatorShares", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.DelegatorShares.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Description.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 8: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field UnbondingHeight", wireType) + } + m.UnbondingHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.UnbondingHeight |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field UnbondingTime", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.UnbondingTime, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 10: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Commission", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Commission.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 11: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MinSelfDelegation", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.MinSelfDelegation.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DVPair) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DVPair: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DVPair: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddress", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DelegatorAddress = append(m.DelegatorAddress[:0], dAtA[iNdEx:postIndex]...) + if m.DelegatorAddress == nil { + m.DelegatorAddress = []byte{} + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddress", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ValidatorAddress = append(m.ValidatorAddress[:0], dAtA[iNdEx:postIndex]...) + if m.ValidatorAddress == nil { + m.ValidatorAddress = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DVVTriplet) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DVVTriplet: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DVVTriplet: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddress", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DelegatorAddress = append(m.DelegatorAddress[:0], dAtA[iNdEx:postIndex]...) + if m.DelegatorAddress == nil { + m.DelegatorAddress = []byte{} + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorSrcAddress", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ValidatorSrcAddress = append(m.ValidatorSrcAddress[:0], dAtA[iNdEx:postIndex]...) + if m.ValidatorSrcAddress == nil { + m.ValidatorSrcAddress = []byte{} + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorDstAddress", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ValidatorDstAddress = append(m.ValidatorDstAddress[:0], dAtA[iNdEx:postIndex]...) + if m.ValidatorDstAddress == nil { + m.ValidatorDstAddress = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Delegation) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Delegation: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Delegation: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddress", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DelegatorAddress = append(m.DelegatorAddress[:0], dAtA[iNdEx:postIndex]...) + if m.DelegatorAddress == nil { + m.DelegatorAddress = []byte{} + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddress", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ValidatorAddress = append(m.ValidatorAddress[:0], dAtA[iNdEx:postIndex]...) + if m.ValidatorAddress == nil { + m.ValidatorAddress = []byte{} + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Shares", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Shares.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *UnbondingDelegation) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: UnbondingDelegation: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: UnbondingDelegation: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddress", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DelegatorAddress = append(m.DelegatorAddress[:0], dAtA[iNdEx:postIndex]...) + if m.DelegatorAddress == nil { + m.DelegatorAddress = []byte{} + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddress", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ValidatorAddress = append(m.ValidatorAddress[:0], dAtA[iNdEx:postIndex]...) + if m.ValidatorAddress == nil { + m.ValidatorAddress = []byte{} + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Entries", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Entries = append(m.Entries, UnbondingDelegationEntry{}) + if err := m.Entries[len(m.Entries)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *UnbondingDelegationEntry) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: UnbondingDelegationEntry: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: UnbondingDelegationEntry: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field CreationHeight", wireType) + } + m.CreationHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.CreationHeight |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CompletionTime", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.CompletionTime, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field InitialBalance", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.InitialBalance.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Balance", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Balance.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *RedelegationEntry) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: RedelegationEntry: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RedelegationEntry: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field CreationHeight", wireType) + } + m.CreationHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.CreationHeight |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CompletionTime", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.CompletionTime, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field InitialBalance", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.InitialBalance.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SharesDst", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.SharesDst.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Redelegation) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Redelegation: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Redelegation: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddress", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DelegatorAddress = append(m.DelegatorAddress[:0], dAtA[iNdEx:postIndex]...) + if m.DelegatorAddress == nil { + m.DelegatorAddress = []byte{} + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorSrcAddress", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ValidatorSrcAddress = append(m.ValidatorSrcAddress[:0], dAtA[iNdEx:postIndex]...) + if m.ValidatorSrcAddress == nil { + m.ValidatorSrcAddress = []byte{} + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorDstAddress", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ValidatorDstAddress = append(m.ValidatorDstAddress[:0], dAtA[iNdEx:postIndex]...) + if m.ValidatorDstAddress == nil { + m.ValidatorDstAddress = []byte{} + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Entries", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Entries = append(m.Entries, RedelegationEntry{}) + if err := m.Entries[len(m.Entries)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Params) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Params: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field UnbondingTime", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_types.StdDurationUnmarshal(&m.UnbondingTime, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MaxValidators", wireType) + } + m.MaxValidators = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MaxValidators |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MaxEntries", wireType) + } + m.MaxEntries = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MaxEntries |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field HistoricalEntries", wireType) + } + m.HistoricalEntries = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.HistoricalEntries |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BondDenom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BondDenom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipTypes(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTypes + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTypes + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTypes + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthTypes + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupTypes + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthTypes + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthTypes = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTypes = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupTypes = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/staking/types/types.proto b/x/staking/types/types.proto new file mode 100644 index 000000000000..c4da8b6fbc45 --- /dev/null +++ b/x/staking/types/types.proto @@ -0,0 +1,273 @@ +syntax = "proto3"; +package cosmos_sdk.x.staking.v1; + +import "third_party/proto/gogoproto/gogo.proto"; +import "third_party/proto/tendermint/abci/types/types.proto"; +import "google/protobuf/timestamp.proto"; +import "google/protobuf/duration.proto"; +import "types/types.proto"; + +option go_package = "github.com/cosmos/cosmos-sdk/x/staking/types"; + +// HistoricalInfoProto contains the historical information that gets stored at +// each height. +message HistoricalInfoProto { + option (gogoproto.equal) = true; + + tendermint.abci.types.Header header = 1 [ (gogoproto.nullable) = false ]; + repeated ValidatorProto valset = 2 [ (gogoproto.nullable) = false ]; +} + +// CommissionRates defines the initial commission rates to be used for creating +// a validator. +message CommissionRates { + option (gogoproto.equal) = true; + option (gogoproto.goproto_stringer) = false; + + string rate = 1 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; + string max_rate = 2 [ + (gogoproto.moretags) = "yaml:\"max_rate\"", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; + string max_change_rate = 3 [ + (gogoproto.moretags) = "yaml:\"max_change_rate\"", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; +} + +// Commission defines a commission parameters for a given validator. +message Commission { + option (gogoproto.equal) = true; + option (gogoproto.goproto_stringer) = false; + + CommissionRates commission_rates = 1 + [ (gogoproto.embed) = true, (gogoproto.nullable) = false ]; + google.protobuf.Timestamp update_time = 2 [ + (gogoproto.nullable) = false, + (gogoproto.stdtime) = true, + (gogoproto.moretags) = "yaml:\"update_time\"" + ]; +} + +// Description defines a validator description. +message Description { + option (gogoproto.equal) = true; + option (gogoproto.goproto_stringer) = false; + + string moniker = 1; + string identity = 2; + string website = 3; + string security_contact = 4 + [ (gogoproto.moretags) = "yaml:\"security_contact\"" ]; + string details = 5; +} + +// ValidatorProto defines the Protocol buffer equivalent of the Validator type. +message ValidatorProto { + option (gogoproto.equal) = true; + + bytes operator_address = 1 [ + (gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.ValAddress", + (gogoproto.moretags) = "yaml:\"operator_address\"" + ]; + // TODO: We can remove cosmos_sdk.v1.PublicKey in favor of the primitive bytes + // once Tendermint supports pubkeys as slices. + cosmos_sdk.v1.PublicKey consensus_pubkey = 2 [ + (gogoproto.moretags) = "yaml:\"consensus_pubkey\"", + (gogoproto.nullable) = false + ]; + bool jailed = 3; + bytes status = 4; + string tokens = 5 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false + ]; + string delegator_shares = 6 [ + (gogoproto.moretags) = "yaml:\"delegator_shares\"", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; + Description description = 7 [ (gogoproto.nullable) = false ]; + int64 unbonding_height = 8 + [ (gogoproto.moretags) = "yaml:\"unbonding_height\"" ]; + google.protobuf.Timestamp unbonding_time = 9 [ + (gogoproto.nullable) = false, + (gogoproto.stdtime) = true, + (gogoproto.moretags) = "yaml:\"unbonding_time\"" + ]; + Commission commission = 10 [ (gogoproto.nullable) = false ]; + string min_self_delegation = 11 [ + (gogoproto.moretags) = "yaml:\"min_self_delegation\"", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false + ]; +} + +// DVPair is struct that just has a delegator-validator pair with no other data. +// It is intended to be used as a marshalable pointer. For example, a DVPair can +// be used to construct the key to getting an UnbondingDelegation from state. +message DVPair { + option (gogoproto.equal) = true; + option (gogoproto.goproto_stringer) = false; + + bytes delegator_address = 1 [ + (gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress", + (gogoproto.moretags) = "yaml:\"delegator_address\"" + ]; + bytes validator_address = 2 [ + (gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.ValAddress", + (gogoproto.moretags) = "yaml:\"validator_address\"" + ]; +} + +// DVVTriplet is struct that just has a delegator-validator-validator triplet +// with no other data. It is intended to be used as a marshalable pointer. For +// example, a DVVTriplet can be used to construct the key to getting a +// Redelegation from state. +message DVVTriplet { + option (gogoproto.equal) = true; + option (gogoproto.goproto_stringer) = false; + + bytes delegator_address = 1 [ + (gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress", + (gogoproto.moretags) = "yaml:\"delegator_address\"" + ]; + bytes validator_src_address = 2 [ + (gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.ValAddress", + (gogoproto.moretags) = "yaml:\"validator_src_address\"" + ]; + bytes validator_dst_address = 3 [ + (gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.ValAddress", + (gogoproto.moretags) = "yaml:\"validator_dst_address\"" + ]; +} + +// Delegation represents the bond with tokens held by an account. It is +// owned by one delegator, and is associated with the voting power of one +// validator. +message Delegation { + option (gogoproto.equal) = true; + option (gogoproto.goproto_stringer) = false; + + bytes delegator_address = 1 [ + (gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress", + (gogoproto.moretags) = "yaml:\"delegator_address\"" + ]; + bytes validator_address = 2 [ + (gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.ValAddress", + (gogoproto.moretags) = "yaml:\"validator_address\"" + ]; + string shares = 3 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; +} + +// UnbondingDelegation stores all of a single delegator's unbonding bonds +// for a single validator in an time-ordered list +message UnbondingDelegation { + option (gogoproto.equal) = true; + option (gogoproto.goproto_stringer) = false; + + bytes delegator_address = 1 [ + (gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress", + (gogoproto.moretags) = "yaml:\"delegator_address\"" + ]; + bytes validator_address = 2 [ + (gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.ValAddress", + (gogoproto.moretags) = "yaml:\"validator_address\"" + ]; + repeated UnbondingDelegationEntry entries = 3 + [ (gogoproto.nullable) = false ]; // unbonding delegation entries +} + +// UnbondingDelegationEntry defines an unbonding object with relevant metadata. +message UnbondingDelegationEntry { + option (gogoproto.equal) = true; + option (gogoproto.goproto_stringer) = false; + + int64 creation_height = 1 + [ (gogoproto.moretags) = "yaml:\"creation_height\"" ]; + google.protobuf.Timestamp completion_time = 2 [ + (gogoproto.nullable) = false, + (gogoproto.stdtime) = true, + (gogoproto.moretags) = "yaml:\"completion_time\"" + ]; + string initial_balance = 3 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false, + (gogoproto.moretags) = "yaml:\"initial_balance\"" + ]; + string balance = 4 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false + ]; +} + +// RedelegationEntry defines a redelegation object with relevant metadata. +message RedelegationEntry { + option (gogoproto.equal) = true; + option (gogoproto.goproto_stringer) = false; + + int64 creation_height = 1 + [ (gogoproto.moretags) = "yaml:\"creation_height\"" ]; + google.protobuf.Timestamp completion_time = 2 [ + (gogoproto.nullable) = false, + (gogoproto.stdtime) = true, + (gogoproto.moretags) = "yaml:\"completion_time\"" + ]; + string initial_balance = 3 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.nullable) = false, + (gogoproto.moretags) = "yaml:\"initial_balance\"" + ]; + string shares_dst = 4 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; +} + +// Redelegation contains the list of a particular delegator's redelegating bonds +// from a particular source validator to a particular destination validator. +message Redelegation { + option (gogoproto.equal) = true; + option (gogoproto.goproto_stringer) = false; + + bytes delegator_address = 1 [ + (gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress", + (gogoproto.moretags) = "yaml:\"delegator_address\"" + ]; + bytes validator_src_address = 2 [ + (gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.ValAddress", + (gogoproto.moretags) = "yaml:\"validator_src_address\"" + ]; + bytes validator_dst_address = 3 [ + (gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.ValAddress", + (gogoproto.moretags) = "yaml:\"validator_dst_address\"" + ]; + repeated RedelegationEntry entries = 4 + [ (gogoproto.nullable) = false ]; // redelegation entries +} + +// Params defines the parameters for the staking module. +message Params { + option (gogoproto.equal) = true; + option (gogoproto.goproto_stringer) = false; + + google.protobuf.Duration unbonding_time = 1 [ + (gogoproto.nullable) = false, + (gogoproto.stdduration) = true, + (gogoproto.moretags) = "yaml:\"unbonding_time\"" + ]; + uint32 max_validators = 2 + [ (gogoproto.moretags) = "yaml:\"max_validators\"" ]; + uint32 max_entries = 3 [ (gogoproto.moretags) = "yaml:\"max_entries\"" ]; + uint32 historical_entries = 4 + [ (gogoproto.moretags) = "yaml:\"historical_entries\"" ]; + string bond_denom = 5 [ (gogoproto.moretags) = "yaml:\"bond_denom\"" ]; +} diff --git a/x/staking/types/validator.go b/x/staking/types/validator.go index 855ed988d290..c981b4c97035 100644 --- a/x/staking/types/validator.go +++ b/x/staking/types/validator.go @@ -9,6 +9,9 @@ import ( abci "github.com/tendermint/tendermint/abci/types" "github.com/tendermint/tendermint/crypto" + "github.com/tendermint/tendermint/crypto/ed25519" + "github.com/tendermint/tendermint/crypto/secp256k1" + "github.com/tendermint/tendermint/crypto/sr25519" tmtypes "github.com/tendermint/tendermint/types" yaml "gopkg.in/yaml.v2" @@ -52,23 +55,105 @@ type Validator struct { MinSelfDelegation sdk.Int `json:"min_self_delegation" yaml:"min_self_delegation"` // validator's self declared minimum self delegation } -// custom marshal yaml function due to consensus pubkey -func (v Validator) MarshalYAML() (interface{}, error) { - bs, err := yaml.Marshal(struct { - OperatorAddress sdk.ValAddress - ConsPubKey string - Jailed bool - Status sdk.BondStatus - Tokens sdk.Int - DelegatorShares sdk.Dec - Description Description - UnbondingHeight int64 - UnbondingCompletionTime time.Time - Commission Commission - MinSelfDelegation sdk.Int - }{ +func NewValidator(operator sdk.ValAddress, pubKey crypto.PubKey, description Description) Validator { + return Validator{ + OperatorAddress: operator, + ConsPubKey: pubKey, + Jailed: false, + Status: sdk.Unbonded, + Tokens: sdk.ZeroInt(), + DelegatorShares: sdk.ZeroDec(), + Description: description, + UnbondingHeight: int64(0), + UnbondingCompletionTime: time.Unix(0, 0).UTC(), + Commission: NewCommission(sdk.ZeroDec(), sdk.ZeroDec(), sdk.ZeroDec()), + MinSelfDelegation: sdk.OneInt(), + } +} + +// ToProto converts a Validator into a ValidatorProto type. +func (v Validator) ToProto() ValidatorProto { + var pk sdk.PublicKey + + switch t := v.ConsPubKey.(type) { + case secp256k1.PubKeySecp256k1: + pk = sdk.PublicKey{ + Pub: &sdk.PublicKey_Secp256K1{t.Bytes()}, + } + + case ed25519.PubKeyEd25519: + pk = sdk.PublicKey{ + Pub: &sdk.PublicKey_Ed25519{t.Bytes()}, + } + + case sr25519.PubKeySr25519: + pk = sdk.PublicKey{ + Pub: &sdk.PublicKey_Sr25519{t.Bytes()}, + } + } + + return ValidatorProto{ + OperatorAddress: v.OperatorAddress, + ConsensusPubkey: pk, + Jailed: v.Jailed, + Status: []byte{byte(v.Status)}, + Tokens: v.Tokens, + DelegatorShares: v.DelegatorShares, + Description: v.Description, + UnbondingHeight: v.UnbondingHeight, + UnbondingTime: v.UnbondingCompletionTime, + Commission: v.Commission, + MinSelfDelegation: v.MinSelfDelegation, + } +} + +// ToValidator converts a ValidatorProto to a Validator type. +func (vp ValidatorProto) ToValidator() Validator { + var ( + pk crypto.PubKey + err error + ) + + switch t := vp.ConsensusPubkey.GetPub().(type) { + case *sdk.PublicKey_Secp256K1: + err = ModuleCdc.amino.UnmarshalBinaryBare(t.Secp256K1, &pk) + + case *sdk.PublicKey_Ed25519: + err = ModuleCdc.amino.UnmarshalBinaryBare(t.Ed25519, &pk) + + case *sdk.PublicKey_Sr25519: + err = ModuleCdc.amino.UnmarshalBinaryBare(t.Sr25519, &pk) + + default: + err = fmt.Errorf("unsupported public key type: %T", t) + } + + if err != nil { + panic(fmt.Errorf("failed to decode public key: %w", err)) + } + + return Validator{ + OperatorAddress: vp.OperatorAddress, + ConsPubKey: pk, + Jailed: vp.Jailed, + Status: sdk.BondStatus(vp.Status[0]), + Tokens: vp.Tokens, + DelegatorShares: vp.DelegatorShares, + Description: vp.Description, + UnbondingHeight: vp.UnbondingHeight, + UnbondingCompletionTime: vp.UnbondingTime, + Commission: vp.Commission, + MinSelfDelegation: vp.MinSelfDelegation, + } +} + +// String implements the Stringer interface for a Validator object. +func (v Validator) String() string { + bechConsPubKey, _ := sdk.Bech32ifyPubKey(sdk.Bech32PubKeyTypeConsPub, v.ConsPubKey) + + bz, _ := yaml.Marshal(bechValidator{ OperatorAddress: v.OperatorAddress, - ConsPubKey: sdk.MustBech32ifyPubKey(sdk.Bech32PubKeyTypeConsPub, v.ConsPubKey), + ConsPubKey: bechConsPubKey, Jailed: v.Jailed, Status: v.Status, Tokens: v.Tokens, @@ -79,11 +164,8 @@ func (v Validator) MarshalYAML() (interface{}, error) { Commission: v.Commission, MinSelfDelegation: v.MinSelfDelegation, }) - if err != nil { - return nil, err - } - return string(bs), nil + return string(bz) } // Validators is a collection of Validator @@ -135,30 +217,14 @@ func (v Validators) Swap(i, j int) { v[j] = it } -// NewValidator - initialize a new validator -func NewValidator(operator sdk.ValAddress, pubKey crypto.PubKey, description Description) Validator { - return Validator{ - OperatorAddress: operator, - ConsPubKey: pubKey, - Jailed: false, - Status: sdk.Unbonded, - Tokens: sdk.ZeroInt(), - DelegatorShares: sdk.ZeroDec(), - Description: description, - UnbondingHeight: int64(0), - UnbondingCompletionTime: time.Unix(0, 0).UTC(), - Commission: NewCommission(sdk.ZeroDec(), sdk.ZeroDec(), sdk.ZeroDec()), - MinSelfDelegation: sdk.OneInt(), - } -} - // return the redelegation -func MustMarshalValidator(cdc *codec.Codec, validator Validator) []byte { - return cdc.MustMarshalBinaryLengthPrefixed(validator) +func MustMarshalValidator(cdc codec.Marshaler, validator Validator) []byte { + valProto := validator.ToProto() + return cdc.MustMarshalBinaryLengthPrefixed(&valProto) } // unmarshal a redelegation from a store value -func MustUnmarshalValidator(cdc *codec.Codec, value []byte) Validator { +func MustUnmarshalValidator(cdc codec.Marshaler, value []byte) Validator { validator, err := UnmarshalValidator(cdc, value) if err != nil { panic(err) @@ -167,32 +233,13 @@ func MustUnmarshalValidator(cdc *codec.Codec, value []byte) Validator { } // unmarshal a redelegation from a store value -func UnmarshalValidator(cdc *codec.Codec, value []byte) (validator Validator, err error) { - err = cdc.UnmarshalBinaryLengthPrefixed(value, &validator) - return validator, err -} - -// String returns a human readable string representation of a validator. -func (v Validator) String() string { - bechConsPubKey, err := sdk.Bech32ifyPubKey(sdk.Bech32PubKeyTypeConsPub, v.ConsPubKey) - if err != nil { - panic(err) +func UnmarshalValidator(cdc codec.Marshaler, value []byte) (Validator, error) { + vp := ValidatorProto{} + if err := cdc.UnmarshalBinaryLengthPrefixed(value, &vp); err != nil { + return Validator{}, err } - return fmt.Sprintf(`Validator - Operator Address: %s - Validator Consensus Pubkey: %s - Jailed: %v - Status: %s - Tokens: %s - Delegator Shares: %s - Description: %s - Unbonding Height: %d - Unbonding Completion Time: %v - Minimum Self Delegation: %v - Commission: %s`, v.OperatorAddress, bechConsPubKey, - v.Jailed, v.Status, v.Tokens, - v.DelegatorShares, v.Description, - v.UnbondingHeight, v.UnbondingCompletionTime, v.MinSelfDelegation, v.Commission) + + return vp.ToValidator(), nil } // this is a helper struct used for JSON de- and encoding only @@ -292,16 +339,6 @@ func (v Validator) IsUnbonding() bool { // constant used in flags to indicate that description field should not be updated const DoNotModifyDesc = "[do-not-modify]" -// Description - description fields for a validator -type Description struct { - Moniker string `json:"moniker" yaml:"moniker"` // name - Identity string `json:"identity" yaml:"identity"` // optional identity signature (ex. UPort or Keybase) - Website string `json:"website" yaml:"website"` // optional website link - SecurityContact string `json:"security_contact" yaml:"security_contact"` // optional security contact info - Details string `json:"details" yaml:"details"` // optional details -} - -// NewDescription returns a new Description with the provided values. func NewDescription(moniker, identity, website, securityContact, details string) Description { return Description{ Moniker: moniker, @@ -312,6 +349,12 @@ func NewDescription(moniker, identity, website, securityContact, details string) } } +// String implements the Stringer interface for a Description object. +func (d Description) String() string { + out, _ := yaml.Marshal(d) + return string(out) +} + // UpdateDescription updates the fields of a given description. An error is // returned if the resulting description contains an invalid length. func (d Description) UpdateDescription(d2 Description) (Description, error) { From 31311cb19e41794ddbd3dc156c226b8bb4c55460 Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Mon, 3 Feb 2020 09:35:04 -0500 Subject: [PATCH 02/46] Use int32 for validator status --- x/staking/types/types.pb.go | 222 ++++++++++++++++------------------- x/staking/types/types.proto | 2 +- x/staking/types/validator.go | 10 +- 3 files changed, 108 insertions(+), 126 deletions(-) diff --git a/x/staking/types/types.pb.go b/x/staking/types/types.pb.go index 55d2ae2322a7..cf26d4124045 100644 --- a/x/staking/types/types.pb.go +++ b/x/staking/types/types.pb.go @@ -254,7 +254,7 @@ type ValidatorProto struct { // once Tendermint supports pubkeys as slices. ConsensusPubkey types1.PublicKey `protobuf:"bytes,2,opt,name=consensus_pubkey,json=consensusPubkey,proto3" json:"consensus_pubkey" yaml:"consensus_pubkey"` Jailed bool `protobuf:"varint,3,opt,name=jailed,proto3" json:"jailed,omitempty"` - Status []byte `protobuf:"bytes,4,opt,name=status,proto3" json:"status,omitempty"` + Status int32 `protobuf:"varint,4,opt,name=status,proto3" json:"status,omitempty"` Tokens github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,5,opt,name=tokens,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"tokens"` DelegatorShares github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,6,opt,name=delegator_shares,json=delegatorShares,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"delegator_shares" yaml:"delegator_shares"` Description Description `protobuf:"bytes,7,opt,name=description,proto3" json:"description"` @@ -318,11 +318,11 @@ func (m *ValidatorProto) GetJailed() bool { return false } -func (m *ValidatorProto) GetStatus() []byte { +func (m *ValidatorProto) GetStatus() int32 { if m != nil { return m.Status } - return nil + return 0 } func (m *ValidatorProto) GetDescription() Description { @@ -858,96 +858,96 @@ func init() { func init() { proto.RegisterFile("x/staking/types/types.proto", fileDescriptor_c669c0a3ee1b124c) } var fileDescriptor_c669c0a3ee1b124c = []byte{ - // 1409 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x58, 0xcb, 0x6f, 0x1b, 0x45, - 0x18, 0xcf, 0xda, 0xc1, 0x49, 0xc6, 0x6d, 0x1c, 0x4f, 0xd4, 0xd6, 0x75, 0xa9, 0xb7, 0x2c, 0xa8, - 0x44, 0x88, 0xae, 0xd5, 0x16, 0x09, 0xa9, 0x5c, 0xa8, 0xe3, 0x56, 0x09, 0xa4, 0x52, 0xba, 0x2d, - 0x39, 0xf0, 0xd0, 0x6a, 0xbc, 0x3b, 0xb1, 0x87, 0xec, 0xc3, 0xec, 0x8c, 0x53, 0xbb, 0xe2, 0xca, - 0x05, 0x09, 0xd1, 0x63, 0x6f, 0x54, 0x9c, 0xb8, 0xf1, 0x6f, 0x94, 0x5b, 0xc5, 0x01, 0x21, 0x0e, - 0x06, 0xb5, 0x17, 0xc4, 0x09, 0xf9, 0xc0, 0x81, 0x13, 0x9a, 0xc7, 0x7a, 0x37, 0xeb, 0x9a, 0xd6, - 0xe1, 0x00, 0x12, 0xb9, 0x24, 0x9e, 0xdf, 0x7e, 0xdf, 0xef, 0x9b, 0xf9, 0x9e, 0xb3, 0x0b, 0xce, - 0xf4, 0xeb, 0x94, 0xa1, 0x3d, 0x12, 0xb4, 0xeb, 0x6c, 0xd0, 0xc5, 0x54, 0x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, 0xbd, 0xb8, - 0xd7, 0x1d, 0x79, 0x18, 0xde, 0x04, 0x0b, 0x38, 0x60, 0x11, 0x11, 0x2e, 0xe6, 0xd7, 0xfc, 0x8b, - 0x53, 0xdb, 0xfc, 0x53, 0xdc, 0x76, 0x2d, 0x60, 0xd1, 0x40, 0x35, 0xfd, 0x98, 0x27, 0xe5, 0xec, - 0x2f, 0xf3, 0xa0, 0x32, 0x4d, 0x0b, 0xae, 0x83, 0x92, 0x13, 0x61, 0x01, 0xc4, 0x03, 0x51, 0x13, - 0x03, 0xb1, 0x9a, 0x5c, 0x97, 0x33, 0x02, 0x86, 0xb5, 0x1c, 0x23, 0x6a, 0x1c, 0xb6, 0x01, 0xbf, - 0xca, 0xf2, 0x46, 0xc6, 0xa5, 0x9e, 0xf3, 0xee, 0x6a, 0xa8, 0x79, 0x18, 0x1b, 0x39, 0x48, 0x20, - 0x07, 0xe2, 0x72, 0x82, 0x8a, 0x89, 0xf8, 0x09, 0x28, 0x91, 0x80, 0x30, 0x82, 0x3c, 0xbb, 0x85, - 0x3c, 0x14, 0x38, 0x87, 0x79, 0x15, 0x90, 0x23, 0x4c, 0x99, 0xcd, 0xd0, 0x19, 0xd6, 0xb2, 0x42, - 0x1a, 0x12, 0x80, 0x1b, 0x60, 0x21, 0x36, 0x35, 0x7f, 0xa8, 0xfb, 0x53, 0xac, 0x9e, 0x8a, 0xc8, - 0x17, 0x79, 0x50, 0xb6, 0xb0, 0x7b, 0x14, 0x8a, 0xd9, 0x42, 0x71, 0x03, 0x00, 0xd9, 0x49, 0x78, - 0xd7, 0x3f, 0x44, 0x34, 0x78, 0x2f, 0x5a, 0x92, 0x0c, 0x4d, 0xca, 0x52, 0xf1, 0xf8, 0x3d, 0x0f, - 0x8e, 0xa5, 0xe3, 0x71, 0x34, 0x8e, 0xff, 0x3b, 0xe3, 0x18, 0xbe, 0x93, 0xf4, 0xc6, 0x79, 0xd1, - 0x1b, 0x5f, 0x9b, 0xda, 0x1b, 0x27, 0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0x7c, 0xff, 0xbb, 0x5d, 0x14, 0x00, - 0x00, + // 1410 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x58, 0xcd, 0x6f, 0x1b, 0x45, + 0x1b, 0xcf, 0xda, 0xa9, 0x93, 0x8c, 0xdb, 0x38, 0x9e, 0xa8, 0xad, 0xeb, 0xbe, 0xf5, 0xf6, 0x5d, + 0x50, 0x89, 0x10, 0x5d, 0xab, 0x2d, 0x12, 0x52, 0xb9, 0x50, 0xc7, 0xad, 0x12, 0x48, 0xa5, 0x74, + 0x5b, 0x72, 0xe0, 0x43, 0xab, 0xf1, 0xee, 0xc4, 0x1e, 0xb2, 0x1f, 0x66, 0x67, 0x9c, 0xda, 0x15, + 0x57, 0x2e, 0x48, 0x88, 0x1e, 0x7b, 0xa3, 0xe2, 0xc4, 0x8d, 0x7f, 0xa3, 0xdc, 0x2a, 0x0e, 0x08, + 0x71, 0x30, 0xa8, 0xbd, 0x20, 0x4e, 0xc8, 0x07, 0x0e, 0x9c, 0xd0, 0x7c, 0xac, 0x77, 0xb3, 0xae, + 0x69, 0x1d, 0x0e, 0x20, 0x91, 0x4b, 0xe2, 0xf9, 0xed, 0xf3, 0xfc, 0x9e, 0x99, 0xe7, 0x73, 0x76, + 0xc1, 0xd9, 0x7e, 0x9d, 0x32, 0xb4, 0x47, 0x82, 0x76, 0x9d, 0x0d, 0xba, 0x98, 0xca, 0xbf, 0x66, + 0x37, 0x0a, 0x59, 0x08, 0x4f, 0x3b, 0x21, 0xf5, 0x43, 0x6a, 0x53, 0x77, 0xcf, 0xec, 0x9b, 0x4a, + 0xce, 0xdc, 0xbf, 0x54, 0xbd, 0xc0, 0x3a, 0x24, 0x72, 0xed, 0x2e, 0x8a, 0xd8, 0xa0, 0x2e, 0x64, + 0xeb, 0xed, 0xb0, 0x1d, 0x26, 0xbf, 0x24, 0x41, 0xf5, 0xca, 0xa4, 0x1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xc5, 0x01, 0x23, 0x6c, 0x20, 0x03, 0x6b, 0x8d, 0xd7, + 0x5c, 0xeb, 0x2e, 0x6e, 0x51, 0x12, 0x87, 0xc3, 0x8a, 0x97, 0xf0, 0x06, 0x58, 0xa1, 0xd8, 0xe9, + 0x45, 0x84, 0x0d, 0x6c, 0x27, 0x0c, 0x18, 0x72, 0x58, 0x65, 0x5e, 0x44, 0xec, 0xec, 0x68, 0xa8, + 0x9f, 0x96, 0x7b, 0xcd, 0x4a, 0x18, 0x56, 0x29, 0x86, 0xd6, 0x25, 0xc2, 0x2d, 0xb8, 0x98, 0x21, + 0xe2, 0xd1, 0xca, 0x31, 0x69, 0x41, 0x2d, 0x53, 0x67, 0xf9, 0x7a, 0x01, 0x2c, 0x1f, 0xcc, 0x7c, + 0x78, 0x17, 0xac, 0x84, 0x5d, 0x1c, 0x71, 0xc0, 0x46, 0xae, 0x1b, 0x61, 0x2a, 0x83, 0x74, 0xbc, + 0xb1, 0x95, 0x98, 0xcf, 0x4a, 0x18, 0x7f, 0x0c, 0xf5, 0x8b, 0x2f, 0x90, 0x47, 0x3b, 0xc8, 0xbb, + 0x26, 0x35, 0xac, 0x52, 0xcc, 0xa1, 0x00, 0xe8, 0xf2, 0xec, 0x08, 0x28, 0x0e, 0x68, 0x8f, 0xda, + 0xdd, 0x5e, 0x6b, 0x0f, 0x0f, 0x54, 0x0c, 0x2b, 0xe9, 0xec, 0xd8, 0xbf, 0x64, 0x6e, 0xf7, 0x5a, + 0x1e, 0x71, 0xde, 0xc1, 0x83, 0x86, 0xae, 0x22, 0xa8, 0xb6, 0x95, 0xd5, 0x37, 0x78, 0x92, 0x28, + 0x68, 0x5b, 0x20, 0xf0, 0x14, 0x28, 0x7c, 0x84, 0x88, 0x87, 0x5d, 0xe1, 0xf6, 0x45, 0x4b, 0xad, + 0x38, 0x4e, 0x19, 0x62, 0x3d, 0x2a, 0x7c, 0x7d, 0xcc, 0x52, 0x2b, 0x78, 0x03, 0x14, 0x58, 0xb8, + 0x87, 0x03, 0xe5, 0xc4, 0x99, 0x4a, 0x7c, 0x33, 0x60, 0x96, 0xd2, 0x86, 0x0c, 0xac, 0xb8, 0xd8, + 0xc3, 0x6d, 0xe1, 0x35, 0xda, 0x41, 0x11, 0xa6, 0x95, 0x82, 0x60, 0xdc, 0x9c, 0xb9, 0x0e, 0xd5, + 0x69, 0xb3, 0x7c, 0x86, 0x55, 0x1a, 0x43, 0xb7, 0x05, 0x02, 0xb7, 0x40, 0xd1, 0x4d, 0x52, 0xb5, + 0xb2, 0x20, 0xdc, 0xf9, 0xf2, 0xd4, 0x62, 0x4b, 0xa5, 0xb5, 0xea, 0x80, 0x69, 0x75, 0x9e, 0x99, + 0xbd, 0xa0, 0x15, 0x06, 0x2e, 0x09, 0xda, 0x76, 0x07, 0x93, 0x76, 0x87, 0x55, 0x16, 0xcf, 0x6b, + 0x6b, 0xf9, 0x74, 0x66, 0x66, 0x25, 0x0c, 0xab, 0x34, 0x86, 0x36, 0x04, 0x02, 0x5d, 0xb0, 0x9c, + 0x48, 0x89, 0x5a, 0x5d, 0x7a, 0x6e, 0xad, 0xfe, 0x5f, 0x45, 0xfa, 0x64, 0xd6, 0x4a, 0x52, 0xae, + 0x27, 0xc6, 0x20, 0x57, 0x83, 0x9b, 0x00, 0x24, 0x1d, 0xa2, 0x02, 0x84, 0x85, 0x97, 0x5e, 0xa0, + 0xcf, 0xa8, 0x93, 0xa7, 0x94, 0xe1, 0x27, 0x60, 0xd5, 0x27, 0x81, 0x4d, 0xb1, 0xb7, 0x6b, 0x2b, + 0x17, 0x73, 0xce, 0xa2, 0x88, 0xdf, 0xd6, 0x6c, 0x19, 0x31, 0x1a, 0xea, 0x55, 0xd5, 0x47, 0x27, + 0x29, 0x0d, 0xab, 0xec, 0x93, 0xe0, 0x36, 0xf6, 0x76, 0x9b, 0x63, 0x4c, 0x4d, 0x9f, 0xcf, 0x72, + 0xa0, 0xd0, 0xdc, 0xd9, 0x46, 0x24, 0x82, 0xf7,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27, 0x1a, 0x67, 0x12, 0x96, 0x83, 0xcf, 0xe5, 0x47, 0x89, 0xf1, 0xab, + 0x2d, 0x85, 0x6f, 0x80, 0x22, 0x97, 0x48, 0xe6, 0x04, 0x57, 0x3f, 0x95, 0xbc, 0xfc, 0xa7, 0x1e, + 0x1a, 0x16, 0xf0, 0x51, 0xff, 0xba, 0x5c, 0xc0, 0x2d, 0x00, 0x3b, 0xe3, 0xcf, 0x52, 0x76, 0xe2, + 0x4b, 0xae, 0x7f, 0x6e, 0x34, 0xd4, 0xcf, 0x48, 0xfd, 0x49, 0x19, 0xc3, 0x2a, 0x27, 0x60, 0xcc, + 0xf6, 0x3a, 0x00, 0xfc, 0x5c, 0xb6, 0x8b, 0x83, 0xd0, 0x57, 0xaf, 0x94, 0x27, 0x47, 0x43, 0xbd, + 0x2c, 0x59, 0x92, 0x67, 0x86, 0xb5, 0xc4, 0x17, 0x4d, 0xfe, 0x3b, 0x71, 0x7c, 0xe3, 0xc6, 0xa3, + 0x27, 0x35, 0xed, 0xf1, 0x93, 0x9a, 0xf6, 0xf3, 0x93, 0x9a, 0x76, 0xff, 0x69, 0x6d, 0xee, 0xf1, + 0xd3, 0xda, 0xdc, 0x0f, 0x4f, 0x6b, 0x73, 0xef, 0xbd, 0xf6, 0x97, 0xc9, 0x92, 0xf9, 0x86, 0xd8, + 0x2a, 0x88, 0xa8, 0x5c, 0xf9, 0x33, 0x00, 0x00, 0xff, 0xff, 0xf1, 0x6f, 0x88, 0x86, 0x5d, 0x14, + 0x00, 0x00, } func (this *HistoricalInfoProto) Equal(that interface{}) bool { @@ -1103,7 +1103,7 @@ func (this *ValidatorProto) Equal(that interface{}) bool { if this.Jailed != that1.Jailed { return false } - if !bytes.Equal(this.Status, that1.Status) { + if this.Status != that1.Status { return false } if !this.Tokens.Equal(that1.Tokens) { @@ -1673,12 +1673,10 @@ func (m *ValidatorProto) MarshalToSizedBuffer(dAtA []byte) (int, error) { } i-- dAtA[i] = 0x2a - if len(m.Status) > 0 { - i -= len(m.Status) - copy(dAtA[i:], m.Status) - i = encodeVarintTypes(dAtA, i, uint64(len(m.Status))) + if m.Status != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.Status)) i-- - dAtA[i] = 0x22 + dAtA[i] = 0x20 } if m.Jailed { i-- @@ -2212,9 +2210,8 @@ func (m *ValidatorProto) Size() (n int) { if m.Jailed { n += 2 } - l = len(m.Status) - if l > 0 { - n += 1 + l + sovTypes(uint64(l)) + if m.Status != 0 { + n += 1 + sovTypes(uint64(m.Status)) } l = m.Tokens.Size() n += 1 + l + sovTypes(uint64(l)) @@ -3131,10 +3128,10 @@ func (m *ValidatorProto) Unmarshal(dAtA []byte) error { } m.Jailed = bool(v != 0) case 4: - if wireType != 2 { + if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) } - var byteLen int + m.Status = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTypes @@ -3144,26 +3141,11 @@ func (m *ValidatorProto) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= int(b&0x7F) << shift + m.Status |= int32(b&0x7F) << shift if b < 0x80 { break } } - if byteLen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Status = append(m.Status[:0], dAtA[iNdEx:postIndex]...) - if m.Status == nil { - m.Status = []byte{} - } - iNdEx = postIndex case 5: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Tokens", wireType) diff --git a/x/staking/types/types.proto b/x/staking/types/types.proto index c4da8b6fbc45..5ff36762df4d 100644 --- a/x/staking/types/types.proto +++ b/x/staking/types/types.proto @@ -82,7 +82,7 @@ message ValidatorProto { (gogoproto.nullable) = false ]; bool jailed = 3; - bytes status = 4; + int32 status = 4; string tokens = 5 [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false diff --git a/x/staking/types/validator.go b/x/staking/types/validator.go index c981b4c97035..74a6b7b2b85c 100644 --- a/x/staking/types/validator.go +++ b/x/staking/types/validator.go @@ -78,17 +78,17 @@ func (v Validator) ToProto() ValidatorProto { switch t := v.ConsPubKey.(type) { case secp256k1.PubKeySecp256k1: pk = sdk.PublicKey{ - Pub: &sdk.PublicKey_Secp256K1{t.Bytes()}, + Pub: &sdk.PublicKey_Secp256K1{Secp256K1: t.Bytes()}, } case ed25519.PubKeyEd25519: pk = sdk.PublicKey{ - Pub: &sdk.PublicKey_Ed25519{t.Bytes()}, + Pub: &sdk.PublicKey_Ed25519{Ed25519: t.Bytes()}, } case sr25519.PubKeySr25519: pk = sdk.PublicKey{ - Pub: &sdk.PublicKey_Sr25519{t.Bytes()}, + Pub: &sdk.PublicKey_Sr25519{Sr25519: t.Bytes()}, } } @@ -96,7 +96,7 @@ func (v Validator) ToProto() ValidatorProto { OperatorAddress: v.OperatorAddress, ConsensusPubkey: pk, Jailed: v.Jailed, - Status: []byte{byte(v.Status)}, + Status: int32(v.Status), Tokens: v.Tokens, DelegatorShares: v.DelegatorShares, Description: v.Description, @@ -136,7 +136,7 @@ func (vp ValidatorProto) ToValidator() Validator { OperatorAddress: vp.OperatorAddress, ConsPubKey: pk, Jailed: vp.Jailed, - Status: sdk.BondStatus(vp.Status[0]), + Status: sdk.BondStatus(byte(vp.Status)), Tokens: vp.Tokens, DelegatorShares: vp.DelegatorShares, Description: vp.Description, From 0d2938ba1712ea05cba4135c824abf94575a36ef Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Mon, 3 Feb 2020 14:39:40 -0500 Subject: [PATCH 03/46] Update staking types --- x/staking/types/errors.go | 1 + x/staking/types/historical_info.go | 47 +- x/staking/types/historical_info_test.go | 6 +- x/staking/types/msg.go | 138 +- x/staking/types/msg_test.go | 47 - x/staking/types/types.pb.go | 2647 +++++++++++++++++++---- x/staking/types/types.proto | 120 +- x/staking/types/validator.go | 260 +-- x/staking/types/validator_test.go | 52 +- 9 files changed, 2337 insertions(+), 981 deletions(-) diff --git a/x/staking/types/errors.go b/x/staking/types/errors.go index d3ccf0a9dac2..62fdd0725b90 100644 --- a/x/staking/types/errors.go +++ b/x/staking/types/errors.go @@ -56,4 +56,5 @@ var ( ErrNeitherShareMsgsGiven = sdkerrors.Register(ModuleName, 43, "neither shares amount nor shares percent provided") ErrInvalidHistoricalInfo = sdkerrors.Register(ModuleName, 44, "invalid historical info") ErrNoHistoricalInfo = sdkerrors.Register(ModuleName, 45, "no historical info found") + ErrEmptyValidatorPubKey = sdkerrors.Register(ModuleName, 46, "empty validator public key") ) diff --git a/x/staking/types/historical_info.go b/x/staking/types/historical_info.go index 58215b1eb53f..98f2ea86a5cd 100644 --- a/x/staking/types/historical_info.go +++ b/x/staking/types/historical_info.go @@ -9,49 +9,19 @@ import ( sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) -// HistoricalInfo contains the historical information that gets stored at each height -type HistoricalInfo struct { - Header abci.Header `json:"header" yaml:"header"` - ValSet Validators `json:"valset" yaml:"valset"` -} - // NewHistoricalInfo will create a historical information struct from header and valset // it will first sort valset before inclusion into historical info func NewHistoricalInfo(header abci.Header, valSet Validators) HistoricalInfo { sort.Sort(valSet) return HistoricalInfo{ Header: header, - ValSet: valSet, - } -} - -// ToProto converts a HistoricalInfo into a HistoricalInfoProto type. -func (hi HistoricalInfo) ToProto() HistoricalInfoProto { - valsetProto := make([]ValidatorProto, len(hi.ValSet)) - for i, val := range hi.ValSet { - valsetProto[i] = val.ToProto() - } - - return HistoricalInfoProto{ - Header: hi.Header, - Valset: valsetProto, + Valset: valSet, } } -// ToHistoricalInfo converts a HistoricalInfoProto to a HistoricalInfo type. -func (hip HistoricalInfoProto) ToHistoricalInfo() HistoricalInfo { - valset := make(Validators, len(hip.Valset)) - for i, valProto := range hip.Valset { - valset[i] = valProto.ToValidator() - } - - return NewHistoricalInfo(hip.Header, valset) -} - // MustMarshalHistoricalInfo wll marshal historical info and panic on error func MustMarshalHistoricalInfo(cdc codec.Marshaler, hi HistoricalInfo) []byte { - hiProto := hi.ToProto() - return cdc.MustMarshalBinaryLengthPrefixed(&hiProto) + return cdc.MustMarshalBinaryLengthPrefixed(&hi) } // MustUnmarshalHistoricalInfo wll unmarshal historical info and panic on error @@ -65,21 +35,18 @@ func MustUnmarshalHistoricalInfo(cdc codec.Marshaler, value []byte) HistoricalIn // UnmarshalHistoricalInfo will unmarshal historical info and return any error func UnmarshalHistoricalInfo(cdc codec.Marshaler, value []byte) (hi HistoricalInfo, err error) { - hip := HistoricalInfoProto{} - if err := cdc.UnmarshalBinaryLengthPrefixed(value, &hip); err != nil { - return HistoricalInfo{}, err - } - - return hip.ToHistoricalInfo(), nil + err = cdc.UnmarshalBinaryLengthPrefixed(value, &hi) + return hi, err } // ValidateBasic will ensure HistoricalInfo is not nil and sorted func ValidateBasic(hi HistoricalInfo) error { - if len(hi.ValSet) == 0 { + if len(hi.Valset) == 0 { return sdkerrors.Wrap(ErrInvalidHistoricalInfo, "validator set is empty") } - if !sort.IsSorted(Validators(hi.ValSet)) { + if !sort.IsSorted(Validators(hi.Valset)) { return sdkerrors.Wrap(ErrInvalidHistoricalInfo, "validator set is not sorted by address") } + return nil } diff --git a/x/staking/types/historical_info_test.go b/x/staking/types/historical_info_test.go index f607ba15031c..32e149af56a9 100644 --- a/x/staking/types/historical_info_test.go +++ b/x/staking/types/historical_info_test.go @@ -23,7 +23,7 @@ var ( func TestHistoricalInfo(t *testing.T) { hi := NewHistoricalInfo(header, validators) - require.True(t, sort.IsSorted(Validators(hi.ValSet)), "Validators are not sorted") + require.True(t, sort.IsSorted(Validators(hi.Valset)), "Validators are not sorted") var value []byte require.NotPanics(t, func() { @@ -35,7 +35,7 @@ func TestHistoricalInfo(t *testing.T) { recv, err := UnmarshalHistoricalInfo(ModuleCdc, value) require.Nil(t, err, "Unmarshalling HistoricalInfo failed") require.Equal(t, hi, recv, "Unmarshalled HistoricalInfo is different from original") - require.True(t, sort.IsSorted(Validators(hi.ValSet)), "Validators are not sorted") + require.True(t, sort.IsSorted(Validators(hi.Valset)), "Validators are not sorted") } func TestValidateBasic(t *testing.T) { @@ -56,7 +56,7 @@ func TestValidateBasic(t *testing.T) { hi = HistoricalInfo{ Header: header, - ValSet: validators, + Valset: validators, } err = ValidateBasic(hi) require.Error(t, err, "ValidateBasic passed on unsorted ValSet") diff --git a/x/staking/types/msg.go b/x/staking/types/msg.go index 62d2295fce6f..18e0bac2dc13 100644 --- a/x/staking/types/msg.go +++ b/x/staking/types/msg.go @@ -2,16 +2,13 @@ package types import ( "bytes" - "encoding/json" "github.com/tendermint/tendermint/crypto" - yaml "gopkg.in/yaml.v2" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) -// ensure Msg interface compliance at compile time var ( _ sdk.Msg = &MsgCreateValidator{} _ sdk.Msg = &MsgEditValidator{} @@ -20,29 +17,6 @@ var ( _ sdk.Msg = &MsgBeginRedelegate{} ) -//______________________________________________________________________ - -// MsgCreateValidator - struct for bonding transactions -type MsgCreateValidator struct { - Description Description `json:"description" yaml:"description"` - Commission CommissionRates `json:"commission" yaml:"commission"` - MinSelfDelegation sdk.Int `json:"min_self_delegation" yaml:"min_self_delegation"` - DelegatorAddress sdk.AccAddress `json:"delegator_address" yaml:"delegator_address"` - ValidatorAddress sdk.ValAddress `json:"validator_address" yaml:"validator_address"` - PubKey crypto.PubKey `json:"pubkey" yaml:"pubkey"` - Value sdk.Coin `json:"value" yaml:"value"` -} - -type msgCreateValidatorJSON struct { - Description Description `json:"description" yaml:"description"` - Commission CommissionRates `json:"commission" yaml:"commission"` - MinSelfDelegation sdk.Int `json:"min_self_delegation" yaml:"min_self_delegation"` - DelegatorAddress sdk.AccAddress `json:"delegator_address" yaml:"delegator_address"` - ValidatorAddress sdk.ValAddress `json:"validator_address" yaml:"validator_address"` - PubKey string `json:"pubkey" yaml:"pubkey"` - Value sdk.Coin `json:"value" yaml:"value"` -} - // NewMsgCreateValidator creates a new MsgCreateValidator instance. // Delegator address and validator address are the same. func NewMsgCreateValidator( @@ -50,11 +24,16 @@ func NewMsgCreateValidator( description Description, commission CommissionRates, minSelfDelegation sdk.Int, ) MsgCreateValidator { + var pkStr string + if pubKey != nil { + pkStr = sdk.MustBech32ifyPubKey(sdk.Bech32PubKeyTypeConsPub, pubKey) + } + return MsgCreateValidator{ Description: description, DelegatorAddress: sdk.AccAddress(valAddr), ValidatorAddress: valAddr, - PubKey: pubKey, + Pubkey: pkStr, Value: selfDelegation, Commission: commission, MinSelfDelegation: minSelfDelegation, @@ -81,70 +60,6 @@ func (msg MsgCreateValidator) GetSigners() []sdk.AccAddress { return addrs } -// MarshalJSON implements the json.Marshaler interface to provide custom JSON -// serialization of the MsgCreateValidator type. -func (msg MsgCreateValidator) MarshalJSON() ([]byte, error) { - return json.Marshal(msgCreateValidatorJSON{ - Description: msg.Description, - Commission: msg.Commission, - DelegatorAddress: msg.DelegatorAddress, - ValidatorAddress: msg.ValidatorAddress, - PubKey: sdk.MustBech32ifyPubKey(sdk.Bech32PubKeyTypeConsPub, msg.PubKey), - Value: msg.Value, - MinSelfDelegation: msg.MinSelfDelegation, - }) -} - -// UnmarshalJSON implements the json.Unmarshaler interface to provide custom -// JSON deserialization of the MsgCreateValidator type. -func (msg *MsgCreateValidator) UnmarshalJSON(bz []byte) error { - var msgCreateValJSON msgCreateValidatorJSON - if err := json.Unmarshal(bz, &msgCreateValJSON); err != nil { - return err - } - - msg.Description = msgCreateValJSON.Description - msg.Commission = msgCreateValJSON.Commission - msg.DelegatorAddress = msgCreateValJSON.DelegatorAddress - msg.ValidatorAddress = msgCreateValJSON.ValidatorAddress - var err error - msg.PubKey, err = sdk.GetPubKeyFromBech32(sdk.Bech32PubKeyTypeConsPub, msgCreateValJSON.PubKey) - if err != nil { - return err - } - msg.Value = msgCreateValJSON.Value - msg.MinSelfDelegation = msgCreateValJSON.MinSelfDelegation - - return nil -} - -// MarshalYAML implements a custom marshal yaml function due to consensus pubkey. -func (msg MsgCreateValidator) MarshalYAML() (interface{}, error) { - bs, err := yaml.Marshal(struct { - Description Description - Commission CommissionRates - MinSelfDelegation sdk.Int - DelegatorAddress sdk.AccAddress - ValidatorAddress sdk.ValAddress - PubKey string - Value sdk.Coin - }{ - Description: msg.Description, - Commission: msg.Commission, - MinSelfDelegation: msg.MinSelfDelegation, - DelegatorAddress: msg.DelegatorAddress, - ValidatorAddress: msg.ValidatorAddress, - PubKey: sdk.MustBech32ifyPubKey(sdk.Bech32PubKeyTypeConsPub, msg.PubKey), - Value: msg.Value, - }) - - if err != nil { - return nil, err - } - - return string(bs), nil -} - // GetSignBytes returns the message bytes to sign over. func (msg MsgCreateValidator) GetSignBytes() []byte { bz := ModuleCdc.MustMarshalJSON(msg) @@ -163,6 +78,9 @@ func (msg MsgCreateValidator) ValidateBasic() error { if !sdk.AccAddress(msg.ValidatorAddress).Equals(msg.DelegatorAddress) { return ErrBadValidatorAddr } + if msg.Pubkey == "" { + return ErrEmptyValidatorPubKey + } if !msg.Value.Amount.IsPositive() { return ErrBadDelegationAmount } @@ -185,20 +103,6 @@ func (msg MsgCreateValidator) ValidateBasic() error { return nil } -// MsgEditValidator - struct for editing a validator -type MsgEditValidator struct { - Description Description `json:"description" yaml:"description"` - ValidatorAddress sdk.ValAddress `json:"address" yaml:"address"` - - // We pass a reference to the new commission rate and min self delegation as it's not mandatory to - // update. If not updated, the deserialized rate will be zero with no way to - // distinguish if an update was intended. - // - // REF: #2373 - CommissionRate *sdk.Dec `json:"commission_rate" yaml:"commission_rate"` - MinSelfDelegation *sdk.Int `json:"min_self_delegation" yaml:"min_self_delegation"` -} - // NewMsgEditValidator creates a new MsgEditValidator instance func NewMsgEditValidator(valAddr sdk.ValAddress, description Description, newRate *sdk.Dec, newMinSelfDelegation *sdk.Int) MsgEditValidator { return MsgEditValidator{ @@ -246,13 +150,6 @@ func (msg MsgEditValidator) ValidateBasic() error { return nil } -// MsgDelegate - struct for bonding transactions -type MsgDelegate struct { - DelegatorAddress sdk.AccAddress `json:"delegator_address" yaml:"delegator_address"` - ValidatorAddress sdk.ValAddress `json:"validator_address" yaml:"validator_address"` - Amount sdk.Coin `json:"amount" yaml:"amount"` -} - // NewMsgDelegate creates a new MsgDelegate instance. func NewMsgDelegate(delAddr sdk.AccAddress, valAddr sdk.ValAddress, amount sdk.Coin) MsgDelegate { return MsgDelegate{ @@ -293,16 +190,6 @@ func (msg MsgDelegate) ValidateBasic() error { return nil } -//______________________________________________________________________ - -// MsgBeginRedelegate defines the attributes of a bonding transaction. -type MsgBeginRedelegate struct { - DelegatorAddress sdk.AccAddress `json:"delegator_address" yaml:"delegator_address"` - ValidatorSrcAddress sdk.ValAddress `json:"validator_src_address" yaml:"validator_src_address"` - ValidatorDstAddress sdk.ValAddress `json:"validator_dst_address" yaml:"validator_dst_address"` - Amount sdk.Coin `json:"amount" yaml:"amount"` -} - // NewMsgBeginRedelegate creates a new MsgBeginRedelegate instance. func NewMsgBeginRedelegate( delAddr sdk.AccAddress, valSrcAddr, valDstAddr sdk.ValAddress, amount sdk.Coin, @@ -349,13 +236,6 @@ func (msg MsgBeginRedelegate) ValidateBasic() error { return nil } -// MsgUndelegate - struct for unbonding transactions -type MsgUndelegate struct { - DelegatorAddress sdk.AccAddress `json:"delegator_address" yaml:"delegator_address"` - ValidatorAddress sdk.ValAddress `json:"validator_address" yaml:"validator_address"` - Amount sdk.Coin `json:"amount" yaml:"amount"` -} - // NewMsgUndelegate creates a new MsgUndelegate instance. func NewMsgUndelegate(delAddr sdk.AccAddress, valAddr sdk.ValAddress, amount sdk.Coin) MsgUndelegate { return MsgUndelegate{ diff --git a/x/staking/types/msg_test.go b/x/staking/types/msg_test.go index 784b653d2b8f..22914ec8aefa 100644 --- a/x/staking/types/msg_test.go +++ b/x/staking/types/msg_test.go @@ -1,11 +1,8 @@ package types import ( - "fmt" "testing" - yaml "gopkg.in/yaml.v2" - "github.com/stretchr/testify/require" "github.com/tendermint/tendermint/crypto" @@ -157,47 +154,3 @@ func TestMsgUndelegate(t *testing.T) { } } } - -//test to validate if NewMsgCreateValidator implements yaml marshaller -func TestMsgMarshalYAML(t *testing.T) { - commission1 := NewCommissionRates(sdk.ZeroDec(), sdk.ZeroDec(), sdk.ZeroDec()) - tc := struct { - name, moniker, identity, website, securityContact, details string - CommissionRates CommissionRates - minSelfDelegation sdk.Int - validatorAddr sdk.ValAddress - pubkey crypto.PubKey - bond sdk.Coin - expectPass bool - }{"basic good", "a", "b", "c", "d", "e", commission1, sdk.OneInt(), valAddr1, pk1, coinPos, true} - - description := NewDescription(tc.moniker, tc.identity, tc.website, tc.securityContact, tc.details) - msg := NewMsgCreateValidator(tc.validatorAddr, tc.pubkey, tc.bond, description, tc.CommissionRates, tc.minSelfDelegation) - bs, err := yaml.Marshal(msg) - require.NoError(t, err) - bechifiedPub, err := sdk.Bech32ifyPubKey(sdk.Bech32PubKeyTypeConsPub, msg.PubKey) - require.NoError(t, err) - - want := fmt.Sprintf(`| - description: - moniker: a - identity: b - website: c - security_contact: d - details: e - commission: - rate: "0.000000000000000000" - max_rate: "0.000000000000000000" - max_change_rate: "0.000000000000000000" - minselfdelegation: "1" - delegatoraddress: %s - validatoraddress: %s - pubkey: %s - value: - denom: stake - amount: "1000" -`, msg.DelegatorAddress, msg.ValidatorAddress, bechifiedPub) - - require.Equal(t, want, string(bs)) - -} diff --git a/x/staking/types/types.pb.go b/x/staking/types/types.pb.go index cf26d4124045..d84de519e7e2 100644 --- a/x/staking/types/types.pb.go +++ b/x/staking/types/types.pb.go @@ -7,13 +7,13 @@ import ( bytes "bytes" fmt "fmt" github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" - types1 "github.com/cosmos/cosmos-sdk/types" + types "github.com/cosmos/cosmos-sdk/types" _ "github.com/gogo/protobuf/gogoproto" proto "github.com/gogo/protobuf/proto" github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" _ "github.com/golang/protobuf/ptypes/duration" _ "github.com/golang/protobuf/ptypes/timestamp" - types "github.com/tendermint/tendermint/abci/types" + types1 "github.com/tendermint/tendermint/abci/types" io "io" math "math" math_bits "math/bits" @@ -32,25 +32,365 @@ var _ = time.Kitchen // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -// HistoricalInfoProto contains the historical information that gets stored at +// MsgCreateValidator defines an SDK message for creating a new validator. +type MsgCreateValidator struct { + Description Description `protobuf:"bytes,1,opt,name=description,proto3" json:"description"` + Commission CommissionRates `protobuf:"bytes,2,opt,name=commission,proto3" json:"commission"` + MinSelfDelegation github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,3,opt,name=min_self_delegation,json=minSelfDelegation,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"min_self_delegation" yaml:"min_self_delegation"` + DelegatorAddress github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,4,opt,name=delegator_address,json=delegatorAddress,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"delegator_address,omitempty" yaml:"delegator_address"` + ValidatorAddress github_com_cosmos_cosmos_sdk_types.ValAddress `protobuf:"bytes,5,opt,name=validator_address,json=validatorAddress,proto3,casttype=github.com/cosmos/cosmos-sdk/types.ValAddress" json:"validator_address,omitempty" yaml:"validator_address"` + Pubkey string `protobuf:"bytes,6,opt,name=pubkey,proto3" json:"pubkey,omitempty"` + Value types.Coin `protobuf:"bytes,7,opt,name=value,proto3" json:"value"` +} + +func (m *MsgCreateValidator) Reset() { *m = MsgCreateValidator{} } +func (m *MsgCreateValidator) String() string { return proto.CompactTextString(m) } +func (*MsgCreateValidator) ProtoMessage() {} +func (*MsgCreateValidator) Descriptor() ([]byte, []int) { + return fileDescriptor_c669c0a3ee1b124c, []int{0} +} +func (m *MsgCreateValidator) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgCreateValidator) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgCreateValidator.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgCreateValidator) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgCreateValidator.Merge(m, src) +} +func (m *MsgCreateValidator) XXX_Size() int { + return m.Size() +} +func (m *MsgCreateValidator) XXX_DiscardUnknown() { + xxx_messageInfo_MsgCreateValidator.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgCreateValidator proto.InternalMessageInfo + +func (m *MsgCreateValidator) GetDescription() Description { + if m != nil { + return m.Description + } + return Description{} +} + +func (m *MsgCreateValidator) GetCommission() CommissionRates { + if m != nil { + return m.Commission + } + return CommissionRates{} +} + +func (m *MsgCreateValidator) GetDelegatorAddress() github_com_cosmos_cosmos_sdk_types.AccAddress { + if m != nil { + return m.DelegatorAddress + } + return nil +} + +func (m *MsgCreateValidator) GetValidatorAddress() github_com_cosmos_cosmos_sdk_types.ValAddress { + if m != nil { + return m.ValidatorAddress + } + return nil +} + +func (m *MsgCreateValidator) GetPubkey() string { + if m != nil { + return m.Pubkey + } + return "" +} + +func (m *MsgCreateValidator) GetValue() types.Coin { + if m != nil { + return m.Value + } + return types.Coin{} +} + +// MsgEditValidator defines an SDK message for editing an existing validator. +type MsgEditValidator struct { + Description Description `protobuf:"bytes,1,opt,name=description,proto3" json:"description"` + ValidatorAddress github_com_cosmos_cosmos_sdk_types.ValAddress `protobuf:"bytes,2,opt,name=validator_address,json=validatorAddress,proto3,casttype=github.com/cosmos/cosmos-sdk/types.ValAddress" json:"validator_address,omitempty" yaml:"address"` + // We pass a reference to the new commission rate and min self delegation as + // it's not mandatory to update. If not updated, the deserialized rate will be + // zero with no way to distinguish if an update was intended. + // + // REF: #2373 + CommissionRate *github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=commission_rate,json=commissionRate,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"commission_rate,omitempty" yaml:"commission_rate"` + MinSelfDelegation *github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,4,opt,name=min_self_delegation,json=minSelfDelegation,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"min_self_delegation,omitempty" yaml:"min_self_delegation"` +} + +func (m *MsgEditValidator) Reset() { *m = MsgEditValidator{} } +func (m *MsgEditValidator) String() string { return proto.CompactTextString(m) } +func (*MsgEditValidator) ProtoMessage() {} +func (*MsgEditValidator) Descriptor() ([]byte, []int) { + return fileDescriptor_c669c0a3ee1b124c, []int{1} +} +func (m *MsgEditValidator) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgEditValidator) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgEditValidator.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgEditValidator) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgEditValidator.Merge(m, src) +} +func (m *MsgEditValidator) XXX_Size() int { + return m.Size() +} +func (m *MsgEditValidator) XXX_DiscardUnknown() { + xxx_messageInfo_MsgEditValidator.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgEditValidator proto.InternalMessageInfo + +func (m *MsgEditValidator) GetDescription() Description { + if m != nil { + return m.Description + } + return Description{} +} + +func (m *MsgEditValidator) GetValidatorAddress() github_com_cosmos_cosmos_sdk_types.ValAddress { + if m != nil { + return m.ValidatorAddress + } + return nil +} + +// MsgDelegate defines an SDK message for performing a delegation from a +// delegate to a validator. +type MsgDelegate struct { + DelegatorAddress github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"delegator_address,omitempty" yaml:"delegator_address"` + ValidatorAddress github_com_cosmos_cosmos_sdk_types.ValAddress `protobuf:"bytes,2,opt,name=validator_address,json=validatorAddress,proto3,casttype=github.com/cosmos/cosmos-sdk/types.ValAddress" json:"validator_address,omitempty" yaml:"validator_address"` + Amount types.Coin `protobuf:"bytes,3,opt,name=amount,proto3" json:"amount"` +} + +func (m *MsgDelegate) Reset() { *m = MsgDelegate{} } +func (m *MsgDelegate) String() string { return proto.CompactTextString(m) } +func (*MsgDelegate) ProtoMessage() {} +func (*MsgDelegate) Descriptor() ([]byte, []int) { + return fileDescriptor_c669c0a3ee1b124c, []int{2} +} +func (m *MsgDelegate) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgDelegate) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgDelegate.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgDelegate) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgDelegate.Merge(m, src) +} +func (m *MsgDelegate) XXX_Size() int { + return m.Size() +} +func (m *MsgDelegate) XXX_DiscardUnknown() { + xxx_messageInfo_MsgDelegate.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgDelegate proto.InternalMessageInfo + +func (m *MsgDelegate) GetDelegatorAddress() github_com_cosmos_cosmos_sdk_types.AccAddress { + if m != nil { + return m.DelegatorAddress + } + return nil +} + +func (m *MsgDelegate) GetValidatorAddress() github_com_cosmos_cosmos_sdk_types.ValAddress { + if m != nil { + return m.ValidatorAddress + } + return nil +} + +func (m *MsgDelegate) GetAmount() types.Coin { + if m != nil { + return m.Amount + } + return types.Coin{} +} + +// MsgBeginRedelegate defines an SDK message for performing a redelegation from +// a delegate and source validator to a destination validator. +type MsgBeginRedelegate struct { + DelegatorAddress github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"delegator_address,omitempty" yaml:"delegator_address"` + ValidatorSrcAddress github_com_cosmos_cosmos_sdk_types.ValAddress `protobuf:"bytes,2,opt,name=validator_src_address,json=validatorSrcAddress,proto3,casttype=github.com/cosmos/cosmos-sdk/types.ValAddress" json:"validator_src_address,omitempty" yaml:"validator_src_address"` + ValidatorDstAddress github_com_cosmos_cosmos_sdk_types.ValAddress `protobuf:"bytes,3,opt,name=validator_dst_address,json=validatorDstAddress,proto3,casttype=github.com/cosmos/cosmos-sdk/types.ValAddress" json:"validator_dst_address,omitempty" yaml:"validator_dst_address"` + Amount types.Coin `protobuf:"bytes,4,opt,name=amount,proto3" json:"amount"` +} + +func (m *MsgBeginRedelegate) Reset() { *m = MsgBeginRedelegate{} } +func (m *MsgBeginRedelegate) String() string { return proto.CompactTextString(m) } +func (*MsgBeginRedelegate) ProtoMessage() {} +func (*MsgBeginRedelegate) Descriptor() ([]byte, []int) { + return fileDescriptor_c669c0a3ee1b124c, []int{3} +} +func (m *MsgBeginRedelegate) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgBeginRedelegate) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgBeginRedelegate.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgBeginRedelegate) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgBeginRedelegate.Merge(m, src) +} +func (m *MsgBeginRedelegate) XXX_Size() int { + return m.Size() +} +func (m *MsgBeginRedelegate) XXX_DiscardUnknown() { + xxx_messageInfo_MsgBeginRedelegate.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgBeginRedelegate proto.InternalMessageInfo + +func (m *MsgBeginRedelegate) GetDelegatorAddress() github_com_cosmos_cosmos_sdk_types.AccAddress { + if m != nil { + return m.DelegatorAddress + } + return nil +} + +func (m *MsgBeginRedelegate) GetValidatorSrcAddress() github_com_cosmos_cosmos_sdk_types.ValAddress { + if m != nil { + return m.ValidatorSrcAddress + } + return nil +} + +func (m *MsgBeginRedelegate) GetValidatorDstAddress() github_com_cosmos_cosmos_sdk_types.ValAddress { + if m != nil { + return m.ValidatorDstAddress + } + return nil +} + +func (m *MsgBeginRedelegate) GetAmount() types.Coin { + if m != nil { + return m.Amount + } + return types.Coin{} +} + +// MsgUndelegate defines an SDK message for performing an undelegation from a +// delegate and a validator. +type MsgUndelegate struct { + DelegatorAddress github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"delegator_address,omitempty" yaml:"delegator_address"` + ValidatorAddress github_com_cosmos_cosmos_sdk_types.ValAddress `protobuf:"bytes,2,opt,name=validator_address,json=validatorAddress,proto3,casttype=github.com/cosmos/cosmos-sdk/types.ValAddress" json:"validator_address,omitempty" yaml:"validator_address"` + Amount types.Coin `protobuf:"bytes,3,opt,name=amount,proto3" json:"amount"` +} + +func (m *MsgUndelegate) Reset() { *m = MsgUndelegate{} } +func (m *MsgUndelegate) String() string { return proto.CompactTextString(m) } +func (*MsgUndelegate) ProtoMessage() {} +func (*MsgUndelegate) Descriptor() ([]byte, []int) { + return fileDescriptor_c669c0a3ee1b124c, []int{4} +} +func (m *MsgUndelegate) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUndelegate) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUndelegate.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgUndelegate) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUndelegate.Merge(m, src) +} +func (m *MsgUndelegate) XXX_Size() int { + return m.Size() +} +func (m *MsgUndelegate) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUndelegate.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUndelegate proto.InternalMessageInfo + +func (m *MsgUndelegate) GetDelegatorAddress() github_com_cosmos_cosmos_sdk_types.AccAddress { + if m != nil { + return m.DelegatorAddress + } + return nil +} + +func (m *MsgUndelegate) GetValidatorAddress() github_com_cosmos_cosmos_sdk_types.ValAddress { + if m != nil { + return m.ValidatorAddress + } + return nil +} + +func (m *MsgUndelegate) GetAmount() types.Coin { + if m != nil { + return m.Amount + } + return types.Coin{} +} + +// HistoricalInfo contains the historical information that gets stored at // each height. -type HistoricalInfoProto struct { - Header types.Header `protobuf:"bytes,1,opt,name=header,proto3" json:"header"` - Valset []ValidatorProto `protobuf:"bytes,2,rep,name=valset,proto3" json:"valset"` +type HistoricalInfo struct { + Header types1.Header `protobuf:"bytes,1,opt,name=header,proto3" json:"header"` + Valset []Validator `protobuf:"bytes,2,rep,name=valset,proto3" json:"valset"` } -func (m *HistoricalInfoProto) Reset() { *m = HistoricalInfoProto{} } -func (m *HistoricalInfoProto) String() string { return proto.CompactTextString(m) } -func (*HistoricalInfoProto) ProtoMessage() {} -func (*HistoricalInfoProto) Descriptor() ([]byte, []int) { - return fileDescriptor_c669c0a3ee1b124c, []int{0} +func (m *HistoricalInfo) Reset() { *m = HistoricalInfo{} } +func (m *HistoricalInfo) String() string { return proto.CompactTextString(m) } +func (*HistoricalInfo) ProtoMessage() {} +func (*HistoricalInfo) Descriptor() ([]byte, []int) { + return fileDescriptor_c669c0a3ee1b124c, []int{5} } -func (m *HistoricalInfoProto) XXX_Unmarshal(b []byte) error { +func (m *HistoricalInfo) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *HistoricalInfoProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *HistoricalInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_HistoricalInfoProto.Marshal(b, m, deterministic) + return xxx_messageInfo_HistoricalInfo.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -60,26 +400,26 @@ func (m *HistoricalInfoProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, return b[:n], nil } } -func (m *HistoricalInfoProto) XXX_Merge(src proto.Message) { - xxx_messageInfo_HistoricalInfoProto.Merge(m, src) +func (m *HistoricalInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_HistoricalInfo.Merge(m, src) } -func (m *HistoricalInfoProto) XXX_Size() int { +func (m *HistoricalInfo) XXX_Size() int { return m.Size() } -func (m *HistoricalInfoProto) XXX_DiscardUnknown() { - xxx_messageInfo_HistoricalInfoProto.DiscardUnknown(m) +func (m *HistoricalInfo) XXX_DiscardUnknown() { + xxx_messageInfo_HistoricalInfo.DiscardUnknown(m) } -var xxx_messageInfo_HistoricalInfoProto proto.InternalMessageInfo +var xxx_messageInfo_HistoricalInfo proto.InternalMessageInfo -func (m *HistoricalInfoProto) GetHeader() types.Header { +func (m *HistoricalInfo) GetHeader() types1.Header { if m != nil { return m.Header } - return types.Header{} + return types1.Header{} } -func (m *HistoricalInfoProto) GetValset() []ValidatorProto { +func (m *HistoricalInfo) GetValset() []Validator { if m != nil { return m.Valset } @@ -97,7 +437,7 @@ type CommissionRates struct { func (m *CommissionRates) Reset() { *m = CommissionRates{} } func (*CommissionRates) ProtoMessage() {} func (*CommissionRates) Descriptor() ([]byte, []int) { - return fileDescriptor_c669c0a3ee1b124c, []int{1} + return fileDescriptor_c669c0a3ee1b124c, []int{6} } func (m *CommissionRates) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -135,7 +475,7 @@ type Commission struct { func (m *Commission) Reset() { *m = Commission{} } func (*Commission) ProtoMessage() {} func (*Commission) Descriptor() ([]byte, []int) { - return fileDescriptor_c669c0a3ee1b124c, []int{2} + return fileDescriptor_c669c0a3ee1b124c, []int{7} } func (m *Commission) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -183,7 +523,7 @@ type Description struct { func (m *Description) Reset() { *m = Description{} } func (*Description) ProtoMessage() {} func (*Description) Descriptor() ([]byte, []int) { - return fileDescriptor_c669c0a3ee1b124c, []int{3} + return fileDescriptor_c669c0a3ee1b124c, []int{8} } func (m *Description) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -247,35 +587,38 @@ func (m *Description) GetDetails() string { return "" } -// ValidatorProto defines the Protocol buffer equivalent of the Validator type. -type ValidatorProto struct { - OperatorAddress github_com_cosmos_cosmos_sdk_types.ValAddress `protobuf:"bytes,1,opt,name=operator_address,json=operatorAddress,proto3,casttype=github.com/cosmos/cosmos-sdk/types.ValAddress" json:"operator_address,omitempty" yaml:"operator_address"` - // TODO: We can remove cosmos_sdk.v1.PublicKey in favor of the primitive bytes - // once Tendermint supports pubkeys as slices. - ConsensusPubkey types1.PublicKey `protobuf:"bytes,2,opt,name=consensus_pubkey,json=consensusPubkey,proto3" json:"consensus_pubkey" yaml:"consensus_pubkey"` - Jailed bool `protobuf:"varint,3,opt,name=jailed,proto3" json:"jailed,omitempty"` - Status int32 `protobuf:"varint,4,opt,name=status,proto3" json:"status,omitempty"` - Tokens github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,5,opt,name=tokens,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"tokens"` - DelegatorShares github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,6,opt,name=delegator_shares,json=delegatorShares,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"delegator_shares" yaml:"delegator_shares"` - Description Description `protobuf:"bytes,7,opt,name=description,proto3" json:"description"` - UnbondingHeight int64 `protobuf:"varint,8,opt,name=unbonding_height,json=unbondingHeight,proto3" json:"unbonding_height,omitempty" yaml:"unbonding_height"` - UnbondingTime time.Time `protobuf:"bytes,9,opt,name=unbonding_time,json=unbondingTime,proto3,stdtime" json:"unbonding_time" yaml:"unbonding_time"` - Commission Commission `protobuf:"bytes,10,opt,name=commission,proto3" json:"commission"` - MinSelfDelegation github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,11,opt,name=min_self_delegation,json=minSelfDelegation,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"min_self_delegation" yaml:"min_self_delegation"` -} - -func (m *ValidatorProto) Reset() { *m = ValidatorProto{} } -func (m *ValidatorProto) String() string { return proto.CompactTextString(m) } -func (*ValidatorProto) ProtoMessage() {} -func (*ValidatorProto) Descriptor() ([]byte, []int) { - return fileDescriptor_c669c0a3ee1b124c, []int{4} +// Validator defines the total amount of bond shares and their exchange rate to +// coins. Slashing results in a decrease in the exchange rate, allowing correct +// calculation of future undelegations without iterating over delegators. +// When coins are delegated to this validator, the validator is credited with a +// delegation whose number of bond shares is based on the amount of coins delegated +// divided by the current exchange rate. Voting power can be calculated as total +// bonded shares multiplied by exchange rate. +type Validator struct { + OperatorAddress github_com_cosmos_cosmos_sdk_types.ValAddress `protobuf:"bytes,1,opt,name=operator_address,json=operatorAddress,proto3,casttype=github.com/cosmos/cosmos-sdk/types.ValAddress" json:"operator_address,omitempty" yaml:"operator_address"` + ConsensusPubkey string `protobuf:"bytes,2,opt,name=consensus_pubkey,json=consensusPubkey,proto3" json:"consensus_pubkey,omitempty" yaml:"consensus_pubkey"` + Jailed bool `protobuf:"varint,3,opt,name=jailed,proto3" json:"jailed,omitempty"` + Status github_com_cosmos_cosmos_sdk_types.BondStatus `protobuf:"varint,4,opt,name=status,proto3,casttype=github.com/cosmos/cosmos-sdk/types.BondStatus" json:"status,omitempty"` + Tokens github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,5,opt,name=tokens,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"tokens"` + DelegatorShares github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,6,opt,name=delegator_shares,json=delegatorShares,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"delegator_shares" yaml:"delegator_shares"` + Description Description `protobuf:"bytes,7,opt,name=description,proto3" json:"description"` + UnbondingHeight int64 `protobuf:"varint,8,opt,name=unbonding_height,json=unbondingHeight,proto3" json:"unbonding_height,omitempty" yaml:"unbonding_height"` + UnbondingTime time.Time `protobuf:"bytes,9,opt,name=unbonding_time,json=unbondingTime,proto3,stdtime" json:"unbonding_time" yaml:"unbonding_time"` + Commission Commission `protobuf:"bytes,10,opt,name=commission,proto3" json:"commission"` + MinSelfDelegation github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,11,opt,name=min_self_delegation,json=minSelfDelegation,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"min_self_delegation" yaml:"min_self_delegation"` +} + +func (m *Validator) Reset() { *m = Validator{} } +func (*Validator) ProtoMessage() {} +func (*Validator) Descriptor() ([]byte, []int) { + return fileDescriptor_c669c0a3ee1b124c, []int{9} } -func (m *ValidatorProto) XXX_Unmarshal(b []byte) error { +func (m *Validator) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *ValidatorProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *Validator) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_ValidatorProto.Marshal(b, m, deterministic) + return xxx_messageInfo_Validator.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -285,100 +628,44 @@ func (m *ValidatorProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, erro return b[:n], nil } } -func (m *ValidatorProto) XXX_Merge(src proto.Message) { - xxx_messageInfo_ValidatorProto.Merge(m, src) +func (m *Validator) XXX_Merge(src proto.Message) { + xxx_messageInfo_Validator.Merge(m, src) } -func (m *ValidatorProto) XXX_Size() int { +func (m *Validator) XXX_Size() int { return m.Size() } -func (m *ValidatorProto) XXX_DiscardUnknown() { - xxx_messageInfo_ValidatorProto.DiscardUnknown(m) +func (m *Validator) XXX_DiscardUnknown() { + xxx_messageInfo_Validator.DiscardUnknown(m) } -var xxx_messageInfo_ValidatorProto proto.InternalMessageInfo +var xxx_messageInfo_Validator proto.InternalMessageInfo -func (m *ValidatorProto) GetOperatorAddress() github_com_cosmos_cosmos_sdk_types.ValAddress { - if m != nil { - return m.OperatorAddress - } - return nil +// DVPair is struct that just has a delegator-validator pair with no other data. +// It is intended to be used as a marshalable pointer. For example, a DVPair can +// be used to construct the key to getting an UnbondingDelegation from state. +type DVPair struct { + DelegatorAddress github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"delegator_address,omitempty" yaml:"delegator_address"` + ValidatorAddress github_com_cosmos_cosmos_sdk_types.ValAddress `protobuf:"bytes,2,opt,name=validator_address,json=validatorAddress,proto3,casttype=github.com/cosmos/cosmos-sdk/types.ValAddress" json:"validator_address,omitempty" yaml:"validator_address"` } -func (m *ValidatorProto) GetConsensusPubkey() types1.PublicKey { - if m != nil { - return m.ConsensusPubkey - } - return types1.PublicKey{} +func (m *DVPair) Reset() { *m = DVPair{} } +func (*DVPair) ProtoMessage() {} +func (*DVPair) Descriptor() ([]byte, []int) { + return fileDescriptor_c669c0a3ee1b124c, []int{10} } - -func (m *ValidatorProto) GetJailed() bool { - if m != nil { - return m.Jailed - } - return false +func (m *DVPair) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) } - -func (m *ValidatorProto) GetStatus() int32 { - if m != nil { - return m.Status - } - return 0 -} - -func (m *ValidatorProto) GetDescription() Description { - if m != nil { - return m.Description - } - return Description{} -} - -func (m *ValidatorProto) GetUnbondingHeight() int64 { - if m != nil { - return m.UnbondingHeight - } - return 0 -} - -func (m *ValidatorProto) GetUnbondingTime() time.Time { - if m != nil { - return m.UnbondingTime - } - return time.Time{} -} - -func (m *ValidatorProto) GetCommission() Commission { - if m != nil { - return m.Commission - } - return Commission{} -} - -// DVPair is struct that just has a delegator-validator pair with no other data. -// It is intended to be used as a marshalable pointer. For example, a DVPair can -// be used to construct the key to getting an UnbondingDelegation from state. -type DVPair struct { - DelegatorAddress github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"delegator_address,omitempty" yaml:"delegator_address"` - ValidatorAddress github_com_cosmos_cosmos_sdk_types.ValAddress `protobuf:"bytes,2,opt,name=validator_address,json=validatorAddress,proto3,casttype=github.com/cosmos/cosmos-sdk/types.ValAddress" json:"validator_address,omitempty" yaml:"validator_address"` -} - -func (m *DVPair) Reset() { *m = DVPair{} } -func (*DVPair) ProtoMessage() {} -func (*DVPair) Descriptor() ([]byte, []int) { - return fileDescriptor_c669c0a3ee1b124c, []int{5} -} -func (m *DVPair) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *DVPair) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_DVPair.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil +func (m *DVPair) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_DVPair.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil } } func (m *DVPair) XXX_Merge(src proto.Message) { @@ -420,7 +707,7 @@ type DVVTriplet struct { func (m *DVVTriplet) Reset() { *m = DVVTriplet{} } func (*DVVTriplet) ProtoMessage() {} func (*DVVTriplet) Descriptor() ([]byte, []int) { - return fileDescriptor_c669c0a3ee1b124c, []int{6} + return fileDescriptor_c669c0a3ee1b124c, []int{11} } func (m *DVVTriplet) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -482,7 +769,7 @@ type Delegation struct { func (m *Delegation) Reset() { *m = Delegation{} } func (*Delegation) ProtoMessage() {} func (*Delegation) Descriptor() ([]byte, []int) { - return fileDescriptor_c669c0a3ee1b124c, []int{7} + return fileDescriptor_c669c0a3ee1b124c, []int{12} } func (m *Delegation) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -536,7 +823,7 @@ type UnbondingDelegation struct { func (m *UnbondingDelegation) Reset() { *m = UnbondingDelegation{} } func (*UnbondingDelegation) ProtoMessage() {} func (*UnbondingDelegation) Descriptor() ([]byte, []int) { - return fileDescriptor_c669c0a3ee1b124c, []int{8} + return fileDescriptor_c669c0a3ee1b124c, []int{13} } func (m *UnbondingDelegation) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -597,7 +884,7 @@ type UnbondingDelegationEntry struct { func (m *UnbondingDelegationEntry) Reset() { *m = UnbondingDelegationEntry{} } func (*UnbondingDelegationEntry) ProtoMessage() {} func (*UnbondingDelegationEntry) Descriptor() ([]byte, []int) { - return fileDescriptor_c669c0a3ee1b124c, []int{9} + return fileDescriptor_c669c0a3ee1b124c, []int{14} } func (m *UnbondingDelegationEntry) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -651,7 +938,7 @@ type RedelegationEntry struct { func (m *RedelegationEntry) Reset() { *m = RedelegationEntry{} } func (*RedelegationEntry) ProtoMessage() {} func (*RedelegationEntry) Descriptor() ([]byte, []int) { - return fileDescriptor_c669c0a3ee1b124c, []int{10} + return fileDescriptor_c669c0a3ee1b124c, []int{15} } func (m *RedelegationEntry) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -706,7 +993,7 @@ type Redelegation struct { func (m *Redelegation) Reset() { *m = Redelegation{} } func (*Redelegation) ProtoMessage() {} func (*Redelegation) Descriptor() ([]byte, []int) { - return fileDescriptor_c669c0a3ee1b124c, []int{11} + return fileDescriptor_c669c0a3ee1b124c, []int{16} } func (m *Redelegation) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -775,7 +1062,7 @@ type Params struct { func (m *Params) Reset() { *m = Params{} } func (*Params) ProtoMessage() {} func (*Params) Descriptor() ([]byte, []int) { - return fileDescriptor_c669c0a3ee1b124c, []int{12} + return fileDescriptor_c669c0a3ee1b124c, []int{17} } func (m *Params) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -840,11 +1127,16 @@ func (m *Params) GetBondDenom() string { } func init() { - proto.RegisterType((*HistoricalInfoProto)(nil), "cosmos_sdk.x.staking.v1.HistoricalInfoProto") + proto.RegisterType((*MsgCreateValidator)(nil), "cosmos_sdk.x.staking.v1.MsgCreateValidator") + proto.RegisterType((*MsgEditValidator)(nil), "cosmos_sdk.x.staking.v1.MsgEditValidator") + proto.RegisterType((*MsgDelegate)(nil), "cosmos_sdk.x.staking.v1.MsgDelegate") + proto.RegisterType((*MsgBeginRedelegate)(nil), "cosmos_sdk.x.staking.v1.MsgBeginRedelegate") + proto.RegisterType((*MsgUndelegate)(nil), "cosmos_sdk.x.staking.v1.MsgUndelegate") + proto.RegisterType((*HistoricalInfo)(nil), "cosmos_sdk.x.staking.v1.HistoricalInfo") proto.RegisterType((*CommissionRates)(nil), "cosmos_sdk.x.staking.v1.CommissionRates") proto.RegisterType((*Commission)(nil), "cosmos_sdk.x.staking.v1.Commission") proto.RegisterType((*Description)(nil), "cosmos_sdk.x.staking.v1.Description") - proto.RegisterType((*ValidatorProto)(nil), "cosmos_sdk.x.staking.v1.ValidatorProto") + proto.RegisterType((*Validator)(nil), "cosmos_sdk.x.staking.v1.Validator") proto.RegisterType((*DVPair)(nil), "cosmos_sdk.x.staking.v1.DVPair") proto.RegisterType((*DVVTriplet)(nil), "cosmos_sdk.x.staking.v1.DVVTriplet") proto.RegisterType((*Delegation)(nil), "cosmos_sdk.x.staking.v1.Delegation") @@ -858,106 +1150,120 @@ func init() { func init() { proto.RegisterFile("x/staking/types/types.proto", fileDescriptor_c669c0a3ee1b124c) } var fileDescriptor_c669c0a3ee1b124c = []byte{ - // 1410 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff,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, 0x58, 0xa1, 0xd8, 0xe9, - 0x45, 0x84, 0x0d, 0x6c, 0x27, 0x0c, 0x18, 0x72, 0x58, 0x65, 0x5e, 0x44, 0xec, 0xec, 0x68, 0xa8, - 0x9f, 0x96, 0x7b, 0xcd, 0x4a, 0x18, 0x56, 0x29, 0x86, 0xd6, 0x25, 0xc2, 0x2d, 0xb8, 0x98, 0x21, - 0xe2, 0xd1, 0xca, 0x31, 0x69, 0x41, 0x2d, 0x53, 0x67, 0xf9, 0x7a, 0x01, 0x2c, 0x1f, 0xcc, 0x7c, - 0x78, 0x17, 0xac, 0x84, 0x5d, 0x1c, 0x71, 0xc0, 0x46, 0xae, 0x1b, 0x61, 0x2a, 0x83, 0x74, 0xbc, - 0xb1, 0x95, 0x98, 0xcf, 0x4a, 0x18, 0x7f, 0x0c, 0xf5, 0x8b, 0x2f, 0x90, 0x47, 0x3b, 0xc8, 0xbb, - 0x26, 0x35, 0xac, 0x52, 0xcc, 0xa1, 0x00, 0xe8, 0xf2, 0xec, 0x08, 0x28, 0x0e, 0x68, 0x8f, 0xda, - 0xdd, 0x5e, 0x6b, 0x0f, 0x0f, 0x54, 0x0c, 0x2b, 0xe9, 0xec, 0xd8, 0xbf, 0x64, 0x6e, 0xf7, 0x5a, - 0x1e, 0x71, 0xde, 0xc1, 0x83, 0x86, 0xae, 0x22, 0xa8, 0xb6, 0x95, 0xd5, 0x37, 0x78, 0x92, 0x28, - 0x68, 0x5b, 0x20, 0xf0, 0x14, 0x28, 0x7c, 0x84, 0x88, 0x87, 0x5d, 0xe1, 0xf6, 0x45, 0x4b, 0xad, - 0x38, 0x4e, 0x19, 0x62, 0x3d, 0x2a, 0x7c, 0x7d, 0xcc, 0x52, 0x2b, 0x78, 0x03, 0x14, 0x58, 0xb8, - 0x87, 0x03, 0xe5, 0xc4, 0x99, 0x4a, 0x7c, 0x33, 0x60, 0x96, 0xd2, 0x86, 0x0c, 0xac, 0xb8, 0xd8, - 0xc3, 0x6d, 0xe1, 0x35, 0xda, 0x41, 0x11, 0xa6, 0x95, 0x82, 0x60, 0xdc, 0x9c, 0xb9, 0x0e, 0xd5, - 0x69, 0xb3, 0x7c, 0x86, 0x55, 0x1a, 0x43, 0xb7, 0x05, 0x02, 0xb7, 0x40, 0xd1, 0x4d, 0x52, 0xb5, - 0xb2, 0x20, 0xdc, 0xf9, 0xf2, 0xd4, 0x62, 0x4b, 0xa5, 0xb5, 0xea, 0x80, 0x69, 0x75, 0x9e, 0x99, - 0xbd, 0xa0, 0x15, 0x06, 0x2e, 0x09, 0xda, 0x76, 0x07, 0x93, 0x76, 0x87, 0x55, 0x16, 0xcf, 0x6b, - 0x6b, 0xf9, 0x74, 0x66, 0x66, 0x25, 0x0c, 0xab, 0x34, 0x86, 0x36, 0x04, 0x02, 0x5d, 0xb0, 0x9c, - 0x48, 0x89, 0x5a, 0x5d, 0x7a, 0x6e, 0xad, 0xfe, 0x5f, 0x45, 0xfa, 0x64, 0xd6, 0x4a, 0x52, 0xae, - 0x27, 0xc6, 0x20, 0x57, 0x83, 0x9b, 0x00, 0x24, 0x1d, 0xa2, 0x02, 0x84, 0x85, 0x97, 0x5e, 0xa0, - 0xcf, 0xa8, 0x93, 0xa7, 0x94, 0xe1, 0x27, 0x60, 0xd5, 0x27, 0x81, 0x4d, 0xb1, 0xb7, 0x6b, 0x2b, - 0x17, 0x73, 0xce, 0xa2, 0x88, 0xdf, 0xd6, 0x6c, 0x19, 0x31, 0x1a, 0xea, 0x55, 0xd5, 0x47, 0x27, - 0x29, 0x0d, 0xab, 0xec, 0x93, 0xe0, 0x36, 0xf6, 0x76, 0x9b, 0x63, 0x4c, 0x4d, 0x9f, 0xcf, 0x72, - 0xa0, 0xd0, 0xdc, 0xd9, 0x46, 0x24, 0x82, 0xf7, 0x40, 0x39, 0x89, 0xfd, 0xc1, 0x1a, 0xbd, 0x39, - 0x1a, 0xea, 0x95, 0x6c, 0x7a, 0xcc, 0x58, 0xa4, 0xd7, 0x1c, 0x27, 0x2e, 0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 0x3f, 0x95, 0xbc, 0xfc, 0xa7, 0x1e, - 0x1a, 0x16, 0xf0, 0x51, 0xff, 0xba, 0x5c, 0xc0, 0x2d, 0x00, 0x3b, 0xe3, 0xcf, 0x52, 0x76, 0xe2, - 0x4b, 0xae, 0x7f, 0x6e, 0x34, 0xd4, 0xcf, 0x48, 0xfd, 0x49, 0x19, 0xc3, 0x2a, 0x27, 0x60, 0xcc, - 0xf6, 0x3a, 0x00, 0xfc, 0x5c, 0xb6, 0x8b, 0x83, 0xd0, 0x57, 0xaf, 0x94, 0x27, 0x47, 0x43, 0xbd, - 0x2c, 0x59, 0x92, 0x67, 0x86, 0xb5, 0xc4, 0x17, 0x4d, 0xfe, 0x3b, 0x71, 0x7c, 0xe3, 0xc6, 0xa3, - 0x27, 0x35, 0xed, 0xf1, 0x93, 0x9a, 0xf6, 0xf3, 0x93, 0x9a, 0x76, 0xff, 0x69, 0x6d, 0xee, 0xf1, - 0xd3, 0xda, 0xdc, 0x0f, 0x4f, 0x6b, 0x73, 0xef, 0xbd, 0xf6, 0x97, 0xc9, 0x92, 0xf9, 0x86, 0xd8, - 0x2a, 0x88, 0xa8, 0x5c, 0xf9, 0x33, 0x00, 0x00, 0xff, 0xff, 0xf1, 0x6f, 0x88, 0x86, 0x5d, 0x14, - 0x00, 0x00, -} - -func (this *HistoricalInfoProto) Equal(that interface{}) bool { + // 1633 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x59, 0xcd, 0x6f, 0xdb, 0x46, + 0x16, 0x37, 0x25, 0x45, 0xb6, 0x9f, 0x62, 0xc9, 0xa6, 0x11, 0x47, 0x71, 0x36, 0xa2, 0x97, 0xbb, + 0x08, 0x8c, 0xc5, 0x46, 0x82, 0x93, 0x05, 0x16, 0xf0, 0x5e, 0x12, 0x59, 0x31, 0xec, 0x85, 0xbd, + 0x48, 0xe8, 0xc4, 0x87, 0xfd, 0x80, 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 0x4d, 0x64, 0x9b, 0x38, 0x3e, 0x84, 0x36, 0x8e, 0xed, 0x64, 0x21, 0x72, 0x12, 0x83, 0x53, + 0xb5, 0x19, 0x0b, 0x75, 0xd7, 0x7c, 0x81, 0xe7, 0x71, 0x75, 0xea, 0xc1, 0x43, 0x65, 0xc2, 0x8f, + 0xd8, 0x67, 0x12, 0x40, 0x14, 0x31, 0xf9, 0x5f, 0x30, 0x9b, 0x18, 0x62, 0x54, 0xe4, 0x73, 0x7c, + 0xe6, 0x37, 0xe5, 0xad, 0xfa, 0x71, 0x4f, 0x91, 0xb4, 0x82, 0x9e, 0xc8, 0xc5, 0x3f, 0x20, 0xd7, + 0x69, 0x1b, 0x88, 0xe1, 0xba, 0x47, 0x82, 0x05, 0xa7, 0x5c, 0x2c, 0x73, 0x02, 0x5c, 0x0e, 0x08, + 0x70, 0xf9, 0x4e, 0xc0, 0x90, 0xab, 0x25, 0x0f, 0xab, 0xdf, 0x53, 0x64, 0xbe, 0xaf, 0x98, 0xb1, + 0x7a, 0xff, 0x6b, 0x45, 0xd2, 0x80, 0x4b, 0x3c, 0x83, 0xd8, 0xa6, 0x3e, 0x95, 0x20, 0x17, 0xa3, + 0x1a, 0x72, 0x11, 0x26, 0x2d, 0xc7, 0x26, 0xfb, 0xe2, 0x70, 0x4e, 0x6b, 0xc1, 0xa3, 0xbc, 0x08, + 0x53, 0xc4, 0xc0, 0x36, 0x23, 0xec, 0x90, 0x27, 0x56, 0x0b, 0x9f, 0x3d, 0xab, 0x7b, 0xb8, 0x41, + 0x49, 0x90, 0x0e, 0x2d, 0x78, 0x94, 0xd7, 0x61, 0x96, 0x62, 0xbd, 0xe3, 0x12, 0x76, 0x58, 0xd7, + 0x1d, 0x9b, 0x21, 0x9d, 0x89, 0x19, 0x7e, 0xb1, 0xdf, 0x53, 0xce, 0xf3, 0xb5, 0x26, 0x35, 0x54, + 0xad, 0x10, 0x88, 0xd6, 0xb8, 0xc4, 0xf3, 0x60, 0x60, 0x86, 0x48, 0x8b, 0xb3, 0xc1, 0x69, 0x2d, + 0x78, 0x8c, 0xed, 0xe5, 0x93, 0x49, 0x98, 0x8e, 0xf8, 0xd6, 0x3d, 0x98, 0x75, 0xda, 0xd8, 0x1d, + 0xd2, 0xa2, 0xb6, 0x22, 0xcf, 0x49, 0x8d, 0x13, 0x74, 0x89, 0x42, 0x80, 0x11, 0x34, 0x89, 0x75, + 0xef, 0x60, 0xd8, 0x14, 0xdb, 0xb4, 0x43, 0xeb, 0x82, 0x50, 0xa6, 0x92, 0x5b, 0x4e, 0x6a, 0xa8, + 0xde, 0x09, 0x10, 0xa2, 0x5b, 0x9c, 0x76, 0x2e, 0x40, 0xf6, 0xdf, 0x88, 0xb4, 0xb0, 0xe1, 0xc7, + 0x74, 0x4a, 0x13, 0x4f, 0xf2, 0x26, 0x64, 0x29, 0x43, 0xac, 0xc3, 0x39, 0xf9, 0x99, 0xea, 0xca, + 0x98, 0x6b, 0xae, 0x3a, 0xb6, 0xb1, 0xe3, 0x1b, 0x6a, 0x02, 0x40, 0x5e, 0x87, 0x2c, 0x73, 0xf6, + 0xb1, 0x2d, 0x82, 0x7a, 0xac, 0x92, 0xdf, 0xb4, 0x99, 0x26, 0xac, 0x65, 0x06, 0x51, 0x9f, 0xae, + 0xd3, 0x26, 0x72, 0x31, 0xe5, 0x1c, 0xba, 0xba, 0x79, 0xec, 0xba, 0x3c, 0x9f, 0x1c, 0x1e, 0x1c, + 0x4f, 0xd5, 0x0a, 0xa1, 0x68, 0xc7, 0x97, 0x24, 0x19, 0xf5, 0xe4, 0x8b, 0x31, 0xea, 0x75, 0x98, + 0xed, 0xd8, 0x0d, 0xc7, 0x36, 0x88, 0x6d, 0xd6, 0x9b, 0x98, 0x98, 0x4d, 0x56, 0x9c, 0x5a, 0x92, + 0x96, 0xd3, 0xf1, 0xb4, 0x25, 0x35, 0x54, 0xad, 0x10, 0x8a, 0x36, 0x7c, 0x89, 0x6c, 0x40, 0x3e, + 0xd2, 0xf2, 0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xaa, 0x06, 0x16, + 0xea, 0xde, 0xe4, 0x0f, 0xf2, 0x16, 0xc8, 0xcd, 0xf0, 0x92, 0xaa, 0x1e, 0xc5, 0xd2, 0xb3, 0xbf, + 0xd4, 0xef, 0x29, 0x17, 0xb8, 0xfd, 0xa0, 0x8e, 0xaa, 0xcd, 0x45, 0xc2, 0x00, 0xed, 0x4f, 0x00, + 0xde, 0xbe, 0xea, 0x06, 0xb6, 0x1d, 0x4b, 0x7c, 0x5a, 0x9e, 0xeb, 0xf7, 0x94, 0x39, 0x8e, 0x12, + 0xbd, 0x53, 0xb5, 0x69, 0xef, 0xa1, 0xe6, 0xfd, 0x1d, 0x05, 0xbe, 0xba, 0xfe, 0xe8, 0x49, 0x49, + 0x7a, 0xfc, 0xa4, 0x24, 0x7d, 0xf3, 0xa4, 0x24, 0xdd, 0x7f, 0x5a, 0x9a, 0x78, 0xfc, 0xb4, 0x34, + 0xf1, 0xe5, 0xd3, 0xd2, 0xc4, 0xdf, 0xff, 0xf8, 0xcc, 0xc3, 0x92, 0xf8, 0x45, 0xb3, 0x91, 0xf5, + 0xb3, 0x72, 0xed, 0xe7, 0x00, 0x00, 0x00, 0xff, 0xff, 0xd8, 0xec, 0x27, 0x1d, 0xeb, 0x1c, 0x00, + 0x00, +} + +func (this *HistoricalInfo) Equal(that interface{}) bool { if that == nil { return this == nil } - that1, ok := that.(*HistoricalInfoProto) + that1, ok := that.(*HistoricalInfo) if !ok { - that2, ok := that.(HistoricalInfoProto) + that2, ok := that.(HistoricalInfo) if ok { that1 = &that2 } else { @@ -1075,14 +1381,14 @@ func (this *Description) Equal(that interface{}) bool { } return true } -func (this *ValidatorProto) Equal(that interface{}) bool { +func (this *Validator) Equal(that interface{}) bool { if that == nil { return this == nil } - that1, ok := that.(*ValidatorProto) + that1, ok := that.(*Validator) if !ok { - that2, ok := that.(ValidatorProto) + that2, ok := that.(Validator) if ok { that1 = &that2 } else { @@ -1097,7 +1403,7 @@ func (this *ValidatorProto) Equal(that interface{}) bool { if !bytes.Equal(this.OperatorAddress, that1.OperatorAddress) { return false } - if !this.ConsensusPubkey.Equal(&that1.ConsensusPubkey) { + if this.ConsensusPubkey != that1.ConsensusPubkey { return false } if this.Jailed != that1.Jailed { @@ -1391,7 +1697,7 @@ func (this *Params) Equal(that interface{}) bool { } return true } -func (m *HistoricalInfoProto) Marshal() (dAtA []byte, err error) { +func (m *MsgCreateValidator) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1401,32 +1707,69 @@ func (m *HistoricalInfoProto) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *HistoricalInfoProto) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgCreateValidator) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *HistoricalInfoProto) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgCreateValidator) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.Valset) > 0 { - for iNdEx := len(m.Valset) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Valset[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 + { + size, err := m.Value.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x3a + if len(m.Pubkey) > 0 { + i -= len(m.Pubkey) + copy(dAtA[i:], m.Pubkey) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Pubkey))) + i-- + dAtA[i] = 0x32 + } + if len(m.ValidatorAddress) > 0 { + i -= len(m.ValidatorAddress) + copy(dAtA[i:], m.ValidatorAddress) + i = encodeVarintTypes(dAtA, i, uint64(len(m.ValidatorAddress))) + i-- + dAtA[i] = 0x2a + } + if len(m.DelegatorAddress) > 0 { + i -= len(m.DelegatorAddress) + copy(dAtA[i:], m.DelegatorAddress) + i = encodeVarintTypes(dAtA, i, uint64(len(m.DelegatorAddress))) + i-- + dAtA[i] = 0x22 } { - size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) + size := m.MinSelfDelegation.Size() + i -= size + if _, err := m.MinSelfDelegation.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + { + size, err := m.Commission.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + { + size, err := m.Description.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -1438,7 +1781,7 @@ func (m *HistoricalInfoProto) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *CommissionRates) Marshal() (dAtA []byte, err error) { +func (m *MsgEditValidator) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1448,42 +1791,53 @@ func (m *CommissionRates) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *CommissionRates) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgEditValidator) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *CommissionRates) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgEditValidator) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - { - size := m.MaxChangeRate.Size() - i -= size - if _, err := m.MaxChangeRate.MarshalTo(dAtA[i:]); err != nil { - return 0, err + if m.MinSelfDelegation != nil { + { + size := m.MinSelfDelegation.Size() + i -= size + if _, err := m.MinSelfDelegation.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTypes(dAtA, i, uint64(size)) } - i = encodeVarintTypes(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x22 } - i-- - dAtA[i] = 0x1a - { - size := m.MaxRate.Size() - i -= size - if _, err := m.MaxRate.MarshalTo(dAtA[i:]); err != nil { - return 0, err + if m.CommissionRate != nil { + { + size := m.CommissionRate.Size() + i -= size + if _, err := m.CommissionRate.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTypes(dAtA, i, uint64(size)) } - i = encodeVarintTypes(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x1a + } + if len(m.ValidatorAddress) > 0 { + i -= len(m.ValidatorAddress) + copy(dAtA[i:], m.ValidatorAddress) + i = encodeVarintTypes(dAtA, i, uint64(len(m.ValidatorAddress))) + i-- + dAtA[i] = 0x12 } - i-- - dAtA[i] = 0x12 { - size := m.Rate.Size() - i -= size - if _, err := m.Rate.MarshalTo(dAtA[i:]); err != nil { + size, err := m.Description.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { return 0, err } + i -= size i = encodeVarintTypes(dAtA, i, uint64(size)) } i-- @@ -1491,7 +1845,7 @@ func (m *CommissionRates) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *Commission) Marshal() (dAtA []byte, err error) { +func (m *MsgDelegate) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1501,26 +1855,18 @@ func (m *Commission) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *Commission) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgDelegate) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *Commission) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgDelegate) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - n2, err2 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.UpdateTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.UpdateTime):]) - if err2 != nil { - return 0, err2 - } - i -= n2 - i = encodeVarintTypes(dAtA, i, uint64(n2)) - i-- - dAtA[i] = 0x12 { - size, err := m.CommissionRates.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.Amount.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -1528,11 +1874,25 @@ func (m *Commission) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintTypes(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0xa + dAtA[i] = 0x1a + if len(m.ValidatorAddress) > 0 { + i -= len(m.ValidatorAddress) + copy(dAtA[i:], m.ValidatorAddress) + i = encodeVarintTypes(dAtA, i, uint64(len(m.ValidatorAddress))) + i-- + dAtA[i] = 0x12 + } + if len(m.DelegatorAddress) > 0 { + i -= len(m.DelegatorAddress) + copy(dAtA[i:], m.DelegatorAddress) + i = encodeVarintTypes(dAtA, i, uint64(len(m.DelegatorAddress))) + i-- + dAtA[i] = 0xa + } return len(dAtA) - i, nil } -func (m *Description) Marshal() (dAtA []byte, err error) { +func (m *MsgBeginRedelegate) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1542,55 +1902,51 @@ func (m *Description) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *Description) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgBeginRedelegate) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *Description) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgBeginRedelegate) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.Details) > 0 { - i -= len(m.Details) - copy(dAtA[i:], m.Details) - i = encodeVarintTypes(dAtA, i, uint64(len(m.Details))) - i-- - dAtA[i] = 0x2a - } - if len(m.SecurityContact) > 0 { - i -= len(m.SecurityContact) - copy(dAtA[i:], m.SecurityContact) - i = encodeVarintTypes(dAtA, i, uint64(len(m.SecurityContact))) - i-- - dAtA[i] = 0x22 + { + size, err := m.Amount.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) } - if len(m.Website) > 0 { - i -= len(m.Website) - copy(dAtA[i:], m.Website) - i = encodeVarintTypes(dAtA, i, uint64(len(m.Website))) + i-- + dAtA[i] = 0x22 + if len(m.ValidatorDstAddress) > 0 { + i -= len(m.ValidatorDstAddress) + copy(dAtA[i:], m.ValidatorDstAddress) + i = encodeVarintTypes(dAtA, i, uint64(len(m.ValidatorDstAddress))) i-- dAtA[i] = 0x1a } - if len(m.Identity) > 0 { - i -= len(m.Identity) - copy(dAtA[i:], m.Identity) - i = encodeVarintTypes(dAtA, i, uint64(len(m.Identity))) + if len(m.ValidatorSrcAddress) > 0 { + i -= len(m.ValidatorSrcAddress) + copy(dAtA[i:], m.ValidatorSrcAddress) + i = encodeVarintTypes(dAtA, i, uint64(len(m.ValidatorSrcAddress))) i-- dAtA[i] = 0x12 } - if len(m.Moniker) > 0 { - i -= len(m.Moniker) - copy(dAtA[i:], m.Moniker) - i = encodeVarintTypes(dAtA, i, uint64(len(m.Moniker))) + if len(m.DelegatorAddress) > 0 { + i -= len(m.DelegatorAddress) + copy(dAtA[i:], m.DelegatorAddress) + i = encodeVarintTypes(dAtA, i, uint64(len(m.DelegatorAddress))) i-- dAtA[i] = 0xa } return len(dAtA) - i, nil } -func (m *ValidatorProto) Marshal() (dAtA []byte, err error) { +func (m *MsgUndelegate) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1600,28 +1956,18 @@ func (m *ValidatorProto) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *ValidatorProto) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgUndelegate) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *ValidatorProto) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgUndelegate) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l { - size := m.MinSelfDelegation.Size() - i -= size - if _, err := m.MinSelfDelegation.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x5a - { - size, err := m.Commission.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.Amount.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -1629,22 +1975,278 @@ func (m *ValidatorProto) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintTypes(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x52 - n5, err5 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.UnbondingTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.UnbondingTime):]) - if err5 != nil { - return 0, err5 + dAtA[i] = 0x1a + if len(m.ValidatorAddress) > 0 { + i -= len(m.ValidatorAddress) + copy(dAtA[i:], m.ValidatorAddress) + i = encodeVarintTypes(dAtA, i, uint64(len(m.ValidatorAddress))) + i-- + dAtA[i] = 0x12 } - i -= n5 - i = encodeVarintTypes(dAtA, i, uint64(n5)) - i-- - dAtA[i] = 0x4a - if m.UnbondingHeight != 0 { - i = encodeVarintTypes(dAtA, i, uint64(m.UnbondingHeight)) + if len(m.DelegatorAddress) > 0 { + i -= len(m.DelegatorAddress) + copy(dAtA[i:], m.DelegatorAddress) + i = encodeVarintTypes(dAtA, i, uint64(len(m.DelegatorAddress))) i-- - dAtA[i] = 0x40 + dAtA[i] = 0xa } - { - size, err := m.Description.MarshalToSizedBuffer(dAtA[:i]) + return len(dAtA) - i, nil +} + +func (m *HistoricalInfo) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *HistoricalInfo) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *HistoricalInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Valset) > 0 { + for iNdEx := len(m.Valset) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Valset[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + { + size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *CommissionRates) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *CommissionRates) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *CommissionRates) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.MaxChangeRate.Size() + i -= size + if _, err := m.MaxChangeRate.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + { + size := m.MaxRate.Size() + i -= size + if _, err := m.MaxRate.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + { + size := m.Rate.Size() + i -= size + if _, err := m.Rate.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *Commission) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Commission) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Commission) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + n9, err9 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.UpdateTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.UpdateTime):]) + if err9 != nil { + return 0, err9 + } + i -= n9 + i = encodeVarintTypes(dAtA, i, uint64(n9)) + i-- + dAtA[i] = 0x12 + { + size, err := m.CommissionRates.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *Description) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Description) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Description) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Details) > 0 { + i -= len(m.Details) + copy(dAtA[i:], m.Details) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Details))) + i-- + dAtA[i] = 0x2a + } + if len(m.SecurityContact) > 0 { + i -= len(m.SecurityContact) + copy(dAtA[i:], m.SecurityContact) + i = encodeVarintTypes(dAtA, i, uint64(len(m.SecurityContact))) + i-- + dAtA[i] = 0x22 + } + if len(m.Website) > 0 { + i -= len(m.Website) + copy(dAtA[i:], m.Website) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Website))) + i-- + dAtA[i] = 0x1a + } + if len(m.Identity) > 0 { + i -= len(m.Identity) + copy(dAtA[i:], m.Identity) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Identity))) + i-- + dAtA[i] = 0x12 + } + if len(m.Moniker) > 0 { + i -= len(m.Moniker) + copy(dAtA[i:], m.Moniker) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Moniker))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Validator) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Validator) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Validator) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.MinSelfDelegation.Size() + i -= size + if _, err := m.MinSelfDelegation.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x5a + { + size, err := m.Commission.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x52 + n12, err12 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.UnbondingTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.UnbondingTime):]) + if err12 != nil { + return 0, err12 + } + i -= n12 + i = encodeVarintTypes(dAtA, i, uint64(n12)) + i-- + dAtA[i] = 0x4a + if m.UnbondingHeight != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.UnbondingHeight)) + i-- + dAtA[i] = 0x40 + } + { + size, err := m.Description.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -1688,16 +2290,13 @@ func (m *ValidatorProto) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x18 } - { - size, err := m.ConsensusPubkey.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) + if len(m.ConsensusPubkey) > 0 { + i -= len(m.ConsensusPubkey) + copy(dAtA[i:], m.ConsensusPubkey) + i = encodeVarintTypes(dAtA, i, uint64(len(m.ConsensusPubkey))) + i-- + dAtA[i] = 0x12 } - i-- - dAtA[i] = 0x12 if len(m.OperatorAddress) > 0 { i -= len(m.OperatorAddress) copy(dAtA[i:], m.OperatorAddress) @@ -1927,12 +2526,12 @@ func (m *UnbondingDelegationEntry) MarshalToSizedBuffer(dAtA []byte) (int, error } i-- dAtA[i] = 0x1a - n8, err8 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.CompletionTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.CompletionTime):]) - if err8 != nil { - return 0, err8 + n14, err14 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.CompletionTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.CompletionTime):]) + if err14 != nil { + return 0, err14 } - i -= n8 - i = encodeVarintTypes(dAtA, i, uint64(n8)) + i -= n14 + i = encodeVarintTypes(dAtA, i, uint64(n14)) i-- dAtA[i] = 0x12 if m.CreationHeight != 0 { @@ -1983,12 +2582,12 @@ func (m *RedelegationEntry) MarshalToSizedBuffer(dAtA []byte) (int, error) { } i-- dAtA[i] = 0x1a - n9, err9 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.CompletionTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.CompletionTime):]) - if err9 != nil { - return 0, err9 + n15, err15 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.CompletionTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.CompletionTime):]) + if err15 != nil { + return 0, err15 } - i -= n9 - i = encodeVarintTypes(dAtA, i, uint64(n9)) + i -= n15 + i = encodeVarintTypes(dAtA, i, uint64(n15)) i-- dAtA[i] = 0x12 if m.CreationHeight != 0 { @@ -2099,12 +2698,12 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x10 } - n10, err10 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.UnbondingTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.UnbondingTime):]) - if err10 != nil { - return 0, err10 + n16, err16 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.UnbondingTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.UnbondingTime):]) + if err16 != nil { + return 0, err16 } - i -= n10 - i = encodeVarintTypes(dAtA, i, uint64(n10)) + i -= n16 + i = encodeVarintTypes(dAtA, i, uint64(n16)) i-- dAtA[i] = 0xa return len(dAtA) - i, nil @@ -2121,7 +2720,120 @@ func encodeVarintTypes(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } -func (m *HistoricalInfoProto) Size() (n int) { +func (m *MsgCreateValidator) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Description.Size() + n += 1 + l + sovTypes(uint64(l)) + l = m.Commission.Size() + n += 1 + l + sovTypes(uint64(l)) + l = m.MinSelfDelegation.Size() + n += 1 + l + sovTypes(uint64(l)) + l = len(m.DelegatorAddress) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.ValidatorAddress) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.Pubkey) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = m.Value.Size() + n += 1 + l + sovTypes(uint64(l)) + return n +} + +func (m *MsgEditValidator) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Description.Size() + n += 1 + l + sovTypes(uint64(l)) + l = len(m.ValidatorAddress) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + if m.CommissionRate != nil { + l = m.CommissionRate.Size() + n += 1 + l + sovTypes(uint64(l)) + } + if m.MinSelfDelegation != nil { + l = m.MinSelfDelegation.Size() + n += 1 + l + sovTypes(uint64(l)) + } + return n +} + +func (m *MsgDelegate) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.DelegatorAddress) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.ValidatorAddress) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = m.Amount.Size() + n += 1 + l + sovTypes(uint64(l)) + return n +} + +func (m *MsgBeginRedelegate) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.DelegatorAddress) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.ValidatorSrcAddress) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.ValidatorDstAddress) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = m.Amount.Size() + n += 1 + l + sovTypes(uint64(l)) + return n +} + +func (m *MsgUndelegate) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.DelegatorAddress) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.ValidatorAddress) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = m.Amount.Size() + n += 1 + l + sovTypes(uint64(l)) + return n +} + +func (m *HistoricalInfo) Size() (n int) { if m == nil { return 0 } @@ -2195,7 +2907,7 @@ func (m *Description) Size() (n int) { return n } -func (m *ValidatorProto) Size() (n int) { +func (m *Validator) Size() (n int) { if m == nil { return 0 } @@ -2205,8 +2917,10 @@ func (m *ValidatorProto) Size() (n int) { if l > 0 { n += 1 + l + sovTypes(uint64(l)) } - l = m.ConsensusPubkey.Size() - n += 1 + l + sovTypes(uint64(l)) + l = len(m.ConsensusPubkey) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } if m.Jailed { n += 2 } @@ -2308,103 +3022,1077 @@ func (m *UnbondingDelegation) Size() (n int) { n += 1 + l + sovTypes(uint64(l)) } } - return n -} - -func (m *UnbondingDelegationEntry) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.CreationHeight != 0 { - n += 1 + sovTypes(uint64(m.CreationHeight)) - } - l = github_com_gogo_protobuf_types.SizeOfStdTime(m.CompletionTime) - n += 1 + l + sovTypes(uint64(l)) - l = m.InitialBalance.Size() - n += 1 + l + sovTypes(uint64(l)) - l = m.Balance.Size() - n += 1 + l + sovTypes(uint64(l)) - return n -} + return n +} + +func (m *UnbondingDelegationEntry) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.CreationHeight != 0 { + n += 1 + sovTypes(uint64(m.CreationHeight)) + } + l = github_com_gogo_protobuf_types.SizeOfStdTime(m.CompletionTime) + n += 1 + l + sovTypes(uint64(l)) + l = m.InitialBalance.Size() + n += 1 + l + sovTypes(uint64(l)) + l = m.Balance.Size() + n += 1 + l + sovTypes(uint64(l)) + return n +} + +func (m *RedelegationEntry) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.CreationHeight != 0 { + n += 1 + sovTypes(uint64(m.CreationHeight)) + } + l = github_com_gogo_protobuf_types.SizeOfStdTime(m.CompletionTime) + n += 1 + l + sovTypes(uint64(l)) + l = m.InitialBalance.Size() + n += 1 + l + sovTypes(uint64(l)) + l = m.SharesDst.Size() + n += 1 + l + sovTypes(uint64(l)) + return n +} + +func (m *Redelegation) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.DelegatorAddress) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.ValidatorSrcAddress) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.ValidatorDstAddress) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + if len(m.Entries) > 0 { + for _, e := range m.Entries { + l = e.Size() + n += 1 + l + sovTypes(uint64(l)) + } + } + return n +} + +func (m *Params) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = github_com_gogo_protobuf_types.SizeOfStdDuration(m.UnbondingTime) + n += 1 + l + sovTypes(uint64(l)) + if m.MaxValidators != 0 { + n += 1 + sovTypes(uint64(m.MaxValidators)) + } + if m.MaxEntries != 0 { + n += 1 + sovTypes(uint64(m.MaxEntries)) + } + if m.HistoricalEntries != 0 { + n += 1 + sovTypes(uint64(m.HistoricalEntries)) + } + l = len(m.BondDenom) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + return n +} + +func sovTypes(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozTypes(x uint64) (n int) { + return sovTypes(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *MsgCreateValidator) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgCreateValidator: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgCreateValidator: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Description.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Commission", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Commission.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MinSelfDelegation", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.MinSelfDelegation.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddress", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DelegatorAddress = append(m.DelegatorAddress[:0], dAtA[iNdEx:postIndex]...) + if m.DelegatorAddress == nil { + m.DelegatorAddress = []byte{} + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddress", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ValidatorAddress = append(m.ValidatorAddress[:0], dAtA[iNdEx:postIndex]...) + if m.ValidatorAddress == nil { + m.ValidatorAddress = []byte{} + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pubkey", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Pubkey = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Value.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgEditValidator) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgEditValidator: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgEditValidator: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Description.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddress", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ValidatorAddress = append(m.ValidatorAddress[:0], dAtA[iNdEx:postIndex]...) + if m.ValidatorAddress == nil { + m.ValidatorAddress = []byte{} + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommissionRate", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var v github_com_cosmos_cosmos_sdk_types.Dec + m.CommissionRate = &v + if err := m.CommissionRate.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MinSelfDelegation", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var v github_com_cosmos_cosmos_sdk_types.Int + m.MinSelfDelegation = &v + if err := m.MinSelfDelegation.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgDelegate) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgDelegate: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgDelegate: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddress", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DelegatorAddress = append(m.DelegatorAddress[:0], dAtA[iNdEx:postIndex]...) + if m.DelegatorAddress == nil { + m.DelegatorAddress = []byte{} + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddress", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ValidatorAddress = append(m.ValidatorAddress[:0], dAtA[iNdEx:postIndex]...) + if m.ValidatorAddress == nil { + m.ValidatorAddress = []byte{} + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgBeginRedelegate) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgBeginRedelegate: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgBeginRedelegate: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddress", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DelegatorAddress = append(m.DelegatorAddress[:0], dAtA[iNdEx:postIndex]...) + if m.DelegatorAddress == nil { + m.DelegatorAddress = []byte{} + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorSrcAddress", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ValidatorSrcAddress = append(m.ValidatorSrcAddress[:0], dAtA[iNdEx:postIndex]...) + if m.ValidatorSrcAddress == nil { + m.ValidatorSrcAddress = []byte{} + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorDstAddress", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ValidatorDstAddress = append(m.ValidatorDstAddress[:0], dAtA[iNdEx:postIndex]...) + if m.ValidatorDstAddress == nil { + m.ValidatorDstAddress = []byte{} + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } -func (m *RedelegationEntry) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.CreationHeight != 0 { - n += 1 + sovTypes(uint64(m.CreationHeight)) + if iNdEx > l { + return io.ErrUnexpectedEOF } - l = github_com_gogo_protobuf_types.SizeOfStdTime(m.CompletionTime) - n += 1 + l + sovTypes(uint64(l)) - l = m.InitialBalance.Size() - n += 1 + l + sovTypes(uint64(l)) - l = m.SharesDst.Size() - n += 1 + l + sovTypes(uint64(l)) - return n + return nil } - -func (m *Redelegation) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.DelegatorAddress) - if l > 0 { - n += 1 + l + sovTypes(uint64(l)) - } - l = len(m.ValidatorSrcAddress) - if l > 0 { - n += 1 + l + sovTypes(uint64(l)) - } - l = len(m.ValidatorDstAddress) - if l > 0 { - n += 1 + l + sovTypes(uint64(l)) - } - if len(m.Entries) > 0 { - for _, e := range m.Entries { - l = e.Size() - n += 1 + l + sovTypes(uint64(l)) +func (m *MsgUndelegate) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgUndelegate: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUndelegate: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddress", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DelegatorAddress = append(m.DelegatorAddress[:0], dAtA[iNdEx:postIndex]...) + if m.DelegatorAddress == nil { + m.DelegatorAddress = []byte{} + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddress", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ValidatorAddress = append(m.ValidatorAddress[:0], dAtA[iNdEx:postIndex]...) + if m.ValidatorAddress == nil { + m.ValidatorAddress = []byte{} + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy } } - return n -} -func (m *Params) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = github_com_gogo_protobuf_types.SizeOfStdDuration(m.UnbondingTime) - n += 1 + l + sovTypes(uint64(l)) - if m.MaxValidators != 0 { - n += 1 + sovTypes(uint64(m.MaxValidators)) - } - if m.MaxEntries != 0 { - n += 1 + sovTypes(uint64(m.MaxEntries)) - } - if m.HistoricalEntries != 0 { - n += 1 + sovTypes(uint64(m.HistoricalEntries)) - } - l = len(m.BondDenom) - if l > 0 { - n += 1 + l + sovTypes(uint64(l)) + if iNdEx > l { + return io.ErrUnexpectedEOF } - return n -} - -func sovTypes(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozTypes(x uint64) (n int) { - return sovTypes(uint64((x << 1) ^ uint64((int64(x) >> 63)))) + return nil } -func (m *HistoricalInfoProto) Unmarshal(dAtA []byte) error { +func (m *HistoricalInfo) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2427,10 +4115,10 @@ func (m *HistoricalInfoProto) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: HistoricalInfoProto: wiretype end group for non-group") + return fmt.Errorf("proto: HistoricalInfo: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: HistoricalInfoProto: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: HistoricalInfo: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -2495,7 +4183,7 @@ func (m *HistoricalInfoProto) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Valset = append(m.Valset, ValidatorProto{}) + m.Valset = append(m.Valset, Validator{}) if err := m.Valset[len(m.Valset)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -3011,7 +4699,7 @@ func (m *Description) Unmarshal(dAtA []byte) error { } return nil } -func (m *ValidatorProto) Unmarshal(dAtA []byte) error { +func (m *Validator) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3034,10 +4722,10 @@ func (m *ValidatorProto) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: ValidatorProto: wiretype end group for non-group") + return fmt.Errorf("proto: Validator: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: ValidatorProto: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: Validator: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -3078,7 +4766,7 @@ func (m *ValidatorProto) Unmarshal(dAtA []byte) error { if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ConsensusPubkey", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTypes @@ -3088,24 +4776,23 @@ func (m *ValidatorProto) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthTypes } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthTypes } if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.ConsensusPubkey.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.ConsensusPubkey = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 3: if wireType != 0 { @@ -3141,7 +4828,7 @@ func (m *ValidatorProto) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Status |= int32(b&0x7F) << shift + m.Status |= github_com_cosmos_cosmos_sdk_types.BondStatus(b&0x7F) << shift if b < 0x80 { break } diff --git a/x/staking/types/types.proto b/x/staking/types/types.proto index 5ff36762df4d..a1f063eec6f0 100644 --- a/x/staking/types/types.proto +++ b/x/staking/types/types.proto @@ -9,13 +9,103 @@ import "types/types.proto"; option go_package = "github.com/cosmos/cosmos-sdk/x/staking/types"; -// HistoricalInfoProto contains the historical information that gets stored at +// MsgCreateValidator defines an SDK message for creating a new validator. +message MsgCreateValidator { + Description description = 1 [ (gogoproto.nullable) = false ]; + CommissionRates commission = 2 [ (gogoproto.nullable) = false ]; + string min_self_delegation = 3 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.moretags) = "yaml:\"min_self_delegation\"", + (gogoproto.nullable) = false + ]; + bytes delegator_address = 4 [ + (gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress", + (gogoproto.moretags) = "yaml:\"delegator_address\"" + ]; + bytes validator_address = 5 [ + (gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.ValAddress", + (gogoproto.moretags) = "yaml:\"validator_address\"" + ]; + string pubkey = 6; + cosmos_sdk.v1.Coin value = 7 [ (gogoproto.nullable) = false ]; +} + +// MsgEditValidator defines an SDK message for editing an existing validator. +message MsgEditValidator { + Description description = 1 [ (gogoproto.nullable) = false ]; + bytes validator_address = 2 [ + (gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.ValAddress", + (gogoproto.moretags) = "yaml:\"address\"" + ]; + + // We pass a reference to the new commission rate and min self delegation as + // it's not mandatory to update. If not updated, the deserialized rate will be + // zero with no way to distinguish if an update was intended. + // + // REF: #2373 + string commission_rate = 3 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.moretags) = "yaml:\"commission_rate\"" + ]; + string min_self_delegation = 4 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + (gogoproto.moretags) = "yaml:\"min_self_delegation\"" + ]; +} + +// MsgDelegate defines an SDK message for performing a delegation from a +// delegate to a validator. +message MsgDelegate { + bytes delegator_address = 1 [ + (gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress", + (gogoproto.moretags) = "yaml:\"delegator_address\"" + ]; + bytes validator_address = 2 [ + (gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.ValAddress", + (gogoproto.moretags) = "yaml:\"validator_address\"" + ]; + cosmos_sdk.v1.Coin amount = 3 [ (gogoproto.nullable) = false ]; +} + +// MsgBeginRedelegate defines an SDK message for performing a redelegation from +// a delegate and source validator to a destination validator. +message MsgBeginRedelegate { + bytes delegator_address = 1 [ + (gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress", + (gogoproto.moretags) = "yaml:\"delegator_address\"" + ]; + bytes validator_src_address = 2 [ + (gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.ValAddress", + (gogoproto.moretags) = "yaml:\"validator_src_address\"" + ]; + bytes validator_dst_address = 3 [ + (gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.ValAddress", + (gogoproto.moretags) = "yaml:\"validator_dst_address\"" + ]; + cosmos_sdk.v1.Coin amount = 4 [ (gogoproto.nullable) = false ]; +} + +// MsgUndelegate defines an SDK message for performing an undelegation from a +// delegate and a validator. +message MsgUndelegate { + bytes delegator_address = 1 [ + (gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress", + (gogoproto.moretags) = "yaml:\"delegator_address\"" + ]; + bytes validator_address = 2 [ + (gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.ValAddress", + (gogoproto.moretags) = "yaml:\"validator_address\"" + ]; + cosmos_sdk.v1.Coin amount = 3 [ (gogoproto.nullable) = false ]; +} + +// HistoricalInfo contains the historical information that gets stored at // each height. -message HistoricalInfoProto { +message HistoricalInfo { option (gogoproto.equal) = true; tendermint.abci.types.Header header = 1 [ (gogoproto.nullable) = false ]; - repeated ValidatorProto valset = 2 [ (gogoproto.nullable) = false ]; + repeated Validator valset = 2 [ (gogoproto.nullable) = false ]; } // CommissionRates defines the initial commission rates to be used for creating @@ -67,22 +157,28 @@ message Description { string details = 5; } -// ValidatorProto defines the Protocol buffer equivalent of the Validator type. -message ValidatorProto { +// Validator defines the total amount of bond shares and their exchange rate to +// coins. Slashing results in a decrease in the exchange rate, allowing correct +// calculation of future undelegations without iterating over delegators. +// When coins are delegated to this validator, the validator is credited with a +// delegation whose number of bond shares is based on the amount of coins delegated +// divided by the current exchange rate. Voting power can be calculated as total +// bonded shares multiplied by exchange rate. +message Validator { option (gogoproto.equal) = true; + option (gogoproto.goproto_stringer) = false; + option (gogoproto.goproto_getters) = false; bytes operator_address = 1 [ (gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.ValAddress", (gogoproto.moretags) = "yaml:\"operator_address\"" ]; - // TODO: We can remove cosmos_sdk.v1.PublicKey in favor of the primitive bytes - // once Tendermint supports pubkeys as slices. - cosmos_sdk.v1.PublicKey consensus_pubkey = 2 [ - (gogoproto.moretags) = "yaml:\"consensus_pubkey\"", - (gogoproto.nullable) = false - ]; + string consensus_pubkey = 2 + [ (gogoproto.moretags) = "yaml:\"consensus_pubkey\"" ]; bool jailed = 3; - int32 status = 4; + int32 status = 4 [ + (gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.BondStatus" + ]; string tokens = 5 [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false diff --git a/x/staking/types/validator.go b/x/staking/types/validator.go index 74a6b7b2b85c..d2b4a0a3b41c 100644 --- a/x/staking/types/validator.go +++ b/x/staking/types/validator.go @@ -9,9 +9,6 @@ import ( abci "github.com/tendermint/tendermint/abci/types" "github.com/tendermint/tendermint/crypto" - "github.com/tendermint/tendermint/crypto/ed25519" - "github.com/tendermint/tendermint/crypto/secp256k1" - "github.com/tendermint/tendermint/crypto/sr25519" tmtypes "github.com/tendermint/tendermint/types" yaml "gopkg.in/yaml.v2" @@ -31,141 +28,33 @@ const ( MaxDetailsLength = 280 ) -// Implements Validator interface var _ exported.ValidatorI = Validator{} -// Validator defines the total amount of bond shares and their exchange rate to -// coins. Slashing results in a decrease in the exchange rate, allowing correct -// calculation of future undelegations without iterating over delegators. -// When coins are delegated to this validator, the validator is credited with a -// delegation whose number of bond shares is based on the amount of coins delegated -// divided by the current exchange rate. Voting power can be calculated as total -// bonded shares multiplied by exchange rate. -type Validator struct { - OperatorAddress sdk.ValAddress `json:"operator_address" yaml:"operator_address"` // address of the validator's operator; bech encoded in JSON - ConsPubKey crypto.PubKey `json:"consensus_pubkey" yaml:"consensus_pubkey"` // the consensus public key of the validator; bech encoded in JSON - Jailed bool `json:"jailed" yaml:"jailed"` // has the validator been jailed from bonded status? - Status sdk.BondStatus `json:"status" yaml:"status"` // validator status (bonded/unbonding/unbonded) - Tokens sdk.Int `json:"tokens" yaml:"tokens"` // delegated tokens (incl. self-delegation) - DelegatorShares sdk.Dec `json:"delegator_shares" yaml:"delegator_shares"` // total shares issued to a validator's delegators - Description Description `json:"description" yaml:"description"` // description terms for the validator - UnbondingHeight int64 `json:"unbonding_height" yaml:"unbonding_height"` // if unbonding, height at which this validator has begun unbonding - UnbondingCompletionTime time.Time `json:"unbonding_time" yaml:"unbonding_time"` // if unbonding, min time for the validator to complete unbonding - Commission Commission `json:"commission" yaml:"commission"` // commission parameters - MinSelfDelegation sdk.Int `json:"min_self_delegation" yaml:"min_self_delegation"` // validator's self declared minimum self delegation -} - func NewValidator(operator sdk.ValAddress, pubKey crypto.PubKey, description Description) Validator { - return Validator{ - OperatorAddress: operator, - ConsPubKey: pubKey, - Jailed: false, - Status: sdk.Unbonded, - Tokens: sdk.ZeroInt(), - DelegatorShares: sdk.ZeroDec(), - Description: description, - UnbondingHeight: int64(0), - UnbondingCompletionTime: time.Unix(0, 0).UTC(), - Commission: NewCommission(sdk.ZeroDec(), sdk.ZeroDec(), sdk.ZeroDec()), - MinSelfDelegation: sdk.OneInt(), - } -} - -// ToProto converts a Validator into a ValidatorProto type. -func (v Validator) ToProto() ValidatorProto { - var pk sdk.PublicKey - - switch t := v.ConsPubKey.(type) { - case secp256k1.PubKeySecp256k1: - pk = sdk.PublicKey{ - Pub: &sdk.PublicKey_Secp256K1{Secp256K1: t.Bytes()}, - } - - case ed25519.PubKeyEd25519: - pk = sdk.PublicKey{ - Pub: &sdk.PublicKey_Ed25519{Ed25519: t.Bytes()}, - } - - case sr25519.PubKeySr25519: - pk = sdk.PublicKey{ - Pub: &sdk.PublicKey_Sr25519{Sr25519: t.Bytes()}, - } - } - - return ValidatorProto{ - OperatorAddress: v.OperatorAddress, - ConsensusPubkey: pk, - Jailed: v.Jailed, - Status: int32(v.Status), - Tokens: v.Tokens, - DelegatorShares: v.DelegatorShares, - Description: v.Description, - UnbondingHeight: v.UnbondingHeight, - UnbondingTime: v.UnbondingCompletionTime, - Commission: v.Commission, - MinSelfDelegation: v.MinSelfDelegation, - } -} - -// ToValidator converts a ValidatorProto to a Validator type. -func (vp ValidatorProto) ToValidator() Validator { - var ( - pk crypto.PubKey - err error - ) - - switch t := vp.ConsensusPubkey.GetPub().(type) { - case *sdk.PublicKey_Secp256K1: - err = ModuleCdc.amino.UnmarshalBinaryBare(t.Secp256K1, &pk) - - case *sdk.PublicKey_Ed25519: - err = ModuleCdc.amino.UnmarshalBinaryBare(t.Ed25519, &pk) - - case *sdk.PublicKey_Sr25519: - err = ModuleCdc.amino.UnmarshalBinaryBare(t.Sr25519, &pk) - - default: - err = fmt.Errorf("unsupported public key type: %T", t) - } - - if err != nil { - panic(fmt.Errorf("failed to decode public key: %w", err)) + var pkStr string + if pubKey != nil { + pkStr = sdk.MustBech32ifyPubKey(sdk.Bech32PubKeyTypeConsPub, pubKey) } return Validator{ - OperatorAddress: vp.OperatorAddress, - ConsPubKey: pk, - Jailed: vp.Jailed, - Status: sdk.BondStatus(byte(vp.Status)), - Tokens: vp.Tokens, - DelegatorShares: vp.DelegatorShares, - Description: vp.Description, - UnbondingHeight: vp.UnbondingHeight, - UnbondingCompletionTime: vp.UnbondingTime, - Commission: vp.Commission, - MinSelfDelegation: vp.MinSelfDelegation, + OperatorAddress: operator, + ConsensusPubkey: pkStr, + Jailed: false, + Status: sdk.Unbonded, + Tokens: sdk.ZeroInt(), + DelegatorShares: sdk.ZeroDec(), + Description: description, + UnbondingHeight: int64(0), + UnbondingTime: time.Unix(0, 0).UTC(), + Commission: NewCommission(sdk.ZeroDec(), sdk.ZeroDec(), sdk.ZeroDec()), + MinSelfDelegation: sdk.OneInt(), } } // String implements the Stringer interface for a Validator object. func (v Validator) String() string { - bechConsPubKey, _ := sdk.Bech32ifyPubKey(sdk.Bech32PubKeyTypeConsPub, v.ConsPubKey) - - bz, _ := yaml.Marshal(bechValidator{ - OperatorAddress: v.OperatorAddress, - ConsPubKey: bechConsPubKey, - Jailed: v.Jailed, - Status: v.Status, - Tokens: v.Tokens, - DelegatorShares: v.DelegatorShares, - Description: v.Description, - UnbondingHeight: v.UnbondingHeight, - UnbondingCompletionTime: v.UnbondingCompletionTime, - Commission: v.Commission, - MinSelfDelegation: v.MinSelfDelegation, - }) - - return string(bz) + out, _ := yaml.Marshal(v) + return string(out) } // Validators is a collection of Validator @@ -219,8 +108,7 @@ func (v Validators) Swap(i, j int) { // return the redelegation func MustMarshalValidator(cdc codec.Marshaler, validator Validator) []byte { - valProto := validator.ToProto() - return cdc.MustMarshalBinaryLengthPrefixed(&valProto) + return cdc.MustMarshalBinaryLengthPrefixed(&validator) } // unmarshal a redelegation from a store value @@ -233,92 +121,9 @@ func MustUnmarshalValidator(cdc codec.Marshaler, value []byte) Validator { } // unmarshal a redelegation from a store value -func UnmarshalValidator(cdc codec.Marshaler, value []byte) (Validator, error) { - vp := ValidatorProto{} - if err := cdc.UnmarshalBinaryLengthPrefixed(value, &vp); err != nil { - return Validator{}, err - } - - return vp.ToValidator(), nil -} - -// this is a helper struct used for JSON de- and encoding only -type bechValidator struct { - OperatorAddress sdk.ValAddress `json:"operator_address" yaml:"operator_address"` // the bech32 address of the validator's operator - ConsPubKey string `json:"consensus_pubkey" yaml:"consensus_pubkey"` // the bech32 consensus public key of the validator - Jailed bool `json:"jailed" yaml:"jailed"` // has the validator been jailed from bonded status? - Status sdk.BondStatus `json:"status" yaml:"status"` // validator status (bonded/unbonding/unbonded) - Tokens sdk.Int `json:"tokens" yaml:"tokens"` // delegated tokens (incl. self-delegation) - DelegatorShares sdk.Dec `json:"delegator_shares" yaml:"delegator_shares"` // total shares issued to a validator's delegators - Description Description `json:"description" yaml:"description"` // description terms for the validator - UnbondingHeight int64 `json:"unbonding_height" yaml:"unbonding_height"` // if unbonding, height at which this validator has begun unbonding - UnbondingCompletionTime time.Time `json:"unbonding_time" yaml:"unbonding_time"` // if unbonding, min time for the validator to complete unbonding - Commission Commission `json:"commission" yaml:"commission"` // commission parameters - MinSelfDelegation sdk.Int `json:"min_self_delegation" yaml:"min_self_delegation"` // minimum self delegation -} - -// MarshalJSON marshals the validator to JSON using Bech32 -func (v Validator) MarshalJSON() ([]byte, error) { - bechConsPubKey, err := sdk.Bech32ifyPubKey(sdk.Bech32PubKeyTypeConsPub, v.ConsPubKey) - if err != nil { - return nil, err - } - - return codec.Cdc.MarshalJSON(bechValidator{ - OperatorAddress: v.OperatorAddress, - ConsPubKey: bechConsPubKey, - Jailed: v.Jailed, - Status: v.Status, - Tokens: v.Tokens, - DelegatorShares: v.DelegatorShares, - Description: v.Description, - UnbondingHeight: v.UnbondingHeight, - UnbondingCompletionTime: v.UnbondingCompletionTime, - MinSelfDelegation: v.MinSelfDelegation, - Commission: v.Commission, - }) -} - -// UnmarshalJSON unmarshals the validator from JSON using Bech32 -func (v *Validator) UnmarshalJSON(data []byte) error { - bv := &bechValidator{} - if err := codec.Cdc.UnmarshalJSON(data, bv); err != nil { - return err - } - consPubKey, err := sdk.GetPubKeyFromBech32(sdk.Bech32PubKeyTypeConsPub, bv.ConsPubKey) - if err != nil { - return err - } - *v = Validator{ - OperatorAddress: bv.OperatorAddress, - ConsPubKey: consPubKey, - Jailed: bv.Jailed, - Tokens: bv.Tokens, - Status: bv.Status, - DelegatorShares: bv.DelegatorShares, - Description: bv.Description, - UnbondingHeight: bv.UnbondingHeight, - UnbondingCompletionTime: bv.UnbondingCompletionTime, - Commission: bv.Commission, - MinSelfDelegation: bv.MinSelfDelegation, - } - return nil -} - -// only the vitals -func (v Validator) TestEquivalent(v2 Validator) bool { - return v.ConsPubKey.Equals(v2.ConsPubKey) && - bytes.Equal(v.OperatorAddress, v2.OperatorAddress) && - v.Status.Equal(v2.Status) && - v.Tokens.Equal(v2.Tokens) && - v.DelegatorShares.Equal(v2.DelegatorShares) && - v.Description == v2.Description && - v.Commission.Equal(v2.Commission) -} - -// return the TM validator address -func (v Validator) ConsAddress() sdk.ConsAddress { - return sdk.ConsAddress(v.ConsPubKey.Address()) +func UnmarshalValidator(cdc codec.Marshaler, value []byte) (v Validator, err error) { + err = cdc.UnmarshalBinaryLengthPrefixed(value, &v) + return v, err } // IsBonded checks if the validator status equals Bonded @@ -408,7 +213,7 @@ func (d Description) EnsureLength() (Description, error) { // with the full validator power func (v Validator) ABCIValidatorUpdate() abci.ValidatorUpdate { return abci.ValidatorUpdate{ - PubKey: tmtypes.TM2PB.PubKey(v.ConsPubKey), + PubKey: tmtypes.TM2PB.PubKey(v.GetConsPubKey()), Power: v.ConsensusPower(), } } @@ -417,14 +222,14 @@ func (v Validator) ABCIValidatorUpdate() abci.ValidatorUpdate { // with zero power used for validator updates. func (v Validator) ABCIValidatorUpdateZero() abci.ValidatorUpdate { return abci.ValidatorUpdate{ - PubKey: tmtypes.TM2PB.PubKey(v.ConsPubKey), + PubKey: tmtypes.TM2PB.PubKey(v.GetConsPubKey()), Power: 0, } } // ToTmValidator casts an SDK validator to a tendermint type Validator. func (v Validator) ToTmValidator() *tmtypes.Validator { - return tmtypes.NewValidator(v.ConsPubKey, v.ConsensusPower()) + return tmtypes.NewValidator(v.GetConsPubKey(), v.ConsensusPower()) } // SetInitialCommission attempts to set a validator's initial commission. An @@ -549,20 +354,19 @@ func (v Validator) RemoveTokens(tokens sdk.Int) Validator { // NOTE: because token fractions are left in the valiadator, // the exchange rate of future shares of this validator can increase. func (v Validator) RemoveDelShares(delShares sdk.Dec) (Validator, sdk.Int) { - remainingShares := v.DelegatorShares.Sub(delShares) + var issuedTokens sdk.Int if remainingShares.IsZero() { - // last delegation share gets any trimmings issuedTokens = v.Tokens v.Tokens = sdk.ZeroInt() } else { - // leave excess tokens in the validator // however fully use all the delegator shares issuedTokens = v.TokensFromShares(delShares).TruncateInt() v.Tokens = v.Tokens.Sub(issuedTokens) + if v.Tokens.IsNegative() { panic("attempting to remove more tokens than available in validator") } @@ -573,12 +377,14 @@ func (v Validator) RemoveDelShares(delShares sdk.Dec) (Validator, sdk.Int) { } // nolint - for ValidatorI -func (v Validator) IsJailed() bool { return v.Jailed } -func (v Validator) GetMoniker() string { return v.Description.Moniker } -func (v Validator) GetStatus() sdk.BondStatus { return v.Status } -func (v Validator) GetOperator() sdk.ValAddress { return v.OperatorAddress } -func (v Validator) GetConsPubKey() crypto.PubKey { return v.ConsPubKey } -func (v Validator) GetConsAddr() sdk.ConsAddress { return sdk.ConsAddress(v.ConsPubKey.Address()) } +func (v Validator) IsJailed() bool { return v.Jailed } +func (v Validator) GetMoniker() string { return v.Description.Moniker } +func (v Validator) GetStatus() sdk.BondStatus { return v.Status } +func (v Validator) GetOperator() sdk.ValAddress { return v.OperatorAddress } +func (v Validator) GetConsPubKey() crypto.PubKey { + return sdk.MustGetPubKeyFromBech32(sdk.Bech32PubKeyTypeConsPub, v.ConsensusPubkey) +} +func (v Validator) GetConsAddr() sdk.ConsAddress { return sdk.ConsAddress(v.GetConsPubKey().Address()) } func (v Validator) GetTokens() sdk.Int { return v.Tokens } func (v Validator) GetBondedTokens() sdk.Int { return v.BondedTokens() } func (v Validator) GetConsensusPower() int64 { return v.ConsensusPower() } diff --git a/x/staking/types/validator_test.go b/x/staking/types/validator_test.go index b8a572444e0c..54e0c7ebb639 100644 --- a/x/staking/types/validator_test.go +++ b/x/staking/types/validator_test.go @@ -1,7 +1,6 @@ package types import ( - "fmt" "math/rand" "reflect" "sort" @@ -11,7 +10,6 @@ import ( "github.com/stretchr/testify/require" "github.com/tendermint/tendermint/crypto/ed25519" tmtypes "github.com/tendermint/tendermint/types" - yaml "gopkg.in/yaml.v2" "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" @@ -21,12 +19,12 @@ func TestValidatorTestEquivalent(t *testing.T) { val1 := NewValidator(valAddr1, pk1, Description{}) val2 := NewValidator(valAddr1, pk1, Description{}) - ok := val1.TestEquivalent(val2) + ok := val1.Equal(val2) require.True(t, ok) val2 = NewValidator(valAddr2, pk2, Description{}) - ok = val1.TestEquivalent(val2) + ok = val1.Equal(val2) require.False(t, ok) } @@ -63,7 +61,7 @@ func TestABCIValidatorUpdate(t *testing.T) { validator := NewValidator(valAddr1, pk1, Description{}) abciVal := validator.ABCIValidatorUpdate() - require.Equal(t, tmtypes.TM2PB.PubKey(validator.ConsPubKey), abciVal.PubKey) + require.Equal(t, tmtypes.TM2PB.PubKey(validator.GetConsPubKey()), abciVal.PubKey) require.Equal(t, validator.BondedTokens().Int64(), abciVal.Power) } @@ -71,14 +69,14 @@ func TestABCIValidatorUpdateZero(t *testing.T) { validator := NewValidator(valAddr1, pk1, Description{}) abciVal := validator.ABCIValidatorUpdateZero() - require.Equal(t, tmtypes.TM2PB.PubKey(validator.ConsPubKey), abciVal.PubKey) + require.Equal(t, tmtypes.TM2PB.PubKey(validator.GetConsPubKey()), abciVal.PubKey) require.Equal(t, int64(0), abciVal.Power) } func TestShareTokens(t *testing.T) { validator := Validator{ OperatorAddress: valAddr1, - ConsPubKey: pk1, + ConsensusPubkey: sdk.MustBech32ifyPubKey(sdk.Bech32PubKeyTypeConsPub, pk1), Status: sdk.Bonded, Tokens: sdk.NewInt(100), DelegatorShares: sdk.NewDec(100), @@ -96,7 +94,7 @@ func TestRemoveTokens(t *testing.T) { validator := Validator{ OperatorAddress: valAddr, - ConsPubKey: valPubKey, + ConsensusPubkey: sdk.MustBech32ifyPubKey(sdk.Bech32PubKeyTypeConsPub, valPubKey), Status: sdk.Bonded, Tokens: sdk.NewInt(100), DelegatorShares: sdk.NewDec(100), @@ -152,7 +150,7 @@ func TestAddTokensValidatorUnbonded(t *testing.T) { func TestRemoveDelShares(t *testing.T) { valA := Validator{ OperatorAddress: sdk.ValAddress(pk1.Address().Bytes()), - ConsPubKey: pk1, + ConsensusPubkey: sdk.MustBech32ifyPubKey(sdk.Bech32PubKeyTypeConsPub, pk1), Status: sdk.Bonded, Tokens: sdk.NewInt(100), DelegatorShares: sdk.NewDec(100), @@ -169,7 +167,7 @@ func TestRemoveDelShares(t *testing.T) { delShares := sdk.NewDec(115) validator := Validator{ OperatorAddress: sdk.ValAddress(pk1.Address().Bytes()), - ConsPubKey: pk1, + ConsensusPubkey: sdk.MustBech32ifyPubKey(sdk.Bech32PubKeyTypeConsPub, pk1), Status: sdk.Bonded, Tokens: poolTokens, DelegatorShares: delShares, @@ -218,7 +216,7 @@ func TestPossibleOverflow(t *testing.T) { delShares := sdk.NewDec(391432570689183511).Quo(sdk.NewDec(40113011844664)) validator := Validator{ OperatorAddress: sdk.ValAddress(pk1.Address().Bytes()), - ConsPubKey: pk1, + ConsensusPubkey: sdk.MustBech32ifyPubKey(sdk.Bech32PubKeyTypeConsPub, pk1), Status: sdk.Bonded, Tokens: sdk.NewInt(2159), DelegatorShares: delShares, @@ -276,38 +274,6 @@ func TestValidatorSetInitialCommission(t *testing.T) { } } -func TestValidatorMarshalYAML(t *testing.T) { - validator := NewValidator(valAddr1, pk1, Description{}) - bechifiedPub, err := sdk.Bech32ifyPubKey(sdk.Bech32PubKeyTypeConsPub, validator.ConsPubKey) - require.NoError(t, err) - bs, err := yaml.Marshal(validator) - require.NoError(t, err) - want := fmt.Sprintf(`| - operatoraddress: %s - conspubkey: %s - jailed: false - status: 0 - tokens: "0" - delegatorshares: "0.000000000000000000" - description: - moniker: "" - identity: "" - website: "" - security_contact: "" - details: "" - unbondingheight: 0 - unbondingcompletiontime: 1970-01-01T00:00:00Z - commission: - commission_rates: - rate: "0.000000000000000000" - max_rate: "0.000000000000000000" - max_change_rate: "0.000000000000000000" - update_time: 1970-01-01T00:00:00Z - minselfdelegation: "1" -`, validator.OperatorAddress.String(), bechifiedPub) - require.Equal(t, want, string(bs)) -} - // Check that sort will create deterministic ordering of validators func TestValidatorsSortDeterminism(t *testing.T) { vals := make([]Validator, 10) From 60dc3672dc0a699de437b8de00185ef69abd28b6 Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Mon, 3 Feb 2020 14:40:01 -0500 Subject: [PATCH 04/46] Add benchmarks for bech32 pubkey funcs --- types/address_bench_test.go | 48 +++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 types/address_bench_test.go diff --git a/types/address_bench_test.go b/types/address_bench_test.go new file mode 100644 index 000000000000..8e438a81dacd --- /dev/null +++ b/types/address_bench_test.go @@ -0,0 +1,48 @@ +package types_test + +import ( + "math/rand" + "testing" + "time" + + "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/require" + + "github.com/tendermint/tendermint/crypto/ed25519" +) + +func BenchmarkBech32ifyPubKey(b *testing.B) { + var pk ed25519.PubKeyEd25519 + rng := rand.New(rand.NewSource(time.Now().Unix())) + + b.ResetTimer() + + for i := 0; i < b.N; i++ { + b.StopTimer() + rng.Read(pk[:]) + b.StartTimer() + + _, err := types.Bech32ifyPubKey(types.Bech32PubKeyTypeConsPub, pk) + require.NoError(b, err) + } +} + +func BenchmarkGetPubKeyFromBech32(b *testing.B) { + var pk ed25519.PubKeyEd25519 + rng := rand.New(rand.NewSource(time.Now().Unix())) + + b.ResetTimer() + + for i := 0; i < b.N; i++ { + b.StopTimer() + rng.Read(pk[:]) + + pkStr, err := types.Bech32ifyPubKey(types.Bech32PubKeyTypeConsPub, pk) + require.NoError(b, err) + + b.StartTimer() + pk2, err := types.GetPubKeyFromBech32(types.Bech32PubKeyTypeConsPub, pkStr) + require.NoError(b, err) + require.Equal(b, pk, pk2) + } +} From f0f6f50ff55ddb57e8e78ed31795f31c93a876f5 Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Mon, 3 Feb 2020 14:40:17 -0500 Subject: [PATCH 05/46] Update BondStatus type alias to int32 --- types/staking.go | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/types/staking.go b/types/staking.go index 9f623b3575e6..91c7601386d6 100644 --- a/types/staking.go +++ b/types/staking.go @@ -36,13 +36,13 @@ func TokensFromConsensusPower(power int64) Int { } // BondStatus is the status of a validator -type BondStatus byte +type BondStatus int32 // staking constants const ( - Unbonded BondStatus = 0x00 - Unbonding BondStatus = 0x01 - Bonded BondStatus = 0x02 + Unbonded BondStatus = 1 + Unbonding BondStatus = 2 + Bonded BondStatus = 3 BondStatusUnbonded = "Unbonded" BondStatusUnbonding = "Unbonding" @@ -57,12 +57,15 @@ func (b BondStatus) Equal(b2 BondStatus) bool { // String implements the Stringer interface for BondStatus. func (b BondStatus) String() string { switch b { - case 0x00: + case Unbonded: return BondStatusUnbonded - case 0x01: + + case Unbonding: return BondStatusUnbonding - case 0x02: + + case Bonded: return BondStatusBonded + default: panic("invalid bond status") } From c268a9e539766aa1e704f31ab54f1dccfede4706 Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Mon, 3 Feb 2020 14:40:50 -0500 Subject: [PATCH 06/46] Remove PubKey proto type --- types/types.pb.go | 553 +--------------------------------------------- types/types.proto | 12 - 2 files changed, 7 insertions(+), 558 deletions(-) diff --git a/types/types.pb.go b/types/types.pb.go index 2f7560431406..4ea0bfeec523 100644 --- a/types/types.pb.go +++ b/types/types.pb.go @@ -4,15 +4,12 @@ package types import ( - bytes "bytes" fmt "fmt" _ "github.com/gogo/protobuf/gogoproto" proto "github.com/gogo/protobuf/proto" io "io" math "math" math_bits "math/bits" - reflect "reflect" - strings "strings" ) // Reference imports to suppress errors if they are not otherwise used. @@ -122,115 +119,15 @@ func (m *DecCoin) GetDenom() string { return "" } -// PublicKey defines a type to represent raw public key bytes. -type PublicKey struct { - // Types that are valid to be assigned to Pub: - // *PublicKey_Ed25519 - // *PublicKey_Secp256K1 - // *PublicKey_Sr25519 - Pub isPublicKey_Pub `protobuf_oneof:"pub"` -} - -func (m *PublicKey) Reset() { *m = PublicKey{} } -func (*PublicKey) ProtoMessage() {} -func (*PublicKey) Descriptor() ([]byte, []int) { - return fileDescriptor_2c0f90c600ad7e2e, []int{2} -} -func (m *PublicKey) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *PublicKey) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_PublicKey.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *PublicKey) XXX_Merge(src proto.Message) { - xxx_messageInfo_PublicKey.Merge(m, src) -} -func (m *PublicKey) XXX_Size() int { - return m.Size() -} -func (m *PublicKey) XXX_DiscardUnknown() { - xxx_messageInfo_PublicKey.DiscardUnknown(m) -} - -var xxx_messageInfo_PublicKey proto.InternalMessageInfo - -type isPublicKey_Pub interface { - isPublicKey_Pub() - Equal(interface{}) bool - MarshalTo([]byte) (int, error) - Size() int -} - -type PublicKey_Ed25519 struct { - Ed25519 []byte `protobuf:"bytes,1,opt,name=ed25519,proto3,oneof" json:"ed25519,omitempty"` -} -type PublicKey_Secp256K1 struct { - Secp256K1 []byte `protobuf:"bytes,2,opt,name=secp256k1,proto3,oneof" json:"secp256k1,omitempty"` -} -type PublicKey_Sr25519 struct { - Sr25519 []byte `protobuf:"bytes,3,opt,name=sr25519,proto3,oneof" json:"sr25519,omitempty"` -} - -func (*PublicKey_Ed25519) isPublicKey_Pub() {} -func (*PublicKey_Secp256K1) isPublicKey_Pub() {} -func (*PublicKey_Sr25519) isPublicKey_Pub() {} - -func (m *PublicKey) GetPub() isPublicKey_Pub { - if m != nil { - return m.Pub - } - return nil -} - -func (m *PublicKey) GetEd25519() []byte { - if x, ok := m.GetPub().(*PublicKey_Ed25519); ok { - return x.Ed25519 - } - return nil -} - -func (m *PublicKey) GetSecp256K1() []byte { - if x, ok := m.GetPub().(*PublicKey_Secp256K1); ok { - return x.Secp256K1 - } - return nil -} - -func (m *PublicKey) GetSr25519() []byte { - if x, ok := m.GetPub().(*PublicKey_Sr25519); ok { - return x.Sr25519 - } - return nil -} - -// XXX_OneofWrappers is for the internal use of the proto package. -func (*PublicKey) XXX_OneofWrappers() []interface{} { - return []interface{}{ - (*PublicKey_Ed25519)(nil), - (*PublicKey_Secp256K1)(nil), - (*PublicKey_Sr25519)(nil), - } -} - func init() { proto.RegisterType((*Coin)(nil), "cosmos_sdk.v1.Coin") proto.RegisterType((*DecCoin)(nil), "cosmos_sdk.v1.DecCoin") - proto.RegisterType((*PublicKey)(nil), "cosmos_sdk.v1.PublicKey") } func init() { proto.RegisterFile("types/types.proto", fileDescriptor_2c0f90c600ad7e2e) } var fileDescriptor_2c0f90c600ad7e2e = []byte{ - // 293 bytes of a gzipped FileDescriptorProto + // 214 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x2c, 0xa9, 0x2c, 0x48, 0x2d, 0xd6, 0x07, 0x93, 0x7a, 0x05, 0x45, 0xf9, 0x25, 0xf9, 0x42, 0xbc, 0xc9, 0xf9, 0xc5, 0xb9, 0xf9, 0xc5, 0xf1, 0xc5, 0x29, 0xd9, 0x7a, 0x65, 0x86, 0x52, 0x6a, 0x25, 0x19, 0x99, 0x45, 0x29, @@ -239,121 +136,14 @@ var fileDescriptor_2c0f90c600ad7e2e = []byte{ 0x5e, 0x7e, 0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x94, 0xd2, 0x2d, 0x4e, 0xc9, 0x86, - 0xc4, 0x40, 0x12, 0x1b, 0x38, 0x2c, 0x8d, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0x83, 0x31, 0xbe, - 0xbf, 0x97, 0x01, 0x00, 0x00, + 0x32, 0x39, 0xa6, 0xb8, 0xa4, 0x26, 0xc3, 0x4c, 0x71, 0x72, 0xb9, 0xf1, 0x50, 0x8e, 0xa1, 0xe1, + 0x91, 0x1c, 0xc3, 0x89, 0x47, 0x72, 0x8c, 0x17, 0x1e, 0xc9, 0x31, 0x3e, 0x78, 0x24, 0xc7, 0x38, + 0xe1, 0xb1, 0x1c, 0xc3, 0x85, 0xc7, 0x72, 0x0c, 0x37, 0x1e, 0xcb, 0x31, 0x44, 0x29, 0xa5, 0x67, + 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0xea, 0x43, 0x3c, 0x0b, 0xa5, 0x74, 0x8b, 0x53, + 0xb2, 0x21, 0x61, 0x91, 0xc4, 0x06, 0xf6, 0x95, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0x8d, 0xc6, + 0x8c, 0x7d, 0x21, 0x01, 0x00, 0x00, } -func (this *PublicKey) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*PublicKey) - if !ok { - that2, ok := that.(PublicKey) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if that1.Pub == nil { - if this.Pub != nil { - return false - } - } else if this.Pub == nil { - return false - } else if !this.Pub.Equal(that1.Pub) { - return false - } - return true -} -func (this *PublicKey_Ed25519) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*PublicKey_Ed25519) - if !ok { - that2, ok := that.(PublicKey_Ed25519) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if !bytes.Equal(this.Ed25519, that1.Ed25519) { - return false - } - return true -} -func (this *PublicKey_Secp256K1) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*PublicKey_Secp256K1) - if !ok { - that2, ok := that.(PublicKey_Secp256K1) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if !bytes.Equal(this.Secp256K1, that1.Secp256K1) { - return false - } - return true -} -func (this *PublicKey_Sr25519) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*PublicKey_Sr25519) - if !ok { - that2, ok := that.(PublicKey_Sr25519) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if !bytes.Equal(this.Sr25519, that1.Sr25519) { - return false - } - return true -} func (m *Coin) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -434,86 +224,6 @@ func (m *DecCoin) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *PublicKey) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *PublicKey) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *PublicKey) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Pub != nil { - { - size := m.Pub.Size() - i -= size - if _, err := m.Pub.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - } - } - return len(dAtA) - i, nil -} - -func (m *PublicKey_Ed25519) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *PublicKey_Ed25519) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - if m.Ed25519 != nil { - i -= len(m.Ed25519) - copy(dAtA[i:], m.Ed25519) - i = encodeVarintTypes(dAtA, i, uint64(len(m.Ed25519))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} -func (m *PublicKey_Secp256K1) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *PublicKey_Secp256K1) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - if m.Secp256K1 != nil { - i -= len(m.Secp256K1) - copy(dAtA[i:], m.Secp256K1) - i = encodeVarintTypes(dAtA, i, uint64(len(m.Secp256K1))) - i-- - dAtA[i] = 0x12 - } - return len(dAtA) - i, nil -} -func (m *PublicKey_Sr25519) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *PublicKey_Sr25519) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - if m.Sr25519 != nil { - i -= len(m.Sr25519) - copy(dAtA[i:], m.Sr25519) - i = encodeVarintTypes(dAtA, i, uint64(len(m.Sr25519))) - i-- - dAtA[i] = 0x1a - } - return len(dAtA) - i, nil -} func encodeVarintTypes(dAtA []byte, offset int, v uint64) int { offset -= sovTypes(v) base := offset @@ -555,109 +265,12 @@ func (m *DecCoin) Size() (n int) { return n } -func (m *PublicKey) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Pub != nil { - n += m.Pub.Size() - } - return n -} - -func (m *PublicKey_Ed25519) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Ed25519 != nil { - l = len(m.Ed25519) - n += 1 + l + sovTypes(uint64(l)) - } - return n -} -func (m *PublicKey_Secp256K1) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Secp256K1 != nil { - l = len(m.Secp256K1) - n += 1 + l + sovTypes(uint64(l)) - } - return n -} -func (m *PublicKey_Sr25519) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Sr25519 != nil { - l = len(m.Sr25519) - n += 1 + l + sovTypes(uint64(l)) - } - return n -} - func sovTypes(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } func sozTypes(x uint64) (n int) { return sovTypes(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } -func (this *PublicKey) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&PublicKey{`, - `Pub:` + fmt.Sprintf("%v", this.Pub) + `,`, - `}`, - }, "") - return s -} -func (this *PublicKey_Ed25519) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&PublicKey_Ed25519{`, - `Ed25519:` + fmt.Sprintf("%v", this.Ed25519) + `,`, - `}`, - }, "") - return s -} -func (this *PublicKey_Secp256K1) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&PublicKey_Secp256K1{`, - `Secp256K1:` + fmt.Sprintf("%v", this.Secp256K1) + `,`, - `}`, - }, "") - return s -} -func (this *PublicKey_Sr25519) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&PublicKey_Sr25519{`, - `Sr25519:` + fmt.Sprintf("%v", this.Sr25519) + `,`, - `}`, - }, "") - return s -} -func valueToStringTypes(v interface{}) string { - rv := reflect.ValueOf(v) - if rv.IsNil() { - return "nil" - } - pv := reflect.Indirect(rv).Interface() - return fmt.Sprintf("*%v", pv) -} func (m *Coin) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -896,158 +509,6 @@ func (m *DecCoin) Unmarshal(dAtA []byte) error { } return nil } -func (m *PublicKey) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: PublicKey: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: PublicKey: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Ed25519", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - v := make([]byte, postIndex-iNdEx) - copy(v, dAtA[iNdEx:postIndex]) - m.Pub = &PublicKey_Ed25519{v} - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Secp256K1", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - v := make([]byte, postIndex-iNdEx) - copy(v, dAtA[iNdEx:postIndex]) - m.Pub = &PublicKey_Secp256K1{v} - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Sr25519", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - v := make([]byte, postIndex-iNdEx) - copy(v, dAtA[iNdEx:postIndex]) - m.Pub = &PublicKey_Sr25519{v} - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTypes(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func skipTypes(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/types/types.proto b/types/types.proto index a9b3dcb1ee62..49da4e5c69f9 100644 --- a/types/types.proto +++ b/types/types.proto @@ -24,15 +24,3 @@ message DecCoin { string denom = 1; string amount = 2 [ (gogoproto.customtype) = "Dec", (gogoproto.nullable) = false ]; } - -// PublicKey defines a type to represent raw public key bytes. -message PublicKey { - option (gogoproto.equal) = true; - option (gogoproto.stringer) = true; - - oneof pub { - bytes ed25519 = 1; - bytes secp256k1 = 2; - bytes sr25519 = 3; - } -} \ No newline at end of file From 95edc79af9418460d9b63cd167852dcd33d7ec83 Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Mon, 3 Feb 2020 14:48:16 -0500 Subject: [PATCH 07/46] Fix unit test --- x/staking/types/msg_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/staking/types/msg_test.go b/x/staking/types/msg_test.go index 22914ec8aefa..99866b11ca65 100644 --- a/x/staking/types/msg_test.go +++ b/x/staking/types/msg_test.go @@ -32,7 +32,7 @@ func TestMsgCreateValidator(t *testing.T) { {"partial description", "", "", "c", "", "", commission1, sdk.OneInt(), valAddr1, pk1, coinPos, true}, {"empty description", "", "", "", "", "", commission2, sdk.OneInt(), valAddr1, pk1, coinPos, false}, {"empty address", "a", "b", "c", "d", "e", commission2, sdk.OneInt(), emptyAddr, pk1, coinPos, false}, - {"empty pubkey", "a", "b", "c", "d", "e", commission1, sdk.OneInt(), valAddr1, emptyPubkey, coinPos, true}, + {"empty pubkey", "a", "b", "c", "d", "e", commission1, sdk.OneInt(), valAddr1, emptyPubkey, coinPos, false}, {"empty bond", "a", "b", "c", "d", "e", commission2, sdk.OneInt(), valAddr1, pk1, coinZero, false}, {"zero min self delegation", "a", "b", "c", "d", "e", commission1, sdk.ZeroInt(), valAddr1, pk1, coinPos, false}, {"negative min self delegation", "a", "b", "c", "d", "e", commission1, sdk.NewInt(-1), valAddr1, pk1, coinPos, false}, From 46be4b4c4d6cf08e9b427fbca0b61b5610921c73 Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Mon, 3 Feb 2020 15:58:26 -0500 Subject: [PATCH 08/46] Update staking keeper --- codec/amino.go | 8 +- types/decimal.go | 4 + types/int.go | 4 + types/types.pb.go | 554 ++++++++++++++++++++++++- types/types.proto | 25 +- x/staking/alias.go | 1 + x/staking/keeper/delegation.go | 36 +- x/staking/keeper/keeper.go | 20 +- x/staking/keeper/params.go | 6 +- x/staking/keeper/query_utils.go | 28 +- x/staking/keeper/val_state_change.go | 10 +- x/staking/keeper/validator.go | 56 ++- x/staking/types/expected_keepers.go | 2 +- x/staking/types/types.pb.go | 600 ++++++++++++++++++++++----- x/staking/types/types.proto | 19 +- 15 files changed, 1175 insertions(+), 198 deletions(-) diff --git a/codec/amino.go b/codec/amino.go index b2300aef6cc3..3393ba4da717 100644 --- a/codec/amino.go +++ b/codec/amino.go @@ -45,8 +45,8 @@ func RegisterEvidences(cdc *Codec) { // MarshalJSONIndent provides a utility for indented JSON encoding of an object // via an Amino codec. It returns an error if it cannot serialize or indent as // JSON. -func MarshalJSONIndent(cdc *Codec, obj interface{}) ([]byte, error) { - bz, err := cdc.MarshalJSON(obj) +func MarshalJSONIndent(m Marshaler, obj interface{}) ([]byte, error) { + bz, err := m.MarshalJSON(obj) if err != nil { return nil, err } @@ -60,8 +60,8 @@ func MarshalJSONIndent(cdc *Codec, obj interface{}) ([]byte, error) { } // MustMarshalJSONIndent executes MarshalJSONIndent except it panics upon failure. -func MustMarshalJSONIndent(cdc *Codec, obj interface{}) []byte { - bz, err := MarshalJSONIndent(cdc, obj) +func MustMarshalJSONIndent(m Marshaler, obj interface{}) []byte { + bz, err := MarshalJSONIndent(m, obj) if err != nil { panic(fmt.Sprintf("failed to marshal JSON: %s", err)) } diff --git a/types/decimal.go b/types/decimal.go index d6917182b66c..c1cfc25bcc08 100644 --- a/types/decimal.go +++ b/types/decimal.go @@ -750,6 +750,10 @@ func (d *Dec) Size() int { func (d Dec) MarshalAmino() ([]byte, error) { return d.Marshal() } func (d *Dec) UnmarshalAmino(bz []byte) error { return d.Unmarshal(bz) } +func (dp DecProto) String() string { + return dp.Dec.String() +} + //___________________________________________________________________________________ // helpers diff --git a/types/int.go b/types/int.go index 9cc99a013263..4326a3ee9931 100644 --- a/types/int.go +++ b/types/int.go @@ -417,3 +417,7 @@ func (i *Int) UnmarshalAmino(bz []byte) error { return i.Unmarshal(bz) } func IntEq(t *testing.T, exp, got Int) (*testing.T, bool, string, string, string) { return t, exp.Equal(got), "expected:\t%v\ngot:\t\t%v", exp.String(), got.String() } + +func (ip IntProto) String() string { + return ip.Int.String() +} diff --git a/types/types.pb.go b/types/types.pb.go index 4ea0bfeec523..4d2136c0a030 100644 --- a/types/types.pb.go +++ b/types/types.pb.go @@ -10,6 +10,8 @@ import ( io "io" math "math" math_bits "math/bits" + reflect "reflect" + strings "strings" ) // Reference imports to suppress errors if they are not otherwise used. @@ -119,15 +121,136 @@ func (m *DecCoin) GetDenom() string { return "" } +// IntProto defines a Protobuf wrapper around an Int object. +type IntProto struct { + Int Int `protobuf:"bytes,1,opt,name=int,proto3,customtype=Int" json:"int"` +} + +func (m *IntProto) Reset() { *m = IntProto{} } +func (*IntProto) ProtoMessage() {} +func (*IntProto) Descriptor() ([]byte, []int) { + return fileDescriptor_2c0f90c600ad7e2e, []int{2} +} +func (m *IntProto) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *IntProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_IntProto.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *IntProto) XXX_Merge(src proto.Message) { + xxx_messageInfo_IntProto.Merge(m, src) +} +func (m *IntProto) XXX_Size() int { + return m.Size() +} +func (m *IntProto) XXX_DiscardUnknown() { + xxx_messageInfo_IntProto.DiscardUnknown(m) +} + +var xxx_messageInfo_IntProto proto.InternalMessageInfo + +// DecProto defines a Protobuf wrapper around a Dec object. +type DecProto struct { + Dec Dec `protobuf:"bytes,1,opt,name=dec,proto3,customtype=Dec" json:"dec"` +} + +func (m *DecProto) Reset() { *m = DecProto{} } +func (*DecProto) ProtoMessage() {} +func (*DecProto) Descriptor() ([]byte, []int) { + return fileDescriptor_2c0f90c600ad7e2e, []int{3} +} +func (m *DecProto) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *DecProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_DecProto.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *DecProto) XXX_Merge(src proto.Message) { + xxx_messageInfo_DecProto.Merge(m, src) +} +func (m *DecProto) XXX_Size() int { + return m.Size() +} +func (m *DecProto) XXX_DiscardUnknown() { + xxx_messageInfo_DecProto.DiscardUnknown(m) +} + +var xxx_messageInfo_DecProto proto.InternalMessageInfo + +// ValAddresses defines a repeated set of validator addresses. +type ValAddresses struct { + Addresses []ValAddress `protobuf:"bytes,1,rep,name=addresses,proto3,casttype=ValAddress" json:"addresses,omitempty"` +} + +func (m *ValAddresses) Reset() { *m = ValAddresses{} } +func (*ValAddresses) ProtoMessage() {} +func (*ValAddresses) Descriptor() ([]byte, []int) { + return fileDescriptor_2c0f90c600ad7e2e, []int{4} +} +func (m *ValAddresses) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ValAddresses) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ValAddresses.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ValAddresses) XXX_Merge(src proto.Message) { + xxx_messageInfo_ValAddresses.Merge(m, src) +} +func (m *ValAddresses) XXX_Size() int { + return m.Size() +} +func (m *ValAddresses) XXX_DiscardUnknown() { + xxx_messageInfo_ValAddresses.DiscardUnknown(m) +} + +var xxx_messageInfo_ValAddresses proto.InternalMessageInfo + +func (m *ValAddresses) GetAddresses() []ValAddress { + if m != nil { + return m.Addresses + } + return nil +} + func init() { proto.RegisterType((*Coin)(nil), "cosmos_sdk.v1.Coin") proto.RegisterType((*DecCoin)(nil), "cosmos_sdk.v1.DecCoin") + proto.RegisterType((*IntProto)(nil), "cosmos_sdk.v1.IntProto") + proto.RegisterType((*DecProto)(nil), "cosmos_sdk.v1.DecProto") + proto.RegisterType((*ValAddresses)(nil), "cosmos_sdk.v1.ValAddresses") } func init() { proto.RegisterFile("types/types.proto", fileDescriptor_2c0f90c600ad7e2e) } var fileDescriptor_2c0f90c600ad7e2e = []byte{ - // 214 bytes of a gzipped FileDescriptorProto + // 298 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x2c, 0xa9, 0x2c, 0x48, 0x2d, 0xd6, 0x07, 0x93, 0x7a, 0x05, 0x45, 0xf9, 0x25, 0xf9, 0x42, 0xbc, 0xc9, 0xf9, 0xc5, 0xb9, 0xf9, 0xc5, 0xf1, 0xc5, 0x29, 0xd9, 0x7a, 0x65, 0x86, 0x52, 0x6a, 0x25, 0x19, 0x99, 0x45, 0x29, @@ -136,12 +259,17 @@ var fileDescriptor_2c0f90c600ad7e2e = []byte{ 0x5e, 0x7e, 0xae, 0x04, 0xa3, 0x02, 0xa3, 0x06, 0x67, 0x10, 0x84, 0x23, 0xa4, 0xcc, 0xc5, 0x96, 0x98, 0x9b, 0x5f, 0x9a, 0x57, 0x22, 0xc1, 0x04, 0x12, 0x76, 0xe2, 0x3e, 0x71, 0x4f, 0x9e, 0xe1, 0xd6, 0x3d, 0x79, 0x66, 0xcf, 0xbc, 0x92, 0x20, 0xa8, 0x94, 0x92, 0x0b, 0x17, 0xbb, 0x4b, 0x6a, - 0x32, 0x39, 0xa6, 0xb8, 0xa4, 0x26, 0xc3, 0x4c, 0x71, 0x72, 0xb9, 0xf1, 0x50, 0x8e, 0xa1, 0xe1, - 0x91, 0x1c, 0xc3, 0x89, 0x47, 0x72, 0x8c, 0x17, 0x1e, 0xc9, 0x31, 0x3e, 0x78, 0x24, 0xc7, 0x38, - 0xe1, 0xb1, 0x1c, 0xc3, 0x85, 0xc7, 0x72, 0x0c, 0x37, 0x1e, 0xcb, 0x31, 0x44, 0x29, 0xa5, 0x67, - 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0xea, 0x43, 0x3c, 0x0b, 0xa5, 0x74, 0x8b, 0x53, - 0xb2, 0x21, 0x61, 0x91, 0xc4, 0x06, 0xf6, 0x95, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0x8d, 0xc6, - 0x8c, 0x7d, 0x21, 0x01, 0x00, 0x00, + 0x32, 0x39, 0xa6, 0xb8, 0xa4, 0x26, 0xc3, 0x4d, 0xd1, 0xe4, 0xe2, 0xf0, 0xcc, 0x2b, 0x09, 0x00, + 0xfb, 0x45, 0x96, 0x8b, 0x39, 0x33, 0xaf, 0x04, 0x62, 0x08, 0xaa, 0x9d, 0x20, 0x71, 0x90, 0x52, + 0x97, 0xd4, 0x64, 0xb8, 0xd2, 0x94, 0xd4, 0x64, 0x74, 0xa5, 0x20, 0x83, 0x41, 0xe2, 0x4a, 0x4e, + 0x5c, 0x3c, 0x61, 0x89, 0x39, 0x8e, 0x29, 0x29, 0x45, 0xa9, 0xc5, 0xc5, 0xa9, 0xc5, 0x42, 0x3a, + 0x5c, 0x9c, 0x89, 0x30, 0x8e, 0x04, 0xa3, 0x02, 0xb3, 0x06, 0x8f, 0x13, 0xdf, 0xaf, 0x7b, 0xf2, + 0x5c, 0x08, 0x45, 0x41, 0x08, 0x05, 0x56, 0x2c, 0x0d, 0x77, 0x14, 0x18, 0x9d, 0x5c, 0x6e, 0x3c, + 0x94, 0x63, 0x68, 0x78, 0x24, 0xc7, 0x70, 0xe2, 0x91, 0x1c, 0xe3, 0x85, 0x47, 0x72, 0x8c, 0x0f, + 0x1e, 0xc9, 0x31, 0x4e, 0x78, 0x2c, 0xc7, 0x70, 0xe1, 0xb1, 0x1c, 0xc3, 0x8d, 0xc7, 0x72, 0x0c, + 0x51, 0x4a, 0xe9, 0x99, 0x25, 0x19, 0xa5, 0x49, 0x7a, 0xc9, 0xf9, 0xb9, 0xfa, 0x90, 0x68, 0x80, + 0x52, 0xba, 0xc5, 0x29, 0xd9, 0x90, 0x58, 0x4a, 0x62, 0x03, 0x87, 0xb7, 0x31, 0x20, 0x00, 0x00, + 0xff, 0xff, 0xd6, 0x08, 0x09, 0x0f, 0xbb, 0x01, 0x00, 0x00, } func (m *Coin) Marshal() (dAtA []byte, err error) { @@ -224,6 +352,104 @@ func (m *DecCoin) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *IntProto) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *IntProto) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *IntProto) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.Int.Size() + i -= size + if _, err := m.Int.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *DecProto) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *DecProto) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *DecProto) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.Dec.Size() + i -= size + if _, err := m.Dec.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *ValAddresses) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ValAddresses) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ValAddresses) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Addresses) > 0 { + for iNdEx := len(m.Addresses) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Addresses[iNdEx]) + copy(dAtA[i:], m.Addresses[iNdEx]) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Addresses[iNdEx]))) + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + func encodeVarintTypes(dAtA []byte, offset int, v uint64) int { offset -= sovTypes(v) base := offset @@ -265,12 +491,67 @@ func (m *DecCoin) Size() (n int) { return n } +func (m *IntProto) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Int.Size() + n += 1 + l + sovTypes(uint64(l)) + return n +} + +func (m *DecProto) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Dec.Size() + n += 1 + l + sovTypes(uint64(l)) + return n +} + +func (m *ValAddresses) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Addresses) > 0 { + for _, b := range m.Addresses { + l = len(b) + n += 1 + l + sovTypes(uint64(l)) + } + } + return n +} + func sovTypes(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } func sozTypes(x uint64) (n int) { return sovTypes(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } +func (this *ValAddresses) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&ValAddresses{`, + `Addresses:` + fmt.Sprintf("%v", this.Addresses) + `,`, + `}`, + }, "") + return s +} +func valueToStringTypes(v interface{}) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("*%v", pv) +} func (m *Coin) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -509,6 +790,265 @@ func (m *DecCoin) Unmarshal(dAtA []byte) error { } return nil } +func (m *IntProto) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: IntProto: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: IntProto: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Int", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Int.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DecProto) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DecProto: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DecProto: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Dec", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Dec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ValAddresses) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ValAddresses: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ValAddresses: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Addresses", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Addresses = append(m.Addresses, make([]byte, postIndex-iNdEx)) + copy(m.Addresses[len(m.Addresses)-1], dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipTypes(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/types/types.proto b/types/types.proto index 49da4e5c69f9..590d21ccd9be 100644 --- a/types/types.proto +++ b/types/types.proto @@ -13,7 +13,8 @@ option (gogoproto.stringer_all) = false; // signatures required by gogoproto. message Coin { string denom = 1; - string amount = 2 [ (gogoproto.customtype) = "Int", (gogoproto.nullable) = false ]; + string amount = 2 + [ (gogoproto.customtype) = "Int", (gogoproto.nullable) = false ]; } // DecCoin defines a token with a denomination and a decimal amount. @@ -22,5 +23,25 @@ message Coin { // signatures required by gogoproto. message DecCoin { string denom = 1; - string amount = 2 [ (gogoproto.customtype) = "Dec", (gogoproto.nullable) = false ]; + string amount = 2 + [ (gogoproto.customtype) = "Dec", (gogoproto.nullable) = false ]; } + +// IntProto defines a Protobuf wrapper around an Int object. +message IntProto { + string int = 1 + [ (gogoproto.customtype) = "Int", (gogoproto.nullable) = false ]; +} + +// DecProto defines a Protobuf wrapper around a Dec object. +message DecProto { + string dec = 1 + [ (gogoproto.customtype) = "Dec", (gogoproto.nullable) = false ]; +} + +// ValAddresses defines a repeated set of validator addresses. +message ValAddresses { + option (gogoproto.stringer) = true; + + repeated bytes addresses = 1 [ (gogoproto.casttype) = "ValAddress" ]; +} \ No newline at end of file diff --git a/x/staking/alias.go b/x/staking/alias.go index 51c7eecc7087..1b7c78772f73 100644 --- a/x/staking/alias.go +++ b/x/staking/alias.go @@ -123,6 +123,7 @@ var ( ErrNeitherShareMsgsGiven = types.ErrNeitherShareMsgsGiven ErrInvalidHistoricalInfo = types.ErrInvalidHistoricalInfo ErrNoHistoricalInfo = types.ErrNoHistoricalInfo + ErrEmptyValidatorPubKey = types.ErrEmptyValidatorPubKey NewGenesisState = types.NewGenesisState DefaultGenesisState = types.DefaultGenesisState NewMultiStakingHooks = types.NewMultiStakingHooks diff --git a/x/staking/keeper/delegation.go b/x/staking/keeper/delegation.go index 219beef71271..375fad90313b 100644 --- a/x/staking/keeper/delegation.go +++ b/x/staking/keeper/delegation.go @@ -218,14 +218,16 @@ func (k Keeper) GetUBDQueueTimeSlice(ctx sdk.Context, timestamp time.Time) (dvPa if bz == nil { return []types.DVPair{} } - k.cdc.MustUnmarshalBinaryLengthPrefixed(bz, &dvPairs) - return dvPairs + + pairs := types.DVPairs{} + k.cdc.MustUnmarshalBinaryLengthPrefixed(bz, &pairs) + return pairs.Pairs } // Sets a specific unbonding queue timeslice. func (k Keeper) SetUBDQueueTimeSlice(ctx sdk.Context, timestamp time.Time, keys []types.DVPair) { store := ctx.KVStore(k.storeKey) - bz := k.cdc.MustMarshalBinaryLengthPrefixed(keys) + bz := k.cdc.MustMarshalBinaryLengthPrefixed(&types.DVPairs{Pairs: keys}) store.Set(types.GetUnbondingDelegationTimeKey(timestamp), bz) } @@ -252,19 +254,20 @@ func (k Keeper) UBDQueueIterator(ctx sdk.Context, endTime time.Time) sdk.Iterato // Returns a concatenated list of all the timeslices inclusively previous to // currTime, and deletes the timeslices from the queue -func (k Keeper) DequeueAllMatureUBDQueue(ctx sdk.Context, - currTime time.Time) (matureUnbonds []types.DVPair) { - +func (k Keeper) DequeueAllMatureUBDQueue(ctx sdk.Context, currTime time.Time) (matureUnbonds []types.DVPair) { store := ctx.KVStore(k.storeKey) + // gets an iterator for all timeslices from time 0 until the current Blockheader time unbondingTimesliceIterator := k.UBDQueueIterator(ctx, ctx.BlockHeader().Time) for ; unbondingTimesliceIterator.Valid(); unbondingTimesliceIterator.Next() { - timeslice := []types.DVPair{} + timeslice := types.DVPairs{} value := unbondingTimesliceIterator.Value() k.cdc.MustUnmarshalBinaryLengthPrefixed(value, ×lice) - matureUnbonds = append(matureUnbonds, timeslice...) + + matureUnbonds = append(matureUnbonds, timeslice.Pairs...) store.Delete(unbondingTimesliceIterator.Key()) } + return matureUnbonds } @@ -404,14 +407,16 @@ func (k Keeper) GetRedelegationQueueTimeSlice(ctx sdk.Context, timestamp time.Ti if bz == nil { return []types.DVVTriplet{} } - k.cdc.MustUnmarshalBinaryLengthPrefixed(bz, &dvvTriplets) - return dvvTriplets + + triplets := types.DVVTriplets{} + k.cdc.MustUnmarshalBinaryLengthPrefixed(bz, &triplets) + return triplets.Triplets } // Sets a specific redelegation queue timeslice. func (k Keeper) SetRedelegationQueueTimeSlice(ctx sdk.Context, timestamp time.Time, keys []types.DVVTriplet) { store := ctx.KVStore(k.storeKey) - bz := k.cdc.MustMarshalBinaryLengthPrefixed(keys) + bz := k.cdc.MustMarshalBinaryLengthPrefixed(&types.DVVTriplets{Triplets: keys}) store.Set(types.GetRedelegationTimeKey(timestamp), bz) } @@ -443,15 +448,18 @@ func (k Keeper) RedelegationQueueIterator(ctx sdk.Context, endTime time.Time) sd // currTime, and deletes the timeslices from the queue func (k Keeper) DequeueAllMatureRedelegationQueue(ctx sdk.Context, currTime time.Time) (matureRedelegations []types.DVVTriplet) { store := ctx.KVStore(k.storeKey) + // gets an iterator for all timeslices from time 0 until the current Blockheader time redelegationTimesliceIterator := k.RedelegationQueueIterator(ctx, ctx.BlockHeader().Time) for ; redelegationTimesliceIterator.Valid(); redelegationTimesliceIterator.Next() { - timeslice := []types.DVVTriplet{} + timeslice := types.DVVTriplets{} value := redelegationTimesliceIterator.Value() k.cdc.MustUnmarshalBinaryLengthPrefixed(value, ×lice) - matureRedelegations = append(matureRedelegations, timeslice...) + + matureRedelegations = append(matureRedelegations, timeslice.Triplets...) store.Delete(redelegationTimesliceIterator.Key()) } + return matureRedelegations } @@ -618,7 +626,7 @@ func (k Keeper) getBeginInfo( return completionTime, height, true case validator.IsUnbonding(): - return validator.UnbondingCompletionTime, validator.UnbondingHeight, false + return validator.UnbondingTime, validator.UnbondingHeight, false default: panic(fmt.Sprintf("unknown validator status: %s", validator.Status)) diff --git a/x/staking/keeper/keeper.go b/x/staking/keeper/keeper.go index 412f6a3a8464..ef7aab43557f 100644 --- a/x/staking/keeper/keeper.go +++ b/x/staking/keeper/keeper.go @@ -23,7 +23,7 @@ var _ types.DelegationSet = Keeper{} // keeper of the staking store type Keeper struct { storeKey sdk.StoreKey - cdc *codec.Codec + cdc codec.Marshaler bankKeeper types.BankKeeper supplyKeeper types.SupplyKeeper hooks types.StakingHooks @@ -34,7 +34,7 @@ type Keeper struct { // NewKeeper creates a new staking Keeper instance func NewKeeper( - cdc *codec.Codec, key sdk.StoreKey, bk types.BankKeeper, sk types.SupplyKeeper, ps params.Subspace, + cdc codec.Marshaler, key sdk.StoreKey, bk types.BankKeeper, sk types.SupplyKeeper, ps params.Subspace, ) Keeper { // ensure bonded and not bonded module accounts are set @@ -73,19 +73,21 @@ func (k *Keeper) SetHooks(sh types.StakingHooks) *Keeper { } // Load the last total validator power. -func (k Keeper) GetLastTotalPower(ctx sdk.Context) (power sdk.Int) { +func (k Keeper) GetLastTotalPower(ctx sdk.Context) sdk.Int { store := ctx.KVStore(k.storeKey) - b := store.Get(types.LastTotalPowerKey) - if b == nil { + bz := store.Get(types.LastTotalPowerKey) + if bz == nil { return sdk.ZeroInt() } - k.cdc.MustUnmarshalBinaryLengthPrefixed(b, &power) - return + + ip := sdk.IntProto{} + k.cdc.MustUnmarshalBinaryLengthPrefixed(bz, &ip) + return ip.Int } // Set the last total validator power. func (k Keeper) SetLastTotalPower(ctx sdk.Context, power sdk.Int) { store := ctx.KVStore(k.storeKey) - b := k.cdc.MustMarshalBinaryLengthPrefixed(power) - store.Set(types.LastTotalPowerKey, b) + bz := k.cdc.MustMarshalBinaryLengthPrefixed(&sdk.IntProto{Int: power}) + store.Set(types.LastTotalPowerKey, bz) } diff --git a/x/staking/keeper/params.go b/x/staking/keeper/params.go index 11f4b57bc55b..e50e6ccd6455 100644 --- a/x/staking/keeper/params.go +++ b/x/staking/keeper/params.go @@ -25,21 +25,21 @@ func (k Keeper) UnbondingTime(ctx sdk.Context) (res time.Duration) { } // MaxValidators - Maximum number of validators -func (k Keeper) MaxValidators(ctx sdk.Context) (res uint16) { +func (k Keeper) MaxValidators(ctx sdk.Context) (res uint32) { k.paramstore.Get(ctx, types.KeyMaxValidators, &res) return } // MaxEntries - Maximum number of simultaneous unbonding // delegations or redelegations (per pair/trio) -func (k Keeper) MaxEntries(ctx sdk.Context) (res uint16) { +func (k Keeper) MaxEntries(ctx sdk.Context) (res uint32) { k.paramstore.Get(ctx, types.KeyMaxEntries, &res) return } // HistoricalEntries = number of historical info entries // to persist in store -func (k Keeper) HistoricalEntries(ctx sdk.Context) (res uint16) { +func (k Keeper) HistoricalEntries(ctx sdk.Context) (res uint32) { k.paramstore.Get(ctx, types.KeyHistoricalEntries, &res) return } diff --git a/x/staking/keeper/query_utils.go b/x/staking/keeper/query_utils.go index 336bb842ab9e..ae7cf634600a 100644 --- a/x/staking/keeper/query_utils.go +++ b/x/staking/keeper/query_utils.go @@ -6,9 +6,11 @@ import ( ) // Return all validators that a delegator is bonded to. If maxRetrieve is supplied, the respective amount will be returned. -func (k Keeper) GetDelegatorValidators(ctx sdk.Context, delegatorAddr sdk.AccAddress, - maxRetrieve uint16) (validators []types.Validator) { - validators = make([]types.Validator, maxRetrieve) +func (k Keeper) GetDelegatorValidators( + ctx sdk.Context, delegatorAddr sdk.AccAddress, maxRetrieve uint32, +) []types.Validator { + + validators := make([]types.Validator, maxRetrieve) store := ctx.KVStore(k.storeKey) delegatorPrefixKey := types.GetDelegationsKey(delegatorAddr) @@ -23,15 +25,18 @@ func (k Keeper) GetDelegatorValidators(ctx sdk.Context, delegatorAddr sdk.AccAdd if !found { panic(types.ErrNoValidatorFound) } + validators[i] = validator i++ } + return validators[:i] // trim } // return a validator that a delegator is bonded to -func (k Keeper) GetDelegatorValidator(ctx sdk.Context, delegatorAddr sdk.AccAddress, - validatorAddr sdk.ValAddress) (validator types.Validator, err error) { +func (k Keeper) GetDelegatorValidator( + ctx sdk.Context, delegatorAddr sdk.AccAddress, validatorAddr sdk.ValAddress, +) (validator types.Validator, err error) { delegation, found := k.GetDelegation(ctx, delegatorAddr, validatorAddr) if !found { @@ -42,7 +47,8 @@ func (k Keeper) GetDelegatorValidator(ctx sdk.Context, delegatorAddr sdk.AccAddr if !found { panic(types.ErrNoValidatorFound) } - return + + return validator, nil } //_____________________________________________________________________________________ @@ -85,9 +91,9 @@ func (k Keeper) GetAllUnbondingDelegations(ctx sdk.Context, delegator sdk.AccAdd } // return all redelegations for a delegator -func (k Keeper) GetAllRedelegations(ctx sdk.Context, delegator sdk.AccAddress, - srcValAddress, dstValAddress sdk.ValAddress) ( - redelegations []types.Redelegation) { +func (k Keeper) GetAllRedelegations( + ctx sdk.Context, delegator sdk.AccAddress, srcValAddress, dstValAddress sdk.ValAddress, +) ([]types.Redelegation) { store := ctx.KVStore(k.storeKey) delegatorPrefixKey := types.GetREDsKey(delegator) @@ -97,6 +103,8 @@ func (k Keeper) GetAllRedelegations(ctx sdk.Context, delegator sdk.AccAddress, srcValFilter := !(srcValAddress.Empty()) dstValFilter := !(dstValAddress.Empty()) + redelegations := []types.Redelegation{} + for ; iterator.Valid(); iterator.Next() { redelegation := types.MustUnmarshalRED(k.cdc, iterator.Value()) if srcValFilter && !(srcValAddress.Equals(redelegation.ValidatorSrcAddress)) { @@ -105,7 +113,9 @@ func (k Keeper) GetAllRedelegations(ctx sdk.Context, delegator sdk.AccAddress, if dstValFilter && !(dstValAddress.Equals(redelegation.ValidatorDstAddress)) { continue } + redelegations = append(redelegations, redelegation) } + return redelegations } diff --git a/x/staking/keeper/val_state_change.go b/x/staking/keeper/val_state_change.go index 101bc139215a..c132100b8434 100644 --- a/x/staking/keeper/val_state_change.go +++ b/x/staking/keeper/val_state_change.go @@ -137,7 +137,7 @@ func (k Keeper) ApplyAndReturnValidatorSetUpdates(ctx sdk.Context) (updates []ab oldPowerBytes, found := last[valAddrBytes] newPower := validator.ConsensusPower() - newPowerBytes := k.cdc.MustMarshalBinaryLengthPrefixed(newPower) + newPowerBytes := k.cdc.MustMarshalBinaryLengthPrefixed(&sdk.IntProto{Int: sdk.NewInt(newPower)}) // update the validator set if power has changed if !found || !bytes.Equal(oldPowerBytes, newPowerBytes) { @@ -240,7 +240,6 @@ func (k Keeper) unjailValidator(ctx sdk.Context, validator types.Validator) { // perform all the store operations for when a validator status becomes bonded func (k Keeper) bondValidator(ctx sdk.Context, validator types.Validator) types.Validator { - // delete the validator by power index, as the key will change k.DeleteValidatorByPowerIndex(ctx, validator) @@ -254,14 +253,13 @@ func (k Keeper) bondValidator(ctx sdk.Context, validator types.Validator) types. k.DeleteValidatorQueue(ctx, validator) // trigger hook - k.AfterValidatorBonded(ctx, validator.ConsAddress(), validator.OperatorAddress) + k.AfterValidatorBonded(ctx, validator.GetConsAddr(), validator.OperatorAddress) return validator } // perform all the store operations for when a validator begins unbonding func (k Keeper) beginUnbondingValidator(ctx sdk.Context, validator types.Validator) types.Validator { - params := k.GetParams(ctx) // delete the validator by power index, as the key will change @@ -275,7 +273,7 @@ func (k Keeper) beginUnbondingValidator(ctx sdk.Context, validator types.Validat validator = validator.UpdateStatus(sdk.Unbonding) // set the unbonding completion time and completion height appropriately - validator.UnbondingCompletionTime = ctx.BlockHeader().Time.Add(params.UnbondingTime) + validator.UnbondingTime = ctx.BlockHeader().Time.Add(params.UnbondingTime) validator.UnbondingHeight = ctx.BlockHeader().Height // save the now unbonded validator record and power index @@ -286,7 +284,7 @@ func (k Keeper) beginUnbondingValidator(ctx sdk.Context, validator types.Validat k.InsertValidatorQueue(ctx, validator) // trigger hook - k.AfterValidatorBeginUnbonding(ctx, validator.ConsAddress(), validator.OperatorAddress) + k.AfterValidatorBeginUnbonding(ctx, validator.GetConsAddr(), validator.OperatorAddress) return validator } diff --git a/x/staking/keeper/validator.go b/x/staking/keeper/validator.go index 48ecbb384313..71c78631b391 100644 --- a/x/staking/keeper/validator.go +++ b/x/staking/keeper/validator.go @@ -94,8 +94,7 @@ func (k Keeper) SetValidator(ctx sdk.Context, validator types.Validator) { // validator index func (k Keeper) SetValidatorByConsAddr(ctx sdk.Context, validator types.Validator) { store := ctx.KVStore(k.storeKey) - consAddr := sdk.ConsAddress(validator.ConsPubKey.Address()) - store.Set(types.GetValidatorByConsAddrKey(consAddr), validator.OperatorAddress) + store.Set(types.GetValidatorByConsAddrKey(validator.GetConsAddr()), validator.OperatorAddress) } // validator index @@ -191,14 +190,16 @@ func (k Keeper) RemoveValidator(ctx sdk.Context, address sdk.ValAddress) { panic("validator being removed should never have positive tokens") } + valConsAddr := validator.GetConsAddr() + // delete the old validator record store := ctx.KVStore(k.storeKey) store.Delete(types.GetValidatorKey(address)) - store.Delete(types.GetValidatorByConsAddrKey(sdk.ConsAddress(validator.ConsPubKey.Address()))) + store.Delete(types.GetValidatorByConsAddrKey(valConsAddr)) store.Delete(types.GetValidatorsByPowerIndexKey(validator)) // call hooks - k.AfterValidatorRemoved(ctx, validator.ConsAddress(), validator.OperatorAddress) + k.AfterValidatorRemoved(ctx, valConsAddr, validator.OperatorAddress) } // get groups of validators @@ -213,6 +214,7 @@ func (k Keeper) GetAllValidators(ctx sdk.Context) (validators []types.Validator) validator := types.MustUnmarshalValidator(k.cdc, iterator.Value()) validators = append(validators, validator) } + return validators } @@ -271,14 +273,16 @@ func (k Keeper) GetLastValidatorPower(ctx sdk.Context, operator sdk.ValAddress) if bz == nil { return 0 } - k.cdc.MustUnmarshalBinaryLengthPrefixed(bz, &power) - return + + ip := sdk.IntProto{} + k.cdc.MustUnmarshalBinaryLengthPrefixed(bz, &ip) + return ip.Int.Int64() } // Set the last validator power. func (k Keeper) SetLastValidatorPower(ctx sdk.Context, operator sdk.ValAddress, power int64) { store := ctx.KVStore(k.storeKey) - bz := k.cdc.MustMarshalBinaryLengthPrefixed(power) + bz := k.cdc.MustMarshalBinaryLengthPrefixed(&sdk.IntProto{Int: sdk.NewInt(power)}) store.Set(types.GetLastValidatorPowerKey(operator), bz) } @@ -302,9 +306,10 @@ func (k Keeper) IterateLastValidatorPowers(ctx sdk.Context, handler func(operato defer iter.Close() for ; iter.Valid(); iter.Next() { addr := sdk.ValAddress(iter.Key()[len(types.LastValidatorPowerKey):]) - var power int64 - k.cdc.MustUnmarshalBinaryLengthPrefixed(iter.Value(), &power) - if handler(addr, power) { + ip := sdk.IntProto{} + + k.cdc.MustUnmarshalBinaryLengthPrefixed(iter.Value(), &ip) + if handler(addr, ip.Int.Int64()) { break } } @@ -342,20 +347,22 @@ func (k Keeper) GetLastValidators(ctx sdk.Context) (validators []types.Validator // gets a specific validator queue timeslice. A timeslice is a slice of ValAddresses corresponding to unbonding validators // that expire at a certain time. -func (k Keeper) GetValidatorQueueTimeSlice(ctx sdk.Context, timestamp time.Time) (valAddrs []sdk.ValAddress) { +func (k Keeper) GetValidatorQueueTimeSlice(ctx sdk.Context, timestamp time.Time) []sdk.ValAddress { store := ctx.KVStore(k.storeKey) bz := store.Get(types.GetValidatorQueueTimeKey(timestamp)) if bz == nil { return []sdk.ValAddress{} } - k.cdc.MustUnmarshalBinaryLengthPrefixed(bz, &valAddrs) - return valAddrs + + va := sdk.ValAddresses{} + k.cdc.MustUnmarshalBinaryLengthPrefixed(bz, &va) + return va.Addresses } // Sets a specific validator queue timeslice. func (k Keeper) SetValidatorQueueTimeSlice(ctx sdk.Context, timestamp time.Time, keys []sdk.ValAddress) { store := ctx.KVStore(k.storeKey) - bz := k.cdc.MustMarshalBinaryLengthPrefixed(keys) + bz := k.cdc.MustMarshalBinaryLengthPrefixed(&sdk.ValAddresses{Addresses: keys}) store.Set(types.GetValidatorQueueTimeKey(timestamp), bz) } @@ -367,24 +374,25 @@ func (k Keeper) DeleteValidatorQueueTimeSlice(ctx sdk.Context, timestamp time.Ti // Insert an validator address to the appropriate timeslice in the validator queue func (k Keeper) InsertValidatorQueue(ctx sdk.Context, val types.Validator) { - timeSlice := k.GetValidatorQueueTimeSlice(ctx, val.UnbondingCompletionTime) + timeSlice := k.GetValidatorQueueTimeSlice(ctx, val.UnbondingTime) timeSlice = append(timeSlice, val.OperatorAddress) - k.SetValidatorQueueTimeSlice(ctx, val.UnbondingCompletionTime, timeSlice) + k.SetValidatorQueueTimeSlice(ctx, val.UnbondingTime, timeSlice) } // Delete a validator address from the validator queue func (k Keeper) DeleteValidatorQueue(ctx sdk.Context, val types.Validator) { - timeSlice := k.GetValidatorQueueTimeSlice(ctx, val.UnbondingCompletionTime) + timeSlice := k.GetValidatorQueueTimeSlice(ctx, val.UnbondingTime) newTimeSlice := []sdk.ValAddress{} for _, addr := range timeSlice { if !bytes.Equal(addr, val.OperatorAddress) { newTimeSlice = append(newTimeSlice, addr) } } + if len(newTimeSlice) == 0 { - k.DeleteValidatorQueueTimeSlice(ctx, val.UnbondingCompletionTime) + k.DeleteValidatorQueueTimeSlice(ctx, val.UnbondingTime) } else { - k.SetValidatorQueueTimeSlice(ctx, val.UnbondingCompletionTime, newTimeSlice) + k.SetValidatorQueueTimeSlice(ctx, val.UnbondingTime, newTimeSlice) } } @@ -401,9 +409,10 @@ func (k Keeper) GetAllMatureValidatorQueue(ctx sdk.Context, currTime time.Time) defer validatorTimesliceIterator.Close() for ; validatorTimesliceIterator.Valid(); validatorTimesliceIterator.Next() { - timeslice := []sdk.ValAddress{} + timeslice := sdk.ValAddresses{} k.cdc.MustUnmarshalBinaryLengthPrefixed(validatorTimesliceIterator.Value(), ×lice) - matureValsAddrs = append(matureValsAddrs, timeslice...) + + matureValsAddrs = append(matureValsAddrs, timeslice.Addresses...) } return matureValsAddrs @@ -416,10 +425,10 @@ func (k Keeper) UnbondAllMatureValidatorQueue(ctx sdk.Context) { defer validatorTimesliceIterator.Close() for ; validatorTimesliceIterator.Valid(); validatorTimesliceIterator.Next() { - timeslice := []sdk.ValAddress{} + timeslice := sdk.ValAddresses{} k.cdc.MustUnmarshalBinaryLengthPrefixed(validatorTimesliceIterator.Value(), ×lice) - for _, valAddr := range timeslice { + for _, valAddr := range timeslice.Addresses { val, found := k.GetValidator(ctx, valAddr) if !found { panic("validator in the unbonding queue was not found") @@ -428,6 +437,7 @@ func (k Keeper) UnbondAllMatureValidatorQueue(ctx sdk.Context) { if !val.IsUnbonding() { panic("unexpected validator in unbonding queue; status was not unbonding") } + val = k.unbondingToUnbonded(ctx, val) if val.GetDelegatorShares().IsZero() { k.RemoveValidator(ctx, val.OperatorAddress) diff --git a/x/staking/types/expected_keepers.go b/x/staking/types/expected_keepers.go index c9e69b9018bb..331840468142 100644 --- a/x/staking/types/expected_keepers.go +++ b/x/staking/types/expected_keepers.go @@ -74,7 +74,7 @@ type ValidatorSet interface { Delegation(sdk.Context, sdk.AccAddress, sdk.ValAddress) stakingexported.DelegationI // MaxValidators returns the maximum amount of bonded validators - MaxValidators(sdk.Context) uint16 + MaxValidators(sdk.Context) uint32 } // DelegationSet expected properties for the set of all delegations for a particular (noalias) diff --git a/x/staking/types/types.pb.go b/x/staking/types/types.pb.go index d84de519e7e2..78da36fae466 100644 --- a/x/staking/types/types.pb.go +++ b/x/staking/types/types.pb.go @@ -591,9 +591,9 @@ func (m *Description) GetDetails() string { // coins. Slashing results in a decrease in the exchange rate, allowing correct // calculation of future undelegations without iterating over delegators. // When coins are delegated to this validator, the validator is credited with a -// delegation whose number of bond shares is based on the amount of coins delegated -// divided by the current exchange rate. Voting power can be calculated as total -// bonded shares multiplied by exchange rate. +// delegation whose number of bond shares is based on the amount of coins +// delegated divided by the current exchange rate. Voting power can be +// calculated as total bonded shares multiplied by exchange rate. type Validator struct { OperatorAddress github_com_cosmos_cosmos_sdk_types.ValAddress `protobuf:"bytes,1,opt,name=operator_address,json=operatorAddress,proto3,casttype=github.com/cosmos/cosmos-sdk/types.ValAddress" json:"operator_address,omitempty" yaml:"operator_address"` ConsensusPubkey string `protobuf:"bytes,2,opt,name=consensus_pubkey,json=consensusPubkey,proto3" json:"consensus_pubkey,omitempty" yaml:"consensus_pubkey"` @@ -694,6 +694,51 @@ func (m *DVPair) GetValidatorAddress() github_com_cosmos_cosmos_sdk_types.ValAdd return nil } +// DVPairs defines an array of DVPair objects. +type DVPairs struct { + Pairs []DVPair `protobuf:"bytes,1,rep,name=pairs,proto3" json:"pairs"` +} + +func (m *DVPairs) Reset() { *m = DVPairs{} } +func (m *DVPairs) String() string { return proto.CompactTextString(m) } +func (*DVPairs) ProtoMessage() {} +func (*DVPairs) Descriptor() ([]byte, []int) { + return fileDescriptor_c669c0a3ee1b124c, []int{11} +} +func (m *DVPairs) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *DVPairs) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_DVPairs.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *DVPairs) XXX_Merge(src proto.Message) { + xxx_messageInfo_DVPairs.Merge(m, src) +} +func (m *DVPairs) XXX_Size() int { + return m.Size() +} +func (m *DVPairs) XXX_DiscardUnknown() { + xxx_messageInfo_DVPairs.DiscardUnknown(m) +} + +var xxx_messageInfo_DVPairs proto.InternalMessageInfo + +func (m *DVPairs) GetPairs() []DVPair { + if m != nil { + return m.Pairs + } + return nil +} + // DVVTriplet is struct that just has a delegator-validator-validator triplet // with no other data. It is intended to be used as a marshalable pointer. For // example, a DVVTriplet can be used to construct the key to getting a @@ -707,7 +752,7 @@ type DVVTriplet struct { func (m *DVVTriplet) Reset() { *m = DVVTriplet{} } func (*DVVTriplet) ProtoMessage() {} func (*DVVTriplet) Descriptor() ([]byte, []int) { - return fileDescriptor_c669c0a3ee1b124c, []int{11} + return fileDescriptor_c669c0a3ee1b124c, []int{12} } func (m *DVVTriplet) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -757,6 +802,51 @@ func (m *DVVTriplet) GetValidatorDstAddress() github_com_cosmos_cosmos_sdk_types return nil } +// DVVTriplets defines an array of DVVTriplet objects. +type DVVTriplets struct { + Triplets []DVVTriplet `protobuf:"bytes,1,rep,name=triplets,proto3" json:"triplets"` +} + +func (m *DVVTriplets) Reset() { *m = DVVTriplets{} } +func (m *DVVTriplets) String() string { return proto.CompactTextString(m) } +func (*DVVTriplets) ProtoMessage() {} +func (*DVVTriplets) Descriptor() ([]byte, []int) { + return fileDescriptor_c669c0a3ee1b124c, []int{13} +} +func (m *DVVTriplets) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *DVVTriplets) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_DVVTriplets.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *DVVTriplets) XXX_Merge(src proto.Message) { + xxx_messageInfo_DVVTriplets.Merge(m, src) +} +func (m *DVVTriplets) XXX_Size() int { + return m.Size() +} +func (m *DVVTriplets) XXX_DiscardUnknown() { + xxx_messageInfo_DVVTriplets.DiscardUnknown(m) +} + +var xxx_messageInfo_DVVTriplets proto.InternalMessageInfo + +func (m *DVVTriplets) GetTriplets() []DVVTriplet { + if m != nil { + return m.Triplets + } + return nil +} + // Delegation represents the bond with tokens held by an account. It is // owned by one delegator, and is associated with the voting power of one // validator. @@ -769,7 +859,7 @@ type Delegation struct { func (m *Delegation) Reset() { *m = Delegation{} } func (*Delegation) ProtoMessage() {} func (*Delegation) Descriptor() ([]byte, []int) { - return fileDescriptor_c669c0a3ee1b124c, []int{12} + return fileDescriptor_c669c0a3ee1b124c, []int{14} } func (m *Delegation) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -823,7 +913,7 @@ type UnbondingDelegation struct { func (m *UnbondingDelegation) Reset() { *m = UnbondingDelegation{} } func (*UnbondingDelegation) ProtoMessage() {} func (*UnbondingDelegation) Descriptor() ([]byte, []int) { - return fileDescriptor_c669c0a3ee1b124c, []int{13} + return fileDescriptor_c669c0a3ee1b124c, []int{15} } func (m *UnbondingDelegation) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -884,7 +974,7 @@ type UnbondingDelegationEntry struct { func (m *UnbondingDelegationEntry) Reset() { *m = UnbondingDelegationEntry{} } func (*UnbondingDelegationEntry) ProtoMessage() {} func (*UnbondingDelegationEntry) Descriptor() ([]byte, []int) { - return fileDescriptor_c669c0a3ee1b124c, []int{14} + return fileDescriptor_c669c0a3ee1b124c, []int{16} } func (m *UnbondingDelegationEntry) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -938,7 +1028,7 @@ type RedelegationEntry struct { func (m *RedelegationEntry) Reset() { *m = RedelegationEntry{} } func (*RedelegationEntry) ProtoMessage() {} func (*RedelegationEntry) Descriptor() ([]byte, []int) { - return fileDescriptor_c669c0a3ee1b124c, []int{15} + return fileDescriptor_c669c0a3ee1b124c, []int{17} } func (m *RedelegationEntry) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -993,7 +1083,7 @@ type Redelegation struct { func (m *Redelegation) Reset() { *m = Redelegation{} } func (*Redelegation) ProtoMessage() {} func (*Redelegation) Descriptor() ([]byte, []int) { - return fileDescriptor_c669c0a3ee1b124c, []int{16} + return fileDescriptor_c669c0a3ee1b124c, []int{18} } func (m *Redelegation) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1062,7 +1152,7 @@ type Params struct { func (m *Params) Reset() { *m = Params{} } func (*Params) ProtoMessage() {} func (*Params) Descriptor() ([]byte, []int) { - return fileDescriptor_c669c0a3ee1b124c, []int{17} + return fileDescriptor_c669c0a3ee1b124c, []int{19} } func (m *Params) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1138,7 +1228,9 @@ func init() { proto.RegisterType((*Description)(nil), "cosmos_sdk.x.staking.v1.Description") proto.RegisterType((*Validator)(nil), "cosmos_sdk.x.staking.v1.Validator") proto.RegisterType((*DVPair)(nil), "cosmos_sdk.x.staking.v1.DVPair") + proto.RegisterType((*DVPairs)(nil), "cosmos_sdk.x.staking.v1.DVPairs") proto.RegisterType((*DVVTriplet)(nil), "cosmos_sdk.x.staking.v1.DVVTriplet") + proto.RegisterType((*DVVTriplets)(nil), "cosmos_sdk.x.staking.v1.DVVTriplets") proto.RegisterType((*Delegation)(nil), "cosmos_sdk.x.staking.v1.Delegation") proto.RegisterType((*UnbondingDelegation)(nil), "cosmos_sdk.x.staking.v1.UnbondingDelegation") proto.RegisterType((*UnbondingDelegationEntry)(nil), "cosmos_sdk.x.staking.v1.UnbondingDelegationEntry") @@ -1150,110 +1242,112 @@ func init() { func init() { proto.RegisterFile("x/staking/types/types.proto", fileDescriptor_c669c0a3ee1b124c) } var fileDescriptor_c669c0a3ee1b124c = []byte{ - // 1633 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x59, 0xcd, 0x6f, 0xdb, 0x46, - 0x16, 0x37, 0x25, 0x45, 0xb6, 0x9f, 0x62, 0xc9, 0xa6, 0x11, 0x47, 0x71, 0x36, 0xa2, 0x97, 0xbb, - 0x08, 0x8c, 0xc5, 0x46, 0x82, 0x93, 0x05, 0x16, 0xf0, 0x5e, 0x12, 0x59, 0x31, 0xec, 0x85, 0xbd, - 0x48, 0xe8, 0xc4, 0x87, 0xfd, 0x80, 0x30, 0x22, 0xc7, 0xd4, 0xac, 0x45, 0x52, 0xcb, 0x19, 0x39, - 0xf2, 0x62, 0xaf, 0x0b, 0x14, 0x05, 0x8a, 0xe6, 0x52, 0x20, 0xc7, 0xa0, 0xff, 0x40, 0xaf, 0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0x5c, 0x47, 0x7a, 0xf4, 0x3a, 0x62, 0x6a, 0x2f, 0xb4, 0x8e, 0x1a, 0x65, 0x83, 0x59, - 0xcd, 0x8c, 0x9b, 0xd5, 0x8f, 0x52, 0x30, 0xb3, 0x4d, 0xcd, 0xbb, 0xb6, 0x71, 0x5a, 0x12, 0xc7, - 0x2e, 0x89, 0xf7, 0x24, 0xc8, 0x6f, 0x10, 0xca, 0x1c, 0x97, 0xe8, 0xa8, 0xb5, 0x69, 0xef, 0x39, - 0xf2, 0x5f, 0x20, 0xdb, 0xc4, 0xc8, 0xc0, 0xae, 0x18, 0x02, 0x97, 0xca, 0x11, 0x35, 0x2a, 0x7b, - 0xd4, 0xa8, 0xcc, 0x97, 0xb2, 0xe1, 0x2b, 0x05, 0x78, 0xdc, 0x44, 0xbe, 0x0e, 0xd9, 0x03, 0xd4, - 0xa2, 0x98, 0x15, 0x53, 0x4b, 0xe9, 0xe5, 0xdc, 0x55, 0x75, 0xe4, 0x04, 0x09, 0x47, 0x4f, 0x80, - 0xc0, 0xed, 0x56, 0x33, 0xdf, 0x3e, 0x54, 0x24, 0xf5, 0x83, 0x14, 0x14, 0x12, 0x44, 0x44, 0xae, - 0x42, 0xc6, 0xef, 0xeb, 0x92, 0xdf, 0x64, 0xcb, 0xc7, 0xe0, 0x19, 0x35, 0xac, 0x6b, 0xbe, 0xad, - 0xfc, 0x4f, 0x98, 0xb2, 0x50, 0x97, 0xcf, 0x87, 0x94, 0x8f, 0x73, 0xe3, 0x78, 0x38, 0xfd, 0x9e, - 0x52, 0x10, 0x0d, 0x5b, 0xe0, 0xa8, 0xda, 0xa4, 0x85, 0xba, 0xfe, 0x54, 0x68, 0x43, 0xc1, 0x93, - 0xea, 0x4d, 0x64, 0x9b, 0x38, 0x3e, 0x84, 0x36, 0x8e, 0xed, 0x64, 0x21, 0x72, 0x12, 0x83, 0x53, - 0xb5, 0x19, 0x0b, 0x75, 0xd7, 0x7c, 0x81, 0xe7, 0x71, 0x75, 0xea, 0xc1, 0x43, 0x65, 0xc2, 0x8f, - 0xd8, 0x67, 0x12, 0x40, 0x14, 0x31, 0xf9, 0x5f, 0x30, 0x9b, 0x18, 0x62, 0x54, 0xe4, 0x73, 0x7c, - 0xe6, 0x37, 0xe5, 0xad, 0xfa, 0x71, 0x4f, 0x91, 0xb4, 0x82, 0x9e, 0xc8, 0xc5, 0x3f, 0x20, 0xd7, - 0x69, 0x1b, 0x88, 0xe1, 0xba, 0x47, 0x82, 0x05, 0xa7, 0x5c, 0x2c, 0x73, 0x02, 0x5c, 0x0e, 0x08, - 0x70, 0xf9, 0x4e, 0xc0, 0x90, 0xab, 0x25, 0x0f, 0xab, 0xdf, 0x53, 0x64, 0xbe, 0xaf, 0x98, 0xb1, - 0x7a, 0xff, 0x6b, 0x45, 0xd2, 0x80, 0x4b, 0x3c, 0x83, 0xd8, 0xa6, 0x3e, 0x95, 0x20, 0x17, 0xa3, - 0x1a, 0x72, 0x11, 0x26, 0x2d, 0xc7, 0x26, 0xfb, 0xe2, 0x70, 0x4e, 0x6b, 0xc1, 0xa3, 0xbc, 0x08, - 0x53, 0xc4, 0xc0, 0x36, 0x23, 0xec, 0x90, 0x27, 0x56, 0x0b, 0x9f, 0x3d, 0xab, 0x7b, 0xb8, 0x41, - 0x49, 0x90, 0x0e, 0x2d, 0x78, 0x94, 0xd7, 0x61, 0x96, 0x62, 0xbd, 0xe3, 0x12, 0x76, 0x58, 0xd7, - 0x1d, 0x9b, 0x21, 0x9d, 0x89, 0x19, 0x7e, 0xb1, 0xdf, 0x53, 0xce, 0xf3, 0xb5, 0x26, 0x35, 0x54, - 0xad, 0x10, 0x88, 0xd6, 0xb8, 0xc4, 0xf3, 0x60, 0x60, 0x86, 0x48, 0x8b, 0xb3, 0xc1, 0x69, 0x2d, - 0x78, 0x8c, 0xed, 0xe5, 0x93, 0x49, 0x98, 0x8e, 0xf8, 0xd6, 0x3d, 0x98, 0x75, 0xda, 0xd8, 0x1d, - 0xd2, 0xa2, 0x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fd, 0xa0, 0x8e, 0xaa, 0xcd, 0x45, 0xc2, 0x00, 0xed, 0x4f, 0x00, - 0xde, 0xbe, 0xea, 0x06, 0xb6, 0x1d, 0x4b, 0x7c, 0x5a, 0x9e, 0xeb, 0xf7, 0x94, 0x39, 0x8e, 0x12, - 0xbd, 0x53, 0xb5, 0x69, 0xef, 0xa1, 0xe6, 0xfd, 0x1d, 0x05, 0xbe, 0xba, 0xfe, 0xe8, 0x49, 0x49, - 0x7a, 0xfc, 0xa4, 0x24, 0x7d, 0xf3, 0xa4, 0x24, 0xdd, 0x7f, 0x5a, 0x9a, 0x78, 0xfc, 0xb4, 0x34, - 0xf1, 0xe5, 0xd3, 0xd2, 0xc4, 0xdf, 0xff, 0xf8, 0xcc, 0xc3, 0x92, 0xf8, 0x45, 0xb3, 0x91, 0xf5, - 0xb3, 0x72, 0xed, 0xe7, 0x00, 0x00, 0x00, 0xff, 0xff, 0xd8, 0xec, 0x27, 0x1d, 0xeb, 0x1c, 0x00, - 0x00, + // 1678 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x59, 0xcd, 0x6f, 0x23, 0x49, + 0x15, 0x4f, 0xdb, 0x8e, 0x9d, 0x3c, 0x4f, 0xec, 0xa4, 0xa3, 0xc9, 0x78, 0xb2, 0xac, 0x3b, 0xf4, + 0xa2, 0x55, 0x84, 0x58, 0x5b, 0xd9, 0x45, 0x42, 0xca, 0x5e, 0x76, 0x1c, 0x27, 0x4a, 0x50, 0x82, + 0x66, 0x3b, 0xb3, 0x39, 0xf0, 0x21, 0xab, 0xdc, 0x5d, 0x69, 0x17, 0x71, 0x77, 0x9b, 0xae, 0x72, + 0xd6, 0x41, 0x5c, 0x91, 0x10, 0x12, 0x62, 0x2f, 0x48, 0x73, 0x1c, 0xf1, 0x0f, 0x70, 0x45, 0x70, + 0xe1, 0x38, 0xdc, 0x46, 0x20, 0x21, 0xc4, 0x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b, 0x2e, 0x33, 0xe8, 0x46, 0x29, 0xa4, 0xc8, 0xa6, 0x6d, 0xf3, 0xc7, 0xad, 0x20, 0x67, 0x02, + 0xae, 0x19, 0x27, 0x6e, 0x5d, 0x76, 0xed, 0xf8, 0x49, 0x2b, 0x09, 0x20, 0xda, 0x76, 0x29, 0xa6, + 0xf2, 0xbe, 0xfd, 0x03, 0x28, 0x13, 0x97, 0x30, 0x82, 0xba, 0xad, 0x36, 0xea, 0x22, 0xd7, 0xbc, + 0xce, 0x05, 0x46, 0x34, 0x5a, 0xa9, 0x36, 0x05, 0xa7, 0x1b, 0x25, 0x49, 0x69, 0x08, 0x82, 0xba, + 0x0f, 0x85, 0x50, 0x55, 0xee, 0x5a, 0x53, 0x5e, 0x28, 0x9e, 0xf0, 0xc8, 0xcf, 0xb2, 0xb0, 0x12, + 0x3d, 0xf0, 0xdc, 0xb8, 0x62, 0x56, 0x57, 0x1c, 0x01, 0x88, 0x4a, 0x12, 0xf4, 0x92, 0x6b, 0x78, + 0x23, 0xa8, 0x45, 0x8b, 0x02, 0xa1, 0x49, 0x59, 0xc2, 0x1f, 0xff, 0xcc, 0xc2, 0xad, 0xa4, 0x3f, + 0x6e, 0x9a, 0xfc, 0x1b, 0xf4, 0xe4, 0xf6, 0xcd, 0xb8, 0x36, 0xe6, 0x78, 0x6d, 0xfc, 0xea, 0xd4, + 0xda, 0x38, 0x96, 0x53, 0xd3, 0x8b, 0xe2, 0xbf, 0x33, 0x90, 0xbf, 0x8f, 0x7c, 0xe4, 0x50, 0xd5, + 0x1c, 0xbb, 0x72, 0x88, 0x87, 0x88, 0xbb, 0x63, 0x19, 0xd3, 0x94, 0x7f, 0x2f, 0x7b, 0xc1, 0x8d, + 0xe3, 0xe1, 0x84, 0x1b, 0xc7, 0x27, 0x50, 0x72, 0xd0, 0xa0, 0x15, 0x1d, 0x50, 0x78, 0x73, 0xa9, + 0x71, 0x37, 0x46, 0xb9, 0xfc, 0x5d, 0x3c, 0xa5, 0x44, 0x17, 0x72, 0xaa, 0x7e, 0x03, 0x8a, 0x01, + 0x47, 0xdc, 0x27, 0x02, 0xf1, 0xb5, 0xf8, 0xc9, 0x22, 0xf1, 0x51, 0x37, 0xc0, 0x41, 0x83, 0x5d, + 0xb1, 0x50, 0x0f, 0x41, 0xed, 0x44, 0x4f, 0x68, 0xad, 0xd8, 0x96, 0x81, 0xfc, 0xbb, 0xa3, 0xa1, + 0x76, 0x57, 0xc8, 0x8f, 0xf3, 0xe8, 0xc6, 0x4a, 0x4c, 0x0c, 0xd1, 0xbe, 0x0e, 0x10, 0x9c, 0xab, + 0x65, 0x61, 0xd7, 0x73, 0xe4, 0xc5, 0xf7, 0xf6, 0x68, 0xa8, 0xad, 0x08, 0x94, 0xf8, 0x9b, 0x6e, + 0x2c, 0x06, 0x8b, 0x66, 0xf0, 0x3b, 0x36, 0x7c, 0x63, 0xef, 0xf1, 0xd3, 0xaa, 0xf2, 0xe4, 0x69, + 0x55, 0xf9, 0xdb, 0xd3, 0xaa, 0xf2, 0xc5, 0xb3, 0xea, 0xdc, 0x93, 0x67, 0xd5, 0xb9, 0x3f, 0x3f, + 0xab, 0xce, 0x7d, 0xfb, 0x6b, 0xcf, 0x0d, 0x96, 0xd4, 0xdf, 0x5b, 0xdb, 0x79, 0xee, 0x95, 0x8f, + 0xfe, 0x1b, 0x00, 0x00, 0xff, 0xff, 0x62, 0xe9, 0xa4, 0xfa, 0x89, 0x1d, 0x00, 0x00, } func (this *HistoricalInfo) Equal(that interface{}) bool { @@ -2344,6 +2438,43 @@ func (m *DVPair) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *DVPairs) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *DVPairs) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *DVPairs) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Pairs) > 0 { + for iNdEx := len(m.Pairs) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Pairs[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + func (m *DVVTriplet) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -2388,6 +2519,43 @@ func (m *DVVTriplet) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *DVVTriplets) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *DVVTriplets) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *DVVTriplets) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Triplets) > 0 { + for iNdEx := len(m.Triplets) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Triplets[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + func (m *Delegation) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -2962,6 +3130,21 @@ func (m *DVPair) Size() (n int) { return n } +func (m *DVPairs) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Pairs) > 0 { + for _, e := range m.Pairs { + l = e.Size() + n += 1 + l + sovTypes(uint64(l)) + } + } + return n +} + func (m *DVVTriplet) Size() (n int) { if m == nil { return 0 @@ -2983,6 +3166,21 @@ func (m *DVVTriplet) Size() (n int) { return n } +func (m *DVVTriplets) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Triplets) > 0 { + for _, e := range m.Triplets { + l = e.Size() + n += 1 + l + sovTypes(uint64(l)) + } + } + return n +} + func (m *Delegation) Size() (n int) { if m == nil { return 0 @@ -5198,6 +5396,93 @@ func (m *DVPair) Unmarshal(dAtA []byte) error { } return nil } +func (m *DVPairs) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DVPairs: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DVPairs: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pairs", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Pairs = append(m.Pairs, DVPair{}) + if err := m.Pairs[len(m.Pairs)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *DVVTriplet) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -5353,6 +5638,93 @@ func (m *DVVTriplet) Unmarshal(dAtA []byte) error { } return nil } +func (m *DVVTriplets) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DVVTriplets: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DVVTriplets: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Triplets", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Triplets = append(m.Triplets, DVVTriplet{}) + if err := m.Triplets[len(m.Triplets)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *Delegation) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 diff --git a/x/staking/types/types.proto b/x/staking/types/types.proto index a1f063eec6f0..e2b064310ec8 100644 --- a/x/staking/types/types.proto +++ b/x/staking/types/types.proto @@ -161,9 +161,9 @@ message Description { // coins. Slashing results in a decrease in the exchange rate, allowing correct // calculation of future undelegations without iterating over delegators. // When coins are delegated to this validator, the validator is credited with a -// delegation whose number of bond shares is based on the amount of coins delegated -// divided by the current exchange rate. Voting power can be calculated as total -// bonded shares multiplied by exchange rate. +// delegation whose number of bond shares is based on the amount of coins +// delegated divided by the current exchange rate. Voting power can be +// calculated as total bonded shares multiplied by exchange rate. message Validator { option (gogoproto.equal) = true; option (gogoproto.goproto_stringer) = false; @@ -176,9 +176,8 @@ message Validator { string consensus_pubkey = 2 [ (gogoproto.moretags) = "yaml:\"consensus_pubkey\"" ]; bool jailed = 3; - int32 status = 4 [ - (gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.BondStatus" - ]; + int32 status = 4 [ (gogoproto.casttype) = + "github.com/cosmos/cosmos-sdk/types.BondStatus" ]; string tokens = 5 [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false @@ -221,6 +220,9 @@ message DVPair { ]; } +// DVPairs defines an array of DVPair objects. +message DVPairs { repeated DVPair pairs = 1 [ (gogoproto.nullable) = false ]; } + // DVVTriplet is struct that just has a delegator-validator-validator triplet // with no other data. It is intended to be used as a marshalable pointer. For // example, a DVVTriplet can be used to construct the key to getting a @@ -243,6 +245,11 @@ message DVVTriplet { ]; } +// DVVTriplets defines an array of DVVTriplet objects. +message DVVTriplets { + repeated DVVTriplet triplets = 1 [ (gogoproto.nullable) = false ]; +} + // Delegation represents the bond with tokens held by an account. It is // owned by one delegator, and is associated with the voting power of one // validator. From 7503396a8a37ffb1a5457e9b45ff1f4b991a9923 Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Mon, 3 Feb 2020 16:33:02 -0500 Subject: [PATCH 09/46] Fix staking keeper tests --- codec/amino.go | 4 ++-- codec/codec.go | 4 ++++ x/staking/keeper/delegation_test.go | 16 +++++++------- x/staking/keeper/historical_info_test.go | 7 +++--- x/staking/keeper/test_common.go | 8 ++++--- x/staking/keeper/validator.go | 3 ++- x/staking/keeper/validator_test.go | 27 ++++++++++++------------ x/staking/simulation/genesis.go | 8 +++---- x/staking/types/validator.go | 12 +++++++++++ 9 files changed, 53 insertions(+), 36 deletions(-) diff --git a/codec/amino.go b/codec/amino.go index 3393ba4da717..c0936e70460b 100644 --- a/codec/amino.go +++ b/codec/amino.go @@ -45,7 +45,7 @@ func RegisterEvidences(cdc *Codec) { // MarshalJSONIndent provides a utility for indented JSON encoding of an object // via an Amino codec. It returns an error if it cannot serialize or indent as // JSON. -func MarshalJSONIndent(m Marshaler, obj interface{}) ([]byte, error) { +func MarshalJSONIndent(m JSONMarshaler, obj interface{}) ([]byte, error) { bz, err := m.MarshalJSON(obj) if err != nil { return nil, err @@ -60,7 +60,7 @@ func MarshalJSONIndent(m Marshaler, obj interface{}) ([]byte, error) { } // MustMarshalJSONIndent executes MarshalJSONIndent except it panics upon failure. -func MustMarshalJSONIndent(m Marshaler, obj interface{}) []byte { +func MustMarshalJSONIndent(m JSONMarshaler, obj interface{}) []byte { bz, err := MarshalJSONIndent(m, obj) if err != nil { panic(fmt.Sprintf("failed to marshal JSON: %s", err)) diff --git a/codec/codec.go b/codec/codec.go index 203a1ec1bbb6..323d2607c851 100644 --- a/codec/codec.go +++ b/codec/codec.go @@ -30,6 +30,10 @@ type ( UnmarshalBinaryLengthPrefixed(bz []byte, ptr ProtoMarshaler) error MustUnmarshalBinaryLengthPrefixed(bz []byte, ptr ProtoMarshaler) + JSONMarshaler + } + + JSONMarshaler interface { MarshalJSON(o interface{}) ([]byte, error) // nolint: stdmethods MustMarshalJSON(o interface{}) []byte diff --git a/x/staking/keeper/delegation_test.go b/x/staking/keeper/delegation_test.go index f2832dd498d2..eda1a550cd67 100644 --- a/x/staking/keeper/delegation_test.go +++ b/x/staking/keeper/delegation_test.go @@ -233,7 +233,7 @@ func TestUnbondingDelegationsMaxEntries(t *testing.T) { // should all pass var completionTime time.Time - for i := uint16(0); i < maxEntries; i++ { + for i := uint32(0); i < maxEntries; i++ { var err error completionTime, err = keeper.Undelegate(ctx, addrDels[0], addrVals[0], sdk.NewDec(1)) require.NoError(t, err) @@ -414,7 +414,7 @@ func TestUndelegateFromUnbondingValidator(t *testing.T) { require.True(t, found) require.Equal(t, blockHeight, validator.UnbondingHeight) params := keeper.GetParams(ctx) - require.True(t, blockTime.Add(params.UnbondingTime).Equal(validator.UnbondingCompletionTime)) + require.True(t, blockTime.Add(params.UnbondingTime).Equal(validator.UnbondingTime)) blockHeight2 := int64(20) blockTime2 := time.Unix(444, 0).UTC() @@ -489,10 +489,10 @@ func TestUndelegateFromUnbondedValidator(t *testing.T) { require.True(t, found) require.Equal(t, ctx.BlockHeight(), validator.UnbondingHeight) params := keeper.GetParams(ctx) - require.True(t, ctx.BlockHeader().Time.Add(params.UnbondingTime).Equal(validator.UnbondingCompletionTime)) + require.True(t, ctx.BlockHeader().Time.Add(params.UnbondingTime).Equal(validator.UnbondingTime)) // unbond the validator - ctx = ctx.WithBlockTime(validator.UnbondingCompletionTime) + ctx = ctx.WithBlockTime(validator.UnbondingTime) keeper.UnbondAllMatureValidatorQueue(ctx) // Make sure validator is still in state because there is still an outstanding delegation @@ -579,7 +579,7 @@ func TestUnbondingAllDelegationFromValidator(t *testing.T) { require.Equal(t, validator.Status, sdk.Unbonding) // unbond the validator - ctx = ctx.WithBlockTime(validator.UnbondingCompletionTime) + ctx = ctx.WithBlockTime(validator.UnbondingTime) keeper.UnbondAllMatureValidatorQueue(ctx) // validator should now be deleted from state @@ -733,7 +733,7 @@ func TestRedelegationMaxEntries(t *testing.T) { // redelegations should pass var completionTime time.Time - for i := uint16(0); i < maxEntries; i++ { + for i := uint32(0); i < maxEntries; i++ { var err error completionTime, err = keeper.BeginRedelegation(ctx, val0AccAddr, addrVals[0], addrVals[1], sdk.NewDec(1)) require.NoError(t, err) @@ -863,7 +863,7 @@ func TestRedelegateFromUnbondingValidator(t *testing.T) { require.True(t, found) require.Equal(t, blockHeight, validator.UnbondingHeight) params := keeper.GetParams(ctx) - require.True(t, blockTime.Add(params.UnbondingTime).Equal(validator.UnbondingCompletionTime)) + require.True(t, blockTime.Add(params.UnbondingTime).Equal(validator.UnbondingTime)) //change the context header = ctx.BlockHeader() @@ -940,7 +940,7 @@ func TestRedelegateFromUnbondedValidator(t *testing.T) { require.True(t, found) require.Equal(t, ctx.BlockHeight(), validator.UnbondingHeight) params := keeper.GetParams(ctx) - require.True(t, ctx.BlockHeader().Time.Add(params.UnbondingTime).Equal(validator.UnbondingCompletionTime)) + require.True(t, ctx.BlockHeader().Time.Add(params.UnbondingTime).Equal(validator.UnbondingTime)) // unbond the validator keeper.unbondingToUnbonded(ctx, validator) diff --git a/x/staking/keeper/historical_info_test.go b/x/staking/keeper/historical_info_test.go index 574d0c9dd9af..db372bce2cae 100644 --- a/x/staking/keeper/historical_info_test.go +++ b/x/staking/keeper/historical_info_test.go @@ -4,12 +4,11 @@ import ( "sort" "testing" - abci "github.com/tendermint/tendermint/abci/types" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/staking/types" "github.com/stretchr/testify/require" + abci "github.com/tendermint/tendermint/abci/types" ) func TestHistoricalInfo(t *testing.T) { @@ -27,7 +26,7 @@ func TestHistoricalInfo(t *testing.T) { recv, found := keeper.GetHistoricalInfo(ctx, 2) require.True(t, found, "HistoricalInfo not found after set") require.Equal(t, hi, recv, "HistoricalInfo not equal") - require.True(t, sort.IsSorted(types.Validators(recv.ValSet)), "HistoricalInfo validators is not sorted") + require.True(t, sort.IsSorted(types.Validators(recv.Valset)), "HistoricalInfo validators is not sorted") keeper.DeleteHistoricalInfo(ctx, 2) @@ -91,7 +90,7 @@ func TestTrackHistoricalInfo(t *testing.T) { // Check HistoricalInfo at height 10 is persisted expected := types.HistoricalInfo{ Header: header, - ValSet: vals, + Valset: vals, } recv, found = k.GetHistoricalInfo(ctx, 10) require.True(t, found, "GetHistoricalInfo failed after BeginBlock") diff --git a/x/staking/keeper/test_common.go b/x/staking/keeper/test_common.go index 65efabe4e25c..d24365084221 100644 --- a/x/staking/keeper/test_common.go +++ b/x/staking/keeper/test_common.go @@ -8,7 +8,6 @@ import ( "testing" "github.com/stretchr/testify/require" - abci "github.com/tendermint/tendermint/abci/types" "github.com/tendermint/tendermint/crypto" "github.com/tendermint/tendermint/crypto/ed25519" @@ -50,7 +49,7 @@ var ( // intended to be used with require/assert: require.True(ValEq(...)) func ValEq(t *testing.T, exp, got types.Validator) (*testing.T, bool, string, types.Validator, types.Validator) { - return t, exp.TestEquivalent(got), "expected:\t%v\ngot:\t\t%v", exp, got + return t, exp.MinEqual(got), "expected:\n%v\ngot:\n%v", exp, got } //_______________________________________________________________________________________ @@ -147,7 +146,7 @@ func CreateTestInput(t *testing.T, isCheckTx bool, initPower int64) (sdk.Context supplyKeeper.SetSupply(ctx, supply.NewSupply(totalSupply)) - keeper := NewKeeper(cdc, keyStaking, bk, supplyKeeper, pk.Subspace(DefaultParamspace)) + keeper := NewKeeper(types.ModuleCdc, keyStaking, bk, supplyKeeper, pk.Subspace(DefaultParamspace)) keeper.SetParams(ctx, types.DefaultParams()) // set module accounts @@ -273,12 +272,15 @@ func TestingUpdateValidator(keeper Keeper, ctx sdk.Context, validator types.Vali } return validator } + cachectx, _ := ctx.CacheContext() keeper.ApplyAndReturnValidatorSetUpdates(cachectx) + validator, found := keeper.GetValidator(cachectx, validator.OperatorAddress) if !found { panic("validator expected but not found") } + return validator } diff --git a/x/staking/keeper/validator.go b/x/staking/keeper/validator.go index 71c78631b391..a09d72ea8d0f 100644 --- a/x/staking/keeper/validator.go +++ b/x/staking/keeper/validator.go @@ -219,7 +219,7 @@ func (k Keeper) GetAllValidators(ctx sdk.Context) (validators []types.Validator) } // return a given amount of all the validators -func (k Keeper) GetValidators(ctx sdk.Context, maxRetrieve uint16) (validators []types.Validator) { +func (k Keeper) GetValidators(ctx sdk.Context, maxRetrieve uint32) (validators []types.Validator) { store := ctx.KVStore(k.storeKey) validators = make([]types.Validator, maxRetrieve) @@ -232,6 +232,7 @@ func (k Keeper) GetValidators(ctx sdk.Context, maxRetrieve uint16) (validators [ validators[i] = validator i++ } + return validators[:i] // trim if the array length < maxRetrieve } diff --git a/x/staking/keeper/validator_test.go b/x/staking/keeper/validator_test.go index ae2552fe8373..1b4d8f6a5ac8 100644 --- a/x/staking/keeper/validator_test.go +++ b/x/staking/keeper/validator_test.go @@ -5,13 +5,12 @@ import ( "testing" "time" - abci "github.com/tendermint/tendermint/abci/types" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/staking/types" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + abci "github.com/tendermint/tendermint/abci/types" ) //_______________________________________________________ @@ -117,7 +116,7 @@ func TestUpdateBondedValidatorsDecreaseCliff(t *testing.T) { // create keeper parameters params := keeper.GetParams(ctx) - params.MaxValidators = uint16(maxVals) + params.MaxValidators = uint32(maxVals) keeper.SetParams(ctx, params) // create a random pool @@ -437,7 +436,7 @@ func TestGetValidatorsEdgeCases(t *testing.T) { // set max validators to 2 params := keeper.GetParams(ctx) - nMax := uint16(2) + nMax := uint32(2) params.MaxValidators = nMax keeper.SetParams(ctx, params) @@ -461,7 +460,7 @@ func TestGetValidatorsEdgeCases(t *testing.T) { // ensure that the first two bonded validators are the largest validators resValidators := keeper.GetBondedValidatorsByPower(ctx) - require.Equal(t, nMax, uint16(len(resValidators))) + require.Equal(t, nMax, uint32(len(resValidators))) assert.True(ValEq(t, validators[2], resValidators[0])) assert.True(ValEq(t, validators[3], resValidators[1])) @@ -481,7 +480,7 @@ func TestGetValidatorsEdgeCases(t *testing.T) { // b) validator 2 with 400 tokens (delegated before validator 3) validators[0] = TestingUpdateValidator(keeper, ctx, validators[0], true) resValidators = keeper.GetBondedValidatorsByPower(ctx) - require.Equal(t, nMax, uint16(len(resValidators))) + require.Equal(t, nMax, uint32(len(resValidators))) assert.True(ValEq(t, validators[0], resValidators[0])) assert.True(ValEq(t, validators[2], resValidators[1])) @@ -509,7 +508,7 @@ func TestGetValidatorsEdgeCases(t *testing.T) { validators[3] = TestingUpdateValidator(keeper, ctx, validators[3], true) resValidators = keeper.GetBondedValidatorsByPower(ctx) - require.Equal(t, nMax, uint16(len(resValidators))) + require.Equal(t, nMax, uint32(len(resValidators))) assert.True(ValEq(t, validators[0], resValidators[0])) assert.True(ValEq(t, validators[3], resValidators[1])) @@ -525,7 +524,7 @@ func TestGetValidatorsEdgeCases(t *testing.T) { validators[3] = TestingUpdateValidator(keeper, ctx, validators[3], true) resValidators = keeper.GetBondedValidatorsByPower(ctx) - require.Equal(t, nMax, uint16(len(resValidators))) + require.Equal(t, nMax, uint32(len(resValidators))) assert.True(ValEq(t, validators[0], resValidators[0])) assert.True(ValEq(t, validators[2], resValidators[1])) @@ -540,7 +539,7 @@ func TestGetValidatorsEdgeCases(t *testing.T) { validators[3] = TestingUpdateValidator(keeper, ctx, validators[3], true) resValidators = keeper.GetBondedValidatorsByPower(ctx) - require.Equal(t, nMax, uint16(len(resValidators))) + require.Equal(t, nMax, uint32(len(resValidators))) assert.True(ValEq(t, validators[0], resValidators[0])) assert.True(ValEq(t, validators[2], resValidators[1])) _, exists := keeper.GetValidator(ctx, validators[3].OperatorAddress) @@ -577,7 +576,7 @@ func TestValidatorBondHeight(t *testing.T) { validators[2] = TestingUpdateValidator(keeper, ctx, validators[2], true) resValidators := keeper.GetBondedValidatorsByPower(ctx) - require.Equal(t, uint16(len(resValidators)), params.MaxValidators) + require.Equal(t, uint32(len(resValidators)), params.MaxValidators) assert.True(ValEq(t, validators[0], resValidators[0])) assert.True(ValEq(t, validators[1], resValidators[1])) @@ -588,7 +587,7 @@ func TestValidatorBondHeight(t *testing.T) { validators[2], _ = validators[2].AddTokensFromDel(delTokens) validators[2] = TestingUpdateValidator(keeper, ctx, validators[2], true) resValidators = keeper.GetBondedValidatorsByPower(ctx) - require.Equal(t, params.MaxValidators, uint16(len(resValidators))) + require.Equal(t, params.MaxValidators, uint32(len(resValidators))) validators[1] = TestingUpdateValidator(keeper, ctx, validators[1], true) assert.True(ValEq(t, validators[0], resValidators[0])) assert.True(ValEq(t, validators[2], resValidators[1])) @@ -598,7 +597,7 @@ func TestFullValidatorSetPowerChange(t *testing.T) { ctx, _, _, keeper, _ := CreateTestInput(t, false, 1000) params := keeper.GetParams(ctx) max := 2 - params.MaxValidators = uint16(2) + params.MaxValidators = uint32(2) keeper.SetParams(ctx, params) // initialize some validators into the state @@ -881,7 +880,7 @@ func TestApplyAndReturnValidatorSetUpdatesPowerDecrease(t *testing.T) { func TestApplyAndReturnValidatorSetUpdatesNewValidator(t *testing.T) { ctx, _, _, keeper, _ := CreateTestInput(t, false, 1000) params := keeper.GetParams(ctx) - params.MaxValidators = uint16(3) + params.MaxValidators = uint32(3) keeper.SetParams(ctx, params) @@ -962,7 +961,7 @@ func TestApplyAndReturnValidatorSetUpdatesNewValidator(t *testing.T) { func TestApplyAndReturnValidatorSetUpdatesBondTransition(t *testing.T) { ctx, _, _, keeper, _ := CreateTestInput(t, false, 1000) params := keeper.GetParams(ctx) - params.MaxValidators = uint16(2) + params.MaxValidators = uint32(2) keeper.SetParams(ctx, params) diff --git a/x/staking/simulation/genesis.go b/x/staking/simulation/genesis.go index cca02bee8cc9..1ce83be9ef18 100644 --- a/x/staking/simulation/genesis.go +++ b/x/staking/simulation/genesis.go @@ -27,8 +27,8 @@ func GenUnbondingTime(r *rand.Rand) (ubdTime time.Duration) { } // GenMaxValidators randomized MaxValidators -func GenMaxValidators(r *rand.Rand) (maxValidators uint16) { - return uint16(r.Intn(250) + 1) +func GenMaxValidators(r *rand.Rand) (maxValidators uint32) { + return uint32(r.Intn(250) + 1) } // RandomizedGenState generates a random GenesisState for staking @@ -40,7 +40,7 @@ func RandomizedGenState(simState *module.SimulationState) { func(r *rand.Rand) { unbondTime = GenUnbondingTime(r) }, ) - var maxValidators uint16 + var maxValidators uint32 simState.AppParams.GetOrGenerate( simState.Cdc, MaxValidators, &maxValidators, simState.Rand, func(r *rand.Rand) { maxValidators = GenMaxValidators(r) }, @@ -82,6 +82,6 @@ func RandomizedGenState(simState *module.SimulationState) { stakingGenesis := types.NewGenesisState(params, validators, delegations) - fmt.Printf("Selected randomly generated staking parameters:\n%s\n", codec.MustMarshalJSONIndent(simState.Cdc, stakingGenesis.Params)) + fmt.Printf("Selected randomly generated staking parameters:\n%s\n", codec.MustMarshalJSONIndent(types.ModuleCdc, stakingGenesis.Params)) simState.GenState[types.ModuleName] = simState.Cdc.MustMarshalJSON(stakingGenesis) } diff --git a/x/staking/types/validator.go b/x/staking/types/validator.go index d2b4a0a3b41c..2304596ae2b9 100644 --- a/x/staking/types/validator.go +++ b/x/staking/types/validator.go @@ -376,6 +376,18 @@ func (v Validator) RemoveDelShares(delShares sdk.Dec) (Validator, sdk.Int) { return v, issuedTokens } +// MinEqual defines a more minimum set of equality conditions when comparing two +// validators. +func (v Validator) MinEqual(other Validator) bool { + return v.ConsensusPubkey == other.ConsensusPubkey && + bytes.Equal(v.OperatorAddress, other.OperatorAddress) && + v.Status.Equal(other.Status) && + v.Tokens.Equal(other.Tokens) && + v.DelegatorShares.Equal(other.DelegatorShares) && + v.Description == other.Description && + v.Commission.Equal(other.Commission) +} + // nolint - for ValidatorI func (v Validator) IsJailed() bool { return v.Jailed } func (v Validator) GetMoniker() string { return v.Description.Moniker } From 97ac0b5827b7012cb5f60bdc2e95ebcb3a4d7dee Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Mon, 3 Feb 2020 16:39:44 -0500 Subject: [PATCH 10/46] Update query client --- x/staking/client/cli/query.go | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/x/staking/client/cli/query.go b/x/staking/client/cli/query.go index 14a60c49bc04..a38c004fde42 100644 --- a/x/staking/client/cli/query.go +++ b/x/staking/client/cli/query.go @@ -77,7 +77,12 @@ $ %s query staking validator cosmosvaloper1gghjut3ccd8ay0zduzj64hwre2fxs9ldmqhff return fmt.Errorf("no validator found with address %s", addr) } - return cliCtx.PrintOutput(types.MustUnmarshalValidator(cdc, res)) + validator, err := types.UnmarshalValidator(types.ModuleCdc, res) + if err != nil { + return err + } + + return cliCtx.PrintOutput(validator) }, } } @@ -107,7 +112,12 @@ $ %s query staking validators var validators types.Validators for _, kv := range resKVs { - validators = append(validators, types.MustUnmarshalValidator(cdc, kv.Value)) + validator, err := types.UnmarshalValidator(types.ModuleCdc, kv.Value) + if err != nil { + return err + } + + validators = append(validators, validator) } return cliCtx.PrintOutput(validators) @@ -380,7 +390,12 @@ $ %s query staking unbonding-delegation cosmos1gghjut3ccd8ay0zduzj64hwre2fxs9ld7 return err } - return cliCtx.PrintOutput(types.MustUnmarshalUBD(cdc, res)) + ubd, err := types.UnmarshalUBD(types.ModuleCdc, res) + if err != nil { + return err + } + + return cliCtx.PrintOutput(ubd) }, } } From 8e84801e6f2861191b4fd5f7cc756f2d3410b5c7 Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Mon, 3 Feb 2020 16:51:29 -0500 Subject: [PATCH 11/46] Update staking genesis and app_test --- x/staking/app_test.go | 2 +- x/staking/genesis.go | 9 ++++++--- x/staking/genesis_test.go | 10 ++++++++-- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/x/staking/app_test.go b/x/staking/app_test.go index 586b5d95d757..28bd943edce0 100644 --- a/x/staking/app_test.go +++ b/x/staking/app_test.go @@ -42,7 +42,7 @@ func getMockApp(t *testing.T) (*mock.App, Keeper) { types.BondedPoolName: {supply.Burner, supply.Staking}, } supplyKeeper := supply.NewKeeper(mApp.Cdc, keySupply, mApp.AccountKeeper, mApp.BankKeeper, maccPerms) - keeper := NewKeeper(mApp.Cdc, keyStaking, mApp.BankKeeper, supplyKeeper, mApp.ParamsKeeper.Subspace(DefaultParamspace)) + keeper := NewKeeper(ModuleCdc, keyStaking, mApp.BankKeeper, supplyKeeper, mApp.ParamsKeeper.Subspace(DefaultParamspace)) mApp.Router().AddRoute(RouterKey, NewHandler(keeper)) mApp.SetEndBlocker(getEndBlocker(keeper)) diff --git a/x/staking/genesis.go b/x/staking/genesis.go index 5c558ca4259b..8a2ecce10740 100644 --- a/x/staking/genesis.go +++ b/x/staking/genesis.go @@ -210,17 +210,20 @@ func validateGenesisStateValidators(validators []types.Validator) (err error) { addrMap := make(map[string]bool, len(validators)) for i := 0; i < len(validators); i++ { val := validators[i] - strKey := string(val.ConsPubKey.Bytes()) + strKey := string(val.GetConsPubKey().Bytes()) + if _, ok := addrMap[strKey]; ok { - return fmt.Errorf("duplicate validator in genesis state: moniker %v, address %v", val.Description.Moniker, val.ConsAddress()) + return fmt.Errorf("duplicate validator in genesis state: moniker %v, address %v", val.Description.Moniker, val.GetConsAddr()) } if val.Jailed && val.IsBonded() { - return fmt.Errorf("validator is bonded and jailed in genesis state: moniker %v, address %v", val.Description.Moniker, val.ConsAddress()) + return fmt.Errorf("validator is bonded and jailed in genesis state: moniker %v, address %v", val.Description.Moniker, val.GetConsAddr()) } if val.DelegatorShares.IsZero() && !val.IsUnbonding() { return fmt.Errorf("bonded/unbonded genesis validator cannot have zero delegator shares, validator: %v", val) } + addrMap[strKey] = true } + return } diff --git a/x/staking/genesis_test.go b/x/staking/genesis_test.go index 4f3a7f1d05bf..551239185fca 100644 --- a/x/staking/genesis_test.go +++ b/x/staking/genesis_test.go @@ -25,15 +25,21 @@ func TestInitGenesis(t *testing.T) { validators := make([]Validator, 2) var delegations []Delegation + pk0, err := sdk.Bech32ifyPubKey(sdk.Bech32PubKeyTypeConsPub, keep.PKs[0]) + require.NoError(t, err) + + pk1, err := sdk.Bech32ifyPubKey(sdk.Bech32PubKeyTypeConsPub, keep.PKs[1]) + require.NoError(t, err) + // initialize the validators validators[0].OperatorAddress = sdk.ValAddress(keep.Addrs[0]) - validators[0].ConsPubKey = keep.PKs[0] + validators[0].ConsensusPubkey = pk0 validators[0].Description = NewDescription("hoop", "", "", "", "") validators[0].Status = sdk.Bonded validators[0].Tokens = valTokens validators[0].DelegatorShares = valTokens.ToDec() validators[1].OperatorAddress = sdk.ValAddress(keep.Addrs[1]) - validators[1].ConsPubKey = keep.PKs[1] + validators[1].ConsensusPubkey = pk1 validators[1].Description = NewDescription("bloop", "", "", "", "") validators[1].Status = sdk.Bonded validators[1].Tokens = valTokens From c35939adaf1ad5ea2456e17005aea1e7791fb58b Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Mon, 3 Feb 2020 22:10:40 -0500 Subject: [PATCH 12/46] Update staking handler --- x/staking/handler.go | 31 +++++++++++++---- x/staking/handler_test.go | 71 ++++++++++++++++++++++++++++----------- 2 files changed, 75 insertions(+), 27 deletions(-) diff --git a/x/staking/handler.go b/x/staking/handler.go index 180bb8008672..e6ed8e3b57c3 100644 --- a/x/staking/handler.go +++ b/x/staking/handler.go @@ -3,6 +3,7 @@ package staking import ( "time" + gogotypes "github.com/gogo/protobuf/types" tmstrings "github.com/tendermint/tendermint/libs/strings" tmtypes "github.com/tendermint/tendermint/types" @@ -47,7 +48,12 @@ func handleMsgCreateValidator(ctx sdk.Context, msg types.MsgCreateValidator, k k return nil, ErrValidatorOwnerExists } - if _, found := k.GetValidatorByConsAddr(ctx, sdk.GetConsAddress(msg.PubKey)); found { + pk, err := sdk.GetPubKeyFromBech32(sdk.Bech32PubKeyTypeConsPub, msg.Pubkey) + if err != nil { + return nil, err + } + + if _, found := k.GetValidatorByConsAddr(ctx, sdk.GetConsAddress(pk)); found { return nil, ErrValidatorPubKeyExists } @@ -60,21 +66,22 @@ func handleMsgCreateValidator(ctx sdk.Context, msg types.MsgCreateValidator, k k } if ctx.ConsensusParams() != nil { - tmPubKey := tmtypes.TM2PB.PubKey(msg.PubKey) + tmPubKey := tmtypes.TM2PB.PubKey(pk) if !tmstrings.StringInSlice(tmPubKey.Type, ctx.ConsensusParams().Validator.PubKeyTypes) { return nil, sdkerrors.Wrapf( ErrValidatorPubKeyTypeNotSupported, - "got: %s, valid: %s", tmPubKey.Type, ctx.ConsensusParams().Validator.PubKeyTypes, + "got: %s, expected: %s", tmPubKey.Type, ctx.ConsensusParams().Validator.PubKeyTypes, ) } } - validator := NewValidator(msg.ValidatorAddress, msg.PubKey, msg.Description) + validator := NewValidator(msg.ValidatorAddress, pk, msg.Description) commission := NewCommissionWithTime( msg.Commission.Rate, msg.Commission.MaxRate, msg.Commission.MaxChangeRate, ctx.BlockHeader().Time, ) - validator, err := validator.SetInitialCommission(commission) + + validator, err = validator.SetInitialCommission(commission) if err != nil { return nil, err } @@ -217,7 +224,12 @@ func handleMsgUndelegate(ctx sdk.Context, msg types.MsgUndelegate, k keeper.Keep return nil, err } - completionTimeBz := types.ModuleCdc.MustMarshalBinaryLengthPrefixed(completionTime) + ts, err := gogotypes.TimestampProto(completionTime) + if err != nil { + return nil, ErrBadRedelegationAddr + } + + completionTimeBz := types.ModuleCdc.MustMarshalBinaryLengthPrefixed(ts) ctx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( types.EventTypeUnbond, @@ -254,7 +266,12 @@ func handleMsgBeginRedelegate(ctx sdk.Context, msg types.MsgBeginRedelegate, k k return nil, err } - completionTimeBz := types.ModuleCdc.MustMarshalBinaryLengthPrefixed(completionTime) + ts, err := gogotypes.TimestampProto(completionTime) + if err != nil { + return nil, ErrBadRedelegationAddr + } + + completionTimeBz := types.ModuleCdc.MustMarshalBinaryLengthPrefixed(ts) ctx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( types.EventTypeRedelegate, diff --git a/x/staking/handler_test.go b/x/staking/handler_test.go index 75e9242e07c7..64a5d579f99d 100644 --- a/x/staking/handler_test.go +++ b/x/staking/handler_test.go @@ -5,9 +5,9 @@ import ( "testing" "time" + gogotypes "github.com/gogo/protobuf/types" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - abci "github.com/tendermint/tendermint/abci/types" "github.com/tendermint/tendermint/crypto/secp256k1" tmtypes "github.com/tendermint/tendermint/types" @@ -90,8 +90,11 @@ func TestValidatorByPowerIndex(t *testing.T) { require.NoError(t, err) require.NotNil(t, res) - var finishTime time.Time - types.ModuleCdc.MustUnmarshalBinaryLengthPrefixed(res.Data, &finishTime) + ts := &gogotypes.Timestamp{} + types.ModuleCdc.MustUnmarshalBinaryLengthPrefixed(res.Data, ts) + + finishTime, err := gogotypes.TimestampFromProto(ts) + require.NoError(t, err) ctx = ctx.WithBlockTime(finishTime) EndBlocker(ctx, keeper) @@ -121,7 +124,7 @@ func TestDuplicatesMsgCreateValidator(t *testing.T) { require.True(t, found) assert.Equal(t, sdk.Bonded, validator.Status) assert.Equal(t, addr1, validator.OperatorAddress) - assert.Equal(t, pk1, validator.ConsPubKey) + assert.Equal(t, pk1, validator.GetConsPubKey()) assert.Equal(t, valTokens, validator.BondedTokens()) assert.Equal(t, valTokens.ToDec(), validator.DelegatorShares) assert.Equal(t, Description{}, validator.Description) @@ -153,7 +156,7 @@ func TestDuplicatesMsgCreateValidator(t *testing.T) { require.True(t, found) assert.Equal(t, sdk.Bonded, validator.Status) assert.Equal(t, addr2, validator.OperatorAddress) - assert.Equal(t, pk2, validator.ConsPubKey) + assert.Equal(t, pk2, validator.GetConsPubKey()) assert.True(sdk.IntEq(t, valTokens, validator.Tokens)) assert.True(sdk.DecEq(t, valTokens.ToDec(), validator.DelegatorShares)) assert.Equal(t, Description{}, validator.Description) @@ -225,8 +228,12 @@ func TestLegacyValidatorDelegations(t *testing.T) { require.NoError(t, err) require.NotNil(t, res) - var finishTime time.Time - types.ModuleCdc.MustUnmarshalBinaryLengthPrefixed(res.Data, &finishTime) + ts := &gogotypes.Timestamp{} + types.ModuleCdc.MustUnmarshalBinaryLengthPrefixed(res.Data, ts) + + finishTime, err := gogotypes.TimestampFromProto(ts) + require.NoError(t, err) + ctx = ctx.WithBlockTime(finishTime) EndBlocker(ctx, keeper) @@ -459,8 +466,11 @@ func TestIncrementsMsgUnbond(t *testing.T) { require.NoError(t, err) require.NotNil(t, res) - var finishTime time.Time - types.ModuleCdc.MustUnmarshalBinaryLengthPrefixed(res.Data, &finishTime) + ts := &gogotypes.Timestamp{} + types.ModuleCdc.MustUnmarshalBinaryLengthPrefixed(res.Data, ts) + + finishTime, err := gogotypes.TimestampFromProto(ts) + require.NoError(t, err) ctx = ctx.WithBlockTime(finishTime) EndBlocker(ctx, keeper) @@ -572,8 +582,11 @@ func TestMultipleMsgCreateValidator(t *testing.T) { require.NoError(t, err) require.NotNil(t, res) - var finishTime time.Time - types.ModuleCdc.MustUnmarshalBinaryLengthPrefixed(res.Data, &finishTime) + ts := &gogotypes.Timestamp{} + types.ModuleCdc.MustUnmarshalBinaryLengthPrefixed(res.Data, ts) + + _, err = gogotypes.TimestampFromProto(ts) + require.NoError(t, err) // adds validator into unbonding queue EndBlocker(ctx, keeper) @@ -626,8 +639,11 @@ func TestMultipleMsgDelegate(t *testing.T) { require.NoError(t, err) require.NotNil(t, res) - var finishTime time.Time - types.ModuleCdc.MustUnmarshalBinaryLengthPrefixed(res.Data, &finishTime) + ts := &gogotypes.Timestamp{} + types.ModuleCdc.MustUnmarshalBinaryLengthPrefixed(res.Data, ts) + + finishTime, err := gogotypes.TimestampFromProto(ts) + require.NoError(t, err) ctx = ctx.WithBlockTime(finishTime) EndBlocker(ctx, keeper) @@ -661,8 +677,11 @@ func TestJailValidator(t *testing.T) { require.NoError(t, err) require.NotNil(t, res) - var finishTime time.Time - types.ModuleCdc.MustUnmarshalBinaryLengthPrefixed(res.Data, &finishTime) + ts := &gogotypes.Timestamp{} + types.ModuleCdc.MustUnmarshalBinaryLengthPrefixed(res.Data, ts) + + finishTime, err := gogotypes.TimestampFromProto(ts) + require.NoError(t, err) ctx = ctx.WithBlockTime(finishTime) EndBlocker(ctx, keeper) @@ -677,7 +696,12 @@ func TestJailValidator(t *testing.T) { res, err = handleMsgUndelegate(ctx, msgUndelegateDelegator, keeper) require.NoError(t, err) require.NotNil(t, res) - types.ModuleCdc.MustUnmarshalBinaryLengthPrefixed(res.Data, &finishTime) + + ts = &gogotypes.Timestamp{} + types.ModuleCdc.MustUnmarshalBinaryLengthPrefixed(res.Data, ts) + + finishTime, err = gogotypes.TimestampFromProto(ts) + require.NoError(t, err) ctx = ctx.WithBlockTime(finishTime) EndBlocker(ctx, keeper) @@ -720,8 +744,11 @@ func TestValidatorQueue(t *testing.T) { require.NoError(t, err) require.NotNil(t, res) - var finishTime time.Time - types.ModuleCdc.MustUnmarshalBinaryLengthPrefixed(res.Data, &finishTime) + ts := &gogotypes.Timestamp{} + types.ModuleCdc.MustUnmarshalBinaryLengthPrefixed(res.Data, ts) + + finishTime, err := gogotypes.TimestampFromProto(ts) + require.NoError(t, err) ctx = ctx.WithBlockTime(finishTime) EndBlocker(ctx, keeper) @@ -821,8 +848,12 @@ func TestUnbondingFromUnbondingValidator(t *testing.T) { require.NotNil(t, res) // change the ctx to Block Time one second before the validator would have unbonded - var finishTime time.Time - types.ModuleCdc.MustUnmarshalBinaryLengthPrefixed(res.Data, &finishTime) + ts := &gogotypes.Timestamp{} + types.ModuleCdc.MustUnmarshalBinaryLengthPrefixed(res.Data, ts) + + finishTime, err := gogotypes.TimestampFromProto(ts) + require.NoError(t, err) + ctx = ctx.WithBlockTime(finishTime.Add(time.Second * -1)) // unbond the delegator from the validator From febaae81dfd8f5325d6a211cbdce78c39e2e83fa Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Mon, 3 Feb 2020 22:11:05 -0500 Subject: [PATCH 13/46] Use Int64Value instead of IntProto --- x/staking/keeper/val_state_change.go | 3 ++- x/staking/keeper/validator.go | 10 ++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/x/staking/keeper/val_state_change.go b/x/staking/keeper/val_state_change.go index c132100b8434..e05182e92876 100644 --- a/x/staking/keeper/val_state_change.go +++ b/x/staking/keeper/val_state_change.go @@ -5,6 +5,7 @@ import ( "fmt" "sort" + gogotypes "github.com/gogo/protobuf/types" abci "github.com/tendermint/tendermint/abci/types" sdk "github.com/cosmos/cosmos-sdk/types" @@ -137,7 +138,7 @@ func (k Keeper) ApplyAndReturnValidatorSetUpdates(ctx sdk.Context) (updates []ab oldPowerBytes, found := last[valAddrBytes] newPower := validator.ConsensusPower() - newPowerBytes := k.cdc.MustMarshalBinaryLengthPrefixed(&sdk.IntProto{Int: sdk.NewInt(newPower)}) + newPowerBytes := k.cdc.MustMarshalBinaryLengthPrefixed(&gogotypes.Int64Value{Value: newPower}) // update the validator set if power has changed if !found || !bytes.Equal(oldPowerBytes, newPowerBytes) { diff --git a/x/staking/keeper/validator.go b/x/staking/keeper/validator.go index a09d72ea8d0f..56db3181c096 100644 --- a/x/staking/keeper/validator.go +++ b/x/staking/keeper/validator.go @@ -5,6 +5,8 @@ import ( "fmt" "time" + gogotypes "github.com/gogo/protobuf/types" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/staking/types" ) @@ -275,15 +277,15 @@ func (k Keeper) GetLastValidatorPower(ctx sdk.Context, operator sdk.ValAddress) return 0 } - ip := sdk.IntProto{} - k.cdc.MustUnmarshalBinaryLengthPrefixed(bz, &ip) - return ip.Int.Int64() + intV := gogotypes.Int64Value{} + k.cdc.MustUnmarshalBinaryLengthPrefixed(bz, &intV) + return intV.GetValue() } // Set the last validator power. func (k Keeper) SetLastValidatorPower(ctx sdk.Context, operator sdk.ValAddress, power int64) { store := ctx.KVStore(k.storeKey) - bz := k.cdc.MustMarshalBinaryLengthPrefixed(&sdk.IntProto{Int: sdk.NewInt(power)}) + bz := k.cdc.MustMarshalBinaryLengthPrefixed(&gogotypes.Int64Value{Value: power}) store.Set(types.GetLastValidatorPowerKey(operator), bz) } From 5b83d9bf3c1634245dac8ff436d257b8f30109fd Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Mon, 3 Feb 2020 22:28:09 -0500 Subject: [PATCH 14/46] Updates tests and APIs --- simapp/app.go | 2 +- x/distribution/keeper/test_common.go | 2 +- x/distribution/types/expected_keepers.go | 2 +- x/gov/keeper/tally_test.go | 2 +- x/gov/keeper/test_common.go | 2 +- x/gov/test_common.go | 2 +- x/slashing/app_test.go | 4 ++-- x/slashing/internal/keeper/test_common.go | 2 +- x/slashing/internal/types/expected_keepers.go | 2 +- 9 files changed, 10 insertions(+), 10 deletions(-) diff --git a/simapp/app.go b/simapp/app.go index e3a589adb877..7dc5a8b5de87 100644 --- a/simapp/app.go +++ b/simapp/app.go @@ -180,7 +180,7 @@ func NewSimApp( app.cdc, keys[supply.StoreKey], app.AccountKeeper, app.BankKeeper, maccPerms, ) stakingKeeper := staking.NewKeeper( - app.cdc, keys[staking.StoreKey], app.BankKeeper, app.SupplyKeeper, app.subspaces[staking.ModuleName], + staking.ModuleCdc, keys[staking.StoreKey], app.BankKeeper, app.SupplyKeeper, app.subspaces[staking.ModuleName], ) app.MintKeeper = mint.NewKeeper( app.cdc, keys[mint.StoreKey], app.subspaces[mint.ModuleName], &stakingKeeper, diff --git a/x/distribution/keeper/test_common.go b/x/distribution/keeper/test_common.go index e049c3bbc57a..2fe0e22b36ab 100644 --- a/x/distribution/keeper/test_common.go +++ b/x/distribution/keeper/test_common.go @@ -139,7 +139,7 @@ func CreateTestInputAdvanced( } supplyKeeper := supply.NewKeeper(cdc, keySupply, accountKeeper, bankKeeper, maccPerms) - sk := staking.NewKeeper(cdc, keyStaking, bankKeeper, supplyKeeper, pk.Subspace(staking.DefaultParamspace)) + sk := staking.NewKeeper(staking.ModuleCdc, keyStaking, bankKeeper, supplyKeeper, pk.Subspace(staking.DefaultParamspace)) sk.SetParams(ctx, staking.DefaultParams()) keeper := NewKeeper(cdc, keyDistr, pk.Subspace(types.DefaultParamspace), bankKeeper, sk, supplyKeeper, auth.FeeCollectorName, blacklistedAddrs) diff --git a/x/distribution/types/expected_keepers.go b/x/distribution/types/expected_keepers.go index 1f9d0a51a348..d7c909bacec0 100644 --- a/x/distribution/types/expected_keepers.go +++ b/x/distribution/types/expected_keepers.go @@ -49,7 +49,7 @@ type StakingKeeper interface { Delegation(sdk.Context, sdk.AccAddress, sdk.ValAddress) stakingexported.DelegationI // MaxValidators returns the maximum amount of bonded validators - MaxValidators(sdk.Context) uint16 + MaxValidators(sdk.Context) uint32 IterateDelegations(ctx sdk.Context, delegator sdk.AccAddress, fn func(index int64, delegation stakingexported.DelegationI) (stop bool)) diff --git a/x/gov/keeper/tally_test.go b/x/gov/keeper/tally_test.go index 52812793c951..e93f6b387e6b 100644 --- a/x/gov/keeper/tally_test.go +++ b/x/gov/keeper/tally_test.go @@ -375,7 +375,7 @@ func TestTallyJailedValidator(t *testing.T) { _ = staking.EndBlocker(ctx, sk) - sk.Jail(ctx, sdk.ConsAddress(val2.ConsPubKey.Address())) + sk.Jail(ctx, sdk.ConsAddress(val2.GetConsPubKey().Address())) tp := TestProposal proposal, err := keeper.SubmitProposal(ctx, tp) diff --git a/x/gov/keeper/test_common.go b/x/gov/keeper/test_common.go index 897ad8b05da5..bb57f7ab0275 100644 --- a/x/gov/keeper/test_common.go +++ b/x/gov/keeper/test_common.go @@ -151,7 +151,7 @@ func createTestInput( bankKeeper := bank.NewBaseKeeper(cdc, keyBank, accountKeeper, pk.Subspace(bank.DefaultParamspace), blacklistedAddrs) supplyKeeper := supply.NewKeeper(cdc, keySupply, accountKeeper, bankKeeper, maccPerms) - sk := staking.NewKeeper(cdc, keyStaking, bankKeeper, supplyKeeper, pk.Subspace(staking.DefaultParamspace)) + sk := staking.NewKeeper(staking.ModuleCdc, keyStaking, bankKeeper, supplyKeeper, pk.Subspace(staking.DefaultParamspace)) sk.SetParams(ctx, staking.DefaultParams()) rtr := types.NewRouter(). diff --git a/x/gov/test_common.go b/x/gov/test_common.go index c6fe5d7fcbba..a01a79c6566d 100644 --- a/x/gov/test_common.go +++ b/x/gov/test_common.go @@ -81,7 +81,7 @@ func getMockApp( bk := mApp.BankKeeper supplyKeeper := supply.NewKeeper(mApp.Cdc, keySupply, mApp.AccountKeeper, bk, maccPerms) sk := staking.NewKeeper( - mApp.Cdc, keyStaking, bk, supplyKeeper, pk.Subspace(staking.DefaultParamspace), + staking.ModuleCdc, keyStaking, bk, supplyKeeper, pk.Subspace(staking.DefaultParamspace), ) keeper := keep.NewKeeper( diff --git a/x/slashing/app_test.go b/x/slashing/app_test.go index 88ae3bb0b75a..b62d5dcb1385 100644 --- a/x/slashing/app_test.go +++ b/x/slashing/app_test.go @@ -55,7 +55,7 @@ func getMockApp(t *testing.T) (*mock.App, staking.Keeper, Keeper) { staking.BondedPoolName: {supply.Burner, supply.Staking}, } supplyKeeper := supply.NewKeeper(mapp.Cdc, keySupply, mapp.AccountKeeper, mapp.BankKeeper, maccPerms) - stakingKeeper := staking.NewKeeper(mapp.Cdc, keyStaking, mapp.BankKeeper, supplyKeeper, mapp.ParamsKeeper.Subspace(staking.DefaultParamspace)) + stakingKeeper := staking.NewKeeper(staking.ModuleCdc, keyStaking, mapp.BankKeeper, supplyKeeper, mapp.ParamsKeeper.Subspace(staking.DefaultParamspace)) keeper := NewKeeper(mapp.Cdc, keySlashing, stakingKeeper, mapp.ParamsKeeper.Subspace(DefaultParamspace)) mapp.Router().AddRoute(staking.RouterKey, staking.NewHandler(stakingKeeper)) mapp.Router().AddRoute(RouterKey, NewHandler(keeper)) @@ -158,7 +158,7 @@ func TestSlashingMsgs(t *testing.T) { require.Equal(t, sdk.ValAddress(addr1), validator.OperatorAddress) require.Equal(t, sdk.Bonded, validator.Status) require.True(sdk.IntEq(t, bondTokens, validator.BondedTokens())) - unjailMsg := MsgUnjail{ValidatorAddr: sdk.ValAddress(validator.ConsPubKey.Address())} + unjailMsg := MsgUnjail{ValidatorAddr: sdk.ValAddress(validator.GetConsPubKey().Address())} // no signing info yet checkValidatorSigningInfo(t, mapp, keeper, sdk.ConsAddress(addr1), false) diff --git a/x/slashing/internal/keeper/test_common.go b/x/slashing/internal/keeper/test_common.go index 79a436b2e1df..128c7438a7f9 100644 --- a/x/slashing/internal/keeper/test_common.go +++ b/x/slashing/internal/keeper/test_common.go @@ -104,7 +104,7 @@ func CreateTestInput(t *testing.T, defaults types.Params) (sdk.Context, bank.Kee totalSupply := sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, InitTokens.MulRaw(int64(len(Addrs))))) supplyKeeper.SetSupply(ctx, supply.NewSupply(totalSupply)) - sk := staking.NewKeeper(cdc, keyStaking, bk, supplyKeeper, paramsKeeper.Subspace(staking.DefaultParamspace)) + sk := staking.NewKeeper(staking.ModuleCdc, keyStaking, bk, supplyKeeper, paramsKeeper.Subspace(staking.DefaultParamspace)) genesis := staking.DefaultGenesisState() // set module accounts diff --git a/x/slashing/internal/types/expected_keepers.go b/x/slashing/internal/types/expected_keepers.go index bf09731a03e6..fe5695eebbf2 100644 --- a/x/slashing/internal/types/expected_keepers.go +++ b/x/slashing/internal/types/expected_keepers.go @@ -51,7 +51,7 @@ type StakingKeeper interface { Delegation(sdk.Context, sdk.AccAddress, sdk.ValAddress) stakingexported.DelegationI // MaxValidators returns the maximum amount of bonded validators - MaxValidators(sdk.Context) uint16 + MaxValidators(sdk.Context) uint32 } // StakingHooks event hooks for staking validator object (noalias) From 0a904f15db0ecf930e88416ca80e1fb5871dfe99 Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Mon, 3 Feb 2020 22:35:51 -0500 Subject: [PATCH 15/46] Fix iteration --- x/staking/keeper/validator.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/x/staking/keeper/validator.go b/x/staking/keeper/validator.go index 56db3181c096..efc0ff517e9d 100644 --- a/x/staking/keeper/validator.go +++ b/x/staking/keeper/validator.go @@ -309,10 +309,10 @@ func (k Keeper) IterateLastValidatorPowers(ctx sdk.Context, handler func(operato defer iter.Close() for ; iter.Valid(); iter.Next() { addr := sdk.ValAddress(iter.Key()[len(types.LastValidatorPowerKey):]) - ip := sdk.IntProto{} + intV := &gogotypes.Int64Value{} - k.cdc.MustUnmarshalBinaryLengthPrefixed(iter.Value(), &ip) - if handler(addr, ip.Int.Int64()) { + k.cdc.MustUnmarshalBinaryLengthPrefixed(iter.Value(), intV) + if handler(addr, intV.GetValue()) { break } } From 1ee452770c94e2c9f88fa567d3e7ff37dee743a0 Mon Sep 17 00:00:00 2001 From: Marko Baricevic Date: Tue, 4 Feb 2020 12:37:42 +0100 Subject: [PATCH 16/46] proto: move distr over to proto Signed-off-by: Marko Baricevic --- x/crisis/internal/types/codec.go | 29 +- x/crisis/internal/types/msgs.go | 7 - x/crisis/internal/types/types.pb.go | 436 +++++++++++ x/crisis/internal/types/types.proto | 20 + x/distribution/types/codec.go | 27 +- x/distribution/types/msg.go | 24 - x/distribution/types/types.pb.go | 1038 +++++++++++++++++++++++++++ x/distribution/types/types.proto | 53 ++ 8 files changed, 1590 insertions(+), 44 deletions(-) create mode 100644 x/crisis/internal/types/types.pb.go create mode 100644 x/crisis/internal/types/types.proto create mode 100644 x/distribution/types/types.pb.go create mode 100644 x/distribution/types/types.proto diff --git a/x/crisis/internal/types/codec.go b/x/crisis/internal/types/codec.go index 92aeb130bce8..fc9178eb386b 100644 --- a/x/crisis/internal/types/codec.go +++ b/x/crisis/internal/types/codec.go @@ -4,17 +4,32 @@ import ( "github.com/cosmos/cosmos-sdk/codec" ) -// Register concrete types on codec codec +type Codec struct { + codec.Marshaler + + // Keep reference to the amino codec to allow backwards compatibility along + // with type, and interface registration. + amino *codec.Codec +} + +func NewCodec(amino *codec.Codec) *Codec { + return &Codec{Marshaler: codec.NewHybridCodec(amino), amino: amino} +} + +// ---------------------------------------------------------------------------- + +// RegisterCodec registers all the necessary crisis module concrete types and +// interfaces with the provided codec reference. func RegisterCodec(cdc *codec.Codec) { cdc.RegisterConcrete(MsgVerifyInvariant{}, "cosmos-sdk/MsgVerifyInvariant", nil) } -// generic sealed codec to be used throughout module -var ModuleCdc *codec.Codec +// ModuleCdc defines a crisis module global Amino codec. +var ModuleCdc *Codec func init() { - ModuleCdc = codec.New() - RegisterCodec(ModuleCdc) - codec.RegisterCrypto(ModuleCdc) - ModuleCdc.Seal() + ModuleCdc = NewCodec(codec.New()) + RegisterCodec(ModuleCdc.amino) + codec.RegisterCrypto(ModuleCdc.amino) + ModuleCdc.amino.Seal() } diff --git a/x/crisis/internal/types/msgs.go b/x/crisis/internal/types/msgs.go index f496df636b60..49698c1ca943 100644 --- a/x/crisis/internal/types/msgs.go +++ b/x/crisis/internal/types/msgs.go @@ -4,13 +4,6 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" ) -// MsgVerifyInvariant - message struct to verify a particular invariance -type MsgVerifyInvariant struct { - Sender sdk.AccAddress `json:"sender" yaml:"sender"` - InvariantModuleName string `json:"invariant_module_name" yaml:"invariant_module_name"` - InvariantRoute string `json:"invariant_route" yaml:"invariant_route"` -} - // ensure Msg interface compliance at compile time var _ sdk.Msg = &MsgVerifyInvariant{} diff --git a/x/crisis/internal/types/types.pb.go b/x/crisis/internal/types/types.pb.go new file mode 100644 index 000000000000..6a9f7c64967e --- /dev/null +++ b/x/crisis/internal/types/types.pb.go @@ -0,0 +1,436 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: x/crisis/internal/types/types.proto + +package types + +import ( + fmt "fmt" + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// MsgVerifyInvariant - message struct to verify a particular invariance +type MsgVerifyInvariant struct { + Sender github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,1,opt,name=sender,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"sender,omitempty" yaml:"sender"` + InvariantModuleName string `protobuf:"bytes,2,opt,name=invariant_module_name,json=invariantModuleName,proto3" json:"invariant_module_name,omitempty" yaml:"invariant_module_name"` + InvariantRoute string `protobuf:"bytes,3,opt,name=invariant_route,json=invariantRoute,proto3" json:"invariant_route,omitempty" yaml:"invariant_route"` +} + +func (m *MsgVerifyInvariant) Reset() { *m = MsgVerifyInvariant{} } +func (m *MsgVerifyInvariant) String() string { return proto.CompactTextString(m) } +func (*MsgVerifyInvariant) ProtoMessage() {} +func (*MsgVerifyInvariant) Descriptor() ([]byte, []int) { + return fileDescriptor_df1c0b8e580cce76, []int{0} +} +func (m *MsgVerifyInvariant) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgVerifyInvariant) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgVerifyInvariant.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgVerifyInvariant) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgVerifyInvariant.Merge(m, src) +} +func (m *MsgVerifyInvariant) XXX_Size() int { + return m.Size() +} +func (m *MsgVerifyInvariant) XXX_DiscardUnknown() { + xxx_messageInfo_MsgVerifyInvariant.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgVerifyInvariant proto.InternalMessageInfo + +func (m *MsgVerifyInvariant) GetSender() github_com_cosmos_cosmos_sdk_types.AccAddress { + if m != nil { + return m.Sender + } + return nil +} + +func (m *MsgVerifyInvariant) GetInvariantModuleName() string { + if m != nil { + return m.InvariantModuleName + } + return "" +} + +func (m *MsgVerifyInvariant) GetInvariantRoute() string { + if m != nil { + return m.InvariantRoute + } + return "" +} + +func init() { + proto.RegisterType((*MsgVerifyInvariant)(nil), "cosmos_sdk.x.crisis.v1.MsgVerifyInvariant") +} + +func init() { + proto.RegisterFile("x/crisis/internal/types/types.proto", fileDescriptor_df1c0b8e580cce76) +} + +var fileDescriptor_df1c0b8e580cce76 = []byte{ + // 310 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x90, 0x3f, 0x4b, 0x03, 0x31, + 0x1c, 0x86, 0x9b, 0x8a, 0x05, 0x0f, 0xff, 0xc0, 0x89, 0xa5, 0x14, 0xc9, 0x95, 0x13, 0xa4, 0x4b, + 0x2f, 0x88, 0x9b, 0x5b, 0xcf, 0xc9, 0xa1, 0x0e, 0x87, 0x38, 0x74, 0x39, 0xd2, 0x4b, 0xbc, 0x86, + 0x36, 0x49, 0x49, 0xd2, 0xd2, 0xfb, 0x0c, 0x2e, 0x7e, 0x2c, 0xc7, 0x8e, 0x4e, 0x87, 0xb4, 0xdf, + 0xa0, 0xa3, 0x93, 0x98, 0x9c, 0x2d, 0x88, 0x4b, 0x12, 0x1e, 0x9e, 0xbc, 0xbf, 0x37, 0xf1, 0xae, + 0x96, 0x28, 0x53, 0x4c, 0x33, 0x8d, 0x98, 0x30, 0x54, 0x09, 0x3c, 0x45, 0xa6, 0x98, 0x51, 0xed, + 0xd6, 0x68, 0xa6, 0xa4, 0x91, 0x7e, 0x33, 0x93, 0x9a, 0x4b, 0x9d, 0x6a, 0x32, 0x89, 0x96, 0x91, + 0xf3, 0xa3, 0xc5, 0x4d, 0xfb, 0xda, 0x8c, 0x99, 0x22, 0xe9, 0x0c, 0x2b, 0x53, 0x20, 0xab, 0xa2, + 0x5c, 0xe6, 0x72, 0x7f, 0x72, 0xf7, 0xc3, 0xd7, 0xba, 0xe7, 0x0f, 0x74, 0xfe, 0x4c, 0x15, 0x7b, + 0x29, 0x1e, 0xc4, 0x02, 0x2b, 0x86, 0x85, 0xf1, 0x87, 0x5e, 0x43, 0x53, 0x41, 0xa8, 0x6a, 0x81, + 0x0e, 0xe8, 0x1e, 0xc7, 0xf1, 0xb6, 0x0c, 0x4e, 0x0a, 0xcc, 0xa7, 0x77, 0xa1, 0xe3, 0xe1, 0x57, + 0x19, 0xf4, 0x72, 0x66, 0xc6, 0xf3, 0x51, 0x94, 0x49, 0x8e, 0x5c, 0x8d, 0x6a, 0xeb, 0x69, 0x32, + 0xa9, 0x5a, 0xf6, 0xb3, 0xac, 0x4f, 0x88, 0xa2, 0x5a, 0x27, 0x55, 0xa2, 0xff, 0xe4, 0x5d, 0xb0, + 0xdf, 0x41, 0x29, 0x97, 0x64, 0x3e, 0xa5, 0xa9, 0xc0, 0x9c, 0xb6, 0xea, 0x1d, 0xd0, 0x3d, 0x8a, + 0x3b, 0xdb, 0x32, 0xb8, 0x74, 0xa3, 0xfe, 0xd5, 0xc2, 0xe4, 0x7c, 0xc7, 0x07, 0x16, 0x3f, 0x62, + 0x4e, 0xfd, 0x7b, 0xef, 0x6c, 0xaf, 0x2b, 0x39, 0x37, 0xb4, 0x75, 0x60, 0xf3, 0xda, 0xdb, 0x32, + 0x68, 0xfe, 0xcd, 0xb3, 0x42, 0x98, 0x9c, 0xee, 0x48, 0xf2, 0x03, 0xe2, 0xe0, 0x7d, 0x0d, 0xc1, + 0x6a, 0x0d, 0xc1, 0xe7, 0x1a, 0x82, 0xb7, 0x0d, 0xac, 0xad, 0x36, 0xb0, 0xf6, 0xb1, 0x81, 0xb5, + 0xe1, 0xa1, 0x7d, 0xce, 0xa8, 0x61, 0x7f, 0xed, 0xf6, 0x3b, 0x00, 0x00, 0xff, 0xff, 0x13, 0x54, + 0x5b, 0x16, 0x9c, 0x01, 0x00, 0x00, +} + +func (m *MsgVerifyInvariant) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgVerifyInvariant) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgVerifyInvariant) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.InvariantRoute) > 0 { + i -= len(m.InvariantRoute) + copy(dAtA[i:], m.InvariantRoute) + i = encodeVarintTypes(dAtA, i, uint64(len(m.InvariantRoute))) + i-- + dAtA[i] = 0x1a + } + if len(m.InvariantModuleName) > 0 { + i -= len(m.InvariantModuleName) + copy(dAtA[i:], m.InvariantModuleName) + i = encodeVarintTypes(dAtA, i, uint64(len(m.InvariantModuleName))) + i-- + dAtA[i] = 0x12 + } + if len(m.Sender) > 0 { + i -= len(m.Sender) + copy(dAtA[i:], m.Sender) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Sender))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintTypes(dAtA []byte, offset int, v uint64) int { + offset -= sovTypes(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *MsgVerifyInvariant) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Sender) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.InvariantModuleName) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.InvariantRoute) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + return n +} + +func sovTypes(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozTypes(x uint64) (n int) { + return sovTypes(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *MsgVerifyInvariant) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgVerifyInvariant: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgVerifyInvariant: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Sender = append(m.Sender[:0], dAtA[iNdEx:postIndex]...) + if m.Sender == nil { + m.Sender = []byte{} + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field InvariantModuleName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.InvariantModuleName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field InvariantRoute", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.InvariantRoute = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipTypes(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTypes + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTypes + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTypes + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthTypes + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupTypes + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthTypes + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthTypes = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTypes = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupTypes = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/crisis/internal/types/types.proto b/x/crisis/internal/types/types.proto new file mode 100644 index 000000000000..e850a8bdacf7 --- /dev/null +++ b/x/crisis/internal/types/types.proto @@ -0,0 +1,20 @@ +syntax = "proto3"; +package cosmos_sdk.x.crisis.v1; + +option go_package = "types"; + +import "third_party/proto/gogoproto/gogo.proto"; + +// MsgVerifyInvariant - message struct to verify a particular invariance +message MsgVerifyInvariant { + bytes sender = 1 [ + (gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress", + (gogoproto.moretags) = "yaml:\"sender\"" + ]; + string invariant_module_name = 2 [ + (gogoproto.moretags) = "yaml:\"invariant_module_name\"" + ]; + string invariant_route = 3 [ + (gogoproto.moretags) = "yaml:\"invariant_route\"" + ]; +} \ No newline at end of file diff --git a/x/distribution/types/codec.go b/x/distribution/types/codec.go index a2d4bf11eaae..85412d65c77e 100644 --- a/x/distribution/types/codec.go +++ b/x/distribution/types/codec.go @@ -4,7 +4,22 @@ import ( "github.com/cosmos/cosmos-sdk/codec" ) -// Register concrete types on codec codec +type Codec struct { + codec.Marshaler + + // Keep reference to the amino codec to allow backwards compatibility along + // with type, and interface registration. + amino *codec.Codec +} + +func NewCodec(amino *codec.Codec) *Codec { + return &Codec{Marshaler: codec.NewHybridCodec(amino), amino: amino} +} + +// ---------------------------------------------------------------------------- + +// RegisterCodec registers all the necessary crisis module concrete types and +// interfaces with the provided codec reference. func RegisterCodec(cdc *codec.Codec) { cdc.RegisterConcrete(MsgWithdrawDelegatorReward{}, "cosmos-sdk/MsgWithdrawDelegationReward", nil) cdc.RegisterConcrete(MsgWithdrawValidatorCommission{}, "cosmos-sdk/MsgWithdrawValidatorCommission", nil) @@ -13,11 +28,11 @@ func RegisterCodec(cdc *codec.Codec) { } // generic sealed codec to be used throughout module -var ModuleCdc *codec.Codec +var ModuleCdc *Codec func init() { - ModuleCdc = codec.New() - RegisterCodec(ModuleCdc) - codec.RegisterCrypto(ModuleCdc) - ModuleCdc.Seal() + ModuleCdc = NewCodec(codec.New()) + RegisterCodec(ModuleCdc.amino) + codec.RegisterCrypto(ModuleCdc.amino) + ModuleCdc.amino.Seal() } diff --git a/x/distribution/types/msg.go b/x/distribution/types/msg.go index 2068caef149e..4641c95663e9 100644 --- a/x/distribution/types/msg.go +++ b/x/distribution/types/msg.go @@ -9,12 +9,6 @@ import ( // Verify interface at compile time var _, _, _ sdk.Msg = &MsgSetWithdrawAddress{}, &MsgWithdrawDelegatorReward{}, &MsgWithdrawValidatorCommission{} -// msg struct for changing the withdraw address for a delegator (or validator self-delegation) -type MsgSetWithdrawAddress struct { - DelegatorAddress sdk.AccAddress `json:"delegator_address" yaml:"delegator_address"` - WithdrawAddress sdk.AccAddress `json:"withdraw_address" yaml:"withdraw_address"` -} - func NewMsgSetWithdrawAddress(delAddr, withdrawAddr sdk.AccAddress) MsgSetWithdrawAddress { return MsgSetWithdrawAddress{ DelegatorAddress: delAddr, @@ -48,12 +42,6 @@ func (msg MsgSetWithdrawAddress) ValidateBasic() error { return nil } -// msg struct for delegation withdraw from a single validator -type MsgWithdrawDelegatorReward struct { - DelegatorAddress sdk.AccAddress `json:"delegator_address" yaml:"delegator_address"` - ValidatorAddress sdk.ValAddress `json:"validator_address" yaml:"validator_address"` -} - func NewMsgWithdrawDelegatorReward(delAddr sdk.AccAddress, valAddr sdk.ValAddress) MsgWithdrawDelegatorReward { return MsgWithdrawDelegatorReward{ DelegatorAddress: delAddr, @@ -86,11 +74,6 @@ func (msg MsgWithdrawDelegatorReward) ValidateBasic() error { return nil } -// msg struct for validator withdraw -type MsgWithdrawValidatorCommission struct { - ValidatorAddress sdk.ValAddress `json:"validator_address" yaml:"validator_address"` -} - func NewMsgWithdrawValidatorCommission(valAddr sdk.ValAddress) MsgWithdrawValidatorCommission { return MsgWithdrawValidatorCommission{ ValidatorAddress: valAddr, @@ -121,13 +104,6 @@ func (msg MsgWithdrawValidatorCommission) ValidateBasic() error { const TypeMsgFundCommunityPool = "fund_community_pool" -// MsgFundCommunityPool defines a Msg type that allows an account to directly -// fund the community pool. -type MsgFundCommunityPool struct { - Amount sdk.Coins `json:"amount" yaml:"amount"` - Depositor sdk.AccAddress `json:"depositor" yaml:"depositor"` -} - // NewMsgFundCommunityPool returns a new MsgFundCommunityPool with a sender and // a funding amount. func NewMsgFundCommunityPool(amount sdk.Coins, depositor sdk.AccAddress) MsgFundCommunityPool { diff --git a/x/distribution/types/types.pb.go b/x/distribution/types/types.pb.go new file mode 100644 index 000000000000..36b9755c296d --- /dev/null +++ b/x/distribution/types/types.pb.go @@ -0,0 +1,1038 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: x/distribution/types/types.proto + +package types + +import ( + fmt "fmt" + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" + types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// msg struct for changing the withdraw address for a delegator (or validator self-delegation) +type MsgSetWithdrawAddress struct { + DelegatorAddress github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"delegator_address,omitempty" yaml:"delegator_address"` + WithdrawAddress github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,2,opt,name=withdraw_address,json=withdrawAddress,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"withdraw_address,omitempty" yaml:"withdraw_address"` +} + +func (m *MsgSetWithdrawAddress) Reset() { *m = MsgSetWithdrawAddress{} } +func (m *MsgSetWithdrawAddress) String() string { return proto.CompactTextString(m) } +func (*MsgSetWithdrawAddress) ProtoMessage() {} +func (*MsgSetWithdrawAddress) Descriptor() ([]byte, []int) { + return fileDescriptor_9fddf2a8e4a90b09, []int{0} +} +func (m *MsgSetWithdrawAddress) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgSetWithdrawAddress) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgSetWithdrawAddress.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgSetWithdrawAddress) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSetWithdrawAddress.Merge(m, src) +} +func (m *MsgSetWithdrawAddress) XXX_Size() int { + return m.Size() +} +func (m *MsgSetWithdrawAddress) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSetWithdrawAddress.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgSetWithdrawAddress proto.InternalMessageInfo + +func (m *MsgSetWithdrawAddress) GetDelegatorAddress() github_com_cosmos_cosmos_sdk_types.AccAddress { + if m != nil { + return m.DelegatorAddress + } + return nil +} + +func (m *MsgSetWithdrawAddress) GetWithdrawAddress() github_com_cosmos_cosmos_sdk_types.AccAddress { + if m != nil { + return m.WithdrawAddress + } + return nil +} + +// msg struct for delegation withdraw from a single validator +type MsgWithdrawDelegatorReward struct { + DelegatorAddress github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"delegator_address,omitempty" yaml:"delegator_address"` + ValidatorAddress github_com_cosmos_cosmos_sdk_types.ValAddress `protobuf:"bytes,2,opt,name=validator_address,json=validatorAddress,proto3,casttype=github.com/cosmos/cosmos-sdk/types.ValAddress" json:"validator_address,omitempty" yaml:"validator_address"` +} + +func (m *MsgWithdrawDelegatorReward) Reset() { *m = MsgWithdrawDelegatorReward{} } +func (m *MsgWithdrawDelegatorReward) String() string { return proto.CompactTextString(m) } +func (*MsgWithdrawDelegatorReward) ProtoMessage() {} +func (*MsgWithdrawDelegatorReward) Descriptor() ([]byte, []int) { + return fileDescriptor_9fddf2a8e4a90b09, []int{1} +} +func (m *MsgWithdrawDelegatorReward) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgWithdrawDelegatorReward) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgWithdrawDelegatorReward.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgWithdrawDelegatorReward) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgWithdrawDelegatorReward.Merge(m, src) +} +func (m *MsgWithdrawDelegatorReward) XXX_Size() int { + return m.Size() +} +func (m *MsgWithdrawDelegatorReward) XXX_DiscardUnknown() { + xxx_messageInfo_MsgWithdrawDelegatorReward.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgWithdrawDelegatorReward proto.InternalMessageInfo + +func (m *MsgWithdrawDelegatorReward) GetDelegatorAddress() github_com_cosmos_cosmos_sdk_types.AccAddress { + if m != nil { + return m.DelegatorAddress + } + return nil +} + +func (m *MsgWithdrawDelegatorReward) GetValidatorAddress() github_com_cosmos_cosmos_sdk_types.ValAddress { + if m != nil { + return m.ValidatorAddress + } + return nil +} + +// msg struct for validator withdraw +type MsgWithdrawValidatorCommission struct { + ValidatorAddress github_com_cosmos_cosmos_sdk_types.ValAddress `protobuf:"bytes,1,opt,name=validator_address,json=validatorAddress,proto3,casttype=github.com/cosmos/cosmos-sdk/types.ValAddress" json:"validator_address,omitempty" yaml:"validator_address"` +} + +func (m *MsgWithdrawValidatorCommission) Reset() { *m = MsgWithdrawValidatorCommission{} } +func (m *MsgWithdrawValidatorCommission) String() string { return proto.CompactTextString(m) } +func (*MsgWithdrawValidatorCommission) ProtoMessage() {} +func (*MsgWithdrawValidatorCommission) Descriptor() ([]byte, []int) { + return fileDescriptor_9fddf2a8e4a90b09, []int{2} +} +func (m *MsgWithdrawValidatorCommission) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgWithdrawValidatorCommission) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgWithdrawValidatorCommission.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgWithdrawValidatorCommission) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgWithdrawValidatorCommission.Merge(m, src) +} +func (m *MsgWithdrawValidatorCommission) XXX_Size() int { + return m.Size() +} +func (m *MsgWithdrawValidatorCommission) XXX_DiscardUnknown() { + xxx_messageInfo_MsgWithdrawValidatorCommission.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgWithdrawValidatorCommission proto.InternalMessageInfo + +func (m *MsgWithdrawValidatorCommission) GetValidatorAddress() github_com_cosmos_cosmos_sdk_types.ValAddress { + if m != nil { + return m.ValidatorAddress + } + return nil +} + +// MsgFundCommunityPool defines a Msg type that allows an account to directly +// fund the community pool. +type MsgFundCommunityPool struct { + Amount github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,1,rep,name=amount,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"amount"` + Depositor github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,2,opt,name=depositor,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"depositor,omitempty" yaml:"depositor"` +} + +func (m *MsgFundCommunityPool) Reset() { *m = MsgFundCommunityPool{} } +func (m *MsgFundCommunityPool) String() string { return proto.CompactTextString(m) } +func (*MsgFundCommunityPool) ProtoMessage() {} +func (*MsgFundCommunityPool) Descriptor() ([]byte, []int) { + return fileDescriptor_9fddf2a8e4a90b09, []int{3} +} +func (m *MsgFundCommunityPool) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgFundCommunityPool) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgFundCommunityPool.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgFundCommunityPool) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgFundCommunityPool.Merge(m, src) +} +func (m *MsgFundCommunityPool) XXX_Size() int { + return m.Size() +} +func (m *MsgFundCommunityPool) XXX_DiscardUnknown() { + xxx_messageInfo_MsgFundCommunityPool.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgFundCommunityPool proto.InternalMessageInfo + +func (m *MsgFundCommunityPool) GetAmount() github_com_cosmos_cosmos_sdk_types.Coins { + if m != nil { + return m.Amount + } + return nil +} + +func (m *MsgFundCommunityPool) GetDepositor() github_com_cosmos_cosmos_sdk_types.AccAddress { + if m != nil { + return m.Depositor + } + return nil +} + +func init() { + proto.RegisterType((*MsgSetWithdrawAddress)(nil), "cosmos_sdk.x.ditribution.v1.MsgSetWithdrawAddress") + proto.RegisterType((*MsgWithdrawDelegatorReward)(nil), "cosmos_sdk.x.ditribution.v1.MsgWithdrawDelegatorReward") + proto.RegisterType((*MsgWithdrawValidatorCommission)(nil), "cosmos_sdk.x.ditribution.v1.MsgWithdrawValidatorCommission") + proto.RegisterType((*MsgFundCommunityPool)(nil), "cosmos_sdk.x.ditribution.v1.MsgFundCommunityPool") +} + +func init() { proto.RegisterFile("x/distribution/types/types.proto", fileDescriptor_9fddf2a8e4a90b09) } + +var fileDescriptor_9fddf2a8e4a90b09 = []byte{ + // 444 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x93, 0x4d, 0x8b, 0xd3, 0x40, + 0x1c, 0xc6, 0x33, 0x11, 0x17, 0x1c, 0x05, 0xdb, 0xa8, 0x58, 0x2a, 0x24, 0x25, 0x07, 0xe9, 0x65, + 0x13, 0x57, 0x6f, 0xde, 0xb6, 0xab, 0x9e, 0x0c, 0x48, 0x85, 0x15, 0x04, 0x29, 0xd3, 0x4c, 0x48, + 0x87, 0x4d, 0xf2, 0x0f, 0x33, 0x93, 0x66, 0xb3, 0x9f, 0xc1, 0x83, 0x07, 0x8f, 0x7e, 0x02, 0x3f, + 0xc9, 0x1e, 0xf7, 0x28, 0x1e, 0xa2, 0xb4, 0xdf, 0xa0, 0x47, 0x4f, 0xb2, 0x79, 0xeb, 0x9b, 0x87, + 0xd2, 0x83, 0x7b, 0x49, 0x42, 0xe6, 0x99, 0xe7, 0xf7, 0xe4, 0x99, 0xfc, 0x71, 0xef, 0xdc, 0xa6, + 0x4c, 0x48, 0xce, 0xc6, 0x89, 0x64, 0x10, 0xd9, 0x32, 0x8b, 0x3d, 0x51, 0x5e, 0xad, 0x98, 0x83, + 0x04, 0xed, 0x89, 0x0b, 0x22, 0x04, 0x31, 0x12, 0xf4, 0xcc, 0x3a, 0xb7, 0x28,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 0x21, 0x18, 0x44, 0xff, 0x8e, 0x87, 0xfe, 0x4f, 0xbc, 0x9f, 0x08, 0x3f, 0x74, + 0x84, 0xff, 0x26, 0x89, 0xe8, 0x75, 0xa2, 0x24, 0x62, 0x32, 0x7b, 0x07, 0x10, 0x68, 0x9f, 0xf0, + 0x01, 0x09, 0x21, 0x89, 0x64, 0x07, 0xf5, 0x6e, 0xf5, 0xef, 0x3e, 0x7f, 0x60, 0xad, 0x8c, 0xd1, + 0xf4, 0xc8, 0x3a, 0x01, 0x16, 0x0d, 0x9e, 0x5d, 0xe6, 0x86, 0xf2, 0xfd, 0x97, 0xd1, 0xdf, 0x21, + 0xc6, 0xf5, 0x06, 0x31, 0xac, 0x4c, 0x35, 0x17, 0xdf, 0xa1, 0x5e, 0x0c, 0x82, 0x49, 0xe0, 0xd5, + 0x51, 0xbc, 0x5e, 0xe4, 0x46, 0xab, 0xfe, 0x0d, 0xaa, 0xa5, 0x3d, 0x8e, 0x7f, 0xe9, 0x3b, 0x30, + 0x2e, 0x67, 0x3a, 0xba, 0x9a, 0xe9, 0xe8, 0xf7, 0x4c, 0x47, 0x5f, 0xe6, 0xba, 0x72, 0x35, 0xd7, + 0x95, 0x1f, 0x73, 0x5d, 0xf9, 0x78, 0xbb, 0xd8, 0x36, 0x3e, 0x28, 0x26, 0xf9, 0xc5, 0xdf, 0x00, + 0x00, 0x00, 0xff, 0xff, 0xbb, 0x7b, 0xe0, 0xd1, 0x45, 0x04, 0x00, 0x00, +} + +func (m *MsgSetWithdrawAddress) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgSetWithdrawAddress) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgSetWithdrawAddress) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.WithdrawAddress) > 0 { + i -= len(m.WithdrawAddress) + copy(dAtA[i:], m.WithdrawAddress) + i = encodeVarintTypes(dAtA, i, uint64(len(m.WithdrawAddress))) + i-- + dAtA[i] = 0x12 + } + if len(m.DelegatorAddress) > 0 { + i -= len(m.DelegatorAddress) + copy(dAtA[i:], m.DelegatorAddress) + i = encodeVarintTypes(dAtA, i, uint64(len(m.DelegatorAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgWithdrawDelegatorReward) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgWithdrawDelegatorReward) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgWithdrawDelegatorReward) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.ValidatorAddress) > 0 { + i -= len(m.ValidatorAddress) + copy(dAtA[i:], m.ValidatorAddress) + i = encodeVarintTypes(dAtA, i, uint64(len(m.ValidatorAddress))) + i-- + dAtA[i] = 0x12 + } + if len(m.DelegatorAddress) > 0 { + i -= len(m.DelegatorAddress) + copy(dAtA[i:], m.DelegatorAddress) + i = encodeVarintTypes(dAtA, i, uint64(len(m.DelegatorAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgWithdrawValidatorCommission) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgWithdrawValidatorCommission) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgWithdrawValidatorCommission) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.ValidatorAddress) > 0 { + i -= len(m.ValidatorAddress) + copy(dAtA[i:], m.ValidatorAddress) + i = encodeVarintTypes(dAtA, i, uint64(len(m.ValidatorAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgFundCommunityPool) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgFundCommunityPool) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgFundCommunityPool) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Depositor) > 0 { + i -= len(m.Depositor) + copy(dAtA[i:], m.Depositor) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Depositor))) + i-- + dAtA[i] = 0x12 + } + if len(m.Amount) > 0 { + for iNdEx := len(m.Amount) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Amount[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func encodeVarintTypes(dAtA []byte, offset int, v uint64) int { + offset -= sovTypes(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *MsgSetWithdrawAddress) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.DelegatorAddress) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.WithdrawAddress) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + return n +} + +func (m *MsgWithdrawDelegatorReward) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.DelegatorAddress) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.ValidatorAddress) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + return n +} + +func (m *MsgWithdrawValidatorCommission) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ValidatorAddress) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + return n +} + +func (m *MsgFundCommunityPool) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Amount) > 0 { + for _, e := range m.Amount { + l = e.Size() + n += 1 + l + sovTypes(uint64(l)) + } + } + l = len(m.Depositor) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + return n +} + +func sovTypes(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozTypes(x uint64) (n int) { + return sovTypes(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *MsgSetWithdrawAddress) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgSetWithdrawAddress: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgSetWithdrawAddress: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddress", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DelegatorAddress = append(m.DelegatorAddress[:0], dAtA[iNdEx:postIndex]...) + if m.DelegatorAddress == nil { + m.DelegatorAddress = []byte{} + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field WithdrawAddress", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.WithdrawAddress = append(m.WithdrawAddress[:0], dAtA[iNdEx:postIndex]...) + if m.WithdrawAddress == nil { + m.WithdrawAddress = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgWithdrawDelegatorReward) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgWithdrawDelegatorReward: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgWithdrawDelegatorReward: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddress", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DelegatorAddress = append(m.DelegatorAddress[:0], dAtA[iNdEx:postIndex]...) + if m.DelegatorAddress == nil { + m.DelegatorAddress = []byte{} + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddress", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ValidatorAddress = append(m.ValidatorAddress[:0], dAtA[iNdEx:postIndex]...) + if m.ValidatorAddress == nil { + m.ValidatorAddress = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgWithdrawValidatorCommission) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgWithdrawValidatorCommission: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgWithdrawValidatorCommission: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddress", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ValidatorAddress = append(m.ValidatorAddress[:0], dAtA[iNdEx:postIndex]...) + if m.ValidatorAddress == nil { + m.ValidatorAddress = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgFundCommunityPool) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgFundCommunityPool: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgFundCommunityPool: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Amount = append(m.Amount, types.Coin{}) + if err := m.Amount[len(m.Amount)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Depositor", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Depositor = append(m.Depositor[:0], dAtA[iNdEx:postIndex]...) + if m.Depositor == nil { + m.Depositor = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipTypes(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTypes + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTypes + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTypes + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthTypes + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupTypes + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthTypes + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthTypes = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTypes = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupTypes = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/distribution/types/types.proto b/x/distribution/types/types.proto new file mode 100644 index 000000000000..b932267954cb --- /dev/null +++ b/x/distribution/types/types.proto @@ -0,0 +1,53 @@ +syntax = "proto3"; +package cosmos_sdk.x.ditribution.v1; + +option go_package = "types"; + +import "third_party/proto/gogoproto/gogo.proto"; +import "types/types.proto"; + +// msg struct for changing the withdraw address for a delegator (or validator self-delegation) +message MsgSetWithdrawAddress { + bytes delegator_address = 1 [ + (gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress", + (gogoproto.moretags) = "yaml:\"delegator_address\"" + ]; + bytes withdraw_address = 2 [ + (gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress", + (gogoproto.moretags) = "yaml:\"withdraw_address\"" + ]; +} + +// msg struct for delegation withdraw from a single validator +message MsgWithdrawDelegatorReward { + bytes delegator_address = 1 [ + (gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress", + (gogoproto.moretags) = "yaml:\"delegator_address\"" + ]; + bytes validator_address = 2 [ + (gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.ValAddress", + (gogoproto.moretags) = "yaml:\"validator_address\"" + ]; +} + +// msg struct for validator withdraw +message MsgWithdrawValidatorCommission { + bytes validator_address = 1 [ + (gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.ValAddress", + (gogoproto.moretags) = "yaml:\"validator_address\"" + ]; +} + +// MsgFundCommunityPool defines a Msg type that allows an account to directly +// fund the community pool. +message MsgFundCommunityPool { + repeated cosmos_sdk.v1.Coin amount = 1 + [ + (gogoproto.nullable) = false, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" + ]; + bytes depositor = 2 [ + (gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress", + (gogoproto.moretags) = "yaml:\"depositor\"" + ]; +} \ No newline at end of file From 7fb0d347f364a7e8521a3f2086063e7e602982bd Mon Sep 17 00:00:00 2001 From: Marko Baricevic Date: Tue, 4 Feb 2020 13:50:05 +0100 Subject: [PATCH 17/46] proto: some more types to proto - move some more types to proto and ahve tests pass Signed-off-by: Marko Baricevic --- x/distribution/types/delegator.go | 13 - x/distribution/types/fee_pool.go | 5 - x/distribution/types/params.go | 8 - x/distribution/types/proposal.go | 8 - x/distribution/types/types.pb.go | 1815 ++++++++++++++++++++++++++--- x/distribution/types/types.proto | 102 +- x/distribution/types/validator.go | 32 +- 7 files changed, 1768 insertions(+), 215 deletions(-) diff --git a/x/distribution/types/delegator.go b/x/distribution/types/delegator.go index 8c9e0b9933ce..850878660780 100644 --- a/x/distribution/types/delegator.go +++ b/x/distribution/types/delegator.go @@ -4,19 +4,6 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" ) -// starting info for a delegator reward period -// tracks the previous validator period, the delegation's amount -// of staking token, and the creation height (to check later on -// if any slashes have occurred) -// NOTE that even though validators are slashed to whole staking tokens, the -// delegators within the validator may be left with less than a full token, -// thus sdk.Dec is used -type DelegatorStartingInfo struct { - PreviousPeriod uint64 `json:"previous_period" yaml:"previous_period"` // period at which the delegation should withdraw starting from - Stake sdk.Dec `json:"stake" yaml:"stake"` // amount of staking token delegated - Height uint64 `json:"creation_height" yaml:"creation_height"` // height at which delegation was created -} - // create a new DelegatorStartingInfo func NewDelegatorStartingInfo(previousPeriod uint64, stake sdk.Dec, height uint64) DelegatorStartingInfo { return DelegatorStartingInfo{ diff --git a/x/distribution/types/fee_pool.go b/x/distribution/types/fee_pool.go index b542ced7be24..645afd401a33 100644 --- a/x/distribution/types/fee_pool.go +++ b/x/distribution/types/fee_pool.go @@ -6,11 +6,6 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" ) -// global fee pool for distribution -type FeePool struct { - CommunityPool sdk.DecCoins `json:"community_pool" yaml:"community_pool"` // pool for community funds yet to be spent -} - // zero fee pool func InitialFeePool() FeePool { return FeePool{ diff --git a/x/distribution/types/params.go b/x/distribution/types/params.go index ac3387e9c48b..23b79c8eee92 100644 --- a/x/distribution/types/params.go +++ b/x/distribution/types/params.go @@ -22,14 +22,6 @@ var ( ParamStoreKeyWithdrawAddrEnabled = []byte("withdrawaddrenabled") ) -// Params defines the set of distribution parameters. -type Params struct { - CommunityTax sdk.Dec `json:"community_tax" yaml:"community_tax"` - BaseProposerReward sdk.Dec `json:"base_proposer_reward" yaml:"base_proposer_reward"` - BonusProposerReward sdk.Dec `json:"bonus_proposer_reward" yaml:"bonus_proposer_reward"` - WithdrawAddrEnabled bool `json:"withdraw_addr_enabled" yaml:"withdraw_addr_enabled"` -} - // ParamKeyTable returns the parameter key table. func ParamKeyTable() params.KeyTable { return params.NewKeyTable().RegisterParamSet(&Params{}) diff --git a/x/distribution/types/proposal.go b/x/distribution/types/proposal.go index 931e111ba719..db65da94286e 100644 --- a/x/distribution/types/proposal.go +++ b/x/distribution/types/proposal.go @@ -21,14 +21,6 @@ func init() { govtypes.RegisterProposalTypeCodec(CommunityPoolSpendProposal{}, "cosmos-sdk/CommunityPoolSpendProposal") } -// CommunityPoolSpendProposal spends from the community pool -type CommunityPoolSpendProposal struct { - Title string `json:"title" yaml:"title"` - Description string `json:"description" yaml:"description"` - Recipient sdk.AccAddress `json:"recipient" yaml:"recipient"` - Amount sdk.Coins `json:"amount" yaml:"amount"` -} - // NewCommunityPoolSpendProposal creates a new community pool spned proposal. func NewCommunityPoolSpendProposal(title, description string, recipient sdk.AccAddress, amount sdk.Coins) CommunityPoolSpendProposal { return CommunityPoolSpendProposal{title, description, recipient, amount} diff --git a/x/distribution/types/types.pb.go b/x/distribution/types/types.pb.go index 36b9755c296d..5adbf8882867 100644 --- a/x/distribution/types/types.pb.go +++ b/x/distribution/types/types.pb.go @@ -179,7 +179,7 @@ func (m *MsgWithdrawValidatorCommission) GetValidatorAddress() github_com_cosmos // MsgFundCommunityPool defines a Msg type that allows an account to directly // fund the community pool. type MsgFundCommunityPool struct { - Amount github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,1,rep,name=amount,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"amount"` + Amount github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,1,rep,name=amount,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"amount" yaml:"amount"` Depositor github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,2,opt,name=depositor,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"depositor,omitempty" yaml:"depositor"` } @@ -230,45 +230,388 @@ func (m *MsgFundCommunityPool) GetDepositor() github_com_cosmos_cosmos_sdk_types return nil } +// Params defines the set of distribution parameters. +type Params struct { + CommunityTax github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,1,opt,name=community_tax,json=communityTax,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"community_tax" yaml:"community_tax"` + BaseProposerReward github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=base_proposer_reward,json=baseProposerReward,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"base_proposer_reward" yaml:"base_proposer_reward"` + BonusProposerReward github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=bonus_proposer_reward,json=bonusProposerReward,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"bonus_proposer_reward" yaml:"bonus_proposer_reward"` + WithdrawAddrEnabled bool `protobuf:"varint,4,opt,name=withdraw_addr_enabled,json=withdrawAddrEnabled,proto3" json:"withdraw_addr_enabled,omitempty" yaml:"withdraw_addr_enabled"` +} + +func (m *Params) Reset() { *m = Params{} } +func (*Params) ProtoMessage() {} +func (*Params) Descriptor() ([]byte, []int) { + return fileDescriptor_9fddf2a8e4a90b09, []int{4} +} +func (m *Params) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Params.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Params) XXX_Merge(src proto.Message) { + xxx_messageInfo_Params.Merge(m, src) +} +func (m *Params) XXX_Size() int { + return m.Size() +} +func (m *Params) XXX_DiscardUnknown() { + xxx_messageInfo_Params.DiscardUnknown(m) +} + +var xxx_messageInfo_Params proto.InternalMessageInfo + +func (m *Params) GetWithdrawAddrEnabled() bool { + if m != nil { + return m.WithdrawAddrEnabled + } + return false +} + +// historical rewards for a validator +// height is implicit within the store key +// cumulative reward ratio is the sum from the zeroeth period +// until this period of rewards / tokens, per the spec +// The reference count indicates the number of objects +// which might need to reference this historical entry +// at any point. +// ReferenceCount = +// number of outstanding delegations which ended the associated period (and might need to read that record) +// + number of slashes which ended the associated period (and might need to read that record) +// + one per validator for the zeroeth period, set on initialization +type ValidatorHistoricalRewards struct { + CumulativeRewardRatio github_com_cosmos_cosmos_sdk_types.DecCoins `protobuf:"bytes,1,rep,name=cumulative_reward_ratio,json=cumulativeRewardRatio,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.DecCoins" json:"cumulative_reward_ratio" yaml:"cumulative_reward_ratio"` + ReferenceCount uint32 `protobuf:"varint,2,opt,name=reference_count,json=referenceCount,proto3" json:"reference_count,omitempty"` +} + +func (m *ValidatorHistoricalRewards) Reset() { *m = ValidatorHistoricalRewards{} } +func (m *ValidatorHistoricalRewards) String() string { return proto.CompactTextString(m) } +func (*ValidatorHistoricalRewards) ProtoMessage() {} +func (*ValidatorHistoricalRewards) Descriptor() ([]byte, []int) { + return fileDescriptor_9fddf2a8e4a90b09, []int{5} +} +func (m *ValidatorHistoricalRewards) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ValidatorHistoricalRewards) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ValidatorHistoricalRewards.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ValidatorHistoricalRewards) XXX_Merge(src proto.Message) { + xxx_messageInfo_ValidatorHistoricalRewards.Merge(m, src) +} +func (m *ValidatorHistoricalRewards) XXX_Size() int { + return m.Size() +} +func (m *ValidatorHistoricalRewards) XXX_DiscardUnknown() { + xxx_messageInfo_ValidatorHistoricalRewards.DiscardUnknown(m) +} + +var xxx_messageInfo_ValidatorHistoricalRewards proto.InternalMessageInfo + +func (m *ValidatorHistoricalRewards) GetCumulativeRewardRatio() github_com_cosmos_cosmos_sdk_types.DecCoins { + if m != nil { + return m.CumulativeRewardRatio + } + return nil +} + +func (m *ValidatorHistoricalRewards) GetReferenceCount() uint32 { + if m != nil { + return m.ReferenceCount + } + return 0 +} + +// validator slash event +// height is implicit within the store key +// needed to calculate appropriate amounts of staking token +// for delegations which withdraw after a slash has occurred +type ValidatorSlashEvent struct { + ValidatorPeriod uint64 `protobuf:"varint,1,opt,name=validator_period,json=validatorPeriod,proto3" json:"validator_period,omitempty" yaml:"validator_period"` + Fraction github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=fraction,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"fraction" yaml:"fraction"` +} + +func (m *ValidatorSlashEvent) Reset() { *m = ValidatorSlashEvent{} } +func (m *ValidatorSlashEvent) String() string { return proto.CompactTextString(m) } +func (*ValidatorSlashEvent) ProtoMessage() {} +func (*ValidatorSlashEvent) Descriptor() ([]byte, []int) { + return fileDescriptor_9fddf2a8e4a90b09, []int{6} +} +func (m *ValidatorSlashEvent) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ValidatorSlashEvent) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ValidatorSlashEvent.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ValidatorSlashEvent) XXX_Merge(src proto.Message) { + xxx_messageInfo_ValidatorSlashEvent.Merge(m, src) +} +func (m *ValidatorSlashEvent) XXX_Size() int { + return m.Size() +} +func (m *ValidatorSlashEvent) XXX_DiscardUnknown() { + xxx_messageInfo_ValidatorSlashEvent.DiscardUnknown(m) +} + +var xxx_messageInfo_ValidatorSlashEvent proto.InternalMessageInfo + +func (m *ValidatorSlashEvent) GetValidatorPeriod() uint64 { + if m != nil { + return m.ValidatorPeriod + } + return 0 +} + +// global fee pool for distribution +type FeePool struct { + CommunityPool github_com_cosmos_cosmos_sdk_types.DecCoins `protobuf:"bytes,1,rep,name=community_pool,json=communityPool,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.DecCoins" json:"community_pool" yaml:"community_pool"` +} + +func (m *FeePool) Reset() { *m = FeePool{} } +func (m *FeePool) String() string { return proto.CompactTextString(m) } +func (*FeePool) ProtoMessage() {} +func (*FeePool) Descriptor() ([]byte, []int) { + return fileDescriptor_9fddf2a8e4a90b09, []int{7} +} +func (m *FeePool) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *FeePool) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_FeePool.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *FeePool) XXX_Merge(src proto.Message) { + xxx_messageInfo_FeePool.Merge(m, src) +} +func (m *FeePool) XXX_Size() int { + return m.Size() +} +func (m *FeePool) XXX_DiscardUnknown() { + xxx_messageInfo_FeePool.DiscardUnknown(m) +} + +var xxx_messageInfo_FeePool proto.InternalMessageInfo + +func (m *FeePool) GetCommunityPool() github_com_cosmos_cosmos_sdk_types.DecCoins { + if m != nil { + return m.CommunityPool + } + return nil +} + +type CommunityPoolSpendProposal struct { + Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty" yaml:"title"` + Description string `protobuf:"bytes,2,opt,name=Description,proto3" json:"Description,omitempty" yaml:"description"` + Recipient github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,3,opt,name=recipient,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"recipient,omitempty" yaml:"recipient"` + Amount github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,4,rep,name=amount,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"amount" yaml:"amount"` +} + +func (m *CommunityPoolSpendProposal) Reset() { *m = CommunityPoolSpendProposal{} } +func (*CommunityPoolSpendProposal) ProtoMessage() {} +func (*CommunityPoolSpendProposal) Descriptor() ([]byte, []int) { + return fileDescriptor_9fddf2a8e4a90b09, []int{8} +} +func (m *CommunityPoolSpendProposal) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *CommunityPoolSpendProposal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_CommunityPoolSpendProposal.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *CommunityPoolSpendProposal) XXX_Merge(src proto.Message) { + xxx_messageInfo_CommunityPoolSpendProposal.Merge(m, src) +} +func (m *CommunityPoolSpendProposal) XXX_Size() int { + return m.Size() +} +func (m *CommunityPoolSpendProposal) XXX_DiscardUnknown() { + xxx_messageInfo_CommunityPoolSpendProposal.DiscardUnknown(m) +} + +var xxx_messageInfo_CommunityPoolSpendProposal proto.InternalMessageInfo + +// starting info for a delegator reward period +// tracks the previous validator period, the delegation's amount +// of staking token, and the creation height (to check later on +// if any slashes have occurred) +// NOTE that even though validators are slashed to whole staking tokens, the +// delegators within the validator may be left with less than a full token, +// thus sdk.Dec is used +type DelegatorStartingInfo struct { + PreviousPeriod uint64 `protobuf:"varint,1,opt,name=previous_period,json=previousPeriod,proto3" json:"previous_period,omitempty" yaml:"previous_period"` + Stake github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=stake,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"stake" yaml:"stake"` + Height uint64 `protobuf:"varint,3,opt,name=height,proto3" json:"height,omitempty" yaml:"height"` +} + +func (m *DelegatorStartingInfo) Reset() { *m = DelegatorStartingInfo{} } +func (m *DelegatorStartingInfo) String() string { return proto.CompactTextString(m) } +func (*DelegatorStartingInfo) ProtoMessage() {} +func (*DelegatorStartingInfo) Descriptor() ([]byte, []int) { + return fileDescriptor_9fddf2a8e4a90b09, []int{9} +} +func (m *DelegatorStartingInfo) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *DelegatorStartingInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_DelegatorStartingInfo.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *DelegatorStartingInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_DelegatorStartingInfo.Merge(m, src) +} +func (m *DelegatorStartingInfo) XXX_Size() int { + return m.Size() +} +func (m *DelegatorStartingInfo) XXX_DiscardUnknown() { + xxx_messageInfo_DelegatorStartingInfo.DiscardUnknown(m) +} + +var xxx_messageInfo_DelegatorStartingInfo proto.InternalMessageInfo + +func (m *DelegatorStartingInfo) GetPreviousPeriod() uint64 { + if m != nil { + return m.PreviousPeriod + } + return 0 +} + +func (m *DelegatorStartingInfo) GetHeight() uint64 { + if m != nil { + return m.Height + } + return 0 +} + func init() { proto.RegisterType((*MsgSetWithdrawAddress)(nil), "cosmos_sdk.x.ditribution.v1.MsgSetWithdrawAddress") proto.RegisterType((*MsgWithdrawDelegatorReward)(nil), "cosmos_sdk.x.ditribution.v1.MsgWithdrawDelegatorReward") proto.RegisterType((*MsgWithdrawValidatorCommission)(nil), "cosmos_sdk.x.ditribution.v1.MsgWithdrawValidatorCommission") proto.RegisterType((*MsgFundCommunityPool)(nil), "cosmos_sdk.x.ditribution.v1.MsgFundCommunityPool") + proto.RegisterType((*Params)(nil), "cosmos_sdk.x.ditribution.v1.Params") + proto.RegisterType((*ValidatorHistoricalRewards)(nil), "cosmos_sdk.x.ditribution.v1.ValidatorHistoricalRewards") + proto.RegisterType((*ValidatorSlashEvent)(nil), "cosmos_sdk.x.ditribution.v1.ValidatorSlashEvent") + proto.RegisterType((*FeePool)(nil), "cosmos_sdk.x.ditribution.v1.FeePool") + proto.RegisterType((*CommunityPoolSpendProposal)(nil), "cosmos_sdk.x.ditribution.v1.CommunityPoolSpendProposal") + proto.RegisterType((*DelegatorStartingInfo)(nil), "cosmos_sdk.x.ditribution.v1.DelegatorStartingInfo") } func init() { proto.RegisterFile("x/distribution/types/types.proto", fileDescriptor_9fddf2a8e4a90b09) } var fileDescriptor_9fddf2a8e4a90b09 = []byte{ - // 444 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x93, 0x4d, 0x8b, 0xd3, 0x40, - 0x1c, 0xc6, 0x33, 0x11, 0x17, 0x1c, 0x05, 0xdb, 0xa8, 0x58, 0x2a, 0x24, 0x25, 0x07, 0xe9, 0x65, - 0x13, 0x57, 0x6f, 0xde, 0xb6, 0xab, 0x9e, 0x0c, 0x48, 0x85, 0x15, 0x04, 0x29, 0xd3, 0x4c, 0x48, - 0x87, 0x4d, 0xf2, 0x0f, 0x33, 0x93, 0x66, 0xb3, 0x9f, 0xc1, 0x83, 0x07, 0x8f, 0x7e, 0x02, 0x3f, - 0xc9, 0x1e, 0xf7, 0x28, 0x1e, 0xa2, 0xb4, 0xdf, 0x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 0xe0, 0xd1, 0x45, 0x04, 0x00, 0x00, + // 987 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x56, 0xbf, 0x6f, 0x23, 0x45, + 0x14, 0xf6, 0x26, 0x4e, 0x48, 0xe6, 0x92, 0x38, 0xd9, 0xc4, 0xb9, 0xc8, 0x41, 0x5e, 0x6b, 0x8a, + 0x10, 0x84, 0xce, 0xd6, 0x41, 0x83, 0x52, 0x20, 0xc5, 0xf9, 0x21, 0x90, 0xce, 0x28, 0xda, 0x84, + 0x43, 0x42, 0x42, 0xab, 0xf1, 0xee, 0xc4, 0x1e, 0x65, 0xbd, 0xb3, 0x9a, 0x19, 0xdb, 0xc9, 0x35, + 0x48, 0x54, 0x48, 0x50, 0x50, 0x20, 0x41, 0x41, 0x71, 0x0d, 0x0d, 0x7f, 0x03, 0x7f, 0xc0, 0x95, + 0xd7, 0x81, 0x90, 0x6e, 0x41, 0x49, 0x89, 0x68, 0x5c, 0x52, 0xa1, 0x9d, 0x99, 0xdd, 0xb5, 0x1d, + 0x4b, 0xc4, 0x29, 0x8e, 0x26, 0xb1, 0xdf, 0xbc, 0xfd, 0xbe, 0x6f, 0xde, 0xfb, 0xde, 0xf3, 0x82, + 0xca, 0x65, 0xcd, 0x23, 0x5c, 0x30, 0xd2, 0xec, 0x0a, 0x42, 0x83, 0x9a, 0xb8, 0x0a, 0x31, 0x57, + 0x7f, 0xab, 0x21, 0xa3, 0x82, 0x9a, 0xdb, 0x2e, 0xe5, 0x1d, 0xca, 0x1d, 0xee, 0x5d, 0x54, 0x2f, + 0xab, 0x1e, 0x49, 0x73, 0xab, 0xbd, 0xc7, 0xa5, 0x1d, 0xd1, 0x26, 0xcc, 0x73, 0x42, 0xc4, 0xc4, + 0x55, 0x4d, 0xe6, 0xd7, 0x5a, 0xb4, 0x45, 0xb3, 0x4f, 0x0a, 0xa4, 0xb4, 0x76, 0x0b, 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, 0x9f, 0xda, 0x22, 0x05, 0xc5, 0x96, 0xe0, 0x40, 0x3b, 0x85, 0x84, 0xdf, 0x1b, 0xe0, + 0x8d, 0x63, 0x8c, 0xe5, 0xa6, 0xf9, 0xda, 0x00, 0x2b, 0xd9, 0xf4, 0x84, 0x94, 0xfa, 0xff, 0xd1, + 0x92, 0x27, 0xba, 0x25, 0xc5, 0xf1, 0xc9, 0x8b, 0x9f, 0x9d, 0xba, 0x13, 0xd9, 0x1a, 0x88, 0xd5, + 0xc0, 0x57, 0x33, 0xa0, 0x34, 0xb2, 0x09, 0x4f, 0x43, 0x1c, 0x78, 0xca, 0xc9, 0xc8, 0x37, 0x77, + 0xc0, 0x9c, 0x20, 0xc2, 0xc7, 0x7a, 0x5d, 0xac, 0x0e, 0x22, 0x6b, 0x49, 0xc9, 0x90, 0x61, 0x68, + 0xab, 0x63, 0xf3, 0x7d, 0xf0, 0xe0, 0x10, 0x73, 0x97, 0x91, 0x70, 0xa8, 0x84, 0x9b, 0x83, 0xc8, + 0x32, 0x93, 0x85, 0x96, 0x1e, 0x42, 0x7b, 0x38, 0x35, 0x5e, 0x84, 0x0c, 0xbb, 0x24, 0x24, 0x38, + 0x10, 0x72, 0x3a, 0x47, 0x16, 0x61, 0x7a, 0x74, 0x9f, 0x45, 0x98, 0x3e, 0x3c, 0xb4, 0xdd, 0xf3, + 0xaf, 0x63, 0xbb, 0xef, 0x2d, 0x7c, 0xf5, 0xdc, 0xca, 0xc9, 0x41, 0x7d, 0x65, 0x80, 0x62, 0xfa, + 0x6e, 0x70, 0x2a, 0x10, 0x13, 0x24, 0x68, 0x7d, 0x14, 0x9c, 0x53, 0xf3, 0x00, 0x14, 0x42, 0x86, + 0x7b, 0x84, 0xc6, 0x0b, 0x65, 0xd8, 0xb9, 0xa5, 0x41, 0x64, 0x6d, 0x2a, 0x0d, 0x63, 0x09, 0xd0, + 0x5e, 0x49, 0x22, 0xda, 0xb7, 0x67, 0x60, 0x8e, 0x0b, 0x74, 0x81, 0x75, 0xc5, 0x3f, 0x98, 0xda, + 0xb4, 0xba, 0x9b, 0x12, 0x04, 0xda, 0x0a, 0xcc, 0x7c, 0x1b, 0xcc, 0xb7, 0x31, 0x69, 0xb5, 0x55, + 0x43, 0xf2, 0xf5, 0xb5, 0xac, 0x2a, 0x2a, 0x0e, 0x6d, 0x9d, 0x50, 0xb7, 0x5e, 0x5c, 0x97, 0x8d, + 0x97, 0xd7, 0x65, 0xe3, 0xcf, 0xeb, 0xb2, 0xf1, 0xed, 0x4d, 0x39, 0xf7, 0xf2, 0xa6, 0x9c, 0xfb, + 0xed, 0xa6, 0x9c, 0xfb, 0x6c, 0x4e, 0xd2, 0x34, 0xe7, 0xe5, 0xdb, 0xe3, 0x7b, 0xff, 0x06, 0x00, + 0x00, 0xff, 0xff, 0x26, 0x9b, 0x98, 0x71, 0xb9, 0x0a, 0x00, 0x00, } func (m *MsgSetWithdrawAddress) Marshal() (dAtA []byte, err error) { @@ -419,62 +762,343 @@ func (m *MsgFundCommunityPool) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func encodeVarintTypes(dAtA []byte, offset int, v uint64) int { - offset -= sovTypes(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ +func (m *Params) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - dAtA[offset] = uint8(v) - return base + return dAtA[:n], nil } -func (m *MsgSetWithdrawAddress) Size() (n int) { - if m == nil { - return 0 - } + +func (m *Params) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - l = len(m.DelegatorAddress) - if l > 0 { - n += 1 + l + sovTypes(uint64(l)) + if m.WithdrawAddrEnabled { + i-- + if m.WithdrawAddrEnabled { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x20 } - l = len(m.WithdrawAddress) - if l > 0 { - n += 1 + l + sovTypes(uint64(l)) + { + size := m.BonusProposerReward.Size() + i -= size + if _, err := m.BonusProposerReward.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTypes(dAtA, i, uint64(size)) } - return n + i-- + dAtA[i] = 0x1a + { + size := m.BaseProposerReward.Size() + i -= size + if _, err := m.BaseProposerReward.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + { + size := m.CommunityTax.Size() + i -= size + if _, err := m.CommunityTax.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil } -func (m *MsgWithdrawDelegatorReward) Size() (n int) { - if m == nil { - return 0 +func (m *ValidatorHistoricalRewards) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } + return dAtA[:n], nil +} + +func (m *ValidatorHistoricalRewards) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ValidatorHistoricalRewards) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - l = len(m.DelegatorAddress) - if l > 0 { - n += 1 + l + sovTypes(uint64(l)) + if m.ReferenceCount != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.ReferenceCount)) + i-- + dAtA[i] = 0x10 } - l = len(m.ValidatorAddress) - if l > 0 { - n += 1 + l + sovTypes(uint64(l)) + if len(m.CumulativeRewardRatio) > 0 { + for iNdEx := len(m.CumulativeRewardRatio) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.CumulativeRewardRatio[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } } - return n + return len(dAtA) - i, nil } -func (m *MsgWithdrawValidatorCommission) Size() (n int) { - if m == nil { - return 0 +func (m *ValidatorSlashEvent) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } + return dAtA[:n], nil +} + +func (m *ValidatorSlashEvent) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ValidatorSlashEvent) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - l = len(m.ValidatorAddress) - if l > 0 { - n += 1 + l + sovTypes(uint64(l)) + { + size := m.Fraction.Size() + i -= size + if _, err := m.Fraction.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTypes(dAtA, i, uint64(size)) } - return n + i-- + dAtA[i] = 0x12 + if m.ValidatorPeriod != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.ValidatorPeriod)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *FeePool) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *FeePool) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *FeePool) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.CommunityPool) > 0 { + for iNdEx := len(m.CommunityPool) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.CommunityPool[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *CommunityPoolSpendProposal) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *CommunityPoolSpendProposal) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *CommunityPoolSpendProposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Amount) > 0 { + for iNdEx := len(m.Amount) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Amount[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + } + if len(m.Recipient) > 0 { + i -= len(m.Recipient) + copy(dAtA[i:], m.Recipient) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Recipient))) + i-- + dAtA[i] = 0x1a + } + if len(m.Description) > 0 { + i -= len(m.Description) + copy(dAtA[i:], m.Description) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Description))) + i-- + dAtA[i] = 0x12 + } + if len(m.Title) > 0 { + i -= len(m.Title) + copy(dAtA[i:], m.Title) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Title))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *DelegatorStartingInfo) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *DelegatorStartingInfo) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *DelegatorStartingInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Height != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.Height)) + i-- + dAtA[i] = 0x18 + } + { + size := m.Stake.Size() + i -= size + if _, err := m.Stake.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if m.PreviousPeriod != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.PreviousPeriod)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func encodeVarintTypes(dAtA []byte, offset int, v uint64) int { + offset -= sovTypes(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *MsgSetWithdrawAddress) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.DelegatorAddress) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.WithdrawAddress) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + return n +} + +func (m *MsgWithdrawDelegatorReward) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.DelegatorAddress) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.ValidatorAddress) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + return n +} + +func (m *MsgWithdrawValidatorCommission) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ValidatorAddress) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + return n } func (m *MsgFundCommunityPool) Size() (n int) { @@ -496,13 +1120,747 @@ func (m *MsgFundCommunityPool) Size() (n int) { return n } +func (m *Params) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.CommunityTax.Size() + n += 1 + l + sovTypes(uint64(l)) + l = m.BaseProposerReward.Size() + n += 1 + l + sovTypes(uint64(l)) + l = m.BonusProposerReward.Size() + n += 1 + l + sovTypes(uint64(l)) + if m.WithdrawAddrEnabled { + n += 2 + } + return n +} + +func (m *ValidatorHistoricalRewards) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.CumulativeRewardRatio) > 0 { + for _, e := range m.CumulativeRewardRatio { + l = e.Size() + n += 1 + l + sovTypes(uint64(l)) + } + } + if m.ReferenceCount != 0 { + n += 1 + sovTypes(uint64(m.ReferenceCount)) + } + return n +} + +func (m *ValidatorSlashEvent) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ValidatorPeriod != 0 { + n += 1 + sovTypes(uint64(m.ValidatorPeriod)) + } + l = m.Fraction.Size() + n += 1 + l + sovTypes(uint64(l)) + return n +} + +func (m *FeePool) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.CommunityPool) > 0 { + for _, e := range m.CommunityPool { + l = e.Size() + n += 1 + l + sovTypes(uint64(l)) + } + } + return n +} + +func (m *CommunityPoolSpendProposal) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Title) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.Description) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.Recipient) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + if len(m.Amount) > 0 { + for _, e := range m.Amount { + l = e.Size() + n += 1 + l + sovTypes(uint64(l)) + } + } + return n +} + +func (m *DelegatorStartingInfo) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.PreviousPeriod != 0 { + n += 1 + sovTypes(uint64(m.PreviousPeriod)) + } + l = m.Stake.Size() + n += 1 + l + sovTypes(uint64(l)) + if m.Height != 0 { + n += 1 + sovTypes(uint64(m.Height)) + } + return n +} + func sovTypes(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } func sozTypes(x uint64) (n int) { return sovTypes(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } -func (m *MsgSetWithdrawAddress) Unmarshal(dAtA []byte) error { +func (m *MsgSetWithdrawAddress) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgSetWithdrawAddress: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgSetWithdrawAddress: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddress", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DelegatorAddress = append(m.DelegatorAddress[:0], dAtA[iNdEx:postIndex]...) + if m.DelegatorAddress == nil { + m.DelegatorAddress = []byte{} + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field WithdrawAddress", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.WithdrawAddress = append(m.WithdrawAddress[:0], dAtA[iNdEx:postIndex]...) + if m.WithdrawAddress == nil { + m.WithdrawAddress = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgWithdrawDelegatorReward) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgWithdrawDelegatorReward: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgWithdrawDelegatorReward: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddress", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DelegatorAddress = append(m.DelegatorAddress[:0], dAtA[iNdEx:postIndex]...) + if m.DelegatorAddress == nil { + m.DelegatorAddress = []byte{} + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddress", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ValidatorAddress = append(m.ValidatorAddress[:0], dAtA[iNdEx:postIndex]...) + if m.ValidatorAddress == nil { + m.ValidatorAddress = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgWithdrawValidatorCommission) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgWithdrawValidatorCommission: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgWithdrawValidatorCommission: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddress", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ValidatorAddress = append(m.ValidatorAddress[:0], dAtA[iNdEx:postIndex]...) + if m.ValidatorAddress == nil { + m.ValidatorAddress = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgFundCommunityPool) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgFundCommunityPool: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgFundCommunityPool: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Amount = append(m.Amount, types.Coin{}) + if err := m.Amount[len(m.Amount)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Depositor", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Depositor = append(m.Depositor[:0], dAtA[iNdEx:postIndex]...) + if m.Depositor == nil { + m.Depositor = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Params) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Params: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CommunityTax", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CommunityTax.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BaseProposerReward", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.BaseProposerReward.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BonusProposerReward", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.BonusProposerReward.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field WithdrawAddrEnabled", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.WithdrawAddrEnabled = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ValidatorHistoricalRewards) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -525,17 +1883,17 @@ func (m *MsgSetWithdrawAddress) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgSetWithdrawAddress: wiretype end group for non-group") + return fmt.Errorf("proto: ValidatorHistoricalRewards: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgSetWithdrawAddress: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: ValidatorHistoricalRewards: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddress", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field CumulativeRewardRatio", wireType) } - var byteLen int + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTypes @@ -545,31 +1903,31 @@ func (m *MsgSetWithdrawAddress) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= int(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - if byteLen < 0 { + if msglen < 0 { return ErrInvalidLengthTypes } - postIndex := iNdEx + byteLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthTypes } if postIndex > l { return io.ErrUnexpectedEOF } - m.DelegatorAddress = append(m.DelegatorAddress[:0], dAtA[iNdEx:postIndex]...) - if m.DelegatorAddress == nil { - m.DelegatorAddress = []byte{} + m.CumulativeRewardRatio = append(m.CumulativeRewardRatio, types.DecCoin{}) + if err := m.CumulativeRewardRatio[len(m.CumulativeRewardRatio)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err } iNdEx = postIndex case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field WithdrawAddress", wireType) + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ReferenceCount", wireType) } - var byteLen int + m.ReferenceCount = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTypes @@ -579,26 +1937,11 @@ func (m *MsgSetWithdrawAddress) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= int(b&0x7F) << shift + m.ReferenceCount |= uint32(b&0x7F) << shift if b < 0x80 { break } } - if byteLen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.WithdrawAddress = append(m.WithdrawAddress[:0], dAtA[iNdEx:postIndex]...) - if m.WithdrawAddress == nil { - m.WithdrawAddress = []byte{} - } - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTypes(dAtA[iNdEx:]) @@ -623,7 +1966,7 @@ func (m *MsgSetWithdrawAddress) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgWithdrawDelegatorReward) Unmarshal(dAtA []byte) error { +func (m *ValidatorSlashEvent) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -646,17 +1989,17 @@ func (m *MsgWithdrawDelegatorReward) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgWithdrawDelegatorReward: wiretype end group for non-group") + return fmt.Errorf("proto: ValidatorSlashEvent: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgWithdrawDelegatorReward: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: ValidatorSlashEvent: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DelegatorAddress", wireType) + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorPeriod", wireType) } - var byteLen int + m.ValidatorPeriod = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTypes @@ -666,31 +2009,16 @@ func (m *MsgWithdrawDelegatorReward) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= int(b&0x7F) << shift + m.ValidatorPeriod |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if byteLen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.DelegatorAddress = append(m.DelegatorAddress[:0], dAtA[iNdEx:postIndex]...) - if m.DelegatorAddress == nil { - m.DelegatorAddress = []byte{} - } - iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddress", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Fraction", wireType) } - var byteLen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTypes @@ -700,24 +2028,24 @@ func (m *MsgWithdrawDelegatorReward) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if byteLen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthTypes } - postIndex := iNdEx + byteLen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthTypes } if postIndex > l { return io.ErrUnexpectedEOF } - m.ValidatorAddress = append(m.ValidatorAddress[:0], dAtA[iNdEx:postIndex]...) - if m.ValidatorAddress == nil { - m.ValidatorAddress = []byte{} + if err := m.Fraction.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err } iNdEx = postIndex default: @@ -744,7 +2072,7 @@ func (m *MsgWithdrawDelegatorReward) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgWithdrawValidatorCommission) Unmarshal(dAtA []byte) error { +func (m *FeePool) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -767,17 +2095,17 @@ func (m *MsgWithdrawValidatorCommission) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgWithdrawValidatorCommission: wiretype end group for non-group") + return fmt.Errorf("proto: FeePool: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgWithdrawValidatorCommission: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: FeePool: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddress", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field CommunityPool", wireType) } - var byteLen int + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTypes @@ -787,24 +2115,24 @@ func (m *MsgWithdrawValidatorCommission) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= int(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - if byteLen < 0 { + if msglen < 0 { return ErrInvalidLengthTypes } - postIndex := iNdEx + byteLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthTypes } if postIndex > l { return io.ErrUnexpectedEOF } - m.ValidatorAddress = append(m.ValidatorAddress[:0], dAtA[iNdEx:postIndex]...) - if m.ValidatorAddress == nil { - m.ValidatorAddress = []byte{} + m.CommunityPool = append(m.CommunityPool, types.DecCoin{}) + if err := m.CommunityPool[len(m.CommunityPool)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err } iNdEx = postIndex default: @@ -831,7 +2159,7 @@ func (m *MsgWithdrawValidatorCommission) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgFundCommunityPool) Unmarshal(dAtA []byte) error { +func (m *CommunityPoolSpendProposal) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -854,13 +2182,111 @@ func (m *MsgFundCommunityPool) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgFundCommunityPool: wiretype end group for non-group") + return fmt.Errorf("proto: CommunityPoolSpendProposal: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgFundCommunityPool: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: CommunityPoolSpendProposal: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Title", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Title = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Description = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Recipient", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Recipient = append(m.Recipient[:0], dAtA[iNdEx:postIndex]...) + if m.Recipient == nil { + m.Recipient = []byte{} + } + iNdEx = postIndex + case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) } @@ -894,11 +2320,83 @@ func (m *MsgFundCommunityPool) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DelegatorStartingInfo) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DelegatorStartingInfo: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DelegatorStartingInfo: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field PreviousPeriod", wireType) + } + m.PreviousPeriod = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.PreviousPeriod |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Depositor", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Stake", wireType) } - var byteLen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTypes @@ -908,26 +2406,45 @@ func (m *MsgFundCommunityPool) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if byteLen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthTypes } - postIndex := iNdEx + byteLen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthTypes } if postIndex > l { return io.ErrUnexpectedEOF } - m.Depositor = append(m.Depositor[:0], dAtA[iNdEx:postIndex]...) - if m.Depositor == nil { - m.Depositor = []byte{} + if err := m.Stake.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err } iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Height", wireType) + } + m.Height = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Height |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipTypes(dAtA[iNdEx:]) diff --git a/x/distribution/types/types.proto b/x/distribution/types/types.proto index b932267954cb..23dfa53dd62c 100644 --- a/x/distribution/types/types.proto +++ b/x/distribution/types/types.proto @@ -44,10 +44,110 @@ message MsgFundCommunityPool { repeated cosmos_sdk.v1.Coin amount = 1 [ (gogoproto.nullable) = false, - (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", + (gogoproto.moretags) = "yaml:\"amount\"" ]; bytes depositor = 2 [ (gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress", (gogoproto.moretags) = "yaml:\"depositor\"" ]; +} + +// Params defines the set of distribution parameters. +message Params { + option (gogoproto.goproto_stringer) = false; + string community_tax = 1 [ + (gogoproto.moretags) = "yaml:\"community_tax\"", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; + string base_proposer_reward = 2 [ + (gogoproto.moretags) = "yaml:\"base_proposer_reward\"", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; + string bonus_proposer_reward = 3 [ + (gogoproto.moretags) = "yaml:\"bonus_proposer_reward\"", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; + bool withdraw_addr_enabled = 4 [ + (gogoproto.moretags) = "yaml:\"withdraw_addr_enabled\"" + ]; +} + +// historical rewards for a validator +// height is implicit within the store key +// cumulative reward ratio is the sum from the zeroeth period +// until this period of rewards / tokens, per the spec +// The reference count indicates the number of objects +// which might need to reference this historical entry +// at any point. +// ReferenceCount = +// number of outstanding delegations which ended the associated period (and might need to read that record) +// + number of slashes which ended the associated period (and might need to read that record) +// + one per validator for the zeroeth period, set on initialization +message ValidatorHistoricalRewards { + repeated cosmos_sdk.v1.DecCoin cumulative_reward_ratio = 1 [ + (gogoproto.moretags) = "yaml:\"cumulative_reward_ratio\"", + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins", + (gogoproto.nullable) = false + ]; + uint32 reference_count = 2; +} + +// validator slash event +// height is implicit within the store key +// needed to calculate appropriate amounts of staking token +// for delegations which withdraw after a slash has occurred +message ValidatorSlashEvent { + uint64 validator_period = 1 [(gogoproto.moretags) = "yaml:\"validator_period\"" ]; + string fraction = 2 [ + (gogoproto.moretags) = "yaml:\"fraction\"", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; +} + +// global fee pool for distribution +message FeePool { + repeated cosmos_sdk.v1.DecCoin community_pool = 1 [ + (gogoproto.nullable) = false, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins", + (gogoproto.moretags) = "yaml:\"community_pool\"" + ]; +} + +message CommunityPoolSpendProposal { + option (gogoproto.goproto_stringer) = false; + option (gogoproto.goproto_getters) = false; + string title = 1 [(gogoproto.moretags) = "yaml:\"title\""]; + string Description = 2 [(gogoproto.moretags) = "yaml:\"description\""]; + bytes recipient = 3 [ + (gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress", + (gogoproto.moretags) = "yaml:\"recipient\"" + ]; + repeated cosmos_sdk.v1.Coin amount = 4 + [ + (gogoproto.nullable) = false, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", + (gogoproto.moretags) = "yaml:\"amount\"" + ]; +} + +// starting info for a delegator reward period +// tracks the previous validator period, the delegation's amount +// of staking token, and the creation height (to check later on +// if any slashes have occurred) +// NOTE that even though validators are slashed to whole staking tokens, the +// delegators within the validator may be left with less than a full token, +// thus sdk.Dec is used +message DelegatorStartingInfo { + uint64 previous_period = 1 [ (gogoproto.moretags) = "yaml:\"previous_period\""]; + string stake = 2 [ + (gogoproto.moretags) = "yaml:\"stake\"", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; + uint64 height = 3 [ (gogoproto.moretags) = "yaml:\"height\"" ]; } \ No newline at end of file diff --git a/x/distribution/types/validator.go b/x/distribution/types/validator.go index 9ff1f4c9aa1f..bdfd0f9a1707 100644 --- a/x/distribution/types/validator.go +++ b/x/distribution/types/validator.go @@ -7,24 +7,8 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" ) -// historical rewards for a validator -// height is implicit within the store key -// cumulative reward ratio is the sum from the zeroeth period -// until this period of rewards / tokens, per the spec -// The reference count indicates the number of objects -// which might need to reference this historical entry -// at any point. -// ReferenceCount = -// number of outstanding delegations which ended the associated period (and might need to read that record) -// + number of slashes which ended the associated period (and might need to read that record) -// + one per validator for the zeroeth period, set on initialization -type ValidatorHistoricalRewards struct { - CumulativeRewardRatio sdk.DecCoins `json:"cumulative_reward_ratio" yaml:"cumulative_reward_ratio"` - ReferenceCount uint16 `json:"reference_count" yaml:"reference_count"` -} - // create a new ValidatorHistoricalRewards -func NewValidatorHistoricalRewards(cumulativeRewardRatio sdk.DecCoins, referenceCount uint16) ValidatorHistoricalRewards { +func NewValidatorHistoricalRewards(cumulativeRewardRatio sdk.DecCoins, referenceCount uint32) ValidatorHistoricalRewards { return ValidatorHistoricalRewards{ CumulativeRewardRatio: cumulativeRewardRatio, ReferenceCount: referenceCount, @@ -56,15 +40,6 @@ func InitialValidatorAccumulatedCommission() ValidatorAccumulatedCommission { return ValidatorAccumulatedCommission{} } -// validator slash event -// height is implicit within the store key -// needed to calculate appropriate amounts of staking token -// for delegations which withdraw after a slash has occurred -type ValidatorSlashEvent struct { - ValidatorPeriod uint64 `json:"validator_period" yaml:"validator_period"` // period when the slash occurred - Fraction sdk.Dec `json:"fraction" yaml:"fraction"` // slash fraction -} - // create a new ValidatorSlashEvent func NewValidatorSlashEvent(validatorPeriod uint64, fraction sdk.Dec) ValidatorSlashEvent { return ValidatorSlashEvent{ @@ -73,11 +48,6 @@ func NewValidatorSlashEvent(validatorPeriod uint64, fraction sdk.Dec) ValidatorS } } -func (vs ValidatorSlashEvent) String() string { - return fmt.Sprintf(`Period: %d -Fraction: %s`, vs.ValidatorPeriod, vs.Fraction) -} - // ValidatorSlashEvents is a collection of ValidatorSlashEvent type ValidatorSlashEvents []ValidatorSlashEvent From 6dc3dd93e4372cc272002f5e28dc3b4d09cc7126 Mon Sep 17 00:00:00 2001 From: Marko Baricevic Date: Tue, 4 Feb 2020 14:07:56 +0100 Subject: [PATCH 18/46] fix protolinting --- codec/amino.go | 8 ++++---- codec/codec.go | 4 ++++ x/distribution/keeper/keeper.go | 4 ++-- x/distribution/keeper/store.go | 7 ++++--- x/distribution/keeper/test_common.go | 2 +- x/distribution/types/types.proto | 3 ++- 6 files changed, 17 insertions(+), 11 deletions(-) diff --git a/codec/amino.go b/codec/amino.go index b2300aef6cc3..c0936e70460b 100644 --- a/codec/amino.go +++ b/codec/amino.go @@ -45,8 +45,8 @@ func RegisterEvidences(cdc *Codec) { // MarshalJSONIndent provides a utility for indented JSON encoding of an object // via an Amino codec. It returns an error if it cannot serialize or indent as // JSON. -func MarshalJSONIndent(cdc *Codec, obj interface{}) ([]byte, error) { - bz, err := cdc.MarshalJSON(obj) +func MarshalJSONIndent(m JSONMarshaler, obj interface{}) ([]byte, error) { + bz, err := m.MarshalJSON(obj) if err != nil { return nil, err } @@ -60,8 +60,8 @@ func MarshalJSONIndent(cdc *Codec, obj interface{}) ([]byte, error) { } // MustMarshalJSONIndent executes MarshalJSONIndent except it panics upon failure. -func MustMarshalJSONIndent(cdc *Codec, obj interface{}) []byte { - bz, err := MarshalJSONIndent(cdc, obj) +func MustMarshalJSONIndent(m JSONMarshaler, obj interface{}) []byte { + bz, err := MarshalJSONIndent(m, obj) if err != nil { panic(fmt.Sprintf("failed to marshal JSON: %s", err)) } diff --git a/codec/codec.go b/codec/codec.go index 203a1ec1bbb6..323d2607c851 100644 --- a/codec/codec.go +++ b/codec/codec.go @@ -30,6 +30,10 @@ type ( UnmarshalBinaryLengthPrefixed(bz []byte, ptr ProtoMarshaler) error MustUnmarshalBinaryLengthPrefixed(bz []byte, ptr ProtoMarshaler) + JSONMarshaler + } + + JSONMarshaler interface { MarshalJSON(o interface{}) ([]byte, error) // nolint: stdmethods MustMarshalJSON(o interface{}) []byte diff --git a/x/distribution/keeper/keeper.go b/x/distribution/keeper/keeper.go index 5cce89d0c33f..a92102fc6f34 100644 --- a/x/distribution/keeper/keeper.go +++ b/x/distribution/keeper/keeper.go @@ -15,7 +15,7 @@ import ( // Keeper of the distribution store type Keeper struct { storeKey sdk.StoreKey - cdc *codec.Codec + cdc codec.Marshaler paramSpace params.Subspace bankKeeper types.BankKeeper stakingKeeper types.StakingKeeper @@ -28,7 +28,7 @@ type Keeper struct { // NewKeeper creates a new distribution Keeper instance func NewKeeper( - cdc *codec.Codec, key sdk.StoreKey, paramSpace params.Subspace, bk types.BankKeeper, + cdc codec.Marshaler, key sdk.StoreKey, paramSpace params.Subspace, bk types.BankKeeper, sk types.StakingKeeper, supplyKeeper types.SupplyKeeper, feeCollectorName string, blacklistedAddrs map[string]bool, ) Keeper { diff --git a/x/distribution/keeper/store.go b/x/distribution/keeper/store.go index e1a1c50d4343..da8f5cebc2ee 100644 --- a/x/distribution/keeper/store.go +++ b/x/distribution/keeper/store.go @@ -62,11 +62,12 @@ func (k Keeper) SetFeePool(ctx sdk.Context, feePool types.FeePool) { // get the proposer public key for this block func (k Keeper) GetPreviousProposerConsAddr(ctx sdk.Context) (consAddr sdk.ConsAddress) { store := ctx.KVStore(k.storeKey) - b := store.Get(types.ProposerKey) - if b == nil { + bz := store.Get(types.ProposerKey) + if bz == nil { panic("Previous proposer not set") } - k.cdc.MustUnmarshalBinaryLengthPrefixed(b, &consAddr) + conAddr := sdk.ConsAddress{} + k.cdc.MustUnmarshalBinaryLengthPrefixed(bz, &conAddr) return } diff --git a/x/distribution/keeper/test_common.go b/x/distribution/keeper/test_common.go index e049c3bbc57a..f94925a783cf 100644 --- a/x/distribution/keeper/test_common.go +++ b/x/distribution/keeper/test_common.go @@ -142,7 +142,7 @@ func CreateTestInputAdvanced( sk := staking.NewKeeper(cdc, keyStaking, bankKeeper, supplyKeeper, pk.Subspace(staking.DefaultParamspace)) sk.SetParams(ctx, staking.DefaultParams()) - keeper := NewKeeper(cdc, keyDistr, pk.Subspace(types.DefaultParamspace), bankKeeper, sk, supplyKeeper, auth.FeeCollectorName, blacklistedAddrs) + keeper := NewKeeper(types.ModuleCdc, keyDistr, pk.Subspace(types.DefaultParamspace), bankKeeper, sk, supplyKeeper, auth.FeeCollectorName, blacklistedAddrs) initCoins := sdk.NewCoins(sdk.NewCoin(sk.BondDenom(ctx), initTokens)) totalSupply := sdk.NewCoins(sdk.NewCoin(sk.BondDenom(ctx), initTokens.MulRaw(int64(len(TestAddrs))))) diff --git a/x/distribution/types/types.proto b/x/distribution/types/types.proto index 23dfa53dd62c..06f19519b6ad 100644 --- a/x/distribution/types/types.proto +++ b/x/distribution/types/types.proto @@ -118,11 +118,12 @@ message FeePool { ]; } +// CommunityPoolSpendProposal spends from the community pool message CommunityPoolSpendProposal { option (gogoproto.goproto_stringer) = false; option (gogoproto.goproto_getters) = false; string title = 1 [(gogoproto.moretags) = "yaml:\"title\""]; - string Description = 2 [(gogoproto.moretags) = "yaml:\"description\""]; + string description = 2 [(gogoproto.moretags) = "yaml:\"description\""]; bytes recipient = 3 [ (gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress", (gogoproto.moretags) = "yaml:\"recipient\"" From 245040983eecdebf57ec6966bf511bf6c7a28b97 Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Tue, 4 Feb 2020 11:00:31 -0500 Subject: [PATCH 19/46] Linting --- x/staking/keeper/delegation.go | 8 +++++--- x/staking/keeper/query_utils.go | 2 +- x/staking/types/delegation.go | 5 +---- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/x/staking/keeper/delegation.go b/x/staking/keeper/delegation.go index 375fad90313b..00d108079dfa 100644 --- a/x/staking/keeper/delegation.go +++ b/x/staking/keeper/delegation.go @@ -194,9 +194,10 @@ func (k Keeper) RemoveUnbondingDelegation(ctx sdk.Context, ubd types.UnbondingDe // SetUnbondingDelegationEntry adds an entry to the unbonding delegation at // the given addresses. It creates the unbonding delegation if it does not exist -func (k Keeper) SetUnbondingDelegationEntry(ctx sdk.Context, - delegatorAddr sdk.AccAddress, validatorAddr sdk.ValAddress, - creationHeight int64, minTime time.Time, balance sdk.Int) types.UnbondingDelegation { +func (k Keeper) SetUnbondingDelegationEntry( + ctx sdk.Context, delegatorAddr sdk.AccAddress, validatorAddr sdk.ValAddress, + creationHeight int64, minTime time.Time, balance sdk.Int, +) types.UnbondingDelegation { ubd, found := k.GetUnbondingDelegation(ctx, delegatorAddr, validatorAddr) if found { @@ -204,6 +205,7 @@ func (k Keeper) SetUnbondingDelegationEntry(ctx sdk.Context, } else { ubd = types.NewUnbondingDelegation(delegatorAddr, validatorAddr, creationHeight, minTime, balance) } + k.SetUnbondingDelegation(ctx, ubd) return ubd } diff --git a/x/staking/keeper/query_utils.go b/x/staking/keeper/query_utils.go index ae7cf634600a..e29e73c899ef 100644 --- a/x/staking/keeper/query_utils.go +++ b/x/staking/keeper/query_utils.go @@ -93,7 +93,7 @@ func (k Keeper) GetAllUnbondingDelegations(ctx sdk.Context, delegator sdk.AccAdd // return all redelegations for a delegator func (k Keeper) GetAllRedelegations( ctx sdk.Context, delegator sdk.AccAddress, srcValAddress, dstValAddress sdk.ValAddress, -) ([]types.Redelegation) { +) []types.Redelegation { store := ctx.KVStore(k.storeKey) delegatorPrefixKey := types.GetREDsKey(delegator) diff --git a/x/staking/types/delegation.go b/x/staking/types/delegation.go index bdb3193ebe9c..f3d7289242ec 100644 --- a/x/staking/types/delegation.go +++ b/x/staking/types/delegation.go @@ -206,10 +206,7 @@ func NewRedelegation( } // AddEntry - append entry to the unbonding delegation -func (d *Redelegation) AddEntry(creationHeight int64, - minTime time.Time, balance sdk.Int, - sharesDst sdk.Dec) { - +func (d *Redelegation) AddEntry(creationHeight int64, minTime time.Time, balance sdk.Int, sharesDst sdk.Dec) { entry := NewRedelegationEntry(creationHeight, minTime, balance, sharesDst) d.Entries = append(d.Entries, entry) } From 1ce8248fc9e861431430a66546de0393f0b44991 Mon Sep 17 00:00:00 2001 From: Marko Baricevic Date: Tue, 4 Feb 2020 17:07:43 +0100 Subject: [PATCH 20/46] minor reading, will wait on staking pr to be merged --- x/distribution/keeper/store.go | 10 +++++----- x/distribution/types/types.proto | 14 +++++++++++++- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/x/distribution/keeper/store.go b/x/distribution/keeper/store.go index da8f5cebc2ee..9c4e02698edc 100644 --- a/x/distribution/keeper/store.go +++ b/x/distribution/keeper/store.go @@ -74,7 +74,7 @@ func (k Keeper) GetPreviousProposerConsAddr(ctx sdk.Context) (consAddr sdk.ConsA // set the proposer public key for this block func (k Keeper) SetPreviousProposerConsAddr(ctx sdk.Context, consAddr sdk.ConsAddress) { store := ctx.KVStore(k.storeKey) - b := k.cdc.MustMarshalBinaryLengthPrefixed(consAddr) + b := k.cdc.MustMarshalBinaryLengthPrefixed(&consAddr) store.Set(types.ProposerKey, b) } @@ -89,7 +89,7 @@ func (k Keeper) GetDelegatorStartingInfo(ctx sdk.Context, val sdk.ValAddress, de // set the starting info associated with a delegator func (k Keeper) SetDelegatorStartingInfo(ctx sdk.Context, val sdk.ValAddress, del sdk.AccAddress, period types.DelegatorStartingInfo) { store := ctx.KVStore(k.storeKey) - b := k.cdc.MustMarshalBinaryLengthPrefixed(period) + b := k.cdc.MustMarshalBinaryLengthPrefixed(&period) store.Set(types.GetDelegatorStartingInfoKey(val, del), b) } @@ -282,7 +282,7 @@ func (k Keeper) GetValidatorOutstandingRewards(ctx sdk.Context, val sdk.ValAddre // set validator outstanding rewards func (k Keeper) SetValidatorOutstandingRewards(ctx sdk.Context, val sdk.ValAddress, rewards types.ValidatorOutstandingRewards) { store := ctx.KVStore(k.storeKey) - b := k.cdc.MustMarshalBinaryLengthPrefixed(rewards) + b := k.cdc.MustMarshalBinaryLengthPrefixed(&rewards) store.Set(types.GetValidatorOutstandingRewardsKey(val), b) } @@ -298,7 +298,7 @@ func (k Keeper) IterateValidatorOutstandingRewards(ctx sdk.Context, handler func iter := sdk.KVStorePrefixIterator(store, types.ValidatorOutstandingRewardsPrefix) defer iter.Close() for ; iter.Valid(); iter.Next() { - var rewards types.ValidatorOutstandingRewards + rewards := types.ValidatorOutstandingRewards{} k.cdc.MustUnmarshalBinaryLengthPrefixed(iter.Value(), &rewards) addr := types.GetValidatorOutstandingRewardsAddress(iter.Key()) if handler(addr, rewards) { @@ -321,7 +321,7 @@ func (k Keeper) GetValidatorSlashEvent(ctx sdk.Context, val sdk.ValAddress, heig // set slash event for height func (k Keeper) SetValidatorSlashEvent(ctx sdk.Context, val sdk.ValAddress, height, period uint64, event types.ValidatorSlashEvent) { store := ctx.KVStore(k.storeKey) - b := k.cdc.MustMarshalBinaryLengthPrefixed(event) + b := k.cdc.MustMarshalBinaryLengthPrefixed(&event) store.Set(types.GetValidatorSlashEventKey(val, height, period), b) } diff --git a/x/distribution/types/types.proto b/x/distribution/types/types.proto index 06f19519b6ad..fa3c402c359e 100644 --- a/x/distribution/types/types.proto +++ b/x/distribution/types/types.proto @@ -96,6 +96,17 @@ message ValidatorHistoricalRewards { uint32 reference_count = 2; } +// current rewards and current period for a validator +// kept as a running counter and incremented each block +// as long as the validator's tokens remain constant +message ValidatorCurrentRewards { + repeated cosmos_sdk.v1.DecCoin rewards = 1 [ + (gogoproto.moretags) = "yaml:\"rewards\"", + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins", + (gogoproto.nullable) = false + ]; +} + // validator slash event // height is implicit within the store key // needed to calculate appropriate amounts of staking token @@ -151,4 +162,5 @@ message DelegatorStartingInfo { (gogoproto.nullable) = false ]; uint64 height = 3 [ (gogoproto.moretags) = "yaml:\"height\"" ]; -} \ No newline at end of file +} + From 97148e220075ee014118f1ad2653d3a0b5f9ffcc Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Tue, 4 Feb 2020 12:03:16 -0500 Subject: [PATCH 21/46] Fix linting --- .golangci.yml | 3 +++ x/staking/keeper/delegation.go | 5 +++-- x/staking/types/commission.go | 14 ++++++------- x/staking/types/delegation.go | 36 +++++++++++++++++----------------- 4 files changed, 31 insertions(+), 27 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 9d790040dbcc..203c19b32648 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -47,6 +47,9 @@ issues: - text: "ST1003:" linters: - stylecheck + - text: "ST1016:" + linters: + - stylecheck linters-settings: dogsled: diff --git a/x/staking/keeper/delegation.go b/x/staking/keeper/delegation.go index 00d108079dfa..9524c4feffa8 100644 --- a/x/staking/keeper/delegation.go +++ b/x/staking/keeper/delegation.go @@ -120,8 +120,9 @@ func (k Keeper) GetUnbondingDelegations(ctx sdk.Context, delegator sdk.AccAddres } // return a unbonding delegation -func (k Keeper) GetUnbondingDelegation(ctx sdk.Context, - delAddr sdk.AccAddress, valAddr sdk.ValAddress) (ubd types.UnbondingDelegation, found bool) { +func (k Keeper) GetUnbondingDelegation( + ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress, +) (ubd types.UnbondingDelegation, found bool) { store := ctx.KVStore(k.storeKey) key := types.GetUBDKey(delAddr, valAddr) diff --git a/x/staking/types/commission.go b/x/staking/types/commission.go index 270670a744b5..9a58210f612e 100644 --- a/x/staking/types/commission.go +++ b/x/staking/types/commission.go @@ -47,29 +47,29 @@ func (cr CommissionRates) String() string { // Validate performs basic sanity validation checks of initial commission // parameters. If validation fails, an SDK error is returned. -func (c CommissionRates) Validate() error { +func (cr CommissionRates) Validate() error { switch { - case c.MaxRate.IsNegative(): + case cr.MaxRate.IsNegative(): // max rate cannot be negative return ErrCommissionNegative - case c.MaxRate.GT(sdk.OneDec()): + case cr.MaxRate.GT(sdk.OneDec()): // max rate cannot be greater than 1 return ErrCommissionHuge - case c.Rate.IsNegative(): + case cr.Rate.IsNegative(): // rate cannot be negative return ErrCommissionNegative - case c.Rate.GT(c.MaxRate): + case cr.Rate.GT(cr.MaxRate): // rate cannot be greater than the max rate return ErrCommissionGTMaxRate - case c.MaxChangeRate.IsNegative(): + case cr.MaxChangeRate.IsNegative(): // change rate cannot be negative return ErrCommissionChangeRateNegative - case c.MaxChangeRate.GT(c.MaxRate): + case cr.MaxChangeRate.GT(cr.MaxRate): // change rate cannot be greater than the max rate return ErrCommissionChangeRateGTMaxRate } diff --git a/x/staking/types/delegation.go b/x/staking/types/delegation.go index f3d7289242ec..f25aaac7b22a 100644 --- a/x/staking/types/delegation.go +++ b/x/staking/types/delegation.go @@ -88,8 +88,8 @@ func NewUnbondingDelegationEntry(creationHeight int64, completionTime time.Time, } // String implements the stringer interface for a UnbondingDelegationEntry. -func (ubd UnbondingDelegationEntry) String() string { - out, _ := yaml.Marshal(ubd) +func (e UnbondingDelegationEntry) String() string { + out, _ := yaml.Marshal(e) return string(out) } @@ -114,14 +114,14 @@ func NewUnbondingDelegation( } // AddEntry - append entry to the unbonding delegation -func (d *UnbondingDelegation) AddEntry(creationHeight int64, minTime time.Time, balance sdk.Int) { +func (ubd *UnbondingDelegation) AddEntry(creationHeight int64, minTime time.Time, balance sdk.Int) { entry := NewUnbondingDelegationEntry(creationHeight, minTime, balance) - d.Entries = append(d.Entries, entry) + ubd.Entries = append(ubd.Entries, entry) } // RemoveEntry - remove entry at index i to the unbonding delegation -func (d *UnbondingDelegation) RemoveEntry(i int64) { - d.Entries = append(d.Entries[:i], d.Entries[i+1:]...) +func (ubd *UnbondingDelegation) RemoveEntry(i int64) { + ubd.Entries = append(ubd.Entries[:i], ubd.Entries[i+1:]...) } // return the unbonding delegation @@ -145,12 +145,12 @@ func UnmarshalUBD(cdc codec.Marshaler, value []byte) (ubd UnbondingDelegation, e } // String returns a human readable string representation of an UnbondingDelegation. -func (d UnbondingDelegation) String() string { +func (ubd UnbondingDelegation) String() string { out := fmt.Sprintf(`Unbonding Delegations between: Delegator: %s Validator: %s - Entries:`, d.DelegatorAddress, d.ValidatorAddress) - for i, entry := range d.Entries { + Entries:`, ubd.DelegatorAddress, ubd.ValidatorAddress) + for i, entry := range ubd.Entries { out += fmt.Sprintf(` Unbonding Delegation %d: Creation Height: %v Min time to unbond (unix): %v @@ -180,8 +180,8 @@ func NewRedelegationEntry(creationHeight int64, completionTime time.Time, balanc } // String implements the Stringer interface for a RedelegationEntry object. -func (red RedelegationEntry) String() string { - out, _ := yaml.Marshal(red) +func (e RedelegationEntry) String() string { + out, _ := yaml.Marshal(e) return string(out) } @@ -206,14 +206,14 @@ func NewRedelegation( } // AddEntry - append entry to the unbonding delegation -func (d *Redelegation) AddEntry(creationHeight int64, minTime time.Time, balance sdk.Int, sharesDst sdk.Dec) { +func (red *Redelegation) AddEntry(creationHeight int64, minTime time.Time, balance sdk.Int, sharesDst sdk.Dec) { entry := NewRedelegationEntry(creationHeight, minTime, balance, sharesDst) - d.Entries = append(d.Entries, entry) + red.Entries = append(red.Entries, entry) } // RemoveEntry - remove entry at index i to the unbonding delegation -func (d *Redelegation) RemoveEntry(i int64) { - d.Entries = append(d.Entries[:i], d.Entries[i+1:]...) +func (red *Redelegation) RemoveEntry(i int64) { + red.Entries = append(red.Entries[:i], red.Entries[i+1:]...) } // MustMarshalRED returns the Redelegation bytes. Panics if fails. @@ -237,17 +237,17 @@ func UnmarshalRED(cdc codec.Marshaler, value []byte) (red Redelegation, err erro } // String returns a human readable string representation of a Redelegation. -func (d Redelegation) String() string { +func (red Redelegation) String() string { out := fmt.Sprintf(`Redelegations between: Delegator: %s Source Validator: %s Destination Validator: %s Entries: `, - d.DelegatorAddress, d.ValidatorSrcAddress, d.ValidatorDstAddress, + red.DelegatorAddress, red.ValidatorSrcAddress, red.ValidatorDstAddress, ) - for i, entry := range d.Entries { + for i, entry := range red.Entries { out += fmt.Sprintf(` Redelegation Entry #%d: Creation height: %v Min time to unbond (unix): %v From 11a0d8b90e3aa54da140216757e8e9b1b5f819f7 Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Tue, 4 Feb 2020 13:58:39 -0500 Subject: [PATCH 22/46] Add changelog entry --- CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index fc45a176b45d..89ce5c7afa04 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -59,6 +59,13 @@ balances or a single balance by denom when the `denom` query parameter is presen * Callers to `NewBaseVestingAccount` are responsible for verifying account balance in relation to the original vesting amount. * The `SendKeeper` and `ViewKeeper` interfaces in `x/bank` have been modified to account for changes. +* (staking) [\#5600](https://github.com/cosmos/cosmos-sdk/pull/5600) Migrate the `x/staking` module to use Protocol Buffer for state +serialization instead of Amino. + * `BondStatus` is now of type `int32` instead of `byte`. + * Types of `int16` in the `Params` type are now of type `int32`. + * Every reference of `crypto.Pubkey` in context of a `Validator` is now of type string. `GetPubKeyFromBech32` must be used to get the `crypto.Pubkey`. + * The `Keeper` constructor now takes a `codec.Marshaler` instead of a concrete Amino codec. This exact type + provided is specified by `ModuleCdc`. ### Improvements From db45cfcf1b623354825ff313945d8e94ff057927 Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Tue, 4 Feb 2020 13:59:55 -0500 Subject: [PATCH 23/46] Update changelog entry --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 89ce5c7afa04..4241c20905a8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -60,7 +60,8 @@ balances or a single balance by denom when the `denom` query parameter is presen the original vesting amount. * The `SendKeeper` and `ViewKeeper` interfaces in `x/bank` have been modified to account for changes. * (staking) [\#5600](https://github.com/cosmos/cosmos-sdk/pull/5600) Migrate the `x/staking` module to use Protocol Buffer for state -serialization instead of Amino. +serialization instead of Amino. The exact codec used is `codec.HybridCodec` which utilizes Protobuf for binary encoding and Amino +for JSON encoding. * `BondStatus` is now of type `int32` instead of `byte`. * Types of `int16` in the `Params` type are now of type `int32`. * Every reference of `crypto.Pubkey` in context of a `Validator` is now of type string. `GetPubKeyFromBech32` must be used to get the `crypto.Pubkey`. From d0b2786d32a2245a2d30962ab1b7605bcd8b60c6 Mon Sep 17 00:00:00 2001 From: Marko Baricevic Date: Wed, 5 Feb 2020 13:41:14 +0100 Subject: [PATCH 24/46] referencing types --- x/distribution/keeper/store.go | 11 +- x/distribution/types/types.pb.go | 360 ++++++++++++++++++++++++------ x/distribution/types/types.proto | 1 + x/distribution/types/validator.go | 8 - 4 files changed, 300 insertions(+), 80 deletions(-) diff --git a/x/distribution/keeper/store.go b/x/distribution/keeper/store.go index 9c4e02698edc..f3f766fee668 100644 --- a/x/distribution/keeper/store.go +++ b/x/distribution/keeper/store.go @@ -55,7 +55,7 @@ func (k Keeper) GetFeePool(ctx sdk.Context) (feePool types.FeePool) { // set the global fee pool distribution info func (k Keeper) SetFeePool(ctx sdk.Context, feePool types.FeePool) { store := ctx.KVStore(k.storeKey) - b := k.cdc.MustMarshalBinaryLengthPrefixed(feePool) + b := k.cdc.MustMarshalBinaryLengthPrefixed(&feePool) store.Set(types.FeePoolKey, b) } @@ -131,7 +131,7 @@ func (k Keeper) GetValidatorHistoricalRewards(ctx sdk.Context, val sdk.ValAddres // set historical rewards for a particular period func (k Keeper) SetValidatorHistoricalRewards(ctx sdk.Context, val sdk.ValAddress, period uint64, rewards types.ValidatorHistoricalRewards) { store := ctx.KVStore(k.storeKey) - b := k.cdc.MustMarshalBinaryLengthPrefixed(rewards) + b := k.cdc.MustMarshalBinaryLengthPrefixed(&rewards) store.Set(types.GetValidatorHistoricalRewardsKey(val, period), b) } @@ -200,7 +200,7 @@ func (k Keeper) GetValidatorCurrentRewards(ctx sdk.Context, val sdk.ValAddress) // set current rewards for a validator func (k Keeper) SetValidatorCurrentRewards(ctx sdk.Context, val sdk.ValAddress, rewards types.ValidatorCurrentRewards) { store := ctx.KVStore(k.storeKey) - b := k.cdc.MustMarshalBinaryLengthPrefixed(rewards) + b := k.cdc.MustMarshalBinaryLengthPrefixed(&rewards) store.Set(types.GetValidatorCurrentRewardsKey(val), b) } @@ -298,9 +298,10 @@ func (k Keeper) IterateValidatorOutstandingRewards(ctx sdk.Context, handler func iter := sdk.KVStorePrefixIterator(store, types.ValidatorOutstandingRewardsPrefix) defer iter.Close() for ; iter.Valid(); iter.Next() { - rewards := types.ValidatorOutstandingRewards{} - k.cdc.MustUnmarshalBinaryLengthPrefixed(iter.Value(), &rewards) + rewardsProto := sdk.DecProto{} + k.cdc.MustUnmarshalBinaryLengthPrefixed(iter.Value(), &rewardsProto) addr := types.GetValidatorOutstandingRewardsAddress(iter.Key()) + rewards := types.ValidatorOutstandingRewards(rewardsProto) if handler(addr, rewards) { break } diff --git a/x/distribution/types/types.pb.go b/x/distribution/types/types.pb.go index 5adbf8882867..8eaebd3674c7 100644 --- a/x/distribution/types/types.pb.go +++ b/x/distribution/types/types.pb.go @@ -340,6 +340,61 @@ func (m *ValidatorHistoricalRewards) GetReferenceCount() uint32 { return 0 } +// current rewards and current period for a validator +// kept as a running counter and incremented each block +// as long as the validator's tokens remain constant +type ValidatorCurrentRewards struct { + Rewards github_com_cosmos_cosmos_sdk_types.DecCoins `protobuf:"bytes,1,rep,name=rewards,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.DecCoins" json:"rewards" yaml:"rewards"` + Period uint64 `protobuf:"varint,2,opt,name=period,proto3" json:"period,omitempty" yaml:"period"` +} + +func (m *ValidatorCurrentRewards) Reset() { *m = ValidatorCurrentRewards{} } +func (m *ValidatorCurrentRewards) String() string { return proto.CompactTextString(m) } +func (*ValidatorCurrentRewards) ProtoMessage() {} +func (*ValidatorCurrentRewards) Descriptor() ([]byte, []int) { + return fileDescriptor_9fddf2a8e4a90b09, []int{6} +} +func (m *ValidatorCurrentRewards) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ValidatorCurrentRewards) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ValidatorCurrentRewards.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ValidatorCurrentRewards) XXX_Merge(src proto.Message) { + xxx_messageInfo_ValidatorCurrentRewards.Merge(m, src) +} +func (m *ValidatorCurrentRewards) XXX_Size() int { + return m.Size() +} +func (m *ValidatorCurrentRewards) XXX_DiscardUnknown() { + xxx_messageInfo_ValidatorCurrentRewards.DiscardUnknown(m) +} + +var xxx_messageInfo_ValidatorCurrentRewards proto.InternalMessageInfo + +func (m *ValidatorCurrentRewards) GetRewards() github_com_cosmos_cosmos_sdk_types.DecCoins { + if m != nil { + return m.Rewards + } + return nil +} + +func (m *ValidatorCurrentRewards) GetPeriod() uint64 { + if m != nil { + return m.Period + } + return 0 +} + // validator slash event // height is implicit within the store key // needed to calculate appropriate amounts of staking token @@ -353,7 +408,7 @@ func (m *ValidatorSlashEvent) Reset() { *m = ValidatorSlashEvent{} } func (m *ValidatorSlashEvent) String() string { return proto.CompactTextString(m) } func (*ValidatorSlashEvent) ProtoMessage() {} func (*ValidatorSlashEvent) Descriptor() ([]byte, []int) { - return fileDescriptor_9fddf2a8e4a90b09, []int{6} + return fileDescriptor_9fddf2a8e4a90b09, []int{7} } func (m *ValidatorSlashEvent) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -398,7 +453,7 @@ func (m *FeePool) Reset() { *m = FeePool{} } func (m *FeePool) String() string { return proto.CompactTextString(m) } func (*FeePool) ProtoMessage() {} func (*FeePool) Descriptor() ([]byte, []int) { - return fileDescriptor_9fddf2a8e4a90b09, []int{7} + return fileDescriptor_9fddf2a8e4a90b09, []int{8} } func (m *FeePool) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -434,9 +489,10 @@ func (m *FeePool) GetCommunityPool() github_com_cosmos_cosmos_sdk_types.DecCoins return nil } +// CommunityPoolSpendProposal spends from the community pool type CommunityPoolSpendProposal struct { Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty" yaml:"title"` - Description string `protobuf:"bytes,2,opt,name=Description,proto3" json:"Description,omitempty" yaml:"description"` + Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty" yaml:"description"` Recipient github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,3,opt,name=recipient,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"recipient,omitempty" yaml:"recipient"` Amount github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,4,rep,name=amount,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"amount" yaml:"amount"` } @@ -444,7 +500,7 @@ type CommunityPoolSpendProposal struct { func (m *CommunityPoolSpendProposal) Reset() { *m = CommunityPoolSpendProposal{} } func (*CommunityPoolSpendProposal) ProtoMessage() {} func (*CommunityPoolSpendProposal) Descriptor() ([]byte, []int) { - return fileDescriptor_9fddf2a8e4a90b09, []int{8} + return fileDescriptor_9fddf2a8e4a90b09, []int{9} } func (m *CommunityPoolSpendProposal) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -490,7 +546,7 @@ func (m *DelegatorStartingInfo) Reset() { *m = DelegatorStartingInfo{} } func (m *DelegatorStartingInfo) String() string { return proto.CompactTextString(m) } func (*DelegatorStartingInfo) ProtoMessage() {} func (*DelegatorStartingInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_9fddf2a8e4a90b09, []int{9} + return fileDescriptor_9fddf2a8e4a90b09, []int{10} } func (m *DelegatorStartingInfo) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -540,6 +596,7 @@ func init() { proto.RegisterType((*MsgFundCommunityPool)(nil), "cosmos_sdk.x.ditribution.v1.MsgFundCommunityPool") proto.RegisterType((*Params)(nil), "cosmos_sdk.x.ditribution.v1.Params") proto.RegisterType((*ValidatorHistoricalRewards)(nil), "cosmos_sdk.x.ditribution.v1.ValidatorHistoricalRewards") + proto.RegisterType((*ValidatorCurrentRewards)(nil), "cosmos_sdk.x.ditribution.v1.ValidatorCurrentRewards") proto.RegisterType((*ValidatorSlashEvent)(nil), "cosmos_sdk.x.ditribution.v1.ValidatorSlashEvent") proto.RegisterType((*FeePool)(nil), "cosmos_sdk.x.ditribution.v1.FeePool") proto.RegisterType((*CommunityPoolSpendProposal)(nil), "cosmos_sdk.x.ditribution.v1.CommunityPoolSpendProposal") @@ -549,69 +606,72 @@ func init() { func init() { proto.RegisterFile("x/distribution/types/types.proto", fileDescriptor_9fddf2a8e4a90b09) } var fileDescriptor_9fddf2a8e4a90b09 = []byte{ - // 987 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x56, 0xbf, 0x6f, 0x23, 0x45, - 0x14, 0xf6, 0x26, 0x4e, 0x48, 0xe6, 0x92, 0x38, 0xd9, 0xc4, 0xb9, 0xc8, 0x41, 0x5e, 0x6b, 0x8a, - 0x10, 0x84, 0xce, 0xd6, 0x41, 0x83, 0x52, 0x20, 0xc5, 0xf9, 0x21, 0x90, 0xce, 0x28, 0xda, 0x84, - 0x43, 0x42, 0x42, 0xab, 0xf1, 0xee, 0xc4, 0x1e, 0x65, 0xbd, 0xb3, 0x9a, 0x19, 0xdb, 0xc9, 0x35, - 0x48, 0x54, 0x48, 0x50, 0x50, 0x20, 0x41, 0x41, 0x71, 0x0d, 0x0d, 0x7f, 0x03, 0x7f, 0xc0, 0x95, + // 1033 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x56, 0xbd, 0x6f, 0x23, 0xc5, + 0x1b, 0xf6, 0xe6, 0xeb, 0x92, 0xb9, 0x24, 0x4e, 0x36, 0x71, 0x12, 0x39, 0x3f, 0x79, 0xad, 0x29, + 0xf2, 0x0b, 0x42, 0x67, 0xeb, 0xa0, 0x41, 0x29, 0x90, 0xe2, 0x7c, 0x08, 0xa4, 0x33, 0x8a, 0x36, + 0xe1, 0x90, 0x90, 0xd0, 0x6a, 0xbc, 0x3b, 0xb1, 0x47, 0x59, 0xef, 0xac, 0x66, 0xc6, 0x76, 0x72, + 0x0d, 0x12, 0x15, 0x12, 0x14, 0x14, 0x48, 0x50, 0x50, 0x5c, 0x43, 0xc3, 0xdf, 0x00, 0xfd, 0x95, 0xd7, 0x81, 0x90, 0x6e, 0x41, 0x49, 0x89, 0x68, 0x5c, 0x52, 0xa1, 0x9d, 0x99, 0xdd, 0xb5, 0x1d, - 0x4b, 0xc4, 0x29, 0x8e, 0x26, 0xb1, 0xdf, 0xbc, 0xfd, 0xbe, 0x6f, 0xde, 0xfb, 0xde, 0xf3, 0x82, - 0xca, 0x65, 0xcd, 0x23, 0x5c, 0x30, 0x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, 0xed, 0x95, 0x34, 0x7c, 0x20, 0x67, 0xec, - 0x17, 0x03, 0xac, 0xa7, 0xf7, 0x3d, 0xf5, 0x11, 0x6f, 0x1f, 0xf5, 0x70, 0x20, 0xcc, 0x63, 0x90, - 0xcd, 0xb8, 0x13, 0x62, 0x46, 0xa8, 0x27, 0x9d, 0x9d, 0xaf, 0x6f, 0x67, 0xeb, 0x7f, 0x3c, 0x03, - 0xda, 0x85, 0x34, 0x74, 0x22, 0x23, 0xe6, 0xe7, 0x60, 0xe1, 0x9c, 0x21, 0x37, 0xfe, 0x99, 0xd4, - 0x2e, 0xdd, 0x9f, 0xda, 0x22, 0x05, 0xc5, 0x96, 0xe0, 0x40, 0x3b, 0x85, 0x84, 0xdf, 0x1b, 0xe0, - 0x8d, 0x63, 0x8c, 0xe5, 0xa6, 0xf9, 0xda, 0x00, 0x2b, 0xd9, 0xf4, 0x84, 0x94, 0xfa, 0xff, 0xd1, - 0x92, 0x27, 0xba, 0x25, 0xc5, 0xf1, 0xc9, 0x8b, 0x9f, 0x9d, 0xba, 0x13, 0xd9, 0x1a, 0x88, 0xd5, - 0xc0, 0x57, 0x33, 0xa0, 0x34, 0xb2, 0x09, 0x4f, 0x43, 0x1c, 0x78, 0xca, 0xc9, 0xc8, 0x37, 0x77, - 0xc0, 0x9c, 0x20, 0xc2, 0xc7, 0x7a, 0x5d, 0xac, 0x0e, 0x22, 0x6b, 0x49, 0xc9, 0x90, 0x61, 0x68, - 0xab, 0x63, 0xf3, 0x7d, 0xf0, 0xe0, 0x10, 0x73, 0x97, 0x91, 0x70, 0xa8, 0x84, 0x9b, 0x83, 0xc8, - 0x32, 0x93, 0x85, 0x96, 0x1e, 0x42, 0x7b, 0x38, 0x35, 0x5e, 0x84, 0x0c, 0xbb, 0x24, 0x24, 0x38, - 0x10, 0x72, 0x3a, 0x47, 0x16, 0x61, 0x7a, 0x74, 0x9f, 0x45, 0x98, 0x3e, 0x3c, 0xb4, 0xdd, 0xf3, - 0xaf, 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0x08, 0xed, 0xc1, 0xd4, 0xd8, 0xc8, 0x19, 0x76, 0x49, 0x48, 0x70, + 0x20, 0xa4, 0xbb, 0x0c, 0x19, 0x79, 0x7a, 0x74, 0x1f, 0x23, 0x4f, 0x1f, 0x1e, 0xb8, 0x9d, 0x66, + 0xde, 0xc4, 0xed, 0xb4, 0x37, 0xff, 0xe5, 0x73, 0x2b, 0x27, 0x8d, 0xe6, 0x95, 0x01, 0x0a, 0xe9, + 0xb7, 0xcd, 0xa9, 0x40, 0x4c, 0x90, 0xa0, 0xf9, 0x61, 0x70, 0x4e, 0xcd, 0x03, 0x90, 0x0f, 0x19, + 0xee, 0x12, 0x1a, 0x1b, 0xe2, 0xe0, 0xe4, 0x16, 0xfb, 0x91, 0xb5, 0xa1, 0xd7, 0x60, 0x38, 0x01, + 0xda, 0xcb, 0x49, 0x44, 0xcf, 0xed, 0x19, 0x98, 0xe5, 0x02, 0x5d, 0x60, 0xdd, 0xf1, 0xf7, 0x27, + 0x1e, 0x5a, 0xfd, 0x36, 0x25, 0x08, 0xb4, 0x15, 0x58, 0xbc, 0x98, 0x2d, 0x4c, 0x9a, 0x2d, 0xf5, + 0x42, 0x86, 0x16, 0x53, 0xc5, 0xa1, 0xad, 0x13, 0x6a, 0xd6, 0x8b, 0xeb, 0x92, 0xf1, 0xf2, 0xba, + 0x64, 0xfc, 0x79, 0x5d, 0x32, 0xbe, 0xb9, 0x29, 0xe5, 0x5e, 0xde, 0x94, 0x72, 0xbf, 0xdd, 0x94, + 0x72, 0x9f, 0xce, 0x4a, 0x9a, 0xc6, 0x9c, 0xfc, 0xfa, 0x7d, 0xf7, 0xdf, 0x00, 0x00, 0x00, 0xff, + 0xff, 0x08, 0x95, 0x05, 0x40, 0x79, 0x0b, 0x00, 0x00, } func (m *MsgSetWithdrawAddress) Marshal() (dAtA []byte, err error) { @@ -867,6 +927,48 @@ func (m *ValidatorHistoricalRewards) MarshalToSizedBuffer(dAtA []byte) (int, err return len(dAtA) - i, nil } +func (m *ValidatorCurrentRewards) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ValidatorCurrentRewards) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ValidatorCurrentRewards) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Period != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.Period)) + i-- + dAtA[i] = 0x10 + } + if len(m.Rewards) > 0 { + for iNdEx := len(m.Rewards) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Rewards[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + func (m *ValidatorSlashEvent) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -1156,6 +1258,24 @@ func (m *ValidatorHistoricalRewards) Size() (n int) { return n } +func (m *ValidatorCurrentRewards) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Rewards) > 0 { + for _, e := range m.Rewards { + l = e.Size() + n += 1 + l + sovTypes(uint64(l)) + } + } + if m.Period != 0 { + n += 1 + sovTypes(uint64(m.Period)) + } + return n +} + func (m *ValidatorSlashEvent) Size() (n int) { if m == nil { return 0 @@ -1966,6 +2086,112 @@ func (m *ValidatorHistoricalRewards) Unmarshal(dAtA []byte) error { } return nil } +func (m *ValidatorCurrentRewards) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ValidatorCurrentRewards: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ValidatorCurrentRewards: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Rewards", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Rewards = append(m.Rewards, types.DecCoin{}) + if err := m.Rewards[len(m.Rewards)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Period", wireType) + } + m.Period = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Period |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *ValidatorSlashEvent) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 diff --git a/x/distribution/types/types.proto b/x/distribution/types/types.proto index fa3c402c359e..72305da8b1b9 100644 --- a/x/distribution/types/types.proto +++ b/x/distribution/types/types.proto @@ -105,6 +105,7 @@ message ValidatorCurrentRewards { (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins", (gogoproto.nullable) = false ]; + uint64 period = 2 [(gogoproto.moretags) = "yaml:\"period\"" ]; } // validator slash event diff --git a/x/distribution/types/validator.go b/x/distribution/types/validator.go index bdfd0f9a1707..ee600e002e7b 100644 --- a/x/distribution/types/validator.go +++ b/x/distribution/types/validator.go @@ -15,14 +15,6 @@ func NewValidatorHistoricalRewards(cumulativeRewardRatio sdk.DecCoins, reference } } -// current rewards and current period for a validator -// kept as a running counter and incremented each block -// as long as the validator's tokens remain constant -type ValidatorCurrentRewards struct { - Rewards sdk.DecCoins `json:"rewards" yaml:"rewards"` // current rewards - Period uint64 `json:"period" yaml:"period"` // current period -} - // create a new ValidatorCurrentRewards func NewValidatorCurrentRewards(rewards sdk.DecCoins, period uint64) ValidatorCurrentRewards { return ValidatorCurrentRewards{ From c68058d7032053782154c28fdad9758416eb0b13 Mon Sep 17 00:00:00 2001 From: Marko Baricevic Date: Wed, 5 Feb 2020 17:11:41 +0100 Subject: [PATCH 25/46] change some types to proto --- x/distribution/keeper/allocation.go | 4 +- x/distribution/keeper/allocation_test.go | 26 +- x/distribution/keeper/delegation.go | 4 +- x/distribution/keeper/delegation_test.go | 4 +- x/distribution/keeper/hooks.go | 4 +- x/distribution/keeper/keeper.go | 12 +- x/distribution/keeper/keeper_test.go | 9 +- x/distribution/keeper/querier.go | 4 +- x/distribution/keeper/querier_test.go | 2 +- x/distribution/keeper/store.go | 15 +- x/distribution/types/types.pb.go | 514 ++++++++++++++++++++--- x/distribution/types/types.proto | 20 + x/distribution/types/validator.go | 8 - 13 files changed, 506 insertions(+), 120 deletions(-) diff --git a/x/distribution/keeper/allocation.go b/x/distribution/keeper/allocation.go index 533aaac43858..d6cfcc4fe06a 100644 --- a/x/distribution/keeper/allocation.go +++ b/x/distribution/keeper/allocation.go @@ -114,7 +114,7 @@ func (k Keeper) AllocateTokensToValidator(ctx sdk.Context, val exported.Validato ), ) currentCommission := k.GetValidatorAccumulatedCommission(ctx, val.GetOperator()) - currentCommission = currentCommission.Add(commission...) + currentCommission = currentCommission.Commission.Add(commission...) k.SetValidatorAccumulatedCommission(ctx, val.GetOperator(), currentCommission) // update current rewards @@ -131,6 +131,6 @@ func (k Keeper) AllocateTokensToValidator(ctx sdk.Context, val exported.Validato ), ) outstanding := k.GetValidatorOutstandingRewards(ctx, val.GetOperator()) - outstanding = outstanding.Add(tokens...) + outstanding = outstanding.Rewards.Add(tokens...) k.SetValidatorOutstandingRewards(ctx, val.GetOperator(), outstanding) } diff --git a/x/distribution/keeper/allocation_test.go b/x/distribution/keeper/allocation_test.go index 61513a02dca3..b8c0d3948a60 100644 --- a/x/distribution/keeper/allocation_test.go +++ b/x/distribution/keeper/allocation_test.go @@ -75,11 +75,11 @@ func TestAllocateTokensToManyValidators(t *testing.T) { } // assert initial state: zero outstanding rewards, zero community pool, zero commission, zero current rewards - require.True(t, k.GetValidatorOutstandingRewards(ctx, valOpAddr1).IsZero()) - require.True(t, k.GetValidatorOutstandingRewards(ctx, valOpAddr2).IsZero()) + require.True(t, k.GetValidatorOutstandingRewards(ctx, valOpAddr1).Rewards.IsZero()) + require.True(t, k.GetValidatorOutstandingRewards(ctx, valOpAddr2).Rewards.IsZero()) require.True(t, k.GetFeePool(ctx).CommunityPool.IsZero()) - require.True(t, k.GetValidatorAccumulatedCommission(ctx, valOpAddr1).IsZero()) - require.True(t, k.GetValidatorAccumulatedCommission(ctx, valOpAddr2).IsZero()) + require.True(t, k.GetValidatorAccumulatedCommission(ctx, valOpAddr1).Commission.IsZero()) + require.True(t, k.GetValidatorAccumulatedCommission(ctx, valOpAddr2).Commission.IsZero()) require.True(t, k.GetValidatorCurrentRewards(ctx, valOpAddr1).Rewards.IsZero()) require.True(t, k.GetValidatorCurrentRewards(ctx, valOpAddr2).Rewards.IsZero()) @@ -112,7 +112,7 @@ func TestAllocateTokensToManyValidators(t *testing.T) { // 50% commission for first proposer, (0.5 * 93%) * 100 / 2 = 23.25 require.Equal(t, sdk.DecCoins{{Denom: sdk.DefaultBondDenom, Amount: sdk.NewDecWithPrec(2325, 2)}}, k.GetValidatorAccumulatedCommission(ctx, valOpAddr1)) // zero commission for second proposer - require.True(t, k.GetValidatorAccumulatedCommission(ctx, valOpAddr2).IsZero()) + require.True(t, k.GetValidatorAccumulatedCommission(ctx, valOpAddr2).Commission.IsZero()) // just staking.proportional for first proposer less commission = (0.5 * 93%) * 100 / 2 = 23.25 require.Equal(t, sdk.DecCoins{{Denom: sdk.DefaultBondDenom, Amount: sdk.NewDecWithPrec(2325, 2)}}, k.GetValidatorCurrentRewards(ctx, valOpAddr1).Rewards) // proposer reward + staking.proportional for second proposer = (5 % + 0.5 * (93%)) * 100 = 51.5 @@ -162,12 +162,12 @@ func TestAllocateTokensTruncation(t *testing.T) { } // assert initial state: zero outstanding rewards, zero community pool, zero commission, zero current rewards - require.True(t, k.GetValidatorOutstandingRewards(ctx, valOpAddr1).IsZero()) - require.True(t, k.GetValidatorOutstandingRewards(ctx, valOpAddr2).IsZero()) - require.True(t, k.GetValidatorOutstandingRewards(ctx, valOpAddr3).IsZero()) + require.True(t, k.GetValidatorOutstandingRewards(ctx, valOpAddr1).Rewards.IsZero()) + require.True(t, k.GetValidatorOutstandingRewards(ctx, valOpAddr2).Rewards.IsZero()) + require.True(t, k.GetValidatorOutstandingRewards(ctx, valOpAddr3).Rewards.IsZero()) require.True(t, k.GetFeePool(ctx).CommunityPool.IsZero()) - require.True(t, k.GetValidatorAccumulatedCommission(ctx, valOpAddr1).IsZero()) - require.True(t, k.GetValidatorAccumulatedCommission(ctx, valOpAddr2).IsZero()) + require.True(t, k.GetValidatorAccumulatedCommission(ctx, valOpAddr1).Commission.IsZero()) + require.True(t, k.GetValidatorAccumulatedCommission(ctx, valOpAddr2).Commission.IsZero()) require.True(t, k.GetValidatorCurrentRewards(ctx, valOpAddr1).Rewards.IsZero()) require.True(t, k.GetValidatorCurrentRewards(ctx, valOpAddr2).Rewards.IsZero()) @@ -198,7 +198,7 @@ func TestAllocateTokensTruncation(t *testing.T) { } k.AllocateTokens(ctx, 31, 31, valConsAddr2, votes) - require.True(t, k.GetValidatorOutstandingRewards(ctx, valOpAddr1).IsValid()) - require.True(t, k.GetValidatorOutstandingRewards(ctx, valOpAddr2).IsValid()) - require.True(t, k.GetValidatorOutstandingRewards(ctx, valOpAddr3).IsValid()) + require.True(t, k.GetValidatorOutstandingRewards(ctx, valOpAddr1).Rewards.IsValid()) + require.True(t, k.GetValidatorOutstandingRewards(ctx, valOpAddr2).Rewards.IsValid()) + require.True(t, k.GetValidatorOutstandingRewards(ctx, valOpAddr3).Rewards.IsValid()) } diff --git a/x/distribution/keeper/delegation.go b/x/distribution/keeper/delegation.go index 7d79a35b40b9..c630bf2a3a46 100644 --- a/x/distribution/keeper/delegation.go +++ b/x/distribution/keeper/delegation.go @@ -145,7 +145,7 @@ func (k Keeper) withdrawDelegationRewards(ctx sdk.Context, val exported.Validato // end current period and calculate rewards endingPeriod := k.incrementValidatorPeriod(ctx, val) rewardsRaw := k.calculateDelegationRewards(ctx, val, del, endingPeriod) - outstanding := k.GetValidatorOutstandingRewards(ctx, del.GetValidatorAddr()) + outstanding := k.GetValidatorOutstandingRewards(ctx, del.GetValidatorAddr()).Rewards // defensive edge case may happen on the very final digits // of the decCoins due to operation order of the distribution mechanism. @@ -171,7 +171,7 @@ func (k Keeper) withdrawDelegationRewards(ctx sdk.Context, val exported.Validato // update the outstanding rewards and the community pool only if the // transaction was successful - k.SetValidatorOutstandingRewards(ctx, del.GetValidatorAddr(), outstanding.Sub(rewards)) + k.SetValidatorOutstandingRewards(ctx, del.GetValidatorAddr(), types.ValidatorOutstandingRewards{Rewards: outstanding.Sub(rewards)}) feePool := k.GetFeePool(ctx) feePool.CommunityPool = feePool.CommunityPool.Add(remainder...) k.SetFeePool(ctx, feePool) diff --git a/x/distribution/keeper/delegation_test.go b/x/distribution/keeper/delegation_test.go index 7f593fd5ecd6..1bb00c38d8ca 100644 --- a/x/distribution/keeper/delegation_test.go +++ b/x/distribution/keeper/delegation_test.go @@ -592,7 +592,7 @@ func TestCalculateRewardsMultiDelegatorMultWithdraw(t *testing.T) { require.True(t, rewards.IsZero()) // commission should be zero - require.True(t, k.GetValidatorAccumulatedCommission(ctx, valOpAddr1).IsZero()) + require.True(t, k.GetValidatorAccumulatedCommission(ctx, valOpAddr1).Commission.IsZero()) // next block ctx = ctx.WithBlockHeight(ctx.BlockHeight() + 1) @@ -646,5 +646,5 @@ func TestCalculateRewardsMultiDelegatorMultWithdraw(t *testing.T) { require.Equal(t, sdk.DecCoins{{Denom: sdk.DefaultBondDenom, Amount: sdk.NewDec(initial / 2)}}, rewards) // commission should be zero - require.True(t, k.GetValidatorAccumulatedCommission(ctx, valOpAddr1).IsZero()) + require.True(t, k.GetValidatorAccumulatedCommission(ctx, valOpAddr1).Commission.IsZero()) } diff --git a/x/distribution/keeper/hooks.go b/x/distribution/keeper/hooks.go index e7f843dd2bd7..2ac25b27d5ec 100644 --- a/x/distribution/keeper/hooks.go +++ b/x/distribution/keeper/hooks.go @@ -26,10 +26,10 @@ func (h Hooks) AfterValidatorCreated(ctx sdk.Context, valAddr sdk.ValAddress) { func (h Hooks) AfterValidatorRemoved(ctx sdk.Context, _ sdk.ConsAddress, valAddr sdk.ValAddress) { // fetch outstanding - outstanding := h.k.GetValidatorOutstandingRewards(ctx, valAddr) + outstanding := h.k.GetValidatorOutstandingRewards(ctx, valAddr).Rewards // force-withdraw commission - commission := h.k.GetValidatorAccumulatedCommission(ctx, valAddr) + commission := h.k.GetValidatorAccumulatedCommission(ctx, valAddr).Commission if !commission.IsZero() { // subtract from outstanding outstanding = outstanding.Sub(commission) diff --git a/x/distribution/keeper/keeper.go b/x/distribution/keeper/keeper.go index a92102fc6f34..0074f84042a6 100644 --- a/x/distribution/keeper/keeper.go +++ b/x/distribution/keeper/keeper.go @@ -116,16 +116,16 @@ func (k Keeper) WithdrawDelegationRewards(ctx sdk.Context, delAddr sdk.AccAddres func (k Keeper) WithdrawValidatorCommission(ctx sdk.Context, valAddr sdk.ValAddress) (sdk.Coins, error) { // fetch validator accumulated commission accumCommission := k.GetValidatorAccumulatedCommission(ctx, valAddr) - if accumCommission.IsZero() { + if accumCommission.Commission.IsZero() { return nil, types.ErrNoValidatorCommission } - commission, remainder := accumCommission.TruncateDecimal() - k.SetValidatorAccumulatedCommission(ctx, valAddr, remainder) // leave remainder to withdraw later + commission, remainder := accumCommission.Commission.TruncateDecimal() + k.SetValidatorAccumulatedCommission(ctx, valAddr, types.ValidatorAccumulatedCommission{Commission: remainder}) // leave remainder to withdraw later // update outstanding - outstanding := k.GetValidatorOutstandingRewards(ctx, valAddr) - k.SetValidatorOutstandingRewards(ctx, valAddr, outstanding.Sub(sdk.NewDecCoinsFromCoins(commission...))) + outstanding := k.GetValidatorOutstandingRewards(ctx, valAddr).Rewards + k.SetValidatorOutstandingRewards(ctx, valAddr, types.ValidatorOutstandingRewards{Rewards: outstanding.Sub(sdk.NewDecCoinsFromCoins(commission...))}) if !commission.IsZero() { accAddr := sdk.AccAddress(valAddr) @@ -150,7 +150,7 @@ func (k Keeper) WithdrawValidatorCommission(ctx sdk.Context, valAddr sdk.ValAddr func (k Keeper) GetTotalRewards(ctx sdk.Context) (totalRewards sdk.DecCoins) { k.IterateValidatorOutstandingRewards(ctx, func(_ sdk.ValAddress, rewards types.ValidatorOutstandingRewards) (stop bool) { - totalRewards = totalRewards.Add(rewards...) + totalRewards = totalRewards.Add(rewards.Rewards...) return false }, ) diff --git a/x/distribution/keeper/keeper_test.go b/x/distribution/keeper/keeper_test.go index ce0721ce6658..0942d6edada1 100644 --- a/x/distribution/keeper/keeper_test.go +++ b/x/distribution/keeper/keeper_test.go @@ -8,6 +8,7 @@ import ( "github.com/stretchr/testify/require" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/x/distribution/types" ) func TestSetWithdrawAddr(t *testing.T) { @@ -53,10 +54,10 @@ func TestWithdrawValidatorCommission(t *testing.T) { require.Equal(t, expCoins, balance) // set outstanding rewards - keeper.SetValidatorOutstandingRewards(ctx, valOpAddr3, valCommission) + keeper.SetValidatorOutstandingRewards(ctx, valOpAddr3, types.ValidatorOutstandingRewards{Rewards: valCommission}) // set commission - keeper.SetValidatorAccumulatedCommission(ctx, valOpAddr3, valCommission) + keeper.SetValidatorAccumulatedCommission(ctx, valOpAddr3, types.ValidatorAccumulatedCommission{Commission: valCommission}) // withdraw commission keeper.WithdrawValidatorCommission(ctx, valOpAddr3) @@ -86,8 +87,8 @@ func TestGetTotalRewards(t *testing.T) { sdk.NewDecCoinFromDec("stake", sdk.NewDec(3).Quo(sdk.NewDec(2))), } - keeper.SetValidatorOutstandingRewards(ctx, valOpAddr1, valCommission) - keeper.SetValidatorOutstandingRewards(ctx, valOpAddr2, valCommission) + keeper.SetValidatorOutstandingRewards(ctx, valOpAddr1, types.ValidatorOutstandingRewards{Rewards: valCommission}) + keeper.SetValidatorOutstandingRewards(ctx, valOpAddr2, types.ValidatorOutstandingRewards{Rewards: valCommission}) expectedRewards := valCommission.MulDec(sdk.NewDec(2)) totalRewards := keeper.GetTotalRewards(ctx) diff --git a/x/distribution/keeper/querier.go b/x/distribution/keeper/querier.go index 4757ea5ffe3e..90bbfc72da43 100644 --- a/x/distribution/keeper/querier.go +++ b/x/distribution/keeper/querier.go @@ -87,8 +87,8 @@ func queryValidatorCommission(ctx sdk.Context, path []string, req abci.RequestQu } commission := k.GetValidatorAccumulatedCommission(ctx, params.ValidatorAddress) - if commission == nil { - commission = sdk.DecCoins{} + if commission.Commission == nil { + commission.Commission = sdk.DecCoins{} } bz, err := codec.MarshalJSONIndent(k.cdc, commission) diff --git a/x/distribution/keeper/querier_test.go b/x/distribution/keeper/querier_test.go index ed87f42edd78..745e9149e3e2 100644 --- a/x/distribution/keeper/querier_test.go +++ b/x/distribution/keeper/querier_test.go @@ -136,7 +136,7 @@ func TestQueries(t *testing.T) { // test validator commission query commission := sdk.DecCoins{{Denom: "token1", Amount: sdk.NewDec(4)}, {Denom: "token2", Amount: sdk.NewDec(2)}} - keeper.SetValidatorAccumulatedCommission(ctx, valOpAddr1, commission) + keeper.SetValidatorAccumulatedCommission(ctx, valOpAddr1, types.ValidatorAccumulatedCommission{Commission: commission}) retCommission := getQueriedValidatorCommission(t, ctx, cdc, querier, valOpAddr1) require.Equal(t, commission, retCommission) diff --git a/x/distribution/keeper/store.go b/x/distribution/keeper/store.go index f3f766fee668..5095a03b574d 100644 --- a/x/distribution/keeper/store.go +++ b/x/distribution/keeper/store.go @@ -241,10 +241,10 @@ func (k Keeper) SetValidatorAccumulatedCommission(ctx sdk.Context, val sdk.ValAd var bz []byte store := ctx.KVStore(k.storeKey) - if commission.IsZero() { - bz = k.cdc.MustMarshalBinaryLengthPrefixed(types.InitialValidatorAccumulatedCommission()) + if commission.Commission.IsZero() { + bz = k.cdc.MustMarshalBinaryLengthPrefixed(&types.ValidatorAccumulatedCommission{}) } else { - bz = k.cdc.MustMarshalBinaryLengthPrefixed(commission) + bz = k.cdc.MustMarshalBinaryLengthPrefixed(&commission) } store.Set(types.GetValidatorAccumulatedCommissionKey(val), bz) @@ -274,8 +274,8 @@ func (k Keeper) IterateValidatorAccumulatedCommissions(ctx sdk.Context, handler // get validator outstanding rewards func (k Keeper) GetValidatorOutstandingRewards(ctx sdk.Context, val sdk.ValAddress) (rewards types.ValidatorOutstandingRewards) { store := ctx.KVStore(k.storeKey) - b := store.Get(types.GetValidatorOutstandingRewardsKey(val)) - k.cdc.MustUnmarshalBinaryLengthPrefixed(b, &rewards) + bz := store.Get(types.GetValidatorOutstandingRewardsKey(val)) + k.cdc.MustUnmarshalBinaryLengthPrefixed(bz, &rewards) return } @@ -298,10 +298,9 @@ func (k Keeper) IterateValidatorOutstandingRewards(ctx sdk.Context, handler func iter := sdk.KVStorePrefixIterator(store, types.ValidatorOutstandingRewardsPrefix) defer iter.Close() for ; iter.Valid(); iter.Next() { - rewardsProto := sdk.DecProto{} - k.cdc.MustUnmarshalBinaryLengthPrefixed(iter.Value(), &rewardsProto) + rewards := types.ValidatorOutstandingRewards{} + k.cdc.MustUnmarshalBinaryLengthPrefixed(iter.Value(), &rewards) addr := types.GetValidatorOutstandingRewardsAddress(iter.Key()) - rewards := types.ValidatorOutstandingRewards(rewardsProto) if handler(addr, rewards) { break } diff --git a/x/distribution/types/types.pb.go b/x/distribution/types/types.pb.go index 8eaebd3674c7..d74fb58518f8 100644 --- a/x/distribution/types/types.pb.go +++ b/x/distribution/types/types.pb.go @@ -395,6 +395,96 @@ func (m *ValidatorCurrentRewards) GetPeriod() uint64 { return 0 } +// accumulated commission for a validator +// kept as a running counter, can be withdrawn at any time +type ValidatorAccumulatedCommission struct { + Commission github_com_cosmos_cosmos_sdk_types.DecCoins `protobuf:"bytes,1,rep,name=commission,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.DecCoins" json:"commission" yaml:"commission"` +} + +func (m *ValidatorAccumulatedCommission) Reset() { *m = ValidatorAccumulatedCommission{} } +func (m *ValidatorAccumulatedCommission) String() string { return proto.CompactTextString(m) } +func (*ValidatorAccumulatedCommission) ProtoMessage() {} +func (*ValidatorAccumulatedCommission) Descriptor() ([]byte, []int) { + return fileDescriptor_9fddf2a8e4a90b09, []int{7} +} +func (m *ValidatorAccumulatedCommission) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ValidatorAccumulatedCommission) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ValidatorAccumulatedCommission.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ValidatorAccumulatedCommission) XXX_Merge(src proto.Message) { + xxx_messageInfo_ValidatorAccumulatedCommission.Merge(m, src) +} +func (m *ValidatorAccumulatedCommission) XXX_Size() int { + return m.Size() +} +func (m *ValidatorAccumulatedCommission) XXX_DiscardUnknown() { + xxx_messageInfo_ValidatorAccumulatedCommission.DiscardUnknown(m) +} + +var xxx_messageInfo_ValidatorAccumulatedCommission proto.InternalMessageInfo + +func (m *ValidatorAccumulatedCommission) GetCommission() github_com_cosmos_cosmos_sdk_types.DecCoins { + if m != nil { + return m.Commission + } + return nil +} + +type ValidatorOutstandingRewards struct { + Rewards github_com_cosmos_cosmos_sdk_types.DecCoins `protobuf:"bytes,1,rep,name=rewards,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.DecCoins" json:"rewards" yaml:"rewards"` +} + +func (m *ValidatorOutstandingRewards) Reset() { *m = ValidatorOutstandingRewards{} } +func (m *ValidatorOutstandingRewards) String() string { return proto.CompactTextString(m) } +func (*ValidatorOutstandingRewards) ProtoMessage() {} +func (*ValidatorOutstandingRewards) Descriptor() ([]byte, []int) { + return fileDescriptor_9fddf2a8e4a90b09, []int{8} +} +func (m *ValidatorOutstandingRewards) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ValidatorOutstandingRewards) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ValidatorOutstandingRewards.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ValidatorOutstandingRewards) XXX_Merge(src proto.Message) { + xxx_messageInfo_ValidatorOutstandingRewards.Merge(m, src) +} +func (m *ValidatorOutstandingRewards) XXX_Size() int { + return m.Size() +} +func (m *ValidatorOutstandingRewards) XXX_DiscardUnknown() { + xxx_messageInfo_ValidatorOutstandingRewards.DiscardUnknown(m) +} + +var xxx_messageInfo_ValidatorOutstandingRewards proto.InternalMessageInfo + +func (m *ValidatorOutstandingRewards) GetRewards() github_com_cosmos_cosmos_sdk_types.DecCoins { + if m != nil { + return m.Rewards + } + return nil +} + // validator slash event // height is implicit within the store key // needed to calculate appropriate amounts of staking token @@ -408,7 +498,7 @@ func (m *ValidatorSlashEvent) Reset() { *m = ValidatorSlashEvent{} } func (m *ValidatorSlashEvent) String() string { return proto.CompactTextString(m) } func (*ValidatorSlashEvent) ProtoMessage() {} func (*ValidatorSlashEvent) Descriptor() ([]byte, []int) { - return fileDescriptor_9fddf2a8e4a90b09, []int{7} + return fileDescriptor_9fddf2a8e4a90b09, []int{9} } func (m *ValidatorSlashEvent) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -453,7 +543,7 @@ func (m *FeePool) Reset() { *m = FeePool{} } func (m *FeePool) String() string { return proto.CompactTextString(m) } func (*FeePool) ProtoMessage() {} func (*FeePool) Descriptor() ([]byte, []int) { - return fileDescriptor_9fddf2a8e4a90b09, []int{8} + return fileDescriptor_9fddf2a8e4a90b09, []int{10} } func (m *FeePool) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -500,7 +590,7 @@ type CommunityPoolSpendProposal struct { func (m *CommunityPoolSpendProposal) Reset() { *m = CommunityPoolSpendProposal{} } func (*CommunityPoolSpendProposal) ProtoMessage() {} func (*CommunityPoolSpendProposal) Descriptor() ([]byte, []int) { - return fileDescriptor_9fddf2a8e4a90b09, []int{9} + return fileDescriptor_9fddf2a8e4a90b09, []int{11} } func (m *CommunityPoolSpendProposal) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -546,7 +636,7 @@ func (m *DelegatorStartingInfo) Reset() { *m = DelegatorStartingInfo{} } func (m *DelegatorStartingInfo) String() string { return proto.CompactTextString(m) } func (*DelegatorStartingInfo) ProtoMessage() {} func (*DelegatorStartingInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_9fddf2a8e4a90b09, []int{10} + return fileDescriptor_9fddf2a8e4a90b09, []int{12} } func (m *DelegatorStartingInfo) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -597,6 +687,8 @@ func init() { proto.RegisterType((*Params)(nil), "cosmos_sdk.x.ditribution.v1.Params") proto.RegisterType((*ValidatorHistoricalRewards)(nil), "cosmos_sdk.x.ditribution.v1.ValidatorHistoricalRewards") proto.RegisterType((*ValidatorCurrentRewards)(nil), "cosmos_sdk.x.ditribution.v1.ValidatorCurrentRewards") + proto.RegisterType((*ValidatorAccumulatedCommission)(nil), "cosmos_sdk.x.ditribution.v1.ValidatorAccumulatedCommission") + proto.RegisterType((*ValidatorOutstandingRewards)(nil), "cosmos_sdk.x.ditribution.v1.ValidatorOutstandingRewards") proto.RegisterType((*ValidatorSlashEvent)(nil), "cosmos_sdk.x.ditribution.v1.ValidatorSlashEvent") proto.RegisterType((*FeePool)(nil), "cosmos_sdk.x.ditribution.v1.FeePool") proto.RegisterType((*CommunityPoolSpendProposal)(nil), "cosmos_sdk.x.ditribution.v1.CommunityPoolSpendProposal") @@ -606,72 +698,76 @@ func init() { func init() { proto.RegisterFile("x/distribution/types/types.proto", fileDescriptor_9fddf2a8e4a90b09) } var fileDescriptor_9fddf2a8e4a90b09 = []byte{ - // 1033 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x56, 0xbd, 0x6f, 0x23, 0xc5, - 0x1b, 0xf6, 0xe6, 0xeb, 0x92, 0xb9, 0x24, 0x4e, 0x36, 0x71, 0x12, 0x39, 0x3f, 0x79, 0xad, 0x29, - 0xf2, 0x0b, 0x42, 0x67, 0xeb, 0xa0, 0x41, 0x29, 0x90, 0xe2, 0x7c, 0x08, 0xa4, 0x33, 0x8a, 0x36, - 0xe1, 0x90, 0x90, 0xd0, 0x6a, 0xbc, 0x3b, 0xb1, 0x47, 0x59, 0xef, 0xac, 0x66, 0xc6, 0x76, 0x72, - 0x0d, 0x12, 0x15, 0x12, 0x14, 0x14, 0x48, 0x50, 0x50, 0x5c, 0x43, 0xc3, 0xdf, 0x00, 0xfd, 0x95, - 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- 0x64, 0xfc, 0x79, 0x5d, 0x32, 0xbe, 0xb9, 0x29, 0xe5, 0x5e, 0xde, 0x94, 0x72, 0xbf, 0xdd, 0x94, - 0x72, 0x9f, 0xce, 0x4a, 0x9a, 0xc6, 0x9c, 0xfc, 0xfa, 0x7d, 0xf7, 0xdf, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x08, 0x95, 0x05, 0x40, 0x79, 0x0b, 0x00, 0x00, + // 1089 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x57, 0xbf, 0x6f, 0x23, 0xc5, + 0x17, 0xf7, 0xe4, 0xd7, 0x25, 0x73, 0xf9, 0xb9, 0x89, 0x93, 0xc8, 0xf9, 0xca, 0x1b, 0x4d, 0x91, + 0x6f, 0x10, 0x3a, 0x47, 0x07, 0x0d, 0x4a, 0x81, 0x14, 0xe7, 0x87, 0x0e, 0xe9, 0x02, 0xd1, 0x26, + 0x1c, 0x12, 0x12, 0xb2, 0xc6, 0xbb, 0x93, 0xf5, 0x28, 0xeb, 0x9d, 0xd5, 0xcc, 0xac, 0x9d, 0x5c, + 0x03, 0xa2, 0x42, 0x82, 0x82, 0x02, 0x01, 0x05, 0xc5, 0x49, 0x88, 0x86, 0xbf, 0x01, 0xfa, 0x2b, + 0xaf, 0x03, 0x21, 0xdd, 0x82, 0x92, 0x12, 0xd1, 0xb8, 0xa4, 0x42, 0xbb, 0x33, 0xbb, 0x6b, 0x3b, + 0x96, 0x12, 0xa7, 0xb8, 0x6b, 0x6c, 0xef, 0x9b, 0x37, 0x9f, 0xcf, 0xe7, 0xbd, 0x79, 0xf3, 0xde, + 0x1a, 0xae, 0x9f, 0x6f, 0x39, 0x54, 0x48, 0x4e, 0xeb, 0xa1, 0xa4, 0xcc, 0xdf, 0x92, 0x17, 0x01, + 0x11, 0xea, 0xb3, 0x12, 0x70, 0x26, 0x99, 0xb1, 0x66, 0x33, 0xd1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, 0x96, 0xc1, 0xd7, 0x57, 0xe5, + 0xc2, 0x8b, 0xab, 0x72, 0xe1, 0xf7, 0xab, 0x72, 0xe1, 0xe3, 0xf1, 0x84, 0xa6, 0x3e, 0x91, 0xfc, + 0x79, 0x78, 0xfb, 0xbf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x73, 0x8e, 0xe8, 0x4b, 0xb8, 0x0c, 0x00, + 0x00, } func (m *MsgSetWithdrawAddress) Marshal() (dAtA []byte, err error) { @@ -969,6 +1065,80 @@ func (m *ValidatorCurrentRewards) MarshalToSizedBuffer(dAtA []byte) (int, error) return len(dAtA) - i, nil } +func (m *ValidatorAccumulatedCommission) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ValidatorAccumulatedCommission) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ValidatorAccumulatedCommission) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Commission) > 0 { + for iNdEx := len(m.Commission) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Commission[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *ValidatorOutstandingRewards) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ValidatorOutstandingRewards) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ValidatorOutstandingRewards) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Rewards) > 0 { + for iNdEx := len(m.Rewards) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Rewards[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + func (m *ValidatorSlashEvent) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -1276,6 +1446,36 @@ func (m *ValidatorCurrentRewards) Size() (n int) { return n } +func (m *ValidatorAccumulatedCommission) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Commission) > 0 { + for _, e := range m.Commission { + l = e.Size() + n += 1 + l + sovTypes(uint64(l)) + } + } + return n +} + +func (m *ValidatorOutstandingRewards) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Rewards) > 0 { + for _, e := range m.Rewards { + l = e.Size() + n += 1 + l + sovTypes(uint64(l)) + } + } + return n +} + func (m *ValidatorSlashEvent) Size() (n int) { if m == nil { return 0 @@ -2192,6 +2392,180 @@ func (m *ValidatorCurrentRewards) Unmarshal(dAtA []byte) error { } return nil } +func (m *ValidatorAccumulatedCommission) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ValidatorAccumulatedCommission: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ValidatorAccumulatedCommission: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Commission", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Commission = append(m.Commission, types.DecCoin{}) + if err := m.Commission[len(m.Commission)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ValidatorOutstandingRewards) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ValidatorOutstandingRewards: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ValidatorOutstandingRewards: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Rewards", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Rewards = append(m.Rewards, types.DecCoin{}) + if err := m.Rewards[len(m.Rewards)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *ValidatorSlashEvent) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 diff --git a/x/distribution/types/types.proto b/x/distribution/types/types.proto index 72305da8b1b9..e5e98290946d 100644 --- a/x/distribution/types/types.proto +++ b/x/distribution/types/types.proto @@ -108,6 +108,26 @@ message ValidatorCurrentRewards { uint64 period = 2 [(gogoproto.moretags) = "yaml:\"period\"" ]; } +// accumulated commission for a validator +// kept as a running counter, can be withdrawn at any time +message ValidatorAccumulatedCommission { + repeated cosmos_sdk.v1.DecCoin commission = 1 [ + (gogoproto.moretags) = "yaml:\"commission\"", + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins", + (gogoproto.nullable) = false + ]; +} + +// outstanding (un-withdrawn) rewards for a validator +// inexpensive to track, allows simple sanity checks +message ValidatorOutstandingRewards { + repeated cosmos_sdk.v1.DecCoin rewards = 1 [ + (gogoproto.moretags) = "yaml:\"rewards\"", + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins", + (gogoproto.nullable) = false + ]; +} + // validator slash event // height is implicit within the store key // needed to calculate appropriate amounts of staking token diff --git a/x/distribution/types/validator.go b/x/distribution/types/validator.go index ee600e002e7b..34a3fcaa057a 100644 --- a/x/distribution/types/validator.go +++ b/x/distribution/types/validator.go @@ -23,10 +23,6 @@ func NewValidatorCurrentRewards(rewards sdk.DecCoins, period uint64) ValidatorCu } } -// accumulated commission for a validator -// kept as a running counter, can be withdrawn at any time -type ValidatorAccumulatedCommission = sdk.DecCoins - // return the initial accumulated commission (zero) func InitialValidatorAccumulatedCommission() ValidatorAccumulatedCommission { return ValidatorAccumulatedCommission{} @@ -53,7 +49,3 @@ func (vs ValidatorSlashEvents) String() string { } return strings.TrimSpace(out) } - -// outstanding (un-withdrawn) rewards for a validator -// inexpensive to track, allows simple sanity checks -type ValidatorOutstandingRewards = sdk.DecCoins From 37bc9c4c5f7eabe0b333ed4c6c4b2c2e8c20ed07 Mon Sep 17 00:00:00 2001 From: Marko Baricevic Date: Wed, 5 Feb 2020 18:05:43 +0100 Subject: [PATCH 26/46] make it build, kinda --- x/distribution/keeper/alias_functions.go | 2 +- x/distribution/keeper/allocation.go | 4 ++-- x/distribution/keeper/invariants.go | 4 ++-- x/distribution/keeper/querier.go | 4 ++-- x/distribution/keeper/store.go | 3 +-- x/distribution/keeper/validator.go | 4 ++-- 6 files changed, 10 insertions(+), 11 deletions(-) diff --git a/x/distribution/keeper/alias_functions.go b/x/distribution/keeper/alias_functions.go index a02d2f2a0b4d..392881c7491b 100644 --- a/x/distribution/keeper/alias_functions.go +++ b/x/distribution/keeper/alias_functions.go @@ -8,7 +8,7 @@ import ( // get outstanding rewards func (k Keeper) GetValidatorOutstandingRewardsCoins(ctx sdk.Context, val sdk.ValAddress) sdk.DecCoins { - return k.GetValidatorOutstandingRewards(ctx, val) + return k.GetValidatorOutstandingRewards(ctx, val).Rewards } // get the community coins diff --git a/x/distribution/keeper/allocation.go b/x/distribution/keeper/allocation.go index d6cfcc4fe06a..385da6b00efd 100644 --- a/x/distribution/keeper/allocation.go +++ b/x/distribution/keeper/allocation.go @@ -114,7 +114,7 @@ func (k Keeper) AllocateTokensToValidator(ctx sdk.Context, val exported.Validato ), ) currentCommission := k.GetValidatorAccumulatedCommission(ctx, val.GetOperator()) - currentCommission = currentCommission.Commission.Add(commission...) + currentCommission.Commission = currentCommission.Commission.Add(commission...) k.SetValidatorAccumulatedCommission(ctx, val.GetOperator(), currentCommission) // update current rewards @@ -131,6 +131,6 @@ func (k Keeper) AllocateTokensToValidator(ctx sdk.Context, val exported.Validato ), ) outstanding := k.GetValidatorOutstandingRewards(ctx, val.GetOperator()) - outstanding = outstanding.Rewards.Add(tokens...) + outstanding.Rewards = outstanding.Rewards.Add(tokens...) k.SetValidatorOutstandingRewards(ctx, val.GetOperator(), outstanding) } diff --git a/x/distribution/keeper/invariants.go b/x/distribution/keeper/invariants.go index cfafe1b11b27..046fa4d38581 100644 --- a/x/distribution/keeper/invariants.go +++ b/x/distribution/keeper/invariants.go @@ -47,7 +47,7 @@ func NonNegativeOutstandingInvariant(k Keeper) sdk.Invariant { var outstanding sdk.DecCoins k.IterateValidatorOutstandingRewards(ctx, func(addr sdk.ValAddress, rewards types.ValidatorOutstandingRewards) (stop bool) { - outstanding = rewards + outstanding = rewards.GetRewards() if outstanding.IsAnyNegative() { count++ msg += fmt.Sprintf("\t%v has negative outstanding coins: %v\n", addr, outstanding) @@ -140,7 +140,7 @@ func ModuleAccountInvariant(k Keeper) sdk.Invariant { var expectedCoins sdk.DecCoins k.IterateValidatorOutstandingRewards(ctx, func(_ sdk.ValAddress, rewards types.ValidatorOutstandingRewards) (stop bool) { - expectedCoins = expectedCoins.Add(rewards...) + expectedCoins = expectedCoins.Add(rewards.Rewards...) return false }) diff --git a/x/distribution/keeper/querier.go b/x/distribution/keeper/querier.go index 90bbfc72da43..77d4c6520971 100644 --- a/x/distribution/keeper/querier.go +++ b/x/distribution/keeper/querier.go @@ -67,8 +67,8 @@ func queryValidatorOutstandingRewards(ctx sdk.Context, path []string, req abci.R } rewards := k.GetValidatorOutstandingRewards(ctx, params.ValidatorAddress) - if rewards == nil { - rewards = sdk.DecCoins{} + if rewards.GetRewards() == nil { + rewards.Rewards = sdk.DecCoins{} } bz, err := codec.MarshalJSONIndent(k.cdc, rewards) diff --git a/x/distribution/keeper/store.go b/x/distribution/keeper/store.go index 5095a03b574d..4efd67ede905 100644 --- a/x/distribution/keeper/store.go +++ b/x/distribution/keeper/store.go @@ -60,13 +60,12 @@ func (k Keeper) SetFeePool(ctx sdk.Context, feePool types.FeePool) { } // get the proposer public key for this block -func (k Keeper) GetPreviousProposerConsAddr(ctx sdk.Context) (consAddr sdk.ConsAddress) { +func (k Keeper) GetPreviousProposerConsAddr(ctx sdk.Context) (consAddr sdk.ConsAddress) { // here store := ctx.KVStore(k.storeKey) bz := store.Get(types.ProposerKey) if bz == nil { panic("Previous proposer not set") } - conAddr := sdk.ConsAddress{} k.cdc.MustUnmarshalBinaryLengthPrefixed(bz, &conAddr) return } diff --git a/x/distribution/keeper/validator.go b/x/distribution/keeper/validator.go index ccedb7ede163..6b9711a76443 100644 --- a/x/distribution/keeper/validator.go +++ b/x/distribution/keeper/validator.go @@ -21,7 +21,7 @@ func (k Keeper) initializeValidator(ctx sdk.Context, val exported.ValidatorI) { k.SetValidatorAccumulatedCommission(ctx, val.GetOperator(), types.InitialValidatorAccumulatedCommission()) // set outstanding rewards - k.SetValidatorOutstandingRewards(ctx, val.GetOperator(), sdk.DecCoins{}) + k.SetValidatorOutstandingRewards(ctx, val.GetOperator(), types.ValidatorOutstandingRewards{Rewards: sdk.DecCoins{}}) } // increment validator period, returning the period just ended @@ -38,7 +38,7 @@ func (k Keeper) incrementValidatorPeriod(ctx sdk.Context, val exported.Validator feePool := k.GetFeePool(ctx) outstanding := k.GetValidatorOutstandingRewards(ctx, val.GetOperator()) feePool.CommunityPool = feePool.CommunityPool.Add(rewards.Rewards...) - outstanding = outstanding.Sub(rewards.Rewards) + outstanding.Rewards = outstanding.GetRewards().Sub(rewards.Rewards) k.SetFeePool(ctx, feePool) k.SetValidatorOutstandingRewards(ctx, val.GetOperator(), outstanding) From 8c2431ad059844afc979ca0fc4c8a67cfa7c90b7 Mon Sep 17 00:00:00 2001 From: Marko Baricevic Date: Thu, 6 Feb 2020 12:49:08 +0100 Subject: [PATCH 27/46] its alive --- simapp/app.go | 2 +- simapp/export.go | 2 +- x/distribution/genesis.go | 4 ++-- x/distribution/keeper/invariants.go | 2 +- x/distribution/keeper/store.go | 11 +++++++---- x/distribution/simulation/operations.go | 2 +- 6 files changed, 13 insertions(+), 10 deletions(-) diff --git a/simapp/app.go b/simapp/app.go index 7dc5a8b5de87..facc380ea42c 100644 --- a/simapp/app.go +++ b/simapp/app.go @@ -187,7 +187,7 @@ func NewSimApp( app.SupplyKeeper, auth.FeeCollectorName, ) app.DistrKeeper = distr.NewKeeper( - app.cdc, keys[distr.StoreKey], app.subspaces[distr.ModuleName], app.BankKeeper, &stakingKeeper, + distr.ModuleCdc, keys[distr.StoreKey], app.subspaces[distr.ModuleName], app.BankKeeper, &stakingKeeper, app.SupplyKeeper, auth.FeeCollectorName, app.ModuleAccountAddrs(), ) app.SlashingKeeper = slashing.NewKeeper( diff --git a/simapp/export.go b/simapp/export.go index 01b1424032cf..6ee705706971 100644 --- a/simapp/export.go +++ b/simapp/export.go @@ -91,7 +91,7 @@ func (app *SimApp) prepForZeroHeightGenesis(ctx sdk.Context, jailWhiteList []str // donate any unwithdrawn outstanding reward fraction tokens to the community pool scraps := app.DistrKeeper.GetValidatorOutstandingRewards(ctx, val.GetOperator()) feePool := app.DistrKeeper.GetFeePool(ctx) - feePool.CommunityPool = feePool.CommunityPool.Add(scraps...) + feePool.CommunityPool = feePool.CommunityPool.Add(scraps.Rewards...) app.DistrKeeper.SetFeePool(ctx, feePool) app.DistrKeeper.Hooks().AfterValidatorCreated(ctx, val.GetOperator()) diff --git a/x/distribution/genesis.go b/x/distribution/genesis.go index 9e00aeba2b7c..2e05a85556f6 100644 --- a/x/distribution/genesis.go +++ b/x/distribution/genesis.go @@ -19,7 +19,7 @@ func InitGenesis(ctx sdk.Context, bk types.BankKeeper, supplyKeeper types.Supply } keeper.SetPreviousProposerConsAddr(ctx, data.PreviousProposer) for _, rew := range data.OutstandingRewards { - keeper.SetValidatorOutstandingRewards(ctx, rew.ValidatorAddress, rew.OutstandingRewards) + keeper.SetValidatorOutstandingRewards(ctx, rew.ValidatorAddress, types.ValidatorOutstandingRewards{Rewards: rew.OutstandingRewards}) moduleHoldings = moduleHoldings.Add(rew.OutstandingRewards...) } for _, acc := range data.ValidatorAccumulatedCommissions { @@ -76,7 +76,7 @@ func ExportGenesis(ctx sdk.Context, keeper Keeper) types.GenesisState { func(addr sdk.ValAddress, rewards types.ValidatorOutstandingRewards) (stop bool) { outstanding = append(outstanding, types.ValidatorOutstandingRewardsRecord{ ValidatorAddress: addr, - OutstandingRewards: rewards, + OutstandingRewards: rewards.Rewards, }) return false }, diff --git a/x/distribution/keeper/invariants.go b/x/distribution/keeper/invariants.go index 046fa4d38581..c7ad575fea9c 100644 --- a/x/distribution/keeper/invariants.go +++ b/x/distribution/keeper/invariants.go @@ -89,7 +89,7 @@ func CanWithdrawInvariant(k Keeper) sdk.Invariant { } } - remaining = k.GetValidatorOutstandingRewards(ctx, val.GetOperator()) + remaining = k.GetValidatorOutstandingRewards(ctx, val.GetOperator()).Rewards if len(remaining) > 0 && remaining[0].Amount.IsNegative() { return true } diff --git a/x/distribution/keeper/store.go b/x/distribution/keeper/store.go index 4efd67ede905..89627e5b268c 100644 --- a/x/distribution/keeper/store.go +++ b/x/distribution/keeper/store.go @@ -1,6 +1,8 @@ package keeper import ( + gogotypes "github.com/gogo/protobuf/types" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/distribution/types" ) @@ -66,15 +68,16 @@ func (k Keeper) GetPreviousProposerConsAddr(ctx sdk.Context) (consAddr sdk.ConsA if bz == nil { panic("Previous proposer not set") } - k.cdc.MustUnmarshalBinaryLengthPrefixed(bz, &conAddr) - return + addrValue := gogotypes.BytesValue{} + k.cdc.MustUnmarshalBinaryLengthPrefixed(bz, &addrValue) + return addrValue.GetValue() } // set the proposer public key for this block func (k Keeper) SetPreviousProposerConsAddr(ctx sdk.Context, consAddr sdk.ConsAddress) { store := ctx.KVStore(k.storeKey) - b := k.cdc.MustMarshalBinaryLengthPrefixed(&consAddr) - store.Set(types.ProposerKey, b) + bz := k.cdc.MustMarshalBinaryLengthPrefixed(&gogotypes.BytesValue{Value: consAddr}) + store.Set(types.ProposerKey, bz) } // get the starting info associated with a delegator diff --git a/x/distribution/simulation/operations.go b/x/distribution/simulation/operations.go index 30bc1a61ec2e..26b51691565b 100644 --- a/x/distribution/simulation/operations.go +++ b/x/distribution/simulation/operations.go @@ -180,7 +180,7 @@ func SimulateMsgWithdrawValidatorCommission(ak types.AccountKeeper, bk types.Ban } commission := k.GetValidatorAccumulatedCommission(ctx, validator.GetOperator()) - if commission.IsZero() { + if commission.Commission.IsZero() { return simulation.NoOpMsg(types.ModuleName), nil, nil } From bdf9455008700a5b1797378eeec9ea982e376ce7 Mon Sep 17 00:00:00 2001 From: Marko Baricevic Date: Thu, 6 Feb 2020 13:24:45 +0100 Subject: [PATCH 28/46] fix tests --- x/distribution/keeper/allocation_test.go | 8 ++++---- x/distribution/keeper/delegation_test.go | 14 +++++++------- x/distribution/keeper/keeper_test.go | 2 +- x/distribution/keeper/querier_test.go | 12 +++++++----- x/distribution/simulation/decoder_test.go | 4 ++-- 5 files changed, 21 insertions(+), 19 deletions(-) diff --git a/x/distribution/keeper/allocation_test.go b/x/distribution/keeper/allocation_test.go index b8c0d3948a60..9628b74597fa 100644 --- a/x/distribution/keeper/allocation_test.go +++ b/x/distribution/keeper/allocation_test.go @@ -37,7 +37,7 @@ func TestAllocateTokensToValidatorWithCommission(t *testing.T) { expected := sdk.DecCoins{ {Denom: sdk.DefaultBondDenom, Amount: sdk.NewDec(5)}, } - require.Equal(t, expected, k.GetValidatorAccumulatedCommission(ctx, val.GetOperator())) + require.Equal(t, expected, k.GetValidatorAccumulatedCommission(ctx, val.GetOperator()).Commission) // check current rewards require.Equal(t, expected, k.GetValidatorCurrentRewards(ctx, val.GetOperator()).Rewards) @@ -105,12 +105,12 @@ func TestAllocateTokensToManyValidators(t *testing.T) { k.AllocateTokens(ctx, 200, 200, valConsAddr2, votes) // 98 outstanding rewards (100 less 2 to community pool) - require.Equal(t, sdk.DecCoins{{Denom: sdk.DefaultBondDenom, Amount: sdk.NewDecWithPrec(465, 1)}}, k.GetValidatorOutstandingRewards(ctx, valOpAddr1)) - require.Equal(t, sdk.DecCoins{{Denom: sdk.DefaultBondDenom, Amount: sdk.NewDecWithPrec(515, 1)}}, k.GetValidatorOutstandingRewards(ctx, valOpAddr2)) + require.Equal(t, sdk.DecCoins{{Denom: sdk.DefaultBondDenom, Amount: sdk.NewDecWithPrec(465, 1)}}, k.GetValidatorOutstandingRewards(ctx, valOpAddr1).Rewards) + require.Equal(t, sdk.DecCoins{{Denom: sdk.DefaultBondDenom, Amount: sdk.NewDecWithPrec(515, 1)}}, k.GetValidatorOutstandingRewards(ctx, valOpAddr2).Rewards) // 2 community pool coins require.Equal(t, sdk.DecCoins{{Denom: sdk.DefaultBondDenom, Amount: sdk.NewDec(2)}}, k.GetFeePool(ctx).CommunityPool) // 50% commission for first proposer, (0.5 * 93%) * 100 / 2 = 23.25 - require.Equal(t, sdk.DecCoins{{Denom: sdk.DefaultBondDenom, Amount: sdk.NewDecWithPrec(2325, 2)}}, k.GetValidatorAccumulatedCommission(ctx, valOpAddr1)) + require.Equal(t, sdk.DecCoins{{Denom: sdk.DefaultBondDenom, Amount: sdk.NewDecWithPrec(2325, 2)}}, k.GetValidatorAccumulatedCommission(ctx, valOpAddr1).Commission) // zero commission for second proposer require.True(t, k.GetValidatorAccumulatedCommission(ctx, valOpAddr2).Commission.IsZero()) // just staking.proportional for first proposer less commission = (0.5 * 93%) * 100 / 2 = 23.25 diff --git a/x/distribution/keeper/delegation_test.go b/x/distribution/keeper/delegation_test.go index 1bb00c38d8ca..a297eb5ba3a1 100644 --- a/x/distribution/keeper/delegation_test.go +++ b/x/distribution/keeper/delegation_test.go @@ -63,7 +63,7 @@ func TestCalculateRewardsBasic(t *testing.T) { require.Equal(t, sdk.DecCoins{{Denom: sdk.DefaultBondDenom, Amount: sdk.NewDec(initial / 2)}}, rewards) // commission should be the other half - require.Equal(t, sdk.DecCoins{{Denom: sdk.DefaultBondDenom, Amount: sdk.NewDec(initial / 2)}}, k.GetValidatorAccumulatedCommission(ctx, valOpAddr1)) + require.Equal(t, sdk.DecCoins{{Denom: sdk.DefaultBondDenom, Amount: sdk.NewDec(initial / 2)}}, k.GetValidatorAccumulatedCommission(ctx, valOpAddr1).Commission) } func TestCalculateRewardsAfterSlash(t *testing.T) { @@ -128,7 +128,7 @@ func TestCalculateRewardsAfterSlash(t *testing.T) { // commission should be the other half require.Equal(t, sdk.DecCoins{{Denom: sdk.DefaultBondDenom, Amount: initial.QuoRaw(2).ToDec()}}, - k.GetValidatorAccumulatedCommission(ctx, valOpAddr1)) + k.GetValidatorAccumulatedCommission(ctx, valOpAddr1).Commission) } func TestCalculateRewardsAfterManySlashes(t *testing.T) { @@ -205,7 +205,7 @@ func TestCalculateRewardsAfterManySlashes(t *testing.T) { // commission should be the other half require.Equal(t, sdk.DecCoins{{Denom: sdk.DefaultBondDenom, Amount: initial.ToDec()}}, - k.GetValidatorAccumulatedCommission(ctx, valOpAddr1)) + k.GetValidatorAccumulatedCommission(ctx, valOpAddr1).Commission) } func TestCalculateRewardsMultiDelegator(t *testing.T) { @@ -273,7 +273,7 @@ func TestCalculateRewardsMultiDelegator(t *testing.T) { require.Equal(t, sdk.DecCoins{{Denom: sdk.DefaultBondDenom, Amount: sdk.NewDec(initial * 1 / 4)}}, rewards) // commission should be equal to initial (50% twice) - require.Equal(t, sdk.DecCoins{{Denom: sdk.DefaultBondDenom, Amount: sdk.NewDec(initial)}}, k.GetValidatorAccumulatedCommission(ctx, valOpAddr1)) + require.Equal(t, sdk.DecCoins{{Denom: sdk.DefaultBondDenom, Amount: sdk.NewDec(initial)}}, k.GetValidatorAccumulatedCommission(ctx, valOpAddr1).Commission) } func TestWithdrawDelegationRewardsBasic(t *testing.T) { @@ -419,7 +419,7 @@ func TestCalculateRewardsAfterManySlashesInSameBlock(t *testing.T) { require.Equal(t, sdk.DecCoins{{Denom: sdk.DefaultBondDenom, Amount: initial}}, rewards) // commission should be the other half - require.Equal(t, sdk.DecCoins{{Denom: sdk.DefaultBondDenom, Amount: initial}}, k.GetValidatorAccumulatedCommission(ctx, valOpAddr1)) + require.Equal(t, sdk.DecCoins{{Denom: sdk.DefaultBondDenom, Amount: initial}}, k.GetValidatorAccumulatedCommission(ctx, valOpAddr1).Commission) } func TestCalculateRewardsMultiDelegatorMultiSlash(t *testing.T) { @@ -501,7 +501,7 @@ func TestCalculateRewardsMultiDelegatorMultiSlash(t *testing.T) { require.Equal(t, sdk.DecCoins{{Denom: sdk.DefaultBondDenom, Amount: initial.QuoInt64(3)}}, rewards) // commission should be equal to initial (twice 50% commission, unaffected by slashing) - require.Equal(t, sdk.DecCoins{{Denom: sdk.DefaultBondDenom, Amount: initial}}, k.GetValidatorAccumulatedCommission(ctx, valOpAddr1)) + require.Equal(t, sdk.DecCoins{{Denom: sdk.DefaultBondDenom, Amount: initial}}, k.GetValidatorAccumulatedCommission(ctx, valOpAddr1).Commission) } func TestCalculateRewardsMultiDelegatorMultWithdraw(t *testing.T) { @@ -619,7 +619,7 @@ func TestCalculateRewardsMultiDelegatorMultWithdraw(t *testing.T) { require.Equal(t, sdk.DecCoins{{Denom: sdk.DefaultBondDenom, Amount: sdk.NewDec(initial / 4)}}, rewards) // commission should be half initial - require.Equal(t, sdk.DecCoins{{Denom: sdk.DefaultBondDenom, Amount: sdk.NewDec(initial / 2)}}, k.GetValidatorAccumulatedCommission(ctx, valOpAddr1)) + require.Equal(t, sdk.DecCoins{{Denom: sdk.DefaultBondDenom, Amount: sdk.NewDec(initial / 2)}}, k.GetValidatorAccumulatedCommission(ctx, valOpAddr1).Commission) // next block ctx = ctx.WithBlockHeight(ctx.BlockHeight() + 1) diff --git a/x/distribution/keeper/keeper_test.go b/x/distribution/keeper/keeper_test.go index 0942d6edada1..85312df33a24 100644 --- a/x/distribution/keeper/keeper_test.go +++ b/x/distribution/keeper/keeper_test.go @@ -70,7 +70,7 @@ func TestWithdrawValidatorCommission(t *testing.T) { ), balance) // check remainder - remainder := keeper.GetValidatorAccumulatedCommission(ctx, valOpAddr3) + remainder := keeper.GetValidatorAccumulatedCommission(ctx, valOpAddr3).Commission require.Equal(t, sdk.DecCoins{ sdk.NewDecCoinFromDec("mytoken", sdk.NewDec(1).Quo(sdk.NewDec(4))), sdk.NewDecCoinFromDec("stake", sdk.NewDec(1).Quo(sdk.NewDec(2))), diff --git a/x/distribution/keeper/querier_test.go b/x/distribution/keeper/querier_test.go index 745e9149e3e2..7d032a6ccd95 100644 --- a/x/distribution/keeper/querier_test.go +++ b/x/distribution/keeper/querier_test.go @@ -27,7 +27,7 @@ func getQueriedParams(t *testing.T, ctx sdk.Context, cdc *codec.Codec, querier s return params } -func getQueriedValidatorOutstandingRewards(t *testing.T, ctx sdk.Context, cdc *codec.Codec, querier sdk.Querier, validatorAddr sdk.ValAddress) (outstandingRewards sdk.DecCoins) { +func getQueriedValidatorOutstandingRewards(t *testing.T, ctx sdk.Context, cdc *codec.Codec, querier sdk.Querier, validatorAddr sdk.ValAddress) sdk.DecCoins { query := abci.RequestQuery{ Path: strings.Join([]string{custom, types.QuerierRoute, types.QueryValidatorOutstandingRewards}, "/"), Data: cdc.MustMarshalJSON(types.NewQueryValidatorOutstandingRewardsParams(validatorAddr)), @@ -35,12 +35,13 @@ func getQueriedValidatorOutstandingRewards(t *testing.T, ctx sdk.Context, cdc *c bz, err := querier(ctx, []string{types.QueryValidatorOutstandingRewards}, query) require.Nil(t, err) + outstandingRewards := types.ValidatorOutstandingRewards{} require.Nil(t, cdc.UnmarshalJSON(bz, &outstandingRewards)) - return + return outstandingRewards.GetRewards() } -func getQueriedValidatorCommission(t *testing.T, ctx sdk.Context, cdc *codec.Codec, querier sdk.Querier, validatorAddr sdk.ValAddress) (validatorCommission sdk.DecCoins) { +func getQueriedValidatorCommission(t *testing.T, ctx sdk.Context, cdc *codec.Codec, querier sdk.Querier, validatorAddr sdk.ValAddress) sdk.DecCoins { query := abci.RequestQuery{ Path: strings.Join([]string{custom, types.QuerierRoute, types.QueryValidatorCommission}, "/"), Data: cdc.MustMarshalJSON(types.NewQueryValidatorCommissionParams(validatorAddr)), @@ -48,9 +49,10 @@ func getQueriedValidatorCommission(t *testing.T, ctx sdk.Context, cdc *codec.Cod bz, err := querier(ctx, []string{types.QueryValidatorCommission}, query) require.Nil(t, err) + validatorCommission := types.ValidatorAccumulatedCommission{} require.Nil(t, cdc.UnmarshalJSON(bz, &validatorCommission)) - return + return validatorCommission.GetCommission() } func getQueriedValidatorSlashes(t *testing.T, ctx sdk.Context, cdc *codec.Codec, querier sdk.Querier, validatorAddr sdk.ValAddress, startHeight uint64, endHeight uint64) (slashes []types.ValidatorSlashEvent) { @@ -130,7 +132,7 @@ func TestQueries(t *testing.T) { // test outstanding rewards query outstandingRewards := sdk.DecCoins{{Denom: "mytoken", Amount: sdk.NewDec(3)}, {Denom: "myothertoken", Amount: sdk.NewDecWithPrec(3, 7)}} - keeper.SetValidatorOutstandingRewards(ctx, valOpAddr1, outstandingRewards) + keeper.SetValidatorOutstandingRewards(ctx, valOpAddr1, types.ValidatorOutstandingRewards{Rewards: outstandingRewards}) retOutstandingRewards := getQueriedValidatorOutstandingRewards(t, ctx, cdc, querier, valOpAddr1) require.Equal(t, outstandingRewards, retOutstandingRewards) diff --git a/x/distribution/simulation/decoder_test.go b/x/distribution/simulation/decoder_test.go index d8c6d719ce9e..059c2d625afd 100644 --- a/x/distribution/simulation/decoder_test.go +++ b/x/distribution/simulation/decoder_test.go @@ -36,8 +36,8 @@ func TestDecodeDistributionStore(t *testing.T) { feePool := types.InitialFeePool() feePool.CommunityPool = decCoins info := types.NewDelegatorStartingInfo(2, sdk.OneDec(), 200) - outstanding := types.ValidatorOutstandingRewards{decCoins[0]} - commission := types.ValidatorAccumulatedCommission{decCoins[0]} + outstanding := types.ValidatorOutstandingRewards{Rewards: decCoins} + commission := types.ValidatorAccumulatedCommission{Commission: decCoins} historicalRewards := types.NewValidatorHistoricalRewards(decCoins, 100) currentRewards := types.NewValidatorCurrentRewards(decCoins, 5) slashEvent := types.NewValidatorSlashEvent(10, sdk.OneDec()) From ccc799c4d19d65f28b4a59035b235e16a03504c9 Mon Sep 17 00:00:00 2001 From: Marko Baricevic Date: Thu, 6 Feb 2020 15:31:46 +0100 Subject: [PATCH 29/46] move slashevents to proto --- x/distribution/client/cli/query.go | 11 +- x/distribution/types/types.pb.go | 334 ++++++++++++++++++++++------- x/distribution/types/types.proto | 9 + x/distribution/types/validator.go | 11 +- 4 files changed, 285 insertions(+), 80 deletions(-) diff --git a/x/distribution/client/cli/query.go b/x/distribution/client/cli/query.go index 92af18275233..ce3f05abd343 100644 --- a/x/distribution/client/cli/query.go +++ b/x/distribution/client/cli/query.go @@ -140,8 +140,10 @@ $ %s query distribution commission cosmosvaloper1gghjut3ccd8ay0zduzj64hwre2fxs9l return err } - var valCom types.ValidatorAccumulatedCommission - cdc.MustUnmarshalJSON(res, &valCom) + valCom, err := types.UnmarshalValidatorAccumulatedCommission(types.ModuleCdc, res) + if err != nil { + return err + } return cliCtx.PrintOutput(valCom) }, } @@ -192,7 +194,10 @@ $ %s query distribution slashes cosmosvaloper1gghjut3ccd8ay0zduzj64hwre2fxs9ldmq } var slashes types.ValidatorSlashEvents - cdc.MustUnmarshalJSON(res, &slashes) + err = cdc.UnmarshalBinaryLengthPrefixed(res, &slashes) + if err != nil { + return err + } return cliCtx.PrintOutput(slashes) }, } diff --git a/x/distribution/types/types.pb.go b/x/distribution/types/types.pb.go index d74fb58518f8..869486985cb2 100644 --- a/x/distribution/types/types.pb.go +++ b/x/distribution/types/types.pb.go @@ -441,6 +441,8 @@ func (m *ValidatorAccumulatedCommission) GetCommission() github_com_cosmos_cosmo return nil } +// outstanding (un-withdrawn) rewards for a validator +// inexpensive to track, allows simple sanity checks type ValidatorOutstandingRewards struct { Rewards github_com_cosmos_cosmos_sdk_types.DecCoins `protobuf:"bytes,1,rep,name=rewards,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.DecCoins" json:"rewards" yaml:"rewards"` } @@ -534,6 +536,50 @@ func (m *ValidatorSlashEvent) GetValidatorPeriod() uint64 { return 0 } +// ValidatorSlashEvents is a collection of ValidatorSlashEvent +type ValidatorSlashEvents struct { + ValidatorSlashEvents []ValidatorSlashEvent `protobuf:"bytes,1,rep,name=validator_slash_events,json=validatorSlashEvents,proto3" json:"validator_slash_events" yaml:"validator_slash_events"` +} + +func (m *ValidatorSlashEvents) Reset() { *m = ValidatorSlashEvents{} } +func (*ValidatorSlashEvents) ProtoMessage() {} +func (*ValidatorSlashEvents) Descriptor() ([]byte, []int) { + return fileDescriptor_9fddf2a8e4a90b09, []int{10} +} +func (m *ValidatorSlashEvents) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ValidatorSlashEvents) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ValidatorSlashEvents.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ValidatorSlashEvents) XXX_Merge(src proto.Message) { + xxx_messageInfo_ValidatorSlashEvents.Merge(m, src) +} +func (m *ValidatorSlashEvents) XXX_Size() int { + return m.Size() +} +func (m *ValidatorSlashEvents) XXX_DiscardUnknown() { + xxx_messageInfo_ValidatorSlashEvents.DiscardUnknown(m) +} + +var xxx_messageInfo_ValidatorSlashEvents proto.InternalMessageInfo + +func (m *ValidatorSlashEvents) GetValidatorSlashEvents() []ValidatorSlashEvent { + if m != nil { + return m.ValidatorSlashEvents + } + return nil +} + // global fee pool for distribution type FeePool struct { CommunityPool github_com_cosmos_cosmos_sdk_types.DecCoins `protobuf:"bytes,1,rep,name=community_pool,json=communityPool,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.DecCoins" json:"community_pool" yaml:"community_pool"` @@ -543,7 +589,7 @@ func (m *FeePool) Reset() { *m = FeePool{} } func (m *FeePool) String() string { return proto.CompactTextString(m) } func (*FeePool) ProtoMessage() {} func (*FeePool) Descriptor() ([]byte, []int) { - return fileDescriptor_9fddf2a8e4a90b09, []int{10} + return fileDescriptor_9fddf2a8e4a90b09, []int{11} } func (m *FeePool) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -590,7 +636,7 @@ type CommunityPoolSpendProposal struct { func (m *CommunityPoolSpendProposal) Reset() { *m = CommunityPoolSpendProposal{} } func (*CommunityPoolSpendProposal) ProtoMessage() {} func (*CommunityPoolSpendProposal) Descriptor() ([]byte, []int) { - return fileDescriptor_9fddf2a8e4a90b09, []int{11} + return fileDescriptor_9fddf2a8e4a90b09, []int{12} } func (m *CommunityPoolSpendProposal) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -636,7 +682,7 @@ func (m *DelegatorStartingInfo) Reset() { *m = DelegatorStartingInfo{} } func (m *DelegatorStartingInfo) String() string { return proto.CompactTextString(m) } func (*DelegatorStartingInfo) ProtoMessage() {} func (*DelegatorStartingInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_9fddf2a8e4a90b09, []int{12} + return fileDescriptor_9fddf2a8e4a90b09, []int{13} } func (m *DelegatorStartingInfo) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -690,6 +736,7 @@ func init() { proto.RegisterType((*ValidatorAccumulatedCommission)(nil), "cosmos_sdk.x.ditribution.v1.ValidatorAccumulatedCommission") proto.RegisterType((*ValidatorOutstandingRewards)(nil), "cosmos_sdk.x.ditribution.v1.ValidatorOutstandingRewards") proto.RegisterType((*ValidatorSlashEvent)(nil), "cosmos_sdk.x.ditribution.v1.ValidatorSlashEvent") + proto.RegisterType((*ValidatorSlashEvents)(nil), "cosmos_sdk.x.ditribution.v1.ValidatorSlashEvents") proto.RegisterType((*FeePool)(nil), "cosmos_sdk.x.ditribution.v1.FeePool") proto.RegisterType((*CommunityPoolSpendProposal)(nil), "cosmos_sdk.x.ditribution.v1.CommunityPoolSpendProposal") proto.RegisterType((*DelegatorStartingInfo)(nil), "cosmos_sdk.x.ditribution.v1.DelegatorStartingInfo") @@ -698,76 +745,78 @@ func init() { func init() { proto.RegisterFile("x/distribution/types/types.proto", fileDescriptor_9fddf2a8e4a90b09) } var fileDescriptor_9fddf2a8e4a90b09 = []byte{ - // 1089 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x57, 0xbf, 0x6f, 0x23, 0xc5, - 0x17, 0xf7, 0xe4, 0xd7, 0x25, 0x73, 0xf9, 0xb9, 0x89, 0x93, 0xc8, 0xf9, 0xca, 0x1b, 0x4d, 0x91, - 0x6f, 0x10, 0x3a, 0x47, 0x07, 0x0d, 0x4a, 0x81, 0x14, 0xe7, 0x87, 0x0e, 0xe9, 0x02, 0xd1, 0x26, - 0x1c, 0x12, 0x12, 0xb2, 0xc6, 0xbb, 0x93, 0xf5, 0x28, 0xeb, 0x9d, 0xd5, 0xcc, 0xac, 0x9d, 0x5c, - 0x03, 0xa2, 0x42, 0x82, 0x82, 0x02, 0x01, 0x05, 0xc5, 0x49, 0x88, 0x86, 0xbf, 0x01, 0xfa, 0x2b, - 0xaf, 0x03, 0x21, 0xdd, 0x82, 0x92, 0x12, 0xd1, 0xb8, 0xa4, 0x42, 0xbb, 0x33, 0xbb, 0x6b, 0x3b, - 0x96, 0x12, 0xa7, 0xb8, 0x6b, 0x6c, 0xef, 0x9b, 0x37, 0x9f, 0xcf, 0xe7, 0xbd, 0x79, 0xf3, 0xde, - 0x1a, 0xae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 0x90, 0x35, - 0x9d, 0x3d, 0x9f, 0xe0, 0x73, 0xe3, 0x53, 0xb8, 0x54, 0xc7, 0x82, 0xd4, 0x02, 0xce, 0x02, 0x26, - 0x08, 0xaf, 0xf1, 0xe4, 0x52, 0x24, 0x71, 0x4e, 0x55, 0x0f, 0x87, 0xe6, 0x5c, 0x53, 0x9c, 0x83, - 0x30, 0x91, 0x65, 0xc4, 0xe6, 0x23, 0x6d, 0xd5, 0xb7, 0xef, 0x73, 0x00, 0x8b, 0x75, 0xe6, 0x87, - 0xe2, 0x9a, 0x84, 0xd1, 0x44, 0xc2, 0xfb, 0x43, 0x4b, 0xf8, 0x9f, 0x96, 0x30, 0x08, 0x14, 0x59, - 0x8b, 0x89, 0xbd, 0x4f, 0xc4, 0x09, 0x2c, 0xf6, 0x34, 0x9e, 0x1a, 0xf1, 0x71, 0xdd, 0x23, 0xce, - 0xea, 0xd8, 0x3a, 0xd8, 0x9c, 0xac, 0xae, 0xe7, 0xa8, 0x03, 0xdd, 0x90, 0xb5, 0xd8, 0xdd, 0x73, - 0xf6, 0x95, 0x75, 0x7b, 0xec, 0xfb, 0x67, 0x66, 0x01, 0xfd, 0x03, 0x60, 0x29, 0xbb, 0x5b, 0x8f, - 0xa8, 0x90, 0x8c, 0x53, 0x1b, 0x7b, 0x8a, 0x59, 0x18, 0x3f, 0x01, 0xb8, 0x62, 0x87, 0xcd, 0xd0, - 0xc3, 0x92, 0xb6, 0x88, 0x96, 0x59, 0xe3, 0x58, 0x52, 0xa6, 0xeb, 0x7b, 0xb9, 0xaf, 0xbe, 0xf7, - 0x88, 0x9d, 0x94, 0xf8, 0x87, 0xba, 0xc4, 0xcb, 0xfa, 0x98, 0x07, 0x83, 0xc4, 0x35, 0xff, 0xe6, - 0xed, 0x72, 0xa7, 0xca, 0xbe, 0x98, 0x03, 0x29, 0x8d, 0x56, 0x0c, 0x63, 0xfc, 0x1f, 0xce, 0x71, - 0x72, 0x4a, 0x38, 0xf1, 0x6d, 0x52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d7, 0x1a, 0x84, 0xba, 0x0d, 0x75, 0x20, 0x3d, 0x7d, 0x4d, 0xd9, 0x91, 0xa5, 0x1d, - 0xaa, 0xe6, 0xf3, 0xcb, 0x32, 0x78, 0x71, 0x59, 0x06, 0x7f, 0x5d, 0x96, 0xc1, 0xd7, 0x57, 0xe5, - 0xc2, 0x8b, 0xab, 0x72, 0xe1, 0xf7, 0xab, 0x72, 0xe1, 0xe3, 0xf1, 0x84, 0xa6, 0x3e, 0x91, 0xfc, - 0x79, 0x78, 0xfb, 0xbf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x73, 0x8e, 0xe8, 0x4b, 0xb8, 0x0c, 0x00, - 0x00, + // 1135 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x57, 0xcd, 0x6b, 0x24, 0x45, + 0x14, 0x9f, 0xca, 0xd7, 0x26, 0xb5, 0xf9, 0xec, 0x64, 0x92, 0x30, 0xd1, 0xe9, 0x50, 0x60, 0x8c, + 0xc8, 0x4e, 0x5c, 0xbd, 0x48, 0x0e, 0x42, 0x26, 0x1f, 0xac, 0xb0, 0xd1, 0xd0, 0x89, 0x2b, 0x08, + 0xd2, 0xd4, 0x74, 0x57, 0x66, 0x8a, 0xf4, 0x74, 0x35, 0x55, 0x35, 0x33, 0xc9, 0x5e, 0x14, 0x4f, + 0x82, 0x0a, 0x1e, 0x44, 0x3d, 0x78, 0x58, 0x10, 0x2f, 0xe2, 0x9f, 0xa0, 0xf7, 0x3d, 0xee, 0x4d, + 0x11, 0xb6, 0x95, 0xe4, 0x28, 0x5e, 0xe6, 0xe8, 0x49, 0xba, 0xab, 0xba, 0x7b, 0x66, 0x32, 0x6c, + 0x32, 0x39, 0xec, 0x5e, 0x92, 0xf4, 0xab, 0xd7, 0xbf, 0xdf, 0xef, 0xbd, 0x7a, 0x1f, 0x1d, 0xb8, + 0x7a, 0xba, 0xe1, 0x52, 0x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3, 0x99, 0x80, 0x93, 0x26, 0x65, 0xd1, 0xfa, 0xeb, 0x6c, 0xb4, 0x42, 0x3b, 0x34, + 0x17, 0xf5, 0xd0, 0xeb, 0x76, 0x40, 0xd6, 0x74, 0x62, 0xd1, 0x6d, 0x76, 0x04, 0x47, 0x85, 0xc4, + 0x27, 0x44, 0x67, 0xfc, 0x9d, 0x81, 0x7b, 0x4c, 0xdf, 0x66, 0x0c, 0x82, 0x2c, 0x05, 0x16, 0x8d, + 0xe1, 0x1a, 0xa1, 0xd5, 0x9a, 0xba, 0x90, 0xae, 0x31, 0xac, 0xec, 0xc8, 0xd2, 0x0e, 0x65, 0xf3, + 0xf1, 0x79, 0x11, 0x3c, 0x39, 0x2f, 0x82, 0xbf, 0xcf, 0x8b, 0xe0, 0xeb, 0x8b, 0x62, 0xee, 0xc9, + 0x45, 0x31, 0xf7, 0xc7, 0x45, 0x31, 0xf7, 0xd1, 0x68, 0x4c, 0x53, 0x19, 0x8b, 0xff, 0xd7, 0x79, + 0xeb, 0xff, 0x00, 0x00, 0x00, 0xff, 0xff, 0x89, 0x11, 0xd0, 0xa9, 0x67, 0x0d, 0x00, 0x00, } func (m *MsgSetWithdrawAddress) Marshal() (dAtA []byte, err error) { @@ -1177,6 +1226,43 @@ func (m *ValidatorSlashEvent) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *ValidatorSlashEvents) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ValidatorSlashEvents) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ValidatorSlashEvents) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.ValidatorSlashEvents) > 0 { + for iNdEx := len(m.ValidatorSlashEvents) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.ValidatorSlashEvents[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + func (m *FeePool) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -1490,6 +1576,21 @@ func (m *ValidatorSlashEvent) Size() (n int) { return n } +func (m *ValidatorSlashEvents) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.ValidatorSlashEvents) > 0 { + for _, e := range m.ValidatorSlashEvents { + l = e.Size() + n += 1 + l + sovTypes(uint64(l)) + } + } + return n +} + func (m *FeePool) Size() (n int) { if m == nil { return 0 @@ -2672,6 +2773,93 @@ func (m *ValidatorSlashEvent) Unmarshal(dAtA []byte) error { } return nil } +func (m *ValidatorSlashEvents) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ValidatorSlashEvents: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ValidatorSlashEvents: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorSlashEvents", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ValidatorSlashEvents = append(m.ValidatorSlashEvents, ValidatorSlashEvent{}) + if err := m.ValidatorSlashEvents[len(m.ValidatorSlashEvents)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *FeePool) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 diff --git a/x/distribution/types/types.proto b/x/distribution/types/types.proto index e5e98290946d..6ed4e224c870 100644 --- a/x/distribution/types/types.proto +++ b/x/distribution/types/types.proto @@ -141,6 +141,15 @@ message ValidatorSlashEvent { ]; } +// ValidatorSlashEvents is a collection of ValidatorSlashEvent +message ValidatorSlashEvents { + option (gogoproto.goproto_stringer) = false; + repeated ValidatorSlashEvent validator_slash_events = 1 [ + (gogoproto.moretags) = "yaml:\"validator_slash_events\"", + (gogoproto.nullable) = false + ]; +} + // global fee pool for distribution message FeePool { repeated cosmos_sdk.v1.DecCoin community_pool = 1 [ diff --git a/x/distribution/types/validator.go b/x/distribution/types/validator.go index 34a3fcaa057a..8484c497e68f 100644 --- a/x/distribution/types/validator.go +++ b/x/distribution/types/validator.go @@ -4,6 +4,7 @@ import ( "fmt" "strings" + "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" ) @@ -28,6 +29,11 @@ func InitialValidatorAccumulatedCommission() ValidatorAccumulatedCommission { return ValidatorAccumulatedCommission{} } +func UnmarshalValidatorAccumulatedCommission(cdc codec.Marshaler, value []byte) (v ValidatorAccumulatedCommission, err error) { + err = cdc.UnmarshalBinaryLengthPrefixed(value, &v) + return v, err +} + // create a new ValidatorSlashEvent func NewValidatorSlashEvent(validatorPeriod uint64, fraction sdk.Dec) ValidatorSlashEvent { return ValidatorSlashEvent{ @@ -36,12 +42,9 @@ func NewValidatorSlashEvent(validatorPeriod uint64, fraction sdk.Dec) ValidatorS } } -// ValidatorSlashEvents is a collection of ValidatorSlashEvent -type ValidatorSlashEvents []ValidatorSlashEvent - func (vs ValidatorSlashEvents) String() string { out := "Validator Slash Events:\n" - for i, sl := range vs { + for i, sl := range vs.ValidatorSlashEvents { out += fmt.Sprintf(` Slash %d: Period: %d Fraction: %s From 59d8427423280e5d2046ed6dde01b200ac73b510 Mon Sep 17 00:00:00 2001 From: Marko Baricevic Date: Thu, 6 Feb 2020 17:25:32 +0100 Subject: [PATCH 30/46] bump buf to 0.7 --- contrib/devtools/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/devtools/Makefile b/contrib/devtools/Makefile index 993d1b7b7436..51194db7789c 100644 --- a/contrib/devtools/Makefile +++ b/contrib/devtools/Makefile @@ -48,7 +48,7 @@ UNAME_M ?= $(shell uname -m) GOPATH ?= $(shell $(GO) env GOPATH) GITHUBDIR := $(GOPATH)$(FS)src$(FS)github.com -BUF_VERSION ?= 0.4.0 +BUF_VERSION ?= 0.7.0 TOOLS_DESTDIR ?= $(GOPATH)/bin STATIK = $(TOOLS_DESTDIR)/statik From 728ac20e4ca0e14ba0e2c8a9f070baacbed7ddfa Mon Sep 17 00:00:00 2001 From: Marko Baricevic Date: Thu, 6 Feb 2020 18:03:53 +0100 Subject: [PATCH 31/46] remove here --- x/distribution/keeper/store.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/distribution/keeper/store.go b/x/distribution/keeper/store.go index 89627e5b268c..c8746157a7ff 100644 --- a/x/distribution/keeper/store.go +++ b/x/distribution/keeper/store.go @@ -62,7 +62,7 @@ func (k Keeper) SetFeePool(ctx sdk.Context, feePool types.FeePool) { } // get the proposer public key for this block -func (k Keeper) GetPreviousProposerConsAddr(ctx sdk.Context) (consAddr sdk.ConsAddress) { // here +func (k Keeper) GetPreviousProposerConsAddr(ctx sdk.Context) (consAddr sdk.ConsAddress) { store := ctx.KVStore(k.storeKey) bz := store.Get(types.ProposerKey) if bz == nil { From 77b6f1f72857eb49bf6f385e1b8ef76c1275abac Mon Sep 17 00:00:00 2001 From: Marko Baricevic Date: Fri, 7 Feb 2020 11:14:30 +0100 Subject: [PATCH 32/46] add applevelcodec --- simapp/app.go | 2 +- simapp/codec.go | 9 ++++++--- x/distribution/alias.go | 2 ++ 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/simapp/app.go b/simapp/app.go index 3ec21f99e936..dff6ab5b9f18 100644 --- a/simapp/app.go +++ b/simapp/app.go @@ -179,7 +179,7 @@ func NewSimApp( app.SupplyKeeper, auth.FeeCollectorName, ) app.DistrKeeper = distr.NewKeeper( - distr.ModuleCdc, keys[distr.StoreKey], app.subspaces[distr.ModuleName], app.BankKeeper, &stakingKeeper, + appCodec.Distribution, keys[distr.StoreKey], app.subspaces[distr.ModuleName], app.BankKeeper, &stakingKeeper, app.SupplyKeeper, auth.FeeCollectorName, app.ModuleAccountAddrs(), ) app.SlashingKeeper = slashing.NewKeeper( diff --git a/simapp/codec.go b/simapp/codec.go index 8f87e7e324b1..96b2d6a70a15 100644 --- a/simapp/codec.go +++ b/simapp/codec.go @@ -4,6 +4,7 @@ import ( "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/auth/vesting" + distr "github.com/cosmos/cosmos-sdk/x/distribution" "github.com/cosmos/cosmos-sdk/x/staking" ) @@ -12,15 +13,17 @@ import ( type AppCodec struct { amino *codec.Codec - Staking *staking.Codec + Staking *staking.Codec + Distribution *distr.Codec } func NewAppCodec() *AppCodec { amino := MakeCodec() return &AppCodec{ - amino: amino, - Staking: staking.NewCodec(amino), + amino: amino, + Staking: staking.NewCodec(amino), + Distribution: distr.NewCodec(amino), } } diff --git a/x/distribution/alias.go b/x/distribution/alias.go index 47143d995cbb..ba16c5f47f28 100644 --- a/x/distribution/alias.go +++ b/x/distribution/alias.go @@ -111,6 +111,7 @@ var ( ParamStoreKeyBonusProposerReward = types.ParamStoreKeyBonusProposerReward ParamStoreKeyWithdrawAddrEnabled = types.ParamStoreKeyWithdrawAddrEnabled ModuleCdc = types.ModuleCdc + NewCodec = types.NewCodec EventTypeSetWithdrawAddress = types.EventTypeSetWithdrawAddress EventTypeRewards = types.EventTypeRewards EventTypeCommission = types.EventTypeCommission @@ -155,4 +156,5 @@ type ( ValidatorSlashEvent = types.ValidatorSlashEvent ValidatorSlashEvents = types.ValidatorSlashEvents ValidatorOutstandingRewards = types.ValidatorOutstandingRewards + Codec = types.Codec ) From 41426fa6e6de4e2fe9de7c89eeff496ae9775fcf Mon Sep 17 00:00:00 2001 From: Marko Baricevic Date: Fri, 7 Feb 2020 11:28:28 +0100 Subject: [PATCH 33/46] add make cmd for tendermint proto files update --- Makefile | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/Makefile b/Makefile index 2e5984dd3ad8..2b3967d9dfac 100644 --- a/Makefile +++ b/Makefile @@ -238,4 +238,23 @@ proto-lint: proto-check-breaking: @buf check breaking --against-input '.git#branch=master' +# Origin +# TODO: Update to the version of Tendermint that is being used in go.mod +version_branch = v0.33.0 +tendermint = https://raw.githubusercontent.com/tendermint/tendermint/$(version_branch) + +# Outputs +tmkv = third_party/proto/tendermint/libs/kv/types.proto +tmmerkle = third_party/proto/tendermint/crypto/merkle/merkle.proto +tmabci = third_party/proto/tendermint/abci/types/types.proto + + # You *only* need to run this to rebuild protobufs from the tendermint source +proto-update-tendermint: + # When running this command you will have to update the proto files with third_party imports instead of what is copied + @curl $(tendermint)/abci/types/types.proto > $(tmabci) + @curl $(tendermint)/libs/kv/types.proto > $(tmkv) + @curl $(tendermint)/crypto/merkle/merkle.proto > $(tmmerkle) + @sed 's@package types;@package abci;@' $(tmabci) > protobuf/abci.proto + @curl $(tendermint)/version/version.go | grep -F -eTMCoreSem -eABCISemVer > version.txt + .PHONY: proto-all proto-gen proto-lint proto-check-breaking From 789a03d2e4e701b008c066777bac1d1b929754f2 Mon Sep 17 00:00:00 2001 From: Marko Baricevic Date: Fri, 7 Feb 2020 11:29:30 +0100 Subject: [PATCH 34/46] fix spacing --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 2b3967d9dfac..d3081d9eeab8 100644 --- a/Makefile +++ b/Makefile @@ -248,7 +248,7 @@ tmkv = third_party/proto/tendermint/libs/kv/types.proto tmmerkle = third_party/proto/tendermint/crypto/merkle/merkle.proto tmabci = third_party/proto/tendermint/abci/types/types.proto - # You *only* need to run this to rebuild protobufs from the tendermint source +# You *only* need to run this to rebuild protobufs from the tendermint source proto-update-tendermint: # When running this command you will have to update the proto files with third_party imports instead of what is copied @curl $(tendermint)/abci/types/types.proto > $(tmabci) @@ -257,4 +257,4 @@ proto-update-tendermint: @sed 's@package types;@package abci;@' $(tmabci) > protobuf/abci.proto @curl $(tendermint)/version/version.go | grep -F -eTMCoreSem -eABCISemVer > version.txt -.PHONY: proto-all proto-gen proto-lint proto-check-breaking +.PHONY: proto-all proto-gen proto-lint proto-check-breaking proto-update-tendermint From a2346d34b88479ef391d552b9b4199824bf636fd Mon Sep 17 00:00:00 2001 From: Marko Baricevic Date: Fri, 7 Feb 2020 12:42:21 +0100 Subject: [PATCH 35/46] add changelog --- CHANGELOG.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index fed89e850a14..c695e13f06a7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -81,6 +81,14 @@ for JSON encoding. * Every reference of `crypto.Pubkey` in context of a `Validator` is now of type string. `GetPubKeyFromBech32` must be used to get the `crypto.Pubkey`. * The `Keeper` constructor now takes a `codec.Marshaler` instead of a concrete Amino codec. This exact type provided is specified by `ModuleCdc`. +* (distr) [\#5610](https://github.com/cosmos/cosmos-sdk/pull/5610) Migrate the `x/distribution` module to use Protocol Buffer for state +serialization instead of Amino. The exact codec used is `codec.HybridCodec` which utilizes Protobuf for binary encoding and Amino +for JSON encoding. + * `ValidatorSlashEvents` is now a struct with `slashevents `. + * `ValidatorOutstandingRewards` is now a struct with `rewards`. + * `ValidatorAccumulatedCommission` is now a struct with `commission`. + * The `Keeper` constructor now takes a `codec.Marshaler` instead of a concrete Amino codec. This exact type + provided is specified by `ModuleCdc`. ### Improvements From fcbe7c36447b6b1516060f9ebb73e1eb7c9c1742 Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Fri, 7 Feb 2020 11:28:54 -0500 Subject: [PATCH 36/46] Fix x/crisis linting --- x/crisis/internal/types/types.proto | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/x/crisis/internal/types/types.proto b/x/crisis/internal/types/types.proto index e850a8bdacf7..64b4c5fc60e8 100644 --- a/x/crisis/internal/types/types.proto +++ b/x/crisis/internal/types/types.proto @@ -7,14 +7,7 @@ import "third_party/proto/gogoproto/gogo.proto"; // MsgVerifyInvariant - message struct to verify a particular invariance message MsgVerifyInvariant { - bytes sender = 1 [ - (gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress", - (gogoproto.moretags) = "yaml:\"sender\"" - ]; - string invariant_module_name = 2 [ - (gogoproto.moretags) = "yaml:\"invariant_module_name\"" - ]; - string invariant_route = 3 [ - (gogoproto.moretags) = "yaml:\"invariant_route\"" - ]; -} \ No newline at end of file + bytes sender = 1 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"]; + string invariant_module_name = 2 [(gogoproto.moretags) = "yaml:\"invariant_module_name\""]; + string invariant_route = 3 [(gogoproto.moretags) = "yaml:\"invariant_route\""]; +} From 28591b3ea3e510490fa234a1bbf474203068ba68 Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Fri, 7 Feb 2020 12:09:40 -0500 Subject: [PATCH 37/46] Verify and cleanup proto types --- x/crisis/internal/types/types.pb.go | 43 ++++--- x/distribution/types/types.pb.go | 169 ++++++++++++++-------------- x/distribution/types/types.proto | 101 +++++++---------- 3 files changed, 147 insertions(+), 166 deletions(-) diff --git a/x/crisis/internal/types/types.pb.go b/x/crisis/internal/types/types.pb.go index 6a9f7c64967e..bf584c384409 100644 --- a/x/crisis/internal/types/types.pb.go +++ b/x/crisis/internal/types/types.pb.go @@ -26,7 +26,7 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // MsgVerifyInvariant - message struct to verify a particular invariance type MsgVerifyInvariant struct { - Sender github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,1,opt,name=sender,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"sender,omitempty" yaml:"sender"` + Sender github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,1,opt,name=sender,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"sender,omitempty"` InvariantModuleName string `protobuf:"bytes,2,opt,name=invariant_module_name,json=invariantModuleName,proto3" json:"invariant_module_name,omitempty" yaml:"invariant_module_name"` InvariantRoute string `protobuf:"bytes,3,opt,name=invariant_route,json=invariantRoute,proto3" json:"invariant_route,omitempty" yaml:"invariant_route"` } @@ -94,27 +94,26 @@ func init() { } var fileDescriptor_df1c0b8e580cce76 = []byte{ - // 310 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x90, 0x3f, 0x4b, 0x03, 0x31, - 0x1c, 0x86, 0x9b, 0x8a, 0x05, 0x0f, 0xff, 0xc0, 0x89, 0xa5, 0x14, 0xc9, 0x95, 0x13, 0xa4, 0x4b, - 0x2f, 0x88, 0x9b, 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xc0, 0x9c, 0xb6, 0xea, 0x1d, 0xd0, 0x3d, 0x8a, - 0x3b, 0xdb, 0x32, 0xb8, 0x74, 0xa3, 0xfe, 0xd5, 0xc2, 0xe4, 0x7c, 0xc7, 0x07, 0x16, 0x3f, 0x62, - 0x4e, 0xfd, 0x7b, 0xef, 0x6c, 0xaf, 0x2b, 0x39, 0x37, 0xb4, 0x75, 0x60, 0xf3, 0xda, 0xdb, 0x32, - 0x68, 0xfe, 0xcd, 0xb3, 0x42, 0x98, 0x9c, 0xee, 0x48, 0xf2, 0x03, 0xe2, 0xe0, 0x7d, 0x0d, 0xc1, - 0x6a, 0x0d, 0xc1, 0xe7, 0x1a, 0x82, 0xb7, 0x0d, 0xac, 0xad, 0x36, 0xb0, 0xf6, 0xb1, 0x81, 0xb5, - 0xe1, 0xa1, 0x7d, 0xce, 0xa8, 0x61, 0x7f, 0xed, 0xf6, 0x3b, 0x00, 0x00, 0xff, 0xff, 0x13, 0x54, - 0x5b, 0x16, 0x9c, 0x01, 0x00, 0x00, + // 301 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x90, 0xcf, 0x4a, 0xfb, 0x30, + 0x00, 0x80, 0x97, 0xdf, 0x0f, 0x07, 0x16, 0x51, 0xa8, 0x38, 0xc6, 0x90, 0x74, 0x54, 0x90, 0x5d, + 0xd6, 0x30, 0xbc, 0x79, 0xdb, 0x3c, 0xed, 0x30, 0x0f, 0x45, 0x3c, 0x78, 0x29, 0x59, 0x13, 0xbb, + 0xb0, 0x25, 0x29, 0x49, 0x3a, 0xd6, 0xb7, 0xf0, 0xb1, 0x3c, 0xee, 0xe8, 0xa9, 0x48, 0xfb, 0x06, + 0x3b, 0xee, 0x24, 0xa6, 0x75, 0x03, 0xf1, 0x92, 0x84, 0x8f, 0x2f, 0x5f, 0xfe, 0x38, 0x37, 0x1b, + 0x14, 0x2b, 0xa6, 0x99, 0x46, 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x12, 0x82, 0xb7, 0x0a, 0xb6, + 0xb6, 0x15, 0x6c, 0x7d, 0x54, 0xb0, 0xf5, 0x72, 0x62, 0x9f, 0x33, 0x6f, 0xdb, 0x4f, 0xba, 0xfb, + 0x0a, 0x00, 0x00, 0xff, 0xff, 0xa7, 0xed, 0x2c, 0x98, 0x8b, 0x01, 0x00, 0x00, } func (m *MsgVerifyInvariant) Marshal() (dAtA []byte, err error) { diff --git a/x/distribution/types/types.pb.go b/x/distribution/types/types.pb.go index 869486985cb2..ccd8529b0b4b 100644 --- a/x/distribution/types/types.pb.go +++ b/x/distribution/types/types.pb.go @@ -179,8 +179,8 @@ func (m *MsgWithdrawValidatorCommission) GetValidatorAddress() github_com_cosmos // MsgFundCommunityPool defines a Msg type that allows an account to directly // fund the community pool. type MsgFundCommunityPool struct { - Amount github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,1,rep,name=amount,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"amount" yaml:"amount"` - Depositor github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,2,opt,name=depositor,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"depositor,omitempty" yaml:"depositor"` + Amount github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,1,rep,name=amount,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"amount"` + Depositor github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,2,opt,name=depositor,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"depositor,omitempty"` } func (m *MsgFundCommunityPool) Reset() { *m = MsgFundCommunityPool{} } @@ -285,12 +285,13 @@ func (m *Params) GetWithdrawAddrEnabled() bool { // which might need to reference this historical entry // at any point. // ReferenceCount = -// number of outstanding delegations which ended the associated period (and might need to read that record) +// number of outstanding delegations which ended the associated period (and might need to read +// that record) // + number of slashes which ended the associated period (and might need to read that record) // + one per validator for the zeroeth period, set on initialization type ValidatorHistoricalRewards struct { CumulativeRewardRatio github_com_cosmos_cosmos_sdk_types.DecCoins `protobuf:"bytes,1,rep,name=cumulative_reward_ratio,json=cumulativeRewardRatio,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.DecCoins" json:"cumulative_reward_ratio" yaml:"cumulative_reward_ratio"` - ReferenceCount uint32 `protobuf:"varint,2,opt,name=reference_count,json=referenceCount,proto3" json:"reference_count,omitempty"` + ReferenceCount uint32 `protobuf:"varint,2,opt,name=reference_count,json=referenceCount,proto3" json:"reference_count,omitempty" yaml:"reference_count"` } func (m *ValidatorHistoricalRewards) Reset() { *m = ValidatorHistoricalRewards{} } @@ -344,8 +345,8 @@ func (m *ValidatorHistoricalRewards) GetReferenceCount() uint32 { // kept as a running counter and incremented each block // as long as the validator's tokens remain constant type ValidatorCurrentRewards struct { - Rewards github_com_cosmos_cosmos_sdk_types.DecCoins `protobuf:"bytes,1,rep,name=rewards,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.DecCoins" json:"rewards" yaml:"rewards"` - Period uint64 `protobuf:"varint,2,opt,name=period,proto3" json:"period,omitempty" yaml:"period"` + Rewards github_com_cosmos_cosmos_sdk_types.DecCoins `protobuf:"bytes,1,rep,name=rewards,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.DecCoins" json:"rewards"` + Period uint64 `protobuf:"varint,2,opt,name=period,proto3" json:"period,omitempty"` } func (m *ValidatorCurrentRewards) Reset() { *m = ValidatorCurrentRewards{} } @@ -398,7 +399,7 @@ func (m *ValidatorCurrentRewards) GetPeriod() uint64 { // accumulated commission for a validator // kept as a running counter, can be withdrawn at any time type ValidatorAccumulatedCommission struct { - Commission github_com_cosmos_cosmos_sdk_types.DecCoins `protobuf:"bytes,1,rep,name=commission,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.DecCoins" json:"commission" yaml:"commission"` + Commission github_com_cosmos_cosmos_sdk_types.DecCoins `protobuf:"bytes,1,rep,name=commission,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.DecCoins" json:"commission"` } func (m *ValidatorAccumulatedCommission) Reset() { *m = ValidatorAccumulatedCommission{} } @@ -493,7 +494,7 @@ func (m *ValidatorOutstandingRewards) GetRewards() github_com_cosmos_cosmos_sdk_ // for delegations which withdraw after a slash has occurred type ValidatorSlashEvent struct { ValidatorPeriod uint64 `protobuf:"varint,1,opt,name=validator_period,json=validatorPeriod,proto3" json:"validator_period,omitempty" yaml:"validator_period"` - Fraction github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=fraction,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"fraction" yaml:"fraction"` + Fraction github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=fraction,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"fraction"` } func (m *ValidatorSlashEvent) Reset() { *m = ValidatorSlashEvent{} } @@ -627,10 +628,10 @@ func (m *FeePool) GetCommunityPool() github_com_cosmos_cosmos_sdk_types.DecCoins // CommunityPoolSpendProposal spends from the community pool type CommunityPoolSpendProposal struct { - Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty" yaml:"title"` - Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty" yaml:"description"` - Recipient github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,3,opt,name=recipient,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"recipient,omitempty" yaml:"recipient"` - Amount github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,4,rep,name=amount,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"amount" yaml:"amount"` + Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"` + Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` + Recipient github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,3,opt,name=recipient,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"recipient,omitempty"` + Amount github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,4,rep,name=amount,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"amount"` } func (m *CommunityPoolSpendProposal) Reset() { *m = CommunityPoolSpendProposal{} } @@ -675,7 +676,7 @@ var xxx_messageInfo_CommunityPoolSpendProposal proto.InternalMessageInfo type DelegatorStartingInfo struct { PreviousPeriod uint64 `protobuf:"varint,1,opt,name=previous_period,json=previousPeriod,proto3" json:"previous_period,omitempty" yaml:"previous_period"` Stake github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=stake,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"stake" yaml:"stake"` - Height uint64 `protobuf:"varint,3,opt,name=height,proto3" json:"height,omitempty" yaml:"height"` + Height uint64 `protobuf:"varint,3,opt,name=height,proto3" json:"height,omitempty" yaml:"creation_height"` } func (m *DelegatorStartingInfo) Reset() { *m = DelegatorStartingInfo{} } @@ -745,78 +746,76 @@ func init() { func init() { proto.RegisterFile("x/distribution/types/types.proto", fileDescriptor_9fddf2a8e4a90b09) } var fileDescriptor_9fddf2a8e4a90b09 = []byte{ - // 1135 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x57, 0xcd, 0x6b, 0x24, 0x45, - 0x14, 0x9f, 0xca, 0xd7, 0x26, 0xb5, 0xf9, 0xec, 0x64, 0x92, 0x30, 0xd1, 0xe9, 0x50, 0x60, 0x8c, - 0xc8, 0x4e, 0x5c, 0xbd, 0x48, 0x0e, 0x42, 0x26, 0x1f, 0xac, 0xb0, 0xd1, 0xd0, 0x89, 0x2b, 0x08, - 0xd2, 0xd4, 0x74, 0x57, 0x66, 0x8a, 0xf4, 0x74, 0x35, 0x55, 0x35, 0x33, 0xc9, 0x5e, 0x14, 0x4f, - 0x82, 0x0a, 0x1e, 0x44, 0x3d, 0x78, 0x58,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, 0xef, 0x92, 0xae, 0xb5, 0x9d, 0x1e, 0xdd, 0x64, 0x6d, 0xa7, - 0x2f, 0x77, 0x7c, 0x8b, 0x8c, 0x3c, 0x8f, 0x6f, 0x91, 0xcd, 0xf1, 0xcf, 0x1f, 0x99, 0xb9, 0xf8, - 0xe6, 0x9f, 0x02, 0x98, 0x4f, 0xbf, 0x64, 0x0f, 0x25, 0xe6, 0x92, 0xfa, 0xd5, 0x77, 0xfd, 0x63, - 0x66, 0x6c, 0xc3, 0x99, 0x80, 0x93, 0x26, 0x65, 0xd1, 0xfa, 0xeb, 0x6c, 0xb4, 0x42, 0x3b, 0x34, - 0x17, 0xf5, 0xd0, 0xeb, 0x76, 0x40, 0xd6, 0x74, 0x62, 0xd1, 0x6d, 0x76, 0x04, 0x47, 0x85, 0xc4, - 0x27, 0x44, 0x67, 0xfc, 0x9d, 0x81, 0x7b, 0x4c, 0xdf, 0x66, 0x0c, 0x82, 0x2c, 0x05, 0x16, 0x8d, - 0xe1, 0x1a, 0xa1, 0xd5, 0x9a, 0xba, 0x90, 0xae, 0x31, 0xac, 0xec, 0xc8, 0xd2, 0x0e, 0x65, 0xf3, - 0xf1, 0x79, 0x11, 0x3c, 0x39, 0x2f, 0x82, 0xbf, 0xcf, 0x8b, 0xe0, 0xeb, 0x8b, 0x62, 0xee, 0xc9, - 0x45, 0x31, 0xf7, 0xc7, 0x45, 0x31, 0xf7, 0xd1, 0x68, 0x4c, 0x53, 0x19, 0x8b, 0xff, 0xd7, 0x79, - 0xeb, 0xff, 0x00, 0x00, 0x00, 0xff, 0xff, 0x89, 0x11, 0xd0, 0xa9, 0x67, 0x0d, 0x00, 0x00, + // 1101 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x57, 0xcf, 0x6f, 0x1b, 0x45, + 0x14, 0xf6, 0x38, 0x3f, 0x9a, 0x4c, 0xd3, 0xa4, 0xd9, 0xd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, 0x22, 0x1c, 0x4e, 0x83, 0xf4, 0x30, 0xad, 0xee, 0x50, 0x38, + 0x46, 0x39, 0x71, 0x68, 0x40, 0x89, 0x2f, 0xa3, 0x7e, 0x7f, 0xb5, 0x31, 0x9a, 0x60, 0x74, 0x8d, + 0xfd, 0xf1, 0xd7, 0x30, 0xf6, 0x37, 0xa6, 0xbe, 0x7c, 0x6a, 0x66, 0xa2, 0xa3, 0xfa, 0x1b, 0xc0, + 0x7c, 0xf2, 0x8d, 0x78, 0x20, 0x31, 0x97, 0xd4, 0xaf, 0x7d, 0xe0, 0x1f, 0x45, 0x8d, 0x32, 0xe0, + 0xa4, 0x45, 0x59, 0x38, 0x7d, 0xba, 0xcb, 0xa0, 0xab, 0x51, 0xf6, 0x25, 0x20, 0x6b, 0x36, 0x8e, + 0xe8, 0x22, 0x38, 0x84, 0x13, 0x42, 0xe2, 0x63, 0xa2, 0x2b, 0xe0, 0xbd, 0x91, 0x87, 0xe0, 0x8c, + 0x22, 0x8a, 0x40, 0x90, 0xa5, 0xc0, 0x8c, 0xbb, 0x70, 0xb2, 0x4e, 0x68, 0xad, 0xae, 0xbc, 0xee, + 0x51, 0xe4, 0x70, 0x12, 0xb6, 0x79, 0xdf, 0x56, 0x09, 0xc8, 0xd2, 0x99, 0x15, 0xf3, 0xf9, 0x59, + 0x11, 0xbc, 0x38, 0x2b, 0x82, 0xbf, 0xce, 0x8a, 0xe0, 0xbb, 0xf3, 0x62, 0xe6, 0xc5, 0x79, 0x31, + 0xf3, 0xc7, 0x79, 0x31, 0xf3, 0xe9, 0x44, 0xc4, 0x57, 0x9d, 0x8c, 0xfe, 0x9d, 0xb8, 0xf7, 0x6f, + 0x00, 0x00, 0x00, 0xff, 0xff, 0xeb, 0xb6, 0x66, 0xa0, 0xca, 0x0c, 0x00, 0x00, } func (m *MsgSetWithdrawAddress) Marshal() (dAtA []byte, err error) { diff --git a/x/distribution/types/types.proto b/x/distribution/types/types.proto index 6ed4e224c870..5940611678f8 100644 --- a/x/distribution/types/types.proto +++ b/x/distribution/types/types.proto @@ -41,39 +41,32 @@ message MsgWithdrawValidatorCommission { // MsgFundCommunityPool defines a Msg type that allows an account to directly // fund the community pool. message MsgFundCommunityPool { - repeated cosmos_sdk.v1.Coin amount = 1 - [ - (gogoproto.nullable) = false, - (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", - (gogoproto.moretags) = "yaml:\"amount\"" - ]; - bytes depositor = 2 [ - (gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress", - (gogoproto.moretags) = "yaml:\"depositor\"" + repeated cosmos_sdk.v1.Coin amount = 1 [ + (gogoproto.nullable) = false, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" ]; + bytes depositor = 2 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"]; } // Params defines the set of distribution parameters. message Params { option (gogoproto.goproto_stringer) = false; - string community_tax = 1 [ - (gogoproto.moretags) = "yaml:\"community_tax\"", + string community_tax = 1 [ + (gogoproto.moretags) = "yaml:\"community_tax\"", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", - (gogoproto.nullable) = false + (gogoproto.nullable) = false ]; string base_proposer_reward = 2 [ - (gogoproto.moretags) = "yaml:\"base_proposer_reward\"", + (gogoproto.moretags) = "yaml:\"base_proposer_reward\"", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", - (gogoproto.nullable) = false + (gogoproto.nullable) = false ]; string bonus_proposer_reward = 3 [ - (gogoproto.moretags) = "yaml:\"bonus_proposer_reward\"", + (gogoproto.moretags) = "yaml:\"bonus_proposer_reward\"", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", - (gogoproto.nullable) = false - ]; - bool withdraw_addr_enabled = 4 [ - (gogoproto.moretags) = "yaml:\"withdraw_addr_enabled\"" + (gogoproto.nullable) = false ]; + bool withdraw_addr_enabled = 4 [(gogoproto.moretags) = "yaml:\"withdraw_addr_enabled\""]; } // historical rewards for a validator @@ -84,16 +77,17 @@ message Params { // which might need to reference this historical entry // at any point. // ReferenceCount = -// number of outstanding delegations which ended the associated period (and might need to read that record) +// number of outstanding delegations which ended the associated period (and might need to read +// that record) // + number of slashes which ended the associated period (and might need to read that record) // + one per validator for the zeroeth period, set on initialization message ValidatorHistoricalRewards { repeated cosmos_sdk.v1.DecCoin cumulative_reward_ratio = 1 [ - (gogoproto.moretags) = "yaml:\"cumulative_reward_ratio\"", + (gogoproto.moretags) = "yaml:\"cumulative_reward_ratio\"", (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins", - (gogoproto.nullable) = false + (gogoproto.nullable) = false ]; - uint32 reference_count = 2; + uint32 reference_count = 2 [(gogoproto.moretags) = "yaml:\"reference_count\""]; } // current rewards and current period for a validator @@ -101,20 +95,18 @@ message ValidatorHistoricalRewards { // as long as the validator's tokens remain constant message ValidatorCurrentRewards { repeated cosmos_sdk.v1.DecCoin rewards = 1 [ - (gogoproto.moretags) = "yaml:\"rewards\"", (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins", - (gogoproto.nullable) = false + (gogoproto.nullable) = false ]; - uint64 period = 2 [(gogoproto.moretags) = "yaml:\"period\"" ]; + uint64 period = 2; } // accumulated commission for a validator // kept as a running counter, can be withdrawn at any time message ValidatorAccumulatedCommission { repeated cosmos_sdk.v1.DecCoin commission = 1 [ - (gogoproto.moretags) = "yaml:\"commission\"", (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins", - (gogoproto.nullable) = false + (gogoproto.nullable) = false ]; } @@ -122,9 +114,9 @@ message ValidatorAccumulatedCommission { // inexpensive to track, allows simple sanity checks message ValidatorOutstandingRewards { repeated cosmos_sdk.v1.DecCoin rewards = 1 [ - (gogoproto.moretags) = "yaml:\"rewards\"", + (gogoproto.moretags) = "yaml:\"rewards\"", (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins", - (gogoproto.nullable) = false + (gogoproto.nullable) = false ]; } @@ -133,47 +125,39 @@ message ValidatorOutstandingRewards { // needed to calculate appropriate amounts of staking token // for delegations which withdraw after a slash has occurred message ValidatorSlashEvent { - uint64 validator_period = 1 [(gogoproto.moretags) = "yaml:\"validator_period\"" ]; - string fraction = 2 [ - (gogoproto.moretags) = "yaml:\"fraction\"", + uint64 validator_period = 1 [(gogoproto.moretags) = "yaml:\"validator_period\""]; + string fraction = 2 [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", - (gogoproto.nullable) = false + (gogoproto.nullable) = false ]; } // ValidatorSlashEvents is a collection of ValidatorSlashEvent message ValidatorSlashEvents { - option (gogoproto.goproto_stringer) = false; - repeated ValidatorSlashEvent validator_slash_events = 1 [ - (gogoproto.moretags) = "yaml:\"validator_slash_events\"", - (gogoproto.nullable) = false - ]; + option (gogoproto.goproto_stringer) = false; + repeated ValidatorSlashEvent validator_slash_events = 1 + [(gogoproto.moretags) = "yaml:\"validator_slash_events\"", (gogoproto.nullable) = false]; } // global fee pool for distribution message FeePool { repeated cosmos_sdk.v1.DecCoin community_pool = 1 [ - (gogoproto.nullable) = false, + (gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins", - (gogoproto.moretags) = "yaml:\"community_pool\"" + (gogoproto.moretags) = "yaml:\"community_pool\"" ]; } // CommunityPoolSpendProposal spends from the community pool message CommunityPoolSpendProposal { option (gogoproto.goproto_stringer) = false; - option (gogoproto.goproto_getters) = false; - string title = 1 [(gogoproto.moretags) = "yaml:\"title\""]; - string description = 2 [(gogoproto.moretags) = "yaml:\"description\""]; - bytes recipient = 3 [ - (gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress", - (gogoproto.moretags) = "yaml:\"recipient\"" - ]; - repeated cosmos_sdk.v1.Coin amount = 4 - [ - (gogoproto.nullable) = false, - (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", - (gogoproto.moretags) = "yaml:\"amount\"" + option (gogoproto.goproto_getters) = false; + string title = 1; + string description = 2; + bytes recipient = 3 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"]; + repeated cosmos_sdk.v1.Coin amount = 4 [ + (gogoproto.nullable) = false, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" ]; } @@ -185,12 +169,11 @@ message CommunityPoolSpendProposal { // delegators within the validator may be left with less than a full token, // thus sdk.Dec is used message DelegatorStartingInfo { - uint64 previous_period = 1 [ (gogoproto.moretags) = "yaml:\"previous_period\""]; - string stake = 2 [ - (gogoproto.moretags) = "yaml:\"stake\"", + uint64 previous_period = 1 [(gogoproto.moretags) = "yaml:\"previous_period\""]; + string stake = 2 [ + (gogoproto.moretags) = "yaml:\"stake\"", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", - (gogoproto.nullable) = false + (gogoproto.nullable) = false ]; - uint64 height = 3 [ (gogoproto.moretags) = "yaml:\"height\"" ]; + uint64 height = 3 [(gogoproto.moretags) = "yaml:\"creation_height\""]; } - From 230829b10cf16b7e46dd88333e2cb0397ab29fc4 Mon Sep 17 00:00:00 2001 From: Alexander Bezobchuk Date: Mon, 10 Feb 2020 10:33:45 -0500 Subject: [PATCH 38/46] Update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c695e13f06a7..8fcd79fc2e88 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -84,7 +84,7 @@ for JSON encoding. * (distr) [\#5610](https://github.com/cosmos/cosmos-sdk/pull/5610) Migrate the `x/distribution` module to use Protocol Buffer for state serialization instead of Amino. The exact codec used is `codec.HybridCodec` which utilizes Protobuf for binary encoding and Amino for JSON encoding. - * `ValidatorSlashEvents` is now a struct with `slashevents `. + * `ValidatorSlashEvents` is now a struct with `slashevents`. * `ValidatorOutstandingRewards` is now a struct with `rewards`. * `ValidatorAccumulatedCommission` is now a struct with `commission`. * The `Keeper` constructor now takes a `codec.Marshaler` instead of a concrete Amino codec. This exact type From 7f2140d58dc2e12cf33606fd9b8ea0f4a3952118 Mon Sep 17 00:00:00 2001 From: Alexander Bezobchuk Date: Mon, 10 Feb 2020 10:35:15 -0500 Subject: [PATCH 39/46] Update x/distribution/keeper/delegation.go --- x/distribution/keeper/delegation.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/distribution/keeper/delegation.go b/x/distribution/keeper/delegation.go index c630bf2a3a46..48f474e5c570 100644 --- a/x/distribution/keeper/delegation.go +++ b/x/distribution/keeper/delegation.go @@ -145,7 +145,7 @@ func (k Keeper) withdrawDelegationRewards(ctx sdk.Context, val exported.Validato // end current period and calculate rewards endingPeriod := k.incrementValidatorPeriod(ctx, val) rewardsRaw := k.calculateDelegationRewards(ctx, val, del, endingPeriod) - outstanding := k.GetValidatorOutstandingRewards(ctx, del.GetValidatorAddr()).Rewards + outstanding := k.GetValidatorOutstandingRewardsCoins(ctx, del.GetValidatorAddr()) // defensive edge case may happen on the very final digits // of the decCoins due to operation order of the distribution mechanism. From cad3cafd733f89a3ec60210439eec6acc012587d Mon Sep 17 00:00:00 2001 From: Alexander Bezobchuk Date: Mon, 10 Feb 2020 10:35:57 -0500 Subject: [PATCH 40/46] Update x/distribution/keeper/invariants.go --- x/distribution/keeper/invariants.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/distribution/keeper/invariants.go b/x/distribution/keeper/invariants.go index c7ad575fea9c..45534b622e50 100644 --- a/x/distribution/keeper/invariants.go +++ b/x/distribution/keeper/invariants.go @@ -89,7 +89,7 @@ func CanWithdrawInvariant(k Keeper) sdk.Invariant { } } - remaining = k.GetValidatorOutstandingRewards(ctx, val.GetOperator()).Rewards + remaining = k.GetValidatorOutstandingRewardsCoins(ctx, val.GetOperator()) if len(remaining) > 0 && remaining[0].Amount.IsNegative() { return true } From ebe0140c7e6ff5dc6e4e9dd3bd38d7b38243d0aa Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Mon, 10 Feb 2020 10:39:05 -0500 Subject: [PATCH 41/46] Review suggestions/linting --- x/distribution/keeper/hooks.go | 3 +-- x/distribution/keeper/store.go | 10 ++++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/x/distribution/keeper/hooks.go b/x/distribution/keeper/hooks.go index 2ac25b27d5ec..c68b5909f734 100644 --- a/x/distribution/keeper/hooks.go +++ b/x/distribution/keeper/hooks.go @@ -24,9 +24,8 @@ func (h Hooks) AfterValidatorCreated(ctx sdk.Context, valAddr sdk.ValAddress) { // cleanup for after validator is removed func (h Hooks) AfterValidatorRemoved(ctx sdk.Context, _ sdk.ConsAddress, valAddr sdk.ValAddress) { - // fetch outstanding - outstanding := h.k.GetValidatorOutstandingRewards(ctx, valAddr).Rewards + outstanding := h.k.GetValidatorOutstandingRewardsCoins(ctx, valAddr) // force-withdraw commission commission := h.k.GetValidatorAccumulatedCommission(ctx, valAddr).Commission diff --git a/x/distribution/keeper/store.go b/x/distribution/keeper/store.go index c8746157a7ff..ffdd807163ed 100644 --- a/x/distribution/keeper/store.go +++ b/x/distribution/keeper/store.go @@ -61,16 +61,18 @@ func (k Keeper) SetFeePool(ctx sdk.Context, feePool types.FeePool) { store.Set(types.FeePoolKey, b) } -// get the proposer public key for this block -func (k Keeper) GetPreviousProposerConsAddr(ctx sdk.Context) (consAddr sdk.ConsAddress) { +// GetPreviousProposerConsAddr returns the proposer consensus address for the +// current block. +func (k Keeper) GetPreviousProposerConsAddr(ctx sdk.Context) sdk.ConsAddress { store := ctx.KVStore(k.storeKey) bz := store.Get(types.ProposerKey) if bz == nil { - panic("Previous proposer not set") + panic("previous proposer not set") } + addrValue := gogotypes.BytesValue{} k.cdc.MustUnmarshalBinaryLengthPrefixed(bz, &addrValue) - return addrValue.GetValue() + return sdk.ConsAddress(addrValue.GetValue()) } // set the proposer public key for this block From 69f965ab237858b75b1ba86d5cc1aaf3697aff93 Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Mon, 10 Feb 2020 10:40:26 -0500 Subject: [PATCH 42/46] Review suggestions/linting --- simapp/export.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/simapp/export.go b/simapp/export.go index 6ee705706971..39cf18586f10 100644 --- a/simapp/export.go +++ b/simapp/export.go @@ -87,11 +87,10 @@ func (app *SimApp) prepForZeroHeightGenesis(ctx sdk.Context, jailWhiteList []str // reinitialize all validators app.StakingKeeper.IterateValidators(ctx, func(_ int64, val exported.ValidatorI) (stop bool) { - // donate any unwithdrawn outstanding reward fraction tokens to the community pool - scraps := app.DistrKeeper.GetValidatorOutstandingRewards(ctx, val.GetOperator()) + scraps := app.DistrKeeper.GetValidatorOutstandingRewardsCoins(ctx, val.GetOperator()) feePool := app.DistrKeeper.GetFeePool(ctx) - feePool.CommunityPool = feePool.CommunityPool.Add(scraps.Rewards...) + feePool.CommunityPool = feePool.CommunityPool.Add(scraps...) app.DistrKeeper.SetFeePool(ctx, feePool) app.DistrKeeper.Hooks().AfterValidatorCreated(ctx, val.GetOperator()) From d680eac5edde96aa9e49db649d402a40bccd1908 Mon Sep 17 00:00:00 2001 From: Marko Baricevic Date: Tue, 11 Feb 2020 09:53:37 +0100 Subject: [PATCH 43/46] change json tag of height --- x/distribution/types/types.pb.go | 141 ++++++++++++++++--------------- x/distribution/types/types.proto | 5 +- 2 files changed, 75 insertions(+), 71 deletions(-) diff --git a/x/distribution/types/types.pb.go b/x/distribution/types/types.pb.go index ccd8529b0b4b..21a6dfbee38d 100644 --- a/x/distribution/types/types.pb.go +++ b/x/distribution/types/types.pb.go @@ -676,7 +676,7 @@ var xxx_messageInfo_CommunityPoolSpendProposal proto.InternalMessageInfo type DelegatorStartingInfo struct { PreviousPeriod uint64 `protobuf:"varint,1,opt,name=previous_period,json=previousPeriod,proto3" json:"previous_period,omitempty" yaml:"previous_period"` Stake github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=stake,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"stake" yaml:"stake"` - Height uint64 `protobuf:"varint,3,opt,name=height,proto3" json:"height,omitempty" yaml:"creation_height"` + Height uint64 `protobuf:"varint,3,opt,name=height,proto3" json:"creation_height" yaml:"creation_height"` } func (m *DelegatorStartingInfo) Reset() { *m = DelegatorStartingInfo{} } @@ -746,76 +746,77 @@ func init() { func init() { proto.RegisterFile("x/distribution/types/types.proto", fileDescriptor_9fddf2a8e4a90b09) } var fileDescriptor_9fddf2a8e4a90b09 = []byte{ - // 1101 bytes of a gzipped FileDescriptorProto + // 1110 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x57, 0xcf, 0x6f, 0x1b, 0x45, - 0x14, 0xf6, 0x38, 0x3f, 0x9a, 0x4c, 0xd3, 0xa4, 0xd9, 0xd8, 0x49, 0xe4, 0x80, 0xd7, 0x1a, 0x89, - 0x2a, 0x12, 0xaa, 0xd3, 0xb4, 0xb7, 0x1c, 0x90, 0xe2, 0xfc, 0x10, 0xa0, 0x86, 0x46, 0x9b, 0x50, - 0x24, 0x24, 0xb4, 0x1a, 0xef, 0x4e, 0xec, 0x51, 0xd6, 0x3b, 0xab, 0x99, 0xb1, 0x9d, 0xf4, 0x82, - 0xc4, 0x09, 0x04, 0x45, 0x1c, 0x10, 0xf4, 0xc0, 0xa1, 0x17, 0x0e, 0x54, 0xfc, 0x1d, 0xa8, 0xc7, - 0xde, 0x40, 0x1c, 0x5c, 0x94, 0x48, 0xfc, 0x01, 0x39, 0x72, 0x42, 0xbb, 0x33, 0xbb, 0x6b, 0x3b, - 0x16, 0xb5, 0x23, 0x95, 0x5e, 0x92, 0xec, 0xdb, 0x37, 0xdf, 0xf7, 0xcd, 0x37, 0xf3, 0xde, 0xdb, - 0xc0, 0xd2, 0xc9, 0x9a, 0x4b, 0x85, 0xe4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8f, 0xf6, 0x34, 0x55, 0xdd, 0x1b, 0x99, 0x73, + 0x59, 0x71, 0x0e, 0xc2, 0x44, 0x96, 0x11, 0x86, 0xf7, 0x75, 0x54, 0x3f, 0xac, 0x4f, 0x01, 0x2c, + 0xd4, 0x98, 0xdf, 0x12, 0x57, 0x24, 0x8c, 0x45, 0x12, 0xde, 0x1f, 0x59, 0xc2, 0xff, 0xb4, 0x84, + 0x41, 0xa0, 0xc8, 0x9a, 0x8f, 0xe2, 0x7d, 0x22, 0x0e, 0x61, 0xe1, 0x52, 0x4d, 0xb1, 0x89, 0x8f, + 0x6b, 0x1e, 0x71, 0x97, 0x72, 0x65, 0xb0, 0x32, 0x59, 0x2d, 0xa7, 0xa8, 0x03, 0xd3, 0x90, 0x35, + 0xdf, 0x5b, 0x4e, 0x76, 0x54, 0x74, 0x23, 0xf7, 0xe4, 0xa9, 0x99, 0x41, 0x9f, 0x67, 0x61, 0x31, + 0x79, 0x36, 0xef, 0x50, 0x21, 0x19, 0xa7, 0x0e, 0xf6, 0x14, 0xb3, 0x30, 0x7e, 0x00, 0x70, 0xd1, + 0x69, 0x35, 0x5b, 0x1e, 0x96, 0xb4, 0x4d, 0xb4, 0x4c, 0x9b, 0x63, 0x49, 0x99, 0xbe, 0xba, 0x0b, + 0x7d, 0x57, 0x77, 0x9b, 0x38, 0xd1, 0xed, 0xfd, 0x20, 0x74, 0xe6, 0xa2, 0x6b, 0x96, 0xf4, 0x31, + 0x0f, 0x06, 0x41, 0xcf, 0x5e, 0x9a, 0x6f, 0x0e, 0xe7, 0x9d, 0xba, 0xe2, 0x85, 0x14, 0x48, 0x69, + 0xb4, 0x42, 0x18, 0x63, 0x0b, 0xce, 0x72, 0x72, 0x44, 0x38, 0xf1, 0x1d, 0x62, 0x3b, 0xd1, 0xcb, + 0x0a, 0xef, 0xc8, 0xad, 0x6a, 0xf1, 0xa2, 0x6b, 0x2e, 0x28, 0x09, 0x7d, 0x09, 0xc8, 0x9a, 0x49, + 0x22,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, 0x5e, + 0xe7, 0xaa, 0xab, 0x7f, 0x74, 0xcd, 0x59, 0x87, 0x93, 0xb0, 0xc0, 0xfb, 0xb6, 0x9a, 0x4a, 0x45, + 0xf6, 0x4d, 0x20, 0x4b, 0x2f, 0xae, 0x9a, 0xcf, 0xcf, 0x4a, 0xe0, 0xc5, 0x59, 0x09, 0xfc, 0x7e, + 0x56, 0x02, 0x5f, 0x9f, 0x97, 0x32, 0x2f, 0xce, 0x4b, 0x99, 0x5f, 0xcf, 0x4b, 0x99, 0x8f, 0xc6, + 0x23, 0x09, 0xb5, 0x89, 0xe8, 0x3f, 0x8c, 0x7b, 0x7f, 0x07, 0x00, 0x00, 0xff, 0xff, 0x2c, 0xac, + 0x10, 0x4b, 0xdd, 0x0c, 0x00, 0x00, } func (m *MsgSetWithdrawAddress) Marshal() (dAtA []byte, err error) { diff --git a/x/distribution/types/types.proto b/x/distribution/types/types.proto index 5940611678f8..be398e09126a 100644 --- a/x/distribution/types/types.proto +++ b/x/distribution/types/types.proto @@ -175,5 +175,8 @@ message DelegatorStartingInfo { (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false ]; - uint64 height = 3 [(gogoproto.moretags) = "yaml:\"creation_height\""]; + uint64 height = 3 [ + (gogoproto.moretags) = "yaml:\"creation_height\"", + (gogoproto.jsontag) = "creation_height" + ]; } From 198830542944b96931de78b02a5997d27c97125a Mon Sep 17 00:00:00 2001 From: Marko Baricevic Date: Tue, 11 Feb 2020 09:59:58 +0100 Subject: [PATCH 44/46] revet query.go changes --- x/distribution/client/cli/query.go | 11 +++-------- x/distribution/types/validator.go | 6 ------ 2 files changed, 3 insertions(+), 14 deletions(-) diff --git a/x/distribution/client/cli/query.go b/x/distribution/client/cli/query.go index ce3f05abd343..92af18275233 100644 --- a/x/distribution/client/cli/query.go +++ b/x/distribution/client/cli/query.go @@ -140,10 +140,8 @@ $ %s query distribution commission cosmosvaloper1gghjut3ccd8ay0zduzj64hwre2fxs9l return err } - valCom, err := types.UnmarshalValidatorAccumulatedCommission(types.ModuleCdc, res) - if err != nil { - return err - } + var valCom types.ValidatorAccumulatedCommission + cdc.MustUnmarshalJSON(res, &valCom) return cliCtx.PrintOutput(valCom) }, } @@ -194,10 +192,7 @@ $ %s query distribution slashes cosmosvaloper1gghjut3ccd8ay0zduzj64hwre2fxs9ldmq } var slashes types.ValidatorSlashEvents - err = cdc.UnmarshalBinaryLengthPrefixed(res, &slashes) - if err != nil { - return err - } + cdc.MustUnmarshalJSON(res, &slashes) return cliCtx.PrintOutput(slashes) }, } diff --git a/x/distribution/types/validator.go b/x/distribution/types/validator.go index 8484c497e68f..aa64a3703068 100644 --- a/x/distribution/types/validator.go +++ b/x/distribution/types/validator.go @@ -4,7 +4,6 @@ import ( "fmt" "strings" - "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" ) @@ -29,11 +28,6 @@ func InitialValidatorAccumulatedCommission() ValidatorAccumulatedCommission { return ValidatorAccumulatedCommission{} } -func UnmarshalValidatorAccumulatedCommission(cdc codec.Marshaler, value []byte) (v ValidatorAccumulatedCommission, err error) { - err = cdc.UnmarshalBinaryLengthPrefixed(value, &v) - return v, err -} - // create a new ValidatorSlashEvent func NewValidatorSlashEvent(validatorPeriod uint64, fraction sdk.Dec) ValidatorSlashEvent { return ValidatorSlashEvent{ From 0d71b3bed90d6113a99cb9b3d08b601e2cf75258 Mon Sep 17 00:00:00 2001 From: Marko Baricevic Date: Tue, 11 Feb 2020 12:13:47 +0100 Subject: [PATCH 45/46] add sed command to third_party tendermint cmds --- Makefile | 8 +- .../proto/tendermint/abci/types/types.proto | 126 +++++++++--------- 2 files changed, 65 insertions(+), 69 deletions(-) diff --git a/Makefile b/Makefile index d3081d9eeab8..2cf897fe985a 100644 --- a/Makefile +++ b/Makefile @@ -250,11 +250,13 @@ tmabci = third_party/proto/tendermint/abci/types/types.proto # You *only* need to run this to rebuild protobufs from the tendermint source proto-update-tendermint: - # When running this command you will have to update the proto files with third_party imports instead of what is copied @curl $(tendermint)/abci/types/types.proto > $(tmabci) + sed -i '' '8,9 s|github.com/tendermint|third_party/proto|g' $(tmabci) + sed -i '' '7 s|github.com/gogo/protobuf|third_party/proto|' $(tmabci) @curl $(tendermint)/libs/kv/types.proto > $(tmkv) + sed -i '' 's|github.com/gogo/protobuf|third_party/proto|' $(tmkv) @curl $(tendermint)/crypto/merkle/merkle.proto > $(tmmerkle) - @sed 's@package types;@package abci;@' $(tmabci) > protobuf/abci.proto - @curl $(tendermint)/version/version.go | grep -F -eTMCoreSem -eABCISemVer > version.txt + sed -i '' '7 s|github.com/gogo/protobuf|third_party/proto|' $(tmmerkle) + .PHONY: proto-all proto-gen proto-lint proto-check-breaking proto-update-tendermint diff --git a/third_party/proto/tendermint/abci/types/types.proto b/third_party/proto/tendermint/abci/types/types.proto index eff32d4c5322..6c65444b0755 100644 --- a/third_party/proto/tendermint/abci/types/types.proto +++ b/third_party/proto/tendermint/abci/types/types.proto @@ -18,7 +18,6 @@ option (gogoproto.marshaler_all) = true; option (gogoproto.unmarshaler_all) = true; option (gogoproto.sizer_all) = true; option (gogoproto.goproto_registration) = true; - // Generate tests option (gogoproto.populate_all) = true; option (gogoproto.equal_all) = true; @@ -43,9 +42,12 @@ message Request { } } -message RequestEcho { string message = 1; } +message RequestEcho { + string message = 1; +} -message RequestFlush {} +message RequestFlush { +} message RequestInfo { string version = 1; @@ -60,11 +62,10 @@ message RequestSetOption { } message RequestInitChain { - google.protobuf.Timestamp time = 1 - [ (gogoproto.nullable) = false, (gogoproto.stdtime) = true ]; + google.protobuf.Timestamp time = 1 [(gogoproto.nullable)=false, (gogoproto.stdtime)=true]; string chain_id = 2; ConsensusParams consensus_params = 3; - repeated ValidatorUpdate validators = 4 [ (gogoproto.nullable) = false ]; + repeated ValidatorUpdate validators = 4 [(gogoproto.nullable)=false]; bytes app_state_bytes = 5; } @@ -77,9 +78,9 @@ message RequestQuery { message RequestBeginBlock { bytes hash = 1; - Header header = 2 [ (gogoproto.nullable) = false ]; - LastCommitInfo last_commit_info = 3 [ (gogoproto.nullable) = false ]; - repeated Evidence byzantine_validators = 4 [ (gogoproto.nullable) = false ]; + Header header = 2 [(gogoproto.nullable)=false]; + LastCommitInfo last_commit_info = 3 [(gogoproto.nullable)=false]; + repeated Evidence byzantine_validators = 4 [(gogoproto.nullable)=false]; } enum CheckTxType { @@ -92,11 +93,16 @@ message RequestCheckTx { CheckTxType type = 2; } -message RequestDeliverTx { bytes tx = 1; } +message RequestDeliverTx { + bytes tx = 1; +} -message RequestEndBlock { int64 height = 1; } +message RequestEndBlock { + int64 height = 1; +} -message RequestCommit {} +message RequestCommit { +} //---------------------------------------- // Response types @@ -119,11 +125,16 @@ message Response { } // nondeterministic -message ResponseException { string error = 1; } +message ResponseException { + string error = 1; +} -message ResponseEcho { string message = 1; } +message ResponseEcho { + string message = 1; +} -message ResponseFlush {} +message ResponseFlush { +} message ResponseInfo { string data = 1; @@ -145,13 +156,13 @@ message ResponseSetOption { message ResponseInitChain { ConsensusParams consensus_params = 1; - repeated ValidatorUpdate validators = 2 [ (gogoproto.nullable) = false ]; + repeated ValidatorUpdate validators = 2 [(gogoproto.nullable)=false]; } message ResponseQuery { uint32 code = 1; // bytes data = 2; // use "value" instead. - string log = 3; // nondeterministic + string log = 3; // nondeterministic string info = 4; // nondeterministic int64 index = 5; bytes key = 6; @@ -162,48 +173,35 @@ message ResponseQuery { } message ResponseBeginBlock { - repeated Event events = 1 [ - (gogoproto.nullable) = false, - (gogoproto.jsontag) = "events,omitempty" - ]; + repeated Event events = 1 [(gogoproto.nullable)=false, (gogoproto.jsontag)="events,omitempty"]; } message ResponseCheckTx { uint32 code = 1; bytes data = 2; - string log = 3; // nondeterministic + string log = 3; // nondeterministic string info = 4; // nondeterministic - int64 gas_wanted = 5; + int64 gas_wanted = 5; int64 gas_used = 6; - repeated Event events = 7 [ - (gogoproto.nullable) = false, - (gogoproto.jsontag) = "events,omitempty" - ]; + repeated Event events = 7 [(gogoproto.nullable)=false, (gogoproto.jsontag)="events,omitempty"]; string codespace = 8; } message ResponseDeliverTx { uint32 code = 1; bytes data = 2; - string log = 3; // nondeterministic + string log = 3; // nondeterministic string info = 4; // nondeterministic int64 gas_wanted = 5; int64 gas_used = 6; - repeated Event events = 7 [ - (gogoproto.nullable) = false, - (gogoproto.jsontag) = "events,omitempty" - ]; + repeated Event events = 7 [(gogoproto.nullable)=false, (gogoproto.jsontag)="events,omitempty"]; string codespace = 8; } message ResponseEndBlock { - repeated ValidatorUpdate validator_updates = 1 - [ (gogoproto.nullable) = false ]; + repeated ValidatorUpdate validator_updates = 1 [(gogoproto.nullable)=false]; ConsensusParams consensus_param_updates = 2; - repeated Event events = 3 [ - (gogoproto.nullable) = false, - (gogoproto.jsontag) = "events,omitempty" - ]; + repeated Event events = 3 [(gogoproto.nullable)=false, (gogoproto.jsontag)="events,omitempty"]; } message ResponseCommit { @@ -233,24 +231,22 @@ message BlockParams { message EvidenceParams { // Note: must be greater than 0 int64 max_age_num_blocks = 1; - google.protobuf.Duration max_age_duration = 2 - [ (gogoproto.nullable) = false, (gogoproto.stdduration) = true ]; + google.protobuf.Duration max_age_duration = 2 [(gogoproto.nullable)=false, (gogoproto.stdduration)=true]; } // ValidatorParams contains limits on validators. -message ValidatorParams { repeated string pub_key_types = 1; } +message ValidatorParams { + repeated string pub_key_types = 1; +} message LastCommitInfo { int32 round = 1; - repeated VoteInfo votes = 2 [ (gogoproto.nullable) = false ]; + repeated VoteInfo votes = 2 [(gogoproto.nullable)=false]; } message Event { string type = 1; - repeated tendermint.libs.kv.Pair attributes = 2 [ - (gogoproto.nullable) = false, - (gogoproto.jsontag) = "attributes,omitempty" - ]; + repeated tendermint.libs.kv.Pair attributes = 2 [(gogoproto.nullable)=false, (gogoproto.jsontag)="attributes,omitempty"]; } //---------------------------------------- @@ -258,26 +254,24 @@ message Event { message Header { // basic block info - Version version = 1 [ (gogoproto.nullable) = false ]; - string chain_id = 2 [ (gogoproto.customname) = "ChainID" ]; + Version version = 1 [(gogoproto.nullable)=false]; + string chain_id = 2 [(gogoproto.customname)="ChainID"]; int64 height = 3; - google.protobuf.Timestamp time = 4 - [ (gogoproto.nullable) = false, (gogoproto.stdtime) = true ]; + google.protobuf.Timestamp time = 4 [(gogoproto.nullable)=false, (gogoproto.stdtime)=true]; // prev block info - BlockID last_block_id = 5 [ (gogoproto.nullable) = false ]; + BlockID last_block_id = 5 [(gogoproto.nullable)=false]; // hashes of block data bytes last_commit_hash = 6; // commit from validators from the last block bytes data_hash = 7; // transactions // hashes from the app output from the prev block - bytes validators_hash = 8; // validators for the current block - bytes next_validators_hash = 9; // validators for the next block - bytes consensus_hash = 10; // consensus params for current block - bytes app_hash = 11; // state after txs from the previous block - bytes last_results_hash = - 12; // root hash of all results from the txs from the previous block + bytes validators_hash = 8; // validators for the current block + bytes next_validators_hash = 9; // validators for the next block + bytes consensus_hash = 10; // consensus params for current block + bytes app_hash = 11; // state after txs from the previous block + bytes last_results_hash = 12;// root hash of all results from the txs from the previous block // consensus info bytes evidence_hash = 13; // evidence included in the block @@ -289,9 +283,10 @@ message Version { uint64 App = 2; } + message BlockID { bytes hash = 1; - PartSetHeader parts_header = 2 [ (gogoproto.nullable) = false ]; + PartSetHeader parts_header = 2 [(gogoproto.nullable)=false]; } message PartSetHeader { @@ -302,33 +297,32 @@ message PartSetHeader { // Validator message Validator { bytes address = 1; - // PubKey pub_key = 2 [(gogoproto.nullable)=false]; + //PubKey pub_key = 2 [(gogoproto.nullable)=false]; int64 power = 3; } // ValidatorUpdate message ValidatorUpdate { - PubKey pub_key = 1 [ (gogoproto.nullable) = false ]; + PubKey pub_key = 1 [(gogoproto.nullable)=false]; int64 power = 2; } // VoteInfo message VoteInfo { - Validator validator = 1 [ (gogoproto.nullable) = false ]; + Validator validator = 1 [(gogoproto.nullable)=false]; bool signed_last_block = 2; } message PubKey { string type = 1; - bytes data = 2; + bytes data = 2; } message Evidence { string type = 1; - Validator validator = 2 [ (gogoproto.nullable) = false ]; + Validator validator = 2 [(gogoproto.nullable)=false]; int64 height = 3; - google.protobuf.Timestamp time = 4 - [ (gogoproto.nullable) = false, (gogoproto.stdtime) = true ]; + google.protobuf.Timestamp time = 4 [(gogoproto.nullable)=false, (gogoproto.stdtime)=true]; int64 total_voting_power = 5; } @@ -336,7 +330,7 @@ message Evidence { // Service Definition service ABCIApplication { - rpc Echo(RequestEcho) returns (ResponseEcho); + rpc Echo(RequestEcho) returns (ResponseEcho) ; rpc Flush(RequestFlush) returns (ResponseFlush); rpc Info(RequestInfo) returns (ResponseInfo); rpc SetOption(RequestSetOption) returns (ResponseSetOption); From 6cd41031eaaf62bb05fccb1c5d2d886f537b5952 Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Tue, 11 Feb 2020 09:04:28 -0500 Subject: [PATCH 46/46] Update changelog entry --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 89d4897605cb..aff20cb2eb1a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -86,6 +86,7 @@ for JSON encoding. * (distr) [\#5610](https://github.com/cosmos/cosmos-sdk/pull/5610) Migrate the `x/distribution` module to use Protocol Buffer for state serialization instead of Amino. The exact codec used is `codec.HybridCodec` which utilizes Protobuf for binary encoding and Amino for JSON encoding. + * `ValidatorHistoricalRewards.ReferenceCount` is now of types `uint32` instead of `uint16`. * `ValidatorSlashEvents` is now a struct with `slashevents`. * `ValidatorOutstandingRewards` is now a struct with `rewards`. * `ValidatorAccumulatedCommission` is now a struct with `commission`.