-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
[BCF-2365] Consolidate *Provider Constructors into One #10475
Conversation
I see that you haven't updated any CHANGELOG files. Would it make sense to do so? |
fb677fa
to
b2813d7
Compare
b2813d7
to
368154b
Compare
go.mod
Outdated
@@ -66,7 +66,7 @@ require ( | |||
github.com/shopspring/decimal v1.3.1 | |||
github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 | |||
github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20230831132059-42af68994512 | |||
github.com/smartcontractkit/chainlink-relay v0.1.7-0.20230901143551-bf6bd84d6938 | |||
github.com/smartcontractkit/chainlink-relay v0.1.7-0.20230904152856-39e4d6f4a24b |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ctx, | ||
types.RelayArgs{ | ||
ExternalJobID: jobSpec.ExternalJobID, | ||
JobID: spec.ID, | ||
ContractID: spec.ContractID, | ||
RelayConfig: spec.RelayConfig.Bytes(), | ||
New: d.isNewlyCreatedJob, | ||
ProviderType: types.ProviderTypeFunctions, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm still not 100% sure that I understand this new types.ProviderType*
. Where will the mapping from plugin type to provider type exist long-term? Core cannot continue to make this associate explicit in the delegate like this. To be product agnostic, it would have to just pass along information from the job spec. It seems like we either need to add this new field to the jobspec, or infer/derive from the plugin type inside the relayer instead of here in core.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand that we don't want to lock in plugin type and provider type as 1-1, but we also have to balance that against node op UX simplicity, so I would favor hiding this difference for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Assuming you're talking about the mapping from the ProviderType value to the ProviderType type, then this mapping should live either in the RelayerServerAdapter (which shouldn't really live in the core node tbh) or in the RelayerServer.
This field should live in the pluginConfig of the jobspec long-term (such as for generic plugin job types). However, based on our discussion the other day where we said that some parts of the codebase will still need to be provider aware, I just added them statically in those places for now (my reasoning being that there is no difference between a call to say, NewMedianProvider
or a call to NewPluginProvider
with providerType = "median"
). That's the case for this block of code here, which has to do with router proxies, which is a functions only feature.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had a similar reaction.
It seems like the job spec is the string that ties all the services together and so the provider type should be coming from there.
how does core know which services to start today for say, mercury vs functions? is something in the jobspec or is it inferred from something else?
my real question is: if we add the provider field to the spec, is it a breaking change or can we infer the correct behavior and backfill on-the-fly as needed to update the spec?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how does core know which services to start today for say, mercury vs functions? is something in the jobspec or is it inferred from something else?
That comes from the plugin type on the job spec at the moment.
my real question is: if we add the provider field to the spec, is it a breaking change or can we infer the correct behavior and backfill on-the-fly as needed to update the spec?
For old job types of the OCR2 job type we could backfill on the fly. I don't know that we could do that in this particular case (ocrbootstrap) since I'm not sure if the pluginType is used. For functions I assume it isn't since they're checking the router DonID rather than the pluginType.
ctx, | ||
types.RelayArgs{ | ||
ExternalJobID: jobSpec.ExternalJobID, | ||
JobID: spec.ID, | ||
ContractID: spec.ContractID, | ||
RelayConfig: spec.RelayConfig.Bytes(), | ||
New: d.isNewlyCreatedJob, | ||
ProviderType: string(job.OCR2Functions), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jmank88 @krehermann Was this the kind of change you had in mind? (Here taken explicitly, but taken from the job spec in the case of Median and Mercury)
I've coerced the value to a string since that way it's acts as a passthrough value when we source it from the providerType.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh I didn't realize this one was such an oddball 🤔
Yeah, I think this works for now, and we should be able to evolve in a compatible way 🤔
75cc7d0
to
608f982
Compare
Running downstream job at https://github.com/smartcontractkit/operator-ui/actions/runs/6108242478 |
608f982
to
dc72147
Compare
Running downstream job at https://github.com/smartcontractkit/operator-ui/actions/runs/6108501128 |
dc72147
to
6be2fc3
Compare
Running downstream job at https://github.com/smartcontractkit/operator-ui/actions/runs/6109453760 |
6be2fc3
to
316ccfe
Compare
Running downstream job at https://github.com/smartcontractkit/operator-ui/actions/runs/6110623679 |
316ccfe
to
bb747fa
Compare
Running downstream job at https://github.com/smartcontractkit/operator-ui/actions/runs/6112141783 |
- Adapt the MercuryProvider so that it strictly extends the PluginProvider type. The additional functions in the MercuryTransmitter have moved to a separate MercuryServerFetcher component. - Introduce a wrapper relayerServerAdapter type which contains similar logic to the GRPC relayerServer, whose NewPluginProvider function returns a different provider type depending on the passed in ProviderType. - Replace uses of New{Mercury|Median|Functions}Provider with calls to NewPluginProvider with the correct ProviderType passed in.
8db4cb1
to
c5f6e4f
Compare
Running downstream job at https://github.com/smartcontractkit/operator-ui/actions/runs/6112640045 |
Running downstream job at https://github.com/smartcontractkit/operator-ui/actions/runs/6120721460 |
Running downstream job at https://github.com/smartcontractkit/operator-ui/actions/runs/6122089885 |
Running downstream job at https://github.com/smartcontractkit/operator-ui/actions/runs/6122192882 |
887424a
to
bfd60d2
Compare
Running downstream job at https://github.com/smartcontractkit/operator-ui/actions/runs/6122378021 |
SonarQube Quality Gate |
NewPluginProvider
function returns a different provider type depending on the passed inProviderType
.New{Mercury|Median|Functions}Provider
with calls toNewPluginProvider
with the correctProviderType
passed in.