Skip to content

Commit

Permalink
feat(pallet-market): implement benchmarks (#705)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmg-duarte authored Jan 28, 2025
1 parent bde8b24 commit 3654ab1
Show file tree
Hide file tree
Showing 17 changed files with 923 additions and 122 deletions.
26 changes: 22 additions & 4 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
types: [labeled]
push:
branches: [develop, main]
workflow_dispatch: # manual launch

concurrency:
group: ${{ github.ref }}
Expand Down Expand Up @@ -107,11 +108,12 @@ jobs:
run: cargo test --profile ci --locked -p pallet-proofs --features runtime-benchmarks -- benchmark --nocapture

- name: pallet-proofs — Run node benchmarks
run: cargo run \
run: |
cargo run \
-p polka-storage-node -r -F runtime-benchmarks -- \
benchmark pallet \
--wasm-execution=compiled \
--pallet "pallet_proofs"\
--pallet "pallet_proofs" \
--extrinsic "*" \
--steps 5 \
--repeat 1 \
Expand All @@ -121,11 +123,27 @@ jobs:
run: cargo test --profile ci --locked -p pallet-randomness --features runtime-benchmarks -- benchmark --nocapture

- name: pallet-randomness — Run node benchmarks
run: cargo run \
run: |
cargo run \
-p polka-storage-node -r -F runtime-benchmarks -- \
benchmark pallet \
--wasm-execution=compiled \
--pallet "pallet_randomness"\
--pallet "pallet_randomness" \
--extrinsic "*" \
--steps 5 \
--repeat 1 \
--template node/benchmark_template.hbs
- name: pallet-market — Run test benchmarks
run: cargo test --profile ci --locked -p pallet-market --features runtime-benchmarks -- benchmark --nocapture

- name: pallet-market — Run node benchmarks
run: |
cargo run \
-p polka-storage-node -r -F runtime-benchmarks -F testnet -- \
benchmark pallet \
--wasm-execution=compiled \
--pallet "pallet_market" \
--extrinsic "*" \
--steps 5 \
--repeat 1 \
Expand Down
3 changes: 2 additions & 1 deletion Cargo.lock

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

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ indexmap = "2.2.6"
integer-encoding = "4.0.0"
ipld-core = "0.4.1"
ipld-dagpb = "0.2.1"
itertools = "0.13.0"
# Use `use_alloc` for crates that compile to WASM
itertools = { version = "0.13.0", default-features = false }
jsonrpsee = { version = "0.24.7" }
libp2p = { version = "0.54", default-features = false }
libp2p-core = "0.42.0"
Expand Down
4 changes: 3 additions & 1 deletion node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ version = "0.0.0"
name = "polka-storage-node"

[dependencies]
polka-storage-runtime.workspace = true

clap = { features = ["derive"], workspace = true }
codec = { workspace = true, default-features = true }
color-print = { workspace = true }
Expand All @@ -33,7 +35,6 @@ futures = { workspace = true }
jsonrpsee = { features = ["server"], workspace = true }
log = { workspace = true, default-features = true }
pallet-transaction-payment-rpc = { workspace = true, default-features = true }
polka-storage-runtime.workspace = true
polkadot-cli = { features = ["rococo-native"], workspace = true, default-features = true }
polkadot-primitives = { workspace = true, default-features = true }
prometheus-endpoint = { workspace = true, default-features = true }
Expand Down Expand Up @@ -82,4 +83,5 @@ runtime-benchmarks = [
"sc-service/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
]
testnet = ["polka-storage-runtime/testnet"]
try-runtime = ["polka-storage-runtime/try-runtime", "polkadot-cli/try-runtime", "sp-runtime/try-runtime"]
41 changes: 34 additions & 7 deletions pallets/market/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,16 @@ workspace = true
targets = ["x86_64-unknown-linux-gnu"]

[dependencies]
cid = { workspace = true, default-features = false, features = ["scale-codec"] }
# Homegrown
primitives = { workspace = true, default-features = false }

# De/Encoding
codec = { workspace = true, default-features = false, features = ["derive"] }
scale-info = { workspace = true, default-features = false, features = ["derive"] }

cid = { workspace = true, default-features = false, features = ["scale-codec"] }
hex = { workspace = true, default-features = false, features = ["alloc"] }
log = { workspace = true }
multihash-codetable = { workspace = true, features = ["blake2b"] }
primitives = { workspace = true }
scale-info = { workspace = true, default-features = false, features = ["derive"] }
thiserror = { workspace = true, default-features = false }

# frame deps
Expand All @@ -32,16 +35,32 @@ frame-system = { workspace = true, default-features = false }
sp-arithmetic = { workspace = true, default-features = false }
sp-std = { workspace = true, default-features = false }

# Benchmark specific
## Homegrown
pallet-balances = { workspace = true, default-features = false, optional = true }
pallet-storage-provider = { workspace = true, default-features = false, optional = true }
## Required for .chunks()
itertools = { workspace = true, optional = true, default-features = false, features = ["use_alloc"] }
## Substrate Primitives & Friends
sp-core = { workspace = true, default_features = false, optional = true }
sp-io = { workspace = true, optional = true }
sp-keystore = { workspace = true, default-features = false, optional = true }
sp-runtime = { workspace = true, optional = true }

[dev-dependencies]
blake2b_simd = { workspace = true, default-features = true }
cid = { workspace = true, default-features = false, features = ["alloc", "scale-codec"] }
env_logger = { workspace = true }
# Homegrown
pallet-balances = { workspace = true, default-features = false }
pallet-proofs = { workspace = true, default-features = false }
pallet-storage-provider = { workspace = true, default-features = false }
primitives = { workspace = true, default-features = false, features = ["builder", "testing"] }

blake2b_simd = { workspace = true, default-features = true }
env_logger = { workspace = true }
# Just used in benchmarks but they're also considered tests
itertools = { workspace = true, default-features = false, features = ["use_alloc"] }
sp-core = { workspace = true, default-features = false }
sp-io = { workspace = true }
sp-keystore = { workspace = true, default-features = false }
sp-runtime = { workspace = true, default-features = false }

[features]
Expand All @@ -50,8 +69,16 @@ runtime-benchmarks = [
"frame-benchmarking/runtime-benchmarks",
"frame-support/runtime-benchmarks",
"frame-system/runtime-benchmarks",
"itertools",
"pallet-balances",
"pallet-storage-provider",
"primitives/builder",
"primitives/builder",
"primitives/testing",
"sp-core",
"sp-io",
"sp-keystore",
"sp-runtime",
"sp-runtime/runtime-benchmarks",
]
std = [
Expand Down
Loading

0 comments on commit 3654ab1

Please sign in to comment.