This repository was archived by the owner on Nov 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
state_machine no_std witness externalities #6934
Merged
Merged
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
ea03567
checkpoint before removing CT from change trie
cheme c0e25ae
before trie backend without tx
cheme 2cb6378
undo
cheme b0e04a4
Started no transaction, but would need using a different root
cheme a9aa27c
Remove NoTransaction.
cheme 2747339
Merge branch 'master' into witness_backend
cheme cac2280
partially address review.
cheme 11305d1
Remove ChangeTrieOverlay.
cheme 4f05206
modified function
cheme d4ce6dd
Merge branch 'master' into witness_backend
cheme 147ef68
Remove witness_ext
cheme d067b0c
need noops changes root
cheme 0e6b642
update from cumulus branch
cheme 4c454cc
line break
cheme d32e3fd
remove warning
cheme 753a8d7
line break
cheme 2d63cf7
From review: renamings and stats active in no std (except time).
cheme 1fadc14
Merge branch 'master' into witness_backend
cheme 9b3146d
include cache, exclude change trie cache with individual temporary ba…
cheme bdbaefc
little test
cheme d1b10c8
fuse imports and filter_map prepare_extrinsics_input_inner fold.
cheme 14e40b6
put back ExtInner into Ext, awkward double proto for new function.
cheme e459698
Apply suggestions from code review
bkchr bef5997
Update primitives/state-machine/Cargo.toml
bkchr File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fuse imports and filter_map prepare_extrinsics_input_inner fold.
- Loading branch information
commit d1b10c84fdcb6518abbeced6b159b5e746cae753
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -132,52 +132,57 @@ fn prepare_extrinsics_input_inner<'a, B, H, Number>( | |
| block: &Number, | ||
| overlay: &'a OverlayedChanges, | ||
| child_info: Option<ChildInfo>, | ||
| mut changes: impl Iterator<Item=(&'a StorageKey, &'a OverlayedValue)> | ||
| changes: impl Iterator<Item=(&'a StorageKey, &'a OverlayedValue)> | ||
| ) -> Result<impl Iterator<Item=InputPair<Number>> + 'a, String> | ||
| where | ||
| B: Backend<H>, | ||
| H: Hasher, | ||
| Number: BlockNumber, | ||
| { | ||
| changes | ||
| .try_fold(BTreeMap::new(), |mut map: BTreeMap<&[u8], (ExtrinsicIndex<Number>, Vec<u32>)>, (k, v)| { | ||
| .filter_map(|(k, v)| { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks much better! |
||
| let extrinsics = v.extrinsics(); | ||
| if !extrinsics.is_empty() { | ||
| match map.entry(k) { | ||
| Entry::Vacant(entry) => { | ||
| // ignore temporary values (values that have null value at the end of operation | ||
| // AND are not in storage at the beginning of operation | ||
| if let Some(child_info) = child_info.as_ref() { | ||
| if !overlay.child_storage(child_info, k).map(|v| v.is_some()).unwrap_or_default() { | ||
| if !backend.exists_child_storage(&child_info, k) | ||
| .map_err(|e| format!("{}", e))? { | ||
| return Ok(map); | ||
| } | ||
| 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 | ||
| // AND are not in storage at the beginning of operation | ||
| if let Some(child_info) = child_info.as_ref() { | ||
| if !overlay.child_storage(child_info, k).map(|v| v.is_some()).unwrap_or_default() { | ||
| if !backend.exists_child_storage(&child_info, k) | ||
| .map_err(|e| format!("{}", e))? { | ||
| return Ok(map); | ||
| } | ||
| } else { | ||
| if !overlay.storage(k).map(|v| v.is_some()).unwrap_or_default() { | ||
| if !backend.exists_storage(k).map_err(|e| format!("{}", e))? { | ||
| return Ok(map); | ||
| } | ||
| } | ||
| } else { | ||
| if !overlay.storage(k).map(|v| v.is_some()).unwrap_or_default() { | ||
| if !backend.exists_storage(k).map_err(|e| format!("{}", e))? { | ||
| return Ok(map); | ||
| } | ||
| }; | ||
|
|
||
| let extrinsics = extrinsics.into_iter().collect(); | ||
| entry.insert((ExtrinsicIndex { | ||
| block: block.clone(), | ||
| key: k.to_vec(), | ||
| }, extrinsics)); | ||
| }, | ||
| 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 entry_extrinsics = &mut entry.get_mut().1; | ||
| entry_extrinsics.extend( | ||
| extrinsics.into_iter() | ||
| ); | ||
| entry_extrinsics.sort(); | ||
| }, | ||
| } | ||
| } | ||
| }; | ||
|
|
||
| let extrinsics = extrinsics.into_iter().collect(); | ||
| entry.insert((ExtrinsicIndex { | ||
| block: block.clone(), | ||
| key: k.to_vec(), | ||
| }, extrinsics)); | ||
| }, | ||
| 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 entry_extrinsics = &mut entry.get_mut().1; | ||
| entry_extrinsics.extend( | ||
| extrinsics.into_iter() | ||
| ); | ||
| entry_extrinsics.sort(); | ||
| }, | ||
| } | ||
|
|
||
| Ok(map) | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.