-
Notifications
You must be signed in to change notification settings - Fork 922
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
Check Chainstart Before Processing Messages In Pubsub #7494
Conversation
@@ -277,6 +277,11 @@ func (s *Service) registerHandlers() { | |||
} | |||
} | |||
|
|||
// marks the chain as having started. | |||
func (s *Service) markForChainStart() { |
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.
func (s *Service) markForChainStart() { | |
func (s *Service) setChainStart() { |
Sounds better?
@@ -277,6 +277,11 @@ func (s *Service) registerHandlers() { | |||
} | |||
} | |||
|
|||
// marks the chain as having started. | |||
func (s *Service) markForChainStart() { | |||
s.chainStarted = true |
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.
Do we want to add a lock ?
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 method can only be called once and that too from a single routine. I don't think a lock is necessary here
This PR mostly does a defensive check during genesis to make sure that we dont receive any messages before chainstart. It's different from #7496, which does a specific subscription check for each topic. @prestonvanloon |
// Reject any messages received before chainstart. | ||
if !s.chainStarted { | ||
messageFailedValidationCounter.WithLabelValues(topic).Inc() | ||
return pubsub.ValidationReject |
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 think this is not a good choice. ValidationReject affects peer scoring, we should use ValidationIgnore.
What type of PR is this?
Feature Addition
What does this PR do? Why is it needed?
Which issues(s) does this PR fix?
N.A
Other notes for review