Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
substrate
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
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
Denis_P
substrate
Commits
3a716693
Commit
3a716693
authored
4 years ago
by
cheme
Browse files
Options
Downloads
Patches
Plain Diff
fix
parent
e5d7b04a
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
primitives/state-machine/src/trie_backend.rs
+5
-12
5 additions, 12 deletions
primitives/state-machine/src/trie_backend.rs
primitives/state-machine/src/trie_backend_essence.rs
+1
-2
1 addition, 2 deletions
primitives/state-machine/src/trie_backend_essence.rs
with
6 additions
and
14 deletions
primitives/state-machine/src/trie_backend.rs
+
5
−
12
View file @
3a716693
...
...
@@ -84,8 +84,7 @@ impl<S: TrieBackendStorage<H>, H: Hasher> Backend<H> for TrieBackend<S, H> where
child_info
:
&
ChildInfo
,
key
:
&
[
u8
],
)
->
Result
<
Option
<
StorageValue
>
,
Self
::
Error
>
{
let
mut
buf
=
Vec
::
new
();
if
let
Some
(
essence
)
=
self
.child_essence
(
storage_key
,
child_info
,
&
mut
buf
)
?
{
if
let
Some
(
essence
)
=
self
.child_essence
(
storage_key
,
child_info
)
?
{
essence
.storage
(
key
)
}
else
{
Ok
(
None
)
...
...
@@ -102,8 +101,7 @@ impl<S: TrieBackendStorage<H>, H: Hasher> Backend<H> for TrieBackend<S, H> where
child_info
:
&
ChildInfo
,
key
:
&
[
u8
],
)
->
Result
<
Option
<
StorageKey
>
,
Self
::
Error
>
{
let
mut
buf
=
Vec
::
new
();
if
let
Some
(
essence
)
=
self
.child_essence
(
storage_key
,
child_info
,
&
mut
buf
)
?
{
if
let
Some
(
essence
)
=
self
.child_essence
(
storage_key
,
child_info
)
?
{
essence
.next_storage_key
(
key
)
}
else
{
Ok
(
None
)
...
...
@@ -124,8 +122,7 @@ impl<S: TrieBackendStorage<H>, H: Hasher> Backend<H> for TrieBackend<S, H> where
child_info
:
&
ChildInfo
,
f
:
F
,
)
{
let
mut
buf
=
Vec
::
new
();
if
let
Ok
(
Some
(
essence
))
=
self
.child_essence
(
storage_key
,
child_info
,
&
mut
buf
)
{
if
let
Ok
(
Some
(
essence
))
=
self
.child_essence
(
storage_key
,
child_info
)
{
essence
.for_keys
(
f
)
}
}
...
...
@@ -137,8 +134,7 @@ impl<S: TrieBackendStorage<H>, H: Hasher> Backend<H> for TrieBackend<S, H> where
prefix
:
&
[
u8
],
f
:
F
,
)
{
let
mut
buf
=
Vec
::
new
();
if
let
Ok
(
Some
(
essence
))
=
self
.child_essence
(
storage_key
,
child_info
,
&
mut
buf
)
{
if
let
Ok
(
Some
(
essence
))
=
self
.child_essence
(
storage_key
,
child_info
)
{
essence
.for_keys_with_prefix
(
prefix
,
f
)
}
}
...
...
@@ -230,8 +226,7 @@ impl<S: TrieBackendStorage<H>, H: Hasher> Backend<H> for TrieBackend<S, H> where
};
{
let
mut
buf
=
Vec
::
new
();
let
child_essence
=
ChildTrieBackendStorage
::
new
(
self
.essence
.backend_storage
(),
Some
(
child_info
),
&
mut
buf
);
let
child_essence
=
ChildTrieBackendStorage
::
new
(
self
.essence
.backend_storage
(),
Some
(
child_info
));
// Do not write prefix in overlay.
let
mut
eph
=
Ephemeral
::
new
(
&
child_essence
,
...
...
@@ -267,7 +262,6 @@ impl<S: TrieBackendStorage<H>, H: Hasher> TrieBackend<S, H> where
&
'a
self
,
storage_key
:
&
[
u8
],
child_info
:
&
'a
ChildInfo
,
buffer
:
&
'a
mut
Vec
<
u8
>
,
)
->
Result
<
Option
<
TrieBackendEssence
<
ChildTrieBackendStorage
<
'a
,
H
,
S
>
,
H
>>
,
<
Self
as
Backend
<
H
>>
::
Error
>
{
let
root
:
Option
<
H
::
Out
>
=
self
.storage
(
storage_key
)
?
.and_then
(|
encoded_root
|
Decode
::
decode
(
&
mut
&
encoded_root
[
..
])
.ok
());
...
...
@@ -275,7 +269,6 @@ impl<S: TrieBackendStorage<H>, H: Hasher> TrieBackend<S, H> where
Some
(
TrieBackendEssence
::
new
(
ChildTrieBackendStorage
::
new
(
self
.essence
.backend_storage
(),
Some
(
child_info
),
buffer
,
),
root
))
}
else
{
None
...
...
This diff is collapsed.
Click to expand it.
primitives/state-machine/src/trie_backend_essence.rs
+
1
−
2
View file @
3a716693
...
...
@@ -430,11 +430,10 @@ pub struct ChildTrieBackendStorage<'a, H: Hasher, B: TrieBackendStorageRef<H>> {
impl
<
'a
,
H
:
Hasher
,
B
:
TrieBackendStorageRef
<
H
>>
ChildTrieBackendStorage
<
'a
,
H
,
B
>
{
/// Instantiate a `ChildTrieBackendStorage`.
pub
fn
new
(
db
:
&
'a
B
,
info
:
Option
<&
'a
ChildInfo
>
,
buffer
:
&
'a
mut
Vec
<
u8
>
)
->
Self
{
pub
fn
new
(
db
:
&
'a
B
,
info
:
Option
<&
'a
ChildInfo
>
)
->
Self
{
ChildTrieBackendStorage
{
db
,
info
,
buffer
,
_ph
:
PhantomData
,
}
}
...
...
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