-
Notifications
You must be signed in to change notification settings - Fork 26
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
feat(levm): fix validation errors (part 2) and some extra things #1345
Conversation
…to levm/ef-tests-error-handling
/// To get the maximum fee per gas that the user is willing to pay, independently of the actual gas price | ||
/// For legacy transactions the max fee per gas is the gas price | ||
fn max_fee_per_gas_or_gasprice(&self) -> U256 { | ||
self.env.tx_max_fee_per_gas.unwrap_or(self.env.gas_price) |
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 this ok? Generally, the gas price is either the transaction type 0 or 1 gas price or the transaction type 2 or 3 max_fee_per_gas
but not the reciprocal.
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.
It is indeed necessary for validations only. Not for execution.
For example there's a validation named INSUFFICIENT_MAX_FEE_PER_GAS
that checks if the max fee per gas is less than the base fee per gas. The problem is that we also have to return that error for type 0 and 1 transactions when gas price is less than base fee per gas.
We also need it the most for the calculation of the up-front cost, where Tp
is gas price and Tm
is max fee per gas. I made the function to simplify that. I could even delete it cause it's only used twice and won't be used more times than that I guess.
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.
The PR looks good. Left some questions, suggestions and change 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.
After the fix I mentioned, lgtm
value, | ||
Bytes::new(), |
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.
In a create tx calldata should be an empty set of bytes, not the calldata.
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.
Good catch! Didn't know that
Fixed it here:
79fc4e0
Motivation
The main motivation is to fix validation related tests. Return a validation exception everytime that is necessary (while being careful of not returning them in cases in which they are not expected).
It also fixes/changes some things that I find along the way and I consider appropriate changing.
Description
add_intrinsic_gas()
add_gas_with_max
for reportDiffs for
add_intrinsic_gas
andvalidate_transaction
don't look very good. I recommend to watch the code directly for those functions.End Result
After mergin main into branch:
Closes #issue_number