Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
polkadot-sdk
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
parity
Mirrored projects
polkadot-sdk
Commits
31da4d24
Commit
31da4d24
authored
5 years ago
by
Bastian Köcher
Committed by
Gavin Wood
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Don't set `HEAP_PAGES` in `BasicExternalities` (#3244)
* Don't set `HEAP_PAGES` in `BasicExternalities` * Fix test
parent
04c115a6
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
substrate/core/state-machine/src/basic.rs
+11
-5
11 additions, 5 deletions
substrate/core/state-machine/src/basic.rs
with
11 additions
and
5 deletions
substrate/core/state-machine/src/basic.rs
+
11
−
5
View file @
31da4d24
...
...
@@ -22,8 +22,7 @@ use crate::backend::{Backend, InMemory};
use
hash_db
::
Hasher
;
use
trie
::
trie_root
;
use
primitives
::
offchain
;
use
primitives
::
storage
::
well_known_keys
::{
HEAP_PAGES
,
is_child_storage_key
};
use
parity_codec
::
Encode
;
use
primitives
::
storage
::
well_known_keys
::
is_child_storage_key
;
use
super
::{
ChildStorageKey
,
Externalities
};
use
log
::
warn
;
...
...
@@ -42,10 +41,9 @@ impl BasicExternalities {
/// Create a new instance of `BasicExternalities` with children
pub
fn
new_with_children
(
mut
top
:
HashMap
<
Vec
<
u8
>
,
Vec
<
u8
>>
,
top
:
HashMap
<
Vec
<
u8
>
,
Vec
<
u8
>>
,
children
:
HashMap
<
Vec
<
u8
>
,
HashMap
<
Vec
<
u8
>
,
Vec
<
u8
>>>
,
)
->
Self
{
top
.insert
(
HEAP_PAGES
.to_vec
(),
8u64
.encode
());
BasicExternalities
{
top
,
children
,
...
...
@@ -188,7 +186,7 @@ mod tests {
ext
.set_storage
(
b"doe"
.to_vec
(),
b"reindeer"
.to_vec
());
ext
.set_storage
(
b"dog"
.to_vec
(),
b"puppy"
.to_vec
());
ext
.set_storage
(
b"dogglesworth"
.to_vec
(),
b"cat"
.to_vec
());
const
ROOT
:
[
u8
;
32
]
=
hex!
(
"0b
33ed94e74e0f8e92a55923bece1ed02d16cf424e124613ddebc53ac3eeeabe
"
);
const
ROOT
:
[
u8
;
32
]
=
hex!
(
"0b
41e488cccbd67d1f1089592c2c235f5c5399b053f7fe9152dd4b5f279914cd
"
);
assert_eq!
(
ext
.storage_root
(),
H256
::
from
(
ROOT
));
}
...
...
@@ -231,4 +229,12 @@ mod tests {
ext
.kill_child_storage
(
child
());
assert_eq!
(
ext
.child_storage
(
child
(),
b"doe"
),
None
);
}
#[test]
fn
basic_externalities_is_empty
()
{
// Make sure no values are set by default in `BasicExternalities`.
let
(
storage
,
child_storage
)
=
BasicExternalities
::
new
(
Default
::
default
())
.into_storages
();
assert!
(
storage
.is_empty
());
assert!
(
child_storage
.is_empty
());
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment