-
Notifications
You must be signed in to change notification settings - Fork 1
Extend cldf timelock converter logic for TON #628
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Extend cldf timelock converter logic for TON #628
Conversation
|
|
👋 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! |
There was a problem hiding this 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
TxOpsstruct 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.
| URL: url, | ||
| TxOps: cldf_ton.TxOps{ | ||
| Wallet: tonWallet, | ||
| Amount: tlb.MustFromTON(defaultTxTONAmount), // default amount for transactions |
There was a problem hiding this comment.
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
There was a problem hiding this 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(), |
Copilot
AI
Dec 12, 2025
There was a problem hiding this comment.
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.
There was a problem hiding this 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) |
Copilot
AI
Dec 12, 2025
There was a problem hiding this comment.
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.
| } | ||
| case chainsel.FamilyTon: | ||
| c := cfg.blockchains.TonChains()[uint64(chainSelector)] | ||
| return ton.NewTimelockExecutor(c.Client, c.TxOps.Wallet, c.TxOps.Amount) |
Copilot
AI
Dec 12, 2025
There was a problem hiding this comment.
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.
| chain := cfg.blockchains.TonChains()[cfg.chainSelector] | ||
| inspector = ton.NewInspector(chain.Client) |
Copilot
AI
Dec 12, 2025
There was a problem hiding this comment.
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.
There was a problem hiding this 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.
…rt-ton-timelock-converter
…lock-converter' of github.com:smartcontractkit/chainlink-deployments-framework into NONEVM-3069/extend-cldf-proposal-logic-support-ton-timelock-converter
There was a problem hiding this 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) |
Copilot
AI
Dec 16, 2025
There was a problem hiding this comment.
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.
| return nil, fmt.Errorf("error creating Sui timelock converter: %w", err) | ||
| } | ||
| case chainsel.FamilyTon: | ||
| converter = ton.NewTimelockConverter(ton.DefaultSendAmount) |
Copilot
AI
Dec 16, 2025
There was a problem hiding this comment.
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.
| } | ||
| case chainsel.FamilyTon: | ||
| chain := cfg.blockchains.TonChains()[cfg.chainSelector] | ||
| inspector = ton.NewInspector(chain.Client) |
Copilot
AI
Dec 16, 2025
There was a problem hiding this comment.
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.
| WalletVersionV5R1 WalletVersion = "V5R1" | ||
| WalletVersionDefault WalletVersion = "" | ||
|
|
||
| defaultAmountTonString = "0.1" // Default amount in TON for transactions |
Copilot
AI
Dec 16, 2025
There was a problem hiding this comment.
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.
| 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" |
|
| return nil, fmt.Errorf("invalid encoder type: %T", encoder) | ||
| } | ||
| chain := cfg.blockchains.EVMChains()[uint64(chainSelector)] | ||
| c := cfg.blockchains.EVMChains()[uint64(chainSelector)] |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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(), |
There was a problem hiding this comment.
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)
}| // 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) | ||
| } |
There was a problem hiding this comment.
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:




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