Skip to content

Commit

Permalink
Corrected replaced files by mistake
Browse files Browse the repository at this point in the history
  • Loading branch information
ehsan6sha committed Mar 11, 2024
1 parent b388d44 commit a01f485
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 9 deletions.
26 changes: 24 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@ try-runtime-cli = { version = "0.10.0-dev", optional = true, git = "https://gith
# The node's runtime
sugarfunge-runtime = { version = "0.1.0", path = "../runtime" }

[dependencies.pallet-im-online]
default-features = false
git = 'https://github.com/paritytech/substrate.git'
branch = 'polkadot-v0.9.43'

[build-dependencies]
substrate-build-script-utils = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }

Expand Down
15 changes: 9 additions & 6 deletions node/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ use sc_service::ChainType;
use serde_json::json;
use sp_consensus_aura::sr25519::AuthorityId as AuraId;
use sp_consensus_grandpa::AuthorityId as GrandpaId;
use pallet_im_online::sr25519::AuthorityId as ImOnlineId;
use sp_core::{sr25519, Pair, Public};
use sp_runtime::traits::{IdentifyAccount, Verify};
use sugarfunge_runtime::{
opaque::SessionKeys, AccountId, AuraConfig, Balance, BalancesConfig, CouncilConfig,
GenesisConfig, GrandpaConfig, SessionConfig, Signature, SudoConfig,
SystemConfig, ValidatorSetConfig, DOLLARS, WASM_BINARY,
SystemConfig, ValidatorSetConfig, DOLLARS, WASM_BINARY, ImOnlineConfig,
};

// The URL for the telemetry server.
Expand All @@ -33,16 +34,17 @@ where
AccountPublic::from(get_from_seed::<TPublic>(seed)).into_account()
}

fn session_keys(aura: AuraId, grandpa: GrandpaId) -> SessionKeys {
SessionKeys { aura, grandpa }
fn session_keys(aura: AuraId, grandpa: GrandpaId, im_online: ImOnlineId) -> SessionKeys {
SessionKeys { aura, grandpa, im_online }
}

/// Generate an Aura authority key.
pub fn authority_keys_from_seed(s: &str) -> (AccountId, AuraId, GrandpaId) {
pub fn authority_keys_from_seed(s: &str) -> (AccountId, AuraId, GrandpaId, ImOnlineId) {
(
get_account_id_from_seed::<sr25519::Public>(s),
get_from_seed::<AuraId>(s),
get_from_seed::<GrandpaId>(s),
get_from_seed::<ImOnlineId>(s),
)
}

Expand Down Expand Up @@ -156,7 +158,7 @@ pub fn local_testnet_config() -> Result<ChainSpec, String> {
/// Configure initial storage state for FRAME modules.
fn testnet_genesis(
wasm_binary: &[u8],
initial_authorities: Vec<(AccountId, AuraId, GrandpaId)>,
initial_authorities: Vec<(AccountId, AuraId, GrandpaId, ImOnlineId)>,
root_key: AccountId,
endowed_accounts: Vec<AccountId>,
_enable_println: bool,
Expand Down Expand Up @@ -189,7 +191,7 @@ fn testnet_genesis(
(
x.0.clone(),
x.0.clone(),
session_keys(x.1.clone(), x.2.clone()),
session_keys(x.1.clone(), x.2.clone(), x.3.clone()),
)
})
.collect::<Vec<_>>(),
Expand All @@ -209,6 +211,7 @@ fn testnet_genesis(
grandpa: GrandpaConfig {
authorities: vec![],
},
im_online: ImOnlineConfig { keys: vec![] },
sudo: SudoConfig {
// Assign network admin rights.
key: Some(root_key),
Expand Down
6 changes: 6 additions & 0 deletions runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,11 @@ sugarfunge-market = { default-features = false, path = "../pallets/market" }
functionland-fula = { git = "https://github.com/functionland/fula-pallet" , branch = "main" , default-features = false }
fula-pool = { git = "https://github.com/functionland/fula-pool" , branch = "main" , default-features = false }

[dependencies.pallet-im-online]
default-features = false
git = 'https://github.com/paritytech/substrate.git'
branch = 'polkadot-v0.9.43'

[build-dependencies]
substrate-wasm-builder = { version = "5.0.0-dev", git = "https://github.com/paritytech/substrate", optional = true, branch = "polkadot-v0.9.43" }

Expand Down Expand Up @@ -156,6 +161,7 @@ std = [
"functionland-fula/std",
"fula-pool/std",
"sugarfunge-primitives/std",
"pallet-im-online/std",
]

runtime-benchmarks = [
Expand Down
4 changes: 3 additions & 1 deletion runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ pub mod opaque {
pub struct SessionKeys {
pub aura: Aura,
pub grandpa: Grandpa,
pub im_online: ImOnline,
}
}
}
Expand Down Expand Up @@ -205,7 +206,7 @@ impl frame_system::Config for Runtime {
}

parameter_types! {
pub const MaxAuthorities: u32 = 32;
pub const MaxAuthorities: u32 = 1000;
}

impl pallet_aura::Config for Runtime {
Expand Down Expand Up @@ -603,6 +604,7 @@ construct_runtime!(
Scheduler: pallet_scheduler::{Pallet, Call, Storage, Event<T>},
Council: pallet_collective::<Instance1>,
Session: pallet_session::{Pallet, Call, Storage, Event, Config<T>},
ImOnline: pallet_im_online,

// SugarFunge pallets
Asset: sugarfunge_asset::{Pallet, Call, Storage, Event<T>},
Expand Down

0 comments on commit a01f485

Please sign in to comment.