Skip to content

Commit a01ba76

Browse files
fix(mcms): improve error handling in confirmTransaction
1 parent c38ded5 commit a01ba76

2 files changed

Lines changed: 18 additions & 12 deletions

File tree

.changeset/true-mammals-lie.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"chainlink-deployments-framework": patch
3+
---
4+
5+
fix(mcms): improve error handling in confirmTransaction

engine/cld/legacy/cli/mcmsv2/mcms_v2.go

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1542,24 +1542,25 @@ func confirmTransaction(ctx context.Context, lggr logger.Logger, tx types.Transa
15421542
lggr.Infof("Transaction %s confirmed in block %d", tx.Hash, block)
15431543
return nil
15441544
}
1545-
rcpt, err := chain.Client.TransactionReceipt(ctx, common.HexToHash(tx.Hash))
1546-
if err != nil {
1547-
return fmt.Errorf("error getting transaction receipt for %s: %w", tx.Hash, err)
1545+
lggr.Errorf("failed to confirm transaction: %s", err)
1546+
rcpt, rerr := chain.Client.TransactionReceipt(ctx, common.HexToHash(tx.Hash))
1547+
if rerr != nil || rcpt == nil {
1548+
return fmt.Errorf("error getting transaction receipt for %s: %w", tx.Hash, rerr)
1549+
}
1550+
lggr.Infof("transaction receipt: %#v", rcpt)
1551+
if rcpt.Status == gethtypes.ReceiptStatusSuccessful {
1552+
return nil
15481553
}
1549-
if rcpt != nil && rcpt.Status == 0 && cfg.proposalCtx != nil {
1554+
if cfg.proposalCtx != nil {
15501555
// Decode via simulation to recover revert bytes
1551-
if pretty, ok := tryDecodeTxRevertEVM(
1552-
ctx,
1553-
chain.Client,
1554-
tx.RawData.(*gethtypes.Transaction),
1555-
bindings.ManyChainMultiSigABI,
1556-
rcpt.BlockNumber,
1557-
cfg.proposalCtx); ok {
1556+
pretty, ok := tryDecodeTxRevertEVM(ctx, chain.Client, tx.RawData.(*gethtypes.Transaction),
1557+
bindings.ManyChainMultiSigABI, rcpt.BlockNumber, cfg.proposalCtx)
1558+
if ok {
15581559
return fmt.Errorf("tx %s reverted: %s", tx.Hash, pretty)
15591560
}
15601561
}
15611562

1562-
return err
1563+
return fmt.Errorf("transaction failed (receipt: %#v): %w", rcpt, err)
15631564
}
15641565

15651566
if family == chainsel.FamilyAptos {

0 commit comments

Comments
 (0)