From 7105ba3e0fbac799f4bd2407a658bd0c7748a215 Mon Sep 17 00:00:00 2001 From: Sorin Stanculeanu Date: Thu, 24 Oct 2024 10:41:26 +0300 Subject: [PATCH 1/3] new relayed v3 --- data/transaction/apiTransactionResult.go | 1 + data/transaction/frontendTransaction.go | 2 + data/transaction/transaction.pb.go | 199 ++++++++++++++++++----- data/transaction/transaction.proto | 2 + 4 files changed, 166 insertions(+), 38 deletions(-) diff --git a/data/transaction/apiTransactionResult.go b/data/transaction/apiTransactionResult.go index ca9671b10..624b07136 100644 --- a/data/transaction/apiTransactionResult.go +++ b/data/transaction/apiTransactionResult.go @@ -63,6 +63,7 @@ type ApiTransactionResult struct { IsRefund bool `json:"isRefund,omitempty"` CallType string `json:"callType,omitempty"` RelayerAddress string `json:"relayerAddress,omitempty"` + RelayerSignature string `json:"relayerSignature,omitempty"` RelayedValue string `json:"relayedValue,omitempty"` ChainID string `json:"chainID,omitempty"` Version uint32 `json:"version,omitempty"` diff --git a/data/transaction/frontendTransaction.go b/data/transaction/frontendTransaction.go index b5b55c2a4..1330c15bd 100644 --- a/data/transaction/frontendTransaction.go +++ b/data/transaction/frontendTransaction.go @@ -17,4 +17,6 @@ type FrontendTransaction struct { Options uint32 `json:"options,omitempty"` GuardianAddr string `json:"guardian,omitempty"` GuardianSignature string `json:"guardianSignature,omitempty"` + RelayerAddr string `json:"relayer,omitempty"` + RelayerSignature string `json:"relayerSignature,omitempty"` } diff --git a/data/transaction/transaction.pb.go b/data/transaction/transaction.pb.go index a8b2dd871..e9a3670ad 100644 --- a/data/transaction/transaction.pb.go +++ b/data/transaction/transaction.pb.go @@ -45,6 +45,8 @@ type Transaction struct { 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"` + RelayerSignature []byte `protobuf:"bytes,17,opt,name=RelayerSignature,proto3" json:"relayerSignature,omitempty"` } func (m *Transaction) Reset() { *m = Transaction{} } @@ -180,6 +182,20 @@ func (m *Transaction) GetGuardianSignature() []byte { return nil } +func (m *Transaction) GetRelayerAddr() []byte { + if m != nil { + return m.RelayerAddr + } + return nil +} + +func (m *Transaction) GetRelayerSignature() []byte { + if m != nil { + return m.RelayerSignature + } + return nil +} + func init() { proto.RegisterType((*Transaction)(nil), "proto.Transaction") } @@ -187,43 +203,46 @@ func init() { func init() { proto.RegisterFile("transaction.proto", fileDescriptor_2cc4e03d2c28c490) } var fileDescriptor_2cc4e03d2c28c490 = []byte{ - // 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, 0xd4, 0xd8, 0x95, 0xe3, 0x9c, 0xca, 0x80, 0xc4, 0x47, 0xe0, 0x63, - 0x20, 0x36, 0xbe, 0x05, 0x63, 0xc7, 0x4e, 0x81, 0xe6, 0x16, 0x94, 0xa9, 0x1f, 0x01, 0xc5, 0xb9, - 0x34, 0x6e, 0x99, 0x98, 0x62, 0xff, 0xde, 0xe7, 0x79, 0x1f, 0xcb, 0xce, 0x0b, 0x57, 0xb5, 0xa2, - 0x22, 0xa5, 0xa1, 0xe6, 0x52, 0x0c, 0x8f, 0x95, 0xd4, 0x12, 0x75, 0xcc, 0xe7, 0xee, 0x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b, 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, + // 615 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x54, 0xcf, 0x4e, 0xd4, 0x40, + 0x18, 0xdf, 0x2a, 0x4b, 0x61, 0x76, 0x41, 0x76, 0x0c, 0x5a, 0x31, 0x99, 0x21, 0x46, 0x09, 0x07, + 0x77, 0x9b, 0x68, 0x8c, 0x89, 0x9c, 0x5c, 0x30, 0x04, 0xa3, 0x68, 0x8a, 0x72, 0xf0, 0x36, 0xdb, + 0x8e, 0xdd, 0x49, 0xe8, 0x94, 0x4c, 0x67, 0x37, 0x70, 0x30, 0xf1, 0x11, 0x7c, 0x0c, 0xe3, 0x03, + 0xf8, 0x0c, 0x1e, 0x39, 0x72, 0xaa, 0x52, 0x2e, 0xa6, 0x27, 0x1e, 0xc1, 0xf4, 0xeb, 0x96, 0x0e, + 0xcb, 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3, 0x94, + 0x76, 0xe2, 0x12, 0x32, 0x24, 0x15, 0x0b, 0xbf, 0x40, 0xed, 0xed, 0x11, 0x53, 0x81, 0x60, 0x12, + 0x4e, 0x6b, 0x11, 0xa2, 0xca, 0x5d, 0x99, 0xe0, 0x86, 0xec, 0x0a, 0x17, 0xbf, 0x45, 0x9d, 0xaa, + 0xae, 0x67, 0xbd, 0x05, 0x06, 0x34, 0x4f, 0xe9, 0xfd, 0x70, 0xba, 0x69, 0x38, 0x5d, 0x57, 0xe2, + 0xe7, 0xa8, 0xe5, 0xf1, 0x03, 0x76, 0xcc, 0x15, 0x4c, 0xb2, 0x04, 0x46, 0x30, 0xbf, 0x2a, 0xe1, + 0x2b, 0x97, 0xad, 0x66, 0xe2, 0xd7, 0x68, 0x69, 0x52, 0xd6, 0x63, 0x74, 0x40, 0x4d, 0xf2, 0x94, + 0xae, 0xa8, 0xa9, 0x9e, 0x61, 0x73, 0x4d, 0xd7, 0xff, 0x72, 0x72, 0x46, 0x1a, 0xa7, 0x67, 0xa4, + 0x71, 0x71, 0x46, 0xac, 0xaf, 0x19, 0xb1, 0xbe, 0x67, 0xc4, 0xfa, 0x95, 0x11, 0xeb, 0x24, 0x23, + 0xd6, 0x69, 0x46, 0xac, 0x3f, 0x19, 0xb1, 0xfe, 0x66, 0xa4, 0x71, 0x91, 0x11, 0xeb, 0xdb, 0x39, + 0x69, 0x9c, 0x9c, 0x93, 0xc6, 0xe9, 0x39, 0x69, 0x7c, 0xda, 0xfc, 0x8f, 0x1f, 0xd3, 0x35, 0xde, + 0x99, 0x0d, 0x63, 0x3d, 0x98, 0x85, 0xe7, 0xe3, 0xe9, 0xbf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x8b, + 0xe9, 0x09, 0xf0, 0x89, 0x04, 0x00, 0x00, } func (this *Transaction) Equal(that interface{}) bool { @@ -293,13 +312,19 @@ 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 !bytes.Equal(this.RelayerSignature, that1.RelayerSignature) { + return false + } return true } func (this *Transaction) GoString() string { if this == nil { return "nil" } - s := make([]string, 0, 19) + s := make([]string, 0, 21) 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") @@ -316,6 +341,8 @@ 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") + s = append(s, "RelayerSignature: "+fmt.Sprintf("%#v", this.RelayerSignature)+",\n") s = append(s, "}") return strings.Join(s, "") } @@ -347,6 +374,24 @@ func (m *Transaction) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.RelayerSignature) > 0 { + i -= len(m.RelayerSignature) + copy(dAtA[i:], m.RelayerSignature) + i = encodeVarintTransaction(dAtA, i, uint64(len(m.RelayerSignature))) + 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) @@ -522,6 +567,14 @@ 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)) + } + l = len(m.RelayerSignature) + if l > 0 { + n += 2 + l + sovTransaction(uint64(l)) + } return n } @@ -551,6 +604,8 @@ 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) + `,`, + `RelayerSignature:` + fmt.Sprintf("%v", this.RelayerSignature) + `,`, `}`, }, "") return s @@ -1031,6 +1086,74 @@ 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 RelayerSignature", 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.RelayerSignature = append(m.RelayerSignature[:0], dAtA[iNdEx:postIndex]...) + if m.RelayerSignature == nil { + m.RelayerSignature = []byte{} + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTransaction(dAtA[iNdEx:]) diff --git a/data/transaction/transaction.proto b/data/transaction/transaction.proto index e9026a452..2a263f5df 100644 --- a/data/transaction/transaction.proto +++ b/data/transaction/transaction.proto @@ -30,4 +30,6 @@ 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"]; + bytes RelayerSignature = 17 [(gogoproto.jsontag) = "relayerSignature,omitempty"]; } From 65c67240b624eda0a304983fea9cb479fb823c18 Mon Sep 17 00:00:00 2001 From: Sorin Stanculeanu Date: Thu, 24 Oct 2024 11:11:32 +0300 Subject: [PATCH 2/3] added interface for new methods --- data/interface.go | 6 ++++++ data/transaction/transaction.go | 9 +++++++++ 2 files changed, 15 insertions(+) diff --git a/data/interface.go b/data/interface.go index 97f5ecd76..88cabda69 100644 --- a/data/interface.go +++ b/data/interface.go @@ -314,6 +314,12 @@ type GuardedTransactionHandler interface { GetDataForSigning(encoder Encoder, marshaller Marshaller, hasher Hasher) ([]byte, error) } +// RelayedTransactionHandler defines functionality for the relayed transactions +type RelayedTransactionHandler interface { + GetRelayerAddr() []byte + GetRelayerSignature() []byte +} + // LogHandler defines the type for a log resulted from executing a transaction or smart contract call type LogHandler interface { // GetAddress returns the address of the sc that was originally called by the user diff --git a/data/transaction/transaction.go b/data/transaction/transaction.go index b5b42531c..16275bd83 100644 --- a/data/transaction/transaction.go +++ b/data/transaction/transaction.go @@ -102,6 +102,15 @@ func (tx *Transaction) GetDataForSigning(encoder data.Encoder, marshaller data.M ftx.GuardianAddr = guardianAddr } + if len(tx.RelayerAddr) > 0 { + relayerAddr, errRelayer := encoder.Encode(tx.RelayerAddr) + if errRelayer != nil { + return nil, errRelayer + } + + ftx.RelayerAddr = relayerAddr + } + ftxBytes, err := marshaller.Marshal(ftx) if err != nil { return nil, err From bbc08e634e511047a9434b9af9544965b3d2f8a1 Mon Sep 17 00:00:00 2001 From: Sorin Stanculeanu Date: Thu, 24 Oct 2024 11:12:46 +0300 Subject: [PATCH 3/3] extended interface --- data/interface.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/data/interface.go b/data/interface.go index 88cabda69..f53a01aef 100644 --- a/data/interface.go +++ b/data/interface.go @@ -318,6 +318,8 @@ type GuardedTransactionHandler interface { type RelayedTransactionHandler interface { GetRelayerAddr() []byte GetRelayerSignature() []byte + GetSignature() []byte + GetDataForSigning(encoder Encoder, marshaller Marshaller, hasher Hasher) ([]byte, error) } // LogHandler defines the type for a log resulted from executing a transaction or smart contract call