@@ -201,25 +201,25 @@ func (t *Task) Execute(ctx context.Context) error {
201201 }
202202 }
203203
204- err = nil
205204 if len (clients ) == 0 {
206- err = fmt .Errorf ("no ready clients available" )
207- } else {
208- walletMgr := t .ctx .Scheduler .GetServices ().WalletManager ()
209- for i := 0 ; i < len (clients ); i ++ {
210- client := clients [i % len (clients )]
211-
212- t .logger .WithFields (logrus.Fields {
213- "client" : client .GetName (),
214- }).Infof ("sending tx: %v" , tx .Hash ().Hex ())
215-
216- err := walletMgr .GetTxPool ().SendTransaction (ctx , t .wallet , tx , & spamoor.SendTransactionOptions {
217- Client : walletMgr .GetClient (client ),
218- ClientsStartOffset : i ,
219- })
220- if err == nil {
221- break
222- }
205+ return fmt .Errorf ("no ready clients available" )
206+ }
207+
208+ walletMgr := t .ctx .Scheduler .GetServices ().WalletManager ()
209+
210+ for i := 0 ; i < len (clients ); i ++ {
211+ client := clients [i % len (clients )]
212+
213+ t .logger .WithFields (logrus.Fields {
214+ "client" : client .GetName (),
215+ }).Infof ("sending tx: %v" , tx .Hash ().Hex ())
216+
217+ err = walletMgr .GetTxPool ().SendTransaction (ctx , t .wallet , tx , & spamoor.SendTransactionOptions {
218+ Client : walletMgr .GetClient (client ),
219+ ClientsStartOffset : i ,
220+ })
221+ if err == nil {
222+ break
223223 }
224224 }
225225
@@ -234,10 +234,12 @@ func (t *Task) Execute(ctx context.Context) error {
234234 t .ctx .Outputs .SetVar ("transactionHash" , tx .Hash ().Hex ())
235235
236236 if t .config .AwaitReceipt {
237- receipt , err := t .ctx .Scheduler .GetServices ().WalletManager ().GetTxPool ().AwaitTransaction (ctx , t .wallet , tx )
237+ var receipt * ethtypes.Receipt
238+
239+ receipt , err = t .ctx .Scheduler .GetServices ().WalletManager ().GetTxPool ().AwaitTransaction (ctx , t .wallet , tx )
238240 if err != nil {
239241 t .logger .Warnf ("failed waiting for tx receipt: %v" , err )
240- return fmt .Errorf ("failed waiting for tx receipt: %v " , err )
242+ return fmt .Errorf ("failed waiting for tx receipt: %w " , err )
241243 }
242244
243245 if receipt == nil {
@@ -260,14 +262,15 @@ func (t *Task) Execute(ctx context.Context) error {
260262
261263 t .ctx .Outputs .SetVar ("contractAddress" , receipt .ContractAddress .Hex ())
262264
263- if receiptData , err := vars .GeneralizeData (receipt ); err == nil {
265+ receiptData , generalizeErr := vars .GeneralizeData (receipt )
266+ if generalizeErr == nil {
264267 t .ctx .Outputs .SetVar ("receipt" , receiptData )
265268
266269 if t .config .TransactionReceiptResultVar != "" {
267270 t .ctx .Vars .SetVar (t .config .TransactionReceiptResultVar , receiptData )
268271 }
269272 } else {
270- t .logger .Warnf ("Failed setting `receipt` output: %v" , err )
273+ t .logger .Warnf ("Failed setting `receipt` output: %v" , generalizeErr )
271274 }
272275
273276 if len (t .config .ExpectEvents ) > 0 {
@@ -306,7 +309,8 @@ func (t *Task) Execute(ctx context.Context) error {
306309 for _ , authorizationWallet := range t .authorizationWallets {
307310 // resync nonces of authorization wallets (might be increased by more than one, so we need to resync)
308311 client := t .ctx .Scheduler .GetServices ().WalletManager ().GetReadyClient ()
309- err := authorizationWallet .UpdateWallet (ctx , client , true )
312+
313+ err = authorizationWallet .UpdateWallet (ctx , client , true )
310314 if err != nil {
311315 return fmt .Errorf ("cannot update authorization wallet: %w" , err )
312316 }
@@ -317,6 +321,7 @@ func (t *Task) Execute(ctx context.Context) error {
317321 return nil
318322}
319323
324+ //nolint:gocyclo // transaction generation has multiple branches for different tx types
320325func (t * Task ) generateTransaction () (* ethtypes.Transaction , error ) {
321326 var toAddr * common.Address
322327
@@ -368,6 +373,7 @@ func (t *Task) generateTransaction() (*ethtypes.Transaction, error) {
368373 } else {
369374 txObj , err = t .wallet .BuildLegacyTx (txData )
370375 }
376+
371377 if err != nil {
372378 return nil , err
373379 }
@@ -377,27 +383,25 @@ func (t *Task) generateTransaction() (*ethtypes.Transaction, error) {
377383 return nil , fmt .Errorf ("contract deployment not supported with blob transactions" )
378384 }
379385
380- blobData := t .config .BlobData
381- if blobData == "" {
382- blobData = "identifier"
383- }
384-
385386 blobCount := t .config .BlobSidecars
387+
386388 blobRefs := make ([][]string , blobCount )
387- for i := 0 ; i < int (blobCount ); i ++ {
389+
390+ for i := uint64 (0 ); i < blobCount ; i ++ {
388391 blobLabel := fmt .Sprintf ("0x1611AA0000%08dFF%02dFF%04dFEED" , t .ctx .Index , i , 0 )
389392
390393 if t .config .BlobData != "" {
391394 blobRefs [i ] = []string {}
395+
392396 for _ , blob := range strings .Split (t .config .BlobData , "," ) {
393397 if blob == "label" {
394398 blob = blobLabel
395399 }
400+
396401 blobRefs [i ] = append (blobRefs [i ], blob )
397402 }
398-
399403 } else {
400- specialBlob := mrand .Intn (50 )
404+ specialBlob := mrand .Intn (50 ) //nolint:gosec // weak random is fine here
401405 switch specialBlob {
402406 case 0 : // special blob commitment - all 0x0
403407 blobRefs [i ] = []string {"0x0" }
@@ -432,6 +436,7 @@ func (t *Task) generateTransaction() (*ethtypes.Transaction, error) {
432436 } else {
433437 txObj , err = t .wallet .BuildBlobTx (blobTx )
434438 }
439+
435440 if err != nil {
436441 return nil , err
437442 }
@@ -479,6 +484,7 @@ func (t *Task) generateTransaction() (*ethtypes.Transaction, error) {
479484 } else {
480485 txObj , err = t .wallet .BuildSetCodeTx (setCodeTx )
481486 }
487+
482488 if err != nil {
483489 return nil , err
484490 }
@@ -501,6 +507,7 @@ func (t *Task) generateTransaction() (*ethtypes.Transaction, error) {
501507 } else {
502508 txObj , err = t .wallet .BuildDynamicFeeTx (txData )
503509 }
510+
504511 if err != nil {
505512 return nil , err
506513 }
0 commit comments