|
@ -0,0 +1,792 @@ |
|
|
|
|
|
// Code generated by protoc-gen-gogo. DO NOT EDIT.
|
|
|
|
|
|
// source: crypto/merkle/merkle.proto
|
|
|
|
|
|
|
|
|
|
|
|
package merkle |
|
|
|
|
|
|
|
|
|
|
|
import proto "github.com/gogo/protobuf/proto" |
|
|
|
|
|
import fmt "fmt" |
|
|
|
|
|
import math "math" |
|
|
|
|
|
import _ "github.com/gogo/protobuf/gogoproto" |
|
|
|
|
|
|
|
|
|
|
|
import bytes "bytes" |
|
|
|
|
|
|
|
|
|
|
|
import io "io" |
|
|
|
|
|
|
|
|
|
|
|
// 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.GoGoProtoPackageIsVersion2 // please upgrade the proto package
|
|
|
|
|
|
|
|
|
|
|
|
// ProofOp defines an operation used for calculating Merkle root
|
|
|
|
|
|
// The data could be arbitrary format, providing nessecary data
|
|
|
|
|
|
// for example neighbouring node hash
|
|
|
|
|
|
type ProofOp struct { |
|
|
|
|
|
Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` |
|
|
|
|
|
Key []byte `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` |
|
|
|
|
|
Data []byte `protobuf:"bytes,3,opt,name=data,proto3" json:"data,omitempty"` |
|
|
|
|
|
XXX_NoUnkeyedLiteral struct{} `json:"-"` |
|
|
|
|
|
XXX_unrecognized []byte `json:"-"` |
|
|
|
|
|
XXX_sizecache int32 `json:"-"` |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func (m *ProofOp) Reset() { *m = ProofOp{} } |
|
|
|
|
|
func (m *ProofOp) String() string { return proto.CompactTextString(m) } |
|
|
|
|
|
func (*ProofOp) ProtoMessage() {} |
|
|
|
|
|
func (*ProofOp) Descriptor() ([]byte, []int) { |
|
|
|
|
|
return fileDescriptor_merkle_5d3f6051907285da, []int{0} |
|
|
|
|
|
} |
|
|
|
|
|
func (m *ProofOp) XXX_Unmarshal(b []byte) error { |
|
|
|
|
|
return m.Unmarshal(b) |
|
|
|
|
|
} |
|
|
|
|
|
func (m *ProofOp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { |
|
|
|
|
|
if deterministic { |
|
|
|
|
|
return xxx_messageInfo_ProofOp.Marshal(b, m, deterministic) |
|
|
|
|
|
} else { |
|
|
|
|
|
b = b[:cap(b)] |
|
|
|
|
|
n, err := m.MarshalTo(b) |
|
|
|
|
|
if err != nil { |
|
|
|
|
|
return nil, err |
|
|
|
|
|
} |
|
|
|
|
|
return b[:n], nil |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
func (dst *ProofOp) XXX_Merge(src proto.Message) { |
|
|
|
|
|
xxx_messageInfo_ProofOp.Merge(dst, src) |
|
|
|
|
|
} |
|
|
|
|
|
func (m *ProofOp) XXX_Size() int { |
|
|
|
|
|
return m.Size() |
|
|
|
|
|
} |
|
|
|
|
|
func (m *ProofOp) XXX_DiscardUnknown() { |
|
|
|
|
|
xxx_messageInfo_ProofOp.DiscardUnknown(m) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var xxx_messageInfo_ProofOp proto.InternalMessageInfo |
|
|
|
|
|
|
|
|
|
|
|
func (m *ProofOp) GetType() string { |
|
|
|
|
|
if m != nil { |
|
|
|
|
|
return m.Type |
|
|
|
|
|
} |
|
|
|
|
|
return "" |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func (m *ProofOp) GetKey() []byte { |
|
|
|
|
|
if m != nil { |
|
|
|
|
|
return m.Key |
|
|
|
|
|
} |
|
|
|
|
|
return nil |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func (m *ProofOp) GetData() []byte { |
|
|
|
|
|
if m != nil { |
|
|
|
|
|
return m.Data |
|
|
|
|
|
} |
|
|
|
|
|
return nil |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Proof is Merkle proof defined by the list of ProofOps
|
|
|
|
|
|
type Proof struct { |
|
|
|
|
|
Ops []ProofOp `protobuf:"bytes,1,rep,name=ops" json:"ops"` |
|
|
|
|
|
XXX_NoUnkeyedLiteral struct{} `json:"-"` |
|
|
|
|
|
XXX_unrecognized []byte `json:"-"` |
|
|
|
|
|
XXX_sizecache int32 `json:"-"` |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func (m *Proof) Reset() { *m = Proof{} } |
|
|
|
|
|
func (m *Proof) String() string { return proto.CompactTextString(m) } |
|
|
|
|
|
func (*Proof) ProtoMessage() {} |
|
|
|
|
|
func (*Proof) Descriptor() ([]byte, []int) { |
|
|
|
|
|
return fileDescriptor_merkle_5d3f6051907285da, []int{1} |
|
|
|
|
|
} |
|
|
|
|
|
func (m *Proof) XXX_Unmarshal(b []byte) error { |
|
|
|
|
|
return m.Unmarshal(b) |
|
|
|
|
|
} |
|
|
|
|
|
func (m *Proof) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { |
|
|
|
|
|
if deterministic { |
|
|
|
|
|
return xxx_messageInfo_Proof.Marshal(b, m, deterministic) |
|
|
|
|
|
} else { |
|
|
|
|
|
b = b[:cap(b)] |
|
|
|
|
|
n, err := m.MarshalTo(b) |
|
|
|
|
|
if err != nil { |
|
|
|
|
|
return nil, err |
|
|
|
|
|
} |
|
|
|
|
|
return b[:n], nil |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
func (dst *Proof) XXX_Merge(src proto.Message) { |
|
|
|
|
|
xxx_messageInfo_Proof.Merge(dst, src) |
|
|
|
|
|
} |
|
|
|
|
|
func (m *Proof) XXX_Size() int { |
|
|
|
|
|
return m.Size() |
|
|
|
|
|
} |
|
|
|
|
|
func (m *Proof) XXX_DiscardUnknown() { |
|
|
|
|
|
xxx_messageInfo_Proof.DiscardUnknown(m) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var xxx_messageInfo_Proof proto.InternalMessageInfo |
|
|
|
|
|
|
|
|
|
|
|
func (m *Proof) GetOps() []ProofOp { |
|
|
|
|
|
if m != nil { |
|
|
|
|
|
return m.Ops |
|
|
|
|
|
} |
|
|
|
|
|
return nil |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func init() { |
|
|
|
|
|
proto.RegisterType((*ProofOp)(nil), "merkle.ProofOp") |
|
|
|
|
|
proto.RegisterType((*Proof)(nil), "merkle.Proof") |
|
|
|
|
|
} |
|
|
|
|
|
func (this *ProofOp) Equal(that interface{}) bool { |
|
|
|
|
|
if that == nil { |
|
|
|
|
|
return this == nil |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
that1, ok := that.(*ProofOp) |
|
|
|
|
|
if !ok { |
|
|
|
|
|
that2, ok := that.(ProofOp) |
|
|
|
|
|
if ok { |
|
|
|
|
|
that1 = &that2 |
|
|
|
|
|
} else { |
|
|
|
|
|
return false |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
if that1 == nil { |
|
|
|
|
|
return this == nil |
|
|
|
|
|
} else if this == nil { |
|
|
|
|
|
return false |
|
|
|
|
|
} |
|
|
|
|
|
if this.Type != that1.Type { |
|
|
|
|
|
return false |
|
|
|
|
|
} |
|
|
|
|
|
if !bytes.Equal(this.Key, that1.Key) { |
|
|
|
|
|
return false |
|
|
|
|
|
} |
|
|
|
|
|
if !bytes.Equal(this.Data, that1.Data) { |
|
|
|
|
|
return false |
|
|
|
|
|
} |
|
|
|
|
|
if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { |
|
|
|
|
|
return false |
|
|
|
|
|
} |
|
|
|
|
|
return true |
|
|
|
|
|
} |
|
|
|
|
|
func (this *Proof) Equal(that interface{}) bool { |
|
|
|
|
|
if that == nil { |
|
|
|
|
|
return this == nil |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
that1, ok := that.(*Proof) |
|
|
|
|
|
if !ok { |
|
|
|
|
|
that2, ok := that.(Proof) |
|
|
|
|
|
if ok { |
|
|
|
|
|
that1 = &that2 |
|
|
|
|
|
} else { |
|
|
|
|
|
return false |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
if that1 == nil { |
|
|
|
|
|
return this == nil |
|
|
|
|
|
} else if this == nil { |
|
|
|
|
|
return false |
|
|
|
|
|
} |
|
|
|
|
|
if len(this.Ops) != len(that1.Ops) { |
|
|
|
|
|
return false |
|
|
|
|
|
} |
|
|
|
|
|
for i := range this.Ops { |
|
|
|
|
|
if !this.Ops[i].Equal(&that1.Ops[i]) { |
|
|
|
|
|
return false |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { |
|
|
|
|
|
return false |
|
|
|
|
|
} |
|
|
|
|
|
return true |
|
|
|
|
|
} |
|
|
|
|
|
func (m *ProofOp) Marshal() (dAtA []byte, err error) { |
|
|
|
|
|
size := m.Size() |
|
|
|
|
|
dAtA = make([]byte, size) |
|
|
|
|
|
n, err := m.MarshalTo(dAtA) |
|
|
|
|
|
if err != nil { |
|
|
|
|
|
return nil, err |
|
|
|
|
|
} |
|
|
|
|
|
return dAtA[:n], nil |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func (m *ProofOp) MarshalTo(dAtA []byte) (int, error) { |
|
|
|
|
|
var i int |
|
|
|
|
|
_ = i |
|
|
|
|
|
var l int |
|
|
|
|
|
_ = l |
|
|
|
|
|
if len(m.Type) > 0 { |
|
|
|
|
|
dAtA[i] = 0xa |
|
|
|
|
|
i++ |
|
|
|
|
|
i = encodeVarintMerkle(dAtA, i, uint64(len(m.Type))) |
|
|
|
|
|
i += copy(dAtA[i:], m.Type) |
|
|
|
|
|
} |
|
|
|
|
|
if len(m.Key) > 0 { |
|
|
|
|
|
dAtA[i] = 0x12 |
|
|
|
|
|
i++ |
|
|
|
|
|
i = encodeVarintMerkle(dAtA, i, uint64(len(m.Key))) |
|
|
|
|
|
i += copy(dAtA[i:], m.Key) |
|
|
|
|
|
} |
|
|
|
|
|
if len(m.Data) > 0 { |
|
|
|
|
|
dAtA[i] = 0x1a |
|
|
|
|
|
i++ |
|
|
|
|
|
i = encodeVarintMerkle(dAtA, i, uint64(len(m.Data))) |
|
|
|
|
|
i += copy(dAtA[i:], m.Data) |
|
|
|
|
|
} |
|
|
|
|
|
if m.XXX_unrecognized != nil { |
|
|
|
|
|
i += copy(dAtA[i:], m.XXX_unrecognized) |
|
|
|
|
|
} |
|
|
|
|
|
return i, nil |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func (m *Proof) Marshal() (dAtA []byte, err error) { |
|
|
|
|
|
size := m.Size() |
|
|
|
|
|
dAtA = make([]byte, size) |
|
|
|
|
|
n, err := m.MarshalTo(dAtA) |
|
|
|
|
|
if err != nil { |
|
|
|
|
|
return nil, err |
|
|
|
|
|
} |
|
|
|
|
|
return dAtA[:n], nil |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func (m *Proof) MarshalTo(dAtA []byte) (int, error) { |
|
|
|
|
|
var i int |
|
|
|
|
|
_ = i |
|
|
|
|
|
var l int |
|
|
|
|
|
_ = l |
|
|
|
|
|
if len(m.Ops) > 0 { |
|
|
|
|
|
for _, msg := range m.Ops { |
|
|
|
|
|
dAtA[i] = 0xa |
|
|
|
|
|
i++ |
|
|
|
|
|
i = encodeVarintMerkle(dAtA, i, uint64(msg.Size())) |
|
|
|
|
|
n, err := msg.MarshalTo(dAtA[i:]) |
|
|
|
|
|
if err != nil { |
|
|
|
|
|
return 0, err |
|
|
|
|
|
} |
|
|
|
|
|
i += n |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
if m.XXX_unrecognized != nil { |
|
|
|
|
|
i += copy(dAtA[i:], m.XXX_unrecognized) |
|
|
|
|
|
} |
|
|
|
|
|
return i, nil |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func encodeVarintMerkle(dAtA []byte, offset int, v uint64) int { |
|
|
|
|
|
for v >= 1<<7 { |
|
|
|
|
|
dAtA[offset] = uint8(v&0x7f | 0x80) |
|
|
|
|
|
v >>= 7 |
|
|
|
|
|
offset++ |
|
|
|
|
|
} |
|
|
|
|
|
dAtA[offset] = uint8(v) |
|
|
|
|
|
return offset + 1 |
|
|
|
|
|
} |
|
|
|
|
|
func NewPopulatedProofOp(r randyMerkle, easy bool) *ProofOp { |
|
|
|
|
|
this := &ProofOp{} |
|
|
|
|
|
this.Type = string(randStringMerkle(r)) |
|
|
|
|
|
v1 := r.Intn(100) |
|
|
|
|
|
this.Key = make([]byte, v1) |
|
|
|
|
|
for i := 0; i < v1; i++ { |
|
|
|
|
|
this.Key[i] = byte(r.Intn(256)) |
|
|
|
|
|
} |
|
|
|
|
|
v2 := r.Intn(100) |
|
|
|
|
|
this.Data = make([]byte, v2) |
|
|
|
|
|
for i := 0; i < v2; i++ { |
|
|
|
|
|
this.Data[i] = byte(r.Intn(256)) |
|
|
|
|
|
} |
|
|
|
|
|
if !easy && r.Intn(10) != 0 { |
|
|
|
|
|
this.XXX_unrecognized = randUnrecognizedMerkle(r, 4) |
|
|
|
|
|
} |
|
|
|
|
|
return this |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func NewPopulatedProof(r randyMerkle, easy bool) *Proof { |
|
|
|
|
|
this := &Proof{} |
|
|
|
|
|
if r.Intn(10) != 0 { |
|
|
|
|
|
v3 := r.Intn(5) |
|
|
|
|
|
this.Ops = make([]ProofOp, v3) |
|
|
|
|
|
for i := 0; i < v3; i++ { |
|
|
|
|
|
v4 := NewPopulatedProofOp(r, easy) |
|
|
|
|
|
this.Ops[i] = *v4 |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
if !easy && r.Intn(10) != 0 { |
|
|
|
|
|
this.XXX_unrecognized = randUnrecognizedMerkle(r, 2) |
|
|
|
|
|
} |
|
|
|
|
|
return this |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
type randyMerkle interface { |
|
|
|
|
|
Float32() float32 |
|
|
|
|
|
Float64() float64 |
|
|
|
|
|
Int63() int64 |
|
|
|
|
|
Int31() int32 |
|
|
|
|
|
Uint32() uint32 |
|
|
|
|
|
Intn(n int) int |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func randUTF8RuneMerkle(r randyMerkle) rune { |
|
|
|
|
|
ru := r.Intn(62) |
|
|
|
|
|
if ru < 10 { |
|
|
|
|
|
return rune(ru + 48) |
|
|
|
|
|
} else if ru < 36 { |
|
|
|
|
|
return rune(ru + 55) |
|
|
|
|
|
} |
|
|
|
|
|
return rune(ru + 61) |
|
|
|
|
|
} |
|
|
|
|
|
func randStringMerkle(r randyMerkle) string { |
|
|
|
|
|
v5 := r.Intn(100) |
|
|
|
|
|
tmps := make([]rune, v5) |
|
|
|
|
|
for i := 0; i < v5; i++ { |
|
|
|
|
|
tmps[i] = randUTF8RuneMerkle(r) |
|
|
|
|
|
} |
|
|
|
|
|
return string(tmps) |
|
|
|
|
|
} |
|
|
|
|
|
func randUnrecognizedMerkle(r randyMerkle, maxFieldNumber int) (dAtA []byte) { |
|
|
|
|
|
l := r.Intn(5) |
|
|
|
|
|
for i := 0; i < l; i++ { |
|
|
|
|
|
wire := r.Intn(4) |
|
|
|
|
|
if wire == 3 { |
|
|
|
|
|
wire = 5 |
|
|
|
|
|
} |
|
|
|
|
|
fieldNumber := maxFieldNumber + r.Intn(100) |
|
|
|
|
|
dAtA = randFieldMerkle(dAtA, r, fieldNumber, wire) |
|
|
|
|
|
} |
|
|
|
|
|
return dAtA |
|
|
|
|
|
} |
|
|
|
|
|
func randFieldMerkle(dAtA []byte, r randyMerkle, fieldNumber int, wire int) []byte { |
|
|
|
|
|
key := uint32(fieldNumber)<<3 | uint32(wire) |
|
|
|
|
|
switch wire { |
|
|
|
|
|
case 0: |
|
|
|
|
|
dAtA = encodeVarintPopulateMerkle(dAtA, uint64(key)) |
|
|
|
|
|
v6 := r.Int63() |
|
|
|
|
|
if r.Intn(2) == 0 { |
|
|
|
|
|
v6 *= -1 |
|
|
|
|
|
} |
|
|
|
|
|
dAtA = encodeVarintPopulateMerkle(dAtA, uint64(v6)) |
|
|
|
|
|
case 1: |
|
|
|
|
|
dAtA = encodeVarintPopulateMerkle(dAtA, uint64(key)) |
|
|
|
|
|
dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256))) |
|
|
|
|
|
case 2: |
|
|
|
|
|
dAtA = encodeVarintPopulateMerkle(dAtA, uint64(key)) |
|
|
|
|
|
ll := r.Intn(100) |
|
|
|
|
|
dAtA = encodeVarintPopulateMerkle(dAtA, uint64(ll)) |
|
|
|
|
|
for j := 0; j < ll; j++ { |
|
|
|
|
|
dAtA = append(dAtA, byte(r.Intn(256))) |
|
|
|
|
|
} |
|
|
|
|
|
default: |
|
|
|
|
|
dAtA = encodeVarintPopulateMerkle(dAtA, uint64(key)) |
|
|
|
|
|
dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256))) |
|
|
|
|
|
} |
|
|
|
|
|
return dAtA |
|
|
|
|
|
} |
|
|
|
|
|
func encodeVarintPopulateMerkle(dAtA []byte, v uint64) []byte { |
|
|
|
|
|
for v >= 1<<7 { |
|
|
|
|
|
dAtA = append(dAtA, uint8(uint64(v)&0x7f|0x80)) |
|
|
|
|
|
v >>= 7 |
|
|
|
|
|
} |
|
|
|
|
|
dAtA = append(dAtA, uint8(v)) |
|
|
|
|
|
return dAtA |
|
|
|
|
|
} |
|
|
|
|
|
func (m *ProofOp) Size() (n int) { |
|
|
|
|
|
var l int |
|
|
|
|
|
_ = l |
|
|
|
|
|
l = len(m.Type) |
|
|
|
|
|
if l > 0 { |
|
|
|
|
|
n += 1 + l + sovMerkle(uint64(l)) |
|
|
|
|
|
} |
|
|
|
|
|
l = len(m.Key) |
|
|
|
|
|
if l > 0 { |
|
|
|
|
|
n += 1 + l + sovMerkle(uint64(l)) |
|
|
|
|
|
} |
|
|
|
|
|
l = len(m.Data) |
|
|
|
|
|
if l > 0 { |
|
|
|
|
|
n += 1 + l + sovMerkle(uint64(l)) |
|
|
|
|
|
} |
|
|
|
|
|
if m.XXX_unrecognized != nil { |
|
|
|
|
|
n += len(m.XXX_unrecognized) |
|
|
|
|
|
} |
|
|
|
|
|
return n |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func (m *Proof) Size() (n int) { |
|
|
|
|
|
var l int |
|
|
|
|
|
_ = l |
|
|
|
|
|
if len(m.Ops) > 0 { |
|
|
|
|
|
for _, e := range m.Ops { |
|
|
|
|
|
l = e.Size() |
|
|
|
|
|
n += 1 + l + sovMerkle(uint64(l)) |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
if m.XXX_unrecognized != nil { |
|
|
|
|
|
n += len(m.XXX_unrecognized) |
|
|
|
|
|
} |
|
|
|
|
|
return n |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func sovMerkle(x uint64) (n int) { |
|
|
|
|
|
for { |
|
|
|
|
|
n++ |
|
|
|
|
|
x >>= 7 |
|
|
|
|
|
if x == 0 { |
|
|
|
|
|
break |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
return n |
|
|
|
|
|
} |
|
|
|
|
|
func sozMerkle(x uint64) (n int) { |
|
|
|
|
|
return sovMerkle(uint64((x << 1) ^ uint64((int64(x) >> 63)))) |
|
|
|
|
|
} |
|
|
|
|
|
func (m *ProofOp) 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 ErrIntOverflowMerkle |
|
|
|
|
|
} |
|
|
|
|
|
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: ProofOp: wiretype end group for non-group") |
|
|
|
|
|
} |
|
|
|
|
|
if fieldNum <= 0 { |
|
|
|
|
|
return fmt.Errorf("proto: ProofOp: illegal tag %d (wire type %d)", fieldNum, wire) |
|
|
|
|
|
} |
|
|
|
|
|
switch fieldNum { |
|
|
|
|
|
case 1: |
|
|
|
|
|
if wireType != 2 { |
|
|
|
|
|
return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) |
|
|
|
|
|
} |
|
|
|
|
|
var stringLen uint64 |
|
|
|
|
|
for shift := uint(0); ; shift += 7 { |
|
|
|
|
|
if shift >= 64 { |
|
|
|
|
|
return ErrIntOverflowMerkle |
|
|
|
|
|
} |
|
|
|
|
|
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 ErrInvalidLengthMerkle |
|
|
|
|
|
} |
|
|
|
|
|
postIndex := iNdEx + intStringLen |
|
|
|
|
|
if postIndex > l { |
|
|
|
|
|
return io.ErrUnexpectedEOF |
|
|
|
|
|
} |
|
|
|
|
|
m.Type = string(dAtA[iNdEx:postIndex]) |
|
|
|
|
|
iNdEx = postIndex |
|
|
|
|
|
case 2: |
|
|
|
|
|
if wireType != 2 { |
|
|
|
|
|
return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) |
|
|
|
|
|
} |
|
|
|
|
|
var byteLen int |
|
|
|
|
|
for shift := uint(0); ; shift += 7 { |
|
|
|
|
|
if shift >= 64 { |
|
|
|
|
|
return ErrIntOverflowMerkle |
|
|
|
|
|
} |
|
|
|
|
|
if iNdEx >= l { |
|
|
|
|
|
return io.ErrUnexpectedEOF |
|
|
|
|
|
} |
|
|
|
|
|
b := dAtA[iNdEx] |
|
|
|
|
|
iNdEx++ |
|
|
|
|
|
byteLen |= (int(b) & 0x7F) << shift |
|
|
|
|
|
if b < 0x80 { |
|
|
|
|
|
break |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
if byteLen < 0 { |
|
|
|
|
|
return ErrInvalidLengthMerkle |
|
|
|
|
|
} |
|
|
|
|
|
postIndex := iNdEx + byteLen |
|
|
|
|
|
if postIndex > l { |
|
|
|
|
|
return io.ErrUnexpectedEOF |
|
|
|
|
|
} |
|
|
|
|
|
m.Key = append(m.Key[:0], dAtA[iNdEx:postIndex]...) |
|
|
|
|
|
if m.Key == nil { |
|
|
|
|
|
m.Key = []byte{} |
|
|
|
|
|
} |
|
|
|
|
|
iNdEx = postIndex |
|
|
|
|
|
case 3: |
|
|
|
|
|
if wireType != 2 { |
|
|
|
|
|
return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) |
|
|
|
|
|
} |
|
|
|
|
|
var byteLen int |
|
|
|
|
|
for shift := uint(0); ; shift += 7 { |
|
|
|
|
|
if shift >= 64 { |
|
|
|
|
|
return ErrIntOverflowMerkle |
|
|
|
|
|
} |
|
|
|
|
|
if iNdEx >= l { |
|
|
|
|
|
return io.ErrUnexpectedEOF |
|
|
|
|
|
} |
|
|
|
|
|
b := dAtA[iNdEx] |
|
|
|
|
|
iNdEx++ |
|
|
|
|
|
byteLen |= (int(b) & 0x7F) << shift |
|
|
|
|
|
if b < 0x80 { |
|
|
|
|
|
break |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
if byteLen < 0 { |
|
|
|
|
|
return ErrInvalidLengthMerkle |
|
|
|
|
|
} |
|
|
|
|
|
postIndex := iNdEx + byteLen |
|
|
|
|
|
if postIndex > l { |
|
|
|
|
|
return io.ErrUnexpectedEOF |
|
|
|
|
|
} |
|
|
|
|
|
m.Data = append(m.Data[:0], dAtA[iNdEx:postIndex]...) |
|
|
|
|
|
if m.Data == nil { |
|
|
|
|
|
m.Data = []byte{} |
|
|
|
|
|
} |
|
|
|
|
|
iNdEx = postIndex |
|
|
|
|
|
default: |
|
|
|
|
|
iNdEx = preIndex |
|
|
|
|
|
skippy, err := skipMerkle(dAtA[iNdEx:]) |
|
|
|
|
|
if err != nil { |
|
|
|
|
|
return err |
|
|
|
|
|
} |
|
|
|
|
|
if skippy < 0 { |
|
|
|
|
|
return ErrInvalidLengthMerkle |
|
|
|
|
|
} |
|
|
|
|
|
if (iNdEx + skippy) > l { |
|
|
|
|
|
return io.ErrUnexpectedEOF |
|
|
|
|
|
} |
|
|
|
|
|
m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) |
|
|
|
|
|
iNdEx += skippy |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if iNdEx > l { |
|
|
|
|
|
return io.ErrUnexpectedEOF |
|
|
|
|
|
} |
|
|
|
|
|
return nil |
|
|
|
|
|
} |
|
|
|
|
|
func (m *Proof) 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 ErrIntOverflowMerkle |
|
|
|
|
|
} |
|
|
|
|
|
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: Proof: wiretype end group for non-group") |
|
|
|
|
|
} |
|
|
|
|
|
if fieldNum <= 0 { |
|
|
|
|
|
return fmt.Errorf("proto: Proof: illegal tag %d (wire type %d)", fieldNum, wire) |
|
|
|
|
|
} |
|
|
|
|
|
switch fieldNum { |
|
|
|
|
|
case 1: |
|
|
|
|
|
if wireType != 2 { |
|
|
|
|
|
return fmt.Errorf("proto: wrong wireType = %d for field Ops", wireType) |
|
|
|
|
|
} |
|
|
|
|
|
var msglen int |
|
|
|
|
|
for shift := uint(0); ; shift += 7 { |
|
|
|
|
|
if shift >= 64 { |
|
|
|
|
|
return ErrIntOverflowMerkle |
|
|
|
|
|
} |
|
|
|
|
|
if iNdEx >= l { |
|
|
|
|
|
return io.ErrUnexpectedEOF |
|
|
|
|
|
} |
|
|
|
|
|
b := dAtA[iNdEx] |
|
|
|
|
|
iNdEx++ |
|
|
|
|
|
msglen |= (int(b) & 0x7F) << shift |
|
|
|
|
|
if b < 0x80 { |
|
|
|
|
|
break |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
if msglen < 0 { |
|
|
|
|
|
return ErrInvalidLengthMerkle |
|
|
|
|
|
} |
|
|
|
|
|
postIndex := iNdEx + msglen |
|
|
|
|
|
if postIndex > l { |
|
|
|
|
|
return io.ErrUnexpectedEOF |
|
|
|
|
|
} |
|
|
|
|
|
m.Ops = append(m.Ops, ProofOp{}) |
|
|
|
|
|
if err := m.Ops[len(m.Ops)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { |
|
|
|
|
|
return err |
|
|
|
|
|
} |
|
|
|
|
|
iNdEx = postIndex |
|
|
|
|
|
default: |
|
|
|
|
|
iNdEx = preIndex |
|
|
|
|
|
skippy, err := skipMerkle(dAtA[iNdEx:]) |
|
|
|
|
|
if err != nil { |
|
|
|
|
|
return err |
|
|
|
|
|
} |
|
|
|
|
|
if skippy < 0 { |
|
|
|
|
|
return ErrInvalidLengthMerkle |
|
|
|
|
|
} |
|
|
|
|
|
if (iNdEx + skippy) > l { |
|
|
|
|
|
return io.ErrUnexpectedEOF |
|
|
|
|
|
} |
|
|
|
|
|
m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) |
|
|
|
|
|
iNdEx += skippy |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if iNdEx > l { |
|
|
|
|
|
return io.ErrUnexpectedEOF |
|
|
|
|
|
} |
|
|
|
|
|
return nil |
|
|
|
|
|
} |
|
|
|
|
|
func skipMerkle(dAtA []byte) (n int, err error) { |
|
|
|
|
|
l := len(dAtA) |
|
|
|
|
|
iNdEx := 0 |
|
|
|
|
|
for iNdEx < l { |
|
|
|
|
|
var wire uint64 |
|
|
|
|
|
for shift := uint(0); ; shift += 7 { |
|
|
|
|
|
if shift >= 64 { |
|
|
|
|
|
return 0, ErrIntOverflowMerkle |
|
|
|
|
|
} |
|
|
|
|
|
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, ErrIntOverflowMerkle |
|
|
|
|
|
} |
|
|
|
|
|
if iNdEx >= l { |
|
|
|
|
|
return 0, io.ErrUnexpectedEOF |
|
|
|
|
|
} |
|
|
|
|
|
iNdEx++ |
|
|
|
|
|
if dAtA[iNdEx-1] < 0x80 { |
|
|
|
|
|
break |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
return iNdEx, nil |
|
|
|
|
|
case 1: |
|
|
|
|
|
iNdEx += 8 |
|
|
|
|
|
return iNdEx, nil |
|
|
|
|
|
case 2: |
|
|
|
|
|
var length int |
|
|
|
|
|
for shift := uint(0); ; shift += 7 { |
|
|
|
|
|
if shift >= 64 { |
|
|
|
|
|
return 0, ErrIntOverflowMerkle |
|
|
|
|
|
} |
|
|
|
|
|
if iNdEx >= l { |
|
|
|
|
|
return 0, io.ErrUnexpectedEOF |
|
|
|
|
|
} |
|
|
|
|
|
b := dAtA[iNdEx] |
|
|
|
|
|
iNdEx++ |
|
|
|
|
|
length |= (int(b) & 0x7F) << shift |
|
|
|
|
|
if b < 0x80 { |
|
|
|
|
|
break |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
iNdEx += length |
|
|
|
|
|
if length < 0 { |
|
|
|
|
|
return 0, ErrInvalidLengthMerkle |
|
|
|
|
|
} |
|
|
|
|
|
return iNdEx, nil |
|
|
|
|
|
case 3: |
|
|
|
|
|
for { |
|
|
|
|
|
var innerWire uint64 |
|
|
|
|
|
var start int = iNdEx |
|
|
|
|
|
for shift := uint(0); ; shift += 7 { |
|
|
|
|
|
if shift >= 64 { |
|
|
|
|
|
return 0, ErrIntOverflowMerkle |
|
|
|
|
|
} |
|
|
|
|
|
if iNdEx >= l { |
|
|
|
|
|
return 0, io.ErrUnexpectedEOF |
|
|
|
|
|
} |
|
|
|
|
|
b := dAtA[iNdEx] |
|
|
|
|
|
iNdEx++ |
|
|
|
|
|
innerWire |= (uint64(b) & 0x7F) << shift |
|
|
|
|
|
if b < 0x80 { |
|
|
|
|
|
break |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
innerWireType := int(innerWire & 0x7) |
|
|
|
|
|
if innerWireType == 4 { |
|
|
|
|
|
break |
|
|
|
|
|
} |
|
|
|
|
|
next, err := skipMerkle(dAtA[start:]) |
|
|
|
|
|
if err != nil { |
|
|
|
|
|
return 0, err |
|
|
|
|
|
} |
|
|
|
|
|
iNdEx = start + next |
|
|
|
|
|
} |
|
|
|
|
|
return iNdEx, nil |
|
|
|
|
|
case 4: |
|
|
|
|
|
return iNdEx, nil |
|
|
|
|
|
case 5: |
|
|
|
|
|
iNdEx += 4 |
|
|
|
|
|
return iNdEx, nil |
|
|
|
|
|
default: |
|
|
|
|
|
return 0, fmt.Errorf("proto: illegal wireType %d", wireType) |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
panic("unreachable") |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var ( |
|
|
|
|
|
ErrInvalidLengthMerkle = fmt.Errorf("proto: negative length found during unmarshaling") |
|
|
|
|
|
ErrIntOverflowMerkle = fmt.Errorf("proto: integer overflow") |
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
func init() { proto.RegisterFile("crypto/merkle/merkle.proto", fileDescriptor_merkle_5d3f6051907285da) } |
|
|
|
|
|
|
|
|
|
|
|
var fileDescriptor_merkle_5d3f6051907285da = []byte{ |
|
|
|
|
|
// 200 bytes of a gzipped FileDescriptorProto
|
|
|
|
|
|
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4a, 0x2e, 0xaa, 0x2c, |
|
|
|
|
|
0x28, 0xc9, 0xd7, 0xcf, 0x4d, 0x2d, 0xca, 0xce, 0x49, 0x85, 0x52, 0x7a, 0x05, 0x45, 0xf9, 0x25, |
|
|
|
|
|
0xf9, 0x42, 0x6c, 0x10, 0x9e, 0x94, 0x6e, 0x7a, 0x66, 0x49, 0x46, 0x69, 0x92, 0x5e, 0x72, 0x7e, |
|
|
|
|
|
0xae, 0x7e, 0x7a, 0x7e, 0x7a, 0xbe, 0x3e, 0x58, 0x3a, 0xa9, 0x34, 0x0d, 0xcc, 0x03, 0x73, 0xc0, |
|
|
|
|
|
0x2c, 0x88, 0x36, 0x25, 0x67, 0x2e, 0xf6, 0x80, 0xa2, 0xfc, 0xfc, 0x34, 0xff, 0x02, 0x21, 0x21, |
|
|
|
|
|
0x2e, 0x96, 0x92, 0xca, 0x82, 0x54, 0x09, 0x46, 0x05, 0x46, 0x0d, 0xce, 0x20, 0x30, 0x5b, 0x48, |
|
|
|
|
|
0x80, 0x8b, 0x39, 0x3b, 0xb5, 0x52, 0x82, 0x49, 0x81, 0x51, 0x83, 0x27, 0x08, 0xc4, 0x04, 0xa9, |
|
|
|
|
|
0x4a, 0x49, 0x2c, 0x49, 0x94, 0x60, 0x06, 0x0b, 0x81, 0xd9, 0x4a, 0x06, 0x5c, 0xac, 0x60, 0x43, |
|
|
|
|
|
0x84, 0xd4, 0xb9, 0x98, 0xf3, 0x0b, 0x8a, 0x25, 0x18, 0x15, 0x98, 0x35, 0xb8, 0x8d, 0xf8, 0xf5, |
|
|
|
|
|
0xa0, 0x0e, 0x84, 0x5a, 0xe0, 0xc4, 0x72, 0xe2, 0x9e, 0x3c, 0x43, 0x10, 0x48, 0x85, 0x93, 0xc8, |
|
|
|
|
|
0x8f, 0x87, 0x72, 0x8c, 0x2b, 0x1e, 0xc9, 0x31, 0x9e, 0x78, 0x24, 0xc7, 0x78, 0xe1, 0x91, 0x1c, |
|
|
|
|
|
0xe3, 0x83, 0x47, 0x72, 0x8c, 0x49, 0x6c, 0x60, 0x37, 0x19, 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, |
|
|
|
|
|
0xb9, 0x2b, 0x0f, 0xd1, 0xe8, 0x00, 0x00, 0x00, |
|
|
|
|
|
} |