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: a68db89

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
URL: url,
TxOps: cldf_ton.TxOps{
Wallet: tonWallet,
Amount: tlb.MustFromTON(defaultTxTONAmount), // default amount for transactions

Choose a reason for hiding this comment

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

Good for now, too simple to scale - we need to track this item.

We will need to be able to load gas configuration (from somewhere) which will need to tell us how much on average something costs to do (per contract call), and something a CLD user should be able to easily override.

cc @patricios-space @vicentevieytes re: per call gas configuration

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.
@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.

}
c := cfg.blockchains.TonChains()[uint64(chainSelector)]

return ton.NewExecutor(encoder, c.Client, c.TxOps.Wallet, c.TxOps.Amount)
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 newly added TON executor creation logic lacks test coverage. Consider adding tests that verify the executor is correctly created with the proper encoder, client, wallet, and amount parameters.

Copilot uses AI. Check for mistakes.
}
case chainsel.FamilyTon:
c := cfg.blockchains.TonChains()[uint64(chainSelector)]
return ton.NewTimelockExecutor(c.Client, c.TxOps.Wallet, c.TxOps.Amount)
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 newly added TON timelock executor creation logic lacks test coverage. Consider adding tests that verify the timelock executor is correctly instantiated with the appropriate client, wallet, and amount.

Copilot uses AI. Check for mistakes.
Comment on lines +1649 to +1650
chain := cfg.blockchains.TonChains()[cfg.chainSelector]
inspector = ton.NewInspector(chain.Client)
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 newly added TON inspector creation logic lacks test coverage. Consider adding tests that verify the inspector is correctly created from the TON chain client.

Copilot uses AI. Check for mistakes.
Copilot AI review requested due to automatic review settings December 16, 2025 21:20
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 8 out of 9 changed files in this pull request and generated no new 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
Copilot AI review requested due to automatic review settings December 16, 2025 23:02
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 8 out of 9 changed files in this pull request and generated 4 comments.


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

}
case chainsel.FamilyTon:
c := cfg.blockchains.TonChains()[uint64(chainSelector)]
return ton.NewTimelockExecutor(c.Client, c.TxOps.Wallet, c.TxOps.Amount)
Copy link

Copilot AI Dec 16, 2025

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 logic lacks test coverage. Consider adding tests to verify correct executor initialization with client, wallet, and amount parameters.

Copilot uses AI. Check for mistakes.
return nil, fmt.Errorf("error creating Sui timelock converter: %w", err)
}
case chainsel.FamilyTon:
converter = ton.NewTimelockConverter(ton.DefaultSendAmount)
Copy link

Copilot AI Dec 16, 2025

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 is not covered by tests. Add test coverage to verify the converter is created with the correct default send amount.

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

Copilot AI Dec 16, 2025

Choose a reason for hiding this comment

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

The TON inspector creation logic lacks test coverage. Add tests to ensure the inspector is properly initialized with the chain client.

Copilot uses AI. Check for mistakes.
WalletVersionV5R1 WalletVersion = "V5R1"
WalletVersionDefault WalletVersion = ""

defaultAmountTonString = "0.1" // Default amount in TON for transactions
Copy link

Copilot AI Dec 16, 2025

Choose a reason for hiding this comment

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

The default transaction amount should be documented more clearly, explaining why 0.1 TON was chosen and under what circumstances this value might need adjustment.

Suggested change
defaultAmountTonString = "0.1" // Default amount in TON for transactions
// defaultAmountTonString defines the default amount (in TON) used when a caller
// does not explicitly specify a transaction amount.
//
// The value 0.1 TON is intentionally conservative: it is typically sufficient to
// cover standard transaction fees on mainnet and testnet while remaining small
// enough to avoid unintentionally transferring a large balance.
//
// Consumers should override this default if:
// - their workflow requires sending a larger or smaller value per transaction;
// - network fee dynamics change so that 0.1 TON is no longer adequate to cover
// gas and other on-chain costs; or
// - they operate in an environment (e.g., private/test networks) with different
// economic assumptions.
defaultAmountTonString = "0.1"

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

return nil, fmt.Errorf("invalid encoder type: %T", encoder)
}
chain := cfg.blockchains.EVMChains()[uint64(chainSelector)]
c := cfg.blockchains.EVMChains()[uint64(chainSelector)]
Copy link
Contributor

Choose a reason for hiding this comment

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

what's wrong with the word chain?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it's a nit thing, go variables with limited scope should have shorter names

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

@jadepark-dev jadepark-dev Dec 23, 2025

Choose a reason for hiding this comment

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

Not related to this PR but I wonder if we need to apply this change to the rest of the codebase. Any context on bounceable address?

// Address - returns old (bounce) version of wallet address
// DEPRECATED: because of address reform, use WalletAddress,
// it will return UQ format
func (w *Wallet) Address() *address.Address {
	return w.addr
}

// WalletAddress - returns new standard non bounce address
func (w *Wallet) WalletAddress() *address.Address {
	return w.addr.Bounce(false)
}

Comment on lines -125 to -129
// airdrop the deployer wallet
ferr := fundTonWallets(ctx, nodeClient, []*address.Address{tonWallet.Address()}, []tlb.Coins{tlb.MustFromTON("1000")})
if ferr != nil {
return nil, fmt.Errorf("failed to fund wallet: %w", ferr)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Omitting fund logic from network setup makes sense to me(if I am reading it right), but just a reminder that integration tests in core and chainlink-ton are relying on the deployer wallet to fund transmitters:

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.

4 participants