Skip to content

Commit 5ae75cb

Browse files
committed
add: scripts for starting nodes
1 parent ea55f2e commit 5ae75cb

File tree

14 files changed

+287
-173
lines changed

14 files changed

+287
-173
lines changed

Cargo.lock

Lines changed: 187 additions & 168 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bin/node/cli/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ getrandom = { version = "0.2.5", features = ["js"] }
4141
# primitives
4242
sp-authority-discovery = { version = "4.0.0-dev", git = "https://github.com/RealisNetwork/substrate", branch = "polkadot-v0.9.9" }
4343
sp-consensus-babe = { version = "0.10.0-dev", git = "https://github.com/RealisNetwork/substrate", branch = "polkadot-v0.9.9" }
44+
sp-consensus-aura = { default-features = false, git = "https://github.com/RealisNetwork/substrate", branch = "polkadot-v0.9.9" }
4445
grandpa-primitives = { version = "4.0.0-dev", package = "sp-finality-grandpa", git = "https://github.com/RealisNetwork/substrate", branch = "polkadot-v0.9.9" }
4546
sp-core = { version = "4.0.0-dev", git = "https://github.com/RealisNetwork/substrate", branch = "polkadot-v0.9.9" }
4647
sp-runtime = { version = "4.0.0-dev", git = "https://github.com/RealisNetwork/substrate", branch = "polkadot-v0.9.9" }

bin/node/cli/src/chain_spec/realis.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use grandpa_primitives::AuthorityId as GrandpaId;
22
use hex_literal::hex;
33
use node_runtime::{
4-
wasm_binary_unwrap, AuthorityDiscoveryConfig, BabeConfig,
4+
wasm_binary_unwrap, AuthorityDiscoveryConfig, AuraConfig, BabeConfig,
55
BalancesConfig, /*CouncilConfig,*/
66
/*DemocracyConfig,*/ /*ElectionsConfig,*/ GrandpaConfig, ImOnlineConfig, IndicesConfig,
77
NftConfig, RealisBridgeConfig, RealisGameApiConfig, SessionConfig,
@@ -164,6 +164,9 @@ pub fn realis_genesis(
164164
// phantom: Default::default(),
165165
// },
166166
sudo: SudoConfig { key: root_key },
167+
aura: AuraConfig {
168+
authorities: vec![], //initial_authorities.iter().map(|x| (x.0.clone())).collect(),
169+
},
167170
babe: BabeConfig {
168171
authorities: vec![],
169172
epoch_config: Some(node_runtime::BABE_GENESIS_EPOCH_CONFIG),

bin/node/cli/src/chain_spec/testnet.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use grandpa_primitives::AuthorityId as GrandpaId;
22
use node_runtime::{
3-
wasm_binary_unwrap, AuthorityDiscoveryConfig, BabeConfig,
3+
wasm_binary_unwrap, AuthorityDiscoveryConfig, AuraConfig, BabeConfig,
44
BalancesConfig, /*CouncilConfig,*/
55
/*DemocracyConfig,*/ /*ElectionsConfig,*/ GrandpaConfig, ImOnlineConfig, IndicesConfig,
66
NftConfig, RealisBridgeConfig, RealisGameApiConfig, SessionConfig,
@@ -161,6 +161,9 @@ pub fn testnet_genesis(
161161
// phantom: Default::default(),
162162
// },
163163
sudo: SudoConfig { key: root_key },
164+
aura: AuraConfig {
165+
authorities: vec![], //initial_authorities.iter().map(|x| (x.0.clone())).collect(),
166+
},
164167
babe: BabeConfig {
165168
authorities: vec![],
166169
epoch_config: Some(node_runtime::BABE_GENESIS_EPOCH_CONFIG),

bin/node/runtime/Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ getrandom = { version = "0.2.5", features = ["js"] }
2222

2323
# primitives
2424
sp-authority-discovery = { default-features = false, git = "https://github.com/RealisNetwork/substrate", branch = "polkadot-v0.9.9" }
25+
sp-consensus-aura = { default-features = false, git = "https://github.com/RealisNetwork/substrate", branch = "polkadot-v0.9.9" }
2526
sp-consensus-babe = { default-features = false, git = "https://github.com/RealisNetwork/substrate", branch = "polkadot-v0.9.9" }
2627
sp-block-builder = { default-features = false, git = "https://github.com/RealisNetwork/substrate", branch = "polkadot-v0.9.9" }
2728
sp-inherents = { default-features = false, git = "https://github.com/RealisNetwork/substrate", branch = "polkadot-v0.9.9" }
@@ -51,6 +52,7 @@ frame-try-runtime = { default-features = false, git = "https://github.com/Realis
5152

5253
# pallet dependencies
5354
pallet-assets = { default-features = false, git = "https://github.com/RealisNetwork/substrate", branch = "polkadot-v0.9.9" }
55+
pallet-aura = { default-features = false, git = "https://github.com/RealisNetwork/substrate", branch = "polkadot-v0.9.9" }
5456
pallet-authority-discovery = { default-features = false, git = "https://github.com/RealisNetwork/substrate", branch = "polkadot-v0.9.9" }
5557
pallet-authorship = { default-features = false, git = "https://github.com/RealisNetwork/substrate", branch = "polkadot-v0.9.9" }
5658
pallet-babe = { default-features = false, git = "https://github.com/RealisNetwork/substrate", branch = "polkadot-v0.9.9" }
@@ -113,6 +115,7 @@ std = [
113115
"log/std",
114116

115117
"sp-authority-discovery/std",
118+
"sp-consensus-aura/std",
116119
"sp-consensus-babe/std",
117120
"sp-block-builder/std",
118121
"sp-inherents/std",
@@ -140,6 +143,7 @@ std = [
140143
"frame-try-runtime/std",
141144

142145
"pallet-assets/std",
146+
"pallet-aura/std",
143147
"pallet-authority-discovery/std",
144148
"pallet-authorship/std",
145149
"pallet-babe/std",

bin/node/runtime/src/lib.rs

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ use frame_system::{
3939
limits::{BlockLength, BlockWeights},
4040
EnsureRoot,
4141
};
42+
use sp_consensus_aura::sr25519::AuthorityId as AuraId;
4243
pub use marketplace;
4344
pub use node_primitives::{AccountId, Signature};
4445
use node_primitives::{AccountIndex, Balance, BlockNumber, Hash, Index, Moment};
@@ -108,14 +109,14 @@ pub fn wasm_binary_unwrap() -> &'static [u8] {
108109
/// Runtime version.
109110
#[sp_version::runtime_version]
110111
pub const VERSION: RuntimeVersion = RuntimeVersion {
111-
spec_name: create_runtime_str!("realis"),
112+
spec_name: create_runtime_str!("node"),
112113
impl_name: create_runtime_str!("realis-node"),
113114
authoring_version: 10,
114115
// Per convention: if the runtime behavior changes, increment spec_version
115116
// and set impl_version to 0. If only runtime
116117
// implementation changes and behavior does not, then leave spec_version as
117118
// is and increment impl_version.
118-
spec_version: 293,
119+
spec_version: 294,
119120
impl_version: 4,
120121
apis: RUNTIME_API_VERSIONS,
121122
transaction_version: 8,
@@ -333,6 +334,11 @@ impl pallet_scheduler::Config for Runtime {
333334
type WeightInfo = pallet_scheduler::weights::SubstrateWeight<Runtime>;
334335
}
335336

337+
impl pallet_aura::Config for Runtime {
338+
type AuthorityId = AuraId;
339+
type DisabledValidators = ();
340+
}
341+
336342
parameter_types! {
337343
// NOTE: Currently it is not possible to change the epoch duration after the chain has started.
338344
// Attempting to do so will brick block production.
@@ -527,7 +533,7 @@ parameter_types! {
527533
pub const SignedDepositByte: Balance = 1 * CENTS;
528534

529535
// fallback: no on-chain fallback.
530-
pub const Fallback: FallbackStrategy = FallbackStrategy::OnChain;
536+
pub const Fallback: FallbackStrategy = FallbackStrategy::Nothing;
531537

532538
pub SolutionImprovementThreshold: Perbill = Perbill::from_rational(1u32, 10_000);
533539

@@ -1298,6 +1304,7 @@ construct_runtime!(
12981304
System: frame_system::{Pallet, Call, Config, Storage, Event<T>},
12991305
Utility: pallet_utility::{Pallet, Call, Event},
13001306
Babe: pallet_babe::{Pallet, Call, Storage, Config, ValidateUnsigned},
1307+
Aura: pallet_aura::{Pallet, Storage, Config<T>},
13011308
Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent},
13021309
Authorship: pallet_authorship::{Pallet, Call, Storage, Inherent},
13031310
Indices: pallet_indices::{Pallet, Call, Storage, Config<T>, Event<T>},
@@ -1475,6 +1482,16 @@ impl_runtime_apis! {
14751482
}
14761483
}
14771484

1485+
// impl sp_consensus_aura::AuraApi<Block, AuraId> for Runtime {
1486+
// fn slot_duration() -> sp_consensus_aura::SlotDuration {
1487+
// sp_consensus_aura::SlotDuration::from_millis(Aura::slot_duration())
1488+
// }
1489+
//
1490+
// fn authorities() -> Vec<AuraId> {
1491+
// Aura::authorities().into_inner()
1492+
// }
1493+
// }
1494+
14781495
impl fg_primitives::GrandpaApi<Block> for Runtime {
14791496
fn grandpa_authorities() -> GrandpaAuthorityList {
14801497
Grandpa::grandpa_authorities()

scripts/insert_aura_key_node01.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
./target/release/realis key insert \
2+
--base-path /tmp/node01 \
3+
--chain customSpecRaw.json \
4+
--scheme Sr25519 \
5+
--suri "0x1e32c692fd0b8e8b5e02d96ed5403ca5aa1d4667d7e11f84eedc446d1c602b54" \
6+
--password-interactive \
7+
--key-type aura

scripts/insert_aura_key_node02.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
./target/release/realis key insert --base-path /tmp/node02 \
2+
--chain customSpecRaw.json \
3+
--scheme Sr25519 \
4+
--suri "0x8b2fb92edf7bcf98d1682a45612cf0ca88607d3f5ada53ad82e93fc83c9cf867" \
5+
--password-interactive \
6+
--key-type aura
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
./target/release/realis key insert --base-path /tmp/node01 \
2+
--chain customSpecRaw.json \
3+
--scheme Ed25519 \
4+
--suri "0x1e32c692fd0b8e8b5e02d96ed5403ca5aa1d4667d7e11f84eedc446d1c602b54" \
5+
--password-interactive \
6+
--key-type gran
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
./target/release/realis key insert --base-path /tmp/node02 \
2+
--chain customSpecRaw.json \
3+
--scheme Ed25519 \
4+
--suri "0x8b2fb92edf7bcf98d1682a45612cf0ca88607d3f5ada53ad82e93fc83c9cf867" \
5+
--password-interactive \
6+
--key-type gran

0 commit comments

Comments
 (0)