Skip to content

Commit

Permalink
Add random feature to chain-config
Browse files Browse the repository at this point in the history
  • Loading branch information
bvrooman committed Oct 13, 2023
1 parent e83a116 commit eeb02a1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 3 additions & 2 deletions crates/chain-config/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ description = "Fuel Chain config types"
anyhow = { workspace = true }
bech32 = "0.9.0"
fuel-core-storage = { workspace = true }
fuel-core-types = { workspace = true, default-features = false, features = ["random", "serde"] }
fuel-core-types = { workspace = true, default-features = false, features = ["serde"] }
hex = { version = "0.4", features = ["serde"] }
itertools = { workspace = true }
postcard = { version = "1.0", features = ["use-std"] }
Expand All @@ -29,5 +29,6 @@ insta = { workspace = true }
serde_json = { version = "1.0", features = ["raw_value"] }

[features]
default = ["std"]
default = ["random", "std"]
random = ["fuel-core-types/random"]
std = ["dep:serde_json", "fuel-core-types/std", "anyhow/std"]
2 changes: 2 additions & 0 deletions crates/chain-config/src/config/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ impl Default for ChainConfig {
impl ChainConfig {
pub const BASE_ASSET: AssetId = AssetId::zeroed();

#[cfg(feature = "random")]
pub fn local_testnet() -> Self {
// endow some preset accounts with an initial balance
tracing::info!("Initial Accounts");
Expand Down Expand Up @@ -139,6 +140,7 @@ impl FromStr for ChainConfig {

fn from_str(s: &str) -> Result<Self, Self::Err> {
match s {
#[cfg(feature = "random")]
LOCAL_TESTNET => Ok(Self::local_testnet()),
s => {
// Attempt to load chain config from path
Expand Down

0 comments on commit eeb02a1

Please sign in to comment.