Skip to content

Transaction confirmation and lifecycle tracking #19

@tac0turtle

Description

@tac0turtle

Summary

Implement transaction lifecycle tracking from broadcast through confirmation or rejection.

Parent: #4

Flow

Broadcast (SYNC) → Mempool → Included in Block → Committed
                      │              │
                      ▼              ▼
                   Evicted        Rejected (execution error)

Requirements

Broadcast

  • Use BroadcastTxSync (returns after mempool acceptance, not block inclusion)
  • Capture tx hash from response
  • Handle immediate rejection (invalid tx, mempool full)

Confirmation polling

  • Poll TxStatus at configurable interval (default: 1s)
  • Timeout after configurable duration (default: 2 minutes)
  • Return confirmed height and gas used on success

Eviction handling

  • If tx is evicted from mempool, optionally resubmit with same or bumped gas price
  • Max resubmission attempts: configurable (default: 1)
  • Log eviction events for debugging

Rejection handling

Timeout handling

  • If confirmation times out, return error but do NOT assume tx failed (it may still confirm)
  • Track "unconfirmed" transactions for later reconciliation

Interface

type TxResult struct {
    TxHash   string
    Height   int64
    GasUsed  int64
    Code     uint32       // 0 = success
    Error    string       // non-empty if Code != 0
    Duration time.Duration // broadcast to confirmation
}

type TxTracker interface {
    Submit(ctx context.Context, txBytes []byte) (*TxResult, error)
    Pending() []string // tx hashes still awaiting confirmation
}

References

  • celestia-app pkg/user/tx_client.goConfirmTx(), eviction handling
  • CometBFT TxStatus endpoint

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions