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

Lazy-start LogPoller from ContractReader, stop if started on shutdown #1051

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from

Conversation

reductionista
Copy link
Contributor

@reductionista reductionista commented Feb 7, 2025

Description

  • Start LogPoller from ChainReader, if there are events defined in ChainReaderConfig, and it's not already started yet
  • Adds a lot more testing coverage to ChainReader's Start() method

JIRA: NONEVM-1286

@reductionista reductionista force-pushed the chore/NONEVM-1286-start-logpoller branch from 51ee0cb to ff0e81f Compare February 7, 2025 22:30
@reductionista reductionista marked this pull request as ready for review February 7, 2025 22:31
@reductionista reductionista requested a review from a team as a code owner February 7, 2025 22:31
@@ -547,6 +548,9 @@ func (c *chain) Close() error {
c.lggr.Debug("Stopping multinode")
closeAll = append(closeAll, c.multiNode, c.txSender)
}
if c.lp.Ready() == nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

What happens in ready throws an error

@cl-sonarqube-production
Copy link

Quality Gate failed Quality Gate failed

Failed conditions
0.0% Coverage on New Code (required ≥ 75%)

See analysis details on SonarQube

// No dependency on EventReader
return nil
}
if s.reader.Ready() != nil {
Copy link
Collaborator

@dhaidashenko dhaidashenko Feb 8, 2025

Choose a reason for hiding this comment

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

This seems to be racy. Ready returns an error if the reader is starting.
In case of LogPoller, it's easy to decide if it needs to do work or not. Can't we always start and check if there are any filters inside the run loop?

@@ -457,7 +470,7 @@ func toLPFilter(
Address: logpoller.PublicKey(address),
EventName: f.EventName,
EventSig: logpoller.EventSignature([]byte(f.EventName)[:logpoller.EventSignatureLength]),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
EventSig: logpoller.EventSignature([]byte(f.EventName)[:logpoller.EventSignatureLength]),
EventSig: logpoller.EventSignature([]byte(f.EventName)[:logpoller.EventSignatureLength]),
EventSig: logpoller.NewEventSignatureFromName(f.EventName),

Copy link
Collaborator

Choose a reason for hiding this comment

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

Also eventIDL is not set. Seems like we need our own e2e tests as soon as possible.

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