Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: update genesis for holesky #4773

Merged
merged 2 commits into from
Sep 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 18 additions & 8 deletions bin/reth/src/dirs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,9 @@ use std::{

/// Constructs a string to be used as a path for configuration and db paths.
pub fn config_path_prefix(chain: Chain) -> String {
if chain == Chain::mainnet() {
"mainnet".to_string()
} else if chain == Chain::goerli() {
"goerli".to_string()
} else if chain == Chain::sepolia() {
"sepolia".to_string()
} else {
chain.id().to_string()
match chain {
Chain::Named(name) => name.to_string(),
Chain::Id(id) => id.to_string(),
}
}

Expand Down Expand Up @@ -325,4 +320,19 @@ mod tests {
let path = path.unwrap_or_chain_default(Chain::mainnet());
assert!(path.as_ref().ends_with("my/path/to/datadir"), "{:?}", path);
}

#[test]
fn test_maybe_testnet_datadir_path() {
let path = MaybePlatformPath::<DataDirPath>::default();
let path = path.unwrap_or_chain_default(Chain::goerli());
assert!(path.as_ref().ends_with("reth/goerli"), "{:?}", path);

let path = MaybePlatformPath::<DataDirPath>::default();
let path = path.unwrap_or_chain_default(Chain::holesky());
assert!(path.as_ref().ends_with("reth/holesky"), "{:?}", path);

let path = MaybePlatformPath::<DataDirPath>::default();
let path = path.unwrap_or_chain_default(Chain::sepolia());
assert!(path.as_ref().ends_with("reth/sepolia"), "{:?}", path);
}
}
4 changes: 2 additions & 2 deletions crates/primitives/res/genesis/holesky.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"nonce": "0x1234",
"timestamp": "1694786100",
"timestamp": "1695902100",
"extraData": "",
"gasLimit": "0x17D7840",
"difficulty": "0x01",
"mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"coinbase": "0x0000000000000000000000000000000000000000",
"stateRoot": "0x69d8c9d72f6fa4ad42d4702b433707212f90db395eb54dc20bc85de253788783",
"alloc": {
Expand Down
10 changes: 5 additions & 5 deletions crates/primitives/src/chain/spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,10 +164,10 @@ pub static HOLESKY: Lazy<Arc<ChainSpec>> = Lazy::new(|| {
genesis: serde_json::from_str(include_str!("../../res/genesis/holesky.json"))
.expect("Can't deserialize Holesky genesis json"),
genesis_hash: Some(H256(hex!(
"fd91bb7c01ae3f608b4d176078ca72bc7846791fdc02324481ca315ede4c9246"
"b5f7f912443c940f21fd611f12828d75b534364ed9e95ca4e307729a4661bde4"
))),
paris_block_and_final_difficulty: Some((0, U256::from(1))),
fork_timestamps: ForkTimestamps::default().shanghai(1694790240),
fork_timestamps: ForkTimestamps::default().shanghai(1696000704),
hardforks: BTreeMap::from([
(Hardfork::Frontier, ForkCondition::Block(0)),
(Hardfork::Homestead, ForkCondition::Block(0)),
Expand All @@ -183,9 +183,9 @@ pub static HOLESKY: Lazy<Arc<ChainSpec>> = Lazy::new(|| {
(Hardfork::London, ForkCondition::Block(0)),
(
Hardfork::Paris,
ForkCondition::TTD { fork_block: None, total_difficulty: U256::ZERO },
ForkCondition::TTD { fork_block: Some(0), total_difficulty: U256::ZERO },
),
(Hardfork::Shanghai, ForkCondition::Timestamp(1694790240)),
(Hardfork::Shanghai, ForkCondition::Timestamp(1696000704)),
]),
deposit_contract: Some(DepositContract::new(
H160(hex!("4242424242424242424242424242424242424242")),
Expand Down Expand Up @@ -839,7 +839,7 @@ pub enum ForkCondition {
/// The block number at which TTD is reached, if it is known.
///
/// This should **NOT** be set unless you want this block advertised as [EIP-2124][eip2124]
/// `FORK_NEXT`. This is currently only the case for Sepolia.
/// `FORK_NEXT`. This is currently only the case for Sepolia and Holesky.
///
/// [eip2124]: https://eips.ethereum.org/EIPS/eip-2124
fork_block: Option<BlockNumber>,
Expand Down