diff --git a/Cargo.lock b/Cargo.lock index ac8a70f..44900b6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2052,7 +2052,7 @@ dependencies = [ [[package]] name = "fula-pool" version = "0.1.1" -source = "git+https://github.com/functionland/fula-pool?branch=main" +source = "git+https://github.com/functionland/fula-pool?branch=main#6f1f9bcb0f5eab55f80863bfa0742092cb99087f" dependencies = [ "frame-benchmarking", "frame-support", @@ -2068,7 +2068,7 @@ dependencies = [ [[package]] name = "functionland-fula" version = "0.1.1" -source = "git+https://github.com/functionland/fula-pallet?branch=main" +source = "git+https://github.com/functionland/fula-pallet?branch=main#c47e2200fb3d65fffe4ad4731ea4bcb39b261618" dependencies = [ "frame-benchmarking", "frame-support", @@ -4344,6 +4344,26 @@ dependencies = [ "sp-std", ] +[[package]] +name = "pallet-im-online" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.43#5e49f6e44820affccaf517fd22af564f4b495d40" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "log", + "pallet-authorship", + "parity-scale-codec", + "scale-info", + "sp-application-crypto", + "sp-core", + "sp-io", + "sp-runtime", + "sp-staking", + "sp-std", +] + [[package]] name = "pallet-scheduler" version = "4.0.0-dev" @@ -7944,6 +7964,7 @@ dependencies = [ "futures", "getrandom 0.2.12", "jsonrpsee", + "pallet-im-online", "pallet-transaction-payment", "pallet-transaction-payment-rpc", "sc-basic-authorship", @@ -8018,6 +8039,7 @@ dependencies = [ "pallet-contracts", "pallet-contracts-primitives", "pallet-grandpa", + "pallet-im-online", "pallet-scheduler", "pallet-session", "pallet-sudo", diff --git a/node/Cargo.toml b/node/Cargo.toml index 46b2edb..69058ad 100644 --- a/node/Cargo.toml +++ b/node/Cargo.toml @@ -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" } diff --git a/node/src/chain_spec.rs b/node/src/chain_spec.rs index 106c71e..216bcff 100644 --- a/node/src/chain_spec.rs +++ b/node/src/chain_spec.rs @@ -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. @@ -33,16 +34,17 @@ where AccountPublic::from(get_from_seed::(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::(s), get_from_seed::(s), get_from_seed::(s), + get_from_seed::(s), ) } @@ -156,7 +158,7 @@ pub fn local_testnet_config() -> Result { /// 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, _enable_println: bool, @@ -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::>(), @@ -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), diff --git a/runtime/Cargo.toml b/runtime/Cargo.toml index 218ced5..8c920fe 100644 --- a/runtime/Cargo.toml +++ b/runtime/Cargo.toml @@ -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" } @@ -156,6 +161,7 @@ std = [ "functionland-fula/std", "fula-pool/std", "sugarfunge-primitives/std", + "pallet-im-online/std", ] runtime-benchmarks = [ diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index 1d81bdb..e12c28d 100644 --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -97,6 +97,7 @@ pub mod opaque { pub struct SessionKeys { pub aura: Aura, pub grandpa: Grandpa, + pub im_online: ImOnline, } } } @@ -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 { @@ -603,6 +604,7 @@ construct_runtime!( Scheduler: pallet_scheduler::{Pallet, Call, Storage, Event}, Council: pallet_collective::, Session: pallet_session::{Pallet, Call, Storage, Event, Config}, + ImOnline: pallet_im_online, // SugarFunge pallets Asset: sugarfunge_asset::{Pallet, Call, Storage, Event},