diff --git a/data/esdt/common.go b/data/esdt/common.go index d2467ec4..7d240b51 100644 --- a/data/esdt/common.go +++ b/data/esdt/common.go @@ -35,7 +35,7 @@ func IsValidPrefixedToken(token string) (string, bool) { } tokenRandSeq := tokenSplit[2] - if !(len(tokenRandSeq) >= esdtTickerNumRandChars) { + if !IsRandomSeqValid(tokenRandSeq) { return "", false } @@ -83,3 +83,21 @@ func IsTickerValid(ticker string) bool { func IsTokenTickerLenCorrect(tokenTickerLen int) bool { return !(tokenTickerLen < minLengthForTickerName || tokenTickerLen > maxLengthForTickerName) } + +// IsRandomSeqValid checks if the token random sequence is valid +func IsRandomSeqValid(randomSeq string) bool { + if len(randomSeq) != esdtTickerNumRandChars { + return false + } + + for _, ch := range randomSeq { + isSmallCharacter := ch >= 'a' && ch <= 'f' + isNumber := ch >= '0' && ch <= '9' + isReadable := isSmallCharacter || isNumber + if !isReadable { + return false + } + } + + return true +} diff --git a/data/esdt/common_test.go b/data/esdt/common_test.go index 8052c23a..0e65fd9d 100644 --- a/data/esdt/common_test.go +++ b/data/esdt/common_test.go @@ -7,19 +7,19 @@ import ( ) func TestIsValidPrefixedToken(t *testing.T) { - prefix, valid := IsValidPrefixedToken("sov1-TKN-coffee") + prefix, valid := IsValidPrefixedToken("sov1-TKN-c0ffee") require.True(t, valid) require.Equal(t, "sov1", prefix) - prefix, valid = IsValidPrefixedToken("sOv1-TKN-coffee") + prefix, valid = IsValidPrefixedToken("sOv1-TKN-c0ffee") require.False(t, valid) require.Equal(t, "", prefix) - prefix, valid = IsValidPrefixedToken("sov1-TkN-coffee") + prefix, valid = IsValidPrefixedToken("sov1-TkN-c0ffee") require.False(t, valid) require.Equal(t, "", prefix) - prefix, valid = IsValidPrefixedToken("sov1-TKN-coffe") + prefix, valid = IsValidPrefixedToken("sov1-TKN-c0ffe") require.False(t, valid) require.Equal(t, "", prefix) @@ -27,7 +27,7 @@ func TestIsValidPrefixedToken(t *testing.T) { require.False(t, valid) require.Equal(t, "", prefix) - prefix, valid = IsValidPrefixedToken("TKN-coffee") + prefix, valid = IsValidPrefixedToken("TKN-c0ffee") require.False(t, valid) require.Equal(t, "", prefix) } diff --git a/data/esdt/esdt.pb.go b/data/esdt/esdt.pb.go index 64f66dd3..7512924b 100644 --- a/data/esdt/esdt.pb.go +++ b/data/esdt/esdt.pb.go @@ -228,48 +228,131 @@ func (m *MetaData) GetAttributes() []byte { return nil } +type MetaDataVersion struct { + Name uint64 `protobuf:"varint,1,opt,name=Name,proto3" json:"Name"` + Creator uint64 `protobuf:"varint,2,opt,name=Creator,proto3" json:"Creator"` + Royalties uint64 `protobuf:"varint,3,opt,name=Royalties,proto3" json:"Royalties"` + Hash uint64 `protobuf:"varint,4,opt,name=Hash,proto3" json:"Hash"` + URIs uint64 `protobuf:"varint,5,opt,name=URIs,proto3" json:"URIs"` + Attributes uint64 `protobuf:"varint,6,opt,name=Attributes,proto3" json:"Attributes"` +} + +func (m *MetaDataVersion) Reset() { *m = MetaDataVersion{} } +func (*MetaDataVersion) ProtoMessage() {} +func (*MetaDataVersion) Descriptor() ([]byte, []int) { + return fileDescriptor_e413e402abc6a34c, []int{3} +} +func (m *MetaDataVersion) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MetaDataVersion) 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 *MetaDataVersion) XXX_Merge(src proto.Message) { + xxx_messageInfo_MetaDataVersion.Merge(m, src) +} +func (m *MetaDataVersion) XXX_Size() int { + return m.Size() +} +func (m *MetaDataVersion) XXX_DiscardUnknown() { + xxx_messageInfo_MetaDataVersion.DiscardUnknown(m) +} + +var xxx_messageInfo_MetaDataVersion proto.InternalMessageInfo + +func (m *MetaDataVersion) GetName() uint64 { + if m != nil { + return m.Name + } + return 0 +} + +func (m *MetaDataVersion) GetCreator() uint64 { + if m != nil { + return m.Creator + } + return 0 +} + +func (m *MetaDataVersion) GetRoyalties() uint64 { + if m != nil { + return m.Royalties + } + return 0 +} + +func (m *MetaDataVersion) GetHash() uint64 { + if m != nil { + return m.Hash + } + return 0 +} + +func (m *MetaDataVersion) GetURIs() uint64 { + if m != nil { + return m.URIs + } + return 0 +} + +func (m *MetaDataVersion) GetAttributes() uint64 { + if m != nil { + return m.Attributes + } + return 0 +} + func init() { proto.RegisterType((*ESDigitalToken)(nil), "protoBuiltInFunctions.ESDigitalToken") proto.RegisterType((*ESDTRoles)(nil), "protoBuiltInFunctions.ESDTRoles") proto.RegisterType((*MetaData)(nil), "protoBuiltInFunctions.MetaData") + proto.RegisterType((*MetaDataVersion)(nil), "protoBuiltInFunctions.MetaDataVersion") } func init() { proto.RegisterFile("esdt.proto", fileDescriptor_e413e402abc6a34c) } var fileDescriptor_e413e402abc6a34c = []byte{ - // 513 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x53, 0x41, 0x8b, 0xd3, 0x40, - 0x14, 0xce, 0x74, 0xdb, 0xdd, 0x76, 0xb6, 0xdd, 0x43, 0x40, 0x08, 0x22, 0x93, 0x52, 0x10, 0x0a, - 0xda, 0x14, 0xf4, 0x28, 0x08, 0x66, 0x5b, 0xb1, 0x07, 0x17, 0x99, 0x56, 0x0f, 0xde, 0xa6, 0xed, - 0x98, 0x0e, 0xa6, 0x99, 0x32, 0x99, 0x2c, 0xbb, 0x37, 0xaf, 0xde, 0xfc, 0x19, 0xe2, 0x1f, 0xd1, - 0x63, 0x8f, 0x3d, 0x45, 0x9b, 0x5e, 0x24, 0xa7, 0xfd, 0x09, 0x32, 0x2f, 0x9b, 0x6d, 0x85, 0xbd, - 0xbc, 0x7c, 0xdf, 0x37, 0x8f, 0x79, 0xf3, 0xbe, 0x8f, 0x60, 0xcc, 0xe3, 0xb9, 0xf6, 0x56, 0x4a, - 0x6a, 0x69, 0x3f, 0x80, 0x8f, 0x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x33, 0x82, 0x36, 0x19, 0x41, 0x7f, 0x32, 0x82, 0xfe, 0x66, 0xc4, 0xba, 0xc9, 0x08, - 0xfa, 0xb6, 0x23, 0xd6, 0x7a, 0x47, 0xac, 0xcd, 0x8e, 0x58, 0x1f, 0xab, 0xe6, 0x7f, 0x98, 0x1e, - 0x43, 0xc0, 0xcf, 0xff, 0x05, 0x00, 0x00, 0xff, 0xff, 0xb8, 0x8c, 0x59, 0x17, 0x1e, 0x03, 0x00, + // 561 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x54, 0xcf, 0x8b, 0xd3, 0x40, + 0x14, 0xce, 0x74, 0xd3, 0xfd, 0x31, 0xfb, 0x43, 0x08, 0x08, 0x41, 0x64, 0x52, 0x0a, 0x42, 0x41, + 0x9b, 0x82, 0x1e, 0x05, 0xc1, 0xec, 0x56, 0xec, 0xc1, 0x45, 0xa6, 0x75, 0x0f, 0xde, 0xa6, 0xed, + 0x98, 0x0e, 0xa6, 0x99, 0x32, 0x99, 0x2c, 0xbb, 0x37, 0xaf, 0xde, 0xfc, 0x33, 0xc4, 0x7f, 0x44, + 0x8f, 0x3d, 0xf6, 0x14, 0x6d, 0x7a, 0x91, 0x5c, 0xdc, 0x3f, 0x41, 0xf2, 0xb2, 0x69, 0x2a, 0xac, + 0xab, 0x97, 0x97, 0xf7, 0x7d, 0xf3, 0x31, 0x6f, 0xbe, 0xef, 0x95, 0x62, 0xcc, 0xa3, 0xb1, 0x76, + 0x67, 0x4a, 0x6a, 0x69, 0xdd, 0x85, 0x8f, 0x17, 0x8b, 0x40, 0xf7, 0xc2, 0x17, 0x71, 0x38, 0xd2, + 0x42, 0x86, 0xd1, 0xbd, 0xb6, 0x2f, 0xf4, 0x24, 0x1e, 0xba, 0x23, 0x39, 0xed, 0xf8, 0xd2, 0x97, + 0x1d, 0x90, 0x0d, 0xe3, 0x77, 0x80, 0x00, 0x40,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b8, 0x5a, 0x12, 0xf4, 0x21, 0x25, 0xe8, 0x73, 0x4a, 0xd0, 0xb7, 0x94, 0xa0, + 0x79, 0x4a, 0xd0, 0x22, 0x25, 0xe8, 0x47, 0x4a, 0xd0, 0xcf, 0x94, 0x18, 0x57, 0x29, 0x41, 0x9f, + 0x56, 0xc4, 0x98, 0xaf, 0x88, 0xb1, 0x58, 0x11, 0xe3, 0xad, 0x99, 0xff, 0x03, 0x0c, 0xb7, 0xe1, + 0x27, 0xfd, 0xe4, 0x77, 0x00, 0x00, 0x00, 0xff, 0xff, 0x8c, 0xee, 0x3e, 0x3a, 0x10, 0x04, 0x00, 0x00, } @@ -388,6 +471,45 @@ func (this *MetaData) Equal(that interface{}) bool { } return true } +func (this *MetaDataVersion) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*MetaDataVersion) + if !ok { + that2, ok := that.(MetaDataVersion) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Name != that1.Name { + return false + } + if this.Creator != that1.Creator { + return false + } + if this.Royalties != that1.Royalties { + return false + } + if this.Hash != that1.Hash { + return false + } + if this.URIs != that1.URIs { + return false + } + if this.Attributes != that1.Attributes { + return false + } + return true +} func (this *ESDigitalToken) GoString() string { if this == nil { return "nil" @@ -430,6 +552,21 @@ func (this *MetaData) GoString() string { s = append(s, "}") return strings.Join(s, "") } +func (this *MetaDataVersion) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 10) + s = append(s, "&esdt.MetaDataVersion{") + s = append(s, "Name: "+fmt.Sprintf("%#v", this.Name)+",\n") + s = append(s, "Creator: "+fmt.Sprintf("%#v", this.Creator)+",\n") + s = append(s, "Royalties: "+fmt.Sprintf("%#v", this.Royalties)+",\n") + s = append(s, "Hash: "+fmt.Sprintf("%#v", this.Hash)+",\n") + s = append(s, "URIs: "+fmt.Sprintf("%#v", this.URIs)+",\n") + s = append(s, "Attributes: "+fmt.Sprintf("%#v", this.Attributes)+",\n") + s = append(s, "}") + return strings.Join(s, "") +} func valueToGoStringEsdt(v interface{}, typ string) string { rv := reflect.ValueOf(v) if rv.IsNil() { @@ -605,6 +742,59 @@ func (m *MetaData) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *MetaDataVersion) 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 *MetaDataVersion) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MetaDataVersion) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Attributes != 0 { + i = encodeVarintEsdt(dAtA, i, uint64(m.Attributes)) + i-- + dAtA[i] = 0x30 + } + if m.URIs != 0 { + i = encodeVarintEsdt(dAtA, i, uint64(m.URIs)) + i-- + dAtA[i] = 0x28 + } + if m.Hash != 0 { + i = encodeVarintEsdt(dAtA, i, uint64(m.Hash)) + i-- + dAtA[i] = 0x20 + } + if m.Royalties != 0 { + i = encodeVarintEsdt(dAtA, i, uint64(m.Royalties)) + i-- + dAtA[i] = 0x18 + } + if m.Creator != 0 { + i = encodeVarintEsdt(dAtA, i, uint64(m.Creator)) + i-- + dAtA[i] = 0x10 + } + if m.Name != 0 { + i = encodeVarintEsdt(dAtA, i, uint64(m.Name)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + func encodeVarintEsdt(dAtA []byte, offset int, v uint64) int { offset -= sovEsdt(v) base := offset @@ -697,6 +887,33 @@ func (m *MetaData) Size() (n int) { return n } +func (m *MetaDataVersion) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Name != 0 { + n += 1 + sovEsdt(uint64(m.Name)) + } + if m.Creator != 0 { + n += 1 + sovEsdt(uint64(m.Creator)) + } + if m.Royalties != 0 { + n += 1 + sovEsdt(uint64(m.Royalties)) + } + if m.Hash != 0 { + n += 1 + sovEsdt(uint64(m.Hash)) + } + if m.URIs != 0 { + n += 1 + sovEsdt(uint64(m.URIs)) + } + if m.Attributes != 0 { + n += 1 + sovEsdt(uint64(m.Attributes)) + } + return n +} + func sovEsdt(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -743,6 +960,21 @@ func (this *MetaData) String() string { }, "") return s } +func (this *MetaDataVersion) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&MetaDataVersion{`, + `Name:` + fmt.Sprintf("%v", this.Name) + `,`, + `Creator:` + fmt.Sprintf("%v", this.Creator) + `,`, + `Royalties:` + fmt.Sprintf("%v", this.Royalties) + `,`, + `Hash:` + fmt.Sprintf("%v", this.Hash) + `,`, + `URIs:` + fmt.Sprintf("%v", this.URIs) + `,`, + `Attributes:` + fmt.Sprintf("%v", this.Attributes) + `,`, + `}`, + }, "") + return s +} func valueToStringEsdt(v interface{}) string { rv := reflect.ValueOf(v) if rv.IsNil() { @@ -1309,6 +1541,173 @@ func (m *MetaData) Unmarshal(dAtA []byte) error { } return nil } +func (m *MetaDataVersion) 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 ErrIntOverflowEsdt + } + 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: MetaDataVersion: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MetaDataVersion: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + m.Name = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEsdt + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Name |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Creator", wireType) + } + m.Creator = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEsdt + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Creator |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Royalties", wireType) + } + m.Royalties = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEsdt + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Royalties |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Hash", wireType) + } + m.Hash = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEsdt + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Hash |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field URIs", wireType) + } + m.URIs = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEsdt + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.URIs |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Attributes", wireType) + } + m.Attributes = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEsdt + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Attributes |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipEsdt(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthEsdt + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthEsdt + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipEsdt(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/data/esdt/proto/esdt.proto b/data/esdt/proto/esdt.proto index 0583bb16..84338add 100644 --- a/data/esdt/proto/esdt.proto +++ b/data/esdt/proto/esdt.proto @@ -32,3 +32,12 @@ message MetaData { repeated bytes URIs = 6 [(gogoproto.jsontag) = "URIs"]; bytes Attributes = 7 [(gogoproto.jsontag) = "Attributes"]; } + +message MetaDataVersion { + uint64 Name = 1 [(gogoproto.jsontag) = "Name"]; + uint64 Creator = 2 [(gogoproto.jsontag) = "Creator"]; + uint64 Royalties = 3 [(gogoproto.jsontag) = "Royalties"]; + uint64 Hash = 4 [(gogoproto.jsontag) = "Hash"]; + uint64 URIs = 5 [(gogoproto.jsontag) = "URIs"]; + uint64 Attributes = 6 [(gogoproto.jsontag) = "Attributes"]; +} diff --git a/data/interface.go b/data/interface.go index cbfd50c8..97f5ecd7 100644 --- a/data/interface.go +++ b/data/interface.go @@ -272,7 +272,6 @@ type TransactionHandler interface { GetSndAddr() []byte GetGasLimit() uint64 GetGasPrice() uint64 - GetUserTransactions() []TransactionHandler SetValue(*big.Int) SetData([]byte) @@ -399,7 +398,6 @@ type TransactionWithFeeHandler interface { GetData() []byte GetRcvAddr() []byte GetValue() *big.Int - GetUserTransactions() []TransactionHandler } // UserAccountHandler models a user account diff --git a/data/receipt/receipt.go b/data/receipt/receipt.go index d19933df..992e4932 100644 --- a/data/receipt/receipt.go +++ b/data/receipt/receipt.go @@ -58,11 +58,6 @@ func (_ *Receipt) GetRcvUserName() []byte { return nil } -// GetUserTransactions returns nil as Receipt does not have user transactions -func (rpt *Receipt) GetUserTransactions() []data.TransactionHandler { - return nil -} - // CheckIntegrity checks for not nil fields and negative value func (rpt *Receipt) CheckIntegrity() error { return nil diff --git a/data/receipt/receipt_test.go b/data/receipt/receipt_test.go index eda8ebc7..84f68941 100644 --- a/data/receipt/receipt_test.go +++ b/data/receipt/receipt_test.go @@ -29,7 +29,6 @@ func TestReceipt_SettersAndGetters(t *testing.T) { assert.Equal(t, uint64(0), r.GetNonce()) assert.Equal(t, uint64(0), r.GetGasPrice()) assert.Equal(t, uint64(0), r.GetGasLimit()) - assert.Nil(t, r.GetUserTransactions()) } func TestReceipt_CheckIntegrityReturnsNil(t *testing.T) { diff --git a/data/rewardTx/rewardTx.go b/data/rewardTx/rewardTx.go index c9b14074..0ccb44a5 100644 --- a/data/rewardTx/rewardTx.go +++ b/data/rewardTx/rewardTx.go @@ -62,11 +62,6 @@ func (rtx *RewardTx) GetRcvUserName() []byte { return nil } -// GetUserTransactions returns nil as RewardTx does not have user transactions -func (rtx *RewardTx) GetUserTransactions() []data.TransactionHandler { - return nil -} - // CheckIntegrity checks for not nil fields and negative value func (rtx *RewardTx) CheckIntegrity() error { if len(rtx.RcvAddr) == 0 { diff --git a/data/rewardTx/rewardTx_test.go b/data/rewardTx/rewardTx_test.go index 043d1058..2f8680e2 100644 --- a/data/rewardTx/rewardTx_test.go +++ b/data/rewardTx/rewardTx_test.go @@ -27,7 +27,6 @@ func TestRewardTx_GettersAndSetters(t *testing.T) { assert.Equal(t, uint64(0), rwdTx.GetGasLimit()) assert.Equal(t, uint64(0), rwdTx.GetGasPrice()) assert.Equal(t, uint64(0), rwdTx.GetNonce()) - assert.Nil(t, rwdTx.GetUserTransactions()) } func TestRewardTx_CheckIntegrityShouldWork(t *testing.T) { diff --git a/data/smartContractResult/smartContractResult.go b/data/smartContractResult/smartContractResult.go index f8ea3324..2c248176 100644 --- a/data/smartContractResult/smartContractResult.go +++ b/data/smartContractResult/smartContractResult.go @@ -39,11 +39,6 @@ func (_ *SmartContractResult) GetRcvUserName() []byte { return nil } -// GetUserTransactions returns nil as SmartContractResult does not have user transactions -func (scr *SmartContractResult) GetUserTransactions() []data.TransactionHandler { - return nil -} - // TrimSlicePtr creates a copy of the provided slice without the excess capacity func TrimSlicePtr(in []*SmartContractResult) []*SmartContractResult { if len(in) == 0 { diff --git a/data/smartContractResult/smartContractResult_test.go b/data/smartContractResult/smartContractResult_test.go index 50e26143..75eba828 100644 --- a/data/smartContractResult/smartContractResult_test.go +++ b/data/smartContractResult/smartContractResult_test.go @@ -38,7 +38,6 @@ func TestSmartContractResult_SettersAndGetters(t *testing.T) { assert.Equal(t, gasLimit, scr.GetGasLimit()) assert.Equal(t, gasPrice, scr.GetGasPrice()) assert.Equal(t, nonce, scr.GetNonce()) - assert.Nil(t, scr.GetUserTransactions()) } func TestTrimSlicePtr(t *testing.T) { diff --git a/data/transaction/apiTransactionResult.go b/data/transaction/apiTransactionResult.go index 1dd23f4c..ca9671b1 100644 --- a/data/transaction/apiTransactionResult.go +++ b/data/transaction/apiTransactionResult.go @@ -69,7 +69,6 @@ type ApiTransactionResult struct { Options uint32 `json:"options"` GuardianAddr string `json:"guardian,omitempty"` GuardianSignature string `json:"guardianSignature,omitempty"` - InnerTransactions []*FrontendTransaction `json:"innerTransactions,omitempty"` } // ApiSmartContractResult represents a smart contract result with changed fields' types in order to make it friendly for API's json diff --git a/data/transaction/frontendTransaction.go b/data/transaction/frontendTransaction.go index 267d7e9c..b5b55c2a 100644 --- a/data/transaction/frontendTransaction.go +++ b/data/transaction/frontendTransaction.go @@ -2,21 +2,19 @@ package transaction // FrontendTransaction represents the DTO used in transaction signing/validation. type FrontendTransaction struct { - Nonce uint64 `json:"nonce"` - Value string `json:"value"` - Receiver string `json:"receiver"` - Sender string `json:"sender"` - SenderUsername []byte `json:"senderUsername,omitempty"` - ReceiverUsername []byte `json:"receiverUsername,omitempty"` - GasPrice uint64 `json:"gasPrice"` - GasLimit uint64 `json:"gasLimit"` - Data []byte `json:"data,omitempty"` - Signature string `json:"signature,omitempty"` - ChainID string `json:"chainID"` - Version uint32 `json:"version"` - Options uint32 `json:"options,omitempty"` - GuardianAddr string `json:"guardian,omitempty"` - GuardianSignature string `json:"guardianSignature,omitempty"` - Relayer string `json:"relayer,omitempty"` - InnerTransactions []*FrontendTransaction `json:"innerTransactions,omitempty"` + Nonce uint64 `json:"nonce"` + Value string `json:"value"` + Receiver string `json:"receiver"` + Sender string `json:"sender"` + SenderUsername []byte `json:"senderUsername,omitempty"` + ReceiverUsername []byte `json:"receiverUsername,omitempty"` + GasPrice uint64 `json:"gasPrice"` + GasLimit uint64 `json:"gasLimit"` + Data []byte `json:"data,omitempty"` + Signature string `json:"signature,omitempty"` + ChainID string `json:"chainID"` + Version uint32 `json:"version"` + Options uint32 `json:"options,omitempty"` + GuardianAddr string `json:"guardian,omitempty"` + GuardianSignature string `json:"guardianSignature,omitempty"` } diff --git a/data/transaction/transaction.go b/data/transaction/transaction.go index d7fd3843..b5b42531 100644 --- a/data/transaction/transaction.go +++ b/data/transaction/transaction.go @@ -2,7 +2,6 @@ package transaction import ( - "encoding/hex" "math/big" "github.com/multiversx/mx-chain-core-go/core" @@ -37,17 +36,6 @@ func (tx *Transaction) SetSndAddr(addr []byte) { tx.SndAddr = addr } -// GetUserTransactions returns the inner transactions -func (tx *Transaction) GetUserTransactions() []data.TransactionHandler { - innerTxs := tx.GetInnerTransactions() - txsHandlers := make([]data.TransactionHandler, len(innerTxs)) - for i := 0; i < len(innerTxs); i++ { - txsHandlers[i] = innerTxs[i] - } - - return txsHandlers -} - // TrimSlicePtr creates a copy of the provided slice without the excess capacity func TrimSlicePtr(in []*Transaction) []*Transaction { if len(in) == 0 { @@ -80,25 +68,38 @@ func (tx *Transaction) GetDataForSigning(encoder data.Encoder, marshaller data.M return nil, ErrNilHasher } - ftx, err := tx.prepareTx(encoder) + receiverAddr, err := encoder.Encode(tx.RcvAddr) if err != nil { return nil, err } - numInnerTxs := len(tx.InnerTransactions) - if numInnerTxs > 0 { - ftx.InnerTransactions = make([]*FrontendTransaction, numInnerTxs) - var errPrepare error - for i := 0; i < numInnerTxs; i++ { - ftx.InnerTransactions[i], errPrepare = tx.InnerTransactions[i].prepareTx(encoder) - if errPrepare != nil { - return nil, errPrepare - } + senderAddr, err := encoder.Encode(tx.SndAddr) + if err != nil { + return nil, err + } - ftx.InnerTransactions[i].Signature = hex.EncodeToString(tx.InnerTransactions[i].Signature) - ftx.InnerTransactions[i].GuardianSignature = hex.EncodeToString(tx.InnerTransactions[i].GuardianSignature) + ftx := &FrontendTransaction{ + Nonce: tx.Nonce, + Value: tx.Value.String(), + Receiver: receiverAddr, + Sender: senderAddr, + GasPrice: tx.GasPrice, + GasLimit: tx.GasLimit, + SenderUsername: tx.SndUserName, + ReceiverUsername: tx.RcvUserName, + Data: tx.Data, + ChainID: string(tx.ChainID), + Version: tx.Version, + Options: tx.Options, + } + + if len(tx.GuardianAddr) > 0 { + guardianAddr, errGuardian := encoder.Encode(tx.GuardianAddr) + if errGuardian != nil { + return nil, errGuardian } + ftx.GuardianAddr = guardianAddr } ftxBytes, err := marshaller.Marshal(ftx) @@ -146,50 +147,3 @@ func (tx *Transaction) CheckIntegrity() error { return nil } - -func (tx *Transaction) prepareTx(encoder data.Encoder) (*FrontendTransaction, error) { - receiverAddr, err := encoder.Encode(tx.RcvAddr) - if err != nil { - return nil, err - } - - senderAddr, err := encoder.Encode(tx.SndAddr) - if err != nil { - return nil, err - } - - ftx := &FrontendTransaction{ - Nonce: tx.Nonce, - Value: tx.Value.String(), - Receiver: receiverAddr, - Sender: senderAddr, - GasPrice: tx.GasPrice, - GasLimit: tx.GasLimit, - SenderUsername: tx.SndUserName, - ReceiverUsername: tx.RcvUserName, - Data: tx.Data, - ChainID: string(tx.ChainID), - Version: tx.Version, - Options: tx.Options, - } - - if len(tx.RelayerAddr) > 0 { - relayerAddr, errRelayer := encoder.Encode(tx.RelayerAddr) - if errRelayer != nil { - return nil, errRelayer - } - - ftx.Relayer = relayerAddr - } - - if len(tx.GuardianAddr) > 0 { - guardianAddr, errGuardian := encoder.Encode(tx.GuardianAddr) - if errGuardian != nil { - return nil, errGuardian - } - - ftx.GuardianAddr = guardianAddr - } - - return ftx, nil -} diff --git a/data/transaction/transaction.pb.go b/data/transaction/transaction.pb.go index 90e14b7f..a8b2dd87 100644 --- a/data/transaction/transaction.pb.go +++ b/data/transaction/transaction.pb.go @@ -30,23 +30,21 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // Transaction holds all the data needed for a value transfer or SC call type Transaction struct { - Nonce uint64 `protobuf:"varint,1,opt,name=Nonce,proto3" json:"nonce"` - Value *math_big.Int `protobuf:"bytes,2,opt,name=Value,proto3,casttypewith=math/big.Int;github.com/multiversx/mx-chain-core-go/data.BigIntCaster" json:"value"` - RcvAddr []byte `protobuf:"bytes,3,opt,name=RcvAddr,proto3" json:"receiver"` - RcvUserName []byte `protobuf:"bytes,4,opt,name=RcvUserName,proto3" json:"rcvUserName,omitempty"` - SndAddr []byte `protobuf:"bytes,5,opt,name=SndAddr,proto3" json:"sender"` - SndUserName []byte `protobuf:"bytes,6,opt,name=SndUserName,proto3" json:"sndUserName,omitempty"` - GasPrice uint64 `protobuf:"varint,7,opt,name=GasPrice,proto3" json:"gasPrice,omitempty"` - GasLimit uint64 `protobuf:"varint,8,opt,name=GasLimit,proto3" json:"gasLimit,omitempty"` - Data []byte `protobuf:"bytes,9,opt,name=Data,proto3" json:"data,omitempty"` - ChainID []byte `protobuf:"bytes,10,opt,name=ChainID,proto3" json:"chainID"` - Version uint32 `protobuf:"varint,11,opt,name=Version,proto3" json:"version"` - Signature []byte `protobuf:"bytes,12,opt,name=Signature,proto3" json:"signature,omitempty"` - Options uint32 `protobuf:"varint,13,opt,name=Options,proto3" json:"options,omitempty"` - GuardianAddr []byte `protobuf:"bytes,14,opt,name=GuardianAddr,proto3" json:"guardian,omitempty"` - GuardianSignature []byte `protobuf:"bytes,15,opt,name=GuardianSignature,proto3" json:"guardianSignature,omitempty"` - RelayerAddr []byte `protobuf:"bytes,16,opt,name=RelayerAddr,proto3" json:"relayer,omitempty"` - InnerTransactions []*Transaction `protobuf:"bytes,17,rep,name=InnerTransactions,proto3" json:"innerTransactions,omitempty"` + Nonce uint64 `protobuf:"varint,1,opt,name=Nonce,proto3" json:"nonce"` + Value *math_big.Int `protobuf:"bytes,2,opt,name=Value,proto3,casttypewith=math/big.Int;github.com/multiversx/mx-chain-core-go/data.BigIntCaster" json:"value"` + RcvAddr []byte `protobuf:"bytes,3,opt,name=RcvAddr,proto3" json:"receiver"` + RcvUserName []byte `protobuf:"bytes,4,opt,name=RcvUserName,proto3" json:"rcvUserName,omitempty"` + SndAddr []byte `protobuf:"bytes,5,opt,name=SndAddr,proto3" json:"sender"` + SndUserName []byte `protobuf:"bytes,6,opt,name=SndUserName,proto3" json:"sndUserName,omitempty"` + GasPrice uint64 `protobuf:"varint,7,opt,name=GasPrice,proto3" json:"gasPrice,omitempty"` + GasLimit uint64 `protobuf:"varint,8,opt,name=GasLimit,proto3" json:"gasLimit,omitempty"` + Data []byte `protobuf:"bytes,9,opt,name=Data,proto3" json:"data,omitempty"` + ChainID []byte `protobuf:"bytes,10,opt,name=ChainID,proto3" json:"chainID"` + Version uint32 `protobuf:"varint,11,opt,name=Version,proto3" json:"version"` + Signature []byte `protobuf:"bytes,12,opt,name=Signature,proto3" json:"signature,omitempty"` + Options uint32 `protobuf:"varint,13,opt,name=Options,proto3" json:"options,omitempty"` + GuardianAddr []byte `protobuf:"bytes,14,opt,name=GuardianAddr,proto3" json:"guardian,omitempty"` + GuardianSignature []byte `protobuf:"bytes,15,opt,name=GuardianSignature,proto3" json:"guardianSignature,omitempty"` } func (m *Transaction) Reset() { *m = Transaction{} } @@ -182,20 +180,6 @@ func (m *Transaction) GetGuardianSignature() []byte { return nil } -func (m *Transaction) GetRelayerAddr() []byte { - if m != nil { - return m.RelayerAddr - } - return nil -} - -func (m *Transaction) GetInnerTransactions() []*Transaction { - if m != nil { - return m.InnerTransactions - } - return nil -} - func init() { proto.RegisterType((*Transaction)(nil), "proto.Transaction") } @@ -203,47 +187,43 @@ func init() { func init() { proto.RegisterFile("transaction.proto", fileDescriptor_2cc4e03d2c28c490) } var fileDescriptor_2cc4e03d2c28c490 = []byte{ - // 628 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x94, 0x41, 0x6f, 0xd3, 0x3e, - 0x18, 0xc6, 0x9b, 0xff, 0xd6, 0x65, 0x73, 0xbb, 0xfd, 0xa9, 0xd1, 0x20, 0x80, 0x64, 0x57, 0x08, - 0xa6, 0x1e, 0x68, 0x23, 0x0d, 0x21, 0x24, 0x76, 0xa2, 0x1b, 0x9a, 0x2a, 0xc1, 0x40, 0x19, 0xec, - 0xc0, 0xcd, 0x4d, 0x4c, 0x6a, 0x69, 0x71, 0x26, 0xc7, 0xad, 0xb6, 0x03, 0x12, 0x1f, 0x81, 0x8f, - 0x81, 0xf8, 0x24, 0x5c, 0x90, 0x76, 0xdc, 0x29, 0xb0, 0xec, 0x82, 0x72, 0xda, 0x47, 0x40, 0x79, - 0xd3, 0x2e, 0x5e, 0x77, 0xe2, 0xd4, 0xf8, 0xf7, 0x3e, 0xcf, 0xfb, 0xbc, 0x75, 0xec, 0xa0, 0x96, - 0x56, 0x4c, 0x26, 0xcc, 0xd7, 0x22, 0x96, 0xbd, 0x23, 0x15, 0xeb, 0x18, 0xd7, 0xe1, 0xe7, 0x7e, - 0x37, 0x14, 0x7a, 0x34, 0x1e, 0xf6, 0xfc, 0x38, 0x72, 0xc3, 0x38, 0x8c, 0x5d, 0xc0, 0xc3, 0xf1, - 0x27, 0x58, 0xc1, 0x02, 0x9e, 0x4a, 0xd7, 0xc3, 0x9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8f, 0x1f, 0xb2, 0x13, 0xae, 0x60, 0x92, 0x5b, 0xd0, 0x08, 0xe6, - 0x57, 0x25, 0xbe, 0x76, 0xd8, 0x2a, 0x25, 0x66, 0xa8, 0x35, 0x90, 0x92, 0x2b, 0xe3, 0xc2, 0x25, - 0x4e, 0xab, 0xbd, 0xd0, 0x69, 0x6c, 0xe2, 0xf2, 0x3e, 0xf6, 0x8c, 0x52, 0x39, 0x9b, 0x98, 0x37, - 0x98, 0xb3, 0xdd, 0xe8, 0xd6, 0xff, 0x7c, 0x7a, 0x4e, 0x6a, 0x67, 0xe7, 0xa4, 0x76, 0x79, 0x4e, - 0xac, 0x2f, 0x19, 0xb1, 0xbe, 0x65, 0xc4, 0xfa, 0x91, 0x11, 0xeb, 0x34, 0x23, 0xd6, 0x59, 0x46, - 0xac, 0xdf, 0x19, 0xb1, 0xfe, 0x64, 0xa4, 0x76, 0x99, 0x11, 0xeb, 0xeb, 0x05, 0xa9, 0x9d, 0x5e, - 0x90, 0xda, 0xd9, 0x05, 0xa9, 0x7d, 0xdc, 0xfe, 0x87, 0xfb, 0xea, 0x1a, 0x9f, 0x9f, 0x2d, 0xe3, - 0x79, 0xb8, 0x04, 0xff, 0xe2, 0xe9, 0xdf, 0x00, 0x00, 0x00, 0xff, 0xff, 0xee, 0xb2, 0x15, 0x7c, - 0xa0, 0x04, 0x00, 0x00, + // 573 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x93, 0x31, 0x6f, 0xd4, 0x3e, + 0x18, 0xc6, 0xe3, 0xff, 0xbf, 0x77, 0x69, 0x7d, 0xd7, 0xa2, 0x1a, 0x15, 0x02, 0x48, 0x76, 0x85, + 0xa0, 0xea, 0xc0, 0x5d, 0x24, 0x10, 0x0b, 0x9d, 0xb8, 0x16, 0x55, 0x95, 0xa0, 0xa0, 0x14, 0x3a, + 0xb0, 0xf9, 0x12, 0x93, 0xb3,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0xaa, 0x33, 0xc5, 0xbc, 0xbe, 0xe9, 0x77, 0xbb, 0xcc, 0xc9, 0xcd, 0xb4, 0x81, 0x56, + 0x7e, 0xab, 0x44, 0x3e, 0x74, 0x5f, 0x1f, 0x57, 0x7f, 0x5c, 0xea, 0x2d, 0x9b, 0xee, 0x6b, 0x65, + 0x4e, 0x56, 0x65, 0x8d, 0x2c, 0x4b, 0xa3, 0x42, 0xcf, 0x60, 0x7f, 0x37, 0xa3, 0x2a, 0xe2, 0x54, + 0x98, 0xd7, 0x5a, 0x31, 0x51, 0xf5, 0xad, 0xcc, 0xb9, 0x65, 0xbb, 0xa2, 0x45, 0xaf, 0xe0, 0x6a, + 0xb3, 0x6f, 0xcf, 0x7a, 0xc3, 0x34, 0x20, 0x65, 0x4e, 0xee, 0xc5, 0xd7, 0x8b, 0x56, 0xa7, 0xbf, + 0x9d, 0xa3, 0x4f, 0xa7, 0xe7, 0xd8, 0x39, 0x3b, 0xc7, 0xce, 0xc5, 0x39, 0x06, 0x9f, 0x0b, 0x0c, + 0xbe, 0x16, 0x18, 0xfc, 0x28, 0x30, 0x38, 0x2d, 0x30, 0x38, 0x2b, 0x30, 0xf8, 0x55, 0x60, 0xf0, + 0xbb, 0xc0, 0xce, 0x45, 0x81, 0xc1, 0x97, 0x19, 0x76, 0x4e, 0x67, 0xd8, 0x39, 0x9b, 0x61, 0xe7, + 0xfd, 0xf6, 0x3f, 0xcc, 0x84, 0x6f, 0x8d, 0xf8, 0x96, 0xb5, 0x1e, 0x77, 0xcd, 0xe4, 0x3e, 0xf9, + 0x13, 0x00, 0x00, 0xff, 0xff, 0x38, 0xda, 0x76, 0x84, 0x04, 0x04, 0x00, 0x00, } func (this *Transaction) Equal(that interface{}) bool { @@ -313,24 +293,13 @@ func (this *Transaction) Equal(that interface{}) bool { if !bytes.Equal(this.GuardianSignature, that1.GuardianSignature) { return false } - if !bytes.Equal(this.RelayerAddr, that1.RelayerAddr) { - return false - } - if len(this.InnerTransactions) != len(that1.InnerTransactions) { - return false - } - for i := range this.InnerTransactions { - if !this.InnerTransactions[i].Equal(that1.InnerTransactions[i]) { - return false - } - } return true } func (this *Transaction) GoString() string { if this == nil { return "nil" } - s := make([]string, 0, 21) + s := make([]string, 0, 19) s = append(s, "&transaction.Transaction{") s = append(s, "Nonce: "+fmt.Sprintf("%#v", this.Nonce)+",\n") s = append(s, "Value: "+fmt.Sprintf("%#v", this.Value)+",\n") @@ -347,10 +316,6 @@ func (this *Transaction) GoString() string { s = append(s, "Options: "+fmt.Sprintf("%#v", this.Options)+",\n") s = append(s, "GuardianAddr: "+fmt.Sprintf("%#v", this.GuardianAddr)+",\n") s = append(s, "GuardianSignature: "+fmt.Sprintf("%#v", this.GuardianSignature)+",\n") - s = append(s, "RelayerAddr: "+fmt.Sprintf("%#v", this.RelayerAddr)+",\n") - if this.InnerTransactions != nil { - s = append(s, "InnerTransactions: "+fmt.Sprintf("%#v", this.InnerTransactions)+",\n") - } s = append(s, "}") return strings.Join(s, "") } @@ -382,31 +347,6 @@ func (m *Transaction) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.InnerTransactions) > 0 { - for iNdEx := len(m.InnerTransactions) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.InnerTransactions[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTransaction(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0x8a - } - } - if len(m.RelayerAddr) > 0 { - i -= len(m.RelayerAddr) - copy(dAtA[i:], m.RelayerAddr) - i = encodeVarintTransaction(dAtA, i, uint64(len(m.RelayerAddr))) - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0x82 - } if len(m.GuardianSignature) > 0 { i -= len(m.GuardianSignature) copy(dAtA[i:], m.GuardianSignature) @@ -582,16 +522,6 @@ func (m *Transaction) Size() (n int) { if l > 0 { n += 1 + l + sovTransaction(uint64(l)) } - l = len(m.RelayerAddr) - if l > 0 { - n += 2 + l + sovTransaction(uint64(l)) - } - if len(m.InnerTransactions) > 0 { - for _, e := range m.InnerTransactions { - l = e.Size() - n += 2 + l + sovTransaction(uint64(l)) - } - } return n } @@ -605,11 +535,6 @@ func (this *Transaction) String() string { if this == nil { return "nil" } - repeatedStringForInnerTransactions := "[]*Transaction{" - for _, f := range this.InnerTransactions { - repeatedStringForInnerTransactions += strings.Replace(f.String(), "Transaction", "Transaction", 1) + "," - } - repeatedStringForInnerTransactions += "}" s := strings.Join([]string{`&Transaction{`, `Nonce:` + fmt.Sprintf("%v", this.Nonce) + `,`, `Value:` + fmt.Sprintf("%v", this.Value) + `,`, @@ -626,8 +551,6 @@ func (this *Transaction) String() string { `Options:` + fmt.Sprintf("%v", this.Options) + `,`, `GuardianAddr:` + fmt.Sprintf("%v", this.GuardianAddr) + `,`, `GuardianSignature:` + fmt.Sprintf("%v", this.GuardianSignature) + `,`, - `RelayerAddr:` + fmt.Sprintf("%v", this.RelayerAddr) + `,`, - `InnerTransactions:` + repeatedStringForInnerTransactions + `,`, `}`, }, "") return s @@ -1108,74 +1031,6 @@ func (m *Transaction) Unmarshal(dAtA []byte) error { m.GuardianSignature = []byte{} } iNdEx = postIndex - case 16: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RelayerAddr", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTransaction - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthTransaction - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthTransaction - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.RelayerAddr = append(m.RelayerAddr[:0], dAtA[iNdEx:postIndex]...) - if m.RelayerAddr == nil { - m.RelayerAddr = []byte{} - } - iNdEx = postIndex - case 17: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field InnerTransactions", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTransaction - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTransaction - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTransaction - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.InnerTransactions = append(m.InnerTransactions, &Transaction{}) - if err := m.InnerTransactions[len(m.InnerTransactions)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTransaction(dAtA[iNdEx:]) diff --git a/data/transaction/transaction.proto b/data/transaction/transaction.proto index 5912769d..e9026a45 100644 --- a/data/transaction/transaction.proto +++ b/data/transaction/transaction.proto @@ -30,6 +30,4 @@ message Transaction { uint32 Options = 13 [(gogoproto.jsontag) = "options,omitempty"]; bytes GuardianAddr = 14 [(gogoproto.jsontag) = "guardian,omitempty"]; bytes GuardianSignature = 15 [(gogoproto.jsontag) = "guardianSignature,omitempty"]; - bytes RelayerAddr = 16 [(gogoproto.jsontag) = "relayer,omitempty"]; - repeated Transaction InnerTransactions = 17 [(gogoproto.jsontag) = "innerTransactions,omitempty"]; } diff --git a/data/transaction/transaction_test.go b/data/transaction/transaction_test.go index 9432789a..8025de68 100644 --- a/data/transaction/transaction_test.go +++ b/data/transaction/transaction_test.go @@ -23,18 +23,11 @@ func TestTransaction_SettersAndGetters(t *testing.T) { gasLimit := uint64(5) sender := []byte("sndr") receiver := []byte("receiver") - innerTxs := []*transaction.Transaction{ - { - Nonce: 123, - RelayerAddr: sender, - }, - } tx := &transaction.Transaction{ - Nonce: nonce, - GasPrice: gasPrice, - GasLimit: gasLimit, - InnerTransactions: innerTxs, + Nonce: nonce, + GasPrice: gasPrice, + GasLimit: gasLimit, } assert.False(t, check.IfNil(tx)) @@ -50,8 +43,6 @@ func TestTransaction_SettersAndGetters(t *testing.T) { assert.Equal(t, gasLimit, tx.GetGasLimit()) assert.Equal(t, sender, tx.GetSndAddr()) assert.Equal(t, receiver, tx.GetRcvAddr()) - assert.Equal(t, innerTxs[0], tx.GetUserTransactions()[0]) - assert.Equal(t, sender, tx.GetInnerTransactions()[0].GetRelayerAddr()) } func TestTransaction_MarshalUnmarshalJsonShouldWork(t *testing.T) { @@ -67,11 +58,6 @@ func TestTransaction_MarshalUnmarshalJsonShouldWork(t *testing.T) { GasLimit: 5678, Data: []byte("data"), Signature: []byte("signature"), - InnerTransactions: []*transaction.Transaction{ - { - Nonce: 123, - }, - }, } buff, err := json.Marshal(tx) @@ -196,9 +182,6 @@ func TestTransaction_GetDataForSigningMarshalizerErrShouldErr(t *testing.T) { MarshalCalled: func(obj interface{}) (bytes []byte, err error) { return nil, expectedErr }, - UnmarshalCalled: func(obj interface{}, buff []byte) error { - return nil - }, }, &mock.HasherMock{}, ) @@ -269,54 +252,6 @@ func TestTransaction_GetDataForSigningShouldWork(t *testing.T) { assert.Equal(t, 2, numEncodeCalled) }) - t.Run("inner txs, without hash sign option set", func(t *testing.T) { - t.Parallel() - - tx1 := &transaction.Transaction{ - Nonce: 1, - } - tx := &transaction.Transaction{ - Nonce: 3, - InnerTransactions: []*transaction.Transaction{tx1}, - } - - numEncodeCalled := 0 - marshallWasCalled := false - hasherWasCalled := false - buff, err := tx.GetDataForSigning( - &mock.PubkeyConverterStub{ - EncodeCalled: func(pkBytes []byte) (string, error) { - numEncodeCalled++ - return "", nil - }, - }, - &mock.MarshalizerStub{ - MarshalCalled: func(obj interface{}) (bytes []byte, err error) { - marshallWasCalled = true - - return json.Marshal(obj) - }, - }, - &mock.HasherStub{ - ComputeCalled: func(s string) []byte { - hasherWasCalled = true - - return make([]byte, 0) - }, - }, - ) - - assert.Nil(t, err) - - var ftx transaction.FrontendTransaction - err = json.Unmarshal(buff, &ftx) - assert.Nil(t, err) - - assert.True(t, marshallWasCalled) - assert.False(t, hasherWasCalled) - assert.Equal(t, 4, numEncodeCalled) - }) - t.Run("with hash sign option set", func(t *testing.T) { t.Parallel()