mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 14:01:02 +00:00
Some fixes required for Cumulus (#766)
* Add some more bounds * More bounds * More fixes * More fixes
This commit is contained in:
committed by
Gavin Wood
parent
16043df46f
commit
9ec65c94d7
@@ -72,6 +72,7 @@ pub use polkadot_network::validation::Incoming;
|
|||||||
pub use polkadot_validation::SignedStatement;
|
pub use polkadot_validation::SignedStatement;
|
||||||
pub use polkadot_primitives::parachain::CollatorId;
|
pub use polkadot_primitives::parachain::CollatorId;
|
||||||
pub use sc_network::PeerId;
|
pub use sc_network::PeerId;
|
||||||
|
pub use service::RuntimeApiCollection;
|
||||||
|
|
||||||
const COLLATION_TIMEOUT: Duration = Duration::from_secs(30);
|
const COLLATION_TIMEOUT: Duration = Duration::from_secs(30);
|
||||||
|
|
||||||
@@ -144,13 +145,17 @@ pub trait BuildParachainContext {
|
|||||||
) -> Result<Self::ParachainContext, ()>
|
) -> Result<Self::ParachainContext, ()>
|
||||||
where
|
where
|
||||||
PolkadotClient<B, E, R>: ProvideRuntimeApi<Block>,
|
PolkadotClient<B, E, R>: ProvideRuntimeApi<Block>,
|
||||||
<PolkadotClient<B, E, R> as ProvideRuntimeApi<Block>>::Api: service::RuntimeApiCollection<Extrinsic>,
|
<PolkadotClient<B, E, R> as ProvideRuntimeApi<Block>>::Api: RuntimeApiCollection<Extrinsic>,
|
||||||
// Rust bug: https://github.com/rust-lang/rust/issues/24159
|
// Rust bug: https://github.com/rust-lang/rust/issues/24159
|
||||||
<<PolkadotClient<B, E, R> as ProvideRuntimeApi<Block>>::Api as sp_api::ApiExt<Block>>::StateBackend:
|
<<PolkadotClient<B, E, R> as ProvideRuntimeApi<Block>>::Api as sp_api::ApiExt<Block>>::StateBackend:
|
||||||
sp_api::StateBackend<Blake2Hasher>,
|
sp_api::StateBackend<Blake2Hasher>,
|
||||||
Extrinsic: codec::Codec + Send + Sync + 'static,
|
Extrinsic: codec::Codec + Send + Sync + 'static,
|
||||||
E: sc_client::CallExecutor<Block> + Clone + Send + Sync + 'static,
|
E: sc_client::CallExecutor<Block> + Clone + Send + Sync + 'static,
|
||||||
SP: Spawn + Clone + Send + Sync + 'static;
|
SP: Spawn + Clone + Send + Sync + 'static,
|
||||||
|
R: Send + Sync + 'static,
|
||||||
|
B: sc_client_api::Backend<Block> + 'static,
|
||||||
|
// Rust bug: https://github.com/rust-lang/rust/issues/24159
|
||||||
|
B::State: sp_api::StateBackend<Blake2Hasher>;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Parachain context needed for collation.
|
/// Parachain context needed for collation.
|
||||||
@@ -282,7 +287,7 @@ fn run_collator_node<S, E, P, Extrinsic>(
|
|||||||
S: AbstractService<Block = service::Block, NetworkSpecialization = service::PolkadotProtocol>,
|
S: AbstractService<Block = service::Block, NetworkSpecialization = service::PolkadotProtocol>,
|
||||||
sc_client::Client<S::Backend, S::CallExecutor, service::Block, S::RuntimeApi>: ProvideRuntimeApi<Block>,
|
sc_client::Client<S::Backend, S::CallExecutor, service::Block, S::RuntimeApi>: ProvideRuntimeApi<Block>,
|
||||||
<sc_client::Client<S::Backend, S::CallExecutor, service::Block, S::RuntimeApi> as ProvideRuntimeApi<Block>>::Api:
|
<sc_client::Client<S::Backend, S::CallExecutor, service::Block, S::RuntimeApi> as ProvideRuntimeApi<Block>>::Api:
|
||||||
service::RuntimeApiCollection<
|
RuntimeApiCollection<
|
||||||
Extrinsic,
|
Extrinsic,
|
||||||
Error = sp_blockchain::Error,
|
Error = sp_blockchain::Error,
|
||||||
StateBackend = sc_client_api::StateBackendFor<S::Backend, Block>
|
StateBackend = sc_client_api::StateBackendFor<S::Backend, Block>
|
||||||
@@ -428,7 +433,7 @@ fn run_collator_node<S, E, P, Extrinsic>(
|
|||||||
});
|
});
|
||||||
|
|
||||||
let deadlined = future::select(
|
let deadlined = future::select(
|
||||||
work,
|
work.then(|f| f).boxed(),
|
||||||
futures_timer::Delay::new(COLLATION_TIMEOUT)
|
futures_timer::Delay::new(COLLATION_TIMEOUT)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -140,7 +140,11 @@ pub fn validate_candidate<E: Externalities + 'static>(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// The host functions provided by the wasm executor to the parachain wasm blob.
|
/// The host functions provided by the wasm executor to the parachain wasm blob.
|
||||||
type HostFunctions = (sp_io::SubstrateHostFunctions, crate::wasm_api::parachain::HostFunctions);
|
type HostFunctions = (
|
||||||
|
sp_io::SubstrateHostFunctions,
|
||||||
|
sc_executor::deprecated_host_interface::SubstrateExternals,
|
||||||
|
crate::wasm_api::parachain::HostFunctions,
|
||||||
|
);
|
||||||
|
|
||||||
/// Validate a candidate under the given validation code.
|
/// Validate a candidate under the given validation code.
|
||||||
///
|
///
|
||||||
|
|||||||
@@ -461,7 +461,7 @@ fn do_validation<P>(
|
|||||||
&validation_code,
|
&validation_code,
|
||||||
params,
|
params,
|
||||||
ext.clone(),
|
ext.clone(),
|
||||||
ExecutionMode::Remote,
|
ExecutionMode::Local,
|
||||||
) {
|
) {
|
||||||
Ok(result) => {
|
Ok(result) => {
|
||||||
if result.head_data == head_data.0 {
|
if result.head_data == head_data.0 {
|
||||||
|
|||||||
@@ -275,7 +275,7 @@ struct ParachainValidation<C, N, P> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<C, N, P> ParachainValidation<C, N, P> where
|
impl<C, N, P> ParachainValidation<C, N, P> where
|
||||||
C: Collators + Send + Unpin + 'static,
|
C: Collators + Send + Unpin + 'static + Sync,
|
||||||
N: Network,
|
N: Network,
|
||||||
P: ProvideRuntimeApi<Block> + HeaderBackend<Block> + BlockBody<Block> + Send + Sync + 'static,
|
P: ProvideRuntimeApi<Block> + HeaderBackend<Block> + BlockBody<Block> + Send + Sync + 'static,
|
||||||
P::Api: ParachainHost<Block> + BlockBuilderApi<Block> + ApiExt<Block, Error = sp_blockchain::Error>,
|
P::Api: ParachainHost<Block> + BlockBuilderApi<Block> + ApiExt<Block, Error = sp_blockchain::Error>,
|
||||||
@@ -436,18 +436,17 @@ impl<C, N, P> ParachainValidation<C, N, P> where
|
|||||||
ready(())
|
ready(())
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Ok(Some(res))
|
||||||
Some(res)
|
|
||||||
}
|
}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
warn!(target: "validation", "Failed to produce a receipt: {:?}", e);
|
warn!(target: "validation", "Failed to produce a receipt: {:?}", e);
|
||||||
None
|
Ok(None)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
warn!(target: "validation", "Failed to collate candidate: {:?}", e);
|
warn!(target: "validation", "Failed to collate candidate: {:?}", e);
|
||||||
None
|
Ok(None)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
@@ -456,7 +455,12 @@ impl<C, N, P> ParachainValidation<C, N, P> where
|
|||||||
.map_ok(with_router)
|
.map_ok(with_router)
|
||||||
.map_err(|e| {
|
.map_err(|e| {
|
||||||
warn!(target: "validation" , "Failed to build table router: {:?}", e);
|
warn!(target: "validation" , "Failed to build table router: {:?}", e);
|
||||||
});
|
})
|
||||||
|
.and_then(|f| f)
|
||||||
|
.and_then(|f| match f {
|
||||||
|
Some(f) => f.map(Ok).boxed(),
|
||||||
|
None => ready(Ok(())).boxed(),
|
||||||
|
}).boxed();
|
||||||
|
|
||||||
let cancellable_work = select(exit, router).map(drop);
|
let cancellable_work = select(exit, router).map(drop);
|
||||||
|
|
||||||
@@ -549,7 +553,7 @@ impl<C, N, P, SC, TxPool, B> ProposerFactory<C, N, P, SC, TxPool, B> where
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<C, N, P, SC, TxPool, B> consensus::Environment<Block> for ProposerFactory<C, N, P, SC, TxPool, B> where
|
impl<C, N, P, SC, TxPool, B> consensus::Environment<Block> for ProposerFactory<C, N, P, SC, TxPool, B> where
|
||||||
C: Collators + Send + Unpin + 'static,
|
C: Collators + Send + Unpin + 'static + Sync,
|
||||||
N: Network,
|
N: Network,
|
||||||
TxPool: TransactionPool<Block=Block> + 'static,
|
TxPool: TransactionPool<Block=Block> + 'static,
|
||||||
P: ProvideRuntimeApi<Block> + HeaderBackend<Block> + BlockBody<Block> + Send + Sync + 'static,
|
P: ProvideRuntimeApi<Block> + HeaderBackend<Block> + BlockBody<Block> + Send + Sync + 'static,
|
||||||
|
|||||||
Reference in New Issue
Block a user