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

core/services/ccipcapability: add the ccip capability package #1024

Closed
wants to merge 12 commits into from

Conversation

makramkd
Copy link
Contributor

@makramkd makramkd commented Jun 14, 2024

Motivation

Solution

Architecture

ccip-init-mini

* add an implementation for the job delegate
* ocr instance launcher and blue/green deployment
@makramkd makramkd force-pushed the CCIP-2379/ccip-capability-job branch from 6e2c9e9 to 26e370d Compare June 14, 2024 13:06
LatestState() (RegistryState, error)
}

type ChainConfig interface {
Copy link
Contributor

Choose a reason for hiding this comment

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

This is different on the contract, it includes ChainSelector as well.

ds sqlutil.DataSource
peerWrapper *ocrcommon.SingletonPeerWrapper

isNewlyCreatedJob bool
Copy link
Contributor

Choose a reason for hiding this comment

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

What do you imagine this is going to be used for? It's currently passed into the oracle creator which effectively makes it a constant.

Copy link
Contributor

@winder winder left a comment

Choose a reason for hiding this comment

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

I haven't spent enough time concentrating on the capabilities docs, so I'm a bit out of depth. But here are some things I noticed. Overall, it seems fairly sensible.

Comment on lines +9 to +10
// blueGreenDeployment represents a blue-green deployment of OCR instances.
type blueGreenDeployment struct {
Copy link
Contributor

Choose a reason for hiding this comment

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

Where are capabilities actually deployed? Seems weird to have this built into the node.

Currently it seems like this only manages switching between configs. It might be nice to switch between LOOPPs 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.

Eventually it'll switch between LOOPPs, that LOOPP or not factor is hidden behind the OracleCreator interface.

Capabilities are created on the capability registry, DONs that support a capability are also created there, so the capability registry is the source of truth on that.

core/services/ccipcapability/launcher/launcher.go Outdated Show resolved Hide resolved
@@ -50,6 +50,7 @@ const (
Webhook Type = (Type)(pipeline.WebhookJobType)
Workflow Type = (Type)(pipeline.WorkflowJobType)
StandardCapabilities Type = (Type)(pipeline.StandardCapabilitiesJobType)
CCIP Type = (Type)(pipeline.CCIPJobType)
Copy link
Contributor

Choose a reason for hiding this comment

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

It appears that someone was trying to alphabetize these, maybe move this to line 39. Same with the flags below.

}

func (d *Delegate) JobType() job.Type {
return job.CCIP
Copy link
Contributor

Choose a reason for hiding this comment

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

Wondering if the single job for both plugins is going to lead to any kind of limitations.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We will find out ;-)


func (d *Delegate) BeforeJobCreated(job.Job) {
// This is only called first time the job is created
d.isNewlyCreatedJob = true
Copy link
Contributor

Choose a reason for hiding this comment

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

This seems weird (maybe after it starts being used it becomes clear though): for a newly created delegate newJob = false.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah this is just standard chainlink job stuff, other jobs do this as well

core/services/ccipcapability/delegate.go Outdated Show resolved Hide resolved
core/services/ccipcapability/delegate.go Outdated Show resolved Hide resolved
core/services/ccipcapability/delegate.go Outdated Show resolved Hide resolved
core/services/ccipcapability/launcher/launcher.go Outdated Show resolved Hide resolved
core/services/ccipcapability/launcher/launcher.go Outdated Show resolved Hide resolved
}
}

func (l *launcher) tick() error {
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe rename tick() to something more meaningful about what happens inside the func

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can't come up with a good name :-) please suggest

core/services/ccipcapability/launcher/launcher.go Outdated Show resolved Hide resolved
// 1. Create a new oracle (the green instance) and start it.
// 2. Shut down the blue instance, making the green instance the new blue instance.
func (l *launcher) updateDON(don keystone_capability_registry.CapabilityRegistryDONInfo) error {
if !isMemberOfDON(don, l.p2pID) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should also check if we are running instances for this DON

@makramkd makramkd closed this Jun 24, 2024
@makramkd makramkd deleted the CCIP-2379/ccip-capability-job branch June 24, 2024 12:31
@makramkd makramkd restored the CCIP-2379/ccip-capability-job branch June 27, 2024 09:22
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