feat(serve): full ogmios v7 interop for the ouroboros N2C endpoint#1120
Draft
Javieracost wants to merge 4 commits into
Draft
feat(serve): full ogmios v7 interop for the ouroboros N2C endpoint#1120Javieracost wants to merge 4 commits into
Javieracost wants to merge 4 commits into
Conversation
Points at the feat/txmonitor-server revision submitted upstream as txpipe/pallas#792; to be repinned to the mainline merge commit once that PR lands. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The ouroboros serve endpoint implemented only chainsync and statequery. Clients that open the local-tx-monitor protocol on the same connection - ogmios does so eagerly on every session - had the whole session killed by the multiplexer, since accepting the N2C handshake claims support for the full protocol set. Adds a txmonitor session handler backed by the domain mempool: - a snapshot is pending + inflight transactions, excluding Confirmed (already on-chain, a node mempool would not hold them), tagged with the current cursor slot - NextTx serves the era-wrapped payload; the wire era is the block era number minus one, same convention as the tx-submission peer client - HasTx matches on the tx hash alone, ignoring the era wrapper, so clients probing the same hash under multiple eras get a correct answer - GetSizes/GetMeasures report capacity as twice the max block body size from effective pparams, mirroring the cardano-node default - AwaitAcquire blocks until the snapshot fingerprint changes, waking on mempool events or tip changes; a closed mempool stream degrades to tip-driven wake-ups instead of busy-looping Includes two ToyDomain integration tests driving a real pallas NodeClient over a unix socket: snapshot queries against a seeded mempool, and await-acquire woken by a tip event. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Acquiring the volatile tip validated the cursor block against the archive store, which lags behind the cursor while the node is catching up, so a fully-functional node answered Failure(PointNotOnChain) to a request that cannot legitimately fail. On top of that, the request loop entered the acquired state even after sending a failure, so the client's spec-correct follow-up acquire was rejected as invalid for the current state and the whole statequery protocol died. Ogmios v7's health client hits both on every reconnect against a syncing mainnet node. Volatile-tip acquires now acquire the current cursor directly, and a failed acquire or re-acquire returns the loop to the idle state. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Four defects left archive-backed chain-sync unusable for any client that intersects below the WAL window (ogmios, kupo, any N2C syncer): - the initial rollback that opens every chain-sync exchange was sent to the first crawled block's point instead of the negotiated intersection, consuming that block in the process; archive-crawled points are slot-only and cannot encode into a wire point, so the send failed outright - that failure was silently discarded, so the server just stopped serving the protocol while the client waited forever for a reply - crawling from origin skipped the first block of the chain, since the archive batch loader always assumed the cursor block had already been delivered - a client awaiting at the tip died on the next chain re-org: an undo tip event returned without sending anything, leaving the client owed a reply and the server attempting to receive without agency The rollback now echoes the negotiated intersection point without consuming a block, chain-sync session errors are logged and propagated like the other mini-protocols, origin batches start at the first block in the archive, and the await loop skips over undo events until the mark or apply that follows them produces the owed reply. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What / Why
Running ogmios v7 on top of dolos 1.5.0's ouroboros N2C endpoint fails at three independent layers today:
Failure(PointNotOnChain)to a request that cannot legitimately fail. Worse, the request loop entered the acquired state even after sending a failure, so the client's spec-correct follow-up acquire was rejected as invalid and the whole statequery protocol died.findIntersectioninstantly and then waits forever for the first block. Four distinct defects: the initial rollback was sent to the first crawled block's point instead of the negotiated intersection (consuming that block — and archive-crawled points are slot-only, so the send failed outright); that failure was silently discarded, leaving the protocol dead while the client waited; crawling from origin skipped the first block of the chain; and a client awaiting at the tip died on the next re-org, because an undo tip event returned without sending the owed reply, leaving the server receiving without agency.This PR fixes all of the above — one commit per concern, each self-contained with protocol-level integration tests (a real pallas
NodeClientover a unix socket against the session handler):feat(serve): add local-tx-monitor server to the ouroboros N2C endpoint— mempool-backed sessions: a snapshot is pending + inflight transactions (Confirmed excluded, as a node mempool would not hold them) tagged with the cursor slot; era-wrapped NextTx payloads (block era − 1, same convention as the tx-submission peer client); HasTx matches on hash alone so era-probing clients get correct answers; capacity mirrors the cardano-node default (2× max block body size); AwaitAcquire blocks on snapshot fingerprint change, waking on mempool events or tip changes.fix(serve): stop failing statequery volatile-tip acquires during sync— volatile-tip acquires acquire the current cursor directly (the node's own tip needs no archive validation), and a failed acquire or re-acquire returns the loop to the idle state.fix(serve): serve historical chain-sync from the archive— the opening rollback echoes the negotiated intersection without consuming a block; chain-sync session errors are logged and propagated like the other mini-protocols; origin batches start at the first block in the archive; the await loop skips undo events until the mark or apply that follows produces the owed reply (undos have no wire counterpart — the mark that follows becomes the rollback).The three concerns are one story — making dolos a drop-in N2C backend for ogmios — but each commit stands alone; we can split the PR if you'd prefer smaller units.
Validation
Beyond the test suite, we validated end-to-end on mainnet: a full-history dolos + ogmios v7.0.0 replacing cardano-node + ogmios as the feed for a mainnet indexing pipeline.
Out of scope (observed while validating, pre-existing)
no overlap between archive and walpanic when the crawl cursor is a slot-only point.Happy to follow up on either separately.