diff --git a/polkadot/node/core/runtime-api/src/lib.rs b/polkadot/node/core/runtime-api/src/lib.rs index a5cc27cc9a..0bca3d5ab3 100644 --- a/polkadot/node/core/runtime-api/src/lib.rs +++ b/polkadot/node/core/runtime-api/src/lib.rs @@ -344,42 +344,30 @@ where { let _timer = metrics.time_make_runtime_api_request(); - // The version of the `ParachainHost` runtime API that we are absolutely sure is deployed widely - // on all supported networks: Rococo, Kusama, Polkadot and perhaps others like Versi. - // - // This version is used for eliding unnecessary runtime API calls. It is safer to keep the lower - // version. - const WIDELY_DEPLOYED_API_VERSION: u32 = 1; - macro_rules! query { ($req_variant:ident, $api_name:ident ($($param:expr),*), ver = $version:literal, $sender:expr) => {{ let sender = $sender; let api = client.runtime_api(); - let runtime_version = if $version > WIDELY_DEPLOYED_API_VERSION { - use sp_api::ApiExt; - api.api_version::>(&BlockId::Hash(relay_parent)) - .unwrap_or_else(|e| { - tracing::warn!( - target: LOG_TARGET, - "cannot query the runtime API version: {}", - e, - ); - Some(WIDELY_DEPLOYED_API_VERSION) - }) - .unwrap_or_else(|| { - tracing::warn!( - target: LOG_TARGET, - "no runtime version is reported" - ); - WIDELY_DEPLOYED_API_VERSION - }) - } else { - // The required version is less or equal to the widely deployed runtime API version. - WIDELY_DEPLOYED_API_VERSION - }; + use sp_api::ApiExt; + let runtime_version = api.api_version::>(&BlockId::Hash(relay_parent)) + .unwrap_or_else(|e| { + tracing::warn!( + target: LOG_TARGET, + "cannot query the runtime API version: {}", + e, + ); + Some(0) + }) + .unwrap_or_else(|| { + tracing::warn!( + target: LOG_TARGET, + "no runtime version is reported" + ); + 0 + }); - let res = if runtime_version <= $version { + let res = if runtime_version >= $version { api.$api_name(&BlockId::Hash(relay_parent) $(, $param.clone() )*) .map_err(|e| RuntimeApiError::Execution { runtime_api_name: stringify!($api_name),