F-2026-canonicalization#264
Merged
Merged
Conversation
Shared canonical string forms for ballot/storage keys, keyed by CAIP-2 namespace: eip155 addresses -> EIP-55, eip155 hashes -> 0x-lowercase, solana -> base58 preserved (case-significant) / hex lowercased, other -> trimmed. Strict variants reject malformed input; lenient variants fall back to trimmed input on the vote-ingress path that must never drop a vote. Foundation for the ballot-key and token-key canonicalization fixes.
…17022] GetTokenConfigsStorageKey canonicalizes the address per CAIP-2 namespace (EIP-55 for eip155), making the storage key the single canonical chokepoint for add/update/remove/get. The PRC20 reverse index moves from lowercase to EIP-55 and GetTokenConfigByPRC20 canonicalizes its query identically. TokenConfig/NativeRepresentation ValidateBasic enforce parseable addresses, so case-variant duplicate registrations collide on the canonical key and are rejected.
…26-17041] VoteFundMigration canonicalizes the observed txHash against the migration's chain namespace before deriving the ballot key, so equivalent hash encodings from different validators aggregate on one ballot instead of fragmenting. Adds MsgVoteFundMigration.ValidateBasic.
… [F-2026-16039, F-2026-16632] Replace full-proto-Marshal ballot identity with explicit injective digests (hashFields: sha256 over per-field sha256 hex digests joined by ':'), domain-separated via collections prefixes so inbound vs outbound keys stay disjoint in the shared Ballots map. The inbound digest covers every execution-relevant field except universal_payload (recomputed on-chain from raw_payload); the outbound digest covers all observation fields. Inbound fields are canonicalized at vote / admin-revert ingress and the key functions self-canonicalize, so stored state, UTX keys and registry lookups all converge on one representation per logical event. Because the digests are one-way, the ballot terminal hook now locates the audit-trail entry by scanning PendingInbounds for the ballot id instead of decoding the inbound back out of the id. Existing test assertions updated for the canonical (EIP-55 / lowercase-hash) stored forms.
Let off-chain validators read the canonical UTX id + ballot ids from the chain rather than re-implementing the canonicalization/digest rules. InboundKeys(inbound) returns utx_id, ballot_id and the canonical inbound; OutboundBallotKey(utx_id, outbound_id, observed_tx) looks up the outbound's destination chain to canonicalize the observed hash, then returns the ballot id and canonical observation. Includes generated proto.
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.
No description provided.