Skip to content

add simple rpc provider for Stellar#714

Open
FelixFan1992 wants to merge 8 commits intomainfrom
NONEVM-3584
Open

add simple rpc provider for Stellar#714
FelixFan1992 wants to merge 8 commits intomainfrom
NONEVM-3584

Conversation

@FelixFan1992
Copy link
Contributor

No description provided.

@changeset-bot
Copy link

changeset-bot bot commented Feb 5, 2026

🦋 Changeset detected

Latest commit: b30b3af

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

This PR includes changesets to release 1 package
Name Type
chainlink-deployments-framework Patch

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

@FelixFan1992 FelixFan1992 marked this pull request as ready for review February 6, 2026 16:32
@FelixFan1992 FelixFan1992 requested a review from a team as a code owner February 6, 2026 16:32
Copilot AI review requested due to automatic review settings February 6, 2026 16:32
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 adds a simple RPC provider implementation for the Stellar blockchain network within the chainlink-deployments-framework. It introduces the foundational types and structures needed to support Stellar chain operations.

Changes:

  • Introduces Chain and ChainMetadata types for Stellar network representation
  • Implements RPCChainProvider with configuration and initialization logic
  • Adds validation for required Stellar network parameters (NetworkPassphrase, FriendbotURL, SorobanRPCURL)

Reviewed changes

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

File Description
chain/stellar/stellar_chain.go Defines the basic Chain struct and ChainMetadata type alias for Stellar networks
chain/stellar/provider/rpc_provider.go Implements RPCChainProvider with configuration validation and chain initialization

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

Copilot AI review requested due to automatic review settings February 9, 2026 14:31
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 3 out of 3 changed files in this pull request and generated 5 comments.


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

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings February 9, 2026 14:36
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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 3 out of 3 changed files in this pull request and generated 2 comments.


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

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings February 9, 2026 14:39
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 3 out of 3 changed files in this pull request and generated 2 comments.


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

Comment on lines 47 to 61
func (p *RPCChainProvider) Initialize(_ context.Context) (chain.BlockChain, error) {
if p.chain != nil {
return p.chain, nil // already initialized
}

if err := p.config.validate(); err != nil {
return nil, err
}

p.chain = &stellar.Chain{
ChainMetadata: stellar.ChainMetadata{Selector: p.selector},
}

return *p.chain, nil
}
Copy link

Copilot AI Feb 9, 2026

Choose a reason for hiding this comment

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

Initialize() performs a check-then-set on p.chain without synchronization. If Initialize() can be called concurrently, this can lead to data races and double-initialization. Consider guarding initialization with sync.Once or a mutex (and similarly protect reads in BlockChain() if needed).

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

Quality Gate failed Quality Gate failed

Failed conditions
0.0% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube

Copilot AI review requested due to automatic review settings February 9, 2026 16: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 9 out of 10 changed files in this pull request and generated 4 comments.


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

Comment on lines +356 to +362
c, err := stellarprov.NewRPCChainProvider(selector,
stellarprov.RPCChainProviderConfig{
NetworkPassphrase: network.Metadata.(map[string]any)["network_passphrase"].(string),
FriendbotURL: network.RPCs[1].HTTPURL,
SorobanRPCURL: network.RPCs[0].HTTPURL,
},
).Initialize(ctx)
Copy link

Copilot AI Feb 9, 2026

Choose a reason for hiding this comment

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

network.Metadata.(map[string]any)["network_passphrase"].(string)andnetwork.RPCs[0/1]can panic at runtime if metadata is missing/typed unexpectedly or if RPC endpoints are not present/ordered as assumed. Prefer explicit extraction withokchecks (and returning a descriptive error) and avoid hard-coded indices by selecting RPC URLs by role/name (or at least validatinglen(network.RPCs)` before indexing).

Copilot uses AI. Check for mistakes.
Comment on lines +206 to +210
if cfg.Stellar.DeployerKey != "" {
loaders[chainsel.FamilyStellar] = newChainLoaderStellar(networks, cfg)
} else {
lggr.Info("Skipping Stellar chains, no private key found in secrets")
}
Copy link

Copilot AI Feb 9, 2026

Choose a reason for hiding this comment

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

chainLoaderStellar/RPCChainProviderdon’t usecfg.Stellar.DeployerKey`, but chain loading is gated on it being set. This will unexpectedly skip Stellar chain initialization even when the RPC config is present/valid. Either (a) remove this gate for Stellar and gate on the actual required inputs (passphrase + RPC URLs), or (b) plumb the deployer key into the Stellar provider/loader if it’s required for intended operations.

Suggested change
if cfg.Stellar.DeployerKey != "" {
loaders[chainsel.FamilyStellar] = newChainLoaderStellar(networks, cfg)
} else {
lggr.Info("Skipping Stellar chains, no private key found in secrets")
}
loaders[chainsel.FamilyStellar] = newChainLoaderStellar(networks, cfg)

Copilot uses AI. Check for mistakes.
Comment on lines +61 to +67
// StellarConfig is the configuration for the Stellar Chains.
//
// WARNING: This data type contains sensitive fields and should not be logged or set in file
// configuration.
type StellarConfig struct {
DeployerKey string `mapstructure:"deployer_key" yaml:"deployer_key"` // Secret: The private key of the deployer account.
}
Copy link

Copilot AI Feb 9, 2026

Choose a reason for hiding this comment

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

The comment says the deployer key “should not be ... set in file configuration”, but the struct is explicitly tagged for YAML file config (yaml:"deployer_key") and this PR adds it to engine/cld/config/env/testdata/config.yml. Consider clarifying the warning (e.g., “do not commit real secrets; prefer env vars for production”) or adjusting test/config patterns to align with the guidance.

Copilot uses AI. Check for mistakes.
Comment on lines +17 to +29
func (c RPCChainProviderConfig) validate() error {
if c.NetworkPassphrase == "" {
return errors.New("network passphrase is required")
}
if c.FriendbotURL == "" {
return errors.New("friendbot URL is required")
}
if c.SorobanRPCURL == "" {
return errors.New("soroban RPC URL is required")
}

return nil
}
Copy link

Copilot AI Feb 9, 2026

Choose a reason for hiding this comment

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

This new config validation (and the provider initialization/caching behavior) doesn’t appear to have unit coverage. Adding tests for each missing-field case and for Initialize() returning the same chain on subsequent calls will help prevent regressions as Stellar support expands.

Copilot uses AI. Check for mistakes.
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.

2 participants