Skip to content

Commit

Permalink
Update client (#1327)
Browse files Browse the repository at this point in the history
* Fix rpc and work on client update

* Finalize standalone client

* Update parachain client

* Use same try-runtime subcommand in every case

* Update node/src/cli.rs

Co-authored-by: Malte Kliemann <mail@maltekliemann.com>

* Update try-runtime* Makefile targets

---------

Co-authored-by: Malte Kliemann <mail@maltekliemann.com>
  • Loading branch information
sea212 and maltekliemann authored Apr 30, 2024
1 parent de0fad9 commit 7fc38ee
Show file tree
Hide file tree
Showing 17 changed files with 303 additions and 483 deletions.
22 changes: 21 additions & 1 deletion Cargo.lock

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

4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,9 @@ sc-consensus-grandpa = { git = "https://github.com/paritytech/polkadot-sdk", bra
sc-executor = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }
sc-keystore = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }
sc-network = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }
sc-network-common = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }
sc-network-statement = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }
sc-network-sync = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }
sc-offchain = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }
sc-rpc = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }
sc-rpc-api = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }
sc-service = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0" }
Expand Down
10 changes: 2 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,27 +18,21 @@ check-dummy:
# Pseudo private target is invoked by public targets for different chains
--try-runtime:
RUST_LOG=runtime=trace,try-runtime::cli=trace,executor=trace \
cargo run \
--bin=zeitgeist \
--features=parachain,try-runtime \
try-runtime \
--chain=${TRYRUNTIME_CHAIN} \
--runtime=${RUNTIME_PATH} \
on-runtime-upgrade \
--checks=all \
live \
--uri=${TRYRUNTIME_URL}

try-runtime-upgrade-battery-station:
@$(MAKE) TRYRUNTIME_CHAIN="battery_station_staging" \
TRYRUNTIME_URL="wss://bsr.zeitgeist.pm:443" \
@$(MAKE) TRYRUNTIME_URL="wss://bsr.zeitgeist.pm:443" \
RUNTIME_PATH="./target/debug/wbuild/battery-station-runtime/battery_station_runtime.compact.compressed.wasm" \
-- \
--try-runtime

try-runtime-upgrade-zeitgeist:
@$(MAKE) TRYRUNTIME_CHAIN="zeitgeist_staging" \
TRYRUNTIME_URL="wss://zeitgeist-rpc.dwellir.com:443" \
@$(MAKE) TRYRUNTIME_URL="wss://zeitgeist-rpc.dwellir.com:443" \
RUNTIME_PATH="./target/debug/wbuild/zeitgeist-runtime/zeitgeist_runtime.compact.compressed.wasm" \
-- \
--try-runtime
Expand Down
9 changes: 5 additions & 4 deletions node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ sc-client-db = { workspace = true }
sc-consensus = { workspace = true }
sc-executor = { workspace = true }
sc-keystore = { workspace = true }
sc-network = { workspace = true }
sc-network-statement = { workspace = true }
sc-offchain = { workspace = true }
sc-rpc = { workspace = true }
sc-rpc-api = { workspace = true }
sc-service = { workspace = true }
Expand Down Expand Up @@ -75,8 +78,7 @@ pallet-author-inherent = { workspace = true, features = ["default"], optional =
pallet-parachain-staking = { workspace = true, features = ["default"], optional = true }
parity-scale-codec = { workspace = true, features = ["default"], optional = true }
sc-chain-spec = { workspace = true, optional = true }
sc-network = { workspace = true, optional = true }
sc-network-common = { workspace = true, optional = true }
sc-network-sync = { workspace = true, optional = true }
sc-tracing = { workspace = true, optional = true }
serde = { workspace = true, features = ["default"], optional = true }
session-keys-primitives = { workspace = true, features = ["default"], optional = true }
Expand Down Expand Up @@ -148,8 +150,7 @@ parachain = [
"parity-scale-codec",
"session-keys-primitives",
"sc-chain-spec",
"sc-network",
"sc-network-common",
"sc-network-sync",
"sc-tracing",
"serde",
"sp-keystore",
Expand Down
2 changes: 1 addition & 1 deletion node/src/chain_spec/additional_chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,5 @@ pub struct AdditionalChainSpec {
#[cfg(not(feature = "parachain"))]
pub struct AdditionalChainSpec {
pub initial_authorities:
Vec<(sp_consensus_aura::sr25519::AuthorityId, sp_finality_grandpa::AuthorityId)>,
Vec<(sp_consensus_aura::sr25519::AuthorityId, sp_consensus_grandpa::AuthorityId)>,
}
4 changes: 2 additions & 2 deletions node/src/chain_spec/battery_station.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ cfg_if::cfg_if! {
pub(super) const DEFAULT_STAKING_AMOUNT_BATTERY_STATION: u128 = 2_000 * BASE;
const DEFAULT_COLLATOR_BALANCE_BATTERY_STATION: Option<u128> =
DEFAULT_STAKING_AMOUNT_BATTERY_STATION.checked_add(CollatorDeposit::get());
pub type BatteryStationChainSpec = sc_service::GenericChainSpec<battery_station_runtime::GenesisConfig, Extensions>;
pub type BatteryStationChainSpec = sc_service::GenericChainSpec<battery_station_runtime::RuntimeGenesisConfig, Extensions>;
const NUM_SELECTED_CANDIDATES: u32 = 8;
} else {
pub type BatteryStationChainSpec = sc_service::GenericChainSpec<battery_station_runtime::GenesisConfig>;
pub type BatteryStationChainSpec = sc_service::GenericChainSpec<battery_station_runtime::RuntimeGenesisConfig>;
}
}

Expand Down
4 changes: 2 additions & 2 deletions node/src/chain_spec/dev.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ const INITIAL_BALANCE: Balance = Balance::MAX >> 4;
#[cfg(not(feature = "parachain"))]
fn authority_keys_from_seed(
s: &str,
) -> (sp_consensus_aura::sr25519::AuthorityId, sp_finality_grandpa::AuthorityId) {
) -> (sp_consensus_aura::sr25519::AuthorityId, sp_consensus_grandpa::AuthorityId) {
(
get_from_seed::<sp_consensus_aura::sr25519::AuthorityId>(s),
get_from_seed::<sp_finality_grandpa::AuthorityId>(s),
get_from_seed::<sp_consensus_grandpa::AuthorityId>(s),
)
}

Expand Down
15 changes: 10 additions & 5 deletions node/src/chain_spec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ macro_rules! generate_generic_genesis_function {
acs: AdditionalChainSpec,
endowed_accounts: Vec<EndowedAccountWithBalance>,
wasm_binary: &[u8],
) -> $runtime::GenesisConfig {
$runtime::GenesisConfig {
) -> $runtime::RuntimeGenesisConfig {
$runtime::RuntimeGenesisConfig {
// Common genesis
advisory_committee: Default::default(),
advisory_committee_membership: $runtime::AdvisoryCommitteeMembershipConfig {
Expand All @@ -125,6 +125,7 @@ macro_rules! generate_generic_genesis_function {
#[cfg(feature = "parachain")]
author_filter: $runtime::AuthorFilterConfig {
eligible_count: EligibilityValue::new_unchecked(1),
..Default::default()
},
#[cfg(feature = "parachain")]
author_mapping: $runtime::AuthorMappingConfig {
Expand All @@ -147,13 +148,17 @@ macro_rules! generate_generic_genesis_function {
#[cfg(not(feature = "parachain"))]
grandpa: $runtime::GrandpaConfig {
authorities: acs.initial_authorities.iter().map(|x| (x.1.clone(), 1)).collect(),
..Default::default()
},
liquidity_mining: $runtime::LiquidityMiningConfig {
initial_balance: LIQUIDITY_MINING,
per_block_distribution: LIQUIDITY_MINING_PTD.mul_ceil(LIQUIDITY_MINING),
},
#[cfg(feature = "parachain")]
parachain_info: $runtime::ParachainInfoConfig { parachain_id: acs.parachain_id },
parachain_info: $runtime::ParachainInfoConfig {
parachain_id: acs.parachain_id,
..Default::default()
},
#[cfg(feature = "parachain")]
parachain_staking: $runtime::ParachainStakingConfig {
blocks_per_round: acs.blocks_per_round,
Expand All @@ -174,7 +179,7 @@ macro_rules! generate_generic_genesis_function {
#[cfg(feature = "parachain")]
// Default should use the pallet configuration
polkadot_xcm: PolkadotXcmConfig::default(),
system: $runtime::SystemConfig { code: wasm_binary.to_vec() },
system: $runtime::SystemConfig { code: wasm_binary.to_vec(), ..Default::default() },
technical_committee: Default::default(),
technical_committee_membership: $runtime::TechnicalCommitteeMembershipConfig {
members: vec![].try_into().unwrap(),
Expand Down Expand Up @@ -230,7 +235,7 @@ pub struct Extensions {
/// The relay chain of the Parachain.
pub relay_chain: String,
/// Known bad block hashes.
pub bad_blocks: sc_client_api::BadBlocks<polkadot_primitives::v2::Block>,
pub bad_blocks: sc_client_api::BadBlocks<polkadot_primitives::Block>,
}

#[cfg(feature = "parachain")]
Expand Down
8 changes: 4 additions & 4 deletions node/src/chain_spec/zeitgeist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,19 @@ use {
zeitgeist_primitives::constants::ztg::{STAKING_PTD, TOTAL_INITIAL_ZTG},
zeitgeist_runtime::{
CollatorDeposit, DefaultBlocksPerRound, DefaultCollatorCommission,
DefaultParachainBondReservePercent, EligibilityValue, MinCollatorStk, PolkadotXcmConfig,
DefaultParachainBondReservePercent, EligibilityValue, MinCandidateStk, PolkadotXcmConfig,
},
};

cfg_if::cfg_if! {
if #[cfg(feature = "parachain")] {
const DEFAULT_STAKING_AMOUNT_ZEITGEIST: u128 = MinCollatorStk::get();
const DEFAULT_STAKING_AMOUNT_ZEITGEIST: u128 = MinCandidateStk::get();
const DEFAULT_COLLATOR_BALANCE_ZEITGEIST: Option<u128> =
DEFAULT_STAKING_AMOUNT_ZEITGEIST.checked_add(CollatorDeposit::get());
const NUM_SELECTED_CANDIDATES: u32 = 8;
pub type ZeitgeistChainSpec = sc_service::GenericChainSpec<zeitgeist_runtime::GenesisConfig, Extensions>;
pub type ZeitgeistChainSpec = sc_service::GenericChainSpec<zeitgeist_runtime::RuntimeGenesisConfig, Extensions>;
} else {
pub type ZeitgeistChainSpec = sc_service::GenericChainSpec<zeitgeist_runtime::GenesisConfig>;
pub type ZeitgeistChainSpec = sc_service::GenericChainSpec<zeitgeist_runtime::RuntimeGenesisConfig>;
}
}

Expand Down
Loading

0 comments on commit 7fc38ee

Please sign in to comment.