mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 17:01:09 +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:
@@ -140,8 +140,15 @@ fn prepare_extrinsics_input_inner<'a, B, H, Number>(
|
||||
Number: BlockNumber,
|
||||
{
|
||||
changes
|
||||
.filter(|( _, v)| v.extrinsics().next().is_some())
|
||||
.try_fold(BTreeMap::new(), |mut map: BTreeMap<&[u8], (ExtrinsicIndex<Number>, Vec<u32>)>, (k, v)| {
|
||||
.filter_map(|(k, v)| {
|
||||
let extrinsics = v.extrinsics();
|
||||
if !extrinsics.is_empty() {
|
||||
Some((k, extrinsics))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
})
|
||||
.try_fold(BTreeMap::new(), |mut map: BTreeMap<&[u8], (ExtrinsicIndex<Number>, Vec<u32>)>, (k, extrinsics)| {
|
||||
match map.entry(k) {
|
||||
Entry::Vacant(entry) => {
|
||||
// ignore temporary values (values that have null value at the end of operation
|
||||
@@ -161,7 +168,7 @@ fn prepare_extrinsics_input_inner<'a, B, H, Number>(
|
||||
}
|
||||
};
|
||||
|
||||
let extrinsics = v.extrinsics().cloned().collect();
|
||||
let extrinsics = extrinsics.into_iter().collect();
|
||||
entry.insert((ExtrinsicIndex {
|
||||
block: block.clone(),
|
||||
key: k.to_vec(),
|
||||
@@ -170,11 +177,11 @@ fn prepare_extrinsics_input_inner<'a, B, H, Number>(
|
||||
Entry::Occupied(mut entry) => {
|
||||
// we do not need to check for temporary values here, because entry is Occupied
|
||||
// AND we are checking it before insertion
|
||||
let extrinsics = &mut entry.get_mut().1;
|
||||
extrinsics.extend(
|
||||
v.extrinsics().cloned()
|
||||
let entry_extrinsics = &mut entry.get_mut().1;
|
||||
entry_extrinsics.extend(
|
||||
extrinsics.into_iter()
|
||||
);
|
||||
extrinsics.sort();
|
||||
entry_extrinsics.sort();
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -85,9 +85,6 @@ use crate::{
|
||||
},
|
||||
};
|
||||
|
||||
/// Changes that are made outside of extrinsics are marked with this index;
|
||||
pub const NO_EXTRINSIC_INDEX: u32 = 0xffffffff;
|
||||
|
||||
/// Requirements for block number that can be used with changes tries.
|
||||
pub trait BlockNumber:
|
||||
Send + Sync + 'static +
|
||||
|
||||
Reference in New Issue
Block a user