Set StateBackend::Transaction to PrefixedMemoryDB (#14612)

* Yep

* Try to get it working everywhere

* Make `from_raw_storage` start with an empty db

* More fixes!

* Make everything compile

* Fix `child_storage_root`

* Fix after merge

* Cleanups

* Update primitives/state-machine/src/overlayed_changes/mod.rs

Co-authored-by: Davide Galassi <davxy@datawok.net>

* Review comments

* Fix issues

* Silence warning

* FMT

* Clippy

---------

Co-authored-by: Davide Galassi <davxy@datawok.net>
This commit is contained in:
Bastian Köcher
2023-08-17 12:49:38 +02:00
committed by GitHub
parent a892fa7f92
commit ecf8035da6
67 changed files with 750 additions and 1150 deletions
@@ -20,7 +20,7 @@ use std::sync::Arc;
use log::debug;
use sp_api::{ProvideRuntimeApi, TransactionFor};
use sp_api::ProvideRuntimeApi;
use sp_consensus::Error as ConsensusError;
use sp_consensus_beefy::{ecdsa_crypto::AuthorityId, BeefyApi, BEEFY_ENGINE_ID};
use sp_runtime::{
@@ -118,21 +118,15 @@ impl<Block, BE, Runtime, I> BlockImport<Block> for BeefyBlockImport<Block, BE, R
where
Block: BlockT,
BE: Backend<Block>,
I: BlockImport<
Block,
Error = ConsensusError,
Transaction = sp_api::TransactionFor<Runtime, Block>,
> + Send
+ Sync,
I: BlockImport<Block, Error = ConsensusError> + Send + Sync,
Runtime: ProvideRuntimeApi<Block> + Send + Sync,
Runtime::Api: BeefyApi<Block, AuthorityId>,
{
type Error = ConsensusError;
type Transaction = TransactionFor<Runtime, Block>;
async fn import_block(
&mut self,
mut block: BlockImportParams<Block, Self::Transaction>,
mut block: BlockImportParams<Block>,
) -> Result<ImportResult, Self::Error> {
let hash = block.post_hash();
let number = *block.header.number();
+1 -3
View File
@@ -139,9 +139,7 @@ pub fn beefy_block_import_and_links<B, BE, RuntimeApi, I>(
where
B: Block,
BE: Backend<B>,
I: BlockImport<B, Error = ConsensusError, Transaction = sp_api::TransactionFor<RuntimeApi, B>>
+ Send
+ Sync,
I: BlockImport<B, Error = ConsensusError> + Send + Sync,
RuntimeApi: ProvideRuntimeApi<B> + Send + Sync,
RuntimeApi::Api: BeefyApi<B, AuthorityId>,
{
@@ -83,7 +83,7 @@ type BeefyBlockImport = crate::BeefyBlockImport<
Block,
substrate_test_runtime_client::Backend,
TestApi,
BlockImportAdapter<PeersClient, sp_api::TransactionFor<TestApi, Block>>,
BlockImportAdapter<PeersClient>,
>;
pub(crate) type BeefyValidatorSet = ValidatorSet<AuthorityId>;