mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-19 22:45:40 +00:00
Companion for Substrate#14612 (#7536)
* Companion for reworking the storage transaction cache
* Cargo lock
* Fixes
* update lockfile for {"substrate"}
---------
Co-authored-by: parity-processbot <>
This commit is contained in:
@@ -120,7 +120,7 @@ macro_rules! dry_run_cmd_for { ($runtime:ident) => { paste::paste! {
|
||||
} else {
|
||||
Default::default()
|
||||
};
|
||||
let mut ext = crate::create_election_ext::<Runtime, Block>(rpc.clone(), config.at, pallets).await?;
|
||||
let mut ext = crate::create_election_ext::<Runtime>(rpc.clone(), config.at, pallets).await?;
|
||||
if config.force_snapshot {
|
||||
force_create_snapshot::<Runtime>(&mut ext)?;
|
||||
};
|
||||
|
||||
@@ -28,7 +28,7 @@ macro_rules! emergency_solution_cmd_for { ($runtime:ident) => { paste::paste! {
|
||||
) -> Result<(), Error<$crate::[<$runtime _runtime_exports>]::Runtime>> {
|
||||
use $crate::[<$runtime _runtime_exports>]::*;
|
||||
|
||||
let mut ext = crate::create_election_ext::<Runtime, Block>(client, config.at, vec![]).await?;
|
||||
let mut ext = crate::create_election_ext::<Runtime>(client, config.at, vec![]).await?;
|
||||
let raw_solution = crate::mine_with::<Runtime>(&config.solver, &mut ext, false)?;
|
||||
|
||||
ext.execute_with(|| {
|
||||
|
||||
@@ -56,7 +56,6 @@ use runtime_versions::RuntimeVersions;
|
||||
use signal_hook::consts::signal::*;
|
||||
use signal_hook_tokio::Signals;
|
||||
use sp_npos_elections::BalancingConfig;
|
||||
use sp_runtime::{traits::Block as BlockT, DeserializeOwned};
|
||||
use std::{ops::Deref, sync::Arc, time::Duration};
|
||||
use tracing_subscriber::{fmt, EnvFilter};
|
||||
|
||||
@@ -295,15 +294,13 @@ frame_support::parameter_types! {
|
||||
|
||||
/// Build the Ext at hash with all the data of `ElectionProviderMultiPhase` and any additional
|
||||
/// pallets.
|
||||
async fn create_election_ext<T, B>(
|
||||
async fn create_election_ext<T>(
|
||||
client: SharedRpcClient,
|
||||
at: Option<B::Hash>,
|
||||
at: Option<Hash>,
|
||||
additional: Vec<String>,
|
||||
) -> Result<Ext, Error<T>>
|
||||
where
|
||||
T: EPM::Config,
|
||||
B: BlockT + DeserializeOwned,
|
||||
B::Header: DeserializeOwned,
|
||||
{
|
||||
use frame_support::{storage::generator::StorageMap, traits::PalletInfo};
|
||||
use sp_core::hashing::twox_128;
|
||||
@@ -312,7 +309,7 @@ where
|
||||
.expect("Pallet always has name; qed.")
|
||||
.to_string()];
|
||||
pallets.extend(additional);
|
||||
Builder::<B>::new()
|
||||
Builder::<Block>::new()
|
||||
.mode(Mode::Online(OnlineConfig {
|
||||
transport: Transport::Uri(client.uri().to_owned()),
|
||||
at,
|
||||
@@ -323,7 +320,7 @@ where
|
||||
}))
|
||||
.build()
|
||||
.await
|
||||
.map_err(|why| Error::RemoteExternalities(why))
|
||||
.map_err(|why| Error::<T>::RemoteExternalities(why))
|
||||
.map(|rx| rx.inner_ext)
|
||||
}
|
||||
|
||||
|
||||
@@ -259,7 +259,7 @@ macro_rules! monitor_cmd_for { ($runtime:tt) => { paste::paste! {
|
||||
|
||||
let _lock = submit_lock.lock().await;
|
||||
|
||||
let mut ext = match crate::create_election_ext::<Runtime, Block>(rpc.clone(), Some(hash), vec![]).await {
|
||||
let mut ext = match crate::create_election_ext::<Runtime>(rpc.clone(), Some(hash), vec![]).await {
|
||||
Ok(ext) => ext,
|
||||
Err(err) => {
|
||||
log::debug!(target: LOG_TARGET, "Skipping block {}; {}", at.number, err);
|
||||
|
||||
@@ -32,6 +32,8 @@ pub type Nonce = core_primitives::Nonce;
|
||||
pub type Hash = core_primitives::Hash;
|
||||
/// The header type. We re-export it here, but we can easily get it from block as well.
|
||||
pub type Header = core_primitives::Header;
|
||||
/// The block type.
|
||||
pub type Block = core_primitives::Block;
|
||||
|
||||
pub use sp_runtime::traits::{Block as BlockT, Header as HeaderT};
|
||||
|
||||
@@ -44,7 +46,7 @@ pub const LOG_TARGET: &str = "staking-miner";
|
||||
pub use pallet_election_provider_multi_phase as EPM;
|
||||
|
||||
/// The externalities type.
|
||||
pub type Ext = sp_io::TestExternalities;
|
||||
pub type Ext = sp_state_machine::TestExternalities<sp_runtime::traits::HashingFor<Block>>;
|
||||
|
||||
/// The key pair type being used. We "strongly" assume sr25519 for simplicity.
|
||||
pub type Pair = sp_core::sr25519::Pair;
|
||||
|
||||
Reference in New Issue
Block a user