Skip to content

NONEVM-2403: use CLDF for ton localnet access#373

Merged
jadepark-dev merged 6 commits into
mainfrom
jade/bump-mylocalton
Nov 24, 2025
Merged

NONEVM-2403: use CLDF for ton localnet access#373
jadepark-dev merged 6 commits into
mainfrom
jade/bump-mylocalton

Conversation

@jadepark-dev

@jadepark-dev jadepark-dev commented Nov 17, 2025

Copy link
Copy Markdown
Collaborator

Steps

@jadepark-dev jadepark-dev changed the title [NONEVM-2403 ] use cldf for ton localnet access NONEVM-2403: use CLDF for ton localnet access Nov 17, 2025
github-merge-queue Bot pushed a commit to smartcontractkit/chainlink-deployments-framework that referenced this pull request Nov 18, 2025
For bumping TON localnet version w/o updating frameworks
smartcontractkit/chainlink-ton#373
- Added configurations for CTFv2, that can be set by caller
- Support ton api client interface
@jadepark-dev jadepark-dev marked this pull request as ready for review November 18, 2025 18:01
@jadepark-dev jadepark-dev requested a review from a team as a code owner November 18, 2025 18:01
Copilot AI review requested due to automatic review settings November 18, 2025 18:01

Copilot AI 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.

Pull Request Overview

This PR migrates TON integration tests from direct TON API client creation to using the Chainlink Deployments Framework (CLDF) for localnet access. The changes consolidate TON local network configuration and reduce code duplication.

Key Changes:

  • Replaced manual API client creation with CLDF's CTFChainProvider
  • Centralized TON localnet configuration in a new deployment/config/localnetwork.go file
  • Updated tests to use the new chain provider pattern with wallet pre-funding

Reviewed Changes

Copilot reviewed 11 out of 13 changed files in this pull request and generated no comments.

Show a summary per file
File Description
scripts/.core_version Updated core version reference to b6d567
pkg/relay/chain.go Added log poller health report to chain health monitoring
integration-tests/txm/txm_test.go Migrated test to use CLDF chain provider, removed manual wallet setup
integration-tests/tracetracking/testutils/test_utils.go Added new test setup functions using CLDF chain provider
integration-tests/smoke/logpoller/log_poller_test.go Migrated all log poller tests to use CLDF chain provider
integration-tests/go.mod Updated dependencies: chain-selectors, chainlink-deployments-framework, and various AWS/Ethereum packages
deployment/utils/chain.go Replaced custom network setup with CLDF provider, extracted prefunded wallet logic
deployment/go.mod Updated dependencies to match integration-tests module
deployment/config/localnetwork.go New file centralizing TON localnet configuration for CLDF
deployment/ccip/helpers/execute.go Changed client type from *ton.APIClient to ton.APIClientWrapped
deployment/ccip/cs_test_helpers.go Changed client type from *ton.APIClient to ton.APIClientWrapped

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

Comment thread deployment/utils/chain.go Outdated
return ton.NewAPIClient(pool, ton.ProofCheckPolicyFast), nil
}
chain, err := p.Initialize(t.Context())
require.NoError(t, err, "failed to initialize CTF chain provider")

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Lets try to stop treating this as "test helpers" but as infrastructure code that is used by a test, and return errors vs injecting test context and asserting no errors.

A function can return an error and a specific test can assert no error.
Any test specific funcs should be moved to test packages.

Refactoring function by function would make us get there eventually.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

A function can return an error and a specific test can assert no error

Ah, good point! this made things click for me 👍

Comment thread deployment/utils/chain.go

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Seems reasonable to remove testing.T parameter

if b.Type == CTF || b.Type == LOCAL {
for _, chain := range env.BlockChains.TonChains() {
testutils.FundWallets(t, chain.Client, []*address.Address{chain.WalletAddress}, []tlb.Coins{tlb.MustFromTON(DefaultFundAmountTon)})
ferr := testutils.FundWallets(t, chain.Client, []*address.Address{chain.WalletAddress}, []tlb.Coins{tlb.MustFromTON(DefaultFundAmountTon)})

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

any reason not to call it err? Calling it different makes it look like we are avoding overwriting err for some reason.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

It's to avoid error variable shadowing, I'm sure in some cases it's ok though. I'll clean up once I got CLDF bump merged in core

@huangzhen1997 huangzhen1997 Nov 22, 2025

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.

You won’t be shadowing it as long as you assign to err using = instead of :=.
If the function returns more than just an error, you can pre-declare the variable to avoid shadowing.

Suggested change
ferr := testutils.FundWallets(t, chain.Client, []*address.Address{chain.WalletAddress}, []tlb.Coins{tlb.MustFromTON(DefaultFundAmountTon)})
err = testutils.FundWallets(t, chain.Client, []*address.Address{chain.WalletAddress}, []tlb.Coins{tlb.MustFromTON(DefaultFundAmountTon)})

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Thanks for the clarification. I’ll merge this first to unblock other PRs and handle it in a follow-up

Comment on lines +821 to +828
sender, serr := test_utils.CreateRandomHighloadWallet(tonChain.Client)
require.NoError(t, serr)

ferr := test_utils.FundWallets(t, tonChain.Client, []*address.Address{sender.Address()},
[]tlb.Coins{tlb.MustFromTON("1000")})
require.NoError(t, ferr)

emitter, err := helper.NewTestEventSource(client, sender, "replayEmitter",
rand.Uint32(), logger.Test(t))
emitter, err := helper.NewTestEventSource(tonChain.Client, sender, "replayEmitter", rand.Uint32(), logger.Test(t))

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

nit: rename errors to err

Suggested change
sender, serr := test_utils.CreateRandomHighloadWallet(tonChain.Client)
require.NoError(t, serr)
ferr := test_utils.FundWallets(t, tonChain.Client, []*address.Address{sender.Address()},
[]tlb.Coins{tlb.MustFromTON("1000")})
require.NoError(t, ferr)
emitter, err := helper.NewTestEventSource(client, sender, "replayEmitter",
rand.Uint32(), logger.Test(t))
emitter, err := helper.NewTestEventSource(tonChain.Client, sender, "replayEmitter", rand.Uint32(), logger.Test(t))
sender, err := test_utils.CreateRandomHighloadWallet(tonChain.Client)
require.NoError(t, err)
err = test_utils.FundWallets(t, tonChain.Client, []*address.Address{sender.Address()},
[]tlb.Coins{tlb.MustFromTON("1000")})
require.NoError(t, err)
emitter, err := helper.NewTestEventSource(tonChain.Client, sender, "replayEmitter", rand.Uint32(), logger.Test(t))

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

lgtm except for the error renaming nit-pick

if b.Type == CTF || b.Type == LOCAL {
for _, chain := range env.BlockChains.TonChains() {
testutils.FundWallets(t, chain.Client, []*address.Address{chain.WalletAddress}, []tlb.Coins{tlb.MustFromTON(DefaultFundAmountTon)})
ferr := testutils.FundWallets(t, chain.Client, []*address.Address{chain.WalletAddress}, []tlb.Coins{tlb.MustFromTON(DefaultFundAmountTon)})

@huangzhen1997 huangzhen1997 Nov 22, 2025

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.

You won’t be shadowing it as long as you assign to err using = instead of :=.
If the function returns more than just an error, you can pre-declare the variable to avoid shadowing.

Suggested change
ferr := testutils.FundWallets(t, chain.Client, []*address.Address{chain.WalletAddress}, []tlb.Coins{tlb.MustFromTON(DefaultFundAmountTon)})
err = testutils.FundWallets(t, chain.Client, []*address.Address{chain.WalletAddress}, []tlb.Coins{tlb.MustFromTON(DefaultFundAmountTon)})

@jadepark-dev jadepark-dev merged commit 7dc35cb into main Nov 24, 2025
35 checks passed
@jadepark-dev jadepark-dev deleted the jade/bump-mylocalton branch November 24, 2025 11:28
This was referenced Nov 24, 2025
archseer added a commit that referenced this pull request Nov 25, 2025
* MCMS suite polish/fixes #3 (#360)

* Allow MCMS<T>.submitErrorReport even when root is expired

* Timelock.onBouncedMessage - Mark the operation as final

* Adopt SnakedCell<T>

* Timelock - support blocking msg bodies (data) < 32 bits

* Revert - 'Timelock - support blocking msg bodies (data) < 32 bits'

* Use SnakedCell<RootDescriptor> for roots

* Add scripts/disk-cache-gc.sh run to e2e test (#366)

* Add scripts/disk-cache-gc.sh run to e2e test

* Relocate Nix store to /mnt

* chore: remove unused function (#368)

* Dont cache CI test run logs (#377)

* dont cache test logs

* chore: clean log dir before running test

* fix: flag

---------

Co-authored-by: Jade Park <jadepark.dev@gmail.com>

* Bump core version tag (#381)

* refactor: offramp wrappers to use CellCodec (#379)

* replace all encode and decode functions with builder type

* refactor message encoding as well

* Update contracts/wrappers/ccip/OffRamp.ts

Co-authored-by: Kristijan Rebernisak <kristijan.rebernisak@gmail.com>

* Update contracts/wrappers/ccip/OffRamp.ts

Co-authored-by: Kristijan Rebernisak <kristijan.rebernisak@gmail.com>

* fmt

* fix typo

---------

Co-authored-by: Kristijan Rebernisak <kristijan.rebernisak@gmail.com>

* refactor ton accessor ocr3base binding (#384)

* refactor offramp binding and chain accessor ocr3base

* update comments

* fix lint

* fix contract test

* add chainId back

* golint

* [NONEVM-3047] feat: add feeValueJuels to getValidatedFee and TVM2ANY event (#361)

* feat: add feeValueJuels to getValidatedFee

* fix: missed overwritten param

* fix: update feequoter go bindings

* fix: update onramp go bindings

* fix: golint

* fix: revert unnecesary change

* feat: don't fail on missing link token price

* cicd: power up integration test vm

* test: make feequoter errors work

* Fix errorCodes for feeQuoter

* LINK token price also needs configuring

* Update generated feeQuoter exit codes

---------

Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>

* NONEVM-2403: use CLDF for ton localnet access (#373)

* chore: clean up

* chore: bump core

* chore: bump core/deployment

* chore: tidy

* chore: clean up

* chore: bump core

* chore: bump mylocalton

* chore: modgraph

* Fix compilation on 1.2

* fix import

* fix: wait for current masterchain block

---------

Co-authored-by: Kristijan Rebernisak <kristijan.rebernisak@gmail.com>
Co-authored-by: Patricio <contact@patricios.space>
Co-authored-by: Oliver Townsend <133903322+ogtownsend@users.noreply.github.com>
Co-authored-by: vicentevieytes <73846744+vicentevieytes@users.noreply.github.com>
Co-authored-by: Joe Huang <joe.huang@smartcontract.com>
Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
archseer added a commit that referenced this pull request Dec 1, 2025
* Tolk 1.2

* Fix pendingOwner serialization

* Fix maybeAddr serialization in typescript wrappers

* Fix go bindings

* nix: Bump sha

* Fix more cases

* chore: bump mylocalton

* tolk-1-2-mylocalton-fix (#387)

* MCMS suite polish/fixes #3 (#360)

* Allow MCMS<T>.submitErrorReport even when root is expired

* Timelock.onBouncedMessage - Mark the operation as final

* Adopt SnakedCell<T>

* Timelock - support blocking msg bodies (data) < 32 bits

* Revert - 'Timelock - support blocking msg bodies (data) < 32 bits'

* Use SnakedCell<RootDescriptor> for roots

* Add scripts/disk-cache-gc.sh run to e2e test (#366)

* Add scripts/disk-cache-gc.sh run to e2e test

* Relocate Nix store to /mnt

* chore: remove unused function (#368)

* Dont cache CI test run logs (#377)

* dont cache test logs

* chore: clean log dir before running test

* fix: flag

---------

Co-authored-by: Jade Park <jadepark.dev@gmail.com>

* Bump core version tag (#381)

* refactor: offramp wrappers to use CellCodec (#379)

* replace all encode and decode functions with builder type

* refactor message encoding as well

* Update contracts/wrappers/ccip/OffRamp.ts

Co-authored-by: Kristijan Rebernisak <kristijan.rebernisak@gmail.com>

* Update contracts/wrappers/ccip/OffRamp.ts

Co-authored-by: Kristijan Rebernisak <kristijan.rebernisak@gmail.com>

* fmt

* fix typo

---------

Co-authored-by: Kristijan Rebernisak <kristijan.rebernisak@gmail.com>

* refactor ton accessor ocr3base binding (#384)

* refactor offramp binding and chain accessor ocr3base

* update comments

* fix lint

* fix contract test

* add chainId back

* golint

* [NONEVM-3047] feat: add feeValueJuels to getValidatedFee and TVM2ANY event (#361)

* feat: add feeValueJuels to getValidatedFee

* fix: missed overwritten param

* fix: update feequoter go bindings

* fix: update onramp go bindings

* fix: golint

* fix: revert unnecesary change

* feat: don't fail on missing link token price

* cicd: power up integration test vm

* test: make feequoter errors work

* Fix errorCodes for feeQuoter

* LINK token price also needs configuring

* Update generated feeQuoter exit codes

---------

Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>

* NONEVM-2403: use CLDF for ton localnet access (#373)

* chore: clean up

* chore: bump core

* chore: bump core/deployment

* chore: tidy

* chore: clean up

* chore: bump core

* chore: bump mylocalton

* chore: modgraph

* Fix compilation on 1.2

* fix import

* fix: wait for current masterchain block

---------

Co-authored-by: Kristijan Rebernisak <kristijan.rebernisak@gmail.com>
Co-authored-by: Patricio <contact@patricios.space>
Co-authored-by: Oliver Townsend <133903322+ogtownsend@users.noreply.github.com>
Co-authored-by: vicentevieytes <73846744+vicentevieytes@users.noreply.github.com>
Co-authored-by: Joe Huang <joe.huang@smartcontract.com>
Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>

* fix import yet again

* Address review

* Update sha

---------

Co-authored-by: Jade Park <jadepark.dev@gmail.com>
Co-authored-by: Kristijan Rebernisak <kristijan.rebernisak@gmail.com>
Co-authored-by: Patricio <contact@patricios.space>
Co-authored-by: Oliver Townsend <133903322+ogtownsend@users.noreply.github.com>
Co-authored-by: vicentevieytes <73846744+vicentevieytes@users.noreply.github.com>
Co-authored-by: Joe Huang <joe.huang@smartcontract.com>
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