mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 09:21:05 +00:00
Remove usage of substrate-test-runtime. (#969)
* Switch from using the substrate_test_runtime Extrinsic to the polkadot_test_runtime one * Copy genesismap into test-runtime * Add UncheckedExtrinsics * Fix tests :^) * Remove unused functions from genesismap * DRY, clean up * Clean up * Update service/src/grandpa_support.rs Co-Authored-By: Bastian Köcher <bkchr@users.noreply.github.com> * Fix indentation * Update runtime/test-runtime/src/genesismap.rs Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
This commit is contained in:
@@ -26,7 +26,7 @@ pub use sc_client::LongestChain;
|
||||
|
||||
use sp_core::{sr25519, ChangesTrieConfiguration, map, twox_128};
|
||||
use sp_core::storage::{ChildInfo, Storage, StorageChild};
|
||||
use substrate_test_runtime::genesismap::{GenesisConfig};
|
||||
use polkadot_test_runtime::genesismap::GenesisConfig;
|
||||
use sp_runtime::traits::{Block as BlockT, Header as HeaderT, Hash as HashT, HashFor};
|
||||
use sc_client::{
|
||||
light::fetcher::{
|
||||
@@ -81,7 +81,6 @@ pub type LightExecutor = sc_client::light::call_executor::GenesisCallExecutor<
|
||||
#[derive(Default)]
|
||||
pub struct GenesisParameters {
|
||||
changes_trie_config: Option<ChangesTrieConfiguration>,
|
||||
heap_pages_override: Option<u64>,
|
||||
extra_storage: Storage,
|
||||
}
|
||||
|
||||
@@ -94,13 +93,7 @@ impl GenesisParameters {
|
||||
sr25519::Public::from(Sr25519Keyring::Bob).into(),
|
||||
sr25519::Public::from(Sr25519Keyring::Charlie).into(),
|
||||
],
|
||||
vec![
|
||||
AccountKeyring::Alice.into(),
|
||||
AccountKeyring::Bob.into(),
|
||||
AccountKeyring::Charlie.into(),
|
||||
],
|
||||
1000,
|
||||
self.heap_pages_override,
|
||||
self.extra_storage.clone(),
|
||||
)
|
||||
}
|
||||
@@ -176,12 +169,6 @@ pub trait TestClientBuilderExt<B>: Sized {
|
||||
self
|
||||
}
|
||||
|
||||
/// Override the default value for Wasm heap pages.
|
||||
fn set_heap_pages(mut self, heap_pages: u64) -> Self {
|
||||
self.genesis_init_mut().heap_pages_override = Some(heap_pages);
|
||||
self
|
||||
}
|
||||
|
||||
/// Add an extra value into the genesis storage.
|
||||
///
|
||||
/// # Panics
|
||||
@@ -256,7 +243,7 @@ type MaybeFetcherCallback<Req, Resp> = Option<Box<dyn Fn(Req) -> Result<Resp, sp
|
||||
#[derive(Default)]
|
||||
pub struct LightFetcher {
|
||||
call: MaybeFetcherCallback<RemoteCallRequest<polkadot_test_runtime::Header>, Vec<u8>>,
|
||||
body: MaybeFetcherCallback<RemoteBodyRequest<polkadot_test_runtime::Header>, Vec<substrate_test_runtime::Extrinsic>>,
|
||||
body: MaybeFetcherCallback<RemoteBodyRequest<polkadot_test_runtime::Header>, Vec<polkadot_test_runtime::Extrinsic>>,
|
||||
}
|
||||
|
||||
impl LightFetcher {
|
||||
@@ -274,7 +261,7 @@ impl LightFetcher {
|
||||
/// Sets remote body callback.
|
||||
pub fn with_remote_body(
|
||||
self,
|
||||
body: MaybeFetcherCallback<RemoteBodyRequest<polkadot_test_runtime::Header>, Vec<substrate_test_runtime::Extrinsic>>,
|
||||
body: MaybeFetcherCallback<RemoteBodyRequest<polkadot_test_runtime::Header>, Vec<polkadot_test_runtime::Extrinsic>>,
|
||||
) -> Self {
|
||||
LightFetcher {
|
||||
call: self.call,
|
||||
@@ -321,3 +308,23 @@ pub fn new_light_fetcher() -> LightFetcher {
|
||||
pub fn new_native_executor() -> sc_executor::NativeExecutor<LocalExecutor> {
|
||||
sc_executor::NativeExecutor::new(sc_executor::WasmExecutionMethod::Interpreted, None, 8)
|
||||
}
|
||||
|
||||
/// Extrinsics that must be included in each block.
|
||||
pub fn needed_extrinsics(heads: Vec<polkadot_primitives::parachain::AttestedCandidate>) -> Vec<polkadot_test_runtime::UncheckedExtrinsic> {
|
||||
use polkadot_runtime_common::parachains;
|
||||
|
||||
vec![
|
||||
polkadot_test_runtime::UncheckedExtrinsic {
|
||||
function: polkadot_test_runtime::Call::Parachains(parachains::Call::set_heads(heads)),
|
||||
signature: None,
|
||||
},
|
||||
polkadot_test_runtime::UncheckedExtrinsic {
|
||||
function: polkadot_test_runtime::Call::Timestamp(pallet_timestamp::Call::set({
|
||||
std::time::SystemTime::now().duration_since(std::time::UNIX_EPOCH)
|
||||
.expect("now always later than unix epoch; qed")
|
||||
.as_millis() as u64
|
||||
})),
|
||||
signature: None,
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user