-
Notifications
You must be signed in to change notification settings - Fork 2
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
Feat/benchmarks refactor #160
Merged
Merged
Changes from 8 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
c7245b5
feat: add ElectionsConfig in Genesis
lrazovic a29356d
feat: add pallet_elections_phragmen to the bechmark CLI
lrazovic a351da4
fmt
lrazovic db71cfe
feat: refactor the justfile
lrazovic a4df7f0
feat: align the flags with the sdk
lrazovic 0e8fef7
feat: use the production chain
lrazovic 644dc01
chore: fix toml metadata
lrazovic 24ea013
feat: give to the endowed accounts enough balance
lrazovic 34c95a5
feat: add all the pallets in the define_benchmarks! macro
lrazovic a7928b7
chore: update doc
lrazovic File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,100 +1,59 @@ | ||
# Help information | ||
default: | ||
@just --list | ||
|
||
# Build everything | ||
build-all: | ||
cargo build --release | ||
|
||
# Build the "Base" Runtime | ||
build-base-runtime: | ||
cargo build --release -p polimec-base-runtime | ||
|
||
# Build the "Testnet" Runtime | ||
build-parachain-runtime: | ||
cargo build --release -p polimec-parachain-runtime | ||
|
||
# Build the "Parachain" Node | ||
build-parachain-node: | ||
cargo build --release -p polimec-parachain-node | ||
@just --list | ||
|
||
# Build the "Base" Runtime using srtool | ||
build-base-srtool: | ||
srtool build --root -p polimec-base-runtime --runtime-dir runtimes/base --build-opts="--features=on-chain-release-build" | ||
srtool build --root -p polimec-base-runtime --runtime-dir runtimes/base --build-opts="--features=on-chain-release-build" | ||
|
||
# Build the "Testnet" Runtime using srtool | ||
build-parachain-srtool: | ||
srtool build --root -p polimec-parachain-runtime --runtime-dir runtimes/testnet | ||
|
||
# Test the runtimes features | ||
test-runtime-features: | ||
cargo test --features runtime-benchmarks -p polimec-parachain-runtime | ||
cargo test --features runtime-benchmarks -p polimec-parachain-runtime | ||
|
||
# Run the integration tests | ||
test-integration: | ||
cargo test -p integration-tests | ||
|
||
cargo test -p integration-tests | ||
|
||
# Run the Runtime benchmarks | ||
# src: https://github.com/polkadot-fellows/runtimes/blob/48ccfae6141d2924f579d81e8b1877efd208693f/system-parachains/asset-hubs/asset-hub-polkadot/src/weights/cumulus_pallet_xcmp_queue.rs | ||
benchmark-runtime pallet="pallet-elections-phragmen" features="runtime-benchmarks": | ||
cargo run --features {{ features }} --release -p polimec-parachain-node benchmark pallet \ | ||
--chain=base-polkadot \ | ||
--steps=50 \ | ||
--repeat=20 \ | ||
--pallet={{ pallet }} \ | ||
--extrinsic=* \ | ||
--wasm-execution=compiled \ | ||
--heap-pages=4096 \ | ||
--output=runtimes/base/src/weights/{{ replace(pallet, "-", "_") }}.rs | ||
|
||
# Benchmark the "Testnet" Runtime | ||
benchmark-runtime-funding: | ||
cargo run --features runtime-benchmarks --release -p polimec-parachain-node benchmark pallet \ | ||
--chain=polimec-rococo-local \ | ||
--steps=50 \ | ||
--repeat=20 \ | ||
--pallet=pallet_funding \ | ||
--extrinsic '*' \ | ||
--wasm-execution=compiled \ | ||
--heap-pages=4096 \ | ||
--output=runtimes/testnet/src/weights/pallet_funding.rs | ||
|
||
|
||
# Benchmark the "Testnet" Runtime | ||
benchmark-runtime-linear-release: | ||
cargo run --features runtime-benchmarks --release -p polimec-parachain-node benchmark pallet \ | ||
--chain=polimec-rococo-local \ | ||
--steps=50 \ | ||
--repeat=20 \ | ||
--pallet=pallet_linear_release \ | ||
--extrinsic '*' \ | ||
--wasm-execution=compiled \ | ||
--heap-pages=4096 \ | ||
--output=runtimes/testnet/src/weights/pallet_linear_release.rs | ||
|
||
# Benchmark the "Testnet" Runtime | ||
benchmark-pallet-funding: | ||
cargo run --features runtime-benchmarks,fast-mode --release -p polimec-parachain-node benchmark pallet \ | ||
--chain=polimec-rococo-local \ | ||
--steps=50 \ | ||
--repeat=20 \ | ||
--pallet=pallet_funding \ | ||
--extrinsic '*' \ | ||
--heap-pages=4096 \ | ||
--output=pallets/funding/src/weights-test.rs \ | ||
--template=./.maintain/frame-weight-template.hbs | ||
|
||
benchmark-pallet-linear-release: | ||
cargo run --features runtime-benchmarks,fast-mode --release -p polimec-parachain-node benchmark pallet \ | ||
--chain=polimec-rococo-local \ | ||
--steps=50 \ | ||
--repeat=20 \ | ||
--pallet=pallet_linear_release \ | ||
--extrinsic '*' \ | ||
--heap-pages=4096 \ | ||
--output=pallets/linear-release/src/weights.rs \ | ||
--template=./.maintain/frame-weight-template.hbs | ||
|
||
benchmarks-test: | ||
cargo test --features runtime-benchmarks -p pallet-funding benchmarks | ||
|
||
# src: https://github.com/paritytech/polkadot-sdk/blob/bc2e5e1fe26e2c2c8ee766ff9fe7be7e212a0c62/substrate/frame/nfts/src/weights.rs | ||
benchmark-pallet pallet="pallet-elections-phragmen" features="runtime-benchmarks": | ||
cargo run --features {{ features }} --release -p polimec-parachain-node benchmark pallet \ | ||
--chain=base-polkadot \ | ||
--steps=50 \ | ||
--repeat=20 \ | ||
--pallet={{ pallet }} \ | ||
--no-storage-info \ | ||
--no-median-slopes \ | ||
--no-min-squares \ | ||
--extrinsic '*' \ | ||
--wasm-execution=compiled \ | ||
--heap-pages=4096 \ | ||
--output=pallets/{{ replace(pallet, "pallet-", "") }}/src/weights.rs \ | ||
--template=./.maintain/frame-weight-template.hbs | ||
|
||
# Build the Node Docker Image | ||
docker-build tag = "latest" package= "polimec-parachain-node": | ||
./scripts/build_image.sh {{tag}} ./Dockerfile {{package}} | ||
docker-build tag="latest" package="polimec-parachain-node": | ||
./scripts/build_image.sh {{ tag }} ./Dockerfile {{ package }} | ||
|
||
# Create the "Base" Runtime Chainspec | ||
create-chainspec-base: | ||
./scripts/create_base_chain_spec.sh ./runtimes/base/target/srtool/release/wbuild/polimec-base-runtime/polimec_base_runtime.compact.compressed.wasm 2105 | ||
./scripts/create_base_chain_spec.sh ./runtimes/base/target/srtool/release/wbuild/polimec-base-runtime/polimec_base_runtime.compact.compressed.wasm 2105 | ||
|
||
# Use zombienet to spawn rococo + polimec testnet | ||
zombienet path_to_file = "scripts/zombienet/native/base-rococo-local.toml": | ||
zombienet spawn {{path_to_file}} | ||
zombienet path_to_file="scripts/zombienet/native/base-rococo-local.toml": | ||
zombienet spawn {{ path_to_file }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A genesis config is required to start the benchmarks.