From 36c25f242fc92f842181a52a7c8db2af77dbf54f Mon Sep 17 00:00:00 2001 From: Jae Kwon Date: Sat, 5 Mar 2016 19:18:34 -0800 Subject: [PATCH] s/InitValidators/InitChain/g, s/SyncValidators/EndBlock/g, added BeginBlock --- README.md | 22 +++-- client/client.go | 29 ++++-- server/server.go | 20 ++-- types/application.go | 17 ++-- types/messages.go | 29 ++++-- types/types.pb.go | 224 +++++++++++++++++++++++++++---------------- types/types.proto | 45 ++++++--- 7 files changed, 252 insertions(+), 134 deletions(-) diff --git a/README.md b/README.md index 2bad63f06..4da882275 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ TMSP requests/responses are simple Protobuf messages. Check out the [schema fil * __Arguments__: * `Data ([]byte)`: The request transaction bytes * __Returns__: - * `Code (uint)`: Response code + * `Code (uint32)`: Response code * `Data ([]byte)`: Result bytes, if any * `Log (string)`: Debug or error message * __Usage__:
@@ -24,7 +24,7 @@ TMSP requests/responses are simple Protobuf messages. Check out the [schema fil * __Arguments__: * `Data ([]byte)`: The request transaction bytes * __Returns__: - * `Code (uint)`: Response code + * `Code (uint32)`: Response code * `Data ([]byte)`: Result bytes, if any * `Log (string)`: Debug or error message * __Usage__:
@@ -43,7 +43,7 @@ TMSP requests/responses are simple Protobuf messages. Check out the [schema fil * __Arguments__: * `Data ([]byte)`: The query request bytes * __Returns__: - * `Code (uint)`: Response code + * `Code (uint32)`: Response code * `Data ([]byte)`: The query response bytes * `Log (string)`: Debug or error message @@ -67,23 +67,29 @@ TMSP requests/responses are simple Protobuf messages. Check out the [schema fil Set application options. E.g. Key="mode", Value="mempool" for a mempool connection, or Key="mode", Value="consensus" for a consensus connection. Other options are application specific. -#### InitValidators +#### InitChain * __Arguments__: * `Validators ([]Validator)`: Initial genesis validators * __Usage__:
- Called once upon genesis, to inform the app about the initial validators. + Called once upon genesis -#### SyncValidators +#### BeginBlock + * __Arguments__: + * `Height (uint64)`: Block number + * __Usage__:
+ Signals the beginning of a block + +#### EndBlock * __Returns__: * `Validators ([]Validator)`: Changed validators with new voting powers (0 to remove) * __Usage__:
- Called prior to each Commit to get validator updates from the application. + Signals the end of a block. Called prior to each Commit after all transactions ## Changelog ### Feb 28th, 2016 -* Added InitValidators, SyncValidators +* Added InitChain, BeginBlock, EndBlock ### Feb 14th, 2016 diff --git a/client/client.go b/client/client.go index f5503e141..dff128543 100644 --- a/client/client.go +++ b/client/client.go @@ -215,12 +215,16 @@ func (cli *Client) QueryAsync(query []byte) *ReqRes { return cli.queueRequest(types.RequestQuery(query)) } -func (cli *Client) InitValidatorsAsync(validators []*types.Validator) *ReqRes { - return cli.queueRequest(types.RequestInitValidators(validators)) +func (cli *Client) InitChainAsync(validators []*types.Validator) *ReqRes { + return cli.queueRequest(types.RequestInitChain(validators)) } -func (cli *Client) SyncValidatorsAsync() *ReqRes { - return cli.queueRequest(types.RequestSyncValidators()) +func (cli *Client) BeginBlockAsync(height uint64) *ReqRes { + return cli.queueRequest(types.RequestBeginBlock(height)) +} + +func (cli *Client) EndBlockAsync() *ReqRes { + return cli.queueRequest(types.RequestEndBlock()) } //---------------------------------------- @@ -288,8 +292,17 @@ func (cli *Client) QuerySync(query []byte) (code types.CodeType, result []byte, return res.Code, res.Data, res.Log, nil } -func (cli *Client) InitValidatorsSync(validators []*types.Validator) (err error) { - cli.queueRequest(types.RequestInitValidators(validators)) +func (cli *Client) InitChainSync(validators []*types.Validator) (err error) { + cli.queueRequest(types.RequestInitChain(validators)) + cli.FlushSync() + if cli.err != nil { + return cli.err + } + return nil +} + +func (cli *Client) BeginBlockSync(height uint64) (err error) { + cli.queueRequest(types.RequestBeginBlock(height)) cli.FlushSync() if cli.err != nil { return cli.err @@ -297,8 +310,8 @@ func (cli *Client) InitValidatorsSync(validators []*types.Validator) (err error) return nil } -func (cli *Client) SyncValidatorsSync() (validators []*types.Validator, err error) { - reqres := cli.queueRequest(types.RequestSyncValidators()) +func (cli *Client) EndBlockSync() (validators []*types.Validator, err error) { + reqres := cli.queueRequest(types.RequestEndBlock()) cli.FlushSync() if cli.err != nil { return nil, cli.err diff --git a/server/server.go b/server/server.go index 47a64dcdc..586a1a607 100644 --- a/server/server.go +++ b/server/server.go @@ -148,19 +148,19 @@ func (s *Server) handleRequest(req *types.Request, responses chan<- *types.Respo case types.MessageType_Query: code, result, logStr := s.app.Query(req.Data) responses <- types.ResponseQuery(code, result, logStr) - case types.MessageType_InitValidators: - if app, ok := s.app.(types.ValidatorAware); ok { - app.InitValidators(req.Validators) - responses <- types.ResponseInitValidators() + case types.MessageType_InitChain: + if app, ok := s.app.(types.BlockchainAware); ok { + app.InitChain(req.Validators) + responses <- types.ResponseInitChain() } else { - responses <- types.ResponseInitValidators() + responses <- types.ResponseInitChain() } - case types.MessageType_SyncValidators: - if app, ok := s.app.(types.ValidatorAware); ok { - validators := app.SyncValidators() - responses <- types.ResponseSyncValidators(validators) + case types.MessageType_EndBlock: + if app, ok := s.app.(types.BlockchainAware); ok { + validators := app.EndBlock() + responses <- types.ResponseEndBlock(validators) } else { - responses <- types.ResponseSyncValidators(nil) + responses <- types.ResponseEndBlock(nil) } default: responses <- types.ResponseException("Unknown request") diff --git a/types/application.go b/types/application.go index 74a2a5cc2..6c916a29d 100644 --- a/types/application.go +++ b/types/application.go @@ -22,12 +22,17 @@ type Application interface { Query(query []byte) (code CodeType, result []byte, log string) } -// Some applications can choose to implement ValidatorAware -type ValidatorAware interface { +// Some applications can choose to implement BlockchainAware +type BlockchainAware interface { - // Give app initial list of validators upon genesis - InitValidators([]*Validator) + // Initialize blockchain + // validators: genesis validators from TendermintCore + InitChain(validators []*Validator) - // Receive updates to validators from app, prior to commit - SyncValidators() []*Validator + // Signals the beginning of a block + BeginBlock(height uint64) + + // Signals the end of a block + // validators: changed validators from app to TendermintCore + EndBlock() (validators []*Validator) } diff --git a/types/messages.go b/types/messages.go index 71a86c7da..368e2f1f9 100644 --- a/types/messages.go +++ b/types/messages.go @@ -61,16 +61,23 @@ func RequestQuery(queryBytes []byte) *Request { } } -func RequestInitValidators(validators []*Validator) *Request { +func RequestInitChain(validators []*Validator) *Request { return &Request{ - Type: MessageType_InitValidators, + Type: MessageType_InitChain, Validators: validators, } } -func RequestSyncValidators() *Request { +func RequestBeginBlock(height uint64) *Request { return &Request{ - Type: MessageType_SyncValidators, + Type: MessageType_BeginBlock, + Height: height, + } +} + +func RequestEndBlock() *Request { + return &Request{ + Type: MessageType_EndBlock, } } @@ -145,15 +152,21 @@ func ResponseQuery(code CodeType, result []byte, log string) *Response { } } -func ResponseInitValidators() *Response { +func ResponseInitChain() *Response { + return &Response{ + Type: MessageType_InitChain, + } +} + +func ResponseBeginBlock() *Response { return &Response{ - Type: MessageType_InitValidators, + Type: MessageType_BeginBlock, } } -func ResponseSyncValidators(validators []*Validator) *Response { +func ResponseEndBlock(validators []*Validator) *Response { return &Response{ - Type: MessageType_SyncValidators, + Type: MessageType_EndBlock, Validators: validators, } } diff --git a/types/types.pb.go b/types/types.pb.go index 81267107d..d8b71f965 100644 --- a/types/types.pb.go +++ b/types/types.pb.go @@ -27,18 +27,19 @@ var _ = math.Inf type MessageType int32 const ( - MessageType_NullMessage MessageType = 0 - MessageType_Echo MessageType = 1 - MessageType_Flush MessageType = 2 - MessageType_Info MessageType = 3 - MessageType_SetOption MessageType = 4 - MessageType_Exception MessageType = 5 - MessageType_AppendTx MessageType = 17 - MessageType_CheckTx MessageType = 18 - MessageType_Commit MessageType = 19 - MessageType_Query MessageType = 20 - MessageType_InitValidators MessageType = 21 - MessageType_SyncValidators MessageType = 22 + MessageType_NullMessage MessageType = 0 + MessageType_Echo MessageType = 1 + MessageType_Flush MessageType = 2 + MessageType_Info MessageType = 3 + MessageType_SetOption MessageType = 4 + MessageType_Exception MessageType = 5 + MessageType_AppendTx MessageType = 17 + MessageType_CheckTx MessageType = 18 + MessageType_Commit MessageType = 19 + MessageType_Query MessageType = 20 + MessageType_InitChain MessageType = 21 + MessageType_BeginBlock MessageType = 22 + MessageType_EndBlock MessageType = 23 ) var MessageType_name = map[int32]string{ @@ -52,22 +53,24 @@ var MessageType_name = map[int32]string{ 18: "CheckTx", 19: "Commit", 20: "Query", - 21: "InitValidators", - 22: "SyncValidators", + 21: "InitChain", + 22: "BeginBlock", + 23: "EndBlock", } var MessageType_value = map[string]int32{ - "NullMessage": 0, - "Echo": 1, - "Flush": 2, - "Info": 3, - "SetOption": 4, - "Exception": 5, - "AppendTx": 17, - "CheckTx": 18, - "Commit": 19, - "Query": 20, - "InitValidators": 21, - "SyncValidators": 22, + "NullMessage": 0, + "Echo": 1, + "Flush": 2, + "Info": 3, + "SetOption": 4, + "Exception": 5, + "AppendTx": 17, + "CheckTx": 18, + "Commit": 19, + "Query": 20, + "InitChain": 21, + "BeginBlock": 22, + "EndBlock": 23, } func (x MessageType) String() string { @@ -80,36 +83,80 @@ type CodeType int32 const ( CodeType_OK CodeType = 0 CodeType_InternalError CodeType = 1 - CodeType_Unauthorized CodeType = 2 - CodeType_InsufficientFees CodeType = 3 - CodeType_UnknownRequest CodeType = 4 - CodeType_EncodingError CodeType = 5 - CodeType_BadNonce CodeType = 6 - CodeType_UnknownAccount CodeType = 7 - CodeType_InsufficientFunds CodeType = 8 + CodeType_EncodingError CodeType = 2 + CodeType_BadNonce CodeType = 3 + CodeType_Unauthorized CodeType = 4 + CodeType_InsufficientFunds CodeType = 5 + CodeType_UnknownRequest CodeType = 6 + // Reserved for basecoin, 100 ~ 199 + CodeType_BaseEncodingError CodeType = 101 + CodeType_BaseBadNonce CodeType = 102 + CodeType_BaseUnknownAccount CodeType = 103 + CodeType_BaseUnauthorized CodeType = 104 + CodeType_BaseInsufficientFunds CodeType = 105 + CodeType_BaseInsufficientFees CodeType = 106 + // Reserved for governance, 200 ~ 299 + CodeType_GovUnknownEntity CodeType = 201 + CodeType_GovUnknownGroup CodeType = 202 + CodeType_GovUnknownMember CodeType = 203 + CodeType_GovUnknownProposal CodeType = 204 + CodeType_GovDuplicateEntity CodeType = 205 + CodeType_GovDuplicateGroup CodeType = 206 + CodeType_GovDuplicateMember CodeType = 207 + CodeType_GovDuplicateProposal CodeType = 208 + CodeType_GovDuplicateVote CodeType = 209 + CodeType_GovInvalidVotingPower CodeType = 210 ) var CodeType_name = map[int32]string{ - 0: "OK", - 1: "InternalError", - 2: "Unauthorized", - 3: "InsufficientFees", - 4: "UnknownRequest", - 5: "EncodingError", - 6: "BadNonce", - 7: "UnknownAccount", - 8: "InsufficientFunds", + 0: "OK", + 1: "InternalError", + 2: "EncodingError", + 3: "BadNonce", + 4: "Unauthorized", + 5: "InsufficientFunds", + 6: "UnknownRequest", + 101: "BaseEncodingError", + 102: "BaseBadNonce", + 103: "BaseUnknownAccount", + 104: "BaseUnauthorized", + 105: "BaseInsufficientFunds", + 106: "BaseInsufficientFees", + 201: "GovUnknownEntity", + 202: "GovUnknownGroup", + 203: "GovUnknownMember", + 204: "GovUnknownProposal", + 205: "GovDuplicateEntity", + 206: "GovDuplicateGroup", + 207: "GovDuplicateMember", + 208: "GovDuplicateProposal", + 209: "GovDuplicateVote", + 210: "GovInvalidVotingPower", } var CodeType_value = map[string]int32{ - "OK": 0, - "InternalError": 1, - "Unauthorized": 2, - "InsufficientFees": 3, - "UnknownRequest": 4, - "EncodingError": 5, - "BadNonce": 6, - "UnknownAccount": 7, - "InsufficientFunds": 8, + "OK": 0, + "InternalError": 1, + "EncodingError": 2, + "BadNonce": 3, + "Unauthorized": 4, + "InsufficientFunds": 5, + "UnknownRequest": 6, + "BaseEncodingError": 101, + "BaseBadNonce": 102, + "BaseUnknownAccount": 103, + "BaseUnauthorized": 104, + "BaseInsufficientFunds": 105, + "BaseInsufficientFees": 106, + "GovUnknownEntity": 201, + "GovUnknownGroup": 202, + "GovUnknownMember": 203, + "GovUnknownProposal": 204, + "GovDuplicateEntity": 205, + "GovDuplicateGroup": 206, + "GovDuplicateMember": 207, + "GovDuplicateProposal": 208, + "GovDuplicateVote": 209, + "GovInvalidVotingPower": 210, } func (x CodeType) String() string { @@ -123,6 +170,7 @@ type Request struct { Key string `protobuf:"bytes,3,opt,name=key" json:"key,omitempty"` Value string `protobuf:"bytes,4,opt,name=value" json:"value,omitempty"` Validators []*Validator `protobuf:"bytes,5,rep,name=validators" json:"validators,omitempty"` + Height uint64 `protobuf:"varint,6,opt,name=height" json:"height,omitempty"` } func (m *Request) Reset() { *m = Request{} } @@ -177,36 +225,46 @@ func init() { } var fileDescriptor0 = []byte{ - // 484 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xa4, 0x53, 0xcd, 0x6e, 0xd3, 0x40, - 0x10, 0xc6, 0x89, 0xed, 0x24, 0x93, 0x34, 0xdd, 0x2c, 0x69, 0xe5, 0x63, 0x55, 0x24, 0x54, 0xf5, - 0x50, 0x50, 0x38, 0x71, 0x2c, 0x51, 0x2a, 0x45, 0x15, 0xad, 0x70, 0x5b, 0xee, 0xae, 0x3d, 0x49, - 0xac, 0xb8, 0xbb, 0xc6, 0xbb, 0x4b, 0x1b, 0x5e, 0x86, 0x27, 0xe0, 0xc8, 0x23, 0xf0, 0x5e, 0xcc, - 0xae, 0x9d, 0x2a, 0x70, 0x42, 0xe2, 0x12, 0xcd, 0xf7, 0xcd, 0xdf, 0xf7, 0xcd, 0xc6, 0x30, 0xd2, - 0x9b, 0x12, 0xd5, 0x1b, 0xf7, 0x7b, 0x56, 0x56, 0x52, 0x4b, 0x1e, 0x38, 0x70, 0xfc, 0xdd, 0x83, - 0x4e, 0x8c, 0x5f, 0x0c, 0x2a, 0xcd, 0x5f, 0x83, 0x6f, 0xc9, 0xc8, 0x3b, 0xf2, 0x4e, 0x86, 0x13, - 0x7e, 0x56, 0x97, 0x7f, 0x44, 0xa5, 0x92, 0x25, 0xde, 0x12, 0x88, 0x5d, 0x9e, 0x73, 0xf0, 0xb3, - 0x44, 0x27, 0x51, 0x8b, 0xea, 0x06, 0xb1, 0x8b, 0x39, 0x83, 0xf6, 0x1a, 0x37, 0x51, 0x9b, 0xa8,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xce, 0x74, 0x85, 0xe9, 0x9a, 0x00, 0x5d, 0x11, 0xc2, 0xa9, 0x7c, - 0x78, 0xc8, 0x35, 0x7b, 0x69, 0x27, 0x7f, 0x32, 0x58, 0x6d, 0xd8, 0x98, 0xf8, 0xe1, 0x5c, 0xe4, - 0xfa, 0xd9, 0x8e, 0x62, 0x07, 0x96, 0xbb, 0xd9, 0x88, 0x74, 0x87, 0x3b, 0x3c, 0xfd, 0x41, 0x4f, - 0xb7, 0xbd, 0x2f, 0x0f, 0xa1, 0x75, 0x7d, 0x49, 0x5a, 0x47, 0xb0, 0x37, 0x17, 0x1a, 0x2b, 0x91, - 0x14, 0x33, 0x7b, 0x5c, 0x12, 0xcd, 0x60, 0x70, 0x27, 0x12, 0xa3, 0x57, 0xb2, 0xca, 0xbf, 0x61, - 0x46, 0xda, 0xc7, 0xc0, 0xe6, 0x42, 0x99, 0xc5, 0x22, 0x4f, 0x73, 0x14, 0xfa, 0x02, 0x51, 0x91, - 0x0f, 0xda, 0x71, 0x27, 0xd6, 0x42, 0x3e, 0x8a, 0xe6, 0x2f, 0x4b, 0x66, 0x68, 0xdc, 0x4c, 0xd0, - 0xd3, 0xe5, 0x62, 0x59, 0x8f, 0x73, 0x86, 0x3e, 0x24, 0xd9, 0x95, 0x14, 0x29, 0xb2, 0x70, 0xa7, - 0xe9, 0x3c, 0x4d, 0xa5, 0x11, 0x9a, 0x75, 0xf8, 0x01, 0x8c, 0xfe, 0x18, 0x6f, 0x44, 0xa6, 0x58, - 0xf7, 0x3e, 0x74, 0x9f, 0xc6, 0xbb, 0xdf, 0x01, 0x00, 0x00, 0xff, 0xff, 0x33, 0x74, 0xc9, 0x67, - 0x2f, 0x03, 0x00, 0x00, + // 654 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xa4, 0x54, 0x4d, 0x4f, 0xdb, 0x40, + 0x10, 0xad, 0x13, 0x27, 0x24, 0x13, 0x08, 0x9b, 0x6d, 0x02, 0x69, 0x4f, 0x88, 0x4a, 0x15, 0xe2, + 0x40, 0x2b, 0x7a, 0xea, 0x91, 0xa4, 0x01, 0x45, 0x88, 0x8f, 0xba, 0xc0, 0xdd, 0x38, 0x93, 0x78, + 0x1b, 0xb3, 0xeb, 0xda, 0x6b, 0x20, 0x3d, 0xf7, 0x3f, 0x55, 0xea, 0xbd, 0x87, 0x7e, 0x7f, 0xfc, + 0xa2, 0xce, 0xda, 0x4e, 0x08, 0xe5, 0xd0, 0x43, 0x2f, 0xd1, 0xbe, 0x37, 0xb3, 0xf3, 0xde, 0x1b, + 0xaf, 0x02, 0x0d, 0x3d, 0x09, 0x31, 0x7e, 0x92, 0xfe, 0x6e, 0x85, 0x91, 0xd2, 0x8a, 0x97, 0x52, + 0xb0, 0xfe, 0xde, 0x82, 0x05, 0x07, 0xdf, 0x24, 0x18, 0x6b, 0xfe, 0x18, 0x6c, 0x43, 0xb6, 0xad, + 0x35, 0x6b, 0xa3, 0xbe, 0xcd, 0xb7, 0xb2, 0xf6, 0x03, 0x8c, 0x63, 0x77, 0x84, 0x27, 0x04, 0x9c, + 0xb4, 0xce, 0x39, 0xd8, 0x03, 0x57, 0xbb, 0xed, 0x02, 0xf5, 0x2d, 0x3a, 0xe9, 0x99, 0x33, 0x28, + 0x8e, 0x71, 0xd2, 0x2e, 0x12, 0x55, 0x75, 0xcc, 0x91, 0x37, 0xa1, 0x74, 0xe9, 0x06, 0x09, 0xb6, + 0xed, 0x94, 0xcb, 0x00, 0x7f, 0x0a, 0x40, 0x07, 0x41, 0x77, 0x54, 0x14, 0xb7, 0x4b, 0x6b, 0xc5, + 0x8d, 0xda, 0x36, 0xcb, 0x95, 0xce, 0xa6, 0x05, 0x67, 0xae, 0x87, 0xaf, 0x40, 0xd9, 0x47, 0x31, + 0xf2, 0x75, 0xbb, 0x4c, 0x83, 0x6c, 0x27, 0x47, 0xeb, 0x1f, 0x2d, 0xa8, 0x38, 0x18, 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0xec, 0x06, 0xec, 0xeb, + 0xb4, 0xf0, 0x22, 0x09, 0x03, 0xe1, 0xb9, 0x1a, 0xf3, 0xf1, 0xdf, 0x2c, 0x0a, 0xd6, 0x98, 0x2f, + 0x64, 0x02, 0xdf, 0xef, 0x5c, 0xc8, 0x25, 0x7e, 0x58, 0x94, 0xad, 0x39, 0x5f, 0x98, 0x89, 0xfc, + 0x9c, 0x9a, 0x9a, 0x95, 0xce, 0x94, 0x46, 0xf6, 0xcb, 0xe2, 0x0f, 0xa1, 0x45, 0x74, 0x5f, 0xa6, + 0xaf, 0x9e, 0x48, 0x5a, 0xf4, 0xb1, 0x79, 0xc0, 0xec, 0xb7, 0x75, 0x5e, 0x4e, 0xff, 0x8e, 0x9e, + 0xfd, 0x09, 0x00, 0x00, 0xff, 0xff, 0xa9, 0x69, 0x85, 0x09, 0xa3, 0x04, 0x00, 0x00, } diff --git a/types/types.proto b/types/types.proto index 349fb7019..ccb4869e9 100644 --- a/types/types.proto +++ b/types/types.proto @@ -18,23 +18,45 @@ enum MessageType { CheckTx = 0x12; Commit = 0x13; Query = 0x14; - InitValidators = 0x15; - SyncValidators = 0x16; + InitChain = 0x15; + BeginBlock = 0x16; + EndBlock = 0x17; } //---------------------------------------- // Code types enum CodeType { - OK = 0; - InternalError = 1; - Unauthorized = 2; - InsufficientFees = 3; - UnknownRequest = 4; - EncodingError = 5; - BadNonce = 6; - UnknownAccount = 7; - InsufficientFunds = 8; + OK = 0; + + // General response codes, 0 ~ 99 + InternalError = 1; + EncodingError = 2; + BadNonce = 3; + Unauthorized = 4; + InsufficientFunds = 5; + UnknownRequest = 6; + + // Reserved for basecoin, 100 ~ 199 + BaseEncodingError = 101; + BaseBadNonce = 102; + BaseUnknownAccount = 103; + BaseUnauthorized = 104; + BaseInsufficientFunds = 105; + BaseInsufficientFees = 106; + + // Reserved for governance, 200 ~ 299 + GovUnknownEntity = 201; + GovUnknownGroup = 202; + GovUnknownMember = 203; + GovUnknownProposal = 204; + GovDuplicateEntity = 205; + GovDuplicateGroup = 206; + GovDuplicateMember = 207; + GovDuplicateProposal = 208; + GovDuplicateVote = 209; + GovInvalidVotingPower = 210; + } //---------------------------------------- @@ -46,6 +68,7 @@ message Request { string key = 3; string value = 4; repeated Validator validators = 5; + uint64 height = 6; } //----------------------------------------