mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 04:07:57 +00:00
Implement runtime version checks in set_code (#4548)
* Implement runtime version checks in `set_code` Check that the new runtime code given to `set_code` fullfills some requirements: - `spec_name` matches - `spec_version` does not decreases - `impl_version` does not decreases - Either `spec_version` and `impl_version` increase * Make tests almost work * Some fixes after master merge * Fix tests * Add missed file * Make depedency check happy? * Remove leftover `sc-executor` * AHHHHH * Reset debug stuff * Remove some 'static * More 'static * Some docs * Update `Cargo.lock`
This commit is contained in:
committed by
Gavin Wood
parent
437772be9e
commit
afc3318f21
@@ -59,21 +59,12 @@ pub mod prelude {
|
||||
pub use super::{AccountKeyring, Sr25519Keyring};
|
||||
}
|
||||
|
||||
mod local_executor {
|
||||
#![allow(missing_docs)]
|
||||
use substrate_test_runtime;
|
||||
use crate::sc_executor::native_executor_instance;
|
||||
// FIXME #1576 change the macro and pass in the `BlakeHasher` that dispatch needs from here instead
|
||||
native_executor_instance!(
|
||||
pub LocalExecutor,
|
||||
substrate_test_runtime::api::dispatch,
|
||||
substrate_test_runtime::native_version
|
||||
);
|
||||
sc_executor::native_executor_instance! {
|
||||
pub LocalExecutor,
|
||||
substrate_test_runtime::api::dispatch,
|
||||
substrate_test_runtime::native_version,
|
||||
}
|
||||
|
||||
/// Native executor used for tests.
|
||||
pub use self::local_executor::LocalExecutor;
|
||||
|
||||
/// Test client database backend.
|
||||
pub type Backend = substrate_test_client::Backend<substrate_test_runtime::Block>;
|
||||
|
||||
@@ -245,7 +236,7 @@ impl<B> TestClientBuilderExt<B> for TestClientBuilder<
|
||||
sc_client::LocalCallExecutor<B, sc_executor::NativeExecutor<LocalExecutor>>,
|
||||
B
|
||||
> where
|
||||
B: sc_client_api::backend::Backend<substrate_test_runtime::Block>,
|
||||
B: sc_client_api::backend::Backend<substrate_test_runtime::Block> + 'static,
|
||||
// Rust bug: https://github.com/rust-lang/rust/issues/24159
|
||||
<B as sc_client_api::backend::Backend<substrate_test_runtime::Block>>::State:
|
||||
sp_api::StateBackend<HasherFor<substrate_test_runtime::Block>>,
|
||||
@@ -353,7 +344,7 @@ pub fn new_light() -> (
|
||||
let storage = sc_client_db::light::LightStorage::new_test();
|
||||
let blockchain = Arc::new(sc_client::light::blockchain::Blockchain::new(storage));
|
||||
let backend = Arc::new(LightBackend::new(blockchain.clone()));
|
||||
let executor = NativeExecutor::new(WasmExecutionMethod::Interpreted, None);
|
||||
let executor = new_native_executor();
|
||||
let local_call_executor = sc_client::LocalCallExecutor::new(backend.clone(), executor);
|
||||
let call_executor = LightExecutor::new(
|
||||
backend.clone(),
|
||||
@@ -372,3 +363,8 @@ pub fn new_light() -> (
|
||||
pub fn new_light_fetcher() -> LightFetcher {
|
||||
LightFetcher::default()
|
||||
}
|
||||
|
||||
/// Create a new native executor.
|
||||
pub fn new_native_executor() -> sc_executor::NativeExecutor<LocalExecutor> {
|
||||
sc_executor::NativeExecutor::new(sc_executor::WasmExecutionMethod::Interpreted, None)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user