diff --git a/data/block/metaBlock.pb.go b/data/block/metaBlock.pb.go index 9595a0ed..360226b8 100644 --- a/data/block/metaBlock.pb.go +++ b/data/block/metaBlock.pb.go @@ -70,8 +70,8 @@ func (PeerAction) EnumDescriptor() ([]byte, []int) { } // PeerData holds information about actions taken by a peer: -// - a peer can register with an amount to become a validator -// - a peer can choose to deregister and get back the deposited value +// - a peer can register with an amount to become a validator +// - a peer can choose to deregister and get back the deposited value type PeerData struct { Address []byte `protobuf:"bytes,1,opt,name=Address,proto3" json:"address,omitempty"` PublicKey []byte `protobuf:"bytes,2,opt,name=PublicKey,proto3" json:"publicKey,omitempty"` diff --git a/data/metrics/metrics.pb.go b/data/metrics/metrics.pb.go index 11aa7a24..54986fd8 100644 --- a/data/metrics/metrics.pb.go +++ b/data/metrics/metrics.pb.go @@ -28,6 +28,7 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type Metric struct { Key string `protobuf:"bytes,1,opt,name=Key,proto3" json:"Key,omitempty"` // Types that are valid to be assigned to Value: + // // *Metric_ValUint64 // *Metric_ValString Value isMetric_Value `protobuf_oneof:"Value"` diff --git a/data/state/dtos.go b/data/state/dtos.go new file mode 100644 index 00000000..6d4b2126 --- /dev/null +++ b/data/state/dtos.go @@ -0,0 +1,11 @@ +//go:generate protoc -I=. -I=$GOPATH/src/github.com/multiversx/mx-chain-core-go/data/transaction -I=$GOPATH/src -I=$GOPATH/src/github.com/multiversx/protobuf/protobuf --gogoslick_out=$GOPATH/src receipt.proto +//go:generate protoc -I=. -I=$GOPATH/src -I=$GOPATH/src/github.com/multiversx/protobuf/protobuf --gogoslick_out=$GOPATH/src stateChange.proto + +package state + +// NewSerializedNodesMap will create a new instance of *SerializedNodeMap +func NewSerializedNodesMap() *SerializedNodeMap { + return &SerializedNodeMap{ + SerializedNodes: map[string][]byte{}, + } +} diff --git a/data/state/receipt.pb.go b/data/state/receipt.pb.go new file mode 100644 index 00000000..379fe53b --- /dev/null +++ b/data/state/receipt.pb.go @@ -0,0 +1,607 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: receipt.proto + +package state + +import ( + bytes "bytes" + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + transaction "github.com/multiversx/mx-chain-core-go/data/transaction" + io "io" + math "math" + math_bits "math/bits" + reflect "reflect" + strings "strings" +) + +// 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 + +// Receipt holds information about a receipt +type Receipt struct { + TxHash []byte `protobuf:"bytes,1,opt,name=TxHash,proto3" json:"txHash"` + Address []byte `protobuf:"bytes,2,opt,name=Address,proto3" json:"address"` + Events []*transaction.Event `protobuf:"bytes,3,rep,name=Events,proto3" json:"events"` + StateChanges []*StateChange `protobuf:"bytes,4,rep,name=StateChanges,proto3" json:"stateChanges"` +} + +func (m *Receipt) Reset() { *m = Receipt{} } +func (*Receipt) ProtoMessage() {} +func (*Receipt) Descriptor() ([]byte, []int) { + return fileDescriptor_ace1d6eb38fad2c8, []int{0} +} +func (m *Receipt) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Receipt) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *Receipt) XXX_Merge(src proto.Message) { + xxx_messageInfo_Receipt.Merge(m, src) +} +func (m *Receipt) XXX_Size() int { + return m.Size() +} +func (m *Receipt) XXX_DiscardUnknown() { + xxx_messageInfo_Receipt.DiscardUnknown(m) +} + +var xxx_messageInfo_Receipt proto.InternalMessageInfo + +func (m *Receipt) GetTxHash() []byte { + if m != nil { + return m.TxHash + } + return nil +} + +func (m *Receipt) GetAddress() []byte { + if m != nil { + return m.Address + } + return nil +} + +func (m *Receipt) GetEvents() []*transaction.Event { + if m != nil { + return m.Events + } + return nil +} + +func (m *Receipt) GetStateChanges() []*StateChange { + if m != nil { + return m.StateChanges + } + return nil +} + +func init() { + proto.RegisterType((*Receipt)(nil), "proto.Receipt") +} + +func init() { proto.RegisterFile("receipt.proto", fileDescriptor_ace1d6eb38fad2c8) } + +var fileDescriptor_ace1d6eb38fad2c8 = []byte{ + // 328 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x51, 0x3d, 0x6e, 0xc2, 0x30, + 0x14, 0x8e, 0x4b, 0x1b, 0x24, 0x93, 0x4a, 0x55, 0xa6, 0x88, 0xe1, 0x81, 0x90, 0x2a, 0xb1, 0x04, + 0xf7, 0xe7, 0x04, 0x80, 0x2a, 0x31, 0xa7, 0x9d, 0xba, 0x99, 0xe0, 0x3a, 0x51, 0x21, 0x46, 0xb6, + 0x41, 0x8c, 0x3d, 0x42, 0x8f, 0xd1, 0xa3, 0x74, 0xcc, 0xc8, 0x84, 0x8a, 0x59, 0x2a, 0x26, 0x8e, + 0x50, 0xc9, 0x4e, 0x55, 0x3a, 0xb2, 0xd8, 0x7e, 0xdf, 0x9f, 0xfd, 0xfc, 0xf0, 0xa5, 0x64, 0x29, + 0xcb, 0xe7, 0xba, 0x37, 0x97, 0x42, 0x8b, 0xf0, 0xc2, 0x6e, 0xcd, 0x98, 0xe7, 0x3a, 0x5b, 0x8c, + 0x7b, 0xa9, 0x98, 0x11, 0x2e, 0xb8, 0x20, 0x16, 0x1e, 0x2f, 0x5e, 0x6c, 0x65, 0x0b, 0x7b, 0x72, + 0xae, 0xe6, 0xf0, 0x48, 0x3e, 0x5b, 0x4c, 0x75, 0xbe, 0x64, 0x52, 0xad, 0xc8, 0x6c, 0x15, 0xa7, + 0x19, 0xcd, 0x8b, 0x38, 0x15, 0x92, 0xc5, 0x5c, 0x90, 0x09, 0xd5, 0x94, 0x28, 0x4d, 0x35, 0x73, + 0xeb, 0x30, 0xa3, 0x05, 0x67, 0x55, 0x48, 0xff, 0x94, 0x10, 0x2d, 0x69, 0xa1, 0x68, 0xaa, 0x73, + 0x51, 0x90, 0xa9, 0xe0, 0x2e, 0xa2, 0x53, 0x22, 0x5c, 0x4f, 0x5c, 0x3f, 0x61, 0x07, 0xfb, 0x4f, + 0xab, 0x11, 0x55, 0x59, 0x84, 0xda, 0xa8, 0x1b, 0x0c, 0xf0, 0x7e, 0xd3, 0xf2, 0xb5, 0x45, 0x92, + 0x8a, 0x09, 0xaf, 0x71, 0xbd, 0x3f, 0x99, 0x48, 0xa6, 0x54, 0x74, 0x66, 0x45, 0x8d, 0xfd, 0xa6, + 0x55, 0xa7, 0x0e, 0x4a, 0x7e, 0xb9, 0xf0, 0x06, 0xfb, 0x0f, 0x4b, 0x56, 0x68, 0x15, 0xd5, 0xda, + 0xb5, 0x6e, 0xe3, 0x2e, 0x70, 0xd7, 0xf5, 0x2c, 0xe8, 0x82, 0x99, 0xe5, 0x93, 0x4a, 0x17, 0x8e, + 0x70, 0xf0, 0xf8, 0xd7, 0xa0, 0x8a, 0xce, 0xad, 0x2f, 0xac, 0x7c, 0x47, 0xd4, 0xe0, 0x6a, 0xbf, + 0x69, 0x05, 0x47, 0x9f, 0xa1, 0x92, 0x7f, 0xce, 0xc1, 0x6b, 0xb9, 0x05, 0x6f, 0xbd, 0x05, 0xef, + 0xb0, 0x05, 0xf4, 0x66, 0x00, 0x7d, 0x18, 0x40, 0x9f, 0x06, 0x50, 0x69, 0x00, 0xad, 0x0d, 0xa0, + 0x2f, 0x03, 0xe8, 0xdb, 0x80, 0x77, 0x30, 0x80, 0xde, 0x77, 0xe0, 0x95, 0x3b, 0xf0, 0xd6, 0x3b, + 0xf0, 0x9e, 0x6f, 0x4f, 0x1e, 0xca, 0xd8, 0xb7, 0xef, 0xbb, 0xff, 0x09, 0x00, 0x00, 0xff, 0xff, + 0xe0, 0x02, 0x6a, 0x6b, 0x15, 0x02, 0x00, 0x00, +} + +func (this *Receipt) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Receipt) + if !ok { + that2, ok := that.(Receipt) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !bytes.Equal(this.TxHash, that1.TxHash) { + return false + } + if !bytes.Equal(this.Address, that1.Address) { + return false + } + if len(this.Events) != len(that1.Events) { + return false + } + for i := range this.Events { + if !this.Events[i].Equal(that1.Events[i]) { + return false + } + } + if len(this.StateChanges) != len(that1.StateChanges) { + return false + } + for i := range this.StateChanges { + if !this.StateChanges[i].Equal(that1.StateChanges[i]) { + return false + } + } + return true +} +func (this *Receipt) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 8) + s = append(s, "&state.Receipt{") + s = append(s, "TxHash: "+fmt.Sprintf("%#v", this.TxHash)+",\n") + s = append(s, "Address: "+fmt.Sprintf("%#v", this.Address)+",\n") + if this.Events != nil { + s = append(s, "Events: "+fmt.Sprintf("%#v", this.Events)+",\n") + } + if this.StateChanges != nil { + s = append(s, "StateChanges: "+fmt.Sprintf("%#v", this.StateChanges)+",\n") + } + s = append(s, "}") + return strings.Join(s, "") +} +func valueToGoStringReceipt(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 *Receipt) 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 *Receipt) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Receipt) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.StateChanges) > 0 { + for iNdEx := len(m.StateChanges) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.StateChanges[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintReceipt(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + } + if len(m.Events) > 0 { + for iNdEx := len(m.Events) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Events[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintReceipt(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + } + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = encodeVarintReceipt(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0x12 + } + if len(m.TxHash) > 0 { + i -= len(m.TxHash) + copy(dAtA[i:], m.TxHash) + i = encodeVarintReceipt(dAtA, i, uint64(len(m.TxHash))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintReceipt(dAtA []byte, offset int, v uint64) int { + offset -= sovReceipt(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Receipt) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.TxHash) + if l > 0 { + n += 1 + l + sovReceipt(uint64(l)) + } + l = len(m.Address) + if l > 0 { + n += 1 + l + sovReceipt(uint64(l)) + } + if len(m.Events) > 0 { + for _, e := range m.Events { + l = e.Size() + n += 1 + l + sovReceipt(uint64(l)) + } + } + if len(m.StateChanges) > 0 { + for _, e := range m.StateChanges { + l = e.Size() + n += 1 + l + sovReceipt(uint64(l)) + } + } + return n +} + +func sovReceipt(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozReceipt(x uint64) (n int) { + return sovReceipt(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (this *Receipt) String() string { + if this == nil { + return "nil" + } + repeatedStringForEvents := "[]*Event{" + for _, f := range this.Events { + repeatedStringForEvents += strings.Replace(fmt.Sprintf("%v", f), "Event", "transaction.Event", 1) + "," + } + repeatedStringForEvents += "}" + repeatedStringForStateChanges := "[]*StateChange{" + for _, f := range this.StateChanges { + repeatedStringForStateChanges += strings.Replace(fmt.Sprintf("%v", f), "StateChange", "StateChange", 1) + "," + } + repeatedStringForStateChanges += "}" + s := strings.Join([]string{`&Receipt{`, + `TxHash:` + fmt.Sprintf("%v", this.TxHash) + `,`, + `Address:` + fmt.Sprintf("%v", this.Address) + `,`, + `Events:` + repeatedStringForEvents + `,`, + `StateChanges:` + repeatedStringForStateChanges + `,`, + `}`, + }, "") + return s +} +func valueToStringReceipt(v interface{}) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("*%v", pv) +} +func (m *Receipt) 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 ErrIntOverflowReceipt + } + 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: Receipt: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Receipt: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TxHash", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowReceipt + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthReceipt + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthReceipt + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TxHash = append(m.TxHash[:0], dAtA[iNdEx:postIndex]...) + if m.TxHash == nil { + m.TxHash = []byte{} + } + iNdEx = postIndex + case 2: + 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 ErrIntOverflowReceipt + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthReceipt + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthReceipt + } + 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 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Events", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowReceipt + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthReceipt + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthReceipt + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Events = append(m.Events, &transaction.Event{}) + if err := m.Events[len(m.Events)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field StateChanges", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowReceipt + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthReceipt + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthReceipt + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.StateChanges = append(m.StateChanges, &StateChange{}) + if err := m.StateChanges[len(m.StateChanges)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipReceipt(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthReceipt + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthReceipt + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipReceipt(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, ErrIntOverflowReceipt + } + 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, ErrIntOverflowReceipt + } + 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, ErrIntOverflowReceipt + } + 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, ErrInvalidLengthReceipt + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupReceipt + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthReceipt + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthReceipt = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowReceipt = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupReceipt = fmt.Errorf("proto: unexpected end of group") +) diff --git a/data/state/receipt.proto b/data/state/receipt.proto new file mode 100644 index 00000000..96be2d4e --- /dev/null +++ b/data/state/receipt.proto @@ -0,0 +1,19 @@ +syntax = "proto3"; + +package proto; + +option go_package = "github.com/multiversx/mx-chain-core-go/data/state"; +option (gogoproto.stable_marshaler_all) = true; + +import "github.com/gogo/protobuf/gogoproto/gogo.proto"; +import "github.com/multiversx/mx-chain-core-go/data/state/stateChange.proto"; +import "github.com/multiversx/mx-chain-core-go/data/transaction/log.proto"; + + +// Receipt holds information about a receipt +message Receipt { + bytes TxHash = 1 [(gogoproto.jsontag) = "txHash"]; + bytes Address = 2 [(gogoproto.jsontag) = "address"]; + repeated Event Events = 3 [(gogoproto.jsontag) = "events"]; + repeated StateChange StateChanges = 4 [(gogoproto.jsontag) = "stateChanges"]; +} diff --git a/data/state/stateChange.pb.go b/data/state/stateChange.pb.go new file mode 100644 index 00000000..e63ac1b2 --- /dev/null +++ b/data/state/stateChange.pb.go @@ -0,0 +1,1169 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: stateChange.proto + +package state + +import ( + bytes "bytes" + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + github_com_gogo_protobuf_sortkeys "github.com/gogo/protobuf/sortkeys" + io "io" + math "math" + math_bits "math/bits" + reflect "reflect" + strings "strings" +) + +// 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 + +// StateChange is used to collect state changes +type StateChange struct { + Type []byte `protobuf:"bytes,1,opt,name=Type,proto3" json:"type"` + DataTrieChanges []*DataTrieChange `protobuf:"bytes,2,rep,name=DataTrieChanges,proto3" json:"dataTrieChanges"` +} + +func (m *StateChange) Reset() { *m = StateChange{} } +func (*StateChange) ProtoMessage() {} +func (*StateChange) Descriptor() ([]byte, []int) { + return fileDescriptor_8e577663eebb0888, []int{0} +} +func (m *StateChange) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *StateChange) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *StateChange) XXX_Merge(src proto.Message) { + xxx_messageInfo_StateChange.Merge(m, src) +} +func (m *StateChange) XXX_Size() int { + return m.Size() +} +func (m *StateChange) XXX_DiscardUnknown() { + xxx_messageInfo_StateChange.DiscardUnknown(m) +} + +var xxx_messageInfo_StateChange proto.InternalMessageInfo + +func (m *StateChange) GetType() []byte { + if m != nil { + return m.Type + } + return nil +} + +func (m *StateChange) GetDataTrieChanges() []*DataTrieChange { + if m != nil { + return m.DataTrieChanges + } + return nil +} + +// DataTrieChange represents a change in the data trie +type DataTrieChange struct { + Type []byte `protobuf:"bytes,1,opt,name=Type,proto3" json:"type"` + Key []byte `protobuf:"bytes,2,opt,name=Key,proto3" json:"key"` + Val []byte `protobuf:"bytes,3,opt,name=Val,proto3" json:"val"` +} + +func (m *DataTrieChange) Reset() { *m = DataTrieChange{} } +func (*DataTrieChange) ProtoMessage() {} +func (*DataTrieChange) Descriptor() ([]byte, []int) { + return fileDescriptor_8e577663eebb0888, []int{1} +} +func (m *DataTrieChange) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *DataTrieChange) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *DataTrieChange) XXX_Merge(src proto.Message) { + xxx_messageInfo_DataTrieChange.Merge(m, src) +} +func (m *DataTrieChange) XXX_Size() int { + return m.Size() +} +func (m *DataTrieChange) XXX_DiscardUnknown() { + xxx_messageInfo_DataTrieChange.DiscardUnknown(m) +} + +var xxx_messageInfo_DataTrieChange proto.InternalMessageInfo + +func (m *DataTrieChange) GetType() []byte { + if m != nil { + return m.Type + } + return nil +} + +func (m *DataTrieChange) GetKey() []byte { + if m != nil { + return m.Key + } + return nil +} + +func (m *DataTrieChange) GetVal() []byte { + if m != nil { + return m.Val + } + return nil +} + +// SerializedNodeMap represents a map with key node hash and data node bytes +type SerializedNodeMap struct { + SerializedNodes map[string][]byte `protobuf:"bytes,1,rep,name=SerializedNodes,proto3" json:"serializedNodes" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` +} + +func (m *SerializedNodeMap) Reset() { *m = SerializedNodeMap{} } +func (*SerializedNodeMap) ProtoMessage() {} +func (*SerializedNodeMap) Descriptor() ([]byte, []int) { + return fileDescriptor_8e577663eebb0888, []int{2} +} +func (m *SerializedNodeMap) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *SerializedNodeMap) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *SerializedNodeMap) XXX_Merge(src proto.Message) { + xxx_messageInfo_SerializedNodeMap.Merge(m, src) +} +func (m *SerializedNodeMap) XXX_Size() int { + return m.Size() +} +func (m *SerializedNodeMap) XXX_DiscardUnknown() { + xxx_messageInfo_SerializedNodeMap.DiscardUnknown(m) +} + +var xxx_messageInfo_SerializedNodeMap proto.InternalMessageInfo + +func (m *SerializedNodeMap) GetSerializedNodes() map[string][]byte { + if m != nil { + return m.SerializedNodes + } + return nil +} + +func init() { + proto.RegisterType((*StateChange)(nil), "proto.StateChange") + proto.RegisterType((*DataTrieChange)(nil), "proto.DataTrieChange") + proto.RegisterType((*SerializedNodeMap)(nil), "proto.SerializedNodeMap") + proto.RegisterMapType((map[string][]byte)(nil), "proto.SerializedNodeMap.SerializedNodesEntry") +} + +func init() { proto.RegisterFile("stateChange.proto", fileDescriptor_8e577663eebb0888) } + +var fileDescriptor_8e577663eebb0888 = []byte{ + // 386 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x92, 0x31, 0x4f, 0xf2, 0x40, + 0x1c, 0xc6, 0x7b, 0x14, 0xde, 0x57, 0x0f, 0x23, 0x52, 0x31, 0xa9, 0xc4, 0x1c, 0x84, 0x89, 0xa5, + 0x34, 0xea, 0x62, 0x1c, 0xab, 0x4e, 0x46, 0x87, 0x42, 0x1c, 0xdc, 0x0e, 0x7a, 0x96, 0x86, 0xc2, + 0x35, 0xed, 0x95, 0x50, 0x27, 0xfd, 0x06, 0x7e, 0x0c, 0xbf, 0x88, 0x89, 0x23, 0x23, 0x13, 0x91, + 0x63, 0x31, 0x4c, 0x7c, 0x04, 0xd3, 0x2b, 0x09, 0x16, 0x4d, 0x9c, 0x7a, 0xff, 0xdf, 0xd3, 0xe7, + 0x49, 0x9f, 0xde, 0x1f, 0x16, 0x03, 0x86, 0x19, 0xb9, 0xe8, 0xe2, 0x81, 0x4d, 0x1a, 0x9e, 0x4f, + 0x19, 0x55, 0x72, 0xe2, 0x51, 0xd6, 0x6c, 0x87, 0x75, 0xc3, 0x76, 0xa3, 0x43, 0xfb, 0xba, 0x4d, + 0x6d, 0xaa, 0x0b, 0xdc, 0x0e, 0x1f, 0xc4, 0x24, 0x06, 0x71, 0x4a, 0x5c, 0xb5, 0x67, 0x00, 0xf3, + 0xcd, 0x75, 0x96, 0x72, 0x04, 0xb3, 0xad, 0xc8, 0x23, 0x2a, 0xa8, 0x82, 0xfa, 0x8e, 0xb1, 0xb5, + 0x98, 0x56, 0xb2, 0x2c, 0xf2, 0x88, 0x29, 0xa8, 0xd2, 0x82, 0x85, 0x4b, 0xcc, 0x70, 0xcb, 0x77, + 0x56, 0xef, 0x07, 0x6a, 0xa6, 0x2a, 0xd7, 0xf3, 0x27, 0x07, 0x49, 0x5c, 0x23, 0xad, 0x1a, 0xfb, + 0x8b, 0x69, 0xa5, 0x60, 0xa5, 0x1d, 0xe6, 0x66, 0x44, 0xcd, 0x82, 0xbb, 0x69, 0xf4, 0xc7, 0x57, + 0x1c, 0x42, 0xf9, 0x9a, 0x44, 0x6a, 0x46, 0x88, 0xff, 0x17, 0xd3, 0x8a, 0xdc, 0x23, 0x91, 0x19, + 0xb3, 0x58, 0xba, 0xc3, 0xae, 0x2a, 0xaf, 0xa5, 0x21, 0x76, 0xcd, 0x98, 0xd5, 0xde, 0x00, 0x2c, + 0x36, 0x89, 0xef, 0x60, 0xd7, 0x79, 0x24, 0xd6, 0x2d, 0xb5, 0xc8, 0x0d, 0xf6, 0x14, 0x17, 0x16, + 0xd2, 0x30, 0x50, 0x81, 0x68, 0xa4, 0xad, 0x1a, 0xfd, 0xb0, 0x6c, 0x90, 0xe0, 0x6a, 0xc0, 0xfc, + 0x28, 0x69, 0x1a, 0xa4, 0x15, 0x73, 0x33, 0xba, 0x6c, 0xc0, 0xd2, 0x6f, 0x6e, 0x65, 0x0f, 0xc6, + 0x15, 0x44, 0xdd, 0x6d, 0x33, 0x3e, 0x2a, 0x25, 0x98, 0x1b, 0x62, 0x37, 0x24, 0x49, 0x4b, 0x33, + 0x19, 0xce, 0x33, 0x67, 0xc0, 0xe8, 0x8d, 0x67, 0x48, 0x9a, 0xcc, 0x90, 0xb4, 0x9c, 0x21, 0xf0, + 0xc4, 0x11, 0x78, 0xe5, 0x08, 0xbc, 0x73, 0x04, 0xc6, 0x1c, 0x81, 0x09, 0x47, 0xe0, 0x83, 0x23, + 0xf0, 0xc9, 0x91, 0xb4, 0xe4, 0x08, 0xbc, 0xcc, 0x91, 0x34, 0x9e, 0x23, 0x69, 0x32, 0x47, 0xd2, + 0xfd, 0xf1, 0xb7, 0xd5, 0xe8, 0x87, 0x2e, 0x73, 0x86, 0xc4, 0x0f, 0x46, 0x7a, 0x7f, 0xa4, 0x75, + 0xba, 0xd8, 0x19, 0x68, 0x1d, 0xea, 0x13, 0xcd, 0xa6, 0x7a, 0x7c, 0x61, 0xba, 0x58, 0xb0, 0xf6, + 0x3f, 0xf1, 0x13, 0x4e, 0xbf, 0x02, 0x00, 0x00, 0xff, 0xff, 0x02, 0x74, 0xaa, 0xdd, 0x70, 0x02, + 0x00, 0x00, +} + +func (this *StateChange) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*StateChange) + if !ok { + that2, ok := that.(StateChange) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !bytes.Equal(this.Type, that1.Type) { + return false + } + if len(this.DataTrieChanges) != len(that1.DataTrieChanges) { + return false + } + for i := range this.DataTrieChanges { + if !this.DataTrieChanges[i].Equal(that1.DataTrieChanges[i]) { + return false + } + } + return true +} +func (this *DataTrieChange) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*DataTrieChange) + if !ok { + that2, ok := that.(DataTrieChange) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !bytes.Equal(this.Type, that1.Type) { + return false + } + if !bytes.Equal(this.Key, that1.Key) { + return false + } + if !bytes.Equal(this.Val, that1.Val) { + return false + } + return true +} +func (this *SerializedNodeMap) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*SerializedNodeMap) + if !ok { + that2, ok := that.(SerializedNodeMap) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if len(this.SerializedNodes) != len(that1.SerializedNodes) { + return false + } + for i := range this.SerializedNodes { + if !bytes.Equal(this.SerializedNodes[i], that1.SerializedNodes[i]) { + return false + } + } + return true +} +func (this *StateChange) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 6) + s = append(s, "&state.StateChange{") + s = append(s, "Type: "+fmt.Sprintf("%#v", this.Type)+",\n") + if this.DataTrieChanges != nil { + s = append(s, "DataTrieChanges: "+fmt.Sprintf("%#v", this.DataTrieChanges)+",\n") + } + s = append(s, "}") + return strings.Join(s, "") +} +func (this *DataTrieChange) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 7) + s = append(s, "&state.DataTrieChange{") + s = append(s, "Type: "+fmt.Sprintf("%#v", this.Type)+",\n") + s = append(s, "Key: "+fmt.Sprintf("%#v", this.Key)+",\n") + s = append(s, "Val: "+fmt.Sprintf("%#v", this.Val)+",\n") + s = append(s, "}") + return strings.Join(s, "") +} +func (this *SerializedNodeMap) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 5) + s = append(s, "&state.SerializedNodeMap{") + keysForSerializedNodes := make([]string, 0, len(this.SerializedNodes)) + for k, _ := range this.SerializedNodes { + keysForSerializedNodes = append(keysForSerializedNodes, k) + } + github_com_gogo_protobuf_sortkeys.Strings(keysForSerializedNodes) + mapStringForSerializedNodes := "map[string][]byte{" + for _, k := range keysForSerializedNodes { + mapStringForSerializedNodes += fmt.Sprintf("%#v: %#v,", k, this.SerializedNodes[k]) + } + mapStringForSerializedNodes += "}" + if this.SerializedNodes != nil { + s = append(s, "SerializedNodes: "+mapStringForSerializedNodes+",\n") + } + s = append(s, "}") + return strings.Join(s, "") +} +func valueToGoStringStateChange(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 *StateChange) 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 *StateChange) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *StateChange) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.DataTrieChanges) > 0 { + for iNdEx := len(m.DataTrieChanges) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.DataTrieChanges[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintStateChange(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if len(m.Type) > 0 { + i -= len(m.Type) + copy(dAtA[i:], m.Type) + i = encodeVarintStateChange(dAtA, i, uint64(len(m.Type))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *DataTrieChange) 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 *DataTrieChange) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *DataTrieChange) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Val) > 0 { + i -= len(m.Val) + copy(dAtA[i:], m.Val) + i = encodeVarintStateChange(dAtA, i, uint64(len(m.Val))) + i-- + dAtA[i] = 0x1a + } + if len(m.Key) > 0 { + i -= len(m.Key) + copy(dAtA[i:], m.Key) + i = encodeVarintStateChange(dAtA, i, uint64(len(m.Key))) + i-- + dAtA[i] = 0x12 + } + if len(m.Type) > 0 { + i -= len(m.Type) + copy(dAtA[i:], m.Type) + i = encodeVarintStateChange(dAtA, i, uint64(len(m.Type))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *SerializedNodeMap) 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 *SerializedNodeMap) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *SerializedNodeMap) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.SerializedNodes) > 0 { + keysForSerializedNodes := make([]string, 0, len(m.SerializedNodes)) + for k := range m.SerializedNodes { + keysForSerializedNodes = append(keysForSerializedNodes, string(k)) + } + github_com_gogo_protobuf_sortkeys.Strings(keysForSerializedNodes) + for iNdEx := len(keysForSerializedNodes) - 1; iNdEx >= 0; iNdEx-- { + v := m.SerializedNodes[string(keysForSerializedNodes[iNdEx])] + baseI := i + if len(v) > 0 { + i -= len(v) + copy(dAtA[i:], v) + i = encodeVarintStateChange(dAtA, i, uint64(len(v))) + i-- + dAtA[i] = 0x12 + } + i -= len(keysForSerializedNodes[iNdEx]) + copy(dAtA[i:], keysForSerializedNodes[iNdEx]) + i = encodeVarintStateChange(dAtA, i, uint64(len(keysForSerializedNodes[iNdEx]))) + i-- + dAtA[i] = 0xa + i = encodeVarintStateChange(dAtA, i, uint64(baseI-i)) + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func encodeVarintStateChange(dAtA []byte, offset int, v uint64) int { + offset -= sovStateChange(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *StateChange) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Type) + if l > 0 { + n += 1 + l + sovStateChange(uint64(l)) + } + if len(m.DataTrieChanges) > 0 { + for _, e := range m.DataTrieChanges { + l = e.Size() + n += 1 + l + sovStateChange(uint64(l)) + } + } + return n +} + +func (m *DataTrieChange) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Type) + if l > 0 { + n += 1 + l + sovStateChange(uint64(l)) + } + l = len(m.Key) + if l > 0 { + n += 1 + l + sovStateChange(uint64(l)) + } + l = len(m.Val) + if l > 0 { + n += 1 + l + sovStateChange(uint64(l)) + } + return n +} + +func (m *SerializedNodeMap) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.SerializedNodes) > 0 { + for k, v := range m.SerializedNodes { + _ = k + _ = v + l = 0 + if len(v) > 0 { + l = 1 + len(v) + sovStateChange(uint64(len(v))) + } + mapEntrySize := 1 + len(k) + sovStateChange(uint64(len(k))) + l + n += mapEntrySize + 1 + sovStateChange(uint64(mapEntrySize)) + } + } + return n +} + +func sovStateChange(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozStateChange(x uint64) (n int) { + return sovStateChange(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (this *StateChange) String() string { + if this == nil { + return "nil" + } + repeatedStringForDataTrieChanges := "[]*DataTrieChange{" + for _, f := range this.DataTrieChanges { + repeatedStringForDataTrieChanges += strings.Replace(f.String(), "DataTrieChange", "DataTrieChange", 1) + "," + } + repeatedStringForDataTrieChanges += "}" + s := strings.Join([]string{`&StateChange{`, + `Type:` + fmt.Sprintf("%v", this.Type) + `,`, + `DataTrieChanges:` + repeatedStringForDataTrieChanges + `,`, + `}`, + }, "") + return s +} +func (this *DataTrieChange) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&DataTrieChange{`, + `Type:` + fmt.Sprintf("%v", this.Type) + `,`, + `Key:` + fmt.Sprintf("%v", this.Key) + `,`, + `Val:` + fmt.Sprintf("%v", this.Val) + `,`, + `}`, + }, "") + return s +} +func (this *SerializedNodeMap) String() string { + if this == nil { + return "nil" + } + keysForSerializedNodes := make([]string, 0, len(this.SerializedNodes)) + for k, _ := range this.SerializedNodes { + keysForSerializedNodes = append(keysForSerializedNodes, k) + } + github_com_gogo_protobuf_sortkeys.Strings(keysForSerializedNodes) + mapStringForSerializedNodes := "map[string][]byte{" + for _, k := range keysForSerializedNodes { + mapStringForSerializedNodes += fmt.Sprintf("%v: %v,", k, this.SerializedNodes[k]) + } + mapStringForSerializedNodes += "}" + s := strings.Join([]string{`&SerializedNodeMap{`, + `SerializedNodes:` + mapStringForSerializedNodes + `,`, + `}`, + }, "") + return s +} +func valueToStringStateChange(v interface{}) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("*%v", pv) +} +func (m *StateChange) 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 ErrIntOverflowStateChange + } + 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: StateChange: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: StateChange: 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 byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStateChange + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthStateChange + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthStateChange + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Type = append(m.Type[:0], dAtA[iNdEx:postIndex]...) + if m.Type == nil { + m.Type = []byte{} + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DataTrieChanges", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStateChange + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthStateChange + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthStateChange + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DataTrieChanges = append(m.DataTrieChanges, &DataTrieChange{}) + if err := m.DataTrieChanges[len(m.DataTrieChanges)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipStateChange(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthStateChange + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthStateChange + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DataTrieChange) 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 ErrIntOverflowStateChange + } + 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: DataTrieChange: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DataTrieChange: 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 byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStateChange + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthStateChange + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthStateChange + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Type = append(m.Type[:0], dAtA[iNdEx:postIndex]...) + if m.Type == nil { + m.Type = []byte{} + } + 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 ErrIntOverflowStateChange + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthStateChange + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthStateChange + } + 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 Val", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStateChange + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthStateChange + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthStateChange + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Val = append(m.Val[:0], dAtA[iNdEx:postIndex]...) + if m.Val == nil { + m.Val = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipStateChange(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthStateChange + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthStateChange + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *SerializedNodeMap) 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 ErrIntOverflowStateChange + } + 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: SerializedNodeMap: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SerializedNodeMap: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SerializedNodes", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStateChange + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthStateChange + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthStateChange + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.SerializedNodes == nil { + m.SerializedNodes = make(map[string][]byte) + } + var mapkey string + mapvalue := []byte{} + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStateChange + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + var stringLenmapkey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStateChange + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapkey |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapkey := int(stringLenmapkey) + if intStringLenmapkey < 0 { + return ErrInvalidLengthStateChange + } + postStringIndexmapkey := iNdEx + intStringLenmapkey + if postStringIndexmapkey < 0 { + return ErrInvalidLengthStateChange + } + if postStringIndexmapkey > l { + return io.ErrUnexpectedEOF + } + mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) + iNdEx = postStringIndexmapkey + } else if fieldNum == 2 { + var mapbyteLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStateChange + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + mapbyteLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intMapbyteLen := int(mapbyteLen) + if intMapbyteLen < 0 { + return ErrInvalidLengthStateChange + } + postbytesIndex := iNdEx + intMapbyteLen + if postbytesIndex < 0 { + return ErrInvalidLengthStateChange + } + if postbytesIndex > l { + return io.ErrUnexpectedEOF + } + mapvalue = make([]byte, mapbyteLen) + copy(mapvalue, dAtA[iNdEx:postbytesIndex]) + iNdEx = postbytesIndex + } else { + iNdEx = entryPreIndex + skippy, err := skipStateChange(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthStateChange + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + m.SerializedNodes[mapkey] = mapvalue + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipStateChange(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthStateChange + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthStateChange + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipStateChange(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, ErrIntOverflowStateChange + } + 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, ErrIntOverflowStateChange + } + 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, ErrIntOverflowStateChange + } + 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, ErrInvalidLengthStateChange + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupStateChange + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthStateChange + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthStateChange = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowStateChange = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupStateChange = fmt.Errorf("proto: unexpected end of group") +) diff --git a/data/state/stateChange.proto b/data/state/stateChange.proto new file mode 100644 index 00000000..7810533f --- /dev/null +++ b/data/state/stateChange.proto @@ -0,0 +1,30 @@ + +syntax = "proto3"; + +package proto; + +option go_package = "github.com/multiversx/mx-chain-core-go/data/state"; +option (gogoproto.stable_marshaler_all) = true; + +import "github.com/gogo/protobuf/gogoproto/gogo.proto"; + +// StateChange is used to collect state changes +message StateChange { + bytes Type = 1 [(gogoproto.jsontag) = "type"]; + repeated DataTrieChange DataTrieChanges = 2 [(gogoproto.jsontag) = "dataTrieChanges"]; +} + + +// DataTrieChange represents a change in the data trie +message DataTrieChange { + bytes Type = 1 [(gogoproto.jsontag) = "type"]; + bytes Key = 2 [(gogoproto.jsontag) = "key"]; + bytes Val = 3 [(gogoproto.jsontag) = "val"]; +} + + +// SerializedNodeMap represents a map with key node hash and data node bytes +message SerializedNodeMap { + map SerializedNodes = 1 [(gogoproto.jsontag) = "serializedNodes"]; +} +