mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-07 16:55:46 +00:00
Fix gloas consensus-specs discrepancies and add EF tests
- Fix DOMAIN_BEACON_BUILDER value (0x1B -> 0x0B per spec) - Add DOMAIN_PROPOSER_PREFERENCES (0x0D) - Add min_builder_withdrawability_delay config (4096 epochs) - Add MaxBuildersPerWithdrawalsSweep to EthSpec trait - Add gloas_only/gloas_and_later handlers for EF tests - Add SSZ static tests for all new Gloas types
This commit is contained in:
@@ -36,6 +36,7 @@ pub enum Domain {
|
||||
SyncCommitteeSelectionProof,
|
||||
BeaconBuilder,
|
||||
PTCAttester,
|
||||
ProposerPreferences,
|
||||
ApplicationMask(ApplicationDomain),
|
||||
}
|
||||
|
||||
@@ -130,6 +131,7 @@ pub struct ChainSpec {
|
||||
pub(crate) domain_aggregate_and_proof: u32,
|
||||
pub(crate) domain_beacon_builder: u32,
|
||||
pub(crate) domain_ptc_attester: u32,
|
||||
pub(crate) domain_proposer_preferences: u32,
|
||||
|
||||
/*
|
||||
* Fork choice
|
||||
@@ -234,6 +236,7 @@ pub struct ChainSpec {
|
||||
pub gloas_fork_epoch: Option<Epoch>,
|
||||
pub builder_payment_threshold_numerator: u64,
|
||||
pub builder_payment_threshold_denominator: u64,
|
||||
pub min_builder_withdrawability_delay: Epoch,
|
||||
|
||||
/*
|
||||
* Networking
|
||||
@@ -500,6 +503,7 @@ impl ChainSpec {
|
||||
Domain::AggregateAndProof => self.domain_aggregate_and_proof,
|
||||
Domain::BeaconBuilder => self.domain_beacon_builder,
|
||||
Domain::PTCAttester => self.domain_ptc_attester,
|
||||
Domain::ProposerPreferences => self.domain_proposer_preferences,
|
||||
Domain::SyncCommittee => self.domain_sync_committee,
|
||||
Domain::ContributionAndProof => self.domain_contribution_and_proof,
|
||||
Domain::SyncCommitteeSelectionProof => self.domain_sync_committee_selection_proof,
|
||||
@@ -977,8 +981,9 @@ impl ChainSpec {
|
||||
domain_voluntary_exit: 4,
|
||||
domain_selection_proof: 5,
|
||||
domain_aggregate_and_proof: 6,
|
||||
domain_beacon_builder: 0x1B,
|
||||
domain_beacon_builder: 0x0B,
|
||||
domain_ptc_attester: 0x0C,
|
||||
domain_proposer_preferences: 0x0D,
|
||||
|
||||
/*
|
||||
* Fork choice
|
||||
@@ -1102,6 +1107,7 @@ impl ChainSpec {
|
||||
gloas_fork_epoch: None,
|
||||
builder_payment_threshold_numerator: 6,
|
||||
builder_payment_threshold_denominator: 10,
|
||||
min_builder_withdrawability_delay: Epoch::new(4096),
|
||||
|
||||
/*
|
||||
* Network specific
|
||||
@@ -1350,8 +1356,9 @@ impl ChainSpec {
|
||||
domain_voluntary_exit: 4,
|
||||
domain_selection_proof: 5,
|
||||
domain_aggregate_and_proof: 6,
|
||||
domain_beacon_builder: 0x1B,
|
||||
domain_beacon_builder: 0x0B,
|
||||
domain_ptc_attester: 0x0C,
|
||||
domain_proposer_preferences: 0x0D,
|
||||
|
||||
/*
|
||||
* Fork choice
|
||||
@@ -1474,6 +1481,7 @@ impl ChainSpec {
|
||||
gloas_fork_epoch: None,
|
||||
builder_payment_threshold_numerator: 6,
|
||||
builder_payment_threshold_denominator: 10,
|
||||
min_builder_withdrawability_delay: Epoch::new(4096),
|
||||
|
||||
/*
|
||||
* Network specific
|
||||
|
||||
@@ -7,7 +7,7 @@ use safe_arith::{ArithError, SafeArith};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use typenum::{
|
||||
U0, U1, U2, U4, U8, U16, U17, U32, U64, U128, U256, U512, U625, U1024, U2048, U4096, U8192,
|
||||
U65536, U131072, U262144, U1048576, U16777216, U33554432, U134217728, U1073741824,
|
||||
U16384, U65536, U131072, U262144, U1048576, U16777216, U33554432, U134217728, U1073741824,
|
||||
U1099511627776, UInt, Unsigned, bit::B0,
|
||||
};
|
||||
|
||||
@@ -179,6 +179,7 @@ pub trait EthSpec: 'static + Default + Sync + Send + Clone + Debug + PartialEq +
|
||||
type MaxPayloadAttestations: Unsigned + Clone + Sync + Send + Debug + PartialEq;
|
||||
type BuilderPendingPaymentsLimit: Unsigned + Clone + Sync + Send + Debug + PartialEq;
|
||||
type BuilderPendingWithdrawalsLimit: Unsigned + Clone + Sync + Send + Debug + PartialEq;
|
||||
type MaxBuildersPerWithdrawalsSweep: Unsigned + Clone + Sync + Send + Debug + PartialEq;
|
||||
|
||||
fn default_spec() -> ChainSpec;
|
||||
|
||||
@@ -431,6 +432,11 @@ pub trait EthSpec: 'static + Default + Sync + Send + Clone + Debug + PartialEq +
|
||||
fn max_payload_attestations() -> usize {
|
||||
Self::MaxPayloadAttestations::to_usize()
|
||||
}
|
||||
|
||||
/// Returns the `MaxBuildersPerWithdrawalsSweep` constant for this specification.
|
||||
fn max_builders_per_withdrawals_sweep() -> usize {
|
||||
Self::MaxBuildersPerWithdrawalsSweep::to_usize()
|
||||
}
|
||||
}
|
||||
|
||||
/// Macro to inherit some type values from another EthSpec.
|
||||
@@ -505,6 +511,7 @@ impl EthSpec for MainnetEthSpec {
|
||||
type MaxPendingDepositsPerEpoch = U16;
|
||||
type PTCSize = U512;
|
||||
type MaxPayloadAttestations = U4;
|
||||
type MaxBuildersPerWithdrawalsSweep = U16384;
|
||||
|
||||
fn default_spec() -> ChainSpec {
|
||||
ChainSpec::mainnet()
|
||||
@@ -549,6 +556,7 @@ impl EthSpec for MinimalEthSpec {
|
||||
type ProposerLookaheadSlots = U16; // Derived from (MIN_SEED_LOOKAHEAD + 1) * SLOTS_PER_EPOCH
|
||||
type BuilderPendingPaymentsLimit = U16; // 2 * SLOTS_PER_EPOCH = 2 * 8 = 16
|
||||
type PTCSize = U2;
|
||||
type MaxBuildersPerWithdrawalsSweep = U16;
|
||||
|
||||
params_from_eth_spec!(MainnetEthSpec {
|
||||
JustificationBitsLength,
|
||||
@@ -656,6 +664,7 @@ impl EthSpec for GnosisEthSpec {
|
||||
type BuilderRegistryLimit = U1099511627776;
|
||||
type PTCSize = U512;
|
||||
type MaxPayloadAttestations = U2;
|
||||
type MaxBuildersPerWithdrawalsSweep = U16384;
|
||||
|
||||
fn default_spec() -> ChainSpec {
|
||||
ChainSpec::gnosis()
|
||||
|
||||
Reference in New Issue
Block a user