Skip to main content

soil_client/client_api/
backend.rs

1// This file is part of Soil.
2
3// Copyright (C) Soil contributors.
4// Copyright (C) Parity Technologies (UK) Ltd.
5// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
6
7//! Substrate Client data backend
8
9use std::collections::HashSet;
10
11use parking_lot::RwLock;
12
13use crate::consensus::BlockOrigin;
14use subsoil::api::CallContext;
15use subsoil::core::offchain::OffchainStorage;
16use subsoil::runtime::{
17	traits::{Block as BlockT, HashingFor, NumberFor},
18	Justification, Justifications, StateVersion, Storage,
19};
20use subsoil::state_machine::{
21	backend::AsTrieBackend, ChildStorageCollection, IndexOperation, IterArgs,
22	OffchainChangesCollection, StorageCollection, StorageIterator,
23};
24use subsoil::storage::{ChildInfo, StorageData, StorageKey};
25pub use subsoil::trie::MerkleValue;
26
27use super::UsageInfo;
28use crate::blockchain::Backend as BlockchainBackend;
29
30pub use subsoil::state_machine::{Backend as StateBackend, BackendTransaction, KeyValueStates};
31
32/// Extracts the state backend type for the given backend.
33pub type StateBackendFor<B, Block> = <B as Backend<Block>>::State;
34
35/// Describes which block import notification stream should be notified.
36#[derive(Debug, Clone, Copy)]
37pub enum ImportNotificationAction {
38	/// Notify only when the node has synced to the tip or there is a re-org.
39	RecentBlock,
40	/// Notify for every single block no matter what the sync state is.
41	EveryBlock,
42	/// Both block import notifications above should be fired.
43	Both,
44	/// No block import notification should be fired.
45	None,
46}
47
48/// Import operation summary.
49///
50/// Contains information about the block that just got imported,
51/// including storage changes, reorged blocks, etc.
52pub struct ImportSummary<Block: BlockT> {
53	/// Block hash of the imported block.
54	pub hash: Block::Hash,
55	/// Import origin.
56	pub origin: BlockOrigin,
57	/// Header of the imported block.
58	pub header: Block::Header,
59	/// Is this block a new best block.
60	pub is_new_best: bool,
61	/// Optional storage changes.
62	pub storage_changes: Option<(StorageCollection, ChildStorageCollection)>,
63	/// Tree route from old best to new best.
64	///
65	/// If `None`, there was no re-org while importing.
66	pub tree_route: Option<crate::blockchain::TreeRoute<Block>>,
67	/// What notify action to take for this import.
68	pub import_notification_action: ImportNotificationAction,
69}
70
71/// A stale block.
72#[derive(Clone, Debug)]
73pub struct StaleBlock<Block: BlockT> {
74	/// The hash of this block.
75	pub hash: Block::Hash,
76	/// Is this a head?
77	pub is_head: bool,
78}
79
80/// Finalization operation summary.
81///
82/// Contains information about the block that just got finalized,
83/// including tree heads that became stale at the moment of finalization.
84pub struct FinalizeSummary<Block: BlockT> {
85	/// Last finalized block header.
86	pub header: Block::Header,
87	/// Blocks that were finalized.
88	///
89	/// The last entry is the one that has been explicitly finalized.
90	pub finalized: Vec<Block::Hash>,
91	/// Blocks that became stale during this finalization operation.
92	pub stale_blocks: Vec<StaleBlock<Block>>,
93}
94
95/// Import operation wrapper.
96pub struct ClientImportOperation<Block: BlockT, B: Backend<Block>> {
97	/// DB Operation.
98	pub op: B::BlockImportOperation,
99	/// Summary of imported block.
100	pub notify_imported: Option<ImportSummary<Block>>,
101	/// Summary of finalized block.
102	pub notify_finalized: Option<FinalizeSummary<Block>>,
103}
104
105/// Helper function to apply auxiliary data insertion into an operation.
106pub fn apply_aux<'a, 'b: 'a, 'c: 'a, B, Block, D, I>(
107	operation: &mut ClientImportOperation<Block, B>,
108	insert: I,
109	delete: D,
110) -> crate::blockchain::Result<()>
111where
112	Block: BlockT,
113	B: Backend<Block>,
114	I: IntoIterator<Item = &'a (&'c [u8], &'c [u8])>,
115	D: IntoIterator<Item = &'a &'b [u8]>,
116{
117	operation.op.insert_aux(
118		insert
119			.into_iter()
120			.map(|(k, v)| (k.to_vec(), Some(v.to_vec())))
121			.chain(delete.into_iter().map(|k| (k.to_vec(), None))),
122	)
123}
124
125/// State of a new block.
126#[derive(Debug, Clone, Copy, PartialEq, Eq)]
127pub enum NewBlockState {
128	/// Normal block.
129	Normal,
130	/// New best block.
131	Best,
132	/// Newly finalized block (implicitly best).
133	Final,
134}
135
136impl NewBlockState {
137	/// Whether this block is the new best block.
138	pub fn is_best(self) -> bool {
139		match self {
140			NewBlockState::Best | NewBlockState::Final => true,
141			NewBlockState::Normal => false,
142		}
143	}
144
145	/// Whether this block is considered final.
146	pub fn is_final(self) -> bool {
147		match self {
148			NewBlockState::Final => true,
149			NewBlockState::Best | NewBlockState::Normal => false,
150		}
151	}
152}
153
154/// Block insertion operation.
155///
156/// Keeps hold if the inserted block state and data.
157pub trait BlockImportOperation<Block: BlockT> {
158	/// Associated state backend type.
159	type State: StateBackend<HashingFor<Block>>;
160
161	/// Returns pending state.
162	///
163	/// Returns None for backends with locally-unavailable state data.
164	fn state(&self) -> crate::blockchain::Result<Option<&Self::State>>;
165
166	/// Append block data to the transaction.
167	///
168	/// - `header`: The block header.
169	/// - `body`: The block body (extrinsics), if available.
170	/// - `indexed_body`: Raw extrinsic data to be stored in the transaction index, keyed by their
171	///   hash.
172	/// - `justifications`: Block justifications, e.g. finality proofs.
173	/// - `state`: Whether this is a normal block, the new best block, or a newly finalized block.
174	/// - `register_as_leaf`: Whether to add the block to the leaf set. Blocks imported during warp
175	///   sync are stored in the database but should not be registered as leaves, since they are
176	///   historical blocks and not candidates for chain progression.
177	fn set_block_data(
178		&mut self,
179		header: Block::Header,
180		body: Option<Vec<Block::Extrinsic>>,
181		indexed_body: Option<Vec<Vec<u8>>>,
182		justifications: Option<Justifications>,
183		state: NewBlockState,
184		register_as_leaf: bool,
185	) -> crate::blockchain::Result<()>;
186
187	/// Inject storage data into the database.
188	fn update_db_storage(
189		&mut self,
190		update: BackendTransaction<HashingFor<Block>>,
191	) -> crate::blockchain::Result<()>;
192
193	/// Set genesis state. If `commit` is `false` the state is saved in memory, but is not written
194	/// to the database.
195	fn set_genesis_state(
196		&mut self,
197		storage: Storage,
198		commit: bool,
199		state_version: StateVersion,
200	) -> crate::blockchain::Result<Block::Hash>;
201
202	/// Inject storage data into the database replacing any existing data.
203	fn reset_storage(
204		&mut self,
205		storage: Storage,
206		state_version: StateVersion,
207	) -> crate::blockchain::Result<Block::Hash>;
208
209	/// Set storage changes.
210	fn update_storage(
211		&mut self,
212		update: StorageCollection,
213		child_update: ChildStorageCollection,
214	) -> crate::blockchain::Result<()>;
215
216	/// Write offchain storage changes to the database.
217	fn update_offchain_storage(
218		&mut self,
219		_offchain_update: OffchainChangesCollection,
220	) -> crate::blockchain::Result<()> {
221		Ok(())
222	}
223
224	/// Insert auxiliary keys.
225	///
226	/// Values are `None` if should be deleted.
227	fn insert_aux<I>(&mut self, ops: I) -> crate::blockchain::Result<()>
228	where
229		I: IntoIterator<Item = (Vec<u8>, Option<Vec<u8>>)>;
230
231	/// Mark a block as finalized, if multiple blocks are finalized in the same operation then they
232	/// must be marked in ascending order.
233	fn mark_finalized(
234		&mut self,
235		hash: Block::Hash,
236		justification: Option<Justification>,
237	) -> crate::blockchain::Result<()>;
238
239	/// Mark a block as new head. If both block import and set head are specified, set head
240	/// overrides block import's best block rule.
241	fn mark_head(&mut self, hash: Block::Hash) -> crate::blockchain::Result<()>;
242
243	/// Add a transaction index operation.
244	fn update_transaction_index(
245		&mut self,
246		index: Vec<IndexOperation>,
247	) -> crate::blockchain::Result<()>;
248
249	/// Configure whether to create a block gap if newly imported block is missing parent
250	fn set_create_gap(&mut self, create_gap: bool);
251}
252
253/// Interface for performing operations on the backend.
254pub trait LockImportRun<Block: BlockT, B: Backend<Block>> {
255	/// Lock the import lock, and run operations inside.
256	fn lock_import_and_run<R, Err, F>(&self, f: F) -> Result<R, Err>
257	where
258		F: FnOnce(&mut ClientImportOperation<Block, B>) -> Result<R, Err>,
259		Err: From<crate::blockchain::Error>;
260}
261
262/// Finalize Facilities
263pub trait Finalizer<Block: BlockT, B: Backend<Block>> {
264	/// Mark all blocks up to given as finalized in operation.
265	///
266	/// If `justification` is provided it is stored with the given finalized
267	/// block (any other finalized blocks are left unjustified).
268	///
269	/// If the block being finalized is on a different fork from the current
270	/// best block the finalized block is set as best, this might be slightly
271	/// inaccurate (i.e. outdated). Usages that require determining an accurate
272	/// best block should use `SelectChain` instead of the client.
273	fn apply_finality(
274		&self,
275		operation: &mut ClientImportOperation<Block, B>,
276		block: Block::Hash,
277		justification: Option<Justification>,
278		notify: bool,
279	) -> crate::blockchain::Result<()>;
280
281	/// Finalize a block.
282	///
283	/// This will implicitly finalize all blocks up to it and
284	/// fire finality notifications.
285	///
286	/// If the block being finalized is on a different fork from the current
287	/// best block, the finalized block is set as best. This might be slightly
288	/// inaccurate (i.e. outdated). Usages that require determining an accurate
289	/// best block should use `SelectChain` instead of the client.
290	///
291	/// Pass a flag to indicate whether finality notifications should be propagated.
292	/// This is usually tied to some synchronization state, where we don't send notifications
293	/// while performing major synchronization work.
294	fn finalize_block(
295		&self,
296		block: Block::Hash,
297		justification: Option<Justification>,
298		notify: bool,
299	) -> crate::blockchain::Result<()>;
300}
301
302/// Provides access to an auxiliary database.
303///
304/// This is a simple global database not aware of forks. Can be used for storing auxiliary
305/// information like total block weight/difficulty for fork resolution purposes as a common use
306/// case.
307pub trait AuxStore {
308	/// Insert auxiliary data into key-value store.
309	///
310	/// Deletions occur after insertions.
311	fn insert_aux<
312		'a,
313		'b: 'a,
314		'c: 'a,
315		I: IntoIterator<Item = &'a (&'c [u8], &'c [u8])>,
316		D: IntoIterator<Item = &'a &'b [u8]>,
317	>(
318		&self,
319		insert: I,
320		delete: D,
321	) -> crate::blockchain::Result<()>;
322
323	/// Query auxiliary data from key-value store.
324	fn get_aux(&self, key: &[u8]) -> crate::blockchain::Result<Option<Vec<u8>>>;
325}
326
327/// An `Iterator` that iterates keys in a given block under a prefix.
328pub struct KeysIter<State, Block>
329where
330	State: StateBackend<HashingFor<Block>>,
331	Block: BlockT,
332{
333	inner: <State as StateBackend<HashingFor<Block>>>::RawIter,
334	state: State,
335}
336
337impl<State, Block> KeysIter<State, Block>
338where
339	State: StateBackend<HashingFor<Block>>,
340	Block: BlockT,
341{
342	/// Create a new iterator over storage keys.
343	pub fn new(
344		state: State,
345		prefix: Option<&StorageKey>,
346		start_at: Option<&StorageKey>,
347	) -> Result<Self, State::Error> {
348		let mut args = IterArgs::default();
349		args.prefix = prefix.as_ref().map(|prefix| prefix.0.as_slice());
350		args.start_at = start_at.as_ref().map(|start_at| start_at.0.as_slice());
351		args.start_at_exclusive = true;
352
353		Ok(Self { inner: state.raw_iter(args)?, state })
354	}
355
356	/// Create a new iterator over a child storage's keys.
357	pub fn new_child(
358		state: State,
359		child_info: ChildInfo,
360		prefix: Option<&StorageKey>,
361		start_at: Option<&StorageKey>,
362	) -> Result<Self, State::Error> {
363		let mut args = IterArgs::default();
364		args.prefix = prefix.as_ref().map(|prefix| prefix.0.as_slice());
365		args.start_at = start_at.as_ref().map(|start_at| start_at.0.as_slice());
366		args.child_info = Some(child_info);
367		args.start_at_exclusive = true;
368
369		Ok(Self { inner: state.raw_iter(args)?, state })
370	}
371}
372
373impl<State, Block> Iterator for KeysIter<State, Block>
374where
375	Block: BlockT,
376	State: StateBackend<HashingFor<Block>>,
377{
378	type Item = StorageKey;
379
380	fn next(&mut self) -> Option<Self::Item> {
381		self.inner.next_key(&self.state)?.ok().map(StorageKey)
382	}
383}
384
385/// An `Iterator` that iterates keys and values in a given block under a prefix.
386pub struct PairsIter<State, Block>
387where
388	State: StateBackend<HashingFor<Block>>,
389	Block: BlockT,
390{
391	inner: <State as StateBackend<HashingFor<Block>>>::RawIter,
392	state: State,
393}
394
395impl<State, Block> Iterator for PairsIter<State, Block>
396where
397	Block: BlockT,
398	State: StateBackend<HashingFor<Block>>,
399{
400	type Item = (StorageKey, StorageData);
401
402	fn next(&mut self) -> Option<Self::Item> {
403		self.inner
404			.next_pair(&self.state)?
405			.ok()
406			.map(|(key, value)| (StorageKey(key), StorageData(value)))
407	}
408}
409
410impl<State, Block> PairsIter<State, Block>
411where
412	State: StateBackend<HashingFor<Block>>,
413	Block: BlockT,
414{
415	/// Create a new iterator over storage key and value pairs.
416	pub fn new(
417		state: State,
418		prefix: Option<&StorageKey>,
419		start_at: Option<&StorageKey>,
420	) -> Result<Self, State::Error> {
421		let mut args = IterArgs::default();
422		args.prefix = prefix.as_ref().map(|prefix| prefix.0.as_slice());
423		args.start_at = start_at.as_ref().map(|start_at| start_at.0.as_slice());
424		args.start_at_exclusive = true;
425
426		Ok(Self { inner: state.raw_iter(args)?, state })
427	}
428}
429
430/// Provides access to storage primitives
431pub trait StorageProvider<Block: BlockT, B: Backend<Block>> {
432	/// Given a block's `Hash` and a key, return the value under the key in that block.
433	fn storage(
434		&self,
435		hash: Block::Hash,
436		key: &StorageKey,
437	) -> crate::blockchain::Result<Option<StorageData>>;
438
439	/// Given a block's `Hash` and a key, return the value under the hash in that block.
440	fn storage_hash(
441		&self,
442		hash: Block::Hash,
443		key: &StorageKey,
444	) -> crate::blockchain::Result<Option<Block::Hash>>;
445
446	/// Given a block's `Hash` and a key prefix, returns a `KeysIter` iterates matching storage
447	/// keys in that block.
448	fn storage_keys(
449		&self,
450		hash: Block::Hash,
451		prefix: Option<&StorageKey>,
452		start_key: Option<&StorageKey>,
453	) -> crate::blockchain::Result<KeysIter<B::State, Block>>;
454
455	/// Given a block's `Hash` and a key prefix, returns an iterator over the storage keys and
456	/// values in that block.
457	fn storage_pairs(
458		&self,
459		hash: <Block as BlockT>::Hash,
460		prefix: Option<&StorageKey>,
461		start_key: Option<&StorageKey>,
462	) -> crate::blockchain::Result<PairsIter<B::State, Block>>;
463
464	/// Given a block's `Hash`, a key and a child storage key, return the value under the key in
465	/// that block.
466	fn child_storage(
467		&self,
468		hash: Block::Hash,
469		child_info: &ChildInfo,
470		key: &StorageKey,
471	) -> crate::blockchain::Result<Option<StorageData>>;
472
473	/// Given a block's `Hash` and a key `prefix` and a child storage key,
474	/// returns a `KeysIter` that iterates matching storage keys in that block.
475	fn child_storage_keys(
476		&self,
477		hash: Block::Hash,
478		child_info: ChildInfo,
479		prefix: Option<&StorageKey>,
480		start_key: Option<&StorageKey>,
481	) -> crate::blockchain::Result<KeysIter<B::State, Block>>;
482
483	/// Given a block's `Hash`, a key and a child storage key, return the hash under the key in that
484	/// block.
485	fn child_storage_hash(
486		&self,
487		hash: Block::Hash,
488		child_info: &ChildInfo,
489		key: &StorageKey,
490	) -> crate::blockchain::Result<Option<Block::Hash>>;
491
492	/// Given a block's `Hash` and a key, return the closest merkle value.
493	fn closest_merkle_value(
494		&self,
495		hash: Block::Hash,
496		key: &StorageKey,
497	) -> crate::blockchain::Result<Option<MerkleValue<Block::Hash>>>;
498
499	/// Given a block's `Hash`, a key and a child storage key, return the closest merkle value.
500	fn child_closest_merkle_value(
501		&self,
502		hash: Block::Hash,
503		child_info: &ChildInfo,
504		key: &StorageKey,
505	) -> crate::blockchain::Result<Option<MerkleValue<Block::Hash>>>;
506}
507
508/// Specify the desired trie cache context when calling [`Backend::state_at`].
509///
510/// This is used to determine the size of the local trie cache.
511#[derive(Debug, Clone, Copy)]
512pub enum TrieCacheContext {
513	/// This is used when calling [`Backend::state_at`] in a trusted context.
514	///
515	/// A trusted context is for example the building or importing of a block.
516	/// In this case the local trie cache can grow unlimited and all the cached data
517	/// will be propagated back to the shared trie cache. It is safe to let the local
518	/// cache grow to hold the entire data, because importing and building blocks is
519	/// bounded by the block size limit.
520	Trusted,
521	/// This is used when calling [`Backend::state_at`] in from untrusted context.
522	///
523	/// The local trie cache will be bounded by its preconfigured size.
524	Untrusted,
525}
526
527impl From<CallContext> for TrieCacheContext {
528	fn from(call_context: CallContext) -> Self {
529		match call_context {
530			CallContext::Onchain => TrieCacheContext::Trusted,
531			CallContext::Offchain => TrieCacheContext::Untrusted,
532		}
533	}
534}
535
536/// Client backend.
537///
538/// Manages the data layer.
539///
540/// # State Pruning
541///
542/// While an object from `state_at` is alive, the state
543/// should not be pruned. The backend should internally reference-count
544/// its state objects.
545///
546/// The same applies for live `BlockImportOperation`s: while an import operation building on a
547/// parent `P` is alive, the state for `P` should not be pruned.
548///
549/// # Block Pruning
550///
551/// Users can pin blocks in memory by calling `pin_block`. When
552/// a block would be pruned, its value is kept in an in-memory cache
553/// until it is unpinned via `unpin_block`.
554///
555/// While a block is pinned, its state is also preserved.
556///
557/// The backend should internally reference count the number of pin / unpin calls.
558pub trait Backend<Block: BlockT>: AuxStore + Send + Sync {
559	/// Associated block insertion operation type.
560	type BlockImportOperation: BlockImportOperation<Block, State = Self::State>;
561	/// Associated blockchain backend type.
562	type Blockchain: BlockchainBackend<Block>;
563	/// Associated state backend type.
564	type State: StateBackend<HashingFor<Block>>
565		+ Send
566		+ AsTrieBackend<
567			HashingFor<Block>,
568			TrieBackendStorage = <Self::State as StateBackend<HashingFor<Block>>>::TrieBackendStorage,
569		>;
570	/// Offchain workers local storage.
571	type OffchainStorage: OffchainStorage;
572
573	/// Begin a new block insertion transaction with given parent block id.
574	///
575	/// When constructing the genesis, this is called with all-zero hash.
576	fn begin_operation(&self) -> crate::blockchain::Result<Self::BlockImportOperation>;
577
578	/// Note an operation to contain state transition.
579	fn begin_state_operation(
580		&self,
581		operation: &mut Self::BlockImportOperation,
582		block: Block::Hash,
583	) -> crate::blockchain::Result<()>;
584
585	/// Commit block insertion.
586	fn commit_operation(
587		&self,
588		transaction: Self::BlockImportOperation,
589	) -> crate::blockchain::Result<()>;
590
591	/// Finalize block with given `hash`.
592	///
593	/// This should only be called if the parent of the given block has been finalized.
594	fn finalize_block(
595		&self,
596		hash: Block::Hash,
597		justification: Option<Justification>,
598	) -> crate::blockchain::Result<()>;
599
600	/// Append justification to the block with the given `hash`.
601	///
602	/// This should only be called for blocks that are already finalized.
603	fn append_justification(
604		&self,
605		hash: Block::Hash,
606		justification: Justification,
607	) -> crate::blockchain::Result<()>;
608
609	/// Returns reference to blockchain backend.
610	fn blockchain(&self) -> &Self::Blockchain;
611
612	/// Returns current usage statistics.
613	fn usage_info(&self) -> Option<UsageInfo>;
614
615	/// Returns a handle to offchain storage.
616	fn offchain_storage(&self) -> Option<Self::OffchainStorage>;
617
618	/// Pin the block to keep body, justification and state available after pruning.
619	/// Number of pins are reference counted. Users need to make sure to perform
620	/// one call to [`Self::unpin_block`] per call to [`Self::pin_block`].
621	fn pin_block(&self, hash: Block::Hash) -> crate::blockchain::Result<()>;
622
623	/// Unpin the block to allow pruning.
624	fn unpin_block(&self, hash: Block::Hash);
625
626	/// Returns true if state for given block is available.
627	fn have_state_at(&self, hash: Block::Hash, _number: NumberFor<Block>) -> bool {
628		self.state_at(hash, TrieCacheContext::Untrusted).is_ok()
629	}
630
631	/// Returns state backend with post-state of given block.
632	fn state_at(
633		&self,
634		hash: Block::Hash,
635		trie_cache_context: TrieCacheContext,
636	) -> crate::blockchain::Result<Self::State>;
637
638	/// Attempts to revert the chain by `n` blocks. If `revert_finalized` is set it will attempt to
639	/// revert past any finalized block, this is unsafe and can potentially leave the node in an
640	/// inconsistent state. All blocks higher than the best block are also reverted and not counting
641	/// towards `n`.
642	///
643	/// Returns the number of blocks that were successfully reverted and the list of finalized
644	/// blocks that has been reverted.
645	fn revert(
646		&self,
647		n: NumberFor<Block>,
648		revert_finalized: bool,
649	) -> crate::blockchain::Result<(NumberFor<Block>, HashSet<Block::Hash>)>;
650
651	/// Discard non-best, unfinalized leaf block.
652	fn remove_leaf_block(&self, hash: Block::Hash) -> crate::blockchain::Result<()>;
653
654	/// Insert auxiliary data into key-value store.
655	fn insert_aux<
656		'a,
657		'b: 'a,
658		'c: 'a,
659		I: IntoIterator<Item = &'a (&'c [u8], &'c [u8])>,
660		D: IntoIterator<Item = &'a &'b [u8]>,
661	>(
662		&self,
663		insert: I,
664		delete: D,
665	) -> crate::blockchain::Result<()> {
666		AuxStore::insert_aux(self, insert, delete)
667	}
668	/// Query auxiliary data from key-value store.
669	fn get_aux(&self, key: &[u8]) -> crate::blockchain::Result<Option<Vec<u8>>> {
670		AuxStore::get_aux(self, key)
671	}
672
673	/// Gain access to the import lock around this backend.
674	///
675	/// _Note_ Backend isn't expected to acquire the lock by itself ever. Rather
676	/// the using components should acquire and hold the lock whenever they do
677	/// something that the import of a block would interfere with, e.g. importing
678	/// a new block or calculating the best head.
679	fn get_import_lock(&self) -> &RwLock<()>;
680
681	/// Tells whether the backend requires full-sync mode.
682	fn requires_full_sync(&self) -> bool;
683}
684
685/// Mark for all Backend implementations, that are making use of state data, stored locally.
686pub trait LocalBackend<Block: BlockT>: Backend<Block> {}