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

[chore] Move core service types to types/core to mirror package structure; Add RelayerSet #475

Merged
merged 1 commit into from
Apr 19, 2024

Conversation

cedric-cordenier
Copy link
Contributor

@cedric-cordenier cedric-cordenier commented Apr 18, 2024

  • Move the core API services (keystore, capabilities_registry, kv store, telemetry, etc) into core.
  • Also move the API "integration path" methods relating to integration reporting plugins into core.
  • Add a RelayerSet API. This duplicates some structs (PluginArgs, RelayArgs), but omits job-related fields.

NOTE: Working on preparing the corresponding PRs to core/chainlink-solana, and will hold off on merging this until those are ready. I'd still appreciate some early feedback at this stage though!

@cedric-cordenier cedric-cordenier requested a review from ettec April 18, 2024 12:55
@cedric-cordenier cedric-cordenier changed the title WIP RelayerSet interfaces [chore] Move core service types to types/core to mirror package structure; Add RelayerSet Apr 18, 2024

type RelayerSet interface {
Get(ctx context.Context, relayID types.RelayID) (Relayer, error)
GetAll(ctx context.Context) ([]Relayer, error)
Copy link
Contributor

Choose a reason for hiding this comment

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

prefer List to GetAll.

additionally if you want to complete, you can pass a vardiac filter List(ctx, ids ...types.RelayID) and return everything when len(ids) == 0

Copy link
Contributor

@krehermann krehermann left a comment

Choose a reason for hiding this comment

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

lgtm up to nit about api naming

pkg/types/relayer.go Outdated Show resolved Hide resolved
)

func (i *RelayID) UnmarshalString(s string) error {
idxs := idRegex.FindStringIndex(s)
Copy link
Contributor

Choose a reason for hiding this comment

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

this looks overly complex. can't it be simple string split on . into 2 pieces?

}

var idRegex = regexp.MustCompile(
fmt.Sprintf("^((%s)|(%s)|(%s)|(%s))\\.", NetworkEVM, NetworkCosmos, NetworkSolana, NetworkStarkNet),
Copy link
Contributor

Choose a reason for hiding this comment

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

as said below, i think the regex is more complex than needed. however, if you need to keep to it, then it should be constructed from SupportNetwork rather than individual consts

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@krehermann Do you mind if I defer this? This is just the existing implementation copied from core to common

Copy link
Contributor

@krehermann krehermann Apr 19, 2024

Choose a reason for hiding this comment

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

does this file make sense here? if we are mirroring the core types up from internal, shouldn't we do the same for the other building blocks?

imho it would make the core side easier to read.

currently it is ~types.NetworkEVM and core.Keystore etc.

relayer.EVM and core.Keystone would be more consistent. or relayer.EVMNetwork

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 don't disagree, but I was trying to just do what I needed to get the RelayerSet interface into common as I promised Dimitris I'd do that by EOW. There's already been a bit of scope creep and I want to avoid further creep here, but happy to follow up with moving the remaining types into types/relayer.

Copy link
Contributor

Choose a reason for hiding this comment

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

ok. can you add some TODOs with ticket references for the deferred maintenance? i'm fine with postponing, but i want to make sure we do the cleanup. if there are TODOs and unassigned tickets in the backlog we can clean them during planning.

"github.com/smartcontractkit/chainlink-common/pkg/types"
)

type PluginMedian interface {
Copy link
Contributor

Choose a reason for hiding this comment

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

why is this a core type? it seems out of place relative to the other things

Copy link
Contributor Author

@cedric-cordenier cedric-cordenier Apr 19, 2024

Choose a reason for hiding this comment

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

It's analogous to the reporting plugin factories methods, except median-specific (dating from when median was a custom loopp type).

@cedric-cordenier cedric-cordenier merged commit 71a18c1 into main Apr 19, 2024
6 of 9 checks passed
@cedric-cordenier cedric-cordenier deleted the relayerset-interfaces branch April 19, 2024 16:10
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.

3 participants