Skip to content

Conversation

@mcrakhman
Copy link
Member

Overview

This note summarizes the logic implemented in grpc/src/tx_client_v2.rs and
grpc/src/tx_client_impl.rs.

This is very roughly made according to the spec (with main ideas):
https://github.com/celestiaorg/celestia-app/blob/main/specs/src/tx_client_v2.md

tx_client_v2.rs

  • Provides the generic transaction pipeline split into a front-end submitter
    (TransactionManager) and a background worker (TransactionWorker).
  • TransactionManager::add_tx serializes sequence reservation, signs the
    request via a SignFn, attaches one-shot callbacks, and enqueues the signed
    transaction.
  • TransactionWorker maintains an ordered queue, tracks per-node submission
    state, and drives the lifecycle with a single event loop:
    • Submits signed transactions to nodes, respecting sequence order.
    • Polls confirmation in batches (status_batch) on a timer.
    • Emits TransactionEvent results to resolve submit/confirm callbacks.
    • Handles recoverable failures by moving to a recovery state and re-syncing
      expected sequence.
  • Confirmation is in-order: confirmed info is buffered by sequence and drained
    when all prior sequences are confirmed.

tx_client_impl.rs

  • Implements the generic traits for a real gRPC client:
    • GrpcSignContext fetches account/chain state and gas estimates.
    • SignFnBuilder builds a SignFn<Hash, TxInfo> that creates signed tx bytes
      from TxRequest and TxConfig.
    • TxServer for GrpcClient wires submit and status_batch to gRPC calls and
      maps failures into v2 error types.
  • Adds TransactionService which hides the worker plumbing:
    • Builds a TransactionWorker using the client signer and current sequence.
    • Exposes submit(TxRequest, TxConfig) -> TxHandle<Hash, TxInfo>.
    • Supports recreate_worker() to rebuild the worker and manager if needed.

@mcrakhman mcrakhman marked this pull request as ready for review February 9, 2026 23:42
@mcrakhman mcrakhman merged commit 817f03d into main Feb 11, 2026
55 checks passed
@mcrakhman mcrakhman mentioned this pull request Feb 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants