-
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): error handling ef_tests (Part 1) #1319
Conversation
…to levm/ef-tests-error-handling
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
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, I just leave you some comments:
@@ -72,31 +72,33 @@ pub fn prepare_vm_for_tx(vector: &TestVector, test: &EFTest) -> Result<VM, EFTes | |||
store: initial_state.database().unwrap().clone(), | |||
block_hash, | |||
}); | |||
|
|||
let tx = test.transactions.get(vector).unwrap(); |
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.
Here instead of using .unwrap()
you can return an EFTestRunnerError
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.
crates/vm/levm/src/constants.rs
Outdated
// Storage constants | ||
pub const COLD_STORAGE_ACCESS_COST: U256 = U256([2100, 0, 0, 0]); | ||
pub const WARM_ADDRESS_ACCESS_COST: U256 = U256([100, 0, 0, 0]); | ||
pub const BALANCE_COLD_ADDRESS_ACCESS_COST: U256 = U256([2600, 0, 0, 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.
This cost constants should be in gas_cost.rs
, since they are mainly used in that file
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 ended up removing them cause they were not used.
8981d83
crates/vm/levm/src/vm.rs
Outdated
} | ||
|
||
// Should revert this? | ||
// sender_account.info.balance -= self.call_frames.first().ok_or(VMError::FatalUnwrap)?.msg_value; |
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 know that comment is not yours, but if it is not necessary we can remove it
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 removed it. I think that in my next PR I'm going to remove revert_create()
function anyways.
c9b747f
Motivation
Description
Add some other fields to levm's environment: Max priority fee per gas, max fee per gas, block gas limit, max fee per blob gas.
Refactors
tx_blob_hashes
andop_blobhash
. I realized this opcode wasn't pushing 0 to the stack if no blobhash was found.Make
execute()
propagate interal errorsPartially implements validation errors. Partially because for them to be fully implemented I have to make changes like gas consumption logic and that would be too much for this PR.
The amount of tests that passed is pretty similar to the ones that are passing in
main
, only a few more are passing. This PR only doesn't fix all execution errors, for this to be fixed I have to make a lot more changes and it would transform itself into a very big PR.Closes #issue_number