Skip to content

Commit

Permalink
Revert changes to ForkContext
Browse files Browse the repository at this point in the history
  • Loading branch information
pawanjay176 committed Aug 24, 2021
1 parent 076c5ce commit 00bdafe
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 14 deletions.
2 changes: 1 addition & 1 deletion beacon_node/network/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,7 @@ fn spawn_service<T: BeaconChainTypes>(
service.log,
"Peer sent gossip on incorrect fork version topic";
"peer" => %source,
"fork_topic" => %topic,
"gossip_topic" => %topic,
);
service.libp2p.report_peer(&source, PeerAction::LowToleranceError, ReportSource::Gossipsub);
service
Expand Down
20 changes: 7 additions & 13 deletions consensus/types/src/fork_context.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use parking_lot::RwLock;

use crate::{ChainSpec, Epoch, EthSpec, ForkName, Hash256, Slot};
use crate::{ChainSpec, EthSpec, ForkName, Hash256, Slot};
use std::collections::HashMap;

/// Provides fork specific info like the current fork name and the fork digests corresponding to every valid fork.
Expand All @@ -26,18 +26,12 @@ impl ForkContext {
ChainSpec::compute_fork_digest(spec.genesis_fork_version, genesis_validators_root),
)];

// Only add Altair to list of forks if it's enabled
// Note: `altair_fork_epoch = None | Some(Epoch::max_value())` implies altair hasn't been activated yet on the config.
if let Some(altair_epoch) = spec.altair_fork_epoch {
if altair_epoch != Epoch::max_value() {
fork_to_digest.push((
ForkName::Altair,
ChainSpec::compute_fork_digest(
spec.altair_fork_version,
genesis_validators_root,
),
));
}
// Only add Altair to list of forks if it's enabled (i.e. spec.altair_fork_epoch != None)
if spec.altair_fork_epoch.is_some() {
fork_to_digest.push((
ForkName::Altair,
ChainSpec::compute_fork_digest(spec.altair_fork_version, genesis_validators_root),
))
}

let fork_to_digest: HashMap<ForkName, [u8; 4]> = fork_to_digest.into_iter().collect();
Expand Down

0 comments on commit 00bdafe

Please sign in to comment.