-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Miscellaneous code quality improvements #7414
Changes from 7 commits
bb53ca4
5a9505e
0862d46
254fb55
5ac8f69
52a27ad
f8a3631
bbf6e8f
b30abc7
0ef3277
4227c33
be74d08
271c089
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -112,7 +112,8 @@ func (s *Service) ReceiveBlockInitialSync(ctx context.Context, block *ethpb.Sign | |
// actions for a block post-transition. | ||
func (s *Service) ReceiveBlockBatch(ctx context.Context, blocks []*ethpb.SignedBeaconBlock, blkRoots [][32]byte) error { | ||
ctx, span := trace.StartSpan(ctx, "blockChain.ReceiveBlockBatch") | ||
defer span.End() | ||
cleanup := span.End | ||
defer cleanup() | ||
|
||
// Apply state transition on the incoming newly received blockCopy without verifying its BLS contents. | ||
fCheckpoints, jCheckpoints, err := s.onBlockBatch(ctx, blocks, blkRoots) | ||
|
@@ -143,6 +144,8 @@ func (s *Service) ReceiveBlockBatch(ctx context.Context, blocks []*ethpb.SignedB | |
} | ||
|
||
if err := s.VerifyWeakSubjectivityRoot(s.ctx); err != nil { | ||
// log.Fatalf will prevent defer from being called | ||
cleanup() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why not just call We do this in other places as well (e.g. call span.End()) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wanted to follow the same pattern everywhere, but I agree that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Issue is this pattern is not used anywhere in the code base so this actually creates inconsistency. Here's a few options: 1.) Revert this PR to use I don't have a strong preference the option, you can choose one, but i do want some consistencies There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. discussed offline and this was resolved |
||
// Exit run time if the node failed to verify weak subjectivity checkpoint. | ||
log.Fatalf("Could not verify weak subjectivity checkpoint: %v", err) | ||
} | ||
|
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 the real problem is that we shouldn't be using log.Fatalf. This isn't a graceful shutdown and can cause other issues like corrupt data writes: #7382
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 absolutely agree. We can discuss this during the OKRs meeting since I am about to take a look at logging in general.