Add mainnet merge values 🐼 (#3462)
## Issue Addressed NA ## Proposed Changes Adds **tentative** values for the merge TTD and Bellatrix as per https://github.com/ethereum/consensus-specs/pull/2969 ## Additional Info - ~~Blocked on https://github.com/ethereum/consensus-specs/pull/2969~~
This commit is contained in:
parent
e5fc9f26bc
commit
d9d1288156
@ -6,8 +6,8 @@ PRESET_BASE: 'mainnet'
|
||||
|
||||
# Transition
|
||||
# ---------------------------------------------------------------
|
||||
# TBD, 2**256-2**10 is a placeholder
|
||||
TERMINAL_TOTAL_DIFFICULTY: 115792089237316195423570985008687907853269984665640564039457584007913129638912
|
||||
# Estimated on Sept 15, 2022
|
||||
TERMINAL_TOTAL_DIFFICULTY: 58750000000000000000000
|
||||
# By default, don't use these params
|
||||
TERMINAL_BLOCK_HASH: 0x0000000000000000000000000000000000000000000000000000000000000000
|
||||
TERMINAL_BLOCK_HASH_ACTIVATION_EPOCH: 18446744073709551615
|
||||
@ -35,7 +35,7 @@ ALTAIR_FORK_VERSION: 0x01000000
|
||||
ALTAIR_FORK_EPOCH: 74240
|
||||
# Merge
|
||||
BELLATRIX_FORK_VERSION: 0x02000000
|
||||
BELLATRIX_FORK_EPOCH: 18446744073709551615
|
||||
BELLATRIX_FORK_EPOCH: 144896 # Sept 6, 2022, 11:34:47am UTC
|
||||
# Sharding
|
||||
SHARDING_FORK_VERSION: 0x03000000
|
||||
SHARDING_FORK_EPOCH: 18446744073709551615
|
||||
|
@ -651,19 +651,17 @@ mod tests {
|
||||
#[test]
|
||||
fn decode_base_and_altair() {
|
||||
type E = MainnetEthSpec;
|
||||
let spec = E::default_spec();
|
||||
|
||||
let rng = &mut XorShiftRng::from_seed([42; 16]);
|
||||
|
||||
let fork_epoch = Epoch::from_ssz_bytes(&[7, 6, 5, 4, 3, 2, 1, 0]).unwrap();
|
||||
let fork_epoch = spec.altair_fork_epoch.unwrap();
|
||||
|
||||
let base_epoch = fork_epoch.saturating_sub(1_u64);
|
||||
let base_slot = base_epoch.end_slot(E::slots_per_epoch());
|
||||
let altair_epoch = fork_epoch;
|
||||
let altair_slot = altair_epoch.start_slot(E::slots_per_epoch());
|
||||
|
||||
let mut spec = E::default_spec();
|
||||
spec.altair_fork_epoch = Some(fork_epoch);
|
||||
|
||||
// BeaconBlockBase
|
||||
{
|
||||
let good_base_block = BeaconBlock::Base(BeaconBlockBase {
|
||||
|
@ -11,7 +11,7 @@ use beacon_chain::types::{
|
||||
MinimalEthSpec, RelativeEpoch, Slot,
|
||||
};
|
||||
use safe_arith::SafeArith;
|
||||
use ssz::{Decode, Encode};
|
||||
use ssz::Encode;
|
||||
use state_processing::per_slot_processing;
|
||||
use std::ops::Mul;
|
||||
use swap_or_not_shuffle::compute_shuffled_index;
|
||||
@ -438,62 +438,60 @@ mod get_outstanding_deposit_len {
|
||||
#[test]
|
||||
fn decode_base_and_altair() {
|
||||
type E = MainnetEthSpec;
|
||||
let spec = E::default_spec();
|
||||
|
||||
let rng = &mut XorShiftRng::from_seed([42; 16]);
|
||||
|
||||
let fork_epoch = Epoch::from_ssz_bytes(&[7, 6, 5, 4, 3, 2, 1, 0]).unwrap();
|
||||
let fork_epoch = spec.altair_fork_epoch.unwrap();
|
||||
|
||||
let base_epoch = fork_epoch.saturating_sub(1_u64);
|
||||
let base_slot = base_epoch.end_slot(E::slots_per_epoch());
|
||||
let altair_epoch = fork_epoch;
|
||||
let altair_slot = altair_epoch.start_slot(E::slots_per_epoch());
|
||||
|
||||
let mut spec = E::default_spec();
|
||||
spec.altair_fork_epoch = Some(altair_epoch);
|
||||
|
||||
// BeaconStateBase
|
||||
{
|
||||
let good_base_block: BeaconState<MainnetEthSpec> = BeaconState::Base(BeaconStateBase {
|
||||
let good_base_state: BeaconState<MainnetEthSpec> = BeaconState::Base(BeaconStateBase {
|
||||
slot: base_slot,
|
||||
..<_>::random_for_test(rng)
|
||||
});
|
||||
// It's invalid to have a base block with a slot higher than the fork slot.
|
||||
let bad_base_block = {
|
||||
let mut bad = good_base_block.clone();
|
||||
// It's invalid to have a base state with a slot higher than the fork slot.
|
||||
let bad_base_state = {
|
||||
let mut bad = good_base_state.clone();
|
||||
*bad.slot_mut() = altair_slot;
|
||||
bad
|
||||
};
|
||||
|
||||
assert_eq!(
|
||||
BeaconState::from_ssz_bytes(&good_base_block.as_ssz_bytes(), &spec)
|
||||
.expect("good base block can be decoded"),
|
||||
good_base_block
|
||||
BeaconState::from_ssz_bytes(&good_base_state.as_ssz_bytes(), &spec)
|
||||
.expect("good base state can be decoded"),
|
||||
good_base_state
|
||||
);
|
||||
<BeaconState<MainnetEthSpec>>::from_ssz_bytes(&bad_base_block.as_ssz_bytes(), &spec)
|
||||
.expect_err("bad base block cannot be decoded");
|
||||
<BeaconState<MainnetEthSpec>>::from_ssz_bytes(&bad_base_state.as_ssz_bytes(), &spec)
|
||||
.expect_err("bad base state cannot be decoded");
|
||||
}
|
||||
|
||||
// BeaconStateAltair
|
||||
{
|
||||
let good_altair_block: BeaconState<MainnetEthSpec> =
|
||||
let good_altair_state: BeaconState<MainnetEthSpec> =
|
||||
BeaconState::Altair(BeaconStateAltair {
|
||||
slot: altair_slot,
|
||||
..<_>::random_for_test(rng)
|
||||
});
|
||||
// It's invalid to have an Altair block with a slot lower than the fork slot.
|
||||
let bad_altair_block = {
|
||||
let mut bad = good_altair_block.clone();
|
||||
// It's invalid to have an Altair state with a slot lower than the fork slot.
|
||||
let bad_altair_state = {
|
||||
let mut bad = good_altair_state.clone();
|
||||
*bad.slot_mut() = base_slot;
|
||||
bad
|
||||
};
|
||||
|
||||
assert_eq!(
|
||||
BeaconState::from_ssz_bytes(&good_altair_block.as_ssz_bytes(), &spec)
|
||||
.expect("good altair block can be decoded"),
|
||||
good_altair_block
|
||||
BeaconState::from_ssz_bytes(&good_altair_state.as_ssz_bytes(), &spec)
|
||||
.expect("good altair state can be decoded"),
|
||||
good_altair_state
|
||||
);
|
||||
<BeaconState<MainnetEthSpec>>::from_ssz_bytes(&bad_altair_block.as_ssz_bytes(), &spec)
|
||||
.expect_err("bad altair block cannot be decoded");
|
||||
<BeaconState<MainnetEthSpec>>::from_ssz_bytes(&bad_altair_state.as_ssz_bytes(), &spec)
|
||||
.expect_err("bad altair state cannot be decoded");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -561,14 +561,9 @@ impl ChainSpec {
|
||||
.expect("pow does not overflow"),
|
||||
proportional_slashing_multiplier_bellatrix: 3,
|
||||
bellatrix_fork_version: [0x02, 0x00, 0x00, 0x00],
|
||||
bellatrix_fork_epoch: None,
|
||||
terminal_total_difficulty: Uint256::MAX
|
||||
.checked_sub(Uint256::from(2u64.pow(10)))
|
||||
.expect("subtraction does not overflow")
|
||||
// Add 1 since the spec declares `2**256 - 2**10` and we use
|
||||
// `Uint256::MAX` which is `2*256- 1`.
|
||||
.checked_add(Uint256::one())
|
||||
.expect("addition does not overflow"),
|
||||
bellatrix_fork_epoch: Some(Epoch::new(144896)),
|
||||
terminal_total_difficulty: Uint256::from_dec_str("58750000000000000000000")
|
||||
.expect("terminal_total_difficulty is a valid integer"),
|
||||
terminal_block_hash: ExecutionBlockHash::zero(),
|
||||
terminal_block_hash_activation_epoch: Epoch::new(u64::MAX),
|
||||
safe_slots_to_import_optimistically: 128u64,
|
||||
@ -621,6 +616,13 @@ impl ChainSpec {
|
||||
// Merge
|
||||
bellatrix_fork_version: [0x02, 0x00, 0x00, 0x01],
|
||||
bellatrix_fork_epoch: None,
|
||||
terminal_total_difficulty: Uint256::MAX
|
||||
.checked_sub(Uint256::from(2u64.pow(10)))
|
||||
.expect("subtraction does not overflow")
|
||||
// Add 1 since the spec declares `2**256 - 2**10` and we use
|
||||
// `Uint256::MAX` which is `2*256- 1`.
|
||||
.checked_add(Uint256::one())
|
||||
.expect("addition does not overflow"),
|
||||
// Other
|
||||
network_id: 2, // lighthouse testnet network id
|
||||
deposit_chain_id: 5,
|
||||
|
@ -1,4 +1,4 @@
|
||||
TESTS_TAG := v1.2.0-rc.1
|
||||
TESTS_TAG := v1.2.0-rc.2
|
||||
TESTS = general minimal mainnet
|
||||
TARBALLS = $(patsubst %,%-$(TESTS_TAG).tar.gz,$(TESTS))
|
||||
|
||||
|
@ -25,12 +25,20 @@ excluded_paths = [
|
||||
# Intentionally omitted, as per https://github.com/sigp/lighthouse/issues/1835
|
||||
"tests/.*/.*/ssz_static/Eth1Block/",
|
||||
"tests/.*/.*/ssz_static/PowBlock/",
|
||||
# light_client
|
||||
"tests/.*/.*/light_client",
|
||||
# LightClientStore
|
||||
"tests/.*/.*/ssz_static/LightClientStore",
|
||||
# LightClientUpdate
|
||||
"tests/.*/.*/ssz_static/LightClientUpdate",
|
||||
# LightClientSnapshot
|
||||
"tests/.*/.*/ssz_static/LightClientSnapshot",
|
||||
# LightClientBootstrap
|
||||
"tests/.*/.*/ssz_static/LightClientBootstrap",
|
||||
# LightClientOptimistic
|
||||
"tests/.*/.*/ssz_static/LightClientOptimistic",
|
||||
# LightClientFinalityUpdate
|
||||
"tests/.*/.*/ssz_static/LightClientFinalityUpdate",
|
||||
# Merkle-proof tests for light clients
|
||||
"tests/.*/.*/merkle/single_proof",
|
||||
# Capella tests are disabled for now.
|
||||
|
Loading…
Reference in New Issue
Block a user