Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@terwey
Copy link
Collaborator

@terwey terwey commented Nov 8, 2025

No description provided.

terwey and others added 9 commits November 8, 2025 14:30
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
@terwey terwey marked this pull request as ready for review November 8, 2025 17:29
@terwey terwey merged commit a909641 into claude/investigate-multi-wallet-hyperliquid-011CUttd5YC1AH2KMtTV8QUu Nov 8, 2025
1 check passed
@terwey terwey deleted the mock/wallet-isolation branch November 8, 2025 17:33
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.

3 participants