mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 09:21:05 +00:00
state_machine no_std witness externalities (#6934)
* checkpoint before removing CT from change trie * before trie backend without tx * undo * Started no transaction, but would need using a different root calculation method, out of the scope of this pr, will roll back. * Remove NoTransaction. * partially address review. dummy stats implementation for no_std. * Remove ChangeTrieOverlay. * modified function * Remove witness_ext * need noops changes root * update from cumulus branch * line break * remove warning * line break * From review: renamings and stats active in no std (except time). * include cache, exclude change trie cache with individual temporary bad looking no_std check * little test * fuse imports and filter_map prepare_extrinsics_input_inner fold. * put back ExtInner into Ext, awkward double proto for new function. * Apply suggestions from code review * Update primitives/state-machine/Cargo.toml Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
This commit is contained in:
@@ -22,7 +22,9 @@
|
||||
//!
|
||||
//! It is required that each extension implements the [`Extension`] trait.
|
||||
|
||||
use std::{collections::HashMap, collections::hash_map::Entry, any::{Any, TypeId}, ops::DerefMut};
|
||||
use sp_std::{
|
||||
collections::btree_map::{BTreeMap, Entry}, any::{Any, TypeId}, ops::DerefMut, boxed::Box,
|
||||
};
|
||||
use crate::Error;
|
||||
|
||||
/// Marker trait for types that should be registered as [`Externalities`](crate::Externalities) extension.
|
||||
@@ -104,9 +106,10 @@ pub trait ExtensionStore {
|
||||
/// Stores extensions that should be made available through the externalities.
|
||||
#[derive(Default)]
|
||||
pub struct Extensions {
|
||||
extensions: HashMap<TypeId, Box<dyn Extension>>,
|
||||
extensions: BTreeMap<TypeId, Box<dyn Extension>>,
|
||||
}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
impl std::fmt::Debug for Extensions {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
write!(f, "Extensions: ({})", self.extensions.len())
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
|
||||
//! Substrate externalities abstraction
|
||||
//!
|
||||
//! The externalities mainly provide access to storage and to registered extensions. Extensions
|
||||
@@ -23,7 +25,7 @@
|
||||
//!
|
||||
//! This crate exposes the main [`Externalities`] trait.
|
||||
|
||||
use std::any::{Any, TypeId};
|
||||
use sp_std::{any::{Any, TypeId}, vec::Vec, boxed::Box};
|
||||
|
||||
use sp_storage::{ChildInfo, TrackedStorageKey};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user