Skip to content

Commit

Permalink
Merge branch 'master' into oty-omni-bencher-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
bkontur committed Sep 22, 2024
2 parents b3e8e15 + 8735c66 commit f7bfa0a
Show file tree
Hide file tree
Showing 48 changed files with 1,410 additions and 1,399 deletions.
21 changes: 21 additions & 0 deletions .gitlab/pipeline/short-benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,27 @@ short-benchmark-westend: &short-bench
script:
- ./artifacts/polkadot benchmark pallet --chain $RUNTIME-dev --pallet "*" --extrinsic "*" --steps 2 --repeat 1

short-benchmark-rococo: &short-bench
stage: short-benchmarks
extends:
- .docker-env
- .common-refs
needs:
- job: build-short-benchmark
artifacts: true
variables:
RUNTIME: rococo
# Enable debug assertions since we are running optimized builds for testing
# but still want to have debug assertions.
RUSTFLAGS: "-C debug-assertions -D warnings"
RUST_BACKTRACE: "full"
WASM_BUILD_NO_COLOR: 1
WASM_BUILD_RUSTFLAGS: "-C debug-assertions -D warnings"
tags:
- benchmark
script:
- ./artifacts/polkadot benchmark pallet --chain $RUNTIME-dev --pallet "*" --extrinsic "*" --steps 2 --repeat 1

# run short-benchmarks for system parachain runtimes from cumulus

.short-benchmark-cumulus: &short-bench-cumulus
Expand Down
26 changes: 9 additions & 17 deletions Cargo.lock

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

8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,18 @@ curl --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/paritytec
* [Introduction](https://paritytech.github.io/polkadot-sdk/master/polkadot_sdk_docs/polkadot_sdk/index.html)
to each component of the Polkadot SDK: Substrate, FRAME, Cumulus, and XCM
* [Guides](https://paritytech.github.io/polkadot-sdk/master/polkadot_sdk_docs/guides/index.html),
namely how to build your first FRAME pallet.
namely how to build your first FRAME pallet
* [Templates](https://paritytech.github.io/polkadot-sdk/master/polkadot_sdk_docs/polkadot_sdk/templates/index.html)
for starting a new project.
* Other Resources:
for starting a new project
* Other resources:
* [Polkadot Wiki -> Build](https://wiki.polkadot.network/docs/build-guide)

## 🚀 Releases

<!-- markdownlint-disable-next-line MD013 -->
![Current Stable Release](https://raw.githubusercontent.com/paritytech/release-registry/main/badges/polkadot-sdk-latest.svg)&nbsp;&nbsp;![Next Stable Release](https://raw.githubusercontent.com/paritytech/release-registry/main/badges/polkadot-sdk-next.svg)

The Polkadot-SDK is released every three months as a `stableYYMMDD` release. They are supported for
The Polkadot SDK is released every three months as a `stableYYMMDD` release. They are supported for
one year with patches. See the next upcoming versions in the [Release
Registry](https://github.com/paritytech/release-registry/).

Expand Down
1 change: 0 additions & 1 deletion cumulus/parachains/common/src/genesis_config_helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
// limitations under the License.

//! Some common helpers for declaring runtime's presets
// note: copied from: cumulus/polkadot-parachain/src/chain_spec/mod.rs

use crate::{AccountId, Signature};
#[cfg(not(feature = "std"))]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,7 @@ pub fn genesis() -> Storage {
minimum_validator_count: 1,
stakers: validators::initial_authorities()
.iter()
.map(|x| {
(x.0.clone(), x.1.clone(), STASH, westend_runtime::StakerStatus::Validator)
})
.map(|x| (x.0.clone(), x.1.clone(), STASH, pallet_staking::StakerStatus::Validator))
.collect(),
invulnerables: validators::initial_authorities().iter().map(|x| x.0.clone()).collect(),
force_era: pallet_staking::Forcing::ForceNone,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,70 +15,58 @@

//! # Asset Hub Rococo Runtime genesis config presets

use crate::*;
use alloc::{vec, vec::Vec};
use cumulus_primitives_core::ParaId;
use hex_literal::hex;
use parachains_common::{genesis_config_helpers::*, AccountId, AuraId, Balance as AssetHubBalance};
use parachains_common::{genesis_config_helpers::*, AccountId, AuraId};
use sp_core::{crypto::UncheckedInto, sr25519};
use sp_genesis_builder::PresetId;
use testnet_parachains_constants::rococo::xcm_version::SAFE_XCM_VERSION;
use testnet_parachains_constants::rococo::{currency::UNITS as ROC, xcm_version::SAFE_XCM_VERSION};

const ASSET_HUB_ROCOCO_ED: AssetHubBalance = crate::ExistentialDeposit::get();

/// Generate the session keys from individual elements.
///
/// The input must be a tuple of individual keys (a single arg for now since we have just one key).
pub fn asset_hub_rococo_session_keys(keys: AuraId) -> crate::SessionKeys {
crate::SessionKeys { aura: keys }
}
const ASSET_HUB_ROCOCO_ED: Balance = ExistentialDeposit::get();

fn asset_hub_rococo_genesis(
invulnerables: Vec<(AccountId, AuraId)>,
endowed_accounts: Vec<AccountId>,
endowment: AssetHubBalance,
endowment: Balance,
id: ParaId,
) -> serde_json::Value {
serde_json::json!({
"balances": crate::BalancesConfig {
balances: endowed_accounts
.iter()
.cloned()
.map(|k| (k, endowment))
.collect(),
},
"parachainInfo": crate::ParachainInfoConfig {
parachain_id: id,
..Default::default()
let config = RuntimeGenesisConfig {
balances: BalancesConfig {
balances: endowed_accounts.iter().cloned().map(|k| (k, endowment)).collect(),
},
"collatorSelection": crate::CollatorSelectionConfig {
parachain_info: ParachainInfoConfig { parachain_id: id, ..Default::default() },
collator_selection: CollatorSelectionConfig {
invulnerables: invulnerables.iter().cloned().map(|(acc, _)| acc).collect(),
candidacy_bond: ASSET_HUB_ROCOCO_ED * 16,
..Default::default()
},
"session": crate::SessionConfig {
session: SessionConfig {
keys: invulnerables
.into_iter()
.map(|(acc, aura)| {
(
acc.clone(), // account id
acc, // validator id
asset_hub_rococo_session_keys(aura), // session keys
acc.clone(), // account id
acc, // validator id
SessionKeys { aura }, // session keys
)
})
.collect(),
..Default::default()
},
"polkadotXcm": crate::PolkadotXcmConfig {
polkadot_xcm: PolkadotXcmConfig {
safe_xcm_version: Some(SAFE_XCM_VERSION),
..Default::default()
}
})
},
..Default::default()
};

serde_json::to_value(config).expect("Could not build genesis config.")
}

/// Encapsulates names of predefined presets.
mod preset_names {
pub const PRESET_DEVELOPMENT: &str = "development";
pub const PRESET_LOCAL: &str = "local";
pub const PRESET_GENESIS: &str = "genesis";
}

Expand Down Expand Up @@ -118,7 +106,7 @@ pub fn get_preset(id: &PresetId) -> Option<Vec<u8>> {
ASSET_HUB_ROCOCO_ED * 524_288,
1000.into(),
),
Ok(PRESET_LOCAL) => asset_hub_rococo_genesis(
Ok(sp_genesis_builder::LOCAL_TESTNET_RUNTIME_PRESET) => asset_hub_rococo_genesis(
// initial collators.
vec![
(
Expand All @@ -144,10 +132,10 @@ pub fn get_preset(id: &PresetId) -> Option<Vec<u8>> {
get_account_id_from_seed::<sr25519::Public>("Eve//stash"),
get_account_id_from_seed::<sr25519::Public>("Ferdie//stash"),
],
testnet_parachains_constants::rococo::currency::UNITS * 1_000_000,
ROC * 1_000_000,
1000.into(),
),
Ok(PRESET_DEVELOPMENT) => asset_hub_rococo_genesis(
Ok(sp_genesis_builder::DEV_RUNTIME_PRESET) => asset_hub_rococo_genesis(
// initial collators.
vec![(
get_account_id_from_seed::<sr25519::Public>("Alice"),
Expand All @@ -159,10 +147,10 @@ pub fn get_preset(id: &PresetId) -> Option<Vec<u8>> {
get_account_id_from_seed::<sr25519::Public>("Alice//stash"),
get_account_id_from_seed::<sr25519::Public>("Bob//stash"),
],
testnet_parachains_constants::rococo::currency::UNITS * 1_000_000,
ROC * 1_000_000,
1000.into(),
),
Err(_) | Ok(_) => return None,
_ => return None,
};

Some(
Expand All @@ -177,7 +165,7 @@ pub fn preset_names() -> Vec<PresetId> {
use preset_names::*;
vec![
PresetId::from(PRESET_GENESIS),
PresetId::from(PRESET_DEVELOPMENT),
PresetId::from(PRESET_LOCAL),
PresetId::from(sp_genesis_builder::DEV_RUNTIME_PRESET),
PresetId::from(sp_genesis_builder::LOCAL_TESTNET_RUNTIME_PRESET),
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ use cumulus_pallet_parachain_system::RelayNumberMonotonicallyIncreases;
use cumulus_primitives_core::AggregateMessageOrigin;
use sp_api::impl_runtime_apis;
use sp_core::{crypto::KeyTypeId, OpaqueMetadata};
use sp_genesis_builder::PresetId;
use sp_runtime::{
create_runtime_str, generic, impl_opaque_keys,
traits::{AccountIdConversion, BlakeTwo256, Block as BlockT, Saturating, Verify},
Expand Down Expand Up @@ -1765,11 +1764,11 @@ impl_runtime_apis! {
build_state::<RuntimeGenesisConfig>(config)
}

fn get_preset(id: &Option<PresetId>) -> Option<Vec<u8>> {
fn get_preset(id: &Option<sp_genesis_builder::PresetId>) -> Option<Vec<u8>> {
get_preset::<RuntimeGenesisConfig>(id, &genesis_config_presets::get_preset)
}

fn preset_names() -> Vec<PresetId> {
fn preset_names() -> Vec<sp_genesis_builder::PresetId> {
genesis_config_presets::preset_names()
}
}
Expand Down
Loading

0 comments on commit f7bfa0a

Please sign in to comment.