Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stefan/fix upgrade #357

Merged
merged 5 commits into from
Oct 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
5 changes: 3 additions & 2 deletions node/cli/src/command.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -39,6 +39,7 @@ impl SubstrateCli for Cli {

fn load_spec(&self, id: &str) -> Result<Box<dyn sc_service::ChainSpec>, 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))?),
Expand Down
72 changes: 71 additions & 1 deletion node/service/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,79 @@ pub fn authority_keys_from_seed(s: &str) -> (AuraId, GrandpaId) {
(get_from_seed::<AuraId>(s), get_from_seed::<GrandpaId>(s))
}

pub fn development_config() -> Result<ChainSpec, String> {
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::<sr25519::Public>("Alice"),
// Pre-funded accounts
vec![
(
get_account_id_from_seed::<sr25519::Public>("Alice"),
1_000_000_u128 * unit(GAFI),
),
(
get_account_id_from_seed::<sr25519::Public>("Bob"),
1_000_000_u128 * unit(GAFI),
),
(
get_account_id_from_seed::<sr25519::Public>("Alice//stash"),
1_000_000_u128 * unit(GAFI),
),
(
get_account_id_from_seed::<sr25519::Public>("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<ChainSpec, String> {
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",
Expand Down Expand Up @@ -132,7 +202,7 @@ pub fn local_config() -> Result<ChainSpec, String> {
None,
// Properties
None,
None,
Some(props),
// Extensions
None,
))
Expand Down
2 changes: 1 addition & 1 deletion runtime/devnet/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading