@ -4,16 +4,11 @@
package types
package types
import (
import (
bytes "bytes"
fmt "fmt"
fmt "fmt"
_ "github.com/gogo/protobuf/gogoproto"
_ "github.com/gogo/protobuf/gogoproto"
proto "github.com/gogo/protobuf/proto"
proto "github.com/gogo/protobuf/proto"
keys "github.com/tendermint/tendermint/proto/crypto/keys"
keys "github.com/tendermint/tendermint/proto/crypto/keys"
io "io"
math "math"
math "math"
math_bits "math/bits"
reflect "reflect"
strings "strings"
)
)
// Reference imports to suppress errors if they are not otherwise used.
// Reference imports to suppress errors if they are not otherwise used.
@ -28,36 +23,31 @@ var _ = math.Inf
const _ = proto . GoGoProtoPackageIsVersion3 // please upgrade the proto package
const _ = proto . GoGoProtoPackageIsVersion3 // please upgrade the proto package
type ValidatorSet struct {
type ValidatorSet struct {
Validators [ ] * Validator ` protobuf:"bytes,1,rep,name=validators,proto3" json:"validators,omitempty" `
Proposer * Validator ` protobuf:"bytes,2,opt,name=proposer,proto3" json:"proposer,omitempty" `
TotalVotingPower int64 ` protobuf:"varint,3,opt,name=total_voting_power,json=totalVotingPower,proto3" json:"total_voting_power,omitempty" `
Validators [ ] * Validator ` protobuf:"bytes,1,rep,name=validators,proto3" json:"validators,omitempty" `
Proposer * Validator ` protobuf:"bytes,2,opt,name=proposer,proto3" json:"proposer,omitempty" `
TotalVotingPower int64 ` protobuf:"varint,3,opt,name=total_voting_power,json=totalVotingPower,proto3" json:"total_voting_power,omitempty" `
XXX_NoUnkeyedLiteral struct { } ` json:"-" `
XXX_unrecognized [ ] byte ` json:"-" `
XXX_sizecache int32 ` json:"-" `
}
}
func ( m * ValidatorSet ) Reset ( ) { * m = ValidatorSet { } }
func ( * ValidatorSet ) ProtoMessage ( ) { }
func ( m * ValidatorSet ) Reset ( ) { * m = ValidatorSet { } }
func ( m * ValidatorSet ) String ( ) string { return proto . CompactTextString ( m ) }
func ( * ValidatorSet ) ProtoMessage ( ) { }
func ( * ValidatorSet ) Descriptor ( ) ( [ ] byte , [ ] int ) {
func ( * ValidatorSet ) Descriptor ( ) ( [ ] byte , [ ] int ) {
return fileDescriptor_2e7c6b38c20e5406 , [ ] int { 0 }
return fileDescriptor_2e7c6b38c20e5406 , [ ] int { 0 }
}
}
func ( m * ValidatorSet ) XXX_Unmarshal ( b [ ] byte ) error {
func ( m * ValidatorSet ) XXX_Unmarshal ( b [ ] byte ) error {
return m . Unmarshal ( b )
return xxx_ messageInfo_ValidatorSet . Unmarshal ( m , b )
}
}
func ( m * ValidatorSet ) XXX_Marshal ( b [ ] byte , deterministic bool ) ( [ ] byte , error ) {
func ( m * ValidatorSet ) XXX_Marshal ( b [ ] byte , deterministic bool ) ( [ ] byte , error ) {
if deterministic {
return xxx_messageInfo_ValidatorSet . Marshal ( b , m , deterministic )
} else {
b = b [ : cap ( b ) ]
n , err := m . MarshalToSizedBuffer ( b )
if err != nil {
return nil , err
}
return b [ : n ] , nil
}
return xxx_messageInfo_ValidatorSet . Marshal ( b , m , deterministic )
}
}
func ( m * ValidatorSet ) XXX_Merge ( src proto . Message ) {
func ( m * ValidatorSet ) XXX_Merge ( src proto . Message ) {
xxx_messageInfo_ValidatorSet . Merge ( m , src )
xxx_messageInfo_ValidatorSet . Merge ( m , src )
}
}
func ( m * ValidatorSet ) XXX_Size ( ) int {
func ( m * ValidatorSet ) XXX_Size ( ) int {
return m . Size ( )
return xxx_messageInfo_ValidatorSet . Size ( m )
}
}
func ( m * ValidatorSet ) XXX_DiscardUnknown ( ) {
func ( m * ValidatorSet ) XXX_DiscardUnknown ( ) {
xxx_messageInfo_ValidatorSet . DiscardUnknown ( m )
xxx_messageInfo_ValidatorSet . DiscardUnknown ( m )
@ -87,37 +77,32 @@ func (m *ValidatorSet) GetTotalVotingPower() int64 {
}
}
type Validator struct {
type Validator struct {
Address [ ] byte ` protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty" `
PubKey keys . PublicKey ` protobuf:"bytes,2,opt,name=pub_key,json=pubKey,proto3" json:"pub_key" `
VotingPower int64 ` protobuf:"varint,3,opt,name=voting_power,json=votingPower,proto3" json:"voting_power,omitempty" `
ProposerPriority int64 ` protobuf:"varint,4,opt,name=proposer_priority,json=proposerPriority,proto3" json:"proposer_priority,omitempty" `
}
func ( m * Validator ) Reset ( ) { * m = Validator { } }
func ( * Validator ) ProtoMessage ( ) { }
Address [ ] byte ` protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty" `
PubKey keys . PublicKey ` protobuf:"bytes,2,opt,name=pub_key,json=pubKey,proto3" json:"pub_key" `
VotingPower int64 ` protobuf:"varint,3,opt,name=voting_power,json=votingPower,proto3" json:"voting_power,omitempty" `
ProposerPriority int64 ` protobuf:"varint,4,opt,name=proposer_priority,json=proposerPriority,proto3" json:"proposer_priority,omitempty" `
XXX_NoUnkeyedLiteral struct { } ` json:"-" `
XXX_unrecognized [ ] byte ` json:"-" `
XXX_sizecache int32 ` json:"-" `
}
func ( m * Validator ) Reset ( ) { * m = Validator { } }
func ( m * Validator ) String ( ) string { return proto . CompactTextString ( m ) }
func ( * Validator ) ProtoMessage ( ) { }
func ( * Validator ) Descriptor ( ) ( [ ] byte , [ ] int ) {
func ( * Validator ) Descriptor ( ) ( [ ] byte , [ ] int ) {
return fileDescriptor_2e7c6b38c20e5406 , [ ] int { 1 }
return fileDescriptor_2e7c6b38c20e5406 , [ ] int { 1 }
}
}
func ( m * Validator ) XXX_Unmarshal ( b [ ] byte ) error {
func ( m * Validator ) XXX_Unmarshal ( b [ ] byte ) error {
return m . Unmarshal ( b )
return xxx_ messageInfo_Validator . Unmarshal ( m , b )
}
}
func ( m * Validator ) XXX_Marshal ( b [ ] byte , deterministic bool ) ( [ ] byte , error ) {
func ( m * Validator ) XXX_Marshal ( b [ ] byte , deterministic bool ) ( [ ] byte , error ) {
if deterministic {
return xxx_messageInfo_Validator . Marshal ( b , m , deterministic )
} else {
b = b [ : cap ( b ) ]
n , err := m . MarshalToSizedBuffer ( b )
if err != nil {
return nil , err
}
return b [ : n ] , nil
}
return xxx_messageInfo_Validator . Marshal ( b , m , deterministic )
}
}
func ( m * Validator ) XXX_Merge ( src proto . Message ) {
func ( m * Validator ) XXX_Merge ( src proto . Message ) {
xxx_messageInfo_Validator . Merge ( m , src )
xxx_messageInfo_Validator . Merge ( m , src )
}
}
func ( m * Validator ) XXX_Size ( ) int {
func ( m * Validator ) XXX_Size ( ) int {
return m . Size ( )
return xxx_messageInfo_Validator . Size ( m )
}
}
func ( m * Validator ) XXX_DiscardUnknown ( ) {
func ( m * Validator ) XXX_DiscardUnknown ( ) {
xxx_messageInfo_Validator . DiscardUnknown ( m )
xxx_messageInfo_Validator . DiscardUnknown ( m )
@ -161,721 +146,26 @@ func init() {
func init ( ) { proto . RegisterFile ( "proto/types/validator.proto" , fileDescriptor_2e7c6b38c20e5406 ) }
func init ( ) { proto . RegisterFile ( "proto/types/validator.proto" , fileDescriptor_2e7c6b38c20e5406 ) }
var fileDescriptor_2e7c6b38c20e5406 = [ ] byte {
var fileDescriptor_2e7c6b38c20e5406 = [ ] byte {
// 383 bytes of a gzipped FileDescriptorProto
0x1f , 0x8b , 0x08 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x02 , 0xff , 0x8c , 0x92 , 0xbd , 0x6e , 0xea , 0x30 ,
0x14 , 0xc7 , 0xe3 , 0x0b , 0x82 , 0x7b , 0x0d , 0xc3 , 0xbd , 0x1e , 0xae , 0x22 , 0xaa , 0xba , 0xc0 , 0xd0 ,
0x22 , 0x15 , 0x25 , 0x52 , 0x3b , 0x77 , 0x28 , 0x43 , 0x17 , 0x16 , 0x94 , 0x4a , 0x0c , 0x5d , 0xa2 , 0x84 ,
0x58 , 0xc1 , 0xe2 , 0xc3 , 0x96 , 0xe3 , 0x50 , 0x79 , 0xeb , 0x23 , 0xf4 , 0x31 , 0xfa , 0x12 , 0xed , 0xcc ,
0xc8 , 0xc8 , 0x54 , 0x95 , 0xb0 , 0x74 , 0xe4 , 0x11 , 0x2a , 0x62 , 0x12 , 0x90 , 0xca , 0xd0 , 0xcd , 0xe7 ,
0xff , 0x3f , 0x1f , 0xbf , 0x73 , 0x64 , 0x78 , 0xc2 , 0x05 , 0x93 , 0xcc , 0x96 , 0x8a , 0x93 , 0xc8 , 0x9e ,
0x79 , 0x63 , 0x1a , 0x78 , 0x92 , 0x09 , 0x2b , 0x55 , 0xd1 , 0x7f , 0x49 , 0xa6 , 0x01 , 0x11 , 0x13 , 0x3a ,
0x95 , 0x5a , 0xb1 , 0xd2 , 0xbc , 0xda , 0xb9 , 0x1c , 0x52 , 0x11 , 0xb8 , 0xdc , 0x13 , 0x52 , 0xd9 , 0xba ,
0x41 , 0xc8 , 0x42 , 0xb6 , 0x7f , 0xe9 , 0xec , 0xda , 0xa9 , 0x56 , 0x06 , 0x42 , 0x71 , 0xc9 , 0xec , 0x11 ,
0x51 , 0x91 , 0x1e , 0xa4 , 0xed , 0xe6 , 0x1b , 0x80 , 0xd5 , 0x7e , 0x36 , 0xf2 , 0x9e , 0x48 , 0x74 , 0x0b ,
0x61 , 0x8e , 0x10 , 0x99 , 0xa0 , 0x5e , 0x68 , 0x55 , 0xae , 0x1a , 0xd6 , 0x71 , 0x08 , 0x2b , 0xaf , 0x74 ,
0x0e , 0x8a , 0xd0 , 0x0d , 0xfc , 0xcd , 0x05 , 0xe3 , 0x2c , 0x22 , 0xc2 , 0xfc , 0x55 , 0x07 , 0x3f , 0x6b ,
0x90 , 0x97 , 0xa0 , 0x36 , 0x44 , 0x92 , 0x49 , 0x6f , 0xec , 0xce , 0x98 , 0xa4 , 0xd3 , 0xd0 , 0xe5 , 0xec ,
0x91 , 0x08 , 0xb3 , 0x50 , 0x07 , 0xad , 0x82 , 0xf3 , 0x37 , 0x75 , 0xfa , 0xa9 , 0xd1 , 0xdb , 0xea , 0xcd ,
0x57 , 0x00 , 0xff , 0xe4 , 0x5d , 0x90 , 0x09 , 0xcb , 0x5e , 0x10 , 0x08 , 0x12 , 0x6d , 0xd1 , 0x41 , 0xab ,
0xea , 0x64 , 0x21 , 0xba , 0x83 , 0x65 , 0x1e , 0xfb , 0xee , 0x88 , 0xa8 , 0x1d , 0xd3 , 0xc5 , 0x77 , 0x26 ,
0x7d , 0x24 , 0x6b , 0x7b , 0x24 , 0xab , 0x17 , 0xfb , 0x63 , 0x3a , 0xe8 , 0x12 , 0xd5 , 0x29 , 0xce , 0xdf ,
0xcf , 0x0c , 0xa7 , 0xc4 , 0x63 , 0xbf , 0x4b , 0x14 , 0x6a , 0xc0 , 0xea , 0x11 , 0xae , 0xca , 0x6c , 0x8f ,
0x84 , 0x2e , 0xe1 , 0xbf , 0x6c , 0x19 , 0x97 , 0x0b , 0xca , 0x04 , 0x95 , 0xca , 0x2c , 0x6a , 0xfe , 0xcc ,
0xe8 , 0xed , 0xf4 , 0x8e , 0xbf , 0x58 , 0x61 , 0x63 , 0xb9 , 0xc2 , 0xc6 , 0x66 , 0x85 , 0xc1 , 0x53 , 0x82 ,
0xc1 , 0x4b , 0x82 , 0xc1 , 0x3c , 0xc1 , 0x60 , 0x91 , 0x60 , 0xf0 , 0x91 , 0x60 , 0xf0 , 0x99 , 0x60 , 0x63 ,
0x93 , 0x60 , 0xf0 , 0xbc , 0xc6 , 0xc6 , 0x62 , 0x8d , 0x8d , 0xe5 , 0x1a , 0x1b , 0x0f , 0xed , 0x90 , 0xca ,
0x61 , 0xec , 0x5b , 0x03 , 0x36 , 0xb1 , 0xf7 , 0x6b , 0x1c , 0x3e , 0x0f , 0xfe , 0x94 , 0x5f , 0x4a , 0x83 ,
0xeb , 0xaf , 0x00 , 0x00 , 0x00 , 0xff , 0xff , 0xdc , 0x2c , 0xc6 , 0xff , 0x69 , 0x02 , 0x00 , 0x00 ,
}
func ( this * ValidatorSet ) Equal ( that interface { } ) bool {
if that == nil {
return this == nil
}
that1 , ok := that . ( * ValidatorSet )
if ! ok {
that2 , ok := that . ( ValidatorSet )
if ok {
that1 = & that2
} else {
return false
}
}
if that1 == nil {
return this == nil
} else if this == nil {
return false
}
if len ( this . Validators ) != len ( that1 . Validators ) {
return false
}
for i := range this . Validators {
if ! this . Validators [ i ] . Equal ( that1 . Validators [ i ] ) {
return false
}
}
if ! this . Proposer . Equal ( that1 . Proposer ) {
return false
}
if this . TotalVotingPower != that1 . TotalVotingPower {
return false
}
return true
}
func ( this * Validator ) Equal ( that interface { } ) bool {
if that == nil {
return this == nil
}
that1 , ok := that . ( * Validator )
if ! ok {
that2 , ok := that . ( Validator )
if ok {
that1 = & that2
} else {
return false
}
}
if that1 == nil {
return this == nil
} else if this == nil {
return false
}
if ! bytes . Equal ( this . Address , that1 . Address ) {
return false
}
if ! this . PubKey . Equal ( & that1 . PubKey ) {
return false
}
if this . VotingPower != that1 . VotingPower {
return false
}
if this . ProposerPriority != that1 . ProposerPriority {
return false
}
return true
}
func ( this * ValidatorSet ) GoString ( ) string {
if this == nil {
return "nil"
}
s := make ( [ ] string , 0 , 7 )
s = append ( s , "&types.ValidatorSet{" )
if this . Validators != nil {
s = append ( s , "Validators: " + fmt . Sprintf ( "%#v" , this . Validators ) + ",\n" )
}
if this . Proposer != nil {
s = append ( s , "Proposer: " + fmt . Sprintf ( "%#v" , this . Proposer ) + ",\n" )
}
s = append ( s , "TotalVotingPower: " + fmt . Sprintf ( "%#v" , this . TotalVotingPower ) + ",\n" )
s = append ( s , "}" )
return strings . Join ( s , "" )
}
func ( this * Validator ) GoString ( ) string {
if this == nil {
return "nil"
}
s := make ( [ ] string , 0 , 8 )
s = append ( s , "&types.Validator{" )
s = append ( s , "Address: " + fmt . Sprintf ( "%#v" , this . Address ) + ",\n" )
s = append ( s , "PubKey: " + strings . Replace ( this . PubKey . GoString ( ) , ` & ` , ` ` , 1 ) + ",\n" )
s = append ( s , "VotingPower: " + fmt . Sprintf ( "%#v" , this . VotingPower ) + ",\n" )
s = append ( s , "ProposerPriority: " + fmt . Sprintf ( "%#v" , this . ProposerPriority ) + ",\n" )
s = append ( s , "}" )
return strings . Join ( s , "" )
}
func valueToGoStringValidator ( v interface { } , typ string ) string {
rv := reflect . ValueOf ( v )
if rv . IsNil ( ) {
return "nil"
}
pv := reflect . Indirect ( rv ) . Interface ( )
return fmt . Sprintf ( "func(v %v) *%v { return &v } ( %#v )" , typ , typ , pv )
}
func ( m * ValidatorSet ) 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 * ValidatorSet ) MarshalTo ( dAtA [ ] byte ) ( int , error ) {
size := m . Size ( )
return m . MarshalToSizedBuffer ( dAtA [ : size ] )
}
func ( m * ValidatorSet ) MarshalToSizedBuffer ( dAtA [ ] byte ) ( int , error ) {
i := len ( dAtA )
_ = i
var l int
_ = l
if m . TotalVotingPower != 0 {
i = encodeVarintValidator ( dAtA , i , uint64 ( m . TotalVotingPower ) )
i --
dAtA [ i ] = 0x18
}
if m . Proposer != nil {
{
size , err := m . Proposer . MarshalToSizedBuffer ( dAtA [ : i ] )
if err != nil {
return 0 , err
}
i -= size
i = encodeVarintValidator ( dAtA , i , uint64 ( size ) )
}
i --
dAtA [ i ] = 0x12
}
if len ( m . Validators ) > 0 {
for iNdEx := len ( m . Validators ) - 1 ; iNdEx >= 0 ; iNdEx -- {
{
size , err := m . Validators [ iNdEx ] . MarshalToSizedBuffer ( dAtA [ : i ] )
if err != nil {
return 0 , err
}
i -= size
i = encodeVarintValidator ( dAtA , i , uint64 ( size ) )
}
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 ] )
// 325 bytes of a gzipped FileDescriptorProto
0x1f , 0x8b , 0x08 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x02 , 0xff , 0x8c , 0x92 , 0xbd , 0x4e , 0x02 , 0x41 ,
0x10 , 0xc7 , 0x5d , 0x21 , 0xa0 , 0x0b , 0x85 , 0x6e , 0x61 , 0x2e , 0x18 , 0x23 , 0x50 , 0x28 , 0x89 , 0x64 ,
0x2f , 0xd1 , 0xda , 0x42 , 0x0a , 0x1b , 0x1a , 0x72 , 0x26 , 0x14 , 0x36 , 0x97 , 0x3b , 0x6e , 0x73 , 0x6c ,
0xf8 , 0x98 , 0xcd , 0xdc , 0x1c , 0x66 , 0x1f , 0x4e , 0x6b , 0x9f , 0xc2 , 0x67 , 0x31 , 0xdc , 0x72 , 0x07 ,
0x89 , 0x14 , 0x76 , 0x33 , 0xff , 0xff , 0x7c , 0xfc , 0x76 , 0xb2 , 0xfc , 0xda , 0x20 , 0x10 , 0xf8 , 0x64 ,
0x8d , 0xca , 0xfc , 0x4d , 0xb4 , 0xd4 , 0x49 , 0x44 , 0x80 , 0xb2 , 0x50 , 0xc5 , 0x15 , 0xa9 , 0x75 , 0xa2 ,
0x70 , 0xa5 , 0xd7 , 0xe4 , 0x14 , 0x59 , 0xd4 , 0x75 , 0xee , 0x68 , 0xae , 0x31 , 0x09 , 0x4d , 0x84 , 0x64 ,
0x7d , 0x37 , 0x20 , 0x85 , 0x14 , 0xf6 , 0x91 , 0xab , 0xee , 0xdc , 0x38 , 0x65 , 0x86 , 0xd6 , 0x10 , 0xf8 ,
0x0b , 0x65 , 0x33 , 0xb7 , 0xc8 , 0xd9 , 0xfd , 0x2f , 0xc6 , 0xdb , 0xd3 , 0x72 , 0xe5 , 0x9b , 0x22 , 0xf1 ,
0xc2 , 0x79 , 0x85 , 0x90 , 0x79 , 0xac , 0x5b , 0x1b , 0xb4 , 0x1e , 0x7b , 0xf2 , 0x38 , 0x84 , 0xac , 0x3a ,
0x83 , 0x83 , 0x26 , 0xf1 , 0xcc , 0xcf , 0x0c , 0x82 , 0x81 , 0x4c , 0xa1 , 0x77 , 0xda , 0x65 , 0xff , 0x1b ,
0x50 , 0xb5 , 0x88 , 0x21 , 0x17 , 0x04 , 0x14 , 0x2d , 0xc3 , 0x0d , 0x90 , 0x5e , 0xa7 , 0xa1 , 0x81 , 0x0f ,
0x85 , 0x5e , 0xad , 0xcb , 0x06 , 0xb5 , 0xe0 , 0xa2 , 0x70 , 0xa6 , 0x85 , 0x31 , 0xd9 , 0xea , 0xfd , 0x4f ,
0xc6 , 0xcf , 0xab , 0x29 , 0xc2 , 0xe3 , 0xcd , 0x28 , 0x49 , 0x50 , 0x65 , 0x5b , 0x74 , 0x36 , 0x68 , 0x07 ,
0x65 , 0x2a , 0x5e , 0x79 , 0xd3 , 0xe4 , 0x71 , 0xb8 , 0x50 , 0x76 , 0xc7 , 0x74 , 0xff , 0x97 , 0xc9 , 0x1d ,
0x49 , 0x6e , 0x8f , 0x24 , 0x27 , 0x79 , 0xbc , 0xd4 , 0xb3 , 0xb1 , 0xb2 , 0xa3 , 0xfa , 0xf7 , 0xcf , 0xed ,
0x49 , 0xd0 , 0x30 , 0x79 , 0x3c , 0x56 , 0x56 , 0xf4 , 0x78 , 0xfb , 0x08 , 0x57 , 0x6b , 0xb3 , 0x47 , 0x12 ,
0x0f , 0xfc , 0xb2 , 0x7c , 0x4c , 0x68 , 0x50 , 0x03 , 0x6a , 0xb2 , 0x5e , 0xdd , 0xf1 , 0x97 , 0xc6 , 0x64 ,
0xa7 , 0x8f , 0xe4 , 0xfb , 0x30 , 0xd5 , 0x34 , 0xcf , 0x63 , 0x39 , 0x83 , 0x95 , 0xbf , 0x47 , 0x3a , 0x0c ,
0x0f , 0xfe , 0x47 , 0xdc , 0x28 , 0x92 , 0xa7 , 0xdf , 0x00 , 0x00 , 0x00 , 0xff , 0xff , 0xd9 , 0x28 , 0xeb ,
0x40 , 0x35 , 0x02 , 0x00 , 0x00 ,
}
}
func ( m * Validator ) MarshalToSizedBuffer ( dAtA [ ] byte ) ( int , error ) {
i := len ( dAtA )
_ = i
var l int
_ = l
if m . ProposerPriority != 0 {
i = encodeVarintValidator ( dAtA , i , uint64 ( m . ProposerPriority ) )
i --
dAtA [ i ] = 0x20
}
if m . VotingPower != 0 {
i = encodeVarintValidator ( dAtA , i , uint64 ( m . VotingPower ) )
i --
dAtA [ i ] = 0x18
}
{
size , err := m . PubKey . MarshalToSizedBuffer ( dAtA [ : i ] )
if err != nil {
return 0 , err
}
i -= size
i = encodeVarintValidator ( dAtA , i , uint64 ( size ) )
}
i --
dAtA [ i ] = 0x12
if len ( m . Address ) > 0 {
i -= len ( m . Address )
copy ( dAtA [ i : ] , m . Address )
i = encodeVarintValidator ( dAtA , i , uint64 ( len ( m . Address ) ) )
i --
dAtA [ i ] = 0xa
}
return len ( dAtA ) - i , nil
}
func encodeVarintValidator ( dAtA [ ] byte , offset int , v uint64 ) int {
offset -= sovValidator ( v )
base := offset
for v >= 1 << 7 {
dAtA [ offset ] = uint8 ( v & 0x7f | 0x80 )
v >>= 7
offset ++
}
dAtA [ offset ] = uint8 ( v )
return base
}
func ( m * ValidatorSet ) Size ( ) ( n int ) {
if m == nil {
return 0
}
var l int
_ = l
if len ( m . Validators ) > 0 {
for _ , e := range m . Validators {
l = e . Size ( )
n += 1 + l + sovValidator ( uint64 ( l ) )
}
}
if m . Proposer != nil {
l = m . Proposer . Size ( )
n += 1 + l + sovValidator ( uint64 ( l ) )
}
if m . TotalVotingPower != 0 {
n += 1 + sovValidator ( uint64 ( m . TotalVotingPower ) )
}
return n
}
func ( m * Validator ) Size ( ) ( n int ) {
if m == nil {
return 0
}
var l int
_ = l
l = len ( m . Address )
if l > 0 {
n += 1 + l + sovValidator ( uint64 ( l ) )
}
l = m . PubKey . Size ( )
n += 1 + l + sovValidator ( uint64 ( l ) )
if m . VotingPower != 0 {
n += 1 + sovValidator ( uint64 ( m . VotingPower ) )
}
if m . ProposerPriority != 0 {
n += 1 + sovValidator ( uint64 ( m . ProposerPriority ) )
}
return n
}
func sovValidator ( x uint64 ) ( n int ) {
return ( math_bits . Len64 ( x | 1 ) + 6 ) / 7
}
func sozValidator ( x uint64 ) ( n int ) {
return sovValidator ( uint64 ( ( x << 1 ) ^ uint64 ( ( int64 ( x ) >> 63 ) ) ) )
}
func ( this * ValidatorSet ) String ( ) string {
if this == nil {
return "nil"
}
repeatedStringForValidators := "[]*Validator{"
for _ , f := range this . Validators {
repeatedStringForValidators += strings . Replace ( f . String ( ) , "Validator" , "Validator" , 1 ) + ","
}
repeatedStringForValidators += "}"
s := strings . Join ( [ ] string { ` &ValidatorSet { ` ,
` Validators: ` + repeatedStringForValidators + ` , ` ,
` Proposer: ` + strings . Replace ( this . Proposer . String ( ) , "Validator" , "Validator" , 1 ) + ` , ` ,
` TotalVotingPower: ` + fmt . Sprintf ( "%v" , this . TotalVotingPower ) + ` , ` ,
` } ` ,
} , "" )
return s
}
func ( this * Validator ) String ( ) string {
if this == nil {
return "nil"
}
s := strings . Join ( [ ] string { ` &Validator { ` ,
` Address: ` + fmt . Sprintf ( "%v" , this . Address ) + ` , ` ,
` PubKey: ` + strings . Replace ( strings . Replace ( fmt . Sprintf ( "%v" , this . PubKey ) , "PublicKey" , "keys.PublicKey" , 1 ) , ` & ` , ` ` , 1 ) + ` , ` ,
` VotingPower: ` + fmt . Sprintf ( "%v" , this . VotingPower ) + ` , ` ,
` ProposerPriority: ` + fmt . Sprintf ( "%v" , this . ProposerPriority ) + ` , ` ,
` } ` ,
} , "" )
return s
}
func valueToStringValidator ( v interface { } ) string {
rv := reflect . ValueOf ( v )
if rv . IsNil ( ) {
return "nil"
}
pv := reflect . Indirect ( rv ) . Interface ( )
return fmt . Sprintf ( "*%v" , pv )
}
func ( m * ValidatorSet ) 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 ErrIntOverflowValidator
}
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: ValidatorSet: wiretype end group for non-group" )
}
if fieldNum <= 0 {
return fmt . Errorf ( "proto: ValidatorSet: illegal tag %d (wire type %d)" , fieldNum , wire )
}
switch fieldNum {
case 1 :
if wireType != 2 {
return fmt . Errorf ( "proto: wrong wireType = %d for field Validators" , wireType )
}
var msglen int
for shift := uint ( 0 ) ; ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowValidator
}
if iNdEx >= l {
return io . ErrUnexpectedEOF
}
b := dAtA [ iNdEx ]
iNdEx ++
msglen |= int ( b & 0x7F ) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthValidator
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthValidator
}
if postIndex > l {
return io . ErrUnexpectedEOF
}
m . Validators = append ( m . Validators , & Validator { } )
if err := m . Validators [ len ( m . Validators ) - 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 Proposer" , wireType )
}
var msglen int
for shift := uint ( 0 ) ; ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowValidator
}
if iNdEx >= l {
return io . ErrUnexpectedEOF
}
b := dAtA [ iNdEx ]
iNdEx ++
msglen |= int ( b & 0x7F ) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthValidator
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthValidator
}
if postIndex > l {
return io . ErrUnexpectedEOF
}
if m . Proposer == nil {
m . Proposer = & Validator { }
}
if err := m . Proposer . Unmarshal ( dAtA [ iNdEx : postIndex ] ) ; err != nil {
return err
}
iNdEx = postIndex
case 3 :
if wireType != 0 {
return fmt . Errorf ( "proto: wrong wireType = %d for field TotalVotingPower" , wireType )
}
m . TotalVotingPower = 0
for shift := uint ( 0 ) ; ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowValidator
}
if iNdEx >= l {
return io . ErrUnexpectedEOF
}
b := dAtA [ iNdEx ]
iNdEx ++
m . TotalVotingPower |= int64 ( b & 0x7F ) << shift
if b < 0x80 {
break
}
}
default :
iNdEx = preIndex
skippy , err := skipValidator ( dAtA [ iNdEx : ] )
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthValidator
}
if ( iNdEx + skippy ) < 0 {
return ErrInvalidLengthValidator
}
if ( iNdEx + skippy ) > l {
return io . ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io . ErrUnexpectedEOF
}
return nil
}
func ( m * Validator ) 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 ErrIntOverflowValidator
}
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: Validator: wiretype end group for non-group" )
}
if fieldNum <= 0 {
return fmt . Errorf ( "proto: Validator: illegal tag %d (wire type %d)" , fieldNum , wire )
}
switch fieldNum {
case 1 :
if wireType != 2 {
return fmt . Errorf ( "proto: wrong wireType = %d for field Address" , wireType )
}
var byteLen int
for shift := uint ( 0 ) ; ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowValidator
}
if iNdEx >= l {
return io . ErrUnexpectedEOF
}
b := dAtA [ iNdEx ]
iNdEx ++
byteLen |= int ( b & 0x7F ) << shift
if b < 0x80 {
break
}
}
if byteLen < 0 {
return ErrInvalidLengthValidator
}
postIndex := iNdEx + byteLen
if postIndex < 0 {
return ErrInvalidLengthValidator
}
if postIndex > l {
return io . ErrUnexpectedEOF
}
m . Address = append ( m . Address [ : 0 ] , dAtA [ iNdEx : postIndex ] ... )
if m . Address == nil {
m . Address = [ ] byte { }
}
iNdEx = postIndex
case 2 :
if wireType != 2 {
return fmt . Errorf ( "proto: wrong wireType = %d for field PubKey" , wireType )
}
var msglen int
for shift := uint ( 0 ) ; ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowValidator
}
if iNdEx >= l {
return io . ErrUnexpectedEOF
}
b := dAtA [ iNdEx ]
iNdEx ++
msglen |= int ( b & 0x7F ) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthValidator
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthValidator
}
if postIndex > l {
return io . ErrUnexpectedEOF
}
if err := m . PubKey . Unmarshal ( dAtA [ iNdEx : postIndex ] ) ; err != nil {
return err
}
iNdEx = postIndex
case 3 :
if wireType != 0 {
return fmt . Errorf ( "proto: wrong wireType = %d for field VotingPower" , wireType )
}
m . VotingPower = 0
for shift := uint ( 0 ) ; ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowValidator
}
if iNdEx >= l {
return io . ErrUnexpectedEOF
}
b := dAtA [ iNdEx ]
iNdEx ++
m . VotingPower |= int64 ( b & 0x7F ) << shift
if b < 0x80 {
break
}
}
case 4 :
if wireType != 0 {
return fmt . Errorf ( "proto: wrong wireType = %d for field ProposerPriority" , wireType )
}
m . ProposerPriority = 0
for shift := uint ( 0 ) ; ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowValidator
}
if iNdEx >= l {
return io . ErrUnexpectedEOF
}
b := dAtA [ iNdEx ]
iNdEx ++
m . ProposerPriority |= int64 ( b & 0x7F ) << shift
if b < 0x80 {
break
}
}
default :
iNdEx = preIndex
skippy , err := skipValidator ( dAtA [ iNdEx : ] )
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthValidator
}
if ( iNdEx + skippy ) < 0 {
return ErrInvalidLengthValidator
}
if ( iNdEx + skippy ) > l {
return io . ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io . ErrUnexpectedEOF
}
return nil
}
func skipValidator ( 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 , ErrIntOverflowValidator
}
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 , ErrIntOverflowValidator
}
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 , ErrIntOverflowValidator
}
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 , ErrInvalidLengthValidator
}
iNdEx += length
case 3 :
depth ++
case 4 :
if depth == 0 {
return 0 , ErrUnexpectedEndOfGroupValidator
}
depth --
case 5 :
iNdEx += 4
default :
return 0 , fmt . Errorf ( "proto: illegal wireType %d" , wireType )
}
if iNdEx < 0 {
return 0 , ErrInvalidLengthValidator
}
if depth == 0 {
return iNdEx , nil
}
}
return 0 , io . ErrUnexpectedEOF
}
var (
ErrInvalidLengthValidator = fmt . Errorf ( "proto: negative length found during unmarshaling" )
ErrIntOverflowValidator = fmt . Errorf ( "proto: integer overflow" )
ErrUnexpectedEndOfGroupValidator = fmt . Errorf ( "proto: unexpected end of group" )
)