Skip to content

Commit

Permalink
Merge pull request #2297 from subspace/no-runtime-chain-constants-calls
Browse files Browse the repository at this point in the history
No runtime chain constants calls
  • Loading branch information
nazar-pc authored Dec 7, 2023
2 parents 33a403b + 6c8a004 commit c05cd4a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions crates/sc-consensus-subspace-rpc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -219,6 +221,7 @@ where
Arc<Mutex<ArchivedSegmentHeaderAcknowledgementSenders>>,
next_subscription_id: AtomicU64,
sync_oracle: SubspaceSyncOracle<SO>,
chain_constants: ChainConstants,
kzg: Kzg,
deny_unsafe: DenyUnsafe,
_block: PhantomData<Block>,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -303,7 +307,7 @@ where
})?;

let farmer_app_info: Result<FarmerAppInfo, ApiError> = 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)?,
Expand Down

0 comments on commit c05cd4a

Please sign in to comment.