-
Notifications
You must be signed in to change notification settings - Fork 66
feat(l1): support snap capability message GetTrieNodes
#1031
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
Merged
Merged
Changes from 130 commits
Commits
Show all changes
183 commits
Select commit
Hold shift + click to select a range
02fe744
Corrupted History Fix
fmoletta a2a2aac
Fix slim encoding for AccountState
fmoletta aef7441
Fix slim encoding for AccountState
fmoletta 13d9bc3
Commit progress
fmoletta 0ca3589
Commit progress
fmoletta 66b6f90
Add snap as supported cap
fmoletta 41dcaff
Push missing changes
fmoletta a526c10
Initial peer listen loop
ElFantasma 562bc49
Deprecate `RLPEncodeSlim` trait and use `AccountStateSlim` instead
fmoletta 3893b05
Fix logic
fmoletta dbe110f
Remove debug print
fmoletta 8b8eacb
Limit response bytes
fmoletta 4ee1790
Add test
fmoletta d87b1ca
Add more tests
fmoletta 89621bf
Cleanup test code + Fix logic + add test
fmoletta 3a14cdd
Add test
fmoletta c354321
Add test
fmoletta 7abd4f7
Add test
fmoletta 7cee2b7
Add test
fmoletta 579309f
Also fetch limit proof
fmoletta 9fccb07
Trim test state 408 -> 100
fmoletta 38a7d5b
Simplify logic
fmoletta 574299b
Merge branch 'main' into 840-rlpx-listen-loop
ElFantasma 704da4c
Encode accounts while building range so we do not encode twice
fmoletta b55294b
Merge branch 'main' of github.com:lambdaclass/lambda_ethereum_rust in…
fmoletta 6d5cc45
Clippy
fmoletta 9514037
Add allow tag
fmoletta a5b3934
Remove comment
fmoletta 68dcef6
Fix typo
fmoletta f23077e
Sending eth Status message first
ElFantasma 122778d
Small fixes
ElFantasma 7a4f9cf
Merge branch 'main' into 840-rlpx-listen-loop
ElFantasma 5ae41fe
Small fixes
ElFantasma 66b0bd8
Added TODO comments for pending tasks
ElFantasma 6a5f580
Refactored code to separate encoding/decoding from backend logic
ElFantasma 6c04bb6
Merge branch '840-rlpx-listen-loop' of github.com:lambdaclass/lambda_…
fmoletta 05c9a5e
Replaced hardcoded capabilities strings with enums
ElFantasma f011aa6
Merge branch 'main' into 840-rlpx-listen-loop
ElFantasma 8ea2644
Add snap messages to liste loop
fmoletta 42049ab
Made Status test to pass
ElFantasma 34e0d9c
Merge branch 'main' into 840-rlpx-listen-loop
ElFantasma 940b6f3
Fixed format
ElFantasma 8047f41
Removed required Debug format on error printing
ElFantasma f474617
Trying previous commit from hive to see if CI works
ElFantasma 1d5223b
Fix `AccountRange message decoding
fmoletta 80329c7
Fix
fmoletta 297a37b
fix
fmoletta f25fb1a
Fix: build proof for last account not limit hash
fmoletta 0fdf562
Using apply_fork_choice to set last block number and make blocks cann…
ElFantasma c989418
Merge branch 'main' into 840-rlpx-listen-loop
ElFantasma 12010b3
Fmt + Return error instead of pancking if invalid root is used
fmoletta ed0186f
Calling apply_fork_choice only once for the whole chain
ElFantasma 42f2af3
Revert change
fmoletta 61ad329
Return empty proof if root is missing
fmoletta 13c44cf
Calling apply_fork_choice only once for the whole chain
ElFantasma ecb682f
Clippy fix
ElFantasma f8bd1dc
use trait method
fmoletta b890f60
Merge remote-tracking branch 'origin/840-rlpx-listen-loop' into trie_…
fmoletta 31aa8ac
Update hive revision
fmoletta 34d8d84
Reorganize module
fmoletta 9b85c69
Merge branch 'main' into 840-rlpx-listen-loop
ElFantasma 013a977
Update hive revision
fmoletta 66f759a
Add hive snap worflow
fmoletta 67cb57a
Merge branch 'main' into 840-rlpx-listen-loop
ElFantasma b1ea882
Reverting hive version
ElFantasma 58da873
Merge branch 'main' of github.com:lambdaclass/lambda_ethereum_rust in…
fmoletta fe2fb77
Removed unnecessary info! messages
ElFantasma 50ca190
Merge branch '840-rlpx-listen-loop' into trie_iter
fmoletta 7062b1b
Add messages + inner structs
fmoletta d609cae
progress
fmoletta c69690d
Bump hive version
fmoletta 65f8c77
Merge branch 'main' of github.com:lambdaclass/lambda_ethereum_rust in…
fmoletta b7c0211
Fix bug in response bytes length calculation
fmoletta 74173d2
Restore Makefile
fmoletta 777732a
Identify storage tries by hashed account address
fmoletta 0e3e276
Merge branch 'trie_iter' into snap-storage-range
fmoletta abb28cf
Impl logic
fmoletta fea174d
Connect to main loop
fmoletta dc6752c
Compute proofs
fmoletta 03d9928
Clippy
fmoletta c791a89
Chamge type
fmoletta 9fd88d3
Add test
fmoletta 2b9d207
Add messages
fmoletta 37becaa
Add hive test
fmoletta a6d2f08
fmt
fmoletta c502f06
Impl messages
fmoletta 242502e
Impl Trie::get_node
fmoletta 3b7d70e
Fix
fmoletta 384eff7
Merge branch 'trie_iter' into snap-storage-range
fmoletta fa4be1b
Merge branch 'snap-storage-range' into snap-bytecodes
fmoletta 1cf1e9b
implement get_trie_nodes for storage
fmoletta 349d05f
Add byte limit
fmoletta 4fd0ee5
Add request processing
fmoletta d02e8f2
Merge branch 'main' of github.com:lambdaclass/lambda_ethereum_rust in…
fmoletta 0575a44
Merge branch 'snap-storage-range' of github.com:lambdaclass/lambda_et…
fmoletta aa29e5f
Fix lingering conflicts
fmoletta 89e144a
Save progress
fmoletta 1d8c3f9
Progress
fmoletta ea34fbc
Progress
fmoletta e57f386
remove unused code
fmoletta 0a31fc9
Handle wrong path input lens
fmoletta 2c0e30e
Add restrictions
fmoletta b3c4816
Fix error handling
fmoletta 80bbc30
clippy+fmt
fmoletta b7b978a
Add hive test
fmoletta f02d29a
Cleanup
fmoletta 0e5a005
Draft
fmoletta 003d445
:(
fmoletta 23974bb
Fix code to handle nibbles properly
fmoletta b159f7d
Simplify code
fmoletta 12b0268
refactor
fmoletta 8e4c884
Remove debug code
fmoletta b80f19f
Cleanup code
fmoletta f03ef1e
Merge branch 'snap-bytecodes' into snap-trie-nodes
fmoletta 098a584
Remove debug command
fmoletta 9a57e37
Un-comment noisy info
fmoletta f54af1d
Update comment
fmoletta b307261
reorder
fmoletta 9da6ec9
Cite sources
fmoletta 8a0fbbb
Move funcs to encodings module
fmoletta 200d014
Merge branch 'main' of github.com:lambdaclass/lambda_ethereum_rust in…
fmoletta 2332889
Merge branch 'snap-storage-range' into snap-bytecodes
fmoletta 1805ef6
Update workflow
fmoletta b270580
Update workflow
fmoletta 6af2d6e
Merge branch 'snap-storage-range' into snap-bytecodes
fmoletta 9ec2129
Update workflow
fmoletta 09f688b
Clippy
fmoletta f494ad9
Merge branch 'snap-storage-range' into snap-bytecodes
fmoletta 64610c3
Merge branch 'snap-bytecodes' into snap-trie-nodes
fmoletta 4f31c37
Merge branch 'main' into snap-trie-nodes
fmoletta 19c0bf0
Remove path field from BranchNode
fmoletta d32bb4e
Start dumb nibbles impl
fmoletta 7cad9b6
Impl common_prefix
fmoletta 3b69cd7
Update name & doc
fmoletta 16d1432
Impl next
fmoletta d7c036f
Use DumbNibbles: LeafNode get & insert
fmoletta a2afdfd
Use DumbNibbles: ExtensionNode get & insert
fmoletta 3a65df9
Make code compile
fmoletta 43ae680
Fix node encoding for LeafNode
fmoletta e69e954
Fix leaf nibbles
fmoletta 998ed51
Fix leaf partial when inserting to leaf
fmoletta 3cfd7c4
Fixes
fmoletta ad40f23
Fix
fmoletta a41cf2b
Fix
fmoletta 68d5f83
Fix
fmoletta 275659a
Fix
fmoletta 6e1b4b7
[DEBUG] Add debug prints
fmoletta 8ff338c
Update crates/storage/store/storage.rs
fmoletta fc33022
Uncomment feature gate
fmoletta 167c591
[DEBUG] Add debug prints
fmoletta aad0bcf
Fix
fmoletta 71357dd
[DEBUG] Add debug prints
fmoletta cd847b9
refactor: add next_choice method
fmoletta 37c93d7
Simplify leaf node encoding
fmoletta 92313f0
Simplify encoding of Leaf
fmoletta 3eb5ee9
Simplify encoding of Extension
fmoletta eb4fd0c
Simplify encoding of Branch
fmoletta d50e0ff
Remove the NodeEncoder
fmoletta 856224d
Clippy
fmoletta f713657
Update TrieIterator
fmoletta 30ba82f
Add proptest
fmoletta 21537d4
Remove old nibble representation
fmoletta 28bd344
Rename DumbNibbles -> Nibbles
fmoletta c56ad04
Update some doc
fmoletta bebce62
Simplify BranchNode::remove
fmoletta 08c6668
Simplify
fmoletta e1f032f
Update doc
fmoletta 9dc2752
Fix unit test
fmoletta bbe367d
Fix test + code
fmoletta 63f1645
Update test values
fmoletta 237f291
Fix potential panick
fmoletta d5dfa30
Fix
fmoletta 55b0c37
Fix unit tests
fmoletta 01090b4
Remove outdated comment
fmoletta e1be0c6
[DEBUG] Remove debug prints
fmoletta bed25f7
Remove funny name test
fmoletta f2c2eef
doc nibbles module
fmoletta 9050b0c
Remove todo
fmoletta 345ae96
remove debug print
fmoletta 0fa490f
avoid clone
fmoletta e6ea561
Merge branch 'refactor-node-structure' into snap-trie-nodes
fmoletta 76640ef
Update trie code with refactored nibble paths
fmoletta e0f83a3
Merge branch 'main' of github.com:lambdaclass/lambda_ethereum_rust in…
fmoletta 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
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
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 |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/// Converts a slice of compact-encoded nibbles into a byte slice | ||
/// If the nibble slice has odd-length (aka the last byte will be a half byte) returns true else false | ||
pub fn compact_nibbles_to_bytes(compact: &[u8]) -> (Vec<u8>, bool) { | ||
// Convert compact nibbles to nibbles | ||
let nibbles = compact_to_hex(compact); | ||
// Convert nibbles to bytes, accouning for odd number of bytes | ||
let mut last_is_half = false; | ||
let bytes = nibbles | ||
.chunks(2) | ||
.map(|chunk| match chunk.len() { | ||
1 => { | ||
last_is_half = true; | ||
chunk[0] << 4 | ||
} | ||
// 2 | ||
_ => chunk[0] << 4 | chunk[1], | ||
}) | ||
.collect::<Vec<_>>(); | ||
(bytes, last_is_half) | ||
} | ||
|
||
// Code taken from https://github.com/ethereum/go-ethereum/blob/a1093d98eb3260f2abf340903c2d968b2b891c11/trie/encoding.go#L82 | ||
fn compact_to_hex(compact: &[u8]) -> Vec<u8> { | ||
if compact.is_empty() { | ||
return vec![]; | ||
} | ||
let mut base = keybytes_to_hex(compact); | ||
// delete terminator flag | ||
if base[0] < 2 { | ||
base = base[..base.len() - 1].to_vec(); | ||
} | ||
// apply odd flag | ||
let chop = 2 - (base[0] & 1) as usize; | ||
base[chop..].to_vec() | ||
} | ||
|
||
// Code taken from https://github.com/ethereum/go-ethereum/blob/a1093d98eb3260f2abf340903c2d968b2b891c11/trie/encoding.go#L96 | ||
fn keybytes_to_hex(keybytes: &[u8]) -> Vec<u8> { | ||
let l = keybytes.len() * 2 + 1; | ||
let mut nibbles = vec![0; l]; | ||
for (i, b) in keybytes.iter().enumerate() { | ||
nibbles[i * 2] = b / 16; | ||
nibbles[i * 2 + 1] = b % 16; | ||
} | ||
nibbles[l - 1] = 16; | ||
nibbles | ||
} |
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 |
---|---|---|
|
@@ -322,7 +322,7 @@ impl NibbleVec { | |
} | ||
} | ||
|
||
#[cfg(test)] | ||
//#[cfg(test)] | ||
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. Why not remove it instead of commenting it out? 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. I think this was leftover for when I was trying out stuff, I should restore it, ty for catching it! |
||
/// Create a NibbleVec from an iterator of nibbles | ||
pub fn from_nibbles( | ||
data_iter: impl Iterator<Item = Nibble>, | ||
|
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
Oops, something went wrong.
Oops, something went wrong.
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.