Fix: Address Generation Issues - #21
Open
sephynox wants to merge 1 commit into
Open
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
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
The
SIGN_BLOCKreview screens displayed addresses with the key-type prefix encoded twice and a checksum computed over the doubled bytes, so the address a user saw on device never matched their real account. The encoder now takes the raw key and key type separately, matchingnode-rs'sformat_public_key_string, and review fields split on-chain values the same way the node does.Related Issues
Changes Made
keeta_address for every fieldaddressmode for those testsBreaking Changes
None
Note
Medium Risk
Changes address strings users see before signing (high user-impact) but fixes a correctness bug; scope is localized to encoding/formatting with strong reference tests.
Overview
Fixes incorrect
keeta_addresses on device by aligning encoding and review formatting with node-rs (format_public_key_string/to_public_key_string).generate_addressnow takes a raw key and explicit key type byte (notAlgorithm), with sharedADDRESS_PREFIX/CHECKSUM_LENconstants. GET_PUBLIC_KEY and signer derivation pass the algorithm discriminant as key type.SIGN_BLOCK review no longer treats on-chain account bytes as a pubkey with an inferred prefix: values are split as
keyType || rawKey, and 33-byte token keys default to secp256k1 (0x00) when no type byte is present.Algorithm::from_pubkey_prefixis removed.Tests: Rust and TypeScript reference verifiers add an
addressmode;test_address_display.pyasserts GET_PUBLIC_KEY and review-screen addresses match both references for all three key types; signature round-trip tests use shared verifier helpers inconftest.py.Reviewed by Cursor Bugbot for commit 0bd1652. Bugbot is set up for automated code reviews on this repo. Configure here.