Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restoring disable-runtime-api for test chains #4325

Closed
wants to merge 12 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions polkadot/runtime/rococo/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,9 @@ try-runtime = [
# Enable the metadata hash generation in the wasm builder.
metadata-hash = ["substrate-wasm-builder/metadata-hash"]

# If enabled, the runtime apis will not be exposed by the runtime.
disable-runtime-api = []
bolajahmad marked this conversation as resolved.
Show resolved Hide resolved

# Set timing constants (e.g. session period) to faster versions to speed up testing.
fast-runtime = ["rococo-runtime-constants/fast-runtime"]

Expand Down
2 changes: 2 additions & 0 deletions polkadot/runtime/rococo/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
authoring_version: 0,
spec_version: 1_015_000,
impl_version: 0,
#[cfg(not(feature = "disable-runtime-api"))]
apis: RUNTIME_API_VERSIONS,
transaction_version: 26,
state_version: 1,
Expand Down Expand Up @@ -1768,6 +1769,7 @@ mod benches {
);
}

#[cfg(not(feature = "disable-runtime-api"))]
sp_api::impl_runtime_apis! {
impl sp_api::Core<Block> for Runtime {
fn version() -> RuntimeVersion {
Expand Down
3 changes: 3 additions & 0 deletions polkadot/runtime/westend/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,9 @@ try-runtime = [
# Enable the metadata hash generation in the wasm builder.
metadata-hash = ["substrate-wasm-builder/metadata-hash"]

# If enabled, the runtime apis will not be exposed by the runtime.
disable-runtime-api = []

# Set timing constants (e.g. session period) to faster versions to speed up testing.
fast-runtime = []

Expand Down
7 changes: 5 additions & 2 deletions polkadot/runtime/westend/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
authoring_version: 2,
spec_version: 1_015_000,
impl_version: 0,
#[cfg(not(feature = "disable-runtime-api"))]
apis: RUNTIME_API_VERSIONS,
transaction_version: 26,
state_version: 1,
Expand Down Expand Up @@ -208,12 +209,12 @@ impl frame_system::Config for Runtime {
type BaseCallFilter = EverythingBut<IsIdentityCall>;
type BlockWeights = BlockWeights;
type BlockLength = BlockLength;
type DbWeight = RocksDbWeight;
type Nonce = Nonce;
type Hash = Hash;
type AccountId = AccountId;
type Block = Block;
type BlockHashCount = BlockHashCount;
type DbWeight = RocksDbWeight;
type Version = Version;
type AccountData = pallet_balances::AccountData<Balance>;
type SystemWeightInfo = weights::frame_system::WeightInfo<Runtime>;
Expand Down Expand Up @@ -1109,7 +1110,8 @@ impl InstanceFilter<RuntimeCall> for ProxyType {
matches!(
c,
RuntimeCall::Staking(..) |
RuntimeCall::Session(..) | RuntimeCall::Utility(..) |
RuntimeCall::Session(..) |
RuntimeCall::Utility(..) |
RuntimeCall::FastUnstake(..) |
RuntimeCall::VoterList(..) |
RuntimeCall::NominationPools(..)
Expand Down Expand Up @@ -1879,6 +1881,7 @@ mod benches {
);
}

#[cfg(not(feature = "disable-runtime-api"))]
sp_api::impl_runtime_apis! {
impl sp_api::Core<Block> for Runtime {
fn version() -> RuntimeVersion {
Expand Down
14 changes: 14 additions & 0 deletions prdoc/pr_4325.prdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
title: Restore disable_runtime_api logic to test nodes

doc:
- audience: Runtime Dev
description: |
There should be an option for runtime dev to choose whether to expose apis. This feature existed but was mistakenly removed.

crates:
- name: polkadot-runtime-rococo
bump: patch

- name: polkadot-runtime-westend
bump: patch

Loading