From f37d9c1ba89937cdc06754b035c17c7b856924eb Mon Sep 17 00:00:00 2001 From: Liam Date: Wed, 11 Sep 2024 11:30:06 +0200 Subject: [PATCH] fix node dep on runtime-benchmarks --- Dockerfile | 2 +- justfile | 2 +- node/src/service.rs | 10 +++++----- scripts/build.sh | 3 +-- scripts/localnet.sh | 12 ++++++------ 5 files changed, 14 insertions(+), 15 deletions(-) diff --git a/Dockerfile b/Dockerfile index 2dd2e2370..9edb2749b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -28,7 +28,7 @@ COPY . /build WORKDIR /build # Build the project -RUN cargo build -p node-subtensor --profile production --features="runtime-benchmarks metadata-hash" --locked +RUN cargo build -p node-subtensor --profile production --features="metadata-hash" --locked # Verify the binary was produced RUN test -e /build/target/production/node-subtensor diff --git a/justfile b/justfile index f99f3913a..a753f7bb2 100644 --- a/justfile +++ b/justfile @@ -51,4 +51,4 @@ lint: production: @echo "Running cargo build with metadata-hash generation..." - cargo +{{RUSTV}} build --profile production --features="runtime-benchmarks metadata-hash" + cargo +{{RUSTV}} build --profile production --features="metadata-hash" diff --git a/node/src/service.rs b/node/src/service.rs index 9a19ae354..074530dff 100644 --- a/node/src/service.rs +++ b/node/src/service.rs @@ -36,12 +36,12 @@ impl HostFunctions for ExecutorDispatch { } impl sc_executor::NativeExecutionDispatch for ExecutorDispatch { - // Only enable the benchmarking host functions when we actually want to benchmark. - #[cfg(feature = "runtime-benchmarks")] + // Always enable runtime benchmark host functions, the genesis state + // was built with them so we're stuck with them forever. + // + // They're just a noop, never actually get used if the runtime was not compiled with + // `runtime-benchmarks`. type ExtendHostFunctions = frame_benchmarking::benchmarking::HostFunctions; - // Otherwise we only use the default Substrate host functions. - #[cfg(not(feature = "runtime-benchmarks"))] - type ExtendHostFunctions = (); fn dispatch(method: &str, data: &[u8]) -> Option> { node_subtensor_runtime::api::dispatch(method, data) diff --git a/scripts/build.sh b/scripts/build.sh index 3f588a1cc..b64c177d6 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -1,2 +1 @@ -cargo build --profile production --features "runtime-benchmarks metadata-hash" - +cargo build --profile production --features "metadata-hash" diff --git a/scripts/localnet.sh b/scripts/localnet.sh index 850a314d8..582d0478d 100755 --- a/scripts/localnet.sh +++ b/scripts/localnet.sh @@ -3,10 +3,10 @@ # Check if `--no-purge` passed as a parameter NO_PURGE=0 for arg in "$@"; do - if [ "$arg" = "--no-purge" ]; then - NO_PURGE=1 - break - fi + if [ "$arg" = "--no-purge" ]; then + NO_PURGE=1 + break + fi done # Determine the directory this script resides in. This allows invoking it from any location. @@ -25,13 +25,13 @@ if [ "$fast_blocks" == "False" ]; then echo "fast_blocks is Off" : "${CHAIN:=local}" : "${BUILD_BINARY:=1}" - : "${FEATURES:="pow-faucet runtime-benchmarks"}" + : "${FEATURES:="pow-faucet"}" else # Block of code to execute if fast_blocks is not False echo "fast_blocks is On" : "${CHAIN:=local}" : "${BUILD_BINARY:=1}" - : "${FEATURES:="pow-faucet runtime-benchmarks fast-blocks"}" + : "${FEATURES:="pow-faucet fast-blocks"}" fi SPEC_PATH="${SCRIPT_DIR}/specs/"