Skip to content

F-2026-canonicalization#264

Merged
0xNilesh merged 5 commits into
audit-fixesfrom
F-2026-canonicalization
Jun 5, 2026
Merged

F-2026-canonicalization#264
0xNilesh merged 5 commits into
audit-fixesfrom
F-2026-canonicalization

Conversation

@0xNilesh

@0xNilesh 0xNilesh commented Jun 5, 2026

Copy link
Copy Markdown
Member

No description provided.

0xNilesh added 5 commits June 4, 2026 20:15
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.
@0xNilesh 0xNilesh merged commit 93de525 into audit-fixes Jun 5, 2026
6 of 7 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