Skip to content

fix(relayer): remove RPC dependency on CCIPProvider creation#658

Merged
jadepark-dev merged 5 commits intomainfrom
jade/fix-ton-startup-rpc-failure
Mar 18, 2026
Merged

fix(relayer): remove RPC dependency on CCIPProvider creation#658
jadepark-dev merged 5 commits intomainfrom
jade/fix-ton-startup-rpc-failure

Conversation

@jadepark-dev
Copy link
Copy Markdown
Collaborator

No description provided.

@jadepark-dev jadepark-dev requested a review from ogtownsend March 18, 2026 20:11
@jadepark-dev jadepark-dev marked this pull request as ready for review March 18, 2026 20:35
@jadepark-dev jadepark-dev requested a review from a team as a code owner March 18, 2026 20:35
Copilot AI review requested due to automatic review settings March 18, 2026 20:35
Copy link
Copy Markdown
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 updates TON CCIP provider construction so it no longer requires an RPC client to be created/fetched at provider creation time, and instead defers client acquisition via a callback.

Changes:

  • Change CCIP provider/TON accessor construction to accept a clientProvider(ctx) function rather than a concrete ton.APIClientWrapped.
  • Update TON accessor read paths to call clientProvider(ctx) at time of use.
  • Update integration tests to pass the new clientProvider into NewTONAccessor.

Reviewed changes

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

Show a summary per file
File Description
pkg/relay/relay.go Switch relayer’s CCIP provider creation to pass a clientProvider callback.
pkg/ccip/provider/provider.go Update NewCCIPProvider signature to accept clientProvider and forward it to the chain accessor.
pkg/ccip/chainaccessor/ton_accessor.go Replace stored client with clientProvider and fetch client on-demand in several accessor methods.
pkg/ccip/chainaccessor/config.go Update config getter paths to fetch client via clientProvider.
integration-tests/deployment/ccip/cs_test.go Update accessor construction to use clientProvider.
integration-tests/deployment/ccip/cs_deployer_test.go Update accessor construction to use clientProvider.

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

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines 100 to +105
func (a *TONAccessor) getCurrentMasterchainBlock(ctx context.Context) (*ton.BlockIDExt, error) {
block, err := a.client.CurrentMasterchainInfo(ctx)
client, err := a.clientProvider(ctx)
if err != nil {
return nil, fmt.Errorf("failed to get TON client: %w", err)
}
block, err := client.CurrentMasterchainInfo(ctx)
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.

Currently only one connection at a time, and should be low priority for now.

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.

currently func (c *chain) GetClient(ctx context.Context) (ton.APIClientWrapped, error) { doesn't create multiple connection in liteclient.ConnectionPool, but once we introduce multi node management using connection pool, we should be using tonutils-go.client.StickyContext

Comment on lines 78 to 94
func NewTONAccessor(
lggr logger.Logger,
chainSelector ccipocr3.ChainSelector,
client ton.APIClientWrapped,
clientProvider func(context.Context) (ton.APIClientWrapped, error),
logPoller logpoller.Service,
addrCodec ccipocr3.ChainSpecificAddressCodec,
) (ccipocr3.ChainAccessor, error) {
sLggr := logger.Sugared(lggr).Named("TONAccessor").Named(chainSelector.String())
return &TONAccessor{
lggr: sLggr,
chainSelector: chainSelector,
client: client,
logPoller: logPoller,
bindings: make(map[string]*address.Address),
bindingsMu: sync.RWMutex{},
addrCodec: addrCodec,
lggr: sLggr,
chainSelector: chainSelector,
clientProvider: clientProvider,
logPoller: logPoller,
bindings: make(map[string]*address.Address),
bindingsMu: sync.RWMutex{},
addrCodec: addrCodec,
}, nil
Comment on lines 108 to +116
addr, err := a.getBinding(consts.ContractNameOffRamp)
if err != nil {
return ccipocr3.OfframpConfig{}, err
}
config, err := tvm.CallGetter(ctx, a.client, block, addr, offramp.GetConfig)
client, err := a.clientProvider(ctx)
if err != nil {
return ccipocr3.OfframpConfig{}, fmt.Errorf("failed to get TON client: %w", err)
}
config, err := tvm.CallGetter(ctx, client, block, addr, offramp.GetConfig)
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.

Currently only one connection at a time, and should be low priority for now.

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.

@jadepark-dev jadepark-dev merged commit c3f360f into main Mar 18, 2026
42 of 44 checks passed
@jadepark-dev jadepark-dev deleted the jade/fix-ton-startup-rpc-failure branch March 18, 2026 21:07
ogtownsend pushed a commit that referenced this pull request Mar 18, 2026
* chore: test

* fix: clientProvider for CCIPProvider

* chore: test

* fix: remove failure

* fix: NewTONAccessor param
krebernisak added a commit that referenced this pull request Mar 19, 2026
fix(relayer): remove RPC dependency on CCIPProvider creation (#658)
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