Skip to content

Commit 5fb674c

Browse files
committed
Fix send transaction bug
1 parent e998af0 commit 5fb674c

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

pkg/txm/clientwrappers/dualbroadcast/meta_client.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,9 @@ func (a *MetaClient) SendTransaction(ctx context.Context, tx *types.Transaction,
166166
if err := a.SendOperation(ctx, tx, attempt, *meta); err != nil {
167167
return fmt.Errorf("failed to send operation for transactionID(%d): %w", tx.ID, err)
168168
}
169+
return nil
169170
}
171+
return errors.New("meta transaction was empty")
170172
}
171173
return a.c.SendTransaction(ctx, attempt.SignedTransaction)
172174
}
@@ -372,7 +374,7 @@ func VerifyMetadata(txData []byte, fromAddress common.Address, result Metacallda
372374
if !ok {
373375
return nil, errors.New("update method not found in ABI")
374376
}
375-
if !bytes.HasPrefix(result.UOP.Data, updateFn.ID) {
377+
if len(result.UOP.Data) < 4 || !bytes.HasPrefix(result.UOP.Data, updateFn.ID) {
376378
return nil, fmt.Errorf("incorrect method id in uop.Data: %v", result.UOP.Data)
377379
}
378380

@@ -461,7 +463,7 @@ func verifyRaw(raw any) (reflect.Value, error) {
461463
return rv, errors.New("raw is invalid")
462464
}
463465

464-
if rv.Kind() == reflect.Ptr || rv.Kind() == reflect.Interface {
466+
if rv.Kind() == reflect.Pointer || rv.Kind() == reflect.Interface {
465467
if rv.IsNil() {
466468
return rv, errors.New("raw is nil")
467469
}
@@ -510,7 +512,7 @@ func copyUserOp(raw any) (UO, error) {
510512
if err != nil {
511513
return u, err
512514
}
513-
if !(f.Kind() == reflect.Slice && f.Type().Elem().Kind() == reflect.Uint8) {
515+
if f.Kind() != reflect.Slice || f.Type().Elem().Kind() != reflect.Uint8 {
514516
return u, errors.New("field Data not []byte")
515517
}
516518
u.Data = f.Bytes()
@@ -546,7 +548,7 @@ func copySolverOps(raw any) ([]SO, error) {
546548
if !sliceVal.IsValid() {
547549
return nil, errors.New("raw is invalid")
548550
}
549-
if sliceVal.Kind() == reflect.Ptr || sliceVal.Kind() == reflect.Interface {
551+
if sliceVal.Kind() == reflect.Pointer || sliceVal.Kind() == reflect.Interface {
550552
if sliceVal.IsNil() {
551553
return nil, errors.New("raw is nil")
552554
}

0 commit comments

Comments
 (0)