Skip to content

Commit bb54698

Browse files
committed
Merge develop and resolve go.mod/go.sum conflicts
2 parents 79db9c1 + 2fa3883 commit bb54698

20 files changed

Lines changed: 164 additions & 54 deletions

File tree

.changeset/bright-pens-glow.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"chainlink": patch
3+
---
4+
5+
#added Add ListPendingJobProposals and ApproveJobProposalByID to the GQL SDK Client

.github/copilot-instructions.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,11 @@ Identify specific code blocks that require **scrupulous human review**. Focus on
1818
Analyze the `CODEOWNERS` file and the git history (recent editors) to suggest the most qualified reviewers.
1919
- Prioritize individuals who have made significant recent contributions to the specific files modified.
2020
- Cross-reference these contributors with the defined `CODEOWNERS` for the directory.
21+
22+
### 4. Code Style
23+
Give style advice based on the following guides, in order of priority.
24+
1. [Effective Go](https://go.dev/doc/effective_go)
25+
2. [Google Code Review Comments](https://go.dev/wiki/CodeReviewComments)
26+
3. [Google Style Guide](https://google.github.io/styleguide/go/)
27+
28+
Style exceptions are acceptable when aligning with pre-existing "local" style from the same file or package, but they should still be noted.

core/scripts/go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -487,11 +487,11 @@ require (
487487
github.com/smartcontractkit/ccip-owner-contracts v0.1.0 // indirect
488488
github.com/smartcontractkit/chain-selectors v1.0.97 // indirect
489489
github.com/smartcontractkit/chainlink-aptos v0.0.0-20260318173523-755cafb24200 // indirect
490-
github.com/smartcontractkit/chainlink-ccip/ccv/chains/evm v0.0.0-20260319175550-83cf59fe6839 // indirect
490+
github.com/smartcontractkit/chainlink-ccip/ccv/chains/evm v0.0.0-20260323224438-d819cb3228e1 // indirect
491491
github.com/smartcontractkit/chainlink-ccip/chains/solana v0.0.0-20260310183131-8d0f0e383288 // indirect
492492
github.com/smartcontractkit/chainlink-ccip/chains/solana/gobindings v0.0.0-20260310183131-8d0f0e383288 // indirect
493493
github.com/smartcontractkit/chainlink-ccip/deployment v0.0.0-20260317185256-d5f7db87ae70 // indirect
494-
github.com/smartcontractkit/chainlink-ccv v0.0.0-20260320145055-eb20b529ff95 // indirect
494+
github.com/smartcontractkit/chainlink-ccv v0.0.0-20260324000441-d4cfddc9f7d2 // indirect
495495
github.com/smartcontractkit/chainlink-common/pkg/chipingress v0.0.11-0.20251211140724-319861e514c4 // indirect
496496
github.com/smartcontractkit/chainlink-evm/contracts/cre/gobindings v0.0.0-20260107191744-4b93f62cffe3 // indirect
497497
github.com/smartcontractkit/chainlink-feeds v0.1.2-0.20250227211209-7cd000095135 // indirect

core/scripts/go.sum

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

deployment/ccip/changeset/v1_5_1/cs_configure_token_pools.go

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,12 @@ type TokenPoolConfig struct {
262262

263263
// SkipOwnershipValidation, if true, skips validation of ownership on the token pool. Optional, defaults to false.
264264
SkipOwnershipValidation bool `json:"skipOwnershipValidation,omitempty"`
265+
266+
// AllowAdditiveRemotePools, if true, allows adding additional remote pools to existing chain configurations
267+
// without removing and re-adding the chain selector. When false (default), the behavior is to remove
268+
// the chain selector and re-add it with the new pool configuration (spot replacement).
269+
// This is particularly useful for Solana and other chains where multiple pools may need to coexist.
270+
AllowAdditiveRemotePools bool `json:"allowAdditiveRemotePools,omitempty"`
265271
}
266272

267273
func (c TokenPoolConfig) Validate(ctx context.Context, chain cldf_evm.Chain, ccipState stateview.CCIPOnChainState, useMcms bool, tokenSymbol shared.TokenSymbol) error {
@@ -482,13 +488,29 @@ func configureTokenPool(
482488
break
483489
}
484490
}
485-
if !bytes.Equal(remoteTokenAddress.Bytes(), remoteToken) || !isRemotePoolSupported {
486-
// Remove & later re-add the chain if the remote token has changed OR the remote pool address is not supported
491+
492+
// Determine the action based on token and pool status
493+
switch {
494+
case !bytes.Equal(remoteTokenAddress.Bytes(), remoteToken):
495+
// Remote token has changed - this always requires chain removal/re-addition
487496
chainRemovals = append(chainRemovals, remoteChainSelector)
488497
addChain = true
489-
} else {
490-
// Update the rate limits if the chain is already supported
491-
// We dont need to add a new remote pool because solana only supports one remote pool per token
498+
case !isRemotePoolSupported:
499+
// Remote pool is not supported - behavior depends on AllowAdditiveRemotePools flag
500+
if poolUpdate.AllowAdditiveRemotePools {
501+
// Add the new remote pool without removing the chain
502+
remotePoolAddressAdditions[remoteChainSelector] = common.LeftPadBytes(remotePoolAddress.Bytes(), 32)
503+
// Also update rate limits
504+
remoteChainSelectorsToUpdate = append(remoteChainSelectorsToUpdate, remoteChainSelector)
505+
updatedOutboundConfigs = append(updatedOutboundConfigs, chainUpdate.RateLimiterConfig.Outbound)
506+
updatedInboundConfigs = append(updatedInboundConfigs, chainUpdate.RateLimiterConfig.Inbound)
507+
} else {
508+
// Default behavior: Remove & later re-add the chain (spot replacement)
509+
chainRemovals = append(chainRemovals, remoteChainSelector)
510+
addChain = true
511+
}
512+
default:
513+
// Remote pool is already supported, just update the rate limits
492514
remoteChainSelectorsToUpdate = append(remoteChainSelectorsToUpdate, remoteChainSelector)
493515
updatedOutboundConfigs = append(updatedOutboundConfigs, chainUpdate.RateLimiterConfig.Outbound)
494516
updatedInboundConfigs = append(updatedInboundConfigs, chainUpdate.RateLimiterConfig.Inbound)
@@ -500,8 +522,8 @@ func configureTokenPool(
500522
RemoteChainSelector: remoteChainSelector,
501523
InboundRateLimiterConfig: chainUpdate.RateLimiterConfig.Inbound,
502524
OutboundRateLimiterConfig: chainUpdate.RateLimiterConfig.Outbound,
503-
RemoteTokenAddress: remoteTokenAddress.Bytes(),
504-
RemotePoolAddresses: [][]byte{remotePoolAddress.Bytes()},
525+
RemoteTokenAddress: common.LeftPadBytes(remoteTokenAddress.Bytes(), 32),
526+
RemotePoolAddresses: [][]byte{common.LeftPadBytes(remotePoolAddress.Bytes(), 32)},
505527
})
506528
}
507529
}
@@ -587,7 +609,9 @@ func configureTokenPool(
587609
}
588610
}
589611
// Check if the remote pool to-be-set is non-empty and not already configured on the token pool
590-
if len(remotePoolAddress) == 0 && !isRemotePoolSupported {
612+
// For Sui, the default behavior has always been additive, so we maintain backward compatibility
613+
// The AllowAdditiveRemotePools flag doesn't change Sui's existing behavior
614+
if len(remotePoolAddress) > 0 && !isRemotePoolSupported {
591615
remotePoolAddressAdditions[remoteChainSelector] = common.LeftPadBytes(remotePoolAddress, 32)
592616
}
593617
} else {
Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,33 @@
11
## GQL SDK
22

3-
This package exports a `Client` for interacting with the `feeds-manager` service of core. The implementation is based on code generated via `[genqlient](https://github.com/Khan/genqlient)`.
3+
This package exports a `Client` for interacting with the `feeds-manager` service of core. The implementation is based on code generated via [genqlient](https://github.com/Khan/genqlient).
4+
5+
### Structure
6+
7+
```
8+
client/ # Client interface, implementation, and types
9+
internal/ # GraphQL queries/mutations and generated code
10+
genqlient.graphql
11+
generated/
12+
```
13+
14+
### Prerequisites
15+
16+
- [go-task](https://taskfile.dev/) (`task` CLI)
17+
- Go 1.21+
418

519
### Extending the Client
620

7-
Add additional queries or mutations to `genqlient.graphql` and then regenerate the implementation via the Taskfile:
21+
If your feature requires **new GraphQL operations**, add queries or mutations to `genqlient.graphql` and then regenerate the implementation via the Taskfile:
822

923
```bash
1024
$ task generate
1125
```
1226

1327
Next, extend the `Client` interface and the `client` implementation.
28+
29+
If your feature **composes existing operations** (e.g. filtering or combining results from already-generated queries), you can extend the `Client` interface and implementation directly without modifying `genqlient.graphql` or regenerating.
30+
31+
### Usage
32+
33+
See `devenv/don.go` and `keystone/scripts/main.go` for real-world usage examples.

deployment/environment/web/sdk/client/client.go

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ type Client interface {
3737
CancelJobProposalSpec(ctx context.Context, id string) (*generated.CancelJobProposalSpecCancelJobProposalSpecCancelJobProposalSpecSuccessSpecJobProposalSpec, error)
3838
RejectJobProposalSpec(ctx context.Context, id string) (*generated.RejectJobProposalSpecResponse, error)
3939
UpdateJobProposalSpecDefinition(ctx context.Context, id string, cmd generated.UpdateJobProposalSpecDefinitionInput) (*generated.UpdateJobProposalSpecDefinitionResponse, error)
40+
ListPendingJobProposals(ctx context.Context) ([]PendingJobProposal, error)
41+
ApproveJobProposalByID(ctx context.Context, proposalID string, force bool) (*JobProposalApprovalSuccessSpec, error)
4042
}
4143

4244
type client struct {
@@ -405,6 +407,46 @@ func (c *client) login() error {
405407
return fmt.Errorf("no set-cookie found in header. Check credentials and scheme. Response code was: %d", res.StatusCode)
406408
}
407409

410+
// ListPendingJobProposals returns all job proposals whose latest spec has a
411+
// pending status, across all job distributors registered on the node.
412+
func (c *client) ListPendingJobProposals(ctx context.Context) ([]PendingJobProposal, error) {
413+
resp, err := generated.ListFeedsManagers(ctx, c.gqlClient)
414+
if err != nil {
415+
return nil, fmt.Errorf("failed to list job distributors: %w", err)
416+
}
417+
if resp == nil {
418+
return nil, errors.New("unexpected nil response from list job distributors")
419+
}
420+
421+
var pending []PendingJobProposal
422+
for _, fm := range resp.FeedsManagers.Results {
423+
for _, jp := range fm.JobProposals {
424+
if jp.LatestSpec.Status == generated.SpecStatusPending {
425+
pending = append(pending, PendingJobProposal{
426+
ProposalID: jp.Id,
427+
SpecID: jp.LatestSpec.Id,
428+
ProposalStatus: string(jp.Status),
429+
SpecStatus: string(jp.LatestSpec.Status),
430+
Definition: jp.LatestSpec.Definition,
431+
Version: jp.LatestSpec.Version,
432+
JobDistributorID: fm.Id,
433+
})
434+
}
435+
}
436+
}
437+
return pending, nil
438+
}
439+
440+
// ApproveJobProposalByID looks up a job proposal by its proposal ID, resolves
441+
// the latest spec, and approves it.
442+
func (c *client) ApproveJobProposalByID(ctx context.Context, proposalID string, force bool) (*JobProposalApprovalSuccessSpec, error) {
443+
proposal, err := c.GetJobProposal(ctx, proposalID)
444+
if err != nil {
445+
return nil, fmt.Errorf("failed to get job proposal %s: %w", proposalID, err)
446+
}
447+
return c.ApproveJobProposalSpec(ctx, proposal.LatestSpec.Id, force)
448+
}
449+
408450
// CreateOCR2KeyBundle creates a new OCR2 key bundle for the specified chain type
409451
// and returns the ID of the created bundle
410452
func (c *client) CreateOCR2KeyBundle(ctx context.Context, chainType string) (string, error) {

deployment/environment/web/sdk/client/types.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,17 @@ func DecodeInput(in, out any) error {
6161
return decoder.Decode(out)
6262
}
6363

64+
// PendingJobProposal represents a job proposal with a pending latest spec
65+
type PendingJobProposal struct {
66+
ProposalID string `json:"proposalId"`
67+
SpecID string `json:"specId"`
68+
ProposalStatus string `json:"proposalStatus"`
69+
SpecStatus string `json:"specStatus"`
70+
Definition string `json:"definition"`
71+
Version int `json:"version"`
72+
JobDistributorID string `json:"jobDistributorId"`
73+
}
74+
6475
type OCR2ChainType = string
6576

6677
const (

deployment/go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -421,8 +421,8 @@ require (
421421
github.com/sigurn/crc16 v0.0.0-20211026045750-20ab5afb07e3 // indirect
422422
github.com/sirupsen/logrus v1.9.4 // indirect
423423
github.com/smartcontractkit/chainlink-automation v0.8.1 // indirect
424-
github.com/smartcontractkit/chainlink-ccip/ccv/chains/evm v0.0.0-20260319175550-83cf59fe6839 // indirect
425-
github.com/smartcontractkit/chainlink-ccv v0.0.0-20260320145055-eb20b529ff95 // indirect
424+
github.com/smartcontractkit/chainlink-ccip/ccv/chains/evm v0.0.0-20260323224438-d819cb3228e1 // indirect
425+
github.com/smartcontractkit/chainlink-ccv v0.0.0-20260324000441-d4cfddc9f7d2 // indirect
426426
github.com/smartcontractkit/chainlink-common/pkg/chipingress v0.0.10 // indirect
427427
github.com/smartcontractkit/chainlink-data-streams v0.1.13 // indirect
428428
github.com/smartcontractkit/chainlink-feeds v0.1.2-0.20250227211209-7cd000095135 // indirect

deployment/go.sum

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)