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
+5 -17
View File
@@ -53,8 +53,7 @@ const LOG_TARGET: &str = "slots";
/// The changes that need to applied to the storage to create the state for a block.
///
/// See [`sp_state_machine::StorageChanges`] for more information.
pub type StorageChanges<Transaction, Block> =
sp_state_machine::StorageChanges<Transaction, HashingFor<Block>>;
pub type StorageChanges<Block> = sp_state_machine::StorageChanges<HashingFor<Block>>;
/// The result of [`SlotWorker::on_slot`].
#[derive(Debug, Clone)]
@@ -84,9 +83,7 @@ pub trait SlotWorker<B: BlockT, Proof> {
#[async_trait::async_trait]
pub trait SimpleSlotWorker<B: BlockT> {
/// A handle to a `BlockImport`.
type BlockImport: BlockImport<B, Transaction = <Self::Proposer as Proposer<B>>::Transaction>
+ Send
+ 'static;
type BlockImport: BlockImport<B> + Send + 'static;
/// A handle to a `SyncOracle`.
type SyncOracle: SyncOracle;
@@ -148,13 +145,10 @@ pub trait SimpleSlotWorker<B: BlockT> {
header: B::Header,
header_hash: &B::Hash,
body: Vec<B::Extrinsic>,
storage_changes: StorageChanges<<Self::BlockImport as BlockImport<B>>::Transaction, B>,
storage_changes: StorageChanges<B>,
public: Self::Claim,
aux_data: Self::AuxData,
) -> Result<
sc_consensus::BlockImportParams<B, <Self::BlockImport as BlockImport<B>>::Transaction>,
sp_consensus::Error,
>;
) -> Result<sc_consensus::BlockImportParams<B>, sp_consensus::Error>;
/// Whether to force authoring if offline.
fn force_authoring(&self) -> bool;
@@ -191,13 +185,7 @@ pub trait SimpleSlotWorker<B: BlockT> {
claim: &Self::Claim,
slot_info: SlotInfo<B>,
end_proposing_at: Instant,
) -> Option<
Proposal<
B,
<Self::Proposer as Proposer<B>>::Transaction,
<Self::Proposer as Proposer<B>>::Proof,
>,
> {
) -> Option<Proposal<B, <Self::Proposer as Proposer<B>>::Proof>> {
let slot = slot_info.slot;
let telemetry = self.telemetry();
let log_target = self.logging_target();