Skip to content

chore: use remote chains selectors#941

Merged
gustavogama-cll merged 1 commit intomainfrom
ggama/feat/use-remote-chain-selectors
Apr 20, 2026
Merged

chore: use remote chains selectors#941
gustavogama-cll merged 1 commit intomainfrom
ggama/feat/use-remote-chain-selectors

Conversation

@gustavogama-cll
Copy link
Copy Markdown
Contributor

@gustavogama-cll gustavogama-cll commented Apr 17, 2026

This pull request updates the /chain/evm/provider and /engine/cld/chains packages to use remote chain selectors from the github.com/smartcontractkit/chain-selectors/remote package. It will enable CLDF clients to load new EVM chains without the need to update the "chain-selectors" library version.

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Apr 17, 2026

🦋 Changeset detected

Latest commit: ade774d

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

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

@gustavogama-cll gustavogama-cll force-pushed the ggama/feat/use-remote-chain-selectors branch from f525925 to 39adb31 Compare April 17, 2026 22:26
@gustavogama-cll gustavogama-cll changed the title feat: use remote chains selectors chore: use remote chains selectors Apr 17, 2026
@gustavogama-cll gustavogama-cll force-pushed the ggama/feat/use-remote-chain-selectors branch from 39adb31 to 2cd7d57 Compare April 17, 2026 22:29
@gustavogama-cll gustavogama-cll marked this pull request as ready for review April 18, 2026 02:41
@gustavogama-cll gustavogama-cll requested a review from a team as a code owner April 18, 2026 02:41
Copilot AI review requested due to automatic review settings April 18, 2026 02:41
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 migrates parts of CLDF chain loading and EVM RPC providers to resolve chain metadata via github.com/smartcontractkit/chain-selectors/remote, aiming to support newly-added EVM chains without bumping the chain-selectors dependency.

Changes:

  • Switch chain-family resolution in engine/cld/chains to use remote chain details.
  • Update EVM RPC provider(s) to derive chain ID from remote chain details.
  • Update rpcclient.MultiClient to use remote chain details (and update call sites/tests to pass context).

Reviewed changes

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

Show a summary per file
File Description
engine/cld/chains/chains.go Uses remote chain details to determine chain family before selecting loaders.
chain/evm/provider/rpc_provider.go Uses remote chain details to derive ChainID; passes ctx into MultiClient.
chain/evm/provider/zksync_rpc_provider.go Updates MultiClient call signature to include ctx.
chain/evm/provider/ctf_geth_provider.go Updates MultiClient call signature to include ctx.
chain/evm/provider/ctf_anvil_provider.go Updates MultiClient call signature to include ctx.
chain/evm/provider/rpcclient/multiclient.go Switches selector->chain lookup to remote; adds ctx param to constructor; uses ctx for health checks.
chain/evm/provider/rpcclient/multiclient_test.go Updates tests for new MultiClient signature.
chain/evm/provider/rpc_provider_test.go Updates expected error substring for remote chain-details lookup failure.
.changeset/easy-waves-hunt.md Adds a release note / version bump entry for the change.

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

Comment thread chain/evm/provider/ctf_anvil_provider.go
Comment thread .changeset/easy-waves-hunt.md Outdated
Comment thread engine/cld/chains/chains.go Outdated
Comment on lines 96 to +99
// NewMultiClient creates a new MultiClient with failover capabilities.
func NewMultiClient(lggr logger.Logger, rpcsCfg RPCConfig, opts ...func(client *MultiClient)) (*MultiClient, error) {
func NewMultiClient(
ctx context.Context, lggr logger.Logger, rpcsCfg RPCConfig, opts ...func(client *MultiClient),
) (*MultiClient, error) {
Copy link

Copilot AI Apr 18, 2026

Choose a reason for hiding this comment

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

NewMultiClient is an exported function in a non-internal package; adding a new leading context.Context parameter is a breaking API change for downstream callers. Consider preserving backwards compatibility by keeping the old signature as a wrapper (calling the new one with context.Background()/TODO) or by introducing a new function name, and align the version bump accordingly.

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

Choose a reason for hiding this comment

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

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.

sounds good to me!

Comment thread chain/evm/provider/rpcclient/multiclient.go Outdated
Comment thread chain/evm/provider/rpc_provider.go
Comment thread chain/evm/provider/zksync_rpc_provider.go
Comment thread chain/evm/provider/ctf_geth_provider.go
@gustavogama-cll gustavogama-cll marked this pull request as draft April 18, 2026 07:15
@gustavogama-cll gustavogama-cll force-pushed the ggama/feat/use-remote-chain-selectors branch from 2cd7d57 to 5c6e5bf Compare April 18, 2026 07:32
@gustavogama-cll gustavogama-cll force-pushed the ggama/feat/use-remote-chain-selectors branch from 5c6e5bf to ade774d Compare April 18, 2026 07:32
@cl-sonarqube-production
Copy link
Copy Markdown

Copy link
Copy Markdown
Collaborator

@graham-chainlink graham-chainlink left a comment

Choose a reason for hiding this comment

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

Looks good to me, running this in CLD should be no issue as the remote github url is public.

i guess one of the side effect is that running the test will hit the github url everytime test is run, i wonder if we should introduce a flag to only use local in test to avoid ddosing github? thoughts?

Copy link
Copy Markdown
Contributor

@ecPablo ecPablo left a comment

Choose a reason for hiding this comment

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

LGTM, just following what @graham-chainlink said on rate limits for unit tests. I believe they have 5,000 requests per hour per IP address. But this should not be a problem as long as we have the chain selectors used in unit tests existing locally, which I think is the case right now.

@graham-chainlink
Copy link
Copy Markdown
Collaborator

LGTM, just following what @graham-chainlink said on rate limits for unit tests. I believe they have 5,000 requests per hour per IP address. But this should not be a problem as long as we have the chain selectors used in unit tests existing locally, which I think is the case right now.

yeah true, since it checks for local first then only fetch remote if it doesnt exist.

@gustavogama-cll gustavogama-cll marked this pull request as ready for review April 20, 2026 15:41
Copilot AI review requested due to automatic review settings April 20, 2026 15:41
@gustavogama-cll gustavogama-cll added this pull request to the merge queue Apr 20, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Apr 20, 2026
@gustavogama-cll gustavogama-cll added this pull request to the merge queue Apr 20, 2026
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

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


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

chainDetails, err := chainsel.GetChainDetailsBySelector(ctx, p.selector)
if err != nil {
return nil, fmt.Errorf("failed to get chain id from selector: %w", err)
return nil, fmt.Errorf("failed to get chain details for selector: %w", err)
Copy link

Copilot AI Apr 20, 2026

Choose a reason for hiding this comment

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

This error omits the selector value (unlike other providers in this PR) which makes failures harder to diagnose. Include p.selector in the message for consistency and easier debugging (e.g., "... for selector %d").

Suggested change
return nil, fmt.Errorf("failed to get chain details for selector: %w", err)
return nil, fmt.Errorf("failed to get chain details for selector %d: %w", p.selector, err)

Copilot uses AI. Check for mistakes.
Merged via the queue into main with commit 7fec47c Apr 20, 2026
31 checks passed
@gustavogama-cll gustavogama-cll deleted the ggama/feat/use-remote-chain-selectors branch April 20, 2026 15:49
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