-
Notifications
You must be signed in to change notification settings - Fork 0
test: add comprehensive WebSocket and BBO integration tests #91
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
terwey
merged 19 commits into
codex/investigate-multi-wallet-support-for-hyperliquid
from
claude/investigate-multi-wallet-hyperliquid-011CUttd5YC1AH2KMtTV8QUu
Nov 8, 2025
Merged
test: add comprehensive WebSocket and BBO integration tests #91
terwey
merged 19 commits into
codex/investigate-multi-wallet-support-for-hyperliquid
from
claude/investigate-multi-wallet-hyperliquid-011CUttd5YC1AH2KMtTV8QUu
Nov 8, 2025
Conversation
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
Add 22 new integration tests covering critical gaps in Hyperliquid WebSocket and BBO functionality: WebSocket Order Updates (6 tests): - Order creation, modification, and cancellation via WebSocket - Full and partial fill updates - Integration with fill tracker service - Multiple concurrent orders handling - WebSocket reconnection scenarios BBO Subscription (10 tests): - Basic BBO subscription and data retrieval - Multiple coin subscriptions - BBO channel broadcasting to multiple subscribers - Case-insensitive coin symbol handling - Context timeout handling - Subscription cleanup on context cancellation - BBO data for IOC order pricing - Concurrent BBO subscriptions across different coins Multi-Wallet Support (6 tests): - Order isolation between different wallets - Concurrent order creation across multiple wallets - BBO data sharing across wallet connections - Concurrent BBO subscriptions from multiple wallets - Combined order operations and BBO subscriptions These tests address the critical missing coverage identified in the investigation, particularly around real-time WebSocket updates and market data functionality that are essential for production readiness. Related to multi-wallet Hyperliquid support.
24fb0f7 to
6c2729c
Compare
- Change filltracker.NewService back to filltracker.New - Remove unused storage import from bbo_integration_test.go - Remove unused storage import from multi_wallet_integration_test.go
Remove calls to non-existent filltracker methods (SubmitBaseOrder, CurrentPosition). The test now verifies WebSocket properly passes updates to the tracker via UpdateStatus, which is the actual integration point.
VenueID type changed from int to string. Update all test files to use string format for venue IDs (e.g., 'test-venue-1' instead of 1).
Fix remaining int to string conversions for VenueID in concurrent test loops.
The go-hyperliquid SDK WebSocket client defaults to TLS (wss://) but the mock server runs on HTTP. These tests are temporarily skipped until: 1. The mock server adds non-TLS WebSocket support, OR 2. The go-hyperliquid SDK adds a WsOpt to disable TLS for testing Issue: WebSocket dial returns 'tls: first record does not look like a TLS handshake' Tests skipped: - TestMultiWalletBBOSharing - TestMultiWalletConcurrentBBOSubscriptions - TestMultiWalletOrderAndBBOConcurrent
- dep: fix upstream hyperliquid client to support non-TLS Websocket scheme - chore: temporarily replace with fork for dependency
c199ad4 to
0e1e2a5
Compare
After upgrading hyperliquid-mock from v0.0.3 to v0.1.0, the mock server now enforces wallet isolation. This caused 25 test failures where tests created orders with one wallet (from newMockExchange) but queried them with a different hardcoded wallet (e.g., "0xtest"). Changes: - Modified newMockExchange() to return both the Exchange and its wallet address - Updated all Info client instantiations to use the wallet from newMockExchange - Updated all WebSocket client instantiations to use the wallet from newMockExchange - Fixed multi-wallet tests to use wallets from newMockExchange instead of hardcoded values This ensures that Info queries, WebSocket subscriptions, and order operations all use the same wallet address, respecting the mock server's isolation. Fixes: - 16 Info/OrderLifecycle test failures (unknown_cloid errors) - 4 StatusRefresher test failures - 5 WebSocket test failures (timeouts waiting for events) Co-authored-by: Claude <[email protected]>
The test was expecting wallets NOT to see their own orders, which was based on the old behavior where WebSocket clients subscribed to hardcoded wallet addresses that differed from the exchange wallets. With proper wallet isolation, the test should verify: - Wallet 1 client SEES wallet 1 orders (✓) - Wallet 1 client does NOT see wallet 2 orders (✓) - Wallet 2 client SEES wallet 2 orders (✓) - Wallet 2 client does NOT see wallet 1 orders (✓) This properly tests wallet isolation: each wallet sees only its own orders. Co-authored-by: Claude <[email protected]>
This documents the intermittent WebSocket orderUpdates delivery failures observed with hyperliquid-mock v0.1.0 when multiple wallets connect concurrently. Includes reproduction steps, suspected root causes, and debug instrumentation recommendations. Co-authored-by: Claude <[email protected]>
This version includes the fix for WebSocket race condition when multiple wallets connect concurrently (see BUG_REPORT_WEBSOCKET_RACE.md). Note: go.sum needs to be updated via 'go mod tidy' - unable to download dependencies in current environment. Co-authored-by: Claude <[email protected]>
The WebSocket race condition has been resolved in hyperliquid-mock v0.1.1. Added a prominent update notice at the top of the bug report. Co-authored-by: Claude <[email protected]>
In CI environments, WebSocket subscriptions need a brief moment to fully establish before orders are created. Without this delay, rapid order creation can result in missed WebSocket updates due to: - Subscription not fully registered in mock server - Goroutine scheduling differences in CI - Network timing variations Adding 100ms delay after ws.New() ensures subscription is ready before test operations begin. This resolves flaky CI failures in: - TestWebSocketMultipleOrders - TestWebSocketReconnection Tests pass consistently locally but fail in CI due to timing differences. This is a pragmatic fix while mock server implements more robust subscription handshaking. Co-authored-by: Claude <[email protected]>
…011CUvWQj6z6hFJFmECjFPAx fix: align integration tests with hyperliquid-mock wallet isolation
dep: dependency hyperliquid-mock now supports multi-wallet
9dda792
into
codex/investigate-multi-wallet-support-for-hyperliquid
1 check passed
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.
Add 22 new integration tests covering critical gaps in Hyperliquid WebSocket and BBO functionality:
WebSocket Order Updates (6 tests):
BBO Subscription (10 tests):
Multi-Wallet Support (6 tests):
These tests address the critical missing coverage identified in the investigation, particularly around real-time WebSocket updates and market data functionality that are essential for production readiness.
Related to multi-wallet Hyperliquid support.