Skip to content

Commit

Permalink
Polkadot v1.0.0 (#279)
Browse files Browse the repository at this point in the history
* WIP

* compiling

* Replacing RuntimeGenesisConfig

* Fixing tests

* Clippy issues solved

* fmt
  • Loading branch information
darkforest0202 authored Aug 10, 2023
1 parent b1fac91 commit d769346
Show file tree
Hide file tree
Showing 26 changed files with 2,064 additions and 2,028 deletions.
1,832 changes: 963 additions & 869 deletions Cargo.lock

Large diffs are not rendered by default.

108 changes: 54 additions & 54 deletions node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,65 +27,65 @@ kreivo-runtime = { path = "../runtime/kreivo", optional = true}
jsonrpsee = { version = "0.16.2", features = ["server"] }

# Substrate
frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }
frame-benchmarking-cli = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }
sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.43" }
sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }
sp-session = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }
sc-consensus = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }
sc-cli = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }
sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }
sc-executor = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }
sc-service = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }
sc-telemetry = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }
sc-transaction-pool = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }
sp-transaction-pool = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }
sc-network = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }
sc-network-sync = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }
sc-basic-authorship = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }
sp-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }
sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }
sp-block-builder = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }
sp-keystore = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }
sp-keyring = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }
sc-chain-spec = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }
sc-rpc = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }
sc-tracing = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }
sp-offchain = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }
sp-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }
sp-consensus-aura = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }
sp-inherents = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }
sc-sysinfo = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }
substrate-prometheus-endpoint = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }
try-runtime-cli = { git = "https://github.com/paritytech/substrate", optional = true , branch = "polkadot-v0.9.43" }
sc-transaction-pool-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }
substrate-frame-rpc-system = { package = "substrate-frame-rpc-system", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }
pallet-transaction-payment-rpc = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }
substrate-state-trie-migration-rpc = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }
frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }
pallet-asset-tx-payment = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }
frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" }
frame-benchmarking-cli = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" }
sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v1.0.0" }
sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" }
sp-session = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" }
sc-consensus = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" }
sc-cli = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" }
sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" }
sc-executor = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" }
sc-service = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" }
sc-telemetry = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" }
sc-transaction-pool = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" }
sp-transaction-pool = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" }
sc-network = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" }
sc-network-sync = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" }
sc-basic-authorship = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" }
sp-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" }
sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" }
sp-block-builder = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" }
sp-keystore = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" }
sp-keyring = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" }
sc-chain-spec = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" }
sc-rpc = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" }
sc-tracing = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" }
sp-offchain = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" }
sp-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" }
sp-consensus-aura = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" }
sp-inherents = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" }
sc-sysinfo = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" }
substrate-prometheus-endpoint = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" }
try-runtime-cli = { git = "https://github.com/paritytech/substrate", optional = true , branch = "polkadot-v1.0.0" }
sc-transaction-pool-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" }
substrate-frame-rpc-system = { package = "substrate-frame-rpc-system", git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" }
pallet-transaction-payment-rpc = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" }
substrate-state-trie-migration-rpc = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" }
frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" }
pallet-asset-tx-payment = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" }

# Polkadot
polkadot-cli = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.43" }
polkadot-primitives = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.43" }
polkadot-service = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.43" }
xcm = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.43" }
polkadot-cli = { git = "https://github.com/paritytech/polkadot", branch = "release-v1.0.0" }
polkadot-primitives = { git = "https://github.com/paritytech/polkadot", branch = "release-v1.0.0" }
polkadot-service = { git = "https://github.com/paritytech/polkadot", branch = "release-v1.0.0" }
xcm = { git = "https://github.com/paritytech/polkadot", branch = "release-v1.0.0" }

# Cumulus
cumulus-client-cli = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.43" }
cumulus-client-consensus-aura = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.43" }
cumulus-client-consensus-relay-chain = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.43" }
cumulus-client-consensus-common = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.43" }
cumulus-client-network = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.43" }
cumulus-client-service = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.43" }
cumulus-primitives-core = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.43" }
cumulus-primitives-parachain-inherent = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.43" }
cumulus-relay-chain-interface = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.43" }
parachains-common = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.43", default-features = false }
cumulus-client-cli = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v1.0.0" }
cumulus-client-consensus-aura = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v1.0.0" }
cumulus-client-consensus-relay-chain = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v1.0.0" }
cumulus-client-consensus-common = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v1.0.0" }
cumulus-client-network = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v1.0.0" }
cumulus-client-service = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v1.0.0" }
cumulus-primitives-core = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v1.0.0" }
cumulus-primitives-parachain-inherent = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v1.0.0" }
cumulus-relay-chain-interface = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v1.0.0" }
parachains-common = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v1.0.0", default-features = false }

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

[dev-dependencies]
assert_cmd = "2.0"
Expand All @@ -94,7 +94,7 @@ tempfile = "3.4.0"
tokio = { version = "1.26.0", features = ["macros", "time", "parking_lot"] }
wait-timeout = "0.2"
# purge_chain_works works with rococo-local and needs to allow this
polkadot-cli = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.43" }
polkadot-cli = { git = "https://github.com/paritytech/polkadot", branch = "release-v1.0.0" }

[features]
default = ["virto-runtime", "kreivo-runtime"]
Expand Down
26 changes: 18 additions & 8 deletions node/src/chain_spec/kreivo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ use crate::chain_spec::{get_account_id_from_seed, get_collator_keys_from_seed, E
use cumulus_primitives_core::ParaId;
use hex_literal::hex;
use kreivo_runtime::{
constants::currency::EXISTENTIAL_DEPOSIT, AccountId, AuraId, BalancesConfig, GenesisConfig, SessionConfig,
constants::currency::EXISTENTIAL_DEPOSIT, AccountId, AuraId, BalancesConfig, RuntimeGenesisConfig, SessionConfig,
SessionKeys, SudoConfig, SystemConfig,
};
use sc_service::ChainType;
use sp_core::{crypto::UncheckedInto, sr25519};
const DEFAULT_PROTOCOL_ID: &str = "kreivo";

/// Specialized `ChainSpec` for the normal parachain runtime.
pub type ChainSpec = sc_service::GenericChainSpec<kreivo_runtime::GenesisConfig, Extensions>;
pub type ChainSpec = sc_service::GenericChainSpec<kreivo_runtime::RuntimeGenesisConfig, Extensions>;

const KREIVO_PARA_ID: u32 = 2000;

Expand Down Expand Up @@ -142,18 +142,22 @@ fn testnet_genesis(
root_key: AccountId,
endowed_accounts: Vec<AccountId>,
id: ParaId,
) -> GenesisConfig {
GenesisConfig {
) -> RuntimeGenesisConfig {
RuntimeGenesisConfig {
system: SystemConfig {
code: kreivo_runtime::WASM_BINARY
.expect("WASM binary was not build, please build it!")
.to_vec(),
_config: Default::default(),
},
balances: BalancesConfig {
// Configure endowed accounts with initial balance of 1 << 60.
balances: endowed_accounts.iter().cloned().map(|k| (k, 1 << 60)).collect(),
},
parachain_info: kreivo_runtime::ParachainInfoConfig { parachain_id: id },
parachain_info: kreivo_runtime::ParachainInfoConfig {
parachain_id: id,
_config: Default::default(),
},
collator_selection: kreivo_runtime::CollatorSelectionConfig {
invulnerables: invulnerables.iter().cloned().map(|(acc, _)| acc).collect(),
candidacy_bond: EXISTENTIAL_DEPOSIT * 16,
Expand All @@ -178,6 +182,7 @@ fn testnet_genesis(
parachain_system: Default::default(),
polkadot_xcm: kreivo_runtime::PolkadotXcmConfig {
safe_xcm_version: Some(SAFE_XCM_VERSION),
_config: Default::default(),
},
transaction_payment: Default::default(),
lockdown_mode: Default::default(),
Expand Down Expand Up @@ -245,12 +250,13 @@ fn kreivo_live_genesis(
root_key: AccountId,
endowed_accounts: Vec<AccountId>,
id: ParaId,
) -> GenesisConfig {
GenesisConfig {
) -> RuntimeGenesisConfig {
RuntimeGenesisConfig {
system: SystemConfig {
code: kreivo_runtime::WASM_BINARY
.expect("WASM binary was not build, please build it!")
.to_vec(),
_config: Default::default(),
},
balances: BalancesConfig {
balances: endowed_accounts
Expand All @@ -260,7 +266,10 @@ fn kreivo_live_genesis(
.map(|k| (k, 1_500_000_000_000_000_000))
.collect(),
},
parachain_info: kreivo_runtime::ParachainInfoConfig { parachain_id: id },
parachain_info: kreivo_runtime::ParachainInfoConfig {
parachain_id: id,
_config: Default::default(),
},
collator_selection: kreivo_runtime::CollatorSelectionConfig {
invulnerables: invulnerables.iter().cloned().map(|(acc, _)| acc).collect(),
candidacy_bond: EXISTENTIAL_DEPOSIT * 16,
Expand All @@ -283,6 +292,7 @@ fn kreivo_live_genesis(
parachain_system: Default::default(),
polkadot_xcm: kreivo_runtime::PolkadotXcmConfig {
safe_xcm_version: Some(SAFE_XCM_VERSION),
_config: Default::default(),
},
transaction_payment: Default::default(),
lockdown_mode: Default::default(),
Expand Down
26 changes: 18 additions & 8 deletions node/src/chain_spec/virto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ use sc_service::ChainType;

use sp_core::{crypto::UncheckedInto, sr25519};
use virto_runtime::{
constants::currency::EXISTENTIAL_DEPOSIT, AccountId, AuraId, BalancesConfig, GenesisConfig, SessionConfig,
constants::currency::EXISTENTIAL_DEPOSIT, AccountId, AuraId, BalancesConfig, RuntimeGenesisConfig, SessionConfig,
SessionKeys, SudoConfig, SystemConfig,
};

const DEFAULT_PROTOCOL_ID: &str = "virto";

/// Specialized `ChainSpec` for the normal parachain runtime.
pub type ChainSpec = sc_service::GenericChainSpec<virto_runtime::GenesisConfig, Extensions>;
pub type ChainSpec = sc_service::GenericChainSpec<virto_runtime::RuntimeGenesisConfig, Extensions>;

const VIRTO_PARA_ID: u32 = 2000;

Expand Down Expand Up @@ -85,18 +85,22 @@ fn testnet_genesis(
root_key: AccountId,
endowed_accounts: Vec<AccountId>,
id: ParaId,
) -> GenesisConfig {
GenesisConfig {
) -> RuntimeGenesisConfig {
RuntimeGenesisConfig {
system: SystemConfig {
code: virto_runtime::WASM_BINARY
.expect("WASM binary was not build, please build it!")
.to_vec(),
_config: Default::default(),
},
balances: BalancesConfig {
// Configure endowed accounts with initial balance of 1 << 60.
balances: endowed_accounts.iter().cloned().map(|k| (k, 1 << 60)).collect(),
},
parachain_info: virto_runtime::ParachainInfoConfig { parachain_id: id },
parachain_info: virto_runtime::ParachainInfoConfig {
parachain_id: id,
_config: Default::default(),
},
collator_selection: virto_runtime::CollatorSelectionConfig {
invulnerables: invulnerables.iter().cloned().map(|(acc, _)| acc).collect(),
candidacy_bond: EXISTENTIAL_DEPOSIT * 16,
Expand All @@ -121,6 +125,7 @@ fn testnet_genesis(
parachain_system: Default::default(),
polkadot_xcm: virto_runtime::PolkadotXcmConfig {
safe_xcm_version: Some(SAFE_XCM_VERSION),
_config: Default::default(),
},
transaction_payment: Default::default(),
lockdown_mode: Default::default(),
Expand Down Expand Up @@ -188,12 +193,13 @@ fn virto_live_genesis(
root_key: AccountId,
endowed_accounts: Vec<AccountId>,
id: ParaId,
) -> GenesisConfig {
GenesisConfig {
) -> RuntimeGenesisConfig {
RuntimeGenesisConfig {
system: SystemConfig {
code: virto_runtime::WASM_BINARY
.expect("WASM binary was not build, please build it!")
.to_vec(),
_config: Default::default(),
},
balances: BalancesConfig {
balances: endowed_accounts
Expand All @@ -209,7 +215,10 @@ fn virto_live_genesis(
})
.collect(),
},
parachain_info: virto_runtime::ParachainInfoConfig { parachain_id: id },
parachain_info: virto_runtime::ParachainInfoConfig {
parachain_id: id,
_config: Default::default(),
},
collator_selection: virto_runtime::CollatorSelectionConfig {
invulnerables: invulnerables.iter().cloned().map(|(acc, _)| acc).collect(),
candidacy_bond: EXISTENTIAL_DEPOSIT * 16,
Expand All @@ -232,6 +241,7 @@ fn virto_live_genesis(
parachain_system: Default::default(),
polkadot_xcm: virto_runtime::PolkadotXcmConfig {
safe_xcm_version: Some(SAFE_XCM_VERSION),
_config: Default::default(),
},
transaction_payment: Default::default(),
lockdown_mode: Default::default(),
Expand Down
Loading

0 comments on commit d769346

Please sign in to comment.