diff --git a/consensus/state_processing/src/per_epoch_processing/apply_rewards.rs b/consensus/state_processing/src/per_epoch_processing/apply_rewards.rs index 4fad653776..dc9a4f32b3 100644 --- a/consensus/state_processing/src/per_epoch_processing/apply_rewards.rs +++ b/consensus/state_processing/src/per_epoch_processing/apply_rewards.rs @@ -225,7 +225,9 @@ fn get_attestation_delta( delta.penalize(spec.base_rewards_per_epoch.safe_mul(base_reward)?)?; // Additionally, all validators whose FFG target didn't match are penalized extra - if !validator.is_previous_epoch_target_attester { + // This condition is equivalent to this condition from the spec: + // `index not in get_unslashed_attesting_indices(state, matching_target_attestations)` + if validator.is_slashed || !validator.is_previous_epoch_target_attester { delta.penalize( validator .current_epoch_effective_balance diff --git a/consensus/types/src/eth_spec.rs b/consensus/types/src/eth_spec.rs index c3c60bae06..6f03a7b32c 100644 --- a/consensus/types/src/eth_spec.rs +++ b/consensus/types/src/eth_spec.rs @@ -56,6 +56,8 @@ pub trait EthSpec: 'static + Default + Sync + Send + Clone + Debug + PartialEq { fn default_spec() -> ChainSpec; + fn spec_name() -> &'static str; + fn genesis_epoch() -> Epoch { Epoch::new(Self::GenesisEpoch::to_u64()) } @@ -159,6 +161,10 @@ impl EthSpec for MainnetEthSpec { fn default_spec() -> ChainSpec { ChainSpec::mainnet() } + + fn spec_name() -> &'static str { + "mainnet" + } } pub type FoundationBeaconState = BeaconState; @@ -196,6 +202,10 @@ impl EthSpec for MinimalEthSpec { fn default_spec() -> ChainSpec { ChainSpec::minimal() } + + fn spec_name() -> &'static str { + "minimal" + } } pub type MinimalBeaconState = BeaconState; @@ -231,6 +241,10 @@ impl EthSpec for InteropEthSpec { fn default_spec() -> ChainSpec { ChainSpec::interop() } + + fn spec_name() -> &'static str { + "interop" + } } pub type InteropBeaconState = BeaconState; diff --git a/lcli/src/parse_hex.rs b/lcli/src/parse_hex.rs index 8f1e3b7080..6c120c033d 100644 --- a/lcli/src/parse_hex.rs +++ b/lcli/src/parse_hex.rs @@ -18,7 +18,7 @@ pub fn run_parse_hex(matches: &ArgMatches) -> Result<(), String> { let hex = hex::decode(&hex).map_err(|e| format!("Failed to parse hex: {:?}", e))?; - info!("Using minimal spec"); + info!("Using {} spec", T::spec_name()); info!("Type: {:?}", type_str); match type_str { diff --git a/lcli/src/skip_slots.rs b/lcli/src/skip_slots.rs index 92cd482624..d048cdea39 100644 --- a/lcli/src/skip_slots.rs +++ b/lcli/src/skip_slots.rs @@ -26,7 +26,7 @@ pub fn run(matches: &ArgMatches) -> Result<(), String> { .parse::() .map_err(|e| format!("Failed to parse output path: {}", e))?; - info!("Using minimal spec"); + info!("Using {} spec", T::spec_name()); info!("Pre-state path: {:?}", pre_state_path); info!("Slots: {:?}", slots); diff --git a/lcli/src/transition_blocks.rs b/lcli/src/transition_blocks.rs index 28e4b06572..073cf83d43 100644 --- a/lcli/src/transition_blocks.rs +++ b/lcli/src/transition_blocks.rs @@ -25,7 +25,7 @@ pub fn run_transition_blocks(matches: &ArgMatches) -> Result<(), Str .parse::() .map_err(|e| format!("Failed to parse output path: {}", e))?; - info!("Using minimal spec"); + info!("Using {} spec", T::spec_name()); info!("Pre-state path: {:?}", pre_state_path); info!("Block path: {:?}", block_path);