Initial update for Init/SyncValidators

This commit is contained in:
Jae Kwon 2016-02-28 18:53:24 -08:00
parent b2bd661a61
commit 1ffe780976
3 changed files with 131 additions and 65 deletions

View File

@ -67,8 +67,24 @@ 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
* __Arguments__:
* `Validators ([]Validator)`: Initial genesis validators
* __Usage__:<br/>
Called once upon genesis, to inform the app about the initial validators.
#### SyncValidators
* __Returns__:
* `Validators ([]Validator)`: Changed validators with new voting powers (0 to remove)
* __Usage__:<br/>
Called prior to each Commit to get validator updates from the application.
## Changelog
### Feb 28th, 2016
* Added InitValidators, SyncValidators
### Feb 14th, 2016
* s/GetHash/Commit/g

View File

@ -11,6 +11,7 @@ It is generated from these files:
It has these top-level messages:
Request
Response
Validator
*/
package types
@ -26,16 +27,18 @@ 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_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_InitValdiators MessageType = 21
MessageType_SyncValdiators MessageType = 22
)
var MessageType_name = map[int32]string{
@ -49,18 +52,22 @@ var MessageType_name = map[int32]string{
18: "CheckTx",
19: "Commit",
20: "Query",
21: "InitValdiators",
22: "SyncValdiators",
}
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,
"NullMessage": 0,
"Echo": 1,
"Flush": 2,
"Info": 3,
"SetOption": 4,
"Exception": 5,
"AppendTx": 17,
"CheckTx": 18,
"Commit": 19,
"Query": 20,
"InitValdiators": 21,
"SyncValdiators": 22,
}
func (x MessageType) String() string {
@ -111,10 +118,11 @@ func (x CodeType) String() string {
func (CodeType) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{1} }
type Request struct {
Type MessageType `protobuf:"varint,1,opt,name=type,enum=types.MessageType" json:"type,omitempty"`
Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"`
Key string `protobuf:"bytes,3,opt,name=key" json:"key,omitempty"`
Value string `protobuf:"bytes,4,opt,name=value" json:"value,omitempty"`
Type MessageType `protobuf:"varint,1,opt,name=type,enum=types.MessageType" json:"type,omitempty"`
Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"`
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"`
}
func (m *Request) Reset() { *m = Request{} }
@ -122,12 +130,20 @@ func (m *Request) String() string { return proto.CompactTextString(m)
func (*Request) ProtoMessage() {}
func (*Request) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
func (m *Request) GetValidators() []*Validator {
if m != nil {
return m.Validators
}
return nil
}
type Response struct {
Type MessageType `protobuf:"varint,1,opt,name=type,enum=types.MessageType" json:"type,omitempty"`
Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"`
Code CodeType `protobuf:"varint,3,opt,name=code,enum=types.CodeType" json:"code,omitempty"`
Error string `protobuf:"bytes,4,opt,name=error" json:"error,omitempty"`
Log string `protobuf:"bytes,5,opt,name=log" json:"log,omitempty"`
Type MessageType `protobuf:"varint,1,opt,name=type,enum=types.MessageType" json:"type,omitempty"`
Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"`
Code CodeType `protobuf:"varint,3,opt,name=code,enum=types.CodeType" json:"code,omitempty"`
Error string `protobuf:"bytes,4,opt,name=error" json:"error,omitempty"`
Log string `protobuf:"bytes,5,opt,name=log" json:"log,omitempty"`
Validators []*Validator `protobuf:"bytes,6,rep,name=validators" json:"validators,omitempty"`
}
func (m *Response) Reset() { *m = Response{} }
@ -135,39 +151,62 @@ func (m *Response) String() string { return proto.CompactTextString(m
func (*Response) ProtoMessage() {}
func (*Response) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} }
func (m *Response) GetValidators() []*Validator {
if m != nil {
return m.Validators
}
return nil
}
type Validator struct {
PubKey []byte `protobuf:"bytes,1,opt,name=pubKey,proto3" json:"pubKey,omitempty"`
Power uint64 `protobuf:"varint,2,opt,name=power" json:"power,omitempty"`
}
func (m *Validator) Reset() { *m = Validator{} }
func (m *Validator) String() string { return proto.CompactTextString(m) }
func (*Validator) ProtoMessage() {}
func (*Validator) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} }
func init() {
proto.RegisterType((*Request)(nil), "types.Request")
proto.RegisterType((*Response)(nil), "types.Response")
proto.RegisterType((*Validator)(nil), "types.Validator")
proto.RegisterEnum("types.MessageType", MessageType_name, MessageType_value)
proto.RegisterEnum("types.CodeType", CodeType_name, CodeType_value)
}
var fileDescriptor0 = []byte{
// 406 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xa4, 0x92, 0x5f, 0x6e, 0xd3, 0x40,
0x10, 0xc6, 0x71, 0x62, 0xe7, 0xcf, 0x24, 0x4d, 0x37, 0x43, 0x90, 0xfc, 0x88, 0x8a, 0x84, 0x50,
0x1f, 0x8a, 0x54, 0x4e, 0x50, 0xa2, 0x54, 0x8a, 0x10, 0xad, 0x30, 0xed, 0x01, 0xcc,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, 0xf3, 0xe6, 0x9a, 0x37, 0x4a, 0xf4, 0xf1, 0x04, 0xc6, 0x5f,
0xc9, 0xdc, 0x36, 0xa6, 0x52, 0x2c, 0x62, 0x2f, 0x57, 0x0f, 0x92, 0x3a, 0x99, 0xe0, 0x14, 0x46,
0x57, 0x4d, 0x43, 0x5c, 0xdc, 0x3d, 0x88, 0x39, 0x4e, 0x60, 0xb8, 0x2c, 0x49, 0xee, 0x9c, 0x70,
0x83, 0xc1, 0x60, 0xa9, 0xf6, 0xfb, 0xca, 0x88, 0x97, 0xbe, 0xf2, 0x17, 0x4b, 0xed, 0x41, 0x2c,
0xce, 0xff, 0xba, 0x2d, 0x3d, 0x8e, 0x82, 0x03, 0xe8, 0xdd, 0x7e, 0x72, 0x0c, 0x73, 0x38, 0x59,
0xb3, 0xa1, 0x96, 0xf3, 0x7a, 0xe5, 0xe7, 0x70, 0x30, 0x02, 0xa6, 0xf7, 0x9c, 0x5b, 0x53, 0xaa,
0xb6, 0xfa, 0x45, 0x85, 0x63, 0x5a, 0x80, 0x58, 0xb3, 0xb6, 0x9b, 0x4d, 0x25, 0x2b, 0x62, 0x73,
0x4d, 0xa4, 0x1d, 0x1f, 0xc2, 0xec, 0x9e, 0x77, 0xac, 0x7e, 0xf2, 0xf1, 0x5f, 0x3b, 0x48, 0x57,
0x6e, 0xc5, 0x6e, 0x4b, 0x15, 0x6f, 0xbb, 0x72, 0x01, 0xf4, 0x63, 0x5e, 0xdc, 0x28, 0x96, 0x24,
0x06, 0x4f, 0x92, 0xae, 0xa4, 0x54, 0x96, 0x8d, 0x18, 0xe2, 0x2b, 0x98, 0xff, 0x57, 0xde, 0x72,
0xa1, 0xc5, 0xe8, 0xdb, 0x20, 0x3c, 0xa9, 0x0f, 0xff, 0x02, 0x00, 0x00, 0xff, 0xff, 0x41, 0x3b,
0x4f, 0x97, 0x67, 0x02, 0x00, 0x00,
// 486 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 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xeb, 0xfa, 0x92, 0xb4, 0x8e, 0x60, 0x6f, 0x2e, 0x34,
0x56, 0x22, 0x29, 0x66, 0xf6, 0xb8, 0x24, 0x9a, 0xc1, 0xe0, 0x4e, 0x24, 0x46, 0xaf, 0x64, 0x95,
0x7f, 0xc3, 0x8c, 0xb4, 0x8f, 0x81, 0xcd, 0x85, 0x32, 0x8b, 0x45, 0x9e, 0xe6, 0x28, 0xf4, 0x05,
0xa2, 0x22, 0x1f, 0xb4, 0xe3, 0x4e, 0xac, 0x85, 0x7c, 0x14, 0xcd, 0x5f, 0x96, 0xcc, 0xd0, 0xb8,
0x99, 0xa0, 0xa7, 0xcb, 0xc5, 0xb2, 0x1e, 0xe7, 0x0c, 0x7d, 0x48, 0xb2, 0x2b, 0x29, 0x52, 0x64,
0xe1, 0x4e, 0xd3, 0x79, 0x9a, 0x4a, 0x23, 0x34, 0xeb, 0xf0, 0x03, 0x18, 0xfd, 0x35, 0xde, 0x88,
0x4c, 0xb1, 0xee, 0x7d, 0xe8, 0x3e, 0x8d, 0x77, 0xbf, 0x03, 0x00, 0x00, 0xff, 0xff, 0xa5, 0x71,
0x5f, 0x3f, 0x2f, 0x03, 0x00, 0x00,
}

View File

@ -9,15 +9,17 @@ package types;
enum MessageType {
NullMessage = 0x00;
Echo = 0x01;
Flush = 0x02;
Info = 0x03;
SetOption = 0x04;
Exception = 0x05;
AppendTx = 0x11;
CheckTx = 0x12;
Commit = 0x13;
Query = 0x14;
Echo = 0x01;
Flush = 0x02;
Info = 0x03;
SetOption = 0x04;
Exception = 0x05;
AppendTx = 0x11;
CheckTx = 0x12;
Commit = 0x13;
Query = 0x14;
InitValdiators = 0x15;
SyncValdiators = 0x16;
}
//----------------------------------------
@ -43,6 +45,7 @@ message Request {
bytes data = 2;
string key = 3;
string value = 4;
repeated Validator validators = 5;
}
//----------------------------------------
@ -54,5 +57,13 @@ message Response {
CodeType code = 3;
string error = 4;
string log = 5;
repeated Validator validators = 6;
}
//----------------------------------------
// Misc types
message Validator {
bytes pubKey = 1;
uint64 power = 2;
}