Skip to content

Conversation

@huangzhen1997
Copy link
Contributor

@huangzhen1997 huangzhen1997 commented Dec 9, 2025

Jira.

Adding TON timelock converter support. Note the TON support for executor override is also added here, but there's another PR for supporting the migration to MCMS-Tools repo: https://github.com/smartcontractkit/mcms-tools/pull/261

Need to add test coverage

@huangzhen1997 huangzhen1997 requested a review from a team as a code owner December 9, 2025 22:54
Copilot AI review requested due to automatic review settings December 9, 2025 22:54
@changeset-bot
Copy link

changeset-bot bot commented Dec 9, 2025

⚠️ No Changeset found

Latest commit: 62b9727

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions
Copy link

github-actions bot commented Dec 9, 2025

👋 huangzhen1997, thanks for creating this pull request!

To help reviewers, please consider creating future PRs as drafts first. This allows you to self-review and make any final changes before notifying the team.

Once you're ready, you can mark it as "Ready for review" to request feedback. Thanks!

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR extends the CLDF (Chainlink Deployments Framework) proposal conversion logic to support the TON (The Open Network) blockchain. The changes enable TON chain integration by adding necessary converters, executors, and inspectors while also updating various dependencies.

Key changes:

  • Add TON support to MCMS v2 CLI with timelock converter, executor, and inspector implementations
  • Introduce TxOps struct to encapsulate TON transaction operation configuration
  • Update multiple dependencies including Go version, chainlink-ccip, mcms, and tonutils-go

Reviewed changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
go.mod Updates Go version to 1.25.3 and upgrades multiple dependencies including TON-related libraries
engine/cld/legacy/cli/mcmsv2/mcms_v2.go Adds TON chain family support with converter, executor, and inspector implementations; refactors variable naming
chain/ton/ton_chain.go Introduces TxOps struct to hold wallet and amount configuration for transactions
chain/ton/provider/rpc_provider.go Initializes TxOps with default transaction amount in RPC provider
chain/ton/provider/ctf_provider_test.go Updates test to verify TxOps instead of Wallet field
chain/ton/provider/ctf_provider.go Initializes TxOps with default amount; fixes wallet method call to use WalletAddress()

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@huangzhen1997 huangzhen1997 marked this pull request as draft December 9, 2025 23:04
@huangzhen1997 huangzhen1997 changed the title Extend cldf proposal conversion logic for TON Extend cldf timelock converter logic for TON Dec 9, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 7 out of 8 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Client: nodeClient,
Wallet: tonWallet,
WalletAddress: tonWallet.Address(),
WalletAddress: tonWallet.WalletAddress(),
Copy link

Copilot AI Dec 12, 2025

Choose a reason for hiding this comment

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

The change from tonWallet.Address() to tonWallet.WalletAddress() lacks test coverage. The existing test in ctf_provider_test.go only checks that WalletAddress is not empty but doesn't verify the correct method is being called or that the address value is as expected.

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@copilot This is not true, it's tested in rpc_provider_test.go line 276

@huangzhen1997 huangzhen1997 marked this pull request as ready for review December 12, 2025 04:33
Copilot AI review requested due to automatic review settings December 12, 2025 04:33
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 7 out of 8 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

…lock-converter' of github.com:smartcontractkit/chainlink-deployments-framework into NONEVM-3069/extend-cldf-proposal-logic-support-ton-timelock-converter
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

return nil, fmt.Errorf("error creating Sui timelock converter: %w", err)
}
case chainsel.FamilyTon:
converter = ton.NewTimelockConverter(tlb.MustFromTON(defaultTONExecutorAmount))
Copy link

Copilot AI Jan 27, 2026

Choose a reason for hiding this comment

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

The TON timelock converter initialization lacks test coverage. Consider adding a test case similar to the existing Sui test case at line 1136-1138 to verify the converter is created correctly for TON chains.

Copilot uses AI. Check for mistakes.
Amount: tlb.MustFromTON(defaultTONExecutorAmount),
}

return ton.NewExecutor(opts)
Copy link

Copilot AI Jan 27, 2026

Choose a reason for hiding this comment

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

The TON executor creation in getExecutorWithChainOverride lacks test coverage. Add test cases to verify the executor is created correctly with the expected options, including the Amount field set to defaultTONExecutorAmount.

Copilot uses AI. Check for mistakes.
Amount: tlb.MustFromTON(defaultTONExecutorAmount),
}

return ton.NewTimelockExecutor(opts)
Copy link

Copilot AI Jan 27, 2026

Choose a reason for hiding this comment

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

The TON timelock executor creation in getTimelockExecutorWithChainOverride lacks test coverage. Add test cases to verify the timelock executor is created correctly with the expected options, similar to other chain family test cases.

Copilot uses AI. Check for mistakes.
Comment on lines +1619 to +1620
chain := cfg.blockchains.TonChains()[cfg.chainSelector]
inspector = ton.NewInspector(chain.Client)
Copy link

Copilot AI Jan 27, 2026

Choose a reason for hiding this comment

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

Variable 'chain' should be renamed to 'c' for consistency with the naming pattern used in the same function for other chain families (lines 1535, 1539, 1542, 1545).

Suggested change
chain := cfg.blockchains.TonChains()[cfg.chainSelector]
inspector = ton.NewInspector(chain.Client)
c := cfg.blockchains.TonChains()[cfg.chainSelector]
inspector = ton.NewInspector(c.Client)

Copilot uses AI. Check for mistakes.
}
case chainsel.FamilyTon:
chain := cfg.blockchains.TonChains()[cfg.chainSelector]
inspector = ton.NewInspector(chain.Client)
Copy link

Copilot AI Jan 27, 2026

Choose a reason for hiding this comment

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

The TON inspector creation in getInspectorFromChainSelector lacks test coverage. Add test cases to verify the inspector is created correctly for TON chains.

Copilot uses AI. Check for mistakes.
Copy link
Contributor

@gustavogama-cll gustavogama-cll left a comment

Choose a reason for hiding this comment

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

re-approving mcms changes

krebernisak
krebernisak previously approved these changes Jan 27, 2026
}

// buildChain creates a ton.Chain with the given parameters.
func buildChain(selector uint64, api *tonlib.APIClient, tonWallet *wallet.Wallet, httpURL string) *ton.Chain {
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure what's the purpose of this method, which just instantiates the type vs just doing it without the method? Then we also have a Test_buildChain test for this method? Seems we could do without.

Copilot AI review requested due to automatic review settings January 27, 2026 18:09
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@huangzhen1997 huangzhen1997 requested review from gustavogama-cll and krebernisak and removed request for krebernisak January 27, 2026 18:16
Copilot AI review requested due to automatic review settings January 29, 2026 17:11
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

defaultProposalValidity = 72 * time.Hour

// defaultTONExecutorAmount is the default amount of TON for MCMS/Timelock executor transactions.
// This is a static estimate that should be sufficient for most operations.
Copy link

Copilot AI Jan 29, 2026

Choose a reason for hiding this comment

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

The comment describes this as a 'static estimate' but doesn't explain why 0.1 TON was chosen or what factors influence whether this amount is sufficient. Consider adding context about what operations this covers and approximate cost considerations.

Suggested change
// This is a static estimate that should be sufficient for most operations.
// This is a conservative static estimate intended to cover the gas and storage fees for a
// typical MCMS/Timelock executor flow on TON (e.g. submitting and executing a proposal with
// a small to medium number of actions) under current mainnet fee conditions, with an extra
// safety buffer. The 0.1 TON value was chosen based on observed costs for common operations
// plus headroom to account for moderate message size growth and fee fluctuations.
//
// IMPORTANT: This may be insufficient for unusually large/complex proposals, for networks
// or environments with significantly higher fees, or if TON fee dynamics change over time.
// Operators who routinely submit high-complexity proposals should consider overriding this
// default with a higher value until a dynamic gas estimation mechanism is available.
//

Copilot uses AI. Check for mistakes.
case chainsel.FamilyTon:
encoder, ok := encoder.(*ton.Encoder)
if !ok {
return nil, fmt.Errorf("invalid encoder type for TON chain %d: expected *ton.Encoder, got %T", chainSelector, encoder)
Copy link

Copilot AI Jan 29, 2026

Choose a reason for hiding this comment

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

The error message for TON encoder type validation is more detailed than the equivalent error messages for EVM (line 1451), Solana (line 1460), Aptos (line 1468), and Sui (line 1481) chains, which only say 'invalid encoder type: %T'. Consider making error messages consistent across all chain families.

Suggested change
return nil, fmt.Errorf("invalid encoder type for TON chain %d: expected *ton.Encoder, got %T", chainSelector, encoder)
return nil, fmt.Errorf("invalid encoder type: %T", encoder)

Copilot uses AI. Check for mistakes.
p := &RPCChainProvider{
selector: 123,
config: RPCChainProviderConfig{
HTTPURL: "", // invalid - missing URL
Copy link

Copilot AI Jan 29, 2026

Choose a reason for hiding this comment

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

The comment says 'invalid - missing URL' but an empty string is technically a valid Go string value. Consider clarifying that this is testing validation logic for an empty/missing URL configuration.

Suggested change
HTTPURL: "", // invalid - missing URL
HTTPURL: "", // invalid: empty URL to test validation of missing/empty configuration

Copilot uses AI. Check for mistakes.
@cl-sonarqube-production
Copy link

@huangzhen1997 huangzhen1997 added this pull request to the merge queue Jan 30, 2026
Merged via the queue into main with commit 7f30604 Jan 30, 2026
16 checks passed
@huangzhen1997 huangzhen1997 deleted the NONEVM-3069/extend-cldf-proposal-logic-support-ton-timelock-converter branch January 30, 2026 17:12
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.

5 participants