Skip to content

Commit 2069a48

Browse files
authored
Merge pull request #801 from opentensor/runtime-benchmarks-fix
Remove node requirement to build with `runtime-benchmarks`
2 parents 9bb0eca + 13e8c15 commit 2069a48

File tree

5 files changed

+14
-15
lines changed

5 files changed

+14
-15
lines changed

Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ COPY . /build
2828
WORKDIR /build
2929

3030
# Build the project
31-
RUN cargo build -p node-subtensor --profile production --features="runtime-benchmarks metadata-hash" --locked
31+
RUN cargo build -p node-subtensor --profile production --features="metadata-hash" --locked
3232

3333
# Verify the binary was produced
3434
RUN test -e /build/target/production/node-subtensor

justfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,4 @@ lint:
5151

5252
production:
5353
@echo "Running cargo build with metadata-hash generation..."
54-
cargo +{{RUSTV}} build --profile production --features="runtime-benchmarks metadata-hash"
54+
cargo +{{RUSTV}} build --profile production --features="metadata-hash"

node/src/service.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,12 @@ impl HostFunctions for ExecutorDispatch {
3636
}
3737

3838
impl sc_executor::NativeExecutionDispatch for ExecutorDispatch {
39-
// Only enable the benchmarking host functions when we actually want to benchmark.
40-
#[cfg(feature = "runtime-benchmarks")]
39+
// Always enable runtime benchmark host functions, the genesis state
40+
// was built with them so we're stuck with them forever.
41+
//
42+
// They're just a noop, never actually get used if the runtime was not compiled with
43+
// `runtime-benchmarks`.
4144
type ExtendHostFunctions = frame_benchmarking::benchmarking::HostFunctions;
42-
// Otherwise we only use the default Substrate host functions.
43-
#[cfg(not(feature = "runtime-benchmarks"))]
44-
type ExtendHostFunctions = ();
4545

4646
fn dispatch(method: &str, data: &[u8]) -> Option<Vec<u8>> {
4747
node_subtensor_runtime::api::dispatch(method, data)

scripts/build.sh

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
cargo build --profile production --features "runtime-benchmarks metadata-hash"
2-
1+
cargo build --profile production --features "metadata-hash"

scripts/localnet.sh

+6-6
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
# Check if `--no-purge` passed as a parameter
44
NO_PURGE=0
55
for arg in "$@"; do
6-
if [ "$arg" = "--no-purge" ]; then
7-
NO_PURGE=1
8-
break
9-
fi
6+
if [ "$arg" = "--no-purge" ]; then
7+
NO_PURGE=1
8+
break
9+
fi
1010
done
1111

1212
# Determine the directory this script resides in. This allows invoking it from any location.
@@ -25,13 +25,13 @@ if [ "$fast_blocks" == "False" ]; then
2525
echo "fast_blocks is Off"
2626
: "${CHAIN:=local}"
2727
: "${BUILD_BINARY:=1}"
28-
: "${FEATURES:="pow-faucet runtime-benchmarks"}"
28+
: "${FEATURES:="pow-faucet"}"
2929
else
3030
# Block of code to execute if fast_blocks is not False
3131
echo "fast_blocks is On"
3232
: "${CHAIN:=local}"
3333
: "${BUILD_BINARY:=1}"
34-
: "${FEATURES:="pow-faucet runtime-benchmarks fast-blocks"}"
34+
: "${FEATURES:="pow-faucet fast-blocks"}"
3535
fi
3636

3737
SPEC_PATH="${SCRIPT_DIR}/specs/"

0 commit comments

Comments
 (0)