-
Notifications
You must be signed in to change notification settings - Fork 323
eof: Add caching of TXCREATE validation results #1193
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
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1193 +/- ##
==========================================
+ Coverage 94.82% 94.84% +0.02%
==========================================
Files 171 171
Lines 19406 19501 +95
==========================================
+ Hits 18401 18496 +95
Misses 1005 1005
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
eb46837
to
c7c3809
Compare
c7c3809
to
b23a729
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.
LGTM. Just some test ideas, but better to implement these in EEST
tx.type = Transaction::Type::initcodes; | ||
tx.initcodes.push_back(init_container); | ||
|
||
constexpr auto iterations = 500; |
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.
as mentioned on the call, I'd also make a version with invalid EOF, and with a mix valid/invalid. But maybe enough to leave it for EEST.
There is also a twisted variant where the loop is handled by recursion, where an (erroneous) cache mechanism could clear the cache on every call depth level. Also possible better in EEST.
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.
So
lib/evmone/execution_state.hpp
Outdated
@@ -216,6 +217,7 @@ class ExecutionState | |||
deploy_container = {}; | |||
m_tx = {}; | |||
m_initcodes.reset(); | |||
m_initcodes_validity.clear(); |
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 it is better to combine this with m_initcodes
: to have value as struct {bytes_view, std::optional<bool>}
or struct {bytes_view, bool}
.
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.
will have to have optional, I mostly decided against this originally because of this cumbersome structure
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.
Combined now.
lib/evmone/instructions_calls.cpp
Outdated
@@ -435,8 +435,18 @@ Result create_eof_impl( | |||
|
|||
if constexpr (Op == OP_TXCREATE) | |||
{ | |||
const auto error_subcont = validate_eof(state.rev, ContainerKind::initcode, initcontainer); | |||
if (error_subcont != EOFValidationError::success) | |||
const auto validity = state.get_initcode_validity(initcode_hash); |
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 section is unnecessarily separated from the other TXCREATE
processing section above. I think we should reorder them and place the endowment and depth checks before the get_tx_initcode_by_hash()
section.
Then we will be able to combine the get_tx_initcode_by_hash()
and set_initcode_validity
, potentially with having single unordered_map
.
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.
Problem is pos
has to be updated before light failures
(and differently for EOFCREATE and TXCREATE)
I pushed one possible version, without unifying initcode and validity query yet.
1265290
to
3a4be96
Compare
44863a1
to
aec7428
Compare
Co-authored-by: Paweł Bylica <[email protected]>
2880d00
to
d1bc275
Compare
No description provided.