From 6c8a00404bc55810ead0bfd2d822d3ecd7b49e2c Mon Sep 17 00:00:00 2001 From: Nazar Mokrynskyi Date: Thu, 7 Dec 2023 10:29:07 +0200 Subject: [PATCH] No runtime chain constants calls --- crates/sc-consensus-subspace-rpc/src/lib.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/crates/sc-consensus-subspace-rpc/src/lib.rs b/crates/sc-consensus-subspace-rpc/src/lib.rs index bdd8716547..a2cf1dcb1a 100644 --- a/crates/sc-consensus-subspace-rpc/src/lib.rs +++ b/crates/sc-consensus-subspace-rpc/src/lib.rs @@ -41,7 +41,9 @@ use sc_utils::mpsc::TracingUnboundedSender; use sp_api::{ApiError, ProvideRuntimeApi}; use sp_blockchain::HeaderBackend; use sp_consensus::SyncOracle; -use sp_consensus_subspace::{FarmerPublicKey, FarmerSignature, SubspaceApi as SubspaceRuntimeApi}; +use sp_consensus_subspace::{ + ChainConstants, FarmerPublicKey, FarmerSignature, SubspaceApi as SubspaceRuntimeApi, +}; use sp_core::crypto::ByteArray; use sp_core::H256; use sp_objects::ObjectsApi; @@ -219,6 +221,7 @@ where Arc>, next_subscription_id: AtomicU64, sync_oracle: SubspaceSyncOracle, + chain_constants: ChainConstants, kzg: Kzg, deny_unsafe: DenyUnsafe, _block: PhantomData, @@ -266,6 +269,7 @@ where archived_segment_acknowledgement_senders: Arc::default(), next_subscription_id: AtomicU64::default(), sync_oracle: config.sync_oracle, + chain_constants, kzg: config.kzg, deny_unsafe: config.deny_unsafe, _block: PhantomData, @@ -303,7 +307,7 @@ where })?; let farmer_app_info: Result = try { - let chain_constants = runtime_api.chain_constants(best_hash)?; + let chain_constants = &self.chain_constants; let protocol_info = FarmerProtocolInfo { history_size: runtime_api.history_size(best_hash)?, max_pieces_in_sector: runtime_api.max_pieces_in_sector(best_hash)?,