mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-21 13:54:44 +00:00
Replace INTERVALS_PER_SLOT with explicit slot component times (#7944)
https://github.com/ethereum/consensus-specs/pull/4476 Co-Authored-By: Barnabas Busa <barnabas.busa@ethereum.org> Co-Authored-By: Eitan Seri- Levi <eserilev@gmail.com> Co-Authored-By: Eitan Seri-Levi <eserilev@ucsc.edu> Co-Authored-By: Michael Sproul <michaelsproul@users.noreply.github.com> Co-Authored-By: Michael Sproul <michael@sigmaprime.io>
This commit is contained in:
@@ -54,7 +54,7 @@ pub struct PeerScoreSettings<E: EthSpec> {
|
||||
|
||||
impl<E: EthSpec> PeerScoreSettings<E> {
|
||||
pub fn new(chain_spec: &ChainSpec, mesh_n: usize) -> PeerScoreSettings<E> {
|
||||
let slot = Duration::from_secs(chain_spec.seconds_per_slot);
|
||||
let slot = chain_spec.get_slot_duration();
|
||||
let beacon_attestation_subnet_weight = 1.0 / chain_spec.attestation_subnet_count as f64;
|
||||
let max_positive_score = (MAX_IN_MESH_SCORE + MAX_FIRST_MESSAGE_DELIVERIES_SCORE)
|
||||
* (BEACON_BLOCK_WEIGHT
|
||||
|
||||
@@ -232,7 +232,7 @@ impl<E: EthSpec> Network<E> {
|
||||
config.network_load,
|
||||
ctx.fork_context.clone(),
|
||||
gossipsub_config_params,
|
||||
ctx.chain_spec.seconds_per_slot,
|
||||
ctx.chain_spec.get_slot_duration(),
|
||||
E::slots_per_epoch(),
|
||||
config.idontwant_message_size_threshold,
|
||||
);
|
||||
@@ -240,13 +240,12 @@ impl<E: EthSpec> Network<E> {
|
||||
let score_settings = PeerScoreSettings::new(&ctx.chain_spec, gs_config.mesh_n());
|
||||
|
||||
let gossip_cache = {
|
||||
let slot_duration = std::time::Duration::from_secs(ctx.chain_spec.seconds_per_slot);
|
||||
let half_epoch = std::time::Duration::from_secs(
|
||||
ctx.chain_spec.seconds_per_slot * E::slots_per_epoch() / 2,
|
||||
let half_epoch = std::time::Duration::from_millis(
|
||||
(ctx.chain_spec.get_slot_duration().as_millis() as u64) * E::slots_per_epoch() / 2,
|
||||
);
|
||||
|
||||
GossipCache::builder()
|
||||
.beacon_block_timeout(slot_duration)
|
||||
.beacon_block_timeout(ctx.chain_spec.get_slot_duration())
|
||||
.aggregates_timeout(half_epoch)
|
||||
.attestation_timeout(half_epoch)
|
||||
.voluntary_exit_timeout(half_epoch * 2)
|
||||
|
||||
Reference in New Issue
Block a user