fix(signing): enable compact ints in msgpack encoder - #20
Merged
Conversation
Hyperliquid’s backend (and the official Python SDK) serialise all small integers using msgpack’s compact-int formats (uint8/uint16/uint32/uint64). Our Go signer always emitted the int64 tag (0xd3), which changed the bytes that are hashed and caused cancel / modify signatures to recover an invalid wallet address (“User or API Wallet … does not exist.”).
sonirico
marked this pull request as ready for review
August 14, 2025 11:28
Owner
|
This is a big one. I personally consume public / historical data APIs and websocket feeds so I implemented authenticated endpoints just for completeness, so this completely passed by inadvertently. Thanks! (Merging it out in spite of failed CI, seems like coveralls is down). |
Contributor
Author
|
@sonirico all good, I mostly need the place order and cancel order endpoints. But before I integrate I want to ensure they're rock solid and don't accidentally bankrupt my user 😄 |
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.
Small PR but big impact, this bubbled up as I was writing unit tests for Cancel as proposed in #18.
I for the life of me could not get a single Cancel out there, eventually I decided to compare the hex dumps of what Python packs and what Go packs and noticed a difference in the integer sizes. There was a suspicion but wasn't sure.
I decided to split it off as I want to do a proper code revert tomorrow (I tried a lot) to see what is really required and not. But this is for now a big one we need to match!
Hyperliquid’s backend (and the official Python SDK) serialise all small integers using msgpack’s compact-int formats (uint8/uint16/uint32/uint64). Our Go signer always emitted the int64 tag (0xd3), which changed the bytes that are hashed and caused cancel / modify signatures to recover an invalid wallet address (“User or API Wallet … does not exist.”).