Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Short benchmarking in CI with frame-omni-bencher + extract chain-spec-builder stuff to get_preset #379

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
12c84fd
PoC for short benchmarking in CI with `frame-omni-bencher`
bkontur Apr 30, 2024
7c20fd9
Download `frame-omni-bencher` from release artifacts
bkontur May 29, 2024
143d09a
Change bencher from 11 to 13
bkontur Jun 26, 2024
87dd772
Set `get_preset` for BridgeHubKusama
bkontur Jun 26, 2024
8793672
Set `get_preset` for BridgeHubPolkadot
bkontur Jul 12, 2024
26061e1
Clean up chain-spec-generator for BridgeHubKusama
bkontur Jul 12, 2024
255e670
Set `get_preset` for CollectivesPolkadot
bkontur Jul 16, 2024
32e958b
Set `get_preset` for AssetHubs
bkontur Jul 17, 2024
b39eabc
Set `get_preset` for CoretimeKusama
bkontur Jul 17, 2024
36170a3
Set `get_preset` for Encointer
bkontur Jul 17, 2024
7b12737
Set `get_preset` for GluttonKusama
bkontur Jul 17, 2024
5c0b9b0
Set `get_preset` for People*
bkontur Jul 17, 2024
c00d688
More chain-spec-generator clean up
bkontur Jul 17, 2024
7a8fb15
Nits
bkontur Jul 17, 2024
c6997c3
Clippy
bkontur Jul 17, 2024
21e9895
More chain-spec-generator clean up
bkontur Jul 17, 2024
df53a95
Set `get_preset` for Kusama/Polkadot + chain-spec-generator clean up …
bkontur Jul 17, 2024
c05940e
taplo
bkontur Jul 17, 2024
18adcbc
Clippy
bkontur Jul 17, 2024
1398b62
Fix collectives-polkadot benchmarks
bkontur Jul 18, 2024
7cce007
Merge branch 'main' into bko-short-benchmarks-get_preset
bkontur Jul 19, 2024
4fb1acf
Update .github/workflows/test.yml
bkontur Jul 23, 2024
5e652c2
Update system-parachains/collectives/collectives-polkadot/src/impls.rs
bkontur Jul 23, 2024
ebe3101
Merge remote-tracking branch 'polkadot-fellows/main' into bko-short-b…
bkontur Jul 23, 2024
537f6e8
Merge branch 'main' into bko-short-benchmarks-get_preset
bkchr Jul 24, 2024
7c05a7a
Removed `get_authority_keys_from_seed_no_beefy`
bkontur Jul 24, 2024
38b8918
Merge remote-tracking branch 'polkadot-fellows/main' into bko-short-b…
bkontur Jul 24, 2024
ebea1ac
Merge branch 'main' into bko-short-benchmarks-get_preset
bkontur Jul 24, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ on:
pull_request:
workflow_dispatch:

env:
FRAME_OMNI_BENCHER_RELEASE_VERSION: polkadot-v1.13.0

# cancel previous runs
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
Expand Down Expand Up @@ -82,6 +85,13 @@ jobs:
with:
shared-key: "fellowship-cache-tests"

- name: Download frame-omni-bencher
run: |
curl -sL https://github.com/paritytech/polkadot-sdk/releases/download/$FRAME_OMNI_BENCHER_RELEASE_VERSION/frame-omni-bencher -o frame-omni-bencher
chmod +x ./frame-omni-bencher
./frame-omni-bencher --version
shell: bash

- name: Test ${{ matrix.runtime.name }}
run: cargo test -p ${{ matrix.runtime.package }} --release --locked -q
env:
Expand All @@ -93,6 +103,20 @@ jobs:
RUSTFLAGS: "-C debug-assertions -D warnings"
SKIP_WASM_BUILD: 1

- name: Test benchmarks ${{ matrix.runtime.name }}
run: |
PACKAGE_NAME=${{ matrix.runtime.package }}
RUNTIME_BLOB_NAME=$(echo $PACKAGE_NAME | sed 's/-/_/g').compact.compressed.wasm
RUNTIME_BLOB_PATH=./target/production/wbuild/$PACKAGE_NAME/$RUNTIME_BLOB_NAME
# build wasm
echo "Preparing wasm for benchmarking RUNTIME_BLOB_PATH=$RUNTIME_BLOB_PATH"
cargo build --profile production -p ${{ matrix.runtime.package }} --features=runtime-benchmarks -q --locked
# run benchmarking
echo "Running benchmarking for RUNTIME_BLOB_PATH=$RUNTIME_BLOB_PATH"
./frame-omni-bencher v1 benchmark pallet --runtime $RUNTIME_BLOB_PATH --all --steps 2 --repeat 1
env:
RUSTFLAGS: "-C debug-assertions -D warnings"

# Job required by "confirmTestPassed"
integration-test:
needs: [integration-test-matrix]
Expand Down
29 changes: 13 additions & 16 deletions Cargo.lock

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

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ sc-chain-spec = { version = "34.0.0" }
scale-info = { version = "2.10.0", default-features = false }
separator = { version = "0.4.1" }
serde = { version = "1.0.196" }
serde_json = { version = "1.0.113" }
serde_json = { version = "1.0.113", default-features = false }
smallvec = { version = "1.13.1" }
snowbridge-beacon-primitives = { version = "0.7.0", default-features = false }
snowbridge-core = { version = "0.7.0", default-features = false }
Expand Down Expand Up @@ -271,6 +271,7 @@ members = [
"integration-tests/emulated/tests/coretime/coretime-kusama",
"integration-tests/emulated/tests/people/people-kusama",
"integration-tests/emulated/tests/people/people-polkadot",
"integration-tests/zombienet",
"relay/kusama",
"relay/kusama/constants",
"relay/polkadot",
Expand All @@ -291,7 +292,6 @@ members = [
"system-parachains/gluttons/glutton-kusama",
"system-parachains/people/people-kusama",
"system-parachains/people/people-polkadot",
"integration-tests/zombienet",
]

[profile.release]
Expand Down
21 changes: 0 additions & 21 deletions chain-spec-generator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,9 @@ serde_json = { workspace = true }
serde = { features = ["derive"], workspace = true }

polkadot-runtime = { workspace = true }
bkontur marked this conversation as resolved.
Show resolved Hide resolved
polkadot-runtime-constants = { workspace = true, default-features = true }
kusama-runtime = { workspace = true }
kusama-runtime-constants = { workspace = true, default-features = true }

sc-chain-spec = { workspace = true }
runtime-parachains = { default-features = true, workspace = true }
polkadot-primitives = { workspace = true, default-features = true }
babe-primitives = { workspace = true, default-features = true }
authority-discovery-primitives = { workspace = true, default-features = true }
sp-core = { workspace = true, default-features = true }
pallet-staking = { workspace = true, default-features = true }
grandpa = { workspace = true }
sp-runtime = { workspace = true, default-features = true }
beefy-primitives = { workspace = true, default-features = true }
xcm = { workspace = true, default-features = true }
parachains-common = { workspace = true, default-features = true }
cumulus-primitives-core = { workspace = true, default-features = true }

asset-hub-polkadot-runtime = { workspace = true }
asset-hub-kusama-runtime = { workspace = true }
Expand All @@ -50,17 +36,10 @@ runtime-benchmarks = [
"bridge-hub-polkadot-runtime/runtime-benchmarks",
"collectives-polkadot-runtime/runtime-benchmarks",
"coretime-kusama-runtime/runtime-benchmarks",
"cumulus-primitives-core/runtime-benchmarks",
"encointer-kusama-runtime/runtime-benchmarks",
"glutton-kusama-runtime/runtime-benchmarks",
"kusama-runtime/runtime-benchmarks",
"pallet-staking/runtime-benchmarks",
"parachains-common/runtime-benchmarks",
"people-kusama-runtime/runtime-benchmarks",
"people-polkadot-runtime/runtime-benchmarks",
"polkadot-primitives/runtime-benchmarks",
"polkadot-runtime/runtime-benchmarks",
"runtime-parachains/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
"encointer-kusama-runtime/runtime-benchmarks"
]
42 changes: 5 additions & 37 deletions chain-spec-generator/src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,46 +19,12 @@ use crate::{
relay_chain_specs::{KusamaChainSpec, PolkadotChainSpec},
system_parachains_specs::{
AssetHubKusamaChainSpec, AssetHubPolkadotChainSpec, BridgeHubKusamaChainSpec,
BridgeHubPolkadotChainSpec, CollectivesPolkadotChainSpec, EncointerKusamaChainSpec,
GluttonKusamaChainSpec, PeopleKusamaChainSpec, PeoplePolkadotChainSpec,
BridgeHubPolkadotChainSpec, CollectivesPolkadotChainSpec, CoretimeKusamaChainSpec,
EncointerKusamaChainSpec, GluttonKusamaChainSpec, PeopleKusamaChainSpec,
PeoplePolkadotChainSpec,
},
ChainSpec,
};
use polkadot_primitives::{AccountId, AccountPublic};
use sp_core::{sr25519, Pair, Public};
use sp_runtime::traits::IdentifyAccount;

pub fn testnet_accounts() -> Vec<AccountId> {
vec![
get_account_id_from_seed::<sr25519::Public>("Alice"),
get_account_id_from_seed::<sr25519::Public>("Bob"),
get_account_id_from_seed::<sr25519::Public>("Charlie"),
get_account_id_from_seed::<sr25519::Public>("Dave"),
get_account_id_from_seed::<sr25519::Public>("Eve"),
get_account_id_from_seed::<sr25519::Public>("Ferdie"),
get_account_id_from_seed::<sr25519::Public>("Alice//stash"),
get_account_id_from_seed::<sr25519::Public>("Bob//stash"),
get_account_id_from_seed::<sr25519::Public>("Charlie//stash"),
get_account_id_from_seed::<sr25519::Public>("Dave//stash"),
get_account_id_from_seed::<sr25519::Public>("Eve//stash"),
get_account_id_from_seed::<sr25519::Public>("Ferdie//stash"),
]
}

/// Helper function to generate a crypto pair from seed
pub fn get_from_seed<TPublic: Public>(seed: &str) -> <TPublic::Pair as Pair>::Public {
TPublic::Pair::from_string(&format!("//{}", seed), None)
.expect("static values are valid; qed")
.public()
}

/// Helper function to generate an account ID from seed
pub fn get_account_id_from_seed<TPublic: Public>(seed: &str) -> AccountId
where
AccountPublic: From<<TPublic::Pair as Pair>::Public>,
{
AccountPublic::from(get_from_seed::<TPublic>(seed)).into_account()
}

#[derive(Debug, serde::Deserialize)]
struct EmptyChainSpecWithId {
Expand Down Expand Up @@ -86,6 +52,8 @@ pub fn from_json_file(filepath: &str, supported: String) -> Result<Box<dyn Chain
Ok(Box::new(BridgeHubPolkadotChainSpec::from_json_file(path)?)),
x if x.starts_with("bridge-hub-kusama") =>
Ok(Box::new(BridgeHubKusamaChainSpec::from_json_file(path)?)),
x if x.starts_with("coretime-kusama") =>
Ok(Box::new(CoretimeKusamaChainSpec::from_json_file(path)?)),
x if x.starts_with("glutton-kusama") =>
Ok(Box::new(GluttonKusamaChainSpec::from_json_file(path)?)),
x if x.starts_with("encointer-kusama") =>
Expand Down
Loading
Loading