-
Notifications
You must be signed in to change notification settings - Fork 886
Bound min size of dynamic processor queues #6466
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
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 feel like this could easily regress with the beacon processor refactors. Wanna add a test?
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.
Not sure if we should use std::cmp::max
here? Happy to stand corrected.
@@ -155,9 +160,15 @@ impl BeaconProcessorQueueLengths { | |||
aggregate_queue: 4096, | |||
unknown_block_aggregate_queue: 1024, | |||
// Capacity for a full slot's worth of attestations if subscribed to all subnets | |||
attestation_queue: active_validator_count / slots_per_epoch, | |||
attestation_queue: std::cmp::min( |
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 may be wrong here, I don't understand why it is std::cmp::min
. From my understanding, it takes the minimum value of the two in comparison. I thought it should be std::cmp::max
.
Because if it is min
, then when active_validator_count / slots_per_epoch
is, say 16, then the queue would be still 0? But if we use max
, then for small validator count, it will return MIN_QUEUE_LEN
which is 128.
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.
you're correct!
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.
ups, good catch
// Capacity for a full slot's worth of attestations if subscribed to all subnets | ||
unknown_block_attestation_queue: active_validator_count / slots_per_epoch, | ||
unknown_block_attestation_queue: std::cmp::min( |
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.
Same as above
To not conflict with the refactor, what API should the test use? i.e. let manager = spawn_manager(event_rx, work_journal_tx, BeaconProcessorQueueLengths::empty());
event_rx.send(Work::GossipAttestation {});
// assert work_journal_tx recv GossipAttestation work |
I think it doesn't matter too much if the test conflicts, as long as it exists and can be translated over. I would even just test initialising the Lengths struct in isolation so that it's minimally entangled with the rest of the beacon processor |
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 pushed a test. This is ready to go.
@mergify queue |
✅ The pull request has been merged automaticallyThe pull request has been merged automatically at 244a460 |
* Bound min size of dynamic processor queues * Use max * Add test
Issue Addressed
A discord user notes that in networks of < SLOTS_PER_EPOCH the beacon node did not process attestations.
It's due to integer division here
lighthouse/beacon_node/beacon_processor/src/lib.rs
Lines 149 to 152 in 35ac9f4
Proposed Changes
Min against a const
Closes #6463