bifrost: emit reorg errata only on definitive not-found

Summary

This MR hardens reorg errata handling so we only emit errata when tx absence is definitive, and avoid false errata on transient RPC/node failures.

What changed

  • Added shared reorg helpers in bifrost/pkg/chainclients/shared/reorg:
    • TxCheckStatus (Confirmed, Errata, Unknown)
    • IsUTXOTxNotFoundErr
    • IsUTXOTxNotInMempoolErr
    • IsEVMTxNotFoundErr
  • Refactored chain clients to use shared status/helpers:
    • bitcoin/client.go
    • ethereum/ethereum_block_scanner.go
    • evm/evm_block_scanner.go
    • shared/evm/eth_rpc.go
  • Behavior change:
    • RPC/network/timeout/non-definitive errors -> Unknown (log warning, keep tx in metadata, no errata)
    • definitive not-found -> Errata
  • Added shared tests:
    • bifrost/pkg/chainclients/shared/reorg/reorg_test.go

Why

Original issue: tx reconfirmation could treat any RPC failure as “missing tx” and emit errata incorrectly.
This MR centralizes classification and makes errata emission explicit and conservative.

Summary by CodeRabbit

  • Improvements
    • More nuanced transaction-status detection during reorganizations, distinguishing confirmed, missing (errata), and uncertain cases for Bitcoin, Zcash, and EVM chains.
    • Enhanced mempool checks to reduce false errata reports and improve confirmation accuracy.
    • Clearer logging and more robust handling of transient RPC errors, yielding fewer mistaken removals of valid transactions.
Edited by Ghost User

Merge request reports

Loading
Loading