mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-14 15:41:02 +00:00
consensus: remove caching functionality from block import pipeline (#13551)
* consensus: remove caching functionality from block import pipeline * client: update docs on Verifier::verify * node: fix block production benchmark
This commit is contained in:
@@ -16,13 +16,13 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use std::sync::Arc;
|
||||
|
||||
use log::debug;
|
||||
use sp_consensus_beefy::{BeefyApi, BEEFY_ENGINE_ID};
|
||||
use std::{collections::HashMap, sync::Arc};
|
||||
|
||||
use sp_api::{ProvideRuntimeApi, TransactionFor};
|
||||
use sp_blockchain::well_known_cache_keys;
|
||||
use sp_consensus::Error as ConsensusError;
|
||||
use sp_consensus_beefy::{BeefyApi, BEEFY_ENGINE_ID};
|
||||
use sp_runtime::{
|
||||
traits::{Block as BlockT, Header as HeaderT, NumberFor},
|
||||
EncodedJustification,
|
||||
@@ -132,7 +132,6 @@ where
|
||||
async fn import_block(
|
||||
&mut self,
|
||||
mut block: BlockImportParams<Block, Self::Transaction>,
|
||||
new_cache: HashMap<well_known_cache_keys::Id, Vec<u8>>,
|
||||
) -> Result<ImportResult, Self::Error> {
|
||||
let hash = block.post_hash();
|
||||
let number = *block.header.number();
|
||||
@@ -146,7 +145,7 @@ where
|
||||
});
|
||||
|
||||
// Run inner block import.
|
||||
let inner_import_result = self.inner.import_block(block, new_cache).await?;
|
||||
let inner_import_result = self.inner.import_block(block).await?;
|
||||
|
||||
match (beefy_encoded, &inner_import_result) {
|
||||
(Some(encoded), ImportResult::Imported(_)) => {
|
||||
|
||||
@@ -61,7 +61,7 @@ use sp_runtime::{
|
||||
traits::{Header as HeaderT, NumberFor},
|
||||
BuildStorage, DigestItem, EncodedJustification, Justifications, Storage,
|
||||
};
|
||||
use std::{collections::HashMap, marker::PhantomData, sync::Arc, task::Poll};
|
||||
use std::{marker::PhantomData, sync::Arc, task::Poll};
|
||||
use substrate_test_runtime_client::{runtime::Header, ClientExt};
|
||||
use tokio::time::Duration;
|
||||
|
||||
@@ -766,14 +766,11 @@ async fn beefy_importing_justifications() {
|
||||
|
||||
// Import block 1 without justifications.
|
||||
assert_eq!(
|
||||
block_import
|
||||
.import_block(params(block.clone(), None), HashMap::new())
|
||||
.await
|
||||
.unwrap(),
|
||||
block_import.import_block(params(block.clone(), None)).await.unwrap(),
|
||||
ImportResult::Imported(ImportedAux { is_new_best: true, ..Default::default() }),
|
||||
);
|
||||
assert_eq!(
|
||||
block_import.import_block(params(block, None), HashMap::new()).await.unwrap(),
|
||||
block_import.import_block(params(block, None)).await.unwrap(),
|
||||
ImportResult::AlreadyInChain,
|
||||
);
|
||||
|
||||
@@ -788,7 +785,7 @@ async fn beefy_importing_justifications() {
|
||||
let encoded = versioned_proof.encode();
|
||||
let justif = Some(Justifications::from((BEEFY_ENGINE_ID, encoded)));
|
||||
assert_eq!(
|
||||
block_import.import_block(params(block, justif), HashMap::new()).await.unwrap(),
|
||||
block_import.import_block(params(block, justif)).await.unwrap(),
|
||||
ImportResult::Imported(ImportedAux {
|
||||
bad_justification: false,
|
||||
is_new_best: true,
|
||||
@@ -820,7 +817,7 @@ async fn beefy_importing_justifications() {
|
||||
let justif = Some(Justifications::from((BEEFY_ENGINE_ID, encoded)));
|
||||
let mut justif_recv = justif_stream.subscribe(100_000);
|
||||
assert_eq!(
|
||||
block_import.import_block(params(block, justif), HashMap::new()).await.unwrap(),
|
||||
block_import.import_block(params(block, justif)).await.unwrap(),
|
||||
ImportResult::Imported(ImportedAux {
|
||||
bad_justification: false,
|
||||
is_new_best: true,
|
||||
@@ -856,7 +853,7 @@ async fn beefy_importing_justifications() {
|
||||
let justif = Some(Justifications::from((BEEFY_ENGINE_ID, encoded)));
|
||||
let mut justif_recv = justif_stream.subscribe(100_000);
|
||||
assert_eq!(
|
||||
block_import.import_block(params(block, justif), HashMap::new()).await.unwrap(),
|
||||
block_import.import_block(params(block, justif)).await.unwrap(),
|
||||
ImportResult::Imported(ImportedAux {
|
||||
// Still `false` because we don't want to fail import on bad BEEFY justifications.
|
||||
bad_justification: false,
|
||||
|
||||
Reference in New Issue
Block a user