-
Notifications
You must be signed in to change notification settings - Fork 20.6k
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
core/vm: set basefee to 0 internally on eth_call #28470
Merged
Merged
Changes from 1 commit
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
849c0d4
core/vm: set basefee to 0 internally on eth_call
karalabe de24a7a
core: nicer 0-basefee, make it work for blob fees too
karalabe 5f39342
internal/ethapi: make tests a bit more complex
karalabe 9da87f8
core: fix blob fee checker
karalabe 2cd4ccf
core: make code a bit more readable
karalabe 7aff365
core: fix some test error strings
karalabe 4544026
core/vm: Get rid of weird comment
karalabe ff2d1d7
core: dict wrong typo
karalabe 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 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 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
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.
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.
Instead of checking for
NoBaseFee
in the production opcode, can't we just set theinterpreter.evm.Context.BaseFee
to anew(uint256.Int)
in theNoBaseFee
-situation?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 did consider that too. The only catch is that some code paths feed us the context directly, and we're not copying currently, so setting the basefee would modify the passed in context. We'd need to add some copying to avoid that.
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.
Like 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.
Ah I didn't see this comment. But I don't think you are quite correct -- the
blockCtx
is passed by value, not ref, in the path I used.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.
Yeah, I think Martin's approach is better, BaseFee is an environment context.
We can also leave a TODO for
BlobBaseFee
, we might face the same problem for this opcode too.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'll switch to Martin's approach, but we need to be aware that BaseFee form the context is used in many locations, each potentially becoming a footgun with 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.
@rjl493456442 Wrt the blob fee, I think we can piggie-back on the same flag. BaseFee, BlobBaseFee, the concept is the same and setting it to zero should also be the same.
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.
Ugh, no, Martin's fix isn't good (neither is mine).
Currently the logic is that we only disable base fee checks if 1) NoBaseFee is set and 2) gas prices are 0. Both our suggested fixes unilaterally nuke it out always, which is bad.
Martin's proposal cannot work because you don't know during construction time if tx will be run with or without gas price. My solution could work if I pulled the gas price up too, but it's a bit ugh. Maybe a cleaner solution is to set/rest the field before actually executing the bytecode for each tx individually. .Will look into that.
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.
Maybe Martin's does work. The EVM is reconstructed for each tx.