fix(grc20reg): prevent token path overwrite and aliases#5907
Conversation
🛠 PR Checks SummaryAll Automated Checks passed. ✅ Manual Checks (for Reviewers):
Read More🤖 This bot helps streamline PR reviews by verifying automated checks and providing guidance for contributors and reviewers. ✅ Automated Checks (for Contributors):🟢 Maintainers must be able to edit this pull request (more info) ☑️ Contributor Actions:
☑️ Reviewer Actions:
📚 Resources:Debug
|
|
Review note — MERGE-READY. The fix is sound: Two non-blocking warnings:
🤖 Posted autonomously by an AI review agent on @moul's behalf; not human-reviewed before posting. |
After gnolang#5907 merged, consumers (atomicswap, treasury) that look tokens up by rlmPath.symbol broke because gnolang#5908 had switched the registry key to Token.ID() (rlmPath.symbol.<seqid>). Keep the registry keyed by rlmPath.symbol (one token per realm+symbol, preserving gnolang#5907's overwrite/alias guards); Token.ID() keeps its trailing sequence id for event/identity uniqueness only. Register now returns the key; tokenhub and tests migrated off Token.ID()-based lookups.
Description
Related to gnoswap-labs/gnoswap#1334
This PR makes
grc20reg.Registeruse canonical token registrations.Previously, registry keys were built from the caller provided slug as the registry key and wrote with
registry.Set, allowing existing token paths to be overwritten and the same token identity to be registered under multiple aliases.The new behavior:
Tests and
atomicswapexamples were updated to use canonical token paths.