-
Notifications
You must be signed in to change notification settings - Fork 298
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
Optimize BlobSidecarGossipValidator #7749
Conversation
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'd prefer extracting the check to avoid maintaining two code blocks 😄
I'd also add a test for the known block headers cache (make sure we check everything again if more than x epochs passed since we've verified a blob with a specific block header)...
@@ -63,14 +65,17 @@ public static BlobSidecarGossipValidator create( | |||
final Optional<Integer> maybeMaxBlobsPerBlock = spec.getMaxBlobsPerBlock(); | |||
|
|||
final int validInfoSize = VALID_BLOCK_SET_SIZE * maybeMaxBlobsPerBlock.orElse(1); | |||
// It's not fatal if we miss something and we don't need finalized data | |||
final int validSignedBlockHeadersSize = spec.getGenesisSpec().getSlotsPerEpoch() * 3; |
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'd rather extract the 3 to a config constant
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.
yeah, and it could have a proper name, it's not a magic number, will do it
@mehdi-aouadi I want to keep order the same as in the spec in long case and the checks we need in short case are not all one by one from it, I've tried to reuse it first time, but it actually looks not so good. |
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
blobSidecar.getIndex()))) { | ||
return ignore( | ||
"BlobSidecar is not the first valid for its slot and index. It will be dropped."); | ||
synchronized (this) { |
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 synchronised when using LimitedSet.createSynchronized
?
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 is imperative that the user manually synchronize on the returned map when traversing any of its collection views via Iterator, Spliterator or Stream:"
Looks like we are safe on atomic operations, removed
LGTM to me as well |
PR Description
Fixed Issue(s)
Fixes #7654
Documentation
doc-change-required
label to this PR if updates are required.Changelog