diff --git a/CHANGELOG.md b/CHANGELOG.md index d012d84ef53..071fd4d68a4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -36,6 +36,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - [2369](https://github.com/FuelLabs/fuel-core/pull/2369): The `transaction_insertion_time_in_thread_pool_milliseconds` metric is properly collected. - [2413](https://github.com/FuelLabs/fuel-core/issues/2413): block production immediately errors if unable to lock the mutex. - [2389](https://github.com/FuelLabs/fuel-core/pull/2389): Fix construction of reverse iterator in RocksDB. +- [2485](https://github.com/FuelLabs/fuel-core/pull/2485): Hardcode the timestamp of the genesis block and version of `tai64` to avoid breaking changes for us. ### Changed - [2295](https://github.com/FuelLabs/fuel-core/pull/2295): `CombinedDb::from_config` now respects `state_rewind_policy` with tmp RocksDB. diff --git a/Cargo.lock b/Cargo.lock index 56a3736a59f..0bc9f38389d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -9113,9 +9113,9 @@ dependencies = [ [[package]] name = "tai64" -version = "4.1.0" +version = "4.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "014639506e4f425c78e823eabf56e71c093f940ae55b43e58f682e7bc2f5887a" +checksum = "ed7401421025f4132e6c1f7af5e7f8287383969f36e6628016cd509b8d3da9dc" dependencies = [ "serde", ] diff --git a/crates/client/Cargo.toml b/crates/client/Cargo.toml index 99e3a1e74d0..320eb707a82 100644 --- a/crates/client/Cargo.toml +++ b/crates/client/Cargo.toml @@ -27,7 +27,8 @@ itertools = { workspace = true } reqwest = { workspace = true } serde = { workspace = true, features = ["derive"] } serde_json = { version = "1.0", features = ["raw_value"] } -tai64 = { version = "4.1", features = ["serde"] } +# We force the version because 4.1.0 update leap seconds that breaks our timestamps +tai64 = { version = "=4.0.0", features = ["serde"] } thiserror = "1.0" tracing = "0.1" diff --git a/crates/fuel-core/src/service/genesis.rs b/crates/fuel-core/src/service/genesis.rs index 55d36e2821b..fc216684f15 100644 --- a/crates/fuel-core/src/service/genesis.rs +++ b/crates/fuel-core/src/service/genesis.rs @@ -285,7 +285,8 @@ pub fn create_genesis_block(config: &Config) -> Block { consensus: ConsensusHeader:: { 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, }, }, diff --git a/crates/types/Cargo.toml b/crates/types/Cargo.toml index deb1b2f8ab6..897869db7c1 100644 --- a/crates/types/Cargo.toml +++ b/crates/types/Cargo.toml @@ -27,7 +27,8 @@ fuel-vm-private = { workspace = true, default-features = false, features = [ rand = { workspace = true, optional = true } secrecy = "0.8" serde = { workspace = true, features = ["derive"], optional = true } -tai64 = { version = "4.1", features = ["serde"] } +# We force the version because 4.1.0 update leap seconds that breaks our timestamps +tai64 = { version = "=4.0.0", features = ["serde"] } zeroize = "1.5" [features] diff --git a/version-compatibility/forkless-upgrade/src/genesis.rs b/version-compatibility/forkless-upgrade/src/genesis.rs new file mode 100644 index 00000000000..702eaf0e075 --- /dev/null +++ b/version-compatibility/forkless-upgrade/src/genesis.rs @@ -0,0 +1,47 @@ +#![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() { + // Given + let latest_node = LatestFuelCoreDriver::spawn(&[ + "--debug", + "--poa-instant", + "true", + "--snapshot", + IGNITION_TESTNET_SNAPSHOT, + "--enable-relayer", + "--relayer", + "https://google.com", + "--relayer-da-deploy-height", + "5791365", + "--relayer-v2-listening-contracts", + "0x768f9459E3339A1F7d59CcF24C80Eb4A711a01FB", + ]) + .await + .unwrap(); + + // When + let original_block = latest_node + .client + .block_by_height(0u32.into()) + .await + .expect("Failed to get blocks") + .expect("Genesis block should exists"); + // Then + // The hash of the genesis block should always be + // `0x19ac99bf59711aca047b28443e599e26f733291c2fa45f5f309b2c5c9712b215` + // regardless of the changes that we made. + assert_eq!( + original_block.id, + Bytes32::from_str( + "0x19ac99bf59711aca047b28443e599e26f733291c2fa45f5f309b2c5c9712b215" + ) + .unwrap() + ) +} \ No newline at end of file diff --git a/version-compatibility/forkless-upgrade/src/lib.rs b/version-compatibility/forkless-upgrade/src/lib.rs index b40ca55c722..ae7415e13d0 100644 --- a/version-compatibility/forkless-upgrade/src/lib.rs +++ b/version-compatibility/forkless-upgrade/src/lib.rs @@ -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)]