-
Notifications
You must be signed in to change notification settings - Fork 293
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
EIP-4844 - pass blockchain tests #1077
base: master
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## enable-inv-bloack #1077 +/- ##
=====================================================
- Coverage 94.29% 94.27% -0.03%
=====================================================
Files 159 159
Lines 17160 17201 +41
=====================================================
+ Hits 16181 16216 +35
- Misses 979 985 +6
Flags with carried forward coverage won't be shown. Click here to find out more.
|
c6d64a1
to
8b251ca
Compare
test/state/host.cpp
Outdated
@@ -493,7 +493,7 @@ evmc_tx_context Host::get_tx_context() const noexcept | |||
m_block.prev_randao, | |||
0x01_bytes32, // Chain ID is expected to be 1. | |||
uint256be{m_block.base_fee}, | |||
intx::be::store<uint256be>(m_block.blob_base_fee), | |||
intx::be::store<uint256be>(compute_blob_gas_price(m_block.excess_blob_gas.value_or(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.
I think we should not compute this each access. Maybe we need two sets of fields in BlockInfo
: official/header fields and computed values.
If big deal, we can handle this by separate PR.
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.
Oh right, get_tx_context() is called within the instruction, yeah, better to fix right away :(. Alternatively this can be kept in Host? WDYT? if we can avoid mixing header/computed values, maybe it's better? or is Host just inappropriate for this?
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.
Better to put it back to BlockInfo
because this is also used in transaction validation and transition. These are also important cases.
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.
argh, I've done it and only after I recalled from previous week, that I have already been there. The problem which arises is that it makes compute_blob_gas_price
come before block validation, making problematic inputs (excess_blob_gas) come through, which previously wasn't the case. fake_exponential
seems to go into infinite loop for such inputs.
I'll need to revisit this and look more closely at what exactly is happening
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 imagine we keep the newly added field and also have blob_base_fee
"after" them computed as some point...
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 explored this idea, but I'm struggling to find a good point to compute that. It would sacrifice some const
s and make a mess, or force us to introduce more complexity to manage that.
I have a counter-proposal. I dug deeper into fake_exponential
, and it seems to me like not only it infinite loops but also easily overflows over 256 bits. If I cap the result at uint256::max on mul overflow (I can post code in a moment), things work OK. I think the tacit assumption in fake_exponential
spec is that it should use arbitrary precision, and I peeked at some impls and they actually do that.
So I'd rather fix fake_exponential
to not loop/overflow, and rely on current block validation, which would reject the block properly.
I see three options here:
- switch from uint256 to big int of some sort
- detect overflow and cap
compute_blob_gas_price
to uint256::max - detect overflow and return nullopt from
compute_blob_gas_price
2 is the easiest (will push in a sec), but has the disadvantage of there being a block with potentially incorrect blob_base_fee field, hanging around until we reject it (on validation of excess/used blob gas fields).
3 seems better but not sure if the opts won't proliferate around the code base excessively. Maybe not
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.
Trying (2.) first
781660c
to
672e4d8
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 wasn't able to review any files in this pull request.
Files not reviewed (14)
- 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/block.cpp: Language not supported
- test/state/block.hpp: Language not supported
- test/state/host.cpp: Language not supported
- test/state/state.cpp: Language not supported
- test/state/transaction.hpp: Language not supported
- test/statetest/statetest_loader.cpp: Language not supported
- test/t8n/t8n.cpp: Language not supported
- test/unittests/state_transition.cpp: Language not supported
- test/unittests/state_transition_block_test.cpp: Language not supported
- test/unittests/state_transition_tx_test.cpp: Language not supported
- test/unittests/state_tx_test.cpp: Language not supported
2c04d7d
to
fff2f4f
Compare
b5c41b9
to
797afe1
Compare
fff2f4f
to
3224eb4
Compare
797afe1
to
4617eb3
Compare
fcfbac4
to
4557052
Compare
4617eb3
to
8dd19d7
Compare
4557052
to
8dbd8c6
Compare
🍏
NOTE: I'll squash the commits before merging.NOTE2: opening as draft to work through CI issues. Not reviewable yet, but if I'm completely off the scent somewhere, please let knowReady for review