Skip to content

fix(contract-manager): support networkId serialization in TonChain config - #3853

Open
Ysh204 wants to merge 1 commit into
pyth-network:mainfrom
Ysh204:fix/ton-configuration-clean
Open

fix(contract-manager): support networkId serialization in TonChain config#3853
Ysh204 wants to merge 1 commit into
pyth-network:mainfrom
Ysh204:fix/ton-configuration-clean

Conversation

@Ysh204

@Ysh204 Ysh204 commented Jun 29, 2026

Copy link
Copy Markdown

Summary

Fixes #3652 by adding missing networkId values for TON chain configurations and ensuring they are preserved during serialization.

Changes

  • Add networkId values to contract_manager/src/store/chains/TonChains.json:

    • 0x2 for TON Testnet
    • 0x27 for TON Mainnet
  • Update TonChain serialization to preserve networkId through:

    • the constructor,
    • fromJson(),
    • toJson().

Verification

  • Ran npx turbo run build.
  • All workspaces compiled successfully.

Fixes #3652


Open in Devin Review

@vercel

vercel Bot commented Jun 29, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

4 Skipped Deployments
Project Deployment Actions Updated (UTC)
entropy-explorer Skipped Skipped Jun 29, 2026 6:14am
insights Skipped Skipped Jun 29, 2026 6:14am
proposals Skipped Skipped Jun 29, 2026 6:14am
staking Skipped Skipped Jun 29, 2026 6:14am

Request Review

@vercel
vercel Bot temporarily deployed to Preview – proposals June 29, 2026 06:14 Inactive
@vercel
vercel Bot temporarily deployed to Preview – staking June 29, 2026 06:14 Inactive
@vercel
vercel Bot temporarily deployed to Preview – entropy-explorer June 29, 2026 06:14 Inactive
@vercel
vercel Bot temporarily deployed to Preview – insights June 29, 2026 06:14 Inactive
@vercel

vercel Bot commented Jun 29, 2026

Copy link
Copy Markdown

@Ysh204 is attempting to deploy a commit to the Pyth Network Team on Vercel.

A member of the Team first needs to authorize it.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 2 potential issues.

Open in Devin Review

wormholeChainName: string,
nativeToken: TokenId | undefined,
private rpcUrl: string,
private networkId: string,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚩 networkId field is added but never consumed by any TonChain logic

The new networkId field (contract_manager/src/core/chains.ts:1522) is stored and serialized/deserialized but is never referenced by any method in TonChain or in any TON contract code (contract_manager/src/core/contracts/ton.ts). By contrast, NearChain uses its networkId in getNearAccount() at contract_manager/src/core/chains.ts:1698 and contract_manager/src/core/chains.ts:1702. This isn't a bug — the commit message says "add missing networkId serialization" suggesting the field is needed for data completeness or future use — but it's worth confirming the intended consumer exists or is planned.

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

{
"id": "ton_testnet",
"mainnet": false,
"networkId": "0x2",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚩 Verify correctness of TON networkId values (0x2 and 0x27)

The JSON config uses "0x2" (decimal 2) for testnet and "0x27" (decimal 39) for mainnet. These don't correspond to standard TON global IDs (mainnet = -239, testnet = -3), nor to the Wormhole chain IDs for TON (ton_mainnet = 60069, ton_testnet = 50104 per governance/xc_admin/packages/xc_admin_common/src/chains.ts:102,243). They also don't match the NearChain convention of using human-readable names like "testnet" and "mainnet". Since the field isn't consumed yet, incorrect values won't cause runtime failures today, but they should be verified before any logic depends on them.

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

@Ysh204

Ysh204 commented Jun 29, 2026

Copy link
Copy Markdown
Author

Thanks for the review!

The networkId values (0x2 and 0x27) were taken from the values proposed in issue #3652. The goal of this PR is to ensure those configuration values are preserved through TonChain serialization by handling networkId in the constructor, fromJson(), and toJson(), rather than changing how TON network IDs are interpreted.

If the project expects different identifiers for TON, or follows a different convention for networkId, I'm happy to update the values accordingly.

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.

Missing Mainnet TON ID (0x27) in chain-configs.json

1 participant