-
Notifications
You must be signed in to change notification settings - Fork 285
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
Add RLP encoding implementation to evmone::state library #463
Conversation
Codecov Report
@@ Coverage Diff @@
## master #463 +/- ##
=======================================
Coverage 99.60% 99.60%
=======================================
Files 39 39
Lines 4593 4593
=======================================
Hits 4575 4575
Misses 18 18
Flags with carried forward coverage won't be shown. Click here to find out more. |
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.
Should consider adding/reviewing test cases from
- https://github.com/ethereum/tests/tree/develop/RLPTests
- https://github.com/ethereumjs/ethereumjs-monorepo/tree/master/packages/rlp/test
- https://github.com/ethereum/go-ethereum/tree/master/rlp
I know projects which found bugs after adding all these, as each of them are not comprehensive. (Should try to merge all these tests.)
@@ -0,0 +1,117 @@ | |||
// evmone: Fast Ethereum Virtual Machine implementation | |||
// Copyright 2021 The evmone Authors. |
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.
👀
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.
I started this last year :(
namespace evmone::rlp | ||
{ | ||
using bytes = std::basic_string<uint8_t>; | ||
using bytes_view = std::basic_string_view<uint8_t>; |
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.
Weren't these defined somewhere? Or only in Fizzy?
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.
This is already defined in multiple places (2x in EVMC). But as long as the definition is the same this is fine. Notice this RLP implementation does not include any evmone/evmc headers. Also intx include can be easily dropped.
I think I can easily manually port "official" and geth tests. |
2dc2339
to
a5dde60
Compare
7b1099c
to
db90da9
Compare
test/unittests/state_rlp_test.cpp
Outdated
TEST(state_rlp, encode_mpt_node) | ||
{ | ||
const bytes path{0x20, 0x41}; | ||
const bytes value{'v', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', |
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.
what are these chars? maybe better represent them in hex?
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.
This is just a test case evolved...
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.
just one more place to use decimal value
No description provided.