Constants

This commit is contained in:
Eitan Seri-Levi
2026-04-30 13:49:26 +02:00
parent 12d31dbfbf
commit 7918dc2a0d
3 changed files with 13 additions and 6 deletions

View File

@@ -49,14 +49,13 @@ impl<T: BeaconChainTypes> GossipVerifiedInclusionList<T> {
.now()
.ok_or(BeaconChainError::UnableToReadSlot)?;
// TODO(focil) move 8192 to config
if signed_il
.message
.transactions
.iter()
.map(|v| v.len())
.sum::<usize>()
> 8192
> chain.spec.max_bytes_per_inclusion_list as usize
{
return Err(GossipInclusionListError::TooManyTransactions);
}
@@ -124,10 +123,9 @@ impl<T: BeaconChainTypes> GossipVerifiedInclusionList<T> {
return Err(GossipInclusionListError::PriorInclusionListKnown);
}
// Compute timeliness: timely if received before INCLUSION_LIST_DUE_BPS into the slot
// INCLUSION_LIST_DUE_BPS = 6667 basis points = 66.67% of slot duration
let slot_duration_ms = chain.spec.get_slot_duration().as_millis() as u64;
let inclusion_list_due_ms = slot_duration_ms * 6667 / 10000;
let inclusion_list_due_ms =
slot_duration_ms * chain.spec.inclusion_list_due_bps / 10000;
let il_delay_ms =
get_slot_delay_ms(timestamp_now(), message_slot, &chain.slot_clock).as_millis() as u64;
let is_timely = il_delay_ms <= inclusion_list_due_ms;