-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added support of customization of the state transition version in the…
… `ChainConfig` (#1929) Closes #1920 The change allows customizing the state transition version in the genesis block. It is helpful if you want to start a new chain with the latest `fuel-core`. ## Checklist - [x] New behavior is reflected in tests ### Before requesting review - [x] I have reviewed the code myself --------- Co-authored-by: Hannes Karppila <hannes.karppila@gmail.com>
- Loading branch information
Showing
15 changed files
with
137 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
+16 Bytes
(100%)
bin/fuel-core/chainspec/local-testnet/state_transition_bytecode.wasm
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
use clap::Parser; | ||
use fuel_core::service::{ | ||
FuelService, | ||
ServiceTrait, | ||
}; | ||
use fuel_core_client::client::FuelClient; | ||
use tempfile::{ | ||
tempdir, | ||
TempDir, | ||
}; | ||
|
||
pub struct FuelCoreDriver { | ||
/// This must be before the db_dir as the drop order matters here | ||
pub node: FuelService, | ||
pub db_dir: TempDir, | ||
pub client: FuelClient, | ||
} | ||
impl FuelCoreDriver { | ||
pub async fn spawn(extra_args: &[&str]) -> anyhow::Result<Self> { | ||
// Generate temp params | ||
let db_dir = tempdir()?; | ||
|
||
let mut args = vec![ | ||
"_IGNORED_", | ||
"--db-path", | ||
db_dir.path().to_str().unwrap(), | ||
"--port", | ||
"0", | ||
]; | ||
args.extend(extra_args); | ||
|
||
let node = fuel_core_bin::cli::run::get_service( | ||
fuel_core_bin::cli::run::Command::parse_from(args), | ||
)?; | ||
|
||
node.start_and_await().await?; | ||
|
||
let client = FuelClient::from(node.shared.graph_ql.bound_address); | ||
Ok(Self { | ||
node, | ||
db_dir, | ||
client, | ||
}) | ||
} | ||
|
||
/// Stops the node, returning the db only | ||
/// Ignoring the return value drops the db as well. | ||
pub async fn kill(self) -> TempDir { | ||
println!("Stopping fuel service"); | ||
self.node | ||
.stop_and_await() | ||
.await | ||
.expect("Failed to stop the node"); | ||
self.db_dir | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
pub mod builder; | ||
pub mod fuel_core_driver; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters