fix: support --serve-info nodes via ABCI state fallback#11
Open
yangwao wants to merge 29 commits intohyperliquid-dex:mainfrom
Open
fix: support --serve-info nodes via ABCI state fallback#11yangwao wants to merge 29 commits intohyperliquid-dex:mainfrom
yangwao wants to merge 29 commits intohyperliquid-dex:mainfrom
Conversation
…e snapshots The `fileSnapshot` API endpoint is not available when the node is started with `--serve-info`, causing the order book server to crash with "No such file or directory" (issue hyperliquid-dex#1). This adds a fallback: when the API returns an error, the server reads the latest `.rmp` file from `periodic_abci_states/` and uses `hl-node compute-l4-snapshots` to generate the L4 snapshot JSON. The `hl-node` binary path and chain can be configured via `HL_NODE_PATH` and `HL_CHAIN` environment variables. Additionally, snapshot fetch errors are now non-fatal — the listener logs the error and retries on the next tick instead of crashing. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…r waits until it exits when there is no new data
Handles special addresses (Assistance Fund 0xFE, HIP-2 0xFF) that don't emit order_status events by creating synthetic Alo Limit order entries. Removes the spot coin subscription filter. Opt-in via --include-spot-unsafe CLI flag since the order type assumption is an approximation. Cherry-picked from hyperliquid-dex#10. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
When running in separate Docker containers, the node and OBS have isolated filesystems. The fileSnapshot API writes to an outPath on the node's filesystem, but the OBS tries to read it from its own. By using a path inside the shared volume (hl/out.json), both containers can access the same file. The CLI fallback still writes to the local filesystem since hl-node runs as a subprocess of the OBS. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Author
|
I made docker hub image for hyperliquid order book server if it helps someone |
…etches The fileSnapshot API was hitting port 3001 but the node serves on 4001. Added a 30s timeout to the reqwest client so the OBS falls back quickly when the node is unavailable instead of hanging indefinitely. Also added an AtomicBool guard to prevent the 10s ticker from spawning overlapping fetch_snapshot tasks that pile up hl-node subprocesses. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Port 4001 is the binary gossip protocol, not HTTP. The info API (--serve-info) listens on port 3001. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
Summary
Fixes #1 — the order book server crashes with
Listener fatal error: No such file or directory (os error 2)when the node is started with--serve-info, because thefileSnapshotAPI endpoint is not available.fileSnapshotAPI fails (HTTP 422 from--serve-infonodes, or connection errors), the server now falls back to reading the latest periodic ABCI state.rmpfile fromhl/data/periodic_abci_states/and computing L4 snapshots viahl-node --chain <chain> compute-l4-snapshots --include-usersHL_NODE_PATH(default:hl-nodeon PATH) andHL_CHAIN(default:Mainnet)How it works
process_rmp_file()first tries the existingfileSnapshotAPI (backwards compatible with full nodes).rmpinperiodic_abci_states/{date}/by block heighthl-node compute-l4-snapshots --include-users <rmp_path> <output_path>[height, data]to match thefileSnapshotformat.rmpfilename (e.g.,917510000.rmp→ height917510000)Setup for Docker
The
hl-nodebinary needs to be accessible to the order book server container. Options:HL_NODE_PATHto point to the binary locationTest plan
cargo check— compiles cleanly with no warningscargo test— all 10 tests pass--serve-infonode that has periodic ABCI state files on disk🤖 Generated with Claude Code