Skip to content

Commit

Permalink
Chore/optimize size (#151)
Browse files Browse the repository at this point in the history
* chore: strip debuginfo

* chore: disable logging when we build the production runtime

* chore: zepter format the tomls
  • Loading branch information
lrazovic authored Jan 24, 2024
1 parent 2cedd52 commit 68ea0b3
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 21 deletions.
2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ version = "0.4.0"
# Substrate runtime requires unwinding.
panic = "unwind"
opt-level = 3
strip = "debuginfo"


[profile.dev]
split-debuginfo = "unpacked"
Expand Down
6 changes: 3 additions & 3 deletions integration-tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ std = [
"parachains-common/std",
"parity-scale-codec/std",
"penpal-runtime/std",
"polimec-common/std",
"polimec-parachain-runtime/std",
"polimec-receiver/std",
"polkadot-core-primitives/std",
Expand All @@ -115,7 +116,6 @@ std = [
"xcm-builder/std",
"xcm-executor/std",
"xcm/std",
"polimec-common/std"
]

runtime-benchmarks = [
Expand All @@ -137,6 +137,7 @@ runtime-benchmarks = [
"pallet-xcm/runtime-benchmarks",
"penpal-runtime/runtime-benchmarks",
"polimec-base-runtime/runtime-benchmarks",
"polimec-common/runtime-benchmarks",
"polimec-parachain-runtime/runtime-benchmarks",
"polimec-receiver/runtime-benchmarks",
"polkadot-parachain/runtime-benchmarks",
Expand All @@ -147,7 +148,6 @@ runtime-benchmarks = [
"sp-runtime/runtime-benchmarks",
"xcm-builder/runtime-benchmarks",
"xcm-executor/runtime-benchmarks",
"polimec-common/runtime-benchmarks"
]
try-runtime = [
"asset-hub-polkadot-runtime/try-runtime",
Expand All @@ -170,9 +170,9 @@ try-runtime = [
"parachain-info/try-runtime",
"penpal-runtime/try-runtime",
"polimec-base-runtime/try-runtime",
"polimec-common/try-runtime",
"polimec-parachain-runtime/try-runtime",
"polimec-receiver/try-runtime",
"polimec-common/try-runtime",
"polkadot-runtime-parachains/try-runtime",
"polkadot-runtime/try-runtime",
"polkadot-service/try-runtime",
Expand Down
4 changes: 2 additions & 2 deletions integration-tests/penpal/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ std = [
"pallet-xcm/std",
"parachain-info/std",
"parachains-common/std",
"polimec-common/std",
"polimec-receiver/std",
"polkadot-parachain/std",
"polkadot-primitives/std",
Expand All @@ -137,7 +138,6 @@ std = [
"xcm-builder/std",
"xcm-executor/std",
"xcm/std",
"polimec-common/std"
]

runtime-benchmarks = [
Expand All @@ -157,6 +157,7 @@ runtime-benchmarks = [
"pallet-timestamp/runtime-benchmarks",
"pallet-vesting/runtime-benchmarks",
"pallet-xcm/runtime-benchmarks",
"polimec-common/runtime-benchmarks",
"polimec-receiver/runtime-benchmarks",
"polkadot-parachain/runtime-benchmarks",
"polkadot-primitives/runtime-benchmarks",
Expand All @@ -165,7 +166,6 @@ runtime-benchmarks = [
"sp-runtime/runtime-benchmarks",
"xcm-builder/runtime-benchmarks",
"xcm-executor/runtime-benchmarks",
"polimec-common/runtime-benchmarks"
]

try-runtime = [
Expand Down
2 changes: 1 addition & 1 deletion justfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ build-parachain-node:

# Build the "Base" Runtime using srtool
build-base-srtool:
srtool build --root -p polimec-base-runtime --runtime-dir runtimes/base
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:
Expand Down
13 changes: 6 additions & 7 deletions pallets/funding/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,12 @@ assert_matches2.workspace = true
xcm-executor.workspace = true

[features]
default = ["std"]
default = [ "std" ]
std = [
"frame-benchmarking?/std",
"frame-support/std",
"frame-system/std",
"futures",
"itertools/use_std",
"log/std",
"pallet-assets/std",
Expand All @@ -77,8 +78,8 @@ std = [
"pallet-xcm/std",
"parachains-common/std",
"parity-scale-codec/std",
"polimec-receiver/std",
"polimec-common/std",
"polimec-receiver/std",
"polimec-xcm-executor/std",
"polkadot-parachain/std",
"polkadot-runtime-parachains/std",
Expand All @@ -90,11 +91,10 @@ std = [
"sp-io/std",
"sp-runtime/std",
"sp-std/std",
"tokio",
"xcm-builder/std",
"xcm-executor/std",
"xcm/std",
"tokio",
"futures",
]
runtime-benchmarks = [
"frame-benchmarking/runtime-benchmarks",
Expand All @@ -106,16 +106,15 @@ runtime-benchmarks = [
"pallet-linear-release/runtime-benchmarks",
"pallet-timestamp/runtime-benchmarks",
"pallet-xcm/runtime-benchmarks",
"polimec-receiver/runtime-benchmarks",
"polimec-common/runtime-benchmarks",
"polimec-receiver/runtime-benchmarks",
"polimec-xcm-executor/runtime-benchmarks",
"polkadot-parachain/runtime-benchmarks",
"polkadot-runtime-parachains/runtime-benchmarks",
"polkadot-runtime/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
"xcm-builder/runtime-benchmarks",
"xcm-executor/runtime-benchmarks",
"pallet-xcm/runtime-benchmarks"
]
try-runtime = [
"frame-support/try-runtime",
Expand All @@ -126,8 +125,8 @@ try-runtime = [
"pallet-linear-release/try-runtime",
"pallet-timestamp/try-runtime",
"pallet-xcm/try-runtime",
"polimec-receiver/try-runtime",
"polimec-common/try-runtime",
"polimec-receiver/try-runtime",
"polkadot-runtime-parachains/try-runtime",
"polkadot-runtime/try-runtime",
"sp-runtime/try-runtime",
Expand Down
2 changes: 1 addition & 1 deletion pallets/linear-release/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ std = [
"parity-scale-codec/std",
"polimec-common/std",
"scale-info/std",
"serde/std",
"sp-core/std",
"sp-io/std",
"sp-runtime/std",
"sp-std/std",
"xcm-builder?/std",
"serde/std"
]
runtime-benchmarks = [
"frame-benchmarking/runtime-benchmarks",
Expand Down
4 changes: 2 additions & 2 deletions pallets/parachain-staking/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ std = [
"pallet-session/std",
"pallet-timestamp/std",
"parity-scale-codec/std",
"polimec-common/std",
"scale-info/std",
"serde/std",
"sp-consensus-aura/std",
Expand All @@ -64,7 +65,6 @@ std = [
"sp-staking/std",
"sp-std/std",
"substrate-fixed/std",
"polimec-common/std"
]
runtime-benchmarks = [
"frame-benchmarking",
Expand All @@ -73,9 +73,9 @@ runtime-benchmarks = [
"frame-system/runtime-benchmarks",
"pallet-balances/runtime-benchmarks",
"pallet-timestamp/runtime-benchmarks",
"polimec-common/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
"sp-staking/runtime-benchmarks",
"polimec-common/runtime-benchmarks"
]
try-runtime = [
"frame-support/try-runtime",
Expand Down
9 changes: 7 additions & 2 deletions runtimes/base/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ std = [
"pallet-authorship/std",
"pallet-balances/std",
"pallet-membership/std",
"pallet-oracle-ocw/std",
"pallet-multisig/std",
"pallet-oracle-ocw/std",
"pallet-parachain-staking/std",
"pallet-proxy/std",
"pallet-session/std",
Expand Down Expand Up @@ -201,8 +201,8 @@ try-runtime = [
"pallet-authorship/try-runtime",
"pallet-balances/try-runtime",
"pallet-membership/try-runtime",
"pallet-oracle-ocw/try-runtime",
"pallet-multisig/try-runtime",
"pallet-oracle-ocw/try-runtime",
"pallet-parachain-staking/try-runtime",
"pallet-proxy/try-runtime",
"pallet-session/try-runtime",
Expand All @@ -219,3 +219,8 @@ try-runtime = [
"shared-configuration/try-runtime",
"sp-runtime/try-runtime",
]

# A feature that should be enabled when the runtime should be built for on-chain
# deployment. This will disable stuff that shouldn't be part of the on-chain wasm
# to make it smaller, like logging for example.
on-chain-release-build = [ "sp-api/disable-logging" ]
6 changes: 3 additions & 3 deletions runtimes/testnet/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -148,11 +148,11 @@ std = [
"parachain-info/std",
"parachains-common/std",
"parity-scale-codec/std",
"polimec-common/std",
"polimec-xcm-executor/std",
"polkadot-parachain/std",
"polkadot-primitives/std",
"polkadot-runtime-common/std",
"polimec-common/std",
"scale-info/std",
"serde/std",
"shared-configuration/std",
Expand Down Expand Up @@ -200,11 +200,11 @@ runtime-benchmarks = [
"pallet-utility/runtime-benchmarks",
"pallet-vesting/runtime-benchmarks",
"pallet-xcm/runtime-benchmarks",
"polimec-common/runtime-benchmarks",
"polimec-xcm-executor/runtime-benchmarks",
"polkadot-parachain/runtime-benchmarks",
"polkadot-primitives/runtime-benchmarks",
"polkadot-runtime-common/runtime-benchmarks",
"polimec-common/runtime-benchmarks",
"shared-configuration/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
"xcm-builder/runtime-benchmarks",
Expand Down Expand Up @@ -249,9 +249,9 @@ try-runtime = [
"pallet-vesting/try-runtime",
"pallet-xcm/try-runtime",
"parachain-info/try-runtime",
"polimec-common/try-runtime",
"polimec-xcm-executor/try-runtime",
"polkadot-runtime-common/try-runtime",
"polimec-common/try-runtime",
"shared-configuration/try-runtime",
"sp-runtime/try-runtime",
]

0 comments on commit 68ea0b3

Please sign in to comment.