Repository navigation
THORChain: accept remote tokens from the info server - #1117
Merged
Merged
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
peachbits
requested changes
Oct 7, 2026
1 of 6 tasks
j0ntz
force-pushed
the
jon/thorchain-remote-tokens
branch
from
October 7, 2026 21:29
0f9a7a8 to
0b5048c
Compare
peachbits
approved these changes
Oct 7, 2026
THORChain had no synchronous createTokenId, so infoServerTokens entries were dropped. Share the Cosmos denom validation between the tools and the outer plugin, anchor it to the full cosmos-sdk denom charset, and reject remote entries that reuse the native denom or a known currency code.
Midgard names a token by its asset (THOR.RUJI, THOR.AUTO, X/RUJI), not by the bank denom the engine tracks (x/ruji, thor.auto). The shared mapping cut the name down to its last part, which matched nothing, and coin parsing rejected a denom with a dot, so the whole action was dropped from history. Port thornode's Asset.Native() as the THORChain mapping, keep the existing one for MAYAChain, and parse the full cosmos-sdk denom charset.
j0ntz
force-pushed
the
jon/thorchain-remote-tokens
branch
from
October 8, 2026 21:03
0b5048c to
33140f2
Compare
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.
CHANGELOG
Does this branch warrant an entry to the CHANGELOG?
Dependencies
none
Description
Asana task
thorchainruneandthorchainrunestagenetaccept bank-denom tokens from the info server'sinfoServerTokens: RUJI, AUTO, LQDY, secured BTC/ETH/SOL, sTCY, sRUJI, bRUNE and ybRUNE. The bundled token list is unchanged; TCY is still its only entry.Ingestion.
updateBuiltinTokenstakes remote tokens only from a plugin that supplies a synchronouscreateTokenId. THORChain had none, and every remote entry was dropped. The Cosmos denom check is a sharedcreateCosmosTokenIdhelper, called byCosmosTools.getTokenIdand by the THORChain outer plugins. The token id is the lowercased denom with slashes removed (x/staking-x/rujigivesxstaking-xruji). The raw denom stays innetworkLocation.contractAddress, the value balance queries andMsgSenduse.A remote THORChain entry is rejected when:
runeRUNE, or matches a bundled token with a different denomupdateBuiltinTokensalready does)The generic Cosmos denom regex had no end anchor and accepted any string with a valid prefix. It is anchored to the full cosmos-sdk charset. Mixed case stays legal there, which keeps custom tokens on other Cosmos chains working.
Native denom.
CosmosTools.getTokenIdrejects a token whose denom is the chain's ownnativeDenom, on every Cosmos plugin, withErrorInvalidContractAddress. The comparison ignores case, as the engine's balance matching does. Before this change the token was accepted. The THORChainrunecheck in the list above stays, because info server ingestion calls the outercreateTokenIdand never reachesgetTokenId.History. Midgard names an asset differently from the bank module:
THOR.RUJIin swaps andX/RUJIin sends for the denomx/ruji,THOR.AUTOforthor.auto. The shared mapping kept only the last segment of the name, which matched no token.extendedParseCoinsalso rejected a denom with a dot. Either one dropped the whole action from history.ThorchainEngineports thornode'sAsset.Native()for the mapping, MAYAChain keeps the previous mapping, and coin parsing takes the full cosmos-sdk charset.Other PRs. EdgeApp/edge-currency-accountbased#1115 covers the ingestion half and has no Midgard work. EdgeApp/edge-currency-accountbased#1034 removes the outer-plugin
createTokenIdhook and keepsCosmosTools.getTokenId. After it lands, thecreateTokenIdlines on the two THORChain infos are the only part of this PR to delete; the helper and the history mapping carry over.EdgeApp/edge-react-gui#6248 adds the testID the simulator flow uses to open a custom token's edit form. Neither PR depends on the other.
Testing. Unit tests cover the ten denoms, each rejection case, and Midgard fixtures copied from live actions. The iOS simulator run used a local proxy that adds the ten tokens to the info server rollup:
3EBA256AFAE3D177302B2F36A345247ACD0A4712AA678954B4E403A0965C6D2D)test/cosmos/nativeDenomTokenId.test.tschecks the native denom rejection, in lowercase and uppercase, on all eight Cosmos plugins. On the simulator an Osmosis wallet refusesuosmoon the Add Token and Edit Token forms and still savesruneas a custom token (cells 11 to 14).Not covered:
x/staking-*andx/brunedenoms follow thornode's rule and were not observed in live actionsTest evidence
0f9a7a82026-10-02
1. remote tokens in wallet search
2. token list top
3. token list bottom
4. ruji balance
5. ruji send confirm
6. ruji send success
7. ruji send details
8. ruji history
0b5048cfixup! Map Midgard asset names to THORChain denoms
2026-10-07
11. osmosis add native denom rejected
12. osmosis other denom saved
13. osmosis edit to native denom rejected
14. osmosis control token deleted
Note
Medium Risk
Changes token ingestion rules and Midgard-to-denom mapping for THORChain transaction history; incorrect mapping could mis-attribute balances or omit token txs, though coverage includes live Midgard fixtures.
Overview
THORChain mainnet and stagenet plugins now wire
createTokenIdviamakeThorchainCreateTokenId, soinfoServerTokensfrom the info server are ingested as bank-denom tokens (RUJI, AUTO, staking variants, etc.) while rejecting uppercase denoms, the nativerune, and duplicate currency codes.Cosmos token IDs are centralized in
createCosmosTokenId(cosmos-sdk denom rules, slashes stripped for IDs).CosmosTools.getTokenIdrejects adding a chain’s ownnativeDenomas a custom token on all Cosmos plugins.Midgard history for THORChain maps Midgard asset names (
THOR.RUJI,X/RUJI,THOR.AUTO, …) to real bank denoms throughthorchainAssetToDenom, andextendedParseCoinsaccepts denoms with dots and slashes so token movements are no longer dropped from history.Reviewed by Cursor Bugbot for commit 33140f2. Bugbot is set up for automated code reviews on this repo. Configure here.