diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index dcd96ff8..164575df 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -34,9 +34,10 @@ jobs: run: make check - name: Check Build for Benchmarking - run: > + run: | if [ ! -d "node" ]; then mkdir node # Create the "node" directory fi pushd node && make check-benchmark + shell: bash \ No newline at end of file diff --git a/node/cli/src/command.rs b/node/cli/src/command.rs index 9258ef0f..15f7fc2c 100644 --- a/node/cli/src/command.rs +++ b/node/cli/src/command.rs @@ -1,8 +1,8 @@ use crate::cli::{Cli, Subcommand}; use frame_benchmarking_cli::{BenchmarkCmd, ExtrinsicFactory, SUBSTRATE_REFERENCE_HARDWARE}; use gafi_service::{ - local_config, inherent_benchmark_data, testnet_config , new_full, new_partial, - ChainSpec, RemarkBuilder, TransferKeepAliveBuilder, + development_config, inherent_benchmark_data, local_config, new_full, new_partial, + testnet_config, ChainSpec, RemarkBuilder, TransferKeepAliveBuilder, }; use polkadot_core_primitives::Block; use sc_cli::SubstrateCli; @@ -39,6 +39,7 @@ impl SubstrateCli for Cli { fn load_spec(&self, id: &str) -> Result, String> { Ok(match id { + "dev" => Box::new(development_config()?), "" | "local" => Box::new(local_config()?), "testnet" => Box::new(testnet_config()?), path => Box::new(ChainSpec::from_json_file(std::path::PathBuf::from(path))?), diff --git a/node/service/src/chain_spec.rs b/node/service/src/chain_spec.rs index c1026b25..8aa299c4 100644 --- a/node/service/src/chain_spec.rs +++ b/node/service/src/chain_spec.rs @@ -51,9 +51,79 @@ pub fn authority_keys_from_seed(s: &str) -> (AuraId, GrandpaId) { (get_from_seed::(s), get_from_seed::(s)) } +pub fn development_config() -> Result { + let wasm_binary = WASM_BINARY.ok_or_else(|| "Development wasm not available".to_string())?; + + let mut props: Properties = Properties::new(); + let token = GafiCurrency::token_info(GAFI); + let symbol = json!(String::from_utf8(token.symbol).unwrap_or("GAFI".to_string())); + let name = json!(String::from_utf8(token.name).unwrap_or("GAFI Token".to_string())); + let decimals = json!(token.decimals); + props.insert("tokenSymbol".to_string(), symbol); + props.insert("tokenName".to_string(), name); + props.insert("tokenDecimals".to_string(), decimals); + + Ok(ChainSpec::from_genesis( + // Name + "Development", + // ID + "dev", + ChainType::Development, + move || { + test_genesis( + wasm_binary, + // Initial PoA authorities + vec![authority_keys_from_seed("Alice")], + // Sudo account + get_account_id_from_seed::("Alice"), + // Pre-funded accounts + vec![ + ( + get_account_id_from_seed::("Alice"), + 1_000_000_u128 * unit(GAFI), + ), + ( + get_account_id_from_seed::("Bob"), + 1_000_000_u128 * unit(GAFI), + ), + ( + get_account_id_from_seed::("Alice//stash"), + 1_000_000_u128 * unit(GAFI), + ), + ( + get_account_id_from_seed::("Bob//stash"), + 1_000_000_u128 * unit(GAFI), + ), + ], + true, + ) + }, + // Bootnodes + vec![], + // Telemetry + None, + // Protocol ID + None, + None, + // Properties + Some(props), + // Extensions + None, + )) +} + pub fn local_config() -> Result { let wasm_binary = WASM_BINARY.ok_or_else(|| "Development wasm not available".to_string())?; + let mut props: Properties = Properties::new(); + let token = GafiCurrency::token_info(GAFI); + let symbol = json!(String::from_utf8(token.symbol).unwrap_or("GAFI".to_string())); + let name = json!(String::from_utf8(token.name).unwrap_or("GAFI Token".to_string())); + let decimals = json!(token.decimals); + props.insert("tokenSymbol".to_string(), symbol); + props.insert("tokenName".to_string(), name); + props.insert("tokenDecimals".to_string(), decimals); + Ok(ChainSpec::from_genesis( // Name "Local Testnet", @@ -132,7 +202,7 @@ pub fn local_config() -> Result { None, // Properties None, - None, + Some(props), // Extensions None, )) diff --git a/runtime/devnet/src/lib.rs b/runtime/devnet/src/lib.rs index c6caed27..6f45dee2 100644 --- a/runtime/devnet/src/lib.rs +++ b/runtime/devnet/src/lib.rs @@ -353,7 +353,7 @@ impl pallet_insecure_randomness_collective_flip::Config for Runtime {} parameter_types! { pub FaucetCleanTime: u128 = 24 * (HOURS as u128); - pub FaucetAmount: u128 = 1500 * unit(GAFI); + pub FaucetAmount: u128 = 100 * unit(GAFI); } // cache for pallet faucet only for testnet