@@ -131,57 +131,7 @@ func TestTransactionsTransformer_NormalTxToRosettaTx(t *testing.T) {
131131 require .Equal (t , expectedRosettaTx , rosettaTx )
132132 })
133133
134- t .Run ("relayed tx, completely intrashard, with signal error (before Sirius)" , func (t * testing.T ) {
135- tx := & transaction.ApiTransactionResult {
136- Epoch : 41 ,
137- Type : string (transaction .TxTypeNormal ),
138- ProcessingTypeOnSource : transactionProcessingTypeRelayedV1 ,
139- ProcessingTypeOnDestination : transactionProcessingTypeRelayedV1 ,
140- Hash : "aaaa" ,
141- Sender : testscommon .TestUserAShard0 .Address ,
142- Receiver : testscommon .TestUserBShard0 .Address ,
143- SourceShard : 0 ,
144- DestinationShard : 0 ,
145- InitiallyPaidFee : "50000000000000" ,
146- // Has non-zero value
147- Data : []byte ("relayedTx@7b226e6f6e6365223a372c2273656e646572223a226e69424758747949504349644a78793373796c6c455a474c78506a503148734a45646e43732b6d726577413d222c227265636569766572223a224141414141414141414141464145356c3079623173734a3933504433672f4b396f48384579366d576958513d222c2276616c7565223a313030303030303030303030303030303030302c226761735072696365223a313030303030303030302c226761734c696d6974223a35303030302c2264617461223a22222c227369676e6174757265223a226e6830743338585a77614b6a725878446969716f6d364d6a5671724d612f6b70767474696a33692b5a6d43492f3778626830596762363548424151445744396f7036575567674541755430756e5253595736455341413d3d222c22636861696e4944223a224d513d3d222c2276657273696f6e223a327d" ),
148- Logs : & transaction.ApiLogs {
149- Events : []* transaction.Events {
150- {
151- Identifier : transactionEventSignalError ,
152- },
153- },
154- },
155- }
156-
157- expectedRosettaTx := & types.Transaction {
158- TransactionIdentifier : hashToTransactionIdentifier ("aaaa" ),
159- Operations : []* types.Operation {
160- {
161- Type : opFee ,
162- Account : addressToAccountIdentifier (testscommon .TestUserAShard0 .Address ),
163- Amount : extension .valueToNativeAmount ("-50000000000000" ),
164- },
165- {
166- Type : opTransfer ,
167- Account : addressToAccountIdentifier (testscommon .TestUserCShard0 .Address ),
168- Amount : extension .valueToNativeAmount ("-1000000000000000000" ),
169- },
170- {
171- Type : opTransfer ,
172- Account : addressToAccountIdentifier (testscommon .TestAddressOfContract ),
173- Amount : extension .valueToNativeAmount ("1000000000000000000" ),
174- },
175- },
176- Metadata : extractTransactionMetadata (tx ),
177- }
178-
179- rosettaTx , err := transformer .normalTxToRosetta (tx )
180- require .NoError (t , err )
181- require .Equal (t , expectedRosettaTx , rosettaTx )
182- })
183-
184- t .Run ("relayed tx, completely intrashard, with signal error (after Sirius)" , func (t * testing.T ) {
134+ t .Run ("relayed tx, completely intrashard, with signal error" , func (t * testing.T ) {
185135 tx := & transaction.ApiTransactionResult {
186136 Epoch : 43 ,
187137 Type : string (transaction .TxTypeNormal ),
@@ -289,92 +239,6 @@ func TestTransactionsTransformer_decideFeePayer(t *testing.T) {
289239 })
290240}
291241
292- func TestTransactionsTransformer_ExtractInnerTxOperationsIfRelayedCompletelyIntrashardWithSignalError (t * testing.T ) {
293- networkProvider := testscommon .NewNetworkProviderMock ()
294- extension := newNetworkProviderExtension (networkProvider )
295- transformer := newTransactionsTransformer (networkProvider )
296-
297- networkProvider .MockActivationEpochSirius = 42
298-
299- t .Run ("non-relayed tx" , func (t * testing.T ) {
300- tx := & transaction.ApiTransactionResult {
301- Type : string (transaction .TxTypeNormal ),
302- }
303-
304- operations , err := transformer .extractInnerTxOperationsIfBeforeSiriusRelayedCompletelyIntrashardWithSignalError (tx )
305- require .NoError (t , err )
306- require .Len (t , operations , 0 )
307- })
308-
309- t .Run ("relayed tx (badly formatted)" , func (t * testing.T ) {
310- tx := & transaction.ApiTransactionResult {
311- Type : string (transaction .TxTypeNormal ),
312- ProcessingTypeOnSource : transactionProcessingTypeRelayedV1 ,
313- ProcessingTypeOnDestination : transactionProcessingTypeRelayedV1 ,
314- Data : []byte ("bad" ),
315- }
316-
317- operations , err := transformer .extractInnerTxOperationsIfBeforeSiriusRelayedCompletelyIntrashardWithSignalError (tx )
318- require .ErrorIs (t , err , errCannotParseRelayedV1 )
319- require .Empty (t , operations )
320- })
321-
322- t .Run ("relayed tx, completely intrashard, with signal error, inner tx has non-zero value" , func (t * testing.T ) {
323- tx := & transaction.ApiTransactionResult {
324- Type : string (transaction .TxTypeNormal ),
325- ProcessingTypeOnSource : transactionProcessingTypeRelayedV1 ,
326- ProcessingTypeOnDestination : transactionProcessingTypeRelayedV1 ,
327- SourceShard : 0 ,
328- DestinationShard : 0 ,
329- Data : []byte ("relayedTx@7b226e6f6e6365223a372c2273656e646572223a226e69424758747949504349644a78793373796c6c455a474c78506a503148734a45646e43732b6d726577413d222c227265636569766572223a224141414141414141414141464145356c3079623173734a3933504433672f4b396f48384579366d576958513d222c2276616c7565223a313030303030303030303030303030303030302c226761735072696365223a313030303030303030302c226761734c696d6974223a35303030302c2264617461223a22222c227369676e6174757265223a226e6830743338585a77614b6a725878446969716f6d364d6a5671724d612f6b70767474696a33692b5a6d43492f3778626830596762363548424151445744396f7036575567674541755430756e5253595736455341413d3d222c22636861696e4944223a224d513d3d222c2276657273696f6e223a327d" ),
330- Logs : & transaction.ApiLogs {
331- Events : []* transaction.Events {
332- {
333- Identifier : transactionEventSignalError ,
334- },
335- },
336- },
337- }
338-
339- operations , err := transformer .extractInnerTxOperationsIfBeforeSiriusRelayedCompletelyIntrashardWithSignalError (tx )
340- require .NoError (t , err )
341- require .Equal (t , []* types.Operation {
342- {
343- Type : opTransfer ,
344- Account : addressToAccountIdentifier (testscommon .TestUserCShard0 .Address ),
345- Amount : extension .valueToNativeAmount ("-1000000000000000000" ),
346- },
347- {
348- Type : opTransfer ,
349- Account : addressToAccountIdentifier (testscommon .TestAddressOfContract ),
350- Amount : extension .valueToNativeAmount ("1000000000000000000" ),
351- },
352- }, operations )
353- })
354-
355- t .Run ("relayed tx, completely intrashard, with signal error, inner tx has zero value" , func (t * testing.T ) {
356- tx := & transaction.ApiTransactionResult {
357- Type : string (transaction .TxTypeNormal ),
358- ProcessingTypeOnSource : transactionProcessingTypeRelayedV1 ,
359- ProcessingTypeOnDestination : transactionProcessingTypeRelayedV1 ,
360- SourceShard : 0 ,
361- DestinationShard : 0 ,
362- Data : []byte ("relayedTx@7b226e6f6e6365223a372c2273656e646572223a226e69424758747949504349644a78793373796c6c455a474c78506a503148734a45646e43732b6d726577413d222c227265636569766572223a224141414141414141414141464145356c3079623173734a3933504433672f4b396f48384579366d576958513d222c2276616c7565223a302c226761735072696365223a313030303030303030302c226761734c696d6974223a35303030302c2264617461223a22222c227369676e6174757265223a22336c644e7a32435734416143675069495863636c466b4654324149586a4a4757316a526a306c542b4f3161736b6241394a744e365a764173396e394f58716d343130574a49665332332b4168666e48793267446c41773d3d222c22636861696e4944223a224d513d3d222c2276657273696f6e223a327d" ),
363- Logs : & transaction.ApiLogs {
364- Events : []* transaction.Events {
365- {
366- Identifier : transactionEventSignalError ,
367- },
368- },
369- },
370- }
371-
372- operations , err := transformer .extractInnerTxOperationsIfBeforeSiriusRelayedCompletelyIntrashardWithSignalError (tx )
373- require .NoError (t , err )
374- require .Len (t , operations , 0 )
375- })
376- }
377-
378242func TestTransactionsTransformer_UnsignedTxToRosettaTx (t * testing.T ) {
379243 networkProvider := testscommon .NewNetworkProviderMock ()
380244 extension := newNetworkProviderExtension (networkProvider )
0 commit comments