Fix read_miner_commitments SS58 decoding#58
Merged
Conversation
substrate-interface's query_map over the Commitments.CommitmentOf double map returns the second-map key (hotkey AccountId) as raw bytes wrapped in a single-element tuple. Commit 47155d1 batched the commitment reads via query_map but compared the str() of that tuple against the metagraph's SS58 hotkey index — so the lookup always returned None and every miner's commitment got dropped. Result: 'alw view rates', scoring rate aggregation, and any swap that relies on a posted miner commitment returned empty. Decode the tuple to 32 bytes and ss58_encode with prefix 42 to match how the metagraph keys hotkeys.
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
Root cause of the E2E suite failing at "rate 345 not found" (cascading into every swap-dependent suite).
substrate-interface'squery_mapoverCommitments.CommitmentOfreturns the second-map key as raw bytes in a single-element tuple, not an SS58 string. The batched refactor in47155d1comparedstr(key.value)— a tuple repr — against the metagraph's SS58 hotkey index, so every lookup returnedNoneand every commitment was silently dropped.Visible effects:
alw view rates→ "No rates found" even with active miners posting ratesalw swap nowcan't find a miner → swap initiation failsFix
Decode the query_map key to 32 bytes and
ss58_encode(..., 42)to match the SS58 string the metagraph uses.Test plan
alw view ratesnow returns the miner's posted ratepytest tests/test_commitments.py)