Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
andresilva committed Mar 6, 2023
1 parent c1f44c2 commit 0ad678c
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 18 deletions.
3 changes: 1 addition & 2 deletions client/consensus/common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,6 @@ where
async fn import_block(
&mut self,
mut params: sc_consensus::BlockImportParams<Block, Self::Transaction>,
cache: std::collections::HashMap<sp_consensus::CacheKeyId, Vec<u8>>,
) -> Result<sc_consensus::ImportResult, Self::Error> {
// Blocks are stored within the backend by using POST hash.
let hash = params.post_hash();
Expand All @@ -158,7 +157,7 @@ where
monitor.release_mutex()
});

let res = self.inner.import_block(params, cache).await?;
let res = self.inner.import_block(params).await?;

if let (Some(mut monitor_lock), ImportResult::Imported(_)) = (maybe_lock, &res) {
let mut monitor = monitor_lock.upgrade();
Expand Down
2 changes: 1 addition & 1 deletion client/consensus/common/src/parachain_consensus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ where
block_import_params.fork_choice = Some(ForkChoiceStrategy::Custom(true));
block_import_params.import_existing = true;

if let Err(err) = (&*parachain).import_block(block_import_params, Default::default()).await {
if let Err(err) = (&*parachain).import_block(block_import_params).await {
tracing::warn!(
target: LOG_TARGET,
block_hash = ?hash,
Expand Down
4 changes: 2 additions & 2 deletions client/consensus/common/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ async fn import_block<I: BlockImport<Block>>(
block_import_params.body = Some(body);
block_import_params.post_digests.push(post_digest);

importer.import_block(block_import_params, Default::default()).await.unwrap();
importer.import_block(block_import_params).await.unwrap();
}

fn import_block_sync<I: BlockImport<Block>>(
Expand Down Expand Up @@ -508,7 +508,7 @@ fn follow_new_best_sets_best_after_it_is_imported() {
block_import_params.body = Some(body);

// Now import the unkown block to make it "known"
client.import_block(block_import_params, Default::default()).await.unwrap();
client.import_block(block_import_params).await.unwrap();

loop {
Delay::new(Duration::from_millis(100)).await;
Expand Down
8 changes: 4 additions & 4 deletions client/consensus/relay-chain/src/import_queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use sc_consensus::{
use sp_api::ProvideRuntimeApi;
use sp_block_builder::BlockBuilder as BlockBuilderApi;
use sp_blockchain::Result as ClientResult;
use sp_consensus::{error::Error as ConsensusError, CacheKeyId};
use sp_consensus::error::Error as ConsensusError;
use sp_inherents::{CreateInherentDataProviders, InherentDataProvider};
use sp_runtime::traits::{Block as BlockT, Header as HeaderT};

Expand Down Expand Up @@ -54,13 +54,13 @@ where
async fn verify(
&mut self,
mut block_params: BlockImportParams<Block, ()>,
) -> Result<(BlockImportParams<Block, ()>, Option<Vec<(CacheKeyId, Vec<u8>)>>), String> {
) -> Result<BlockImportParams<Block, ()>, String> {
// Skip checks that include execution, if being told so, or when importing only state.
//
// This is done for example when gap syncing and it is expected that the block after the gap
// was checked/chosen properly, e.g. by warp syncing to this block using a finality proof.
if block_params.state_action.skip_execution_checks() || block_params.with_state() {
return Ok((block_params, Default::default()))
return Ok(block_params)
}

if let Some(inner_body) = block_params.body.take() {
Expand Down Expand Up @@ -101,7 +101,7 @@ where

block_params.post_hash = Some(block_params.header.hash());

Ok((block_params, None))
Ok(block_params)
}
}

Expand Down
8 changes: 1 addition & 7 deletions client/consensus/relay-chain/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -197,13 +197,7 @@ where
sc_consensus::StorageChanges::Changes(storage_changes),
);

if let Err(err) = self
.block_import
.lock()
.await
.import_block(block_import_params, Default::default())
.await
{
if let Err(err) = self.block_import.lock().await.import_block(block_import_params).await {
tracing::error!(
target: LOG_TARGET,
at = ?parent.hash(),
Expand Down
3 changes: 1 addition & 2 deletions polkadot-parachain/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ use sc_network_sync::SyncingService;
use sc_service::{Configuration, PartialComponents, TFullBackend, TFullClient, TaskManager};
use sc_telemetry::{Telemetry, TelemetryHandle, TelemetryWorker, TelemetryWorkerHandle};
use sp_api::{ApiExt, ConstructRuntimeApi};
use sp_consensus::CacheKeyId;
use sp_consensus_aura::AuraApi;
use sp_keystore::SyncCryptoStorePtr;
use sp_runtime::{
Expand Down Expand Up @@ -1034,7 +1033,7 @@ where
async fn verify(
&mut self,
block_import: BlockImportParams<Block, ()>,
) -> Result<(BlockImportParams<Block, ()>, Option<Vec<(CacheKeyId, Vec<u8>)>>), String> {
) -> Result<BlockImportParams<Block, ()>, String> {
if self
.client
.runtime_api()
Expand Down

0 comments on commit 0ad678c

Please sign in to comment.