mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-28 08:37:56 +00:00
BlockId removal: refactor: StorageProvider (#12510)
* BlockId removal: refactor: StorageProvider It changes the arguments of `Backend::StorageProvider` trait from: block: `BlockId<Block>` to: hash: `&Block::Hash` This PR is part of BlockId::Number refactoring analysis (paritytech/substrate#11292) * Apply suggestions from code review Co-authored-by: Bastian Köcher <git@kchr.de> * Update client/api/src/backend.rs Co-authored-by: Dmitrii Markin <dmitry@markin.tech> * GrandpaBlockImport::current_set_id reworked * ExportStateCmd reworked * trigger CI job * trigger CI job Co-authored-by: Bastian Köcher <git@kchr.de> Co-authored-by: Dmitrii Markin <dmitry@markin.tech>
This commit is contained in:
committed by
GitHub
parent
2f341fcf15
commit
b16135f602
@@ -23,7 +23,7 @@ use crate::{
|
||||
};
|
||||
use clap::Parser;
|
||||
use log::info;
|
||||
use sc_client_api::{StorageProvider, UsageProvider};
|
||||
use sc_client_api::{HeaderBackend, StorageProvider, UsageProvider};
|
||||
use sp_runtime::traits::{Block as BlockT, Header as HeaderT};
|
||||
use std::{fmt::Debug, io::Write, str::FromStr, sync::Arc};
|
||||
|
||||
@@ -57,7 +57,7 @@ impl ExportStateCmd {
|
||||
) -> error::Result<()>
|
||||
where
|
||||
B: BlockT,
|
||||
C: UsageProvider<B> + StorageProvider<B, BA>,
|
||||
C: UsageProvider<B> + StorageProvider<B, BA> + HeaderBackend<B>,
|
||||
BA: sc_client_api::backend::Backend<B>,
|
||||
B::Hash: FromStr,
|
||||
<B::Hash as FromStr>::Err: Debug,
|
||||
@@ -65,7 +65,11 @@ impl ExportStateCmd {
|
||||
{
|
||||
info!("Exporting raw state...");
|
||||
let block_id = self.input.as_ref().map(|b| b.parse()).transpose()?;
|
||||
let raw_state = sc_service::chain_ops::export_raw_state(client, block_id)?;
|
||||
let hash = match block_id {
|
||||
Some(id) => client.expect_block_hash_from_id(&id)?,
|
||||
None => client.usage_info().chain.best_hash,
|
||||
};
|
||||
let raw_state = sc_service::chain_ops::export_raw_state(client, &hash)?;
|
||||
input_spec.set_storage(raw_state);
|
||||
|
||||
info!("Generating new chain spec...");
|
||||
|
||||
Reference in New Issue
Block a user