Skip to content

Commit 5936b3b

Browse files
fix(mcms): improve error handling in confirmTransaction (#594)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 95f96d9 commit 5936b3b

2 files changed

Lines changed: 20 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: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1545,24 +1545,27 @@ func confirmTransaction(ctx context.Context, lggr logger.Logger, tx types.Transa
15451545
lggr.Infof("Transaction %s confirmed in block %d", tx.Hash, block)
15461546
return nil
15471547
}
1548-
rcpt, err := chain.Client.TransactionReceipt(ctx, common.HexToHash(tx.Hash))
1549-
if err != nil {
1550-
return fmt.Errorf("error getting transaction receipt for %s: %w", tx.Hash, err)
1548+
lggr.Errorf("failed to confirm transaction %s: %s", tx.Hash, err)
1549+
rcpt, rerr := chain.Client.TransactionReceipt(ctx, common.HexToHash(tx.Hash))
1550+
if rerr != nil {
1551+
return fmt.Errorf("failed to get transaction receipt for %s: %w", tx.Hash, rerr)
1552+
}
1553+
if rcpt == nil {
1554+
return fmt.Errorf("got nil receipt for %s", tx.Hash)
1555+
}
1556+
if rcpt.Status == gethtypes.ReceiptStatusSuccessful {
1557+
return nil
15511558
}
1552-
if rcpt != nil && rcpt.Status == 0 && cfg.proposalCtx != nil {
1559+
if cfg.proposalCtx != nil {
15531560
// Decode via simulation to recover revert bytes
1554-
if pretty, ok := tryDecodeTxRevertEVM(
1555-
ctx,
1556-
chain.Client,
1557-
tx.RawData.(*gethtypes.Transaction),
1558-
bindings.ManyChainMultiSigABI,
1559-
rcpt.BlockNumber,
1560-
cfg.proposalCtx); ok {
1561+
pretty, ok := tryDecodeTxRevertEVM(ctx, chain.Client, tx.RawData.(*gethtypes.Transaction),
1562+
bindings.ManyChainMultiSigABI, rcpt.BlockNumber, cfg.proposalCtx)
1563+
if ok {
15611564
return fmt.Errorf("tx %s reverted: %s", tx.Hash, pretty)
15621565
}
15631566
}
15641567

1565-
return err
1568+
return fmt.Errorf("transaction %s failed (block number %v): %w", tx.Hash, rcpt.BlockNumber, err)
15661569
}
15671570

15681571
if family == chainsel.FamilyAptos {

0 commit comments

Comments
 (0)