-
Notifications
You must be signed in to change notification settings - Fork 16
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
Conversation
2cc3c10
to
20c0628
Compare
20c0628
to
157d875
Compare
pkg/types/core/relayerset.go
Outdated
|
||
type RelayerSet interface { | ||
Get(ctx context.Context, relayID types.RelayID) (Relayer, error) | ||
GetAll(ctx context.Context) ([]Relayer, error) |
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.
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
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.
lgtm up to nit about api naming
157d875
to
bfbd363
Compare
bfbd363
to
e32d9b8
Compare
e32d9b8
to
9d32752
Compare
af8e582
to
fdd8534
Compare
fdd8534
to
9bef5c9
Compare
9bef5c9
to
3399470
Compare
3399470
to
f23f3bd
Compare
) | ||
|
||
func (i *RelayID) UnmarshalString(s string) error { | ||
idxs := idRegex.FindStringIndex(s) |
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.
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), |
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.
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
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.
@krehermann Do you mind if I defer this? This is just the existing implementation copied from core to common
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.
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
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 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.
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.
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 { |
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.
why is this a core type? it seems out of place relative to the other things
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.
It's analogous to the reporting plugin factories methods, except median-specific (dating from when median was a custom loopp type).
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!