Skip to content

Commit

Permalink
Merge pull request #2128 from subspace/fix-runtime-api-light
Browse files Browse the repository at this point in the history
Fix RuntimeApiLight dispatch_call to correctly query RuntimeVersion
  • Loading branch information
ParthDesai authored Oct 17, 2023
2 parents 487ae10 + 482455f commit dc56eb8
Show file tree
Hide file tree
Showing 9 changed files with 78 additions and 78 deletions.
90 changes: 45 additions & 45 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions crates/sp-domains-fraud-proof/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ codec = { package = "parity-scale-codec", version = "3.6.5", default-features =
hash-db = { version = "0.16.0", default-features = false }
scale-info = { version = "2.7.0", default-features = false, features = ["derive"] }
domain-block-preprocessor = { version = "0.1.0", default-features = false, path = "../../domains/client/block-preprocessor", optional = true }
sc-executor = { version = "0.10.0-dev", git = "https://github.com/subspace/polkadot-sdk", rev = "74509ce016358e7f56ed2825fd75c324f8c22ef9", default-features = false, optional = true }
sp-api = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/polkadot-sdk", rev = "74509ce016358e7f56ed2825fd75c324f8c22ef9" }
sp-blockchain = { version = "4.0.0-dev", git = "https://github.com/subspace/polkadot-sdk", rev = "74509ce016358e7f56ed2825fd75c324f8c22ef9", optional = true }
sp-core = { version = "21.0.0", default-features = false, git = "https://github.com/subspace/polkadot-sdk", rev = "74509ce016358e7f56ed2825fd75c324f8c22ef9" }
Expand All @@ -34,6 +35,7 @@ std = [
"hash-db/std",
"scale-info/std",
"domain-block-preprocessor",
"sc-executor",
"sp-api/std",
"sp-blockchain",
"sp-core/std",
Expand Down
5 changes: 3 additions & 2 deletions crates/sp-domains-fraud-proof/src/host_functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use crate::{FraudProofVerificationInfoRequest, FraudProofVerificationInfoRespons
use codec::Encode;
use domain_block_preprocessor::runtime_api::InherentExtrinsicConstructor;
use domain_block_preprocessor::runtime_api_light::RuntimeApiLight;
use sc_executor::RuntimeVersionOf;
use sp_api::{BlockT, ProvideRuntimeApi};
use sp_blockchain::HeaderBackend;
use sp_core::traits::CodeExecutor;
Expand Down Expand Up @@ -61,7 +62,7 @@ where
DomainBlock: BlockT,
Client: HeaderBackend<Block> + ProvideRuntimeApi<Block>,
Client::Api: DomainsApi<Block, NumberFor<DomainBlock>, DomainBlock::Hash>,
Executor: CodeExecutor,
Executor: CodeExecutor + RuntimeVersionOf,
{
fn get_block_randomness(&self, consensus_block_hash: H256) -> Option<Randomness> {
let runtime_api = self.consensus_client.runtime_api();
Expand Down Expand Up @@ -106,7 +107,7 @@ where
DomainBlock: BlockT,
Client: HeaderBackend<Block> + ProvideRuntimeApi<Block>,
Client::Api: DomainsApi<Block, NumberFor<DomainBlock>, DomainBlock::Hash>,
Executor: CodeExecutor,
Executor: CodeExecutor + RuntimeVersionOf,
{
fn get_fraud_proof_verification_info(
&self,
Expand Down
1 change: 1 addition & 0 deletions crates/subspace-fraud-proof/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ domain-block-preprocessor = { version = "0.1.0", path = "../../domains/client/bl
futures = "0.3.28"
hash-db = "0.16.0"
sc-client-api = { version = "4.0.0-dev", git = "https://github.com/subspace/polkadot-sdk", rev = "74509ce016358e7f56ed2825fd75c324f8c22ef9" }
sc-executor = { version = "0.10.0-dev", git = "https://github.com/subspace/polkadot-sdk", rev = "74509ce016358e7f56ed2825fd75c324f8c22ef9", default-features = false }
sp-api = { version = "4.0.0-dev", git = "https://github.com/subspace/polkadot-sdk", rev = "74509ce016358e7f56ed2825fd75c324f8c22ef9" }
sp-blockchain = { version = "4.0.0-dev", git = "https://github.com/subspace/polkadot-sdk", rev = "74509ce016358e7f56ed2825fd75c324f8c22ef9" }
sp-core = { version = "21.0.0", git = "https://github.com/subspace/polkadot-sdk", rev = "74509ce016358e7f56ed2825fd75c324f8c22ef9" }
Expand Down
7 changes: 4 additions & 3 deletions crates/subspace-fraud-proof/src/invalid_transaction_proof.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use domain_block_preprocessor::runtime_api_light::RuntimeApiLight;
use domain_runtime_primitives::opaque::Block;
use domain_runtime_primitives::{DomainCoreApi, Hash};
use sc_client_api::StorageProof;
use sc_executor::RuntimeVersionOf;
use sp_api::ProvideRuntimeApi;
use sp_blockchain::HeaderBackend;
use sp_core::traits::CodeExecutor;
Expand Down Expand Up @@ -53,7 +54,7 @@ fn create_runtime_api_light<Exec>(
extrinsic: OpaqueExtrinsic,
) -> Result<RuntimeApiLight<Exec>, VerificationError>
where
Exec: CodeExecutor,
Exec: CodeExecutor + RuntimeVersionOf,
{
let mut runtime_api_light = RuntimeApiLight::new(executor, wasm_bundle);

Expand Down Expand Up @@ -116,7 +117,7 @@ where
CClient: HeaderBackend<CBlock> + ProvideRuntimeApi<CBlock> + Send + Sync,
CClient::Api: DomainsApi<CBlock, domain_runtime_primitives::BlockNumber, Hash>,
VerifierClient: VerifierApi,
Exec: CodeExecutor + 'static,
Exec: CodeExecutor + RuntimeVersionOf + 'static,
{
/// Constructs a new instance of [`InvalidTransactionProofVerifier`].
pub fn new(
Expand Down Expand Up @@ -237,7 +238,7 @@ where
Client: HeaderBackend<CBlock> + ProvideRuntimeApi<CBlock> + Send + Sync,
Client::Api: DomainsApi<CBlock, domain_runtime_primitives::BlockNumber, Hash>,
VerifierClient: VerifierApi,
Exec: CodeExecutor + 'static,
Exec: CodeExecutor + RuntimeVersionOf + 'static,
{
fn verify_invalid_transaction_proof(
&self,
Expand Down
Loading

0 comments on commit dc56eb8

Please sign in to comment.