Skip to content

Commit

Permalink
Moved chain specification into fuel-core-bin crate (#1792)
Browse files Browse the repository at this point in the history
The `0.24.0` release
[failed](https://github.com/FuelLabs/fuel-core/actions/runs/8489604374/job/232600247460)
because chain specification is not part of the `fuel-core-bin` crate.

After the latest changes, the `fuel-core` binary uses testnet
configuration as a default configuration in the case when the snapshot
path is not specified by the user. Because the configuration lives
outside of any crate, it is not possible to load it with
`include_bytes!`. This change moves chain specification folders into a
`fuel-core-bin` crate.

It will affect deployments because now the path is
`bin/fuel-core/chainspec/testnet` instead of
`deployment/scripts/chainspec/testnet`.

cc @rfuelsh @liviudm @tirkesi
  • Loading branch information
xgreenx authored Mar 30, 2024
1 parent ec1b159 commit 24ec6ab
Show file tree
Hide file tree
Showing 10 changed files with 6 additions and 7 deletions.
5 changes: 2 additions & 3 deletions bin/e2e-test-client/tests/integration_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,8 @@ async fn execute_suite(config_path: String) {
fn dev_config() -> Config {
let mut config = Config::local_node();

let snapshot =
SnapshotMetadata::read("../../deployment/scripts/chainspec/dev-testnet")
.expect("Should be able to open snapshot metadata");
let snapshot = SnapshotMetadata::read("../../bin/fuel-core/chainspec/dev-testnet")
.expect("Should be able to open snapshot metadata");
let reader =
SnapshotReader::open(snapshot).expect("Should be able to open snapshot reader");

Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions bin/fuel-core/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ pub async fn run_cli() -> anyhow::Result<()> {
/// Returns the chain configuration for the local testnet.
pub fn local_testnet_chain_config() -> ChainConfig {
const TESTNET_CHAIN_CONFIG: &[u8] =
include_bytes!("../../../deployment/scripts/chainspec/testnet/chain_config.json");
include_bytes!("../chainspec/testnet/chain_config.json");

let config: ChainConfig = serde_json::from_slice(TESTNET_CHAIN_CONFIG).unwrap();
config
Expand All @@ -149,7 +149,7 @@ pub fn local_testnet_chain_config() -> ChainConfig {
/// Returns the chain configuration for the local testnet.
pub fn local_testnet_reader() -> SnapshotReader {
const TESTNET_STATE_CONFIG: &[u8] =
include_bytes!("../../../deployment/scripts/chainspec/testnet/state_config.json");
include_bytes!("../chainspec/testnet/state_config.json");

let state_config: StateConfig = serde_json::from_slice(TESTNET_STATE_CONFIG).unwrap();

Expand Down
4 changes: 2 additions & 2 deletions tests/tests/deployment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ use fuel_core::chain_config::{
use fuel_core_types::fuel_tx::GasCosts;

#[allow(irrefutable_let_patterns)]
#[test_case::test_case( "./../deployment/scripts/chainspec/testnet" ; "Beta chainconfig" )]
#[test_case::test_case( "./../deployment/scripts/chainspec/dev-testnet" ; "Dev chainconfig" )]
#[test_case::test_case( "./../bin/fuel-core/chainspec/testnet" ; "Beta chainconfig" )]
#[test_case::test_case( "./../bin/fuel-core/chainspec/dev-testnet" ; "Dev chainconfig" )]
fn test_deployment_chainconfig(path: impl AsRef<Path>) -> anyhow::Result<()> {
let path = path.as_ref();
let stored_snapshot = SnapshotMetadata::read(path).unwrap();
Expand Down

0 comments on commit 24ec6ab

Please sign in to comment.