Enforce stricter checks on certain constants (#8500)

Which issue # does this PR address?
None


  All of these are performing a check, and adding a batch, or creating a new lookup, or a new query, etc..
Hence all of these limits would be off by one.

Example:

```rust
// BACKFILL_BATCH_BUFFER_SIZE = 5
if self.batches.iter().filter(...).count() >= BACKFILL_BATCH_BUFFER_SIZE {
return None;  // ← REJECT
}
// ... later adds batch via Entry::Vacant(entry).insert(...)
```

Without the `>` being changed to a `>=` , we would allow 6. The same idea applies to all changes proposed.


Co-Authored-By: Antoine James <antoine@ethereum.org>

Co-Authored-By: Jimmy Chen <jimmy@sigmaprime.io>

Co-Authored-By: Jimmy Chen <jchen.tc@gmail.com>
This commit is contained in:
0xMushow
2026-02-23 06:02:56 +04:00
committed by GitHub
parent 9452d51867
commit 2b214175d5
6 changed files with 6 additions and 6 deletions

View File

@@ -674,7 +674,7 @@ impl<E: EthSpec> Discovery<E> {
/// updates the min_ttl field.
fn add_subnet_query(&mut self, subnet: Subnet, min_ttl: Option<Instant>, retries: usize) {
// remove the entry and complete the query if greater than the maximum search count
if retries > MAX_DISCOVERY_RETRY {
if retries >= MAX_DISCOVERY_RETRY {
debug!("Subnet peer discovery did not find sufficient peers. Reached max retry limit");
return;
}