From 182b4f42b4170e89a6996b7396fe23dc72cd01d3 Mon Sep 17 00:00:00 2001 From: Juan Ignacio Rios <54085674+JuaniRios@users.noreply.github.com> Date: Tue, 10 Sep 2024 10:40:36 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=99=85=F0=9F=8F=BB=E2=80=8D=E2=99=82?= =?UTF-8?q?=EF=B8=8F=20Hide=20instantiator=20behind=20feature=20flag=20(#3?= =?UTF-8?q?89)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## What? When on-chain-release-build feature is used, don't compile the instantiator ## Why? Makes the runtime smaller ## Testing - Successfully ran pallet tests, integration tests, benchmark tests, dry-run-benches, and srtool wasm --- pallets/funding/Cargo.toml | 1 + pallets/funding/src/lib.rs | 3 +-- runtimes/polimec/Cargo.toml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pallets/funding/Cargo.toml b/pallets/funding/Cargo.toml index a3895b2b7..430f2fa90 100644 --- a/pallets/funding/Cargo.toml +++ b/pallets/funding/Cargo.toml @@ -124,3 +124,4 @@ try-runtime = [ "polimec-common/try-runtime", "sp-runtime/try-runtime", ] +on-chain-release-build = [] diff --git a/pallets/funding/src/lib.rs b/pallets/funding/src/lib.rs index 341034cc5..8c49ca64d 100644 --- a/pallets/funding/src/lib.rs +++ b/pallets/funding/src/lib.rs @@ -109,8 +109,7 @@ pub mod mock; #[cfg(test)] pub mod tests; -// TODO: This is used only in tests. Should we use #[cfg(test)]? -// If we do that the integration-tests will complain about the missing `use` statement :( +#[cfg(not(feature = "on-chain-release-build"))] pub mod instantiator; #[cfg(feature = "runtime-benchmarks")] diff --git a/runtimes/polimec/Cargo.toml b/runtimes/polimec/Cargo.toml index 94e923340..acdfc9a5a 100644 --- a/runtimes/polimec/Cargo.toml +++ b/runtimes/polimec/Cargo.toml @@ -275,6 +275,6 @@ 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" ] +on-chain-release-build = [ "sp-api/disable-logging", "pallet-funding/on-chain-release-build" ] development-settings = [ "shared-configuration/development-settings" ]