-
Notifications
You must be signed in to change notification settings - Fork 329
EIP-7685: General purpose execution layer requests #1083
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
Conversation
c696b91 to
2a1cfaf
Compare
test/state/requests.cpp
Outdated
| // if (requests.data.empty()) | ||
| // continue; | ||
|
|
||
| const bytes requests_bytes = requests.type + requests.data; |
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 can be optimized to get rid of copying, if we represent Requests as just struct Requests { bytes data; } and put type as the first byte of data right away when collecting requests.
Let me know if it's worth it. I think not really, as it only affects blockchain test runner performance.
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 think this is worth it when all EIPs are implemented. So let's make an issue to track it.
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 can be also handled by init-update-final API for sha256.
BTW, is there rationale for this double-hashing?
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 think this is worth it when all EIPs are implemented. So let's make an issue to track it.
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.
BTW, is there rationale for this double-hashing?
Good question, I couldn't find any in the EIP, other than previously it was a root of MPT and now is hash of flat list of hashes.
Asked on magicians https://ethereum-magicians.org/t/eip-7685-general-purpose-execution-layer-requests/19668/20
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1083 +/- ##
=======================================
Coverage 94.29% 94.29%
=======================================
Files 157 159 +2
Lines 17080 17102 +22
=======================================
+ Hits 16105 16127 +22
Misses 975 975
Flags with carried forward coverage won't be shown. Click here to find out more.
|
pdobacz
left a comment
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.
LGTM overall, I left some minor comments. Also, maybe we're ready to undo the workarounds from https://github.com/ethereum/evmone/pull/1064/files ?
test/state/requests.hpp
Outdated
| struct Requests | ||
| { | ||
| /// Request type. | ||
| uint8_t type = 0; |
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.
is having a default good here?
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.
also, maybe introduce a Request::Type enum like for tx?
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 was meaning to just introduce constants for types in respective later PRs, but enum is a better idea, I'll add it in the next PR.
Having a default in general is good, otherwise it may be left uninitialized.
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.
Having a default in general is good, otherwise it may be left uninitialized.
ah right, that would not error out :(. OK then
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.
added enum here
Ah I forgot about t8n, thanks for the reminder. I'll look into it, it probably will go to a separate PR, too. |
OK, but also maybe this in particular is better off here to make the change more atomic? Also, t8n has an integration test, so your code would also get automatically covered by that for extra assurance. |
test/state/requests.hpp
Outdated
| using RequestsList = std::vector<Requests>; | ||
|
|
||
| /// Calculate commitment value of block requests list | ||
| hash256 calculate_requests_hash(std::span<const Requests> block_requests_list); |
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.
| hash256 calculate_requests_hash(std::span<const Requests> block_requests_list); | |
| hash256 calculate_requests_hash(std::span<const Requests> requests_list); |
test/state/requests.hpp
Outdated
| }; | ||
|
|
||
| /// Block requests list - container of `requests` objects, ordered by request type. | ||
| using RequestsList = std::vector<Requests>; |
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'd skip this alias because we also use std::span<Requests>.
test/state/requests.cpp
Outdated
| hash256 calculate_requests_hash(std::span<const Requests> block_requests_list) | ||
| { | ||
| bytes requests_hash_list; | ||
| requests_hash_list.reserve(sizeof(bytes32) * block_requests_list.size()); |
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.
| requests_hash_list.reserve(sizeof(bytes32) * block_requests_list.size()); | |
| requests_hash_list.reserve(sizeof(hash256) * block_requests_list.size()); |
test/state/requests.cpp
Outdated
| // if (requests.data.empty()) | ||
| // continue; | ||
|
|
||
| const bytes requests_bytes = requests.type + requests.data; |
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 think this is worth it when all EIPs are implemented. So let's make an issue to track it.
Introduce Requests and RequestsList types. Calculate hash of the list of requests after transactions execution. Read expected hash from blockchain test files and compare with result of calculation.
229cdf7 to
b991667
Compare
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.
Copilot reviewed 1 out of 9 changed files in this pull request and generated no suggestions.
Files not reviewed (8)
- test/blockchaintest/blockchaintest.hpp: Language not supported
- test/blockchaintest/blockchaintest_loader.cpp: Language not supported
- test/blockchaintest/blockchaintest_runner.cpp: Language not supported
- test/state/CMakeLists.txt: Language not supported
- test/state/requests.cpp: Language not supported
- test/state/requests.hpp: Language not supported
- test/t8n/CMakeLists.txt: Language not supported
- test/t8n/t8n.cpp: Language not supported
https://eips.ethereum.org/EIPS/eip-7685
Requeststype.(EIP-7685 tests are not enabled yet, because they require all of EIP-6110, 7002 and 7251 to be implemented.)