diff --git a/pkg/acl/aclchanges/aclpb/aclchanges.pb.go b/pkg/acl/aclchanges/aclpb/aclchanges.pb.go index 1cce6bf3..4a892fdf 100644 --- a/pkg/acl/aclchanges/aclpb/aclchanges.pb.go +++ b/pkg/acl/aclchanges/aclpb/aclchanges.pb.go @@ -50,7 +50,67 @@ func (x ACLChangeUserPermissions) String() string { } func (ACLChangeUserPermissions) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_37a022c841a51877, []int{0, 0} + return fileDescriptor_37a022c841a51877, []int{1, 0} +} + +type RawChange struct { + Payload []byte `protobuf:"bytes,1,opt,name=payload,proto3" json:"payload,omitempty"` + Signature []byte `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` + Id string `protobuf:"bytes,3,opt,name=id,proto3" json:"id,omitempty"` +} + +func (m *RawChange) Reset() { *m = RawChange{} } +func (m *RawChange) String() string { return proto.CompactTextString(m) } +func (*RawChange) ProtoMessage() {} +func (*RawChange) Descriptor() ([]byte, []int) { + return fileDescriptor_37a022c841a51877, []int{0} +} +func (m *RawChange) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *RawChange) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_RawChange.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *RawChange) XXX_Merge(src proto.Message) { + xxx_messageInfo_RawChange.Merge(m, src) +} +func (m *RawChange) XXX_Size() int { + return m.Size() +} +func (m *RawChange) XXX_DiscardUnknown() { + xxx_messageInfo_RawChange.DiscardUnknown(m) +} + +var xxx_messageInfo_RawChange proto.InternalMessageInfo + +func (m *RawChange) GetPayload() []byte { + if m != nil { + return m.Payload + } + return nil +} + +func (m *RawChange) GetSignature() []byte { + if m != nil { + return m.Signature + } + return nil +} + +func (m *RawChange) GetId() string { + if m != nil { + return m.Id + } + return "" } // the element of change tree used to store and internal apply smartBlock history @@ -70,7 +130,7 @@ func (m *ACLChange) Reset() { *m = ACLChange{} } func (m *ACLChange) String() string { return proto.CompactTextString(m) } func (*ACLChange) ProtoMessage() {} func (*ACLChange) Descriptor() ([]byte, []int) { - return fileDescriptor_37a022c841a51877, []int{0} + return fileDescriptor_37a022c841a51877, []int{1} } func (m *ACLChange) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -170,7 +230,7 @@ func (m *ACLChangeACLContentValue) Reset() { *m = ACLChangeACLContentVal func (m *ACLChangeACLContentValue) String() string { return proto.CompactTextString(m) } func (*ACLChangeACLContentValue) ProtoMessage() {} func (*ACLChangeACLContentValue) Descriptor() ([]byte, []int) { - return fileDescriptor_37a022c841a51877, []int{0, 0} + return fileDescriptor_37a022c841a51877, []int{1, 0} } func (m *ACLChangeACLContentValue) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -301,7 +361,7 @@ func (m *ACLChangeACLData) Reset() { *m = ACLChangeACLData{} } func (m *ACLChangeACLData) String() string { return proto.CompactTextString(m) } func (*ACLChangeACLData) ProtoMessage() {} func (*ACLChangeACLData) Descriptor() ([]byte, []int) { - return fileDescriptor_37a022c841a51877, []int{0, 1} + return fileDescriptor_37a022c841a51877, []int{1, 1} } func (m *ACLChangeACLData) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -353,7 +413,7 @@ func (m *ACLChangeACLSnapshot) Reset() { *m = ACLChangeACLSnapshot{} } func (m *ACLChangeACLSnapshot) String() string { return proto.CompactTextString(m) } func (*ACLChangeACLSnapshot) ProtoMessage() {} func (*ACLChangeACLSnapshot) Descriptor() ([]byte, []int) { - return fileDescriptor_37a022c841a51877, []int{0, 2} + return fileDescriptor_37a022c841a51877, []int{1, 2} } func (m *ACLChangeACLSnapshot) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -399,7 +459,7 @@ func (m *ACLChangeACLState) Reset() { *m = ACLChangeACLState{} } func (m *ACLChangeACLState) String() string { return proto.CompactTextString(m) } func (*ACLChangeACLState) ProtoMessage() {} func (*ACLChangeACLState) Descriptor() ([]byte, []int) { - return fileDescriptor_37a022c841a51877, []int{0, 3} + return fileDescriptor_37a022c841a51877, []int{1, 3} } func (m *ACLChangeACLState) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -461,7 +521,7 @@ func (m *ACLChangeUserState) Reset() { *m = ACLChangeUserState{} } func (m *ACLChangeUserState) String() string { return proto.CompactTextString(m) } func (*ACLChangeUserState) ProtoMessage() {} func (*ACLChangeUserState) Descriptor() ([]byte, []int) { - return fileDescriptor_37a022c841a51877, []int{0, 4} + return fileDescriptor_37a022c841a51877, []int{1, 4} } func (m *ACLChangeUserState) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -537,7 +597,7 @@ func (m *ACLChangeUserAdd) Reset() { *m = ACLChangeUserAdd{} } func (m *ACLChangeUserAdd) String() string { return proto.CompactTextString(m) } func (*ACLChangeUserAdd) ProtoMessage() {} func (*ACLChangeUserAdd) Descriptor() ([]byte, []int) { - return fileDescriptor_37a022c841a51877, []int{0, 5} + return fileDescriptor_37a022c841a51877, []int{1, 5} } func (m *ACLChangeUserAdd) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -604,7 +664,7 @@ func (m *ACLChangeUserConfirm) Reset() { *m = ACLChangeUserConfirm{} } func (m *ACLChangeUserConfirm) String() string { return proto.CompactTextString(m) } func (*ACLChangeUserConfirm) ProtoMessage() {} func (*ACLChangeUserConfirm) Descriptor() ([]byte, []int) { - return fileDescriptor_37a022c841a51877, []int{0, 6} + return fileDescriptor_37a022c841a51877, []int{1, 6} } func (m *ACLChangeUserConfirm) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -659,7 +719,7 @@ func (m *ACLChangeUserInvite) Reset() { *m = ACLChangeUserInvite{} } func (m *ACLChangeUserInvite) String() string { return proto.CompactTextString(m) } func (*ACLChangeUserInvite) ProtoMessage() {} func (*ACLChangeUserInvite) Descriptor() ([]byte, []int) { - return fileDescriptor_37a022c841a51877, []int{0, 7} + return fileDescriptor_37a022c841a51877, []int{1, 7} } func (m *ACLChangeUserInvite) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -735,7 +795,7 @@ func (m *ACLChangeUserJoin) Reset() { *m = ACLChangeUserJoin{} } func (m *ACLChangeUserJoin) String() string { return proto.CompactTextString(m) } func (*ACLChangeUserJoin) ProtoMessage() {} func (*ACLChangeUserJoin) Descriptor() ([]byte, []int) { - return fileDescriptor_37a022c841a51877, []int{0, 8} + return fileDescriptor_37a022c841a51877, []int{1, 8} } func (m *ACLChangeUserJoin) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -808,7 +868,7 @@ func (m *ACLChangeUserRemove) Reset() { *m = ACLChangeUserRemove{} } func (m *ACLChangeUserRemove) String() string { return proto.CompactTextString(m) } func (*ACLChangeUserRemove) ProtoMessage() {} func (*ACLChangeUserRemove) Descriptor() ([]byte, []int) { - return fileDescriptor_37a022c841a51877, []int{0, 9} + return fileDescriptor_37a022c841a51877, []int{1, 9} } func (m *ACLChangeUserRemove) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -861,7 +921,7 @@ func (m *ACLChangeReadKeyReplace) Reset() { *m = ACLChangeReadKeyReplace func (m *ACLChangeReadKeyReplace) String() string { return proto.CompactTextString(m) } func (*ACLChangeReadKeyReplace) ProtoMessage() {} func (*ACLChangeReadKeyReplace) Descriptor() ([]byte, []int) { - return fileDescriptor_37a022c841a51877, []int{0, 10} + return fileDescriptor_37a022c841a51877, []int{1, 10} } func (m *ACLChangeReadKeyReplace) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -920,7 +980,7 @@ func (m *ACLChangeUserPermissionChange) Reset() { *m = ACLChangeUserPerm func (m *ACLChangeUserPermissionChange) String() string { return proto.CompactTextString(m) } func (*ACLChangeUserPermissionChange) ProtoMessage() {} func (*ACLChangeUserPermissionChange) Descriptor() ([]byte, []int) { - return fileDescriptor_37a022c841a51877, []int{0, 11} + return fileDescriptor_37a022c841a51877, []int{1, 11} } func (m *ACLChangeUserPermissionChange) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -965,6 +1025,7 @@ func (m *ACLChangeUserPermissionChange) GetPermissions() ACLChangeUserPermission func init() { proto.RegisterEnum("acl.ACLChangeUserPermissions", ACLChangeUserPermissions_name, ACLChangeUserPermissions_value) + proto.RegisterType((*RawChange)(nil), "acl.RawChange") proto.RegisterType((*ACLChange)(nil), "acl.ACLChange") proto.RegisterType((*ACLChangeACLContentValue)(nil), "acl.ACLChange.ACLContentValue") proto.RegisterType((*ACLChangeACLData)(nil), "acl.ACLChange.ACLData") @@ -986,64 +1047,111 @@ func init() { } var fileDescriptor_37a022c841a51877 = []byte{ - // 912 bytes of a gzipped FileDescriptorProto + // 948 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x56, 0x4f, 0x6f, 0xe3, 0x44, - 0x14, 0xf7, 0x24, 0x4d, 0x13, 0x3f, 0x87, 0x36, 0x0c, 0x2b, 0xd6, 0x8c, 0x96, 0x10, 0x95, 0x15, - 0x8a, 0x10, 0x4a, 0x57, 0x59, 0x21, 0xad, 0x00, 0x55, 0xb4, 0x05, 0x6d, 0x42, 0x39, 0xac, 0x66, - 0xb5, 0x20, 0xb8, 0x4d, 0xed, 0xa1, 0xb5, 0xd6, 0xb1, 0x8d, 0x67, 0x52, 0x29, 0x17, 0x24, 0x4e, - 0x5c, 0x39, 0xf3, 0x55, 0xf8, 0x02, 0x7b, 0xdc, 0x23, 0x37, 0x50, 0x7b, 0xe7, 0xc2, 0x17, 0x40, - 0xf3, 0xc7, 0x8e, 0x93, 0x78, 0x23, 0x21, 0x55, 0x48, 0x7b, 0xa8, 0x34, 0xf3, 0x7b, 0xbf, 0x37, - 0x7d, 0x7f, 0x7e, 0xef, 0x39, 0xf0, 0x20, 0x7b, 0x7e, 0x71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x28, 0xd6, 0xfa, 0xa9, 0xf5, 0xaf, 0xfb, 0xe9, 0xe0, + 0x18, 0xf6, 0xd7, 0xec, 0xd8, 0x85, 0xf6, 0x71, 0x34, 0x8b, 0xd3, 0x9e, 0x85, 0x01, 0x76, 0xbf, + 0x2e, 0x62, 0xc1, 0x8a, 0x1e, 0x92, 0x67, 0x19, 0x2a, 0x2b, 0x7a, 0x2d, 0xec, 0x81, 0xa3, 0xa5, + 0x89, 0x7a, 0xf6, 0xc9, 0x3b, 0xcf, 0x6f, 0xfa, 0xe8, 0xc5, 0x4d, 0x1f, 0xfd, 0x79, 0xd3, 0x47, + 0xbf, 0xdc, 0xf6, 0xad, 0x17, 0xb7, 0x7d, 0xeb, 0xf7, 0xdb, 0xbe, 0xf5, 0x6d, 0x5b, 0x7d, 0x88, + 0x5e, 0xec, 0xaa, 0xef, 0xce, 0x87, 0xff, 0x04, 0x00, 0x00, 0xff, 0xff, 0x2a, 0xe8, 0x23, 0x71, + 0xab, 0x0a, 0x00, 0x00, +} + +func (m *RawChange) 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 *RawChange) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *RawChange) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Id) > 0 { + i -= len(m.Id) + copy(dAtA[i:], m.Id) + i = encodeVarintAclchanges(dAtA, i, uint64(len(m.Id))) + i-- + dAtA[i] = 0x1a + } + if len(m.Signature) > 0 { + i -= len(m.Signature) + copy(dAtA[i:], m.Signature) + i = encodeVarintAclchanges(dAtA, i, uint64(len(m.Signature))) + i-- + dAtA[i] = 0x12 + } + if len(m.Payload) > 0 { + i -= len(m.Payload) + copy(dAtA[i:], m.Payload) + i = encodeVarintAclchanges(dAtA, i, uint64(len(m.Payload))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil } func (m *ACLChange) Marshal() (dAtA []byte, err error) { @@ -1854,6 +1962,27 @@ func encodeVarintAclchanges(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } +func (m *RawChange) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Payload) + if l > 0 { + n += 1 + l + sovAclchanges(uint64(l)) + } + l = len(m.Signature) + if l > 0 { + n += 1 + l + sovAclchanges(uint64(l)) + } + l = len(m.Id) + if l > 0 { + n += 1 + l + sovAclchanges(uint64(l)) + } + return n +} + func (m *ACLChange) Size() (n int) { if m == nil { return 0 @@ -2243,6 +2372,156 @@ func sovAclchanges(x uint64) (n int) { func sozAclchanges(x uint64) (n int) { return sovAclchanges(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } +func (m *RawChange) 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 ErrIntOverflowAclchanges + } + 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: RawChange: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RawChange: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Payload", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAclchanges + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthAclchanges + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthAclchanges + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Payload = append(m.Payload[:0], dAtA[iNdEx:postIndex]...) + if m.Payload == nil { + m.Payload = []byte{} + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Signature", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAclchanges + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthAclchanges + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthAclchanges + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Signature = append(m.Signature[:0], dAtA[iNdEx:postIndex]...) + if m.Signature == nil { + m.Signature = []byte{} + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAclchanges + } + 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 ErrInvalidLengthAclchanges + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthAclchanges + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Id = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipAclchanges(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthAclchanges + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *ACLChange) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 diff --git a/pkg/acl/aclchanges/aclpb/protos/aclchanges.proto b/pkg/acl/aclchanges/aclpb/protos/aclchanges.proto index 1906e1e5..1c8ceaf2 100644 --- a/pkg/acl/aclchanges/aclpb/protos/aclchanges.proto +++ b/pkg/acl/aclchanges/aclpb/protos/aclchanges.proto @@ -2,6 +2,12 @@ syntax = "proto3"; package acl; option go_package = "aclpb"; +message RawChange { + bytes payload = 1; + bytes signature = 2; + string id = 3; +} + // the element of change tree used to store and internal apply smartBlock history message ACLChange { repeated string treeHeadIds = 1; diff --git a/pkg/acl/acltree/acltree.go b/pkg/acl/acltree/acltree.go index 5d5b770d..9761e545 100644 --- a/pkg/acl/acltree/acltree.go +++ b/pkg/acl/acltree/acltree.go @@ -3,6 +3,7 @@ package acltree import ( "context" "github.com/anytypeio/go-anytype-infrastructure-experiments/pkg/acl/account" + "github.com/anytypeio/go-anytype-infrastructure-experiments/pkg/acl/aclchanges/aclpb" "github.com/anytypeio/go-anytype-infrastructure-experiments/pkg/acl/treestorage" "sync" ) @@ -228,7 +229,7 @@ func (a *aclTree) AddContent(ctx context.Context, build func(builder ChangeBuild } a.fullTree.AddFast(ch) - err = a.treeStorage.AddRawChange(&treestorage.RawChange{ + err = a.treeStorage.AddRawChange(&aclpb.RawChange{ Payload: marshalled, Signature: ch.Signature(), Id: ch.Id, diff --git a/pkg/acl/acltree/acltreestorage.go b/pkg/acl/acltree/acltreestorage.go index f5fe18c0..51d7d86d 100644 --- a/pkg/acl/acltree/acltreestorage.go +++ b/pkg/acl/acltree/acltreestorage.go @@ -2,6 +2,7 @@ package acltree import ( "github.com/anytypeio/go-anytype-infrastructure-experiments/pkg/acl/account" + "github.com/anytypeio/go-anytype-infrastructure-experiments/pkg/acl/aclchanges/aclpb" "github.com/anytypeio/go-anytype-infrastructure-experiments/pkg/acl/treestorage" "github.com/anytypeio/go-anytype-infrastructure-experiments/util/keys/asymmetric/signingkey" ) @@ -9,7 +10,7 @@ import ( func BuildTreeStorageWithACL( acc *account.AccountData, build func(builder ChangeBuilder) error, - create func(change *treestorage.RawChange) (treestorage.TreeStorage, error)) (treestorage.TreeStorage, error) { + create func(change *aclpb.RawChange) (treestorage.TreeStorage, error)) (treestorage.TreeStorage, error) { bld := newChangeBuilder() bld.Init( newACLState(acc.Identity, acc.EncKey, signingkey.NewEd25519PubKeyDecoder()), @@ -26,7 +27,7 @@ func BuildTreeStorageWithACL( return nil, err } - rawChange := &treestorage.RawChange{ + rawChange := &aclpb.RawChange{ Payload: payload, Signature: change.Signature(), Id: change.CID(), diff --git a/pkg/acl/acltree/change.go b/pkg/acl/acltree/change.go index 799a549f..c768ef23 100644 --- a/pkg/acl/acltree/change.go +++ b/pkg/acl/acltree/change.go @@ -3,7 +3,6 @@ package acltree import ( "fmt" "github.com/anytypeio/go-anytype-infrastructure-experiments/pkg/acl/aclchanges/aclpb" - "github.com/anytypeio/go-anytype-infrastructure-experiments/pkg/acl/treestorage" "github.com/gogo/protobuf/proto" "github.com/anytypeio/go-anytype-infrastructure-experiments/util/keys/symmetric" @@ -47,7 +46,7 @@ func (ch *Change) IsACLChange() bool { return ch.Content.GetAclData() != nil } -func NewFromRawChange(rawChange *treestorage.RawChange) (*Change, error) { +func NewFromRawChange(rawChange *aclpb.RawChange) (*Change, error) { unmarshalled := &aclpb.ACLChange{} err := proto.Unmarshal(rawChange.Payload, unmarshalled) if err != nil { diff --git a/pkg/acl/acltree/changeloader.go b/pkg/acl/acltree/changeloader.go index 658ac58f..d3b57a32 100644 --- a/pkg/acl/acltree/changeloader.go +++ b/pkg/acl/acltree/changeloader.go @@ -73,7 +73,7 @@ func (c *changeLoader) verify(identity string, payload, signature []byte) (isVer return identityKey.Verify(payload, signature) } -func (c *changeLoader) makeVerifiedACLChange(change *treestorage.RawChange) (aclChange *aclpb.ACLChange, err error) { +func (c *changeLoader) makeVerifiedACLChange(change *aclpb.RawChange) (aclChange *aclpb.ACLChange, err error) { aclChange = new(aclpb.ACLChange) // TODO: think what should we do with such cases, because this can be used by attacker to break our Tree diff --git a/pkg/acl/example/plaintextdocument/document.go b/pkg/acl/example/plaintextdocument/document.go index a38b6d3c..80e760b0 100644 --- a/pkg/acl/example/plaintextdocument/document.go +++ b/pkg/acl/example/plaintextdocument/document.go @@ -117,7 +117,7 @@ func NewInMemoryPlainTextDocument(acc *account.AccountData, text string) (PlainT func NewPlainTextDocument( acc *account.AccountData, - create func(change *treestorage.RawChange) (treestorage.TreeStorage, error), + create func(change *aclpb.RawChange) (treestorage.TreeStorage, error), text string) (PlainTextDocument, error) { changeBuilder := func(builder acltree.ChangeBuilder) error { err := builder.UserAdd(acc.Identity, acc.EncKey.GetPublic(), aclpb.ACLChange_Admin) diff --git a/pkg/acl/testutils/treestoragebuilder/treestoragebuilder.go b/pkg/acl/testutils/treestoragebuilder/treestoragebuilder.go index b48595ca..f7bb65bd 100644 --- a/pkg/acl/testutils/treestoragebuilder/treestoragebuilder.go +++ b/pkg/acl/testutils/treestoragebuilder/treestoragebuilder.go @@ -7,7 +7,6 @@ import ( "github.com/anytypeio/go-anytype-infrastructure-experiments/pkg/acl/aclchanges/aclpb" testpb "github.com/anytypeio/go-anytype-infrastructure-experiments/pkg/acl/testutils/testchanges/testchangepb" "github.com/anytypeio/go-anytype-infrastructure-experiments/pkg/acl/testutils/yamltests" - "github.com/anytypeio/go-anytype-infrastructure-experiments/pkg/acl/treestorage" storagepb "github.com/anytypeio/go-anytype-infrastructure-experiments/pkg/acl/treestorage/treepb" "github.com/anytypeio/go-anytype-infrastructure-experiments/util/keys/asymmetric/encryptionkey" "github.com/anytypeio/go-anytype-infrastructure-experiments/util/keys/asymmetric/signingkey" @@ -87,7 +86,7 @@ func (t *TreeStorageBuilder) Heads() ([]string, error) { return t.heads, nil } -func (t *TreeStorageBuilder) AddRawChange(change *treestorage.RawChange) error { +func (t *TreeStorageBuilder) AddRawChange(change *aclpb.RawChange) error { aclChange := new(aclpb.ACLChange) var err error @@ -165,12 +164,12 @@ func (t *TreeStorageBuilder) RemoveOrphans(orphans ...string) error { return nil } -func (t *TreeStorageBuilder) GetChange(ctx context.Context, recordID string) (*treestorage.RawChange, error) { +func (t *TreeStorageBuilder) GetChange(ctx context.Context, recordID string) (*aclpb.RawChange, error) { return t.getChange(recordID, t.allChanges), nil } -func (t *TreeStorageBuilder) GetUpdates(useCase string) []*treestorage.RawChange { - var res []*treestorage.RawChange +func (t *TreeStorageBuilder) GetUpdates(useCase string) []*aclpb.RawChange { + var res []*aclpb.RawChange update := t.updates[useCase] for _, ch := range update.changes { rawCh := t.getChange(ch.id, update.changes) @@ -183,7 +182,7 @@ func (t *TreeStorageBuilder) Header() (*storagepb.TreeHeader, error) { return t.header, nil } -func (t *TreeStorageBuilder) getChange(changeId string, m map[string]*treeChange) *treestorage.RawChange { +func (t *TreeStorageBuilder) getChange(changeId string, m map[string]*treeChange) *aclpb.RawChange { rec := m[changeId] if rec.changesDataDecrypted != nil { @@ -205,7 +204,7 @@ func (t *TreeStorageBuilder) getChange(changeId string, m map[string]*treeChange panic("should be able to sign final acl message!") } - transformedRec := &treestorage.RawChange{ + transformedRec := &aclpb.RawChange{ Payload: aclMarshaled, Signature: signature, Id: changeId, diff --git a/pkg/acl/treestorage/inmemory.go b/pkg/acl/treestorage/inmemory.go index 5cebd9d9..3120d27a 100644 --- a/pkg/acl/treestorage/inmemory.go +++ b/pkg/acl/treestorage/inmemory.go @@ -4,6 +4,7 @@ import ( "context" "fmt" "github.com/anytypeio/go-anytype-infrastructure-experiments/pkg/acl/aclchanges" + "github.com/anytypeio/go-anytype-infrastructure-experiments/pkg/acl/aclchanges/aclpb" "github.com/anytypeio/go-anytype-infrastructure-experiments/pkg/acl/treestorage/treepb" "github.com/anytypeio/go-anytype-infrastructure-experiments/util/cid" "github.com/anytypeio/go-anytype-infrastructure-experiments/util/slice" @@ -16,12 +17,12 @@ type inMemoryTreeStorage struct { header *treepb.TreeHeader heads []string orphans []string - changes map[string]*RawChange + changes map[string]*aclpb.RawChange sync.RWMutex } -func NewInMemoryTreeStorage(firstChange *RawChange) (TreeStorage, error) { +func NewInMemoryTreeStorage(firstChange *aclpb.RawChange) (TreeStorage, error) { header := &treepb.TreeHeader{ FirstChangeId: firstChange.Id, IsWorkspace: false, @@ -35,7 +36,7 @@ func NewInMemoryTreeStorage(firstChange *RawChange) (TreeStorage, error) { return nil, err } - changes := make(map[string]*RawChange) + changes := make(map[string]*aclpb.RawChange) changes[firstChange.Id] = firstChange return &inMemoryTreeStorage{ @@ -97,7 +98,7 @@ func (t *inMemoryTreeStorage) AddOrphans(orphans ...string) error { return nil } -func (t *inMemoryTreeStorage) AddRawChange(change *RawChange) error { +func (t *inMemoryTreeStorage) AddRawChange(change *aclpb.RawChange) error { t.Lock() defer t.Unlock() // TODO: better to do deep copy @@ -116,7 +117,7 @@ func (t *inMemoryTreeStorage) AddChange(change aclchanges.Change) error { if err != nil { return err } - rawChange := &RawChange{ + rawChange := &aclpb.RawChange{ Payload: fullMarshalledChange, Signature: signature, Id: id, @@ -125,7 +126,7 @@ func (t *inMemoryTreeStorage) AddChange(change aclchanges.Change) error { return nil } -func (t *inMemoryTreeStorage) GetChange(ctx context.Context, changeId string) (*RawChange, error) { +func (t *inMemoryTreeStorage) GetChange(ctx context.Context, changeId string) (*aclpb.RawChange, error) { t.RLock() defer t.RUnlock() if res, exists := t.changes[changeId]; exists { diff --git a/pkg/acl/treestorage/storage.go b/pkg/acl/treestorage/storage.go index 44a3effc..df47d809 100644 --- a/pkg/acl/treestorage/storage.go +++ b/pkg/acl/treestorage/storage.go @@ -3,6 +3,7 @@ package treestorage import ( "context" "github.com/anytypeio/go-anytype-infrastructure-experiments/pkg/acl/aclchanges" + "github.com/anytypeio/go-anytype-infrastructure-experiments/pkg/acl/aclchanges/aclpb" "github.com/anytypeio/go-anytype-infrastructure-experiments/pkg/acl/treestorage/treepb" ) @@ -16,15 +17,9 @@ type TreeStorage interface { RemoveOrphans(orphan ...string) error AddOrphans(orphan ...string) error - AddRawChange(change *RawChange) error + AddRawChange(change *aclpb.RawChange) error AddChange(change aclchanges.Change) error // TODO: have methods with raw changes also - GetChange(ctx context.Context, recordID string) (*RawChange, error) -} - -type RawChange struct { - Payload []byte - Signature []byte - Id string + GetChange(ctx context.Context, recordID string) (*aclpb.RawChange, error) } diff --git a/service/sync/syncpb/protos/sync.proto b/service/sync/syncpb/protos/sync.proto index ca2c3fb8..b1ab6905 100644 --- a/service/sync/syncpb/protos/sync.proto +++ b/service/sync/syncpb/protos/sync.proto @@ -7,8 +7,8 @@ import "pkg/acl/aclchanges/aclpb/protos/aclchanges.proto"; message Sync { message HeadUpdate { repeated Head heads = 1; - repeated acl.ACLChange changes = 2; - string senderId = 3; + repeated acl.RawChange changes = 2; + string treeId = 3; } message Head { @@ -20,12 +20,14 @@ message Sync { // here with send the request with all changes we have (we already know sender's snapshot path) message Request { repeated Head heads = 1; - repeated acl.ACLChange changes = 2; + repeated acl.RawChange changes = 2; + string treeId = 3; } message Response { repeated Head heads = 1; - repeated acl.ACLChange changes = 2; + repeated acl.RawChange changes = 2; + string treeId = 3; } } } \ No newline at end of file diff --git a/service/sync/syncpb/sync.pb.go b/service/sync/syncpb/sync.pb.go index 12ddf234..889ae169 100644 --- a/service/sync/syncpb/sync.pb.go +++ b/service/sync/syncpb/sync.pb.go @@ -60,9 +60,9 @@ func (m *Sync) XXX_DiscardUnknown() { var xxx_messageInfo_Sync proto.InternalMessageInfo type SyncHeadUpdate struct { - Heads []*SyncHead `protobuf:"bytes,1,rep,name=heads,proto3" json:"heads,omitempty"` - Changes []*aclpb.ACLChange `protobuf:"bytes,2,rep,name=changes,proto3" json:"changes,omitempty"` - SenderId string `protobuf:"bytes,3,opt,name=senderId,proto3" json:"senderId,omitempty"` + Heads []*SyncHead `protobuf:"bytes,1,rep,name=heads,proto3" json:"heads,omitempty"` + Changes []*aclpb.RawChange `protobuf:"bytes,2,rep,name=changes,proto3" json:"changes,omitempty"` + TreeId string `protobuf:"bytes,3,opt,name=treeId,proto3" json:"treeId,omitempty"` } func (m *SyncHeadUpdate) Reset() { *m = SyncHeadUpdate{} } @@ -105,16 +105,16 @@ func (m *SyncHeadUpdate) GetHeads() []*SyncHead { return nil } -func (m *SyncHeadUpdate) GetChanges() []*aclpb.ACLChange { +func (m *SyncHeadUpdate) GetChanges() []*aclpb.RawChange { if m != nil { return m.Changes } return nil } -func (m *SyncHeadUpdate) GetSenderId() string { +func (m *SyncHeadUpdate) GetTreeId() string { if m != nil { - return m.SenderId + return m.TreeId } return "" } @@ -210,7 +210,8 @@ var xxx_messageInfo_SyncFull proto.InternalMessageInfo // here with send the request with all changes we have (we already know sender's snapshot path) type SyncFullRequest struct { Heads []*SyncHead `protobuf:"bytes,1,rep,name=heads,proto3" json:"heads,omitempty"` - Changes []*aclpb.ACLChange `protobuf:"bytes,2,rep,name=changes,proto3" json:"changes,omitempty"` + Changes []*aclpb.RawChange `protobuf:"bytes,2,rep,name=changes,proto3" json:"changes,omitempty"` + TreeId string `protobuf:"bytes,3,opt,name=treeId,proto3" json:"treeId,omitempty"` } func (m *SyncFullRequest) Reset() { *m = SyncFullRequest{} } @@ -253,16 +254,24 @@ func (m *SyncFullRequest) GetHeads() []*SyncHead { return nil } -func (m *SyncFullRequest) GetChanges() []*aclpb.ACLChange { +func (m *SyncFullRequest) GetChanges() []*aclpb.RawChange { if m != nil { return m.Changes } return nil } +func (m *SyncFullRequest) GetTreeId() string { + if m != nil { + return m.TreeId + } + return "" +} + type SyncFullResponse struct { Heads []*SyncHead `protobuf:"bytes,1,rep,name=heads,proto3" json:"heads,omitempty"` - Changes []*aclpb.ACLChange `protobuf:"bytes,2,rep,name=changes,proto3" json:"changes,omitempty"` + Changes []*aclpb.RawChange `protobuf:"bytes,2,rep,name=changes,proto3" json:"changes,omitempty"` + TreeId string `protobuf:"bytes,3,opt,name=treeId,proto3" json:"treeId,omitempty"` } func (m *SyncFullResponse) Reset() { *m = SyncFullResponse{} } @@ -305,13 +314,20 @@ func (m *SyncFullResponse) GetHeads() []*SyncHead { return nil } -func (m *SyncFullResponse) GetChanges() []*aclpb.ACLChange { +func (m *SyncFullResponse) GetChanges() []*aclpb.RawChange { if m != nil { return m.Changes } return nil } +func (m *SyncFullResponse) GetTreeId() string { + if m != nil { + return m.TreeId + } + return "" +} + func init() { proto.RegisterType((*Sync)(nil), "anytype.Sync") proto.RegisterType((*SyncHeadUpdate)(nil), "anytype.Sync.HeadUpdate") @@ -326,26 +342,26 @@ func init() { } var fileDescriptor_5f66cdd599c6466f = []byte{ - // 300 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x2d, 0x4e, 0x2d, 0x2a, - 0xcb, 0x4c, 0x4e, 0xd5, 0x2f, 0xae, 0xcc, 0x4b, 0x06, 0x13, 0x05, 0x49, 0xfa, 0x05, 0x45, 0xf9, - 0x25, 0xf9, 0xc5, 0x60, 0x9e, 0x1e, 0x98, 0x2d, 0xc4, 0x9e, 0x98, 0x57, 0x59, 0x52, 0x59, 0x90, - 0x2a, 0x65, 0x50, 0x90, 0x9d, 0xae, 0x9f, 0x98, 0x9c, 0x03, 0xc2, 0xc9, 0x19, 0x89, 0x79, 0xe9, - 0xa9, 0xc5, 0x20, 0x26, 0x42, 0x13, 0x42, 0x1c, 0xa2, 0x55, 0xa9, 0x83, 0x99, 0x8b, 0x25, 0xb8, - 0x32, 0x2f, 0x59, 0xaa, 0x86, 0x8b, 0xcb, 0x23, 0x35, 0x31, 0x25, 0xb4, 0x20, 0x25, 0xb1, 0x24, - 0x55, 0x48, 0x83, 0x8b, 0x35, 0x23, 0x35, 0x31, 0xa5, 0x58, 0x82, 0x51, 0x81, 0x59, 0x83, 0xdb, - 0x48, 0x48, 0x0f, 0x6a, 0x83, 0x1e, 0x48, 0xad, 0x1e, 0x48, 0x61, 0x10, 0x44, 0x81, 0x90, 0x06, - 0x17, 0x3b, 0xd4, 0x44, 0x09, 0x26, 0xb0, 0x5a, 0x3e, 0xbd, 0xc4, 0xe4, 0x1c, 0x3d, 0x47, 0x67, - 0x1f, 0x67, 0xb0, 0x70, 0x10, 0x4c, 0x5a, 0x48, 0x8a, 0x8b, 0xa3, 0x38, 0x35, 0x2f, 0x25, 0xb5, - 0xc8, 0x33, 0x45, 0x82, 0x59, 0x81, 0x51, 0x83, 0x33, 0x08, 0xce, 0x97, 0xb2, 0xe2, 0x62, 0x01, - 0x19, 0x2a, 0xc4, 0xc7, 0xc5, 0x94, 0x99, 0x22, 0xc1, 0x08, 0x96, 0x65, 0xca, 0x4c, 0x11, 0x52, - 0xe2, 0xe2, 0x29, 0xce, 0x4b, 0x2c, 0x28, 0xce, 0xc8, 0x2f, 0x09, 0x48, 0x2c, 0xc9, 0x00, 0x5b, - 0xc1, 0x19, 0x84, 0x22, 0x26, 0x75, 0x94, 0x91, 0x8b, 0xc5, 0xad, 0x34, 0x27, 0x47, 0x2a, 0x96, - 0x8b, 0x3d, 0x28, 0xb5, 0xb0, 0x34, 0xb5, 0xb8, 0x84, 0x16, 0xee, 0x97, 0x8a, 0xe3, 0xe2, 0x08, - 0x4a, 0x2d, 0x2e, 0xc8, 0xcf, 0x2b, 0xa6, 0x49, 0xf8, 0x38, 0x29, 0x9c, 0x78, 0x24, 0xc7, 0x78, - 0xe1, 0x91, 0x1c, 0xe3, 0x83, 0x47, 0x72, 0x8c, 0x13, 0x1e, 0xcb, 0x31, 0x5c, 0x78, 0x2c, 0xc7, - 0x70, 0xe3, 0xb1, 0x1c, 0x43, 0x14, 0x1b, 0x24, 0xe6, 0x93, 0xd8, 0xc0, 0x71, 0x66, 0x0c, 0x08, - 0x00, 0x00, 0xff, 0xff, 0x9a, 0x7b, 0x0b, 0x1c, 0x17, 0x02, 0x00, 0x00, + // 297 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 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0x24, 0x23, 0xd1, 0x66, 0xf1, 0x25, 0xf4, 0x6b, 0x43, 0x3a, 0x86, 0xee, 0x52, 0x47, 0x24, 0xd4, + 0xba, 0x4b, 0x4d, 0xa7, 0x70, 0xec, 0x8c, 0xb4, 0x2e, 0xcd, 0xfd, 0xbd, 0xf4, 0x69, 0xb0, 0x1f, + 0x89, 0x7f, 0x5a, 0xfc, 0x43, 0xa0, 0x7f, 0xb3, 0xce, 0xb2, 0x78, 0x0d, 0x43, 0x81, 0x2f, 0x6b, + 0x74, 0x7e, 0xaf, 0x77, 0xdf, 0xc0, 0xa1, 0x40, 0x67, 0x73, 0xe3, 0xf6, 0xfa, 0x66, 0x57, 0x93, + 0xcf, 0x92, 0x91, 0x6d, 0xc9, 0xc8, 0x77, 0xc9, 0xc8, 0x7b, 0xc5, 0x3a, 0xdb, 0x8a, 0x75, 0xbe, + 0x2a, 0xd6, 0x79, 0x1a, 0x34, 0x53, 0x32, 0x1f, 0x84, 0xff, 0xbd, 0xf8, 0x0d, 0x00, 0x00, 0xff, + 0xff, 0xac, 0xf4, 0x50, 0xb7, 0x43, 0x02, 0x00, 0x00, } func (m *Sync) Marshal() (dAtA []byte, err error) { @@ -391,10 +407,10 @@ func (m *SyncHeadUpdate) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.SenderId) > 0 { - i -= len(m.SenderId) - copy(dAtA[i:], m.SenderId) - i = encodeVarintSync(dAtA, i, uint64(len(m.SenderId))) + if len(m.TreeId) > 0 { + i -= len(m.TreeId) + copy(dAtA[i:], m.TreeId) + i = encodeVarintSync(dAtA, i, uint64(len(m.TreeId))) i-- dAtA[i] = 0x1a } @@ -511,6 +527,13 @@ func (m *SyncFullRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.TreeId) > 0 { + i -= len(m.TreeId) + copy(dAtA[i:], m.TreeId) + i = encodeVarintSync(dAtA, i, uint64(len(m.TreeId))) + i-- + dAtA[i] = 0x1a + } if len(m.Changes) > 0 { for iNdEx := len(m.Changes) - 1; iNdEx >= 0; iNdEx-- { { @@ -562,6 +585,13 @@ func (m *SyncFullResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.TreeId) > 0 { + i -= len(m.TreeId) + copy(dAtA[i:], m.TreeId) + i = encodeVarintSync(dAtA, i, uint64(len(m.TreeId))) + i-- + dAtA[i] = 0x1a + } if len(m.Changes) > 0 { for iNdEx := len(m.Changes) - 1; iNdEx >= 0; iNdEx-- { { @@ -631,7 +661,7 @@ func (m *SyncHeadUpdate) Size() (n int) { n += 1 + l + sovSync(uint64(l)) } } - l = len(m.SenderId) + l = len(m.TreeId) if l > 0 { n += 1 + l + sovSync(uint64(l)) } @@ -684,6 +714,10 @@ func (m *SyncFullRequest) Size() (n int) { n += 1 + l + sovSync(uint64(l)) } } + l = len(m.TreeId) + if l > 0 { + n += 1 + l + sovSync(uint64(l)) + } return n } @@ -705,6 +739,10 @@ func (m *SyncFullResponse) Size() (n int) { n += 1 + l + sovSync(uint64(l)) } } + l = len(m.TreeId) + if l > 0 { + n += 1 + l + sovSync(uint64(l)) + } return n } @@ -856,14 +894,14 @@ func (m *SyncHeadUpdate) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Changes = append(m.Changes, &aclpb.ACLChange{}) + m.Changes = append(m.Changes, &aclpb.RawChange{}) if err := m.Changes[len(m.Changes)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SenderId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field TreeId", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -891,7 +929,7 @@ func (m *SyncHeadUpdate) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.SenderId = string(dAtA[iNdEx:postIndex]) + m.TreeId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -1170,11 +1208,43 @@ func (m *SyncFullRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Changes = append(m.Changes, &aclpb.ACLChange{}) + m.Changes = append(m.Changes, &aclpb.RawChange{}) if err := m.Changes[len(m.Changes)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TreeId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSync + } + 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 ErrInvalidLengthSync + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthSync + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TreeId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipSync(dAtA[iNdEx:]) @@ -1288,11 +1358,43 @@ func (m *SyncFullResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Changes = append(m.Changes, &aclpb.ACLChange{}) + m.Changes = append(m.Changes, &aclpb.RawChange{}) if err := m.Changes[len(m.Changes)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TreeId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSync + } + 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 ErrInvalidLengthSync + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthSync + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TreeId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipSync(dAtA[iNdEx:])