mirror of
https://github.com/sigp/lighthouse.git
synced 2026-04-18 13:28:33 +00:00
Consensus updates for v0.12 (#1228)
* Update state processing for v0.12 * Fix EF test runners for v0.12 * Fix some tests * Fix broken attestation verification test * More test fixes * Fix typo found in review
This commit is contained in:
@@ -82,7 +82,7 @@ pub struct ChainSpec {
|
||||
pub max_seed_lookahead: Epoch,
|
||||
pub min_epochs_to_inactivity_penalty: u64,
|
||||
pub min_validator_withdrawability_delay: Epoch,
|
||||
pub persistent_committee_period: u64,
|
||||
pub shard_committee_period: u64,
|
||||
|
||||
/*
|
||||
* Reward and penalty quotients
|
||||
@@ -292,7 +292,7 @@ impl ChainSpec {
|
||||
max_seed_lookahead: Epoch::new(4),
|
||||
min_epochs_to_inactivity_penalty: 4,
|
||||
min_validator_withdrawability_delay: Epoch::new(256),
|
||||
persistent_committee_period: 2_048,
|
||||
shard_committee_period: 256,
|
||||
|
||||
/*
|
||||
* Reward and penalty quotients
|
||||
@@ -300,7 +300,7 @@ impl ChainSpec {
|
||||
base_reward_factor: 64,
|
||||
whistleblower_reward_quotient: 512,
|
||||
proposer_reward_quotient: 8,
|
||||
inactivity_penalty_quotient: 33_554_432,
|
||||
inactivity_penalty_quotient: u64::pow(2, 24),
|
||||
min_slashing_penalty_quotient: 32,
|
||||
|
||||
/*
|
||||
@@ -353,7 +353,7 @@ impl ChainSpec {
|
||||
min_genesis_active_validator_count: 64,
|
||||
eth1_follow_distance: 16,
|
||||
genesis_fork_version: [0x00, 0x00, 0x00, 0x01],
|
||||
persistent_committee_period: 128,
|
||||
shard_committee_period: 64,
|
||||
min_genesis_delay: 300,
|
||||
milliseconds_per_slot: 6_000,
|
||||
safe_slots_to_update_justified: 2,
|
||||
@@ -481,7 +481,7 @@ pub struct YamlConfig {
|
||||
max_seed_lookahead: u64,
|
||||
min_epochs_to_inactivity_penalty: u64,
|
||||
min_validator_withdrawability_delay: u64,
|
||||
persistent_committee_period: u64,
|
||||
shard_committee_period: u64,
|
||||
base_reward_factor: u64,
|
||||
whistleblower_reward_quotient: u64,
|
||||
proposer_reward_quotient: u64,
|
||||
@@ -591,7 +591,7 @@ impl YamlConfig {
|
||||
min_seed_lookahead: spec.min_seed_lookahead.into(),
|
||||
max_seed_lookahead: spec.max_seed_lookahead.into(),
|
||||
min_validator_withdrawability_delay: spec.min_validator_withdrawability_delay.into(),
|
||||
persistent_committee_period: spec.persistent_committee_period,
|
||||
shard_committee_period: spec.shard_committee_period,
|
||||
min_epochs_to_inactivity_penalty: spec.min_epochs_to_inactivity_penalty,
|
||||
base_reward_factor: spec.base_reward_factor,
|
||||
whistleblower_reward_quotient: spec.whistleblower_reward_quotient,
|
||||
@@ -690,7 +690,7 @@ impl YamlConfig {
|
||||
min_validator_withdrawability_delay: Epoch::from(
|
||||
self.min_validator_withdrawability_delay,
|
||||
),
|
||||
persistent_committee_period: self.persistent_committee_period,
|
||||
shard_committee_period: self.shard_committee_period,
|
||||
min_epochs_to_inactivity_penalty: self.min_epochs_to_inactivity_penalty,
|
||||
base_reward_factor: self.base_reward_factor,
|
||||
whistleblower_reward_quotient: self.whistleblower_reward_quotient,
|
||||
|
||||
@@ -3,7 +3,7 @@ use crate::*;
|
||||
use safe_arith::SafeArith;
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
use ssz_types::typenum::{
|
||||
Unsigned, U0, U1, U1024, U1099511627776, U128, U16, U16777216, U2, U2048, U32, U4, U4096, U64,
|
||||
Unsigned, U0, U1024, U1099511627776, U128, U16, U16777216, U2, U2048, U32, U4, U4096, U64,
|
||||
U65536, U8, U8192,
|
||||
};
|
||||
use std::fmt::Debug;
|
||||
@@ -151,7 +151,7 @@ impl EthSpec for MainnetEthSpec {
|
||||
type HistoricalRootsLimit = U16777216;
|
||||
type ValidatorRegistryLimit = U1099511627776;
|
||||
type MaxProposerSlashings = U16;
|
||||
type MaxAttesterSlashings = U1;
|
||||
type MaxAttesterSlashings = U2;
|
||||
type MaxAttestations = U128;
|
||||
type MaxDeposits = U16;
|
||||
type MaxVoluntaryExits = U16;
|
||||
@@ -178,12 +178,12 @@ pub struct MinimalEthSpec;
|
||||
|
||||
impl EthSpec for MinimalEthSpec {
|
||||
type SlotsPerEpoch = U8;
|
||||
type EpochsPerEth1VotingPeriod = U2;
|
||||
type EpochsPerEth1VotingPeriod = U4;
|
||||
type SlotsPerHistoricalRoot = U64;
|
||||
type EpochsPerHistoricalVector = U64;
|
||||
type EpochsPerSlashingsVector = U64;
|
||||
type MaxPendingAttestations = U1024; // 128 max attestations * 8 slots per epoch
|
||||
type SlotsPerEth1VotingPeriod = U16; // 2 epochs * 8 slots per epoch
|
||||
type SlotsPerEth1VotingPeriod = U32; // 4 epochs * 8 slots per epoch
|
||||
|
||||
params_from_eth_spec!(MainnetEthSpec {
|
||||
JustificationBitsLength,
|
||||
|
||||
@@ -39,7 +39,7 @@ pub mod signed_aggregate_and_proof;
|
||||
pub mod signed_beacon_block;
|
||||
pub mod signed_beacon_block_header;
|
||||
pub mod signed_voluntary_exit;
|
||||
pub mod signing_root;
|
||||
pub mod signing_data;
|
||||
pub mod utils;
|
||||
pub mod validator;
|
||||
pub mod voluntary_exit;
|
||||
@@ -84,7 +84,7 @@ pub use crate::signed_aggregate_and_proof::SignedAggregateAndProof;
|
||||
pub use crate::signed_beacon_block::{SignedBeaconBlock, SignedBeaconBlockHash};
|
||||
pub use crate::signed_beacon_block_header::SignedBeaconBlockHeader;
|
||||
pub use crate::signed_voluntary_exit::SignedVoluntaryExit;
|
||||
pub use crate::signing_root::{SignedRoot, SigningRoot};
|
||||
pub use crate::signing_data::{SignedRoot, SigningData};
|
||||
pub use crate::slot_epoch::{Epoch, Slot};
|
||||
pub use crate::subnet_id::SubnetId;
|
||||
pub use crate::validator::Validator;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use crate::{
|
||||
test_utils::TestRandom, BeaconBlock, ChainSpec, Domain, EthSpec, Fork, Hash256, PublicKey,
|
||||
SignedRoot, SigningRoot, Slot,
|
||||
SignedRoot, SigningData, Slot,
|
||||
};
|
||||
use bls::Signature;
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
@@ -69,7 +69,7 @@ impl<E: EthSpec> SignedBeaconBlock<E> {
|
||||
);
|
||||
|
||||
let message = if let Some(object_root) = object_root_opt {
|
||||
SigningRoot {
|
||||
SigningData {
|
||||
object_root,
|
||||
domain,
|
||||
}
|
||||
|
||||
@@ -9,14 +9,14 @@ use tree_hash_derive::TreeHash;
|
||||
|
||||
#[cfg_attr(feature = "arbitrary-fuzz", derive(arbitrary::Arbitrary))]
|
||||
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize, Encode, Decode, TreeHash, TestRandom)]
|
||||
pub struct SigningRoot {
|
||||
pub struct SigningData {
|
||||
pub object_root: Hash256,
|
||||
pub domain: Hash256,
|
||||
}
|
||||
|
||||
pub trait SignedRoot: TreeHash {
|
||||
fn signing_root(&self, domain: Hash256) -> Hash256 {
|
||||
SigningRoot {
|
||||
SigningData {
|
||||
object_root: self.tree_hash_root(),
|
||||
domain,
|
||||
}
|
||||
Reference in New Issue
Block a user