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

Make genesis block timestamp hardcoded. #2476

Merged
merged 9 commits into from
Dec 6, 2024
3 changes: 2 additions & 1 deletion crates/fuel-core/src/service/genesis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,8 @@ pub fn create_genesis_block(config: &Config) -> Block {
consensus: ConsensusHeader::<Empty> {
prev_root,
height,
time: fuel_core_types::tai64::Tai64::UNIX_EPOCH,
// The time is set to UNIX_EPOCH + 10 leap seconds to make backward compatibility
time: fuel_core_types::tai64::Tai64(4611686018427387914),
generated: Empty,
},
},
Expand Down
42 changes: 42 additions & 0 deletions version-compatibility/forkless-upgrade/src/genesis.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#![allow(non_snake_case)]
use crate::tests_helper::{
LatestFuelCoreDriver,
IGNITION_TESTNET_SNAPSHOT,
};
use latest_fuel_core_type::fuel_tx::Bytes32;
use std::str::FromStr;

#[tokio::test(flavor = "multi_thread")]
async fn test__genesis_block__hash() {
let latest_node = LatestFuelCoreDriver::spawn(&[
"--debug",
"--poa-instant",
"true",
"--snapshot",
IGNITION_TESTNET_SNAPSHOT,
"--enable-relayer",
"--relayer",
"https://eth-mainnet.public.blastapi.io",
"--relayer-da-deploy-height",
"5791365",
"--relayer-v2-listening-contracts",
"0x768f9459E3339A1F7d59CcF24C80Eb4A711a01FB",
])
.await
.unwrap();

// Given
let original_block = latest_node
.client
.block_by_height(0u32.into())
.await
.expect("Failed to get blocks")
.expect("Genesis block should exists");
assert_eq!(
AurelienFT marked this conversation as resolved.
Show resolved Hide resolved
original_block.id,
Bytes32::from_str(
"0x19ac99bf59711aca047b28443e599e26f733291c2fa45f5f309b2c5c9712b215"
)
.unwrap()
)
}
2 changes: 2 additions & 0 deletions version-compatibility/forkless-upgrade/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ mod backward_compatibility;
#[cfg(test)]
mod forward_compatibility;
#[cfg(test)]
mod genesis;
#[cfg(test)]
pub(crate) mod tests_helper;

#[cfg(test)]
Expand Down
Loading