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

Add standalone registrysyncer package #13668

Merged
merged 8 commits into from
Jun 25, 2024
Merged

Conversation

cedric-cordenier
Copy link
Contributor

@cedric-cordenier cedric-cordenier commented Jun 24, 2024

  • Create a standalone registrysyncer package which accepts arbitrary handlers (launchers). To be used by CCIP and Keystone.
  • Create a capabilities launcher which handles state updates for the Keystone case.
  • Some cleanup: combine syncer + reader now that the syncer is significantly smaller, move LocalNode from the syncer to the workflow handler, since it contains Keystone-specific logic.

- And workflow handler implementation for keystone-specific logic
@cedric-cordenier cedric-cordenier changed the title Registrysyncer pkg Add standalone registrysyncer package Jun 24, 2024
@cedric-cordenier cedric-cordenier marked this pull request as ready for review June 24, 2024 15:47
@cedric-cordenier cedric-cordenier requested a review from a team as a code owner June 24, 2024 15:47
bolekk
bolekk previously approved these changes Jun 24, 2024
core/capabilities/workflow_syncer_handler.go Outdated Show resolved Hide resolved
core/services/registrysyncer/syncer.go Outdated Show resolved Hide resolved
Comment on lines 211 to 212
// TODO: this is a bit nasty; figure out how best to handle this.
if len(myWorkflowDONs) > 1 {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is no longer necessary because it is ensured onchain, right?

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 think we do still need some variant of this check (an error since it shouldn't happen) because the DONs are returned as a list

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've reworded it though to make it clear that this is an invariant violation

ettec
ettec previously approved these changes Jun 25, 2024
return State{IDsToDONs: idsToDONs, IDsToCapabilities: idsToCapabilities, IDsToNodes: idsToNodes}, nil
}

func (s *registrySyncer) sync(ctx context.Context) error {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Naming nit: when I was reading this, I expected to only see state sync inside the sync method, but this method also included notifying the launchers, which was a bit confusing.

I would move the "launching" part to a separate method called "notifyLaunchers". Also, launchers aren't being "launched", but rather "notified" of the new state, as this happens on a loop. FWIW, I liked your "handlers" name better (I know you changed it 😅); another alternative would be "listeners"/"addListener".

Comment on lines +209 to +212
if len(s.launchers) == 0 {
s.lggr.Warn("sync called, but no launchers are registered; nooping")
return nil
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

I like this. I would even take this a step further and not start the sync loop if there are no launchers (I'm assuming these aren't going to be added dynamically anyway). It seems like an error to me if we have the registry with no listeners 🤷‍♂️

@cedric-cordenier cedric-cordenier added this pull request to the merge queue Jun 25, 2024
Merged via the queue into develop with commit e5dc01e Jun 25, 2024
113 checks passed
@cedric-cordenier cedric-cordenier deleted the registrysyncer-pkg branch June 25, 2024 11:19
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.

5 participants