-
Notifications
You must be signed in to change notification settings - Fork 55
chore(levm, l1, l2): remove code specific to unsupported forks #2670
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
base: main
Are you sure you want to change the base?
Conversation
Lines of code reportTotal lines added: Detailed view
|
Benchmark Results ComparisonPR ResultsBenchmark Results: Factorial
Benchmark Results: Factorial - Recursive
Benchmark Results: Fibonacci
Benchmark Results: ManyHashes
Benchmark Results: BubbleSort
Benchmark Results: ERC20 - Transfer
Benchmark Results: ERC20 - Mint
Benchmark Results: ERC20 - Approval
Main ResultsBenchmark Results: Factorial
Benchmark Results: Factorial - Recursive
Benchmark Results: Fibonacci
Benchmark Results: ManyHashes
Benchmark Results: BubbleSort
Benchmark Results: ERC20 - Transfer
Benchmark Results: ERC20 - Mint
Benchmark Results: ERC20 - Approval
|
EF Tests ComparisonSame results between main branch and the current PR. |
There is an unnecessary check of Paris fork in |
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.
Amazing job. We can merge after making the requested changes :)
// check for gas limit is grater or equal than the minimum required | ||
let calldata = vm.current_call_frame()?.calldata.clone(); | ||
let intrinsic_gas: u64 = vm.get_intrinsic_gas()?; | ||
|
||
// calldata_cost = tokens_in_calldata * 4 | ||
let calldata_cost: u64 = gas_cost::tx_calldata(&calldata).map_err(VMError::OutOfGas)?; | ||
|
||
// same as calculated in gas_used() | ||
let tokens_in_calldata: u64 = calldata_cost | ||
.checked_div(STANDARD_TOKEN_COST) | ||
.ok_or(VMError::Internal(InternalError::DivisionError))?; | ||
|
||
// floor_cost_by_tokens = TX_BASE_COST + TOTAL_COST_FLOOR_PER_TOKEN * tokens_in_calldata | ||
let floor_cost_by_tokens = tokens_in_calldata | ||
.checked_mul(TOTAL_COST_FLOOR_PER_TOKEN) | ||
.ok_or(VMError::Internal(InternalError::GasOverflow))? | ||
.checked_add(TX_BASE_COST) | ||
.ok_or(VMError::Internal(InternalError::GasOverflow))?; | ||
|
||
let min_gas_limit = max(intrinsic_gas, floor_cost_by_tokens); | ||
if vm.current_call_frame()?.gas_limit < min_gas_limit { | ||
return Err(VMError::TxValidation(TxValidationError::IntrinsicGasTooLow)); |
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.
Isn't all this the same as what's in validate_min_gas_limit
?
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.
If so, we can remove it
@@ -131,11 +131,13 @@ impl Hook for L2Hook { | |||
vm.increase_account_balance(vm.env.origin, vm.current_call_frame()?.msg_value)?; | |||
} | |||
|
|||
// 2. Return unused gas + gas refunds to the sender. |
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.
Why add a comment in this PR?
Motivation
Keep the codebase clean and as simple as possible by removing code we don't really need.
Description
All the code that was only relevant to forks prior to Paris was removed. This includes constants, ifs, etc.
Resolves issue #2659