Skip to content
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

Merged
merged 32 commits into from
Nov 28, 2024

Conversation

JereSalo
Copy link
Contributor

@JereSalo JereSalo commented Nov 27, 2024

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 and op_blobhash. I realized this opcode wasn't pushing 0 to the stack if no blobhash was found.

  • Make execute() propagate interal errors

  • Partially 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

@JereSalo JereSalo added the levm Lambda EVM implementation label Nov 27, 2024
@JereSalo JereSalo self-assigned this Nov 27, 2024
@JereSalo JereSalo marked this pull request as ready for review November 28, 2024 16:07
@JereSalo JereSalo requested a review from a team as a code owner November 28, 2024 16:07
@JereSalo JereSalo changed the title feat(levm): error handling ef_tests feat(levm): error handling ef_tests (Part 1) Nov 28, 2024
Copy link
Contributor

@ilitteri ilitteri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ilitteri ilitteri enabled auto-merge November 28, 2024 17:13
@ilitteri ilitteri added this pull request to the merge queue Nov 28, 2024
Copy link
Contributor

@maximopalopoli maximopalopoli left a 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();
Copy link
Contributor

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// 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]);
Copy link
Contributor

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

Copy link
Contributor Author

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

}

// Should revert this?
// sender_account.info.balance -= self.call_frames.first().ok_or(VMError::FatalUnwrap)?.msg_value;
Copy link
Contributor

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

Copy link
Contributor Author

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

@JereSalo JereSalo removed this pull request from the merge queue due to a manual request Nov 28, 2024
@JereSalo JereSalo added this pull request to the merge queue Nov 28, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Nov 28, 2024
@JereSalo JereSalo enabled auto-merge November 28, 2024 19:40
@JereSalo JereSalo added this pull request to the merge queue Nov 28, 2024
Merged via the queue into main with commit f461511 Nov 28, 2024
21 checks passed
@JereSalo JereSalo deleted the levm/ef-tests-error-handling branch November 28, 2024 21:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
levm Lambda EVM implementation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants