Fix Schlesi-splitting penalty bug (#1166)
* Fix Schlesi-splitting penalty bug * Print correct spec version in lcli
This commit is contained in:
parent
309cd95b2c
commit
ddd63c0de1
@ -225,7 +225,9 @@ fn get_attestation_delta<T: EthSpec>(
|
||||
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
|
||||
|
@ -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<MainnetEthSpec>;
|
||||
@ -196,6 +202,10 @@ impl EthSpec for MinimalEthSpec {
|
||||
fn default_spec() -> ChainSpec {
|
||||
ChainSpec::minimal()
|
||||
}
|
||||
|
||||
fn spec_name() -> &'static str {
|
||||
"minimal"
|
||||
}
|
||||
}
|
||||
|
||||
pub type MinimalBeaconState = BeaconState<MinimalEthSpec>;
|
||||
@ -231,6 +241,10 @@ impl EthSpec for InteropEthSpec {
|
||||
fn default_spec() -> ChainSpec {
|
||||
ChainSpec::interop()
|
||||
}
|
||||
|
||||
fn spec_name() -> &'static str {
|
||||
"interop"
|
||||
}
|
||||
}
|
||||
|
||||
pub type InteropBeaconState = BeaconState<InteropEthSpec>;
|
||||
|
@ -18,7 +18,7 @@ pub fn run_parse_hex<T: EthSpec>(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 {
|
||||
|
@ -26,7 +26,7 @@ pub fn run<T: EthSpec>(matches: &ArgMatches) -> Result<(), String> {
|
||||
.parse::<PathBuf>()
|
||||
.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);
|
||||
|
||||
|
@ -25,7 +25,7 @@ pub fn run_transition_blocks<T: EthSpec>(matches: &ArgMatches) -> Result<(), Str
|
||||
.parse::<PathBuf>()
|
||||
.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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user