Skip to content

Commit

Permalink
Update from bkchr running command 'fmt'
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Feb 21, 2025
1 parent 9bcc0f4 commit 58a2f7a
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 38 deletions.
12 changes: 3 additions & 9 deletions cumulus/client/consensus/aura/src/collators/lookahead.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ use polkadot_node_primitives::SubmitCollationParams;
use polkadot_node_subsystem::messages::CollationGenerationMessage;
use polkadot_overseer::Handle as OverseerHandle;
use polkadot_primitives::{
vstaging::DEFAULT_CLAIM_QUEUE_OFFSET, CollatorPair,
Id as ParaId, OccupiedCoreAssumption,
vstaging::DEFAULT_CLAIM_QUEUE_OFFSET, CollatorPair, Id as ParaId, OccupiedCoreAssumption,
};

use crate::{collator as collator_util, export_pov_to_path};
use futures::prelude::*;
use sc_client_api::{backend::AuxStore, BlockBackend, BlockOf};
use sc_consensus::BlockImport;
Expand All @@ -59,13 +59,7 @@ use sp_core::crypto::Pair;
use sp_inherents::CreateInherentDataProviders;
use sp_keystore::KeystorePtr;
use sp_runtime::traits::{Block as BlockT, Header as HeaderT, Member};
use std::{
path::PathBuf,
sync::Arc,
time::Duration,
};
use crate::{collator as collator_util, export_pov_to_path};

use std::{path::PathBuf, sync::Arc, time::Duration};

/// Parameters for [`run`].
pub struct Params<BI, CIDP, Client, Backend, RClient, CHP, Proposer, CS> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
// You should have received a copy of the GNU General Public License
// along with Cumulus. If not, see <https://www.gnu.org/licenses/>.

use std::path::PathBuf;
use codec::Encode;
use std::path::PathBuf;

use cumulus_client_collator::service::ServiceInterface as CollatorServiceInterface;
use cumulus_relay_chain_interface::RelayChainInterface;
Expand All @@ -26,12 +26,12 @@ use polkadot_node_subsystem::messages::CollationGenerationMessage;
use polkadot_overseer::Handle as OverseerHandle;
use polkadot_primitives::{CollatorPair, Id as ParaId};

use futures::prelude::*;
use cumulus_primitives_core::relay_chain::BlockId;
use futures::prelude::*;

use crate::export_pov_to_path;
use sc_utils::mpsc::TracingUnboundedReceiver;
use sp_runtime::traits::{Block as BlockT, Header};
use crate::export_pov_to_path;

use super::CollatorMessage;

Expand All @@ -54,7 +54,7 @@ pub struct Params<Block: BlockT, RClient, CS> {
/// The handle from the special slot based block import.
pub block_import_handle: super::SlotBasedBlockImportHandle<Block>,
/// When set, the collator will export every produced `POV` to this folder.
pub export_pov: Option<PathBuf>
pub export_pov: Option<PathBuf>,
}

/// Asynchronously executes the collation task for a parachain.
Expand All @@ -72,7 +72,7 @@ pub async fn run_collation_task<Block, RClient, CS>(
collator_service,
mut collator_receiver,
mut block_import_handle,
export_pov
export_pov,
}: Params<Block, RClient, CS>,
) where
Block: BlockT,
Expand Down Expand Up @@ -118,7 +118,7 @@ async fn handle_collation_message<Block: BlockT, RClient: RelayChainInterface +
collator_service: &impl CollatorServiceInterface<Block>,
overseer_handle: &mut OverseerHandle,
relay_client: RClient,
export_pov: Option<PathBuf>
export_pov: Option<PathBuf>,
) {
let CollatorMessage {
parent_header,
Expand Down Expand Up @@ -148,19 +148,20 @@ async fn handle_collation_message<Block: BlockT, RClient: RelayChainInterface +
);

if let MaybeCompressedPoV::Compressed(ref pov) = collation.proof_of_validity {

if let Some(pov_path) = export_pov {
if let Ok(Some(relay_parent_header)) = relay_client.header(BlockId::Hash(relay_parent)).await {
if let Ok(Some(relay_parent_header)) =
relay_client.header(BlockId::Hash(relay_parent)).await
{
export_pov_to_path::<Block>(
pov_path.clone(),
pov.clone(),
block_data.header().hash(),
*block_data.header().number(),
parent_header.clone(),
relay_parent_header.state_root,
relay_parent_header.number
relay_parent_header.number,
);
}else {
} else {
tracing::error!(target: LOG_TARGET, "Failed to get relay parent header from hash: {:?relay_parent}");

Check failure on line 165 in cumulus/client/consensus/aura/src/collators/slot_based/collation_task.rs

View workflow job for this annotation

GitHub Actions / cargo-check-all-crate-macos

invalid format string: expected `}`, found `r`
}
}
Expand Down
10 changes: 4 additions & 6 deletions cumulus/client/consensus/aura/src/collators/slot_based/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,7 @@ use sp_core::{crypto::Pair, traits::SpawnNamed, U256};
use sp_inherents::CreateInherentDataProviders;
use sp_keystore::KeystorePtr;
use sp_runtime::traits::{Block as BlockT, Member, NumberFor, One};
use std::{sync::Arc, time::Duration};
use std::path::PathBuf;
use std::{path::PathBuf, sync::Arc, time::Duration};

pub use block_import::{SlotBasedBlockImport, SlotBasedBlockImportHandle};

Expand Down Expand Up @@ -105,10 +104,9 @@ pub struct Params<Block, BI, CIDP, Client, Backend, RClient, CHP, Proposer, CS,
pub export_pov: Option<PathBuf>,
}


/// Run aura-based block building and collation task.
pub fn run<Block, P, BI, CIDP, Client, Backend, RClient, CHP, Proposer, CS, Spawner>(
params: Params<Block, BI, CIDP, Client, Backend, RClient, CHP, Proposer, CS, Spawner>
params: Params<Block, BI, CIDP, Client, Backend, RClient, CHP, Proposer, CS, Spawner>,
) where
Block: BlockT,
Client: ProvideRuntimeApi<Block>
Expand Down Expand Up @@ -152,7 +150,7 @@ pub fn run<Block, P, BI, CIDP, Client, Backend, RClient, CHP, Proposer, CS, Spaw
slot_drift,
block_import_handle,
spawner,
export_pov
export_pov,
} = params;

let (tx, rx) = tracing_unbounded("mpsc_builder_to_collator", 100);
Expand All @@ -164,7 +162,7 @@ pub fn run<Block, P, BI, CIDP, Client, Backend, RClient, CHP, Proposer, CS, Spaw
collator_service: collator_service.clone(),
collator_receiver: rx,
block_import_handle,
export_pov
export_pov,
};

let collation_task_fut = run_collation_task::<Block, _, _>(collator_task_params);
Expand Down
21 changes: 13 additions & 8 deletions cumulus/client/consensus/aura/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ use cumulus_client_consensus_common::{
};
use cumulus_primitives_core::{relay_chain::Hash as PHash, PersistedValidationData};

use cumulus_primitives_core::relay_chain::HeadData;
use futures::lock::Mutex;
use polkadot_primitives::{BlockNumber as RBlockNumber, Hash as RHash};
use sc_client_api::{backend::AuxStore, BlockOf};
use sc_consensus::BlockImport;
use sc_consensus_slots::{BackoffAuthoringBlocksStrategy, SimpleSlotWorker, SlotInfo};
Expand All @@ -43,14 +45,17 @@ use sp_core::crypto::Pair;
use sp_inherents::CreateInherentDataProviders;
use sp_keystore::KeystorePtr;
use sp_runtime::traits::{Block as BlockT, Header as HeaderT, Member, NumberFor};
use std::{convert::TryFrom, fs, marker::PhantomData, sync::{
atomic::{AtomicU64, Ordering},
Arc,
}};
use std::fs::File;
use std::path::PathBuf;
use cumulus_primitives_core::relay_chain::HeadData;
use polkadot_primitives::{BlockNumber as RBlockNumber, Hash as RHash};
use std::{
convert::TryFrom,
fs,
fs::File,
marker::PhantomData,
path::PathBuf,
sync::{
atomic::{AtomicU64, Ordering},
Arc,
},
};

mod import_queue;

Expand Down
8 changes: 5 additions & 3 deletions cumulus/polkadot-omni-node/lib/src/nodes/aura.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ use cumulus_client_collator::service::{
};
#[docify::export(slot_based_colator_import)]
use cumulus_client_consensus_aura::collators::slot_based::{
self as slot_based, Params as SlotBasedParams
self as slot_based, Params as SlotBasedParams,
};
use cumulus_client_consensus_aura::{
collators::{
Expand Down Expand Up @@ -277,7 +277,9 @@ where
CS: CollatorServiceInterface<Block> + Send + Sync + Clone + 'static,
Spawner: SpawnNamed,
{
slot_based::run::<Block, <AuraId as AppCrypto>::Pair, _, _, _, _, _, _, _, _, _>(params_with_export);
slot_based::run::<Block, <AuraId as AppCrypto>::Pair, _, _, _, _, _, _, _, _, _>(
params_with_export,
);
}
}

Expand Down Expand Up @@ -358,7 +360,7 @@ where
slot_drift: Duration::from_secs(1),
block_import_handle,
spawner: task_manager.spawn_handle(),
export_pov: node_extra_args.export_pov
export_pov: node_extra_args.export_pov,
};

// We have a separate function only to be able to use `docify::export` on this piece of
Expand Down
4 changes: 2 additions & 2 deletions cumulus/test/service/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ use cumulus_client_consensus_aura::{
lookahead::{self as aura, Params as AuraParams},
slot_based::{
self as slot_based, Params as SlotBasedParams, SlotBasedBlockImport,
SlotBasedBlockImportHandle
SlotBasedBlockImportHandle,
},
},
ImportQueueParams,
Expand Down Expand Up @@ -506,7 +506,7 @@ where
slot_drift: Duration::from_secs(1),
block_import_handle: slot_based_handle,
spawner: task_manager.spawn_handle(),
export_pov: None
export_pov: None,
};

slot_based::run::<Block, AuthorityPair, _, _, _, _, _, _, _, _, _>(params);
Expand Down

0 comments on commit 58a2f7a

Please sign in to comment.