Skip to content

Fix read_miner_commitments SS58 decoding#58

Merged
LandynDev merged 1 commit intotestfrom
fix/read-miner-commitments-ss58
Apr 17, 2026
Merged

Fix read_miner_commitments SS58 decoding#58
LandynDev merged 1 commit intotestfrom
fix/read-miner-commitments-ss58

Conversation

@LandynDev
Copy link
Copy Markdown
Collaborator

Summary

Root cause of the E2E suite failing at "rate 345 not found" (cascading into every swap-dependent suite). substrate-interface's query_map over Commitments.CommitmentOf returns the second-map key as raw bytes in a single-element tuple, not an SS58 string. The batched refactor in 47155d1 compared str(key.value) — a tuple repr — against the metagraph's SS58 hotkey index, so every lookup returned None and every commitment was silently dropped.

Visible effects:

  • alw view rates → "No rates found" even with active miners posting rates
  • Validator scoring's rate events never populated
  • alw swap now can't find a miner → swap initiation fails
  • E2E suite 01 failed "Miner-1 visible in rates"; suite 02 and downstream cascaded

Fix

Decode the query_map key to 32 bytes and ss58_encode(..., 42) to match the SS58 string the metagraph uses.

Test plan

  • alw view rates now returns the miner's posted rate
  • Unit tests pass (pytest tests/test_commitments.py)
  • Full pytest suite passes (279 tests)
  • Ruff clean
  • E2E suite 01-02 happy path against dev env (should pass once merged)

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.
@LandynDev LandynDev merged commit accafd6 into test Apr 17, 2026
2 checks passed
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.

1 participant