Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CCIP Merge] Capabilities fix [CCIP-2943] #14048

Merged
merged 16 commits into from
Aug 7, 2024

Conversation

asoliman92
Copy link
Contributor

@asoliman92 asoliman92 commented Aug 6, 2024

Fixing ccip capabilities to be merged into chainlink

@asoliman92 asoliman92 changed the title Ccip/capabilities merge fix [CCIP Merge] Capabilities fix [CCIP-2943] Aug 6, 2024
@asoliman92 asoliman92 force-pushed the ccip/capabilities-merge-fix branch from afb93d7 to b089224 Compare August 6, 2024 13:43
@asoliman92 asoliman92 force-pushed the ccip/capabilities-directory-only branch from 7f010e1 to 7d44b17 Compare August 6, 2024 13:47
@asoliman92 asoliman92 force-pushed the ccip/capabilities-merge-fix branch from b089224 to 23dea4c Compare August 6, 2024 13:49
core/capabilities/ccip/launcher/diff.go Outdated Show resolved Hide resolved
core/capabilities/ccip/launcher/diff.go Outdated Show resolved Hide resolved
capabilityLabelledName string,
state registrysyncer.State,
) (kcr.CapabilitiesRegistryCapabilityInfo, error) {
capabilityID string,
Copy link
Contributor

Choose a reason for hiding this comment

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

Feels less error prone to make this structured ID an actual structure rather than just a string.

@cedric-cordenier wdyt? Maybe something like:

type CapabilityID struct {
    Name string
    Version string
}

func (cid CapabilityID) String() string {
    // perhaps some semver regex validation using the semver package
    return fmt.Sprintf("%s@%s", cid.Name, cid.Version)
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I said a similar comment on call with @cedric-cordenier last week as well :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This should not be a blocker for this PR though.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, I'm not against this 👍

Copy link
Contributor

Choose a reason for hiding this comment

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

@asoliman92 can you create a ticket in the backlog for this if you're not going to do it in this PR

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

core/services/chainlink/application.go Outdated Show resolved Hide resolved
Base automatically changed from ccip/capabilities-directory-only to ccip/capabilities-merge-clean August 6, 2024 14:34
@asoliman92 asoliman92 marked this pull request as ready for review August 7, 2024 15:42
@asoliman92 asoliman92 requested review from a team as code owners August 7, 2024 15:42
@asoliman92 asoliman92 requested a review from makramkd August 7, 2024 15:42
@@ -99,6 +106,25 @@ func (d *Delegate) ServicesForSpec(ctx context.Context, spec job.Job) (services
return nil, fmt.Errorf("failed to get all p2p keys: %w", err)
}

cfg := d.capabilityConfig
rid := cfg.ExternalRegistry().RelayID()
registryAddress := cfg.ExternalRegistry().Address()
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: you can inline this

Comment on lines 27 to 28
var defaultCapability = getCapability(ccipCapName, ccipCapVersion)
var newCapability = getCapability(ccipCapName, ccipCapNewVersion)
Copy link
Contributor

Choose a reason for hiding this comment

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

Merge these var decls into one var decl

Comment on lines 44 to 53
var p2pID1 = getP2PID(1)
var p2pID2 = getP2PID(2)

var defaultCapCfgs = map[string]registrysyncer.CapabilityConfiguration{
defaultCapability.ID: registrysyncer.CapabilityConfiguration{},
}
var defaultRegistryDon = registrysyncer.DON{
DON: getDON(1, []ragep2ptypes.PeerID{p2pID1}, 0),
CapabilityConfigurations: defaultCapCfgs,
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Merge into one var decl at the top of the file for better organization

Comment on lines 19 to 20
ccipreader "github.com/smartcontractkit/chainlink-ccip/pkg/reader"
ccipreaderpkg "github.com/smartcontractkit/chainlink-ccip/pkg/reader"
Copy link
Contributor

Choose a reason for hiding this comment

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

Duplicate import

@@ -46,6 +50,42 @@ type launcher struct {
subServices []services.Service
}

func unmarshalCapabilityConfig(data []byte) (capabilities.CapabilityConfiguration, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Which capability config is this unmarshalling? Not CCIP right?

Copy link
Contributor Author

@asoliman92 asoliman92 Aug 7, 2024

Choose a reason for hiding this comment

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

Not CCIP AFAIU. @cedric-cordenier right?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah this is only unmarshaling the Keystone capability configs

@@ -17,6 +17,8 @@ import (
"go.uber.org/multierr"
"go.uber.org/zap/zapcore"

"github.com/smartcontractkit/chainlink/v2/core/capabilities/ccip"
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: group this with other chainlink/v2/ imports?

@asoliman92 asoliman92 merged commit ba0e8c5 into ccip/capabilities-merge-clean Aug 7, 2024
128 of 129 checks passed
@asoliman92 asoliman92 deleted the ccip/capabilities-merge-fix branch August 7, 2024 17:11
github-merge-queue bot pushed a commit that referenced this pull request Aug 7, 2024
* [CCIP Merge] Add ccip capabilities directory [CCIP-2943] (#14044)

* Add ccip capabilities directory

* [CCIP Merge] Capabilities fix [CCIP-2943] (#14048)

* Fix compilation for launcher, diff

Make application.go ready for adding more fixes


* Fix launcher tests

* ks-409 fix the mock trigger to ensure events are sent (#14047)

* Add ccip to job orm

* Add capabilities directory under BUSL license

* Prep to instantiate separate registrysyncer for CCIP

* Move registrySyncer creation into ccip delegate

* [chore] Change registrysyncer config to bytes

* Fix launcher diff tests after changing structs in syncer

* Fix linting

* MAke simulated backend client work with chains other than 1337

* core/capabilities/ccip: use OCR offchain config (#1264)

We want to define and use the appropriate OCR offchain config for each
plugin.

Requires smartcontractkit/chainlink-ccip#36

* Cleaning up

* Add capabilities types to mockery

---------

Co-authored-by: Cedric Cordenier <cedric.cordenier@smartcontract.com>
Co-authored-by: Matthew Pendrey <matthew.pendrey@gmail.com>
Co-authored-by: Makram <makramkd@users.noreply.github.com>

* make modgraph

* Add changeset

* Fix test with new TxMgr constructor

---------

Co-authored-by: Cedric Cordenier <cedric.cordenier@smartcontract.com>
Co-authored-by: Matthew Pendrey <matthew.pendrey@gmail.com>
Co-authored-by: Makram <makramkd@users.noreply.github.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.

4 participants