-
Notifications
You must be signed in to change notification settings - Fork 146
feat(l1): implement flatkeyvalue (snapshots) #4884
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
77c61a6
37fadd9
731f5ef
29850f8
4f8e956
fa27f76
9bda718
fd66967
26a5715
aa86d98
675ee90
60e3476
cc54cd9
e3103f0
fd0a71c
148655f
0592338
8aa3966
175de2d
454db9b
8eac9a9
2678119
cfda5fb
a23275d
e1b301c
5c34ee8
e4f5a18
3af5e60
b8d5a78
840cb3d
77458d4
fad5ba5
9935d98
a011a3e
5f41620
63f01dc
dede3ab
fa28ad7
fa47749
ee75c19
6136bf8
2b077da
fc02510
aa63a77
9e06da7
8750945
0c6ba6e
3a01580
e5645dd
ef27dc6
49e817f
dce6506
63eec48
f688021
5d45a41
d4cdc9c
2d81017
9f0a639
bb0464f
9387932
8cfbe4c
f058dd6
7dd5d73
5c0a47c
f80e1b5
62dba3c
ca69f55
2753a9a
dd45f7d
cd889eb
36d7a40
f8150c4
389c8d4
4a17209
bbbe4eb
844247f
e626ca0
a950ce2
31b0590
bafbcc0
c60a57c
986f059
d99b01a
c703e13
a82b75c
c0ee61e
78cbe11
889a696
5fb1428
c8a0671
6b994c3
bd49420
d595a6a
ac7edd4
9236bea
12357f6
3a9a443
0253eae
0573013
c7732cf
f79ac75
b28da0f
160381a
449dbe5
8721a47
95dcfec
44a4fdc
0a76511
285bb60
24c102a
92dc4f4
01ae76a
1ab221b
093b987
a317224
be14f5f
965474b
8c48e34
f504301
811daf4
10bb130
c65f10f
bea428f
87a56e5
6032348
8681ca8
f477f81
08424a6
7856ee4
6bb4c64
f07ff1a
d692dba
88b65cc
0dc67db
8059482
e688e36
ea12776
cf89733
036684d
1197e92
77c0c39
2005866
5c2e33b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -98,6 +98,19 @@ impl Trie { | |
| pub fn get(&self, pathrlp: &PathRLP) -> Result<Option<ValueRLP>, TrieError> { | ||
| let path = Nibbles::from_bytes(pathrlp); | ||
|
|
||
| if pathrlp.len() == 32 | ||
|
Contributor
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. Similarly, we shouldn't have to check length here. |
||
| && !self.pending_removal.contains(&path) | ||
| && self.db().flatkeyvalue_computed(path.clone()) | ||
| { | ||
| let Some(value_rlp) = self.db.get(path)? else { | ||
| return Ok(None); | ||
| }; | ||
| if value_rlp.is_empty() { | ||
| return Ok(None); | ||
| } | ||
| return Ok(Some(value_rlp)); | ||
| } | ||
|
|
||
| Ok(match self.root { | ||
| NodeRef::Node(ref node, _) => node.get(self.db.as_ref(), path)?, | ||
| NodeRef::Hash(hash) if hash.is_valid() => Node::decode( | ||
|
|
@@ -138,6 +151,10 @@ impl Trie { | |
| if !self.root.is_valid() { | ||
| return Ok(None); | ||
| } | ||
| if path.len() == 32 { | ||
| self.pending_removal.insert(Nibbles::from_bytes(path)); | ||
| } | ||
|
Comment on lines
+154
to
+156
Contributor
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. This is not true for all tries (receipts, transactions and withdrawals use their index encoded as RLP as key), but also at this level |
||
|
|
||
| // If the trie is not empty, call the root node's removal logic. | ||
| let (node, value) = self | ||
| .root | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should have a comment here.