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:
Bastian Köcher
2023-08-17 13:26:44 +02:00
committed by GitHub
parent 747957fd8a
commit 26b5f259a3
9 changed files with 200 additions and 210 deletions
+186 -186
View File
File diff suppressed because it is too large Load Diff
-1
View File
@@ -53,7 +53,6 @@ sp-session = { git = "https://github.com/paritytech/substrate", branch = "master
sp-storage = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-transaction-pool = { git = "https://github.com/paritytech/substrate", branch = "master" }
pallet-transaction-payment = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-trie = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-timestamp = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-consensus-babe = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-state-machine = { git = "https://github.com/paritytech/substrate", branch = "master" }
+3 -11
View File
@@ -56,7 +56,6 @@ use {
sc_client_api::BlockBackend,
sc_transaction_pool_api::OffchainTransactionPoolFactory,
sp_core::traits::SpawnNamed,
sp_trie::PrefixedMemoryDB,
};
use polkadot_node_subsystem_util::database::Database;
@@ -475,7 +474,7 @@ fn new_partial<ChainSelection>(
FullClient,
FullBackend,
ChainSelection,
sc_consensus::DefaultImportQueue<Block, FullClient>,
sc_consensus::DefaultImportQueue<Block>,
sc_transaction_pool::FullPool<Block, FullClient>,
(
impl Fn(
@@ -1321,15 +1320,8 @@ macro_rules! chain_ops {
pub fn new_chain_ops(
config: &mut Configuration,
jaeger_agent: Option<std::net::SocketAddr>,
) -> Result<
(
Arc<FullClient>,
Arc<FullBackend>,
sc_consensus::BasicQueue<Block, PrefixedMemoryDB<BlakeTwo256>>,
TaskManager,
),
Error,
> {
) -> Result<(Arc<FullClient>, Arc<FullBackend>, sc_consensus::BasicQueue<Block>, TaskManager), Error>
{
config.keystore = service::config::KeystoreConfig::InMemory;
if config.chain_spec.is_rococo() ||
+1 -1
View File
@@ -25,7 +25,7 @@ remote-externalities = { git = "https://github.com/paritytech/substrate", branch
signal-hook-tokio = { version = "0.3", features = ["futures-v0_3"] }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-version = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-io = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-state-machine = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-npos-elections = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-transaction-pool-api = { git = "https://github.com/paritytech/substrate", branch = "master" }
+1 -1
View File
@@ -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(|| {
+4 -7
View File
@@ -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)
}
+1 -1
View File
@@ -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);
+3 -1
View File
@@ -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;