Skip to content

Add genesis migration dual-write queue for new Core chain#748

Open
rickyrombo wants to merge 1 commit intomainfrom
mjp-new-chain-queue
Open

Add genesis migration dual-write queue for new Core chain#748
rickyrombo wants to merge 1 commit intomainfrom
mjp-new-chain-queue

Conversation

@rickyrombo
Copy link
Copy Markdown
Contributor

Summary

  • After a relay transaction is confirmed, enqueue it (fire-and-forget) into new_chain_queue
  • NewChainFlusher goroutine drains the queue and forwards transactions to the new Core chain via ForwardTransaction ConnectRPC

Ordering

Transactions are flushed sequentially in insertion order. Parallel flushing was considered and rejected: dev apps can act on behalf of other users, creating cross-user ordering dependencies that no simple partitioning scheme can safely handle.

On error the flusher halts at the failing row (2s backoff + retry) rather than skipping — skipping would violate ordering. Mempool-full responses are retried separately with exponential backoff (500ms → 15s cap).

Config knobs (all off by default)

Env var Purpose
newChainUrl ConnectRPC endpoint of the bootstrap node
newChainQueueEnabled Turns on enqueueing in the relay path
newChainFlushEnabled Starts the background flusher goroutine
newChainFlushFromBlock Trims rows already covered by the genesis backfill
newChainInsecureSkipVerify Disables TLS verification (for localstack / self-signed certs)

Test plan

  • Unit tests cover: enqueue correctness, backfill trim, trim+flush, full drain
  • Deploy with all knobs off — no behaviour change
  • Enable newChainQueueEnabled first to populate the queue before enabling the flusher

🤖 Generated with Claude Code

After a relay transaction is confirmed on the legacy chain, enqueue it
(fire-and-forget) into new_chain_queue. A background NewChainFlusher
goroutine drains the queue and forwards transactions to the new Core
chain via ConnectRPC/ForwardTransaction.

Transactions are flushed sequentially in insertion order. Parallel
flushing was considered and rejected: dev apps can act on behalf of
other users, creating cross-user ordering dependencies that no simple
partitioning scheme can safely handle.

On error the flusher halts at the failing row (with a 2s backoff) and
retries rather than skipping — skipping would violate ordering. Mempool
full responses are retried separately with exponential backoff.

Config knobs (all off by default):
- newChainUrl: ConnectRPC endpoint of the bootstrap node
- newChainQueueEnabled: turns on enqueueing in the relay path
- newChainFlushEnabled: starts the background flusher goroutine
- newChainFlushFromBlock: trims rows already covered by the backfill
- newChainInsecureSkipVerify: disables TLS verification (e.g. localstack)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.

1 participant