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): ensure errors are right (adaptation) #1459

Merged
merged 75 commits into from
Dec 11, 2024

Conversation

maximopalopoli
Copy link
Contributor

Motivation

This PR is a revival of an older PR that implemented this feature, and merged the branch in another which PR was closed. This is an adaptation of it to the current codebase.

Description

See #1225 for more details.

@maximopalopoli maximopalopoli added the levm Lambda EVM implementation label Dec 10, 2024
@maximopalopoli maximopalopoli self-assigned this Dec 10, 2024
@maximopalopoli maximopalopoli marked this pull request as ready for review December 10, 2024 19:52
@maximopalopoli maximopalopoli requested a review from a team as a code owner December 10, 2024 19:52
@lima-limon-inc lima-limon-inc self-requested a review December 10, 2024 20:49
Copy link
Contributor

@lima-limon-inc lima-limon-inc left a comment

Choose a reason for hiding this comment

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

LGTM ^_^

let error_reason = format!("Expected exception: {expected_exception}");
println!("Expected exception: {expected_exception}");
let error_reason = format!("Expected exception: {expected_exception:?}");
println!("Expected exception: {expected_exception:?}");
Copy link
Contributor

Choose a reason for hiding this comment

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

Quick question, couldn't the println print the "error_reason" variable instead of the re-writing the string?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@maximopalopoli maximopalopoli marked this pull request as draft December 10, 2024 21:45
@maximopalopoli maximopalopoli marked this pull request as ready for review December 11, 2024 13:56
Copy link
Contributor

@JereSalo JereSalo left a comment

Choose a reason for hiding this comment

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

I left some suggestions, I just think the REVM stuff should be clarified

// Instead of cloning could use references
if !exception_is_expected(expected_exceptions.clone(), err.clone()) {
let error_reason = match expected_exceptions.get(1) {
Some(second_exception) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Leave a little comment here explaining that in tests there are at most 2 exceptions, that's why even though it is a vec we only care about the first 2 exceptions. And that changing it is not worth it yet.
It doesn't have to be long, something concise just to inform the reader

Copy link
Contributor Author

@maximopalopoli maximopalopoli Dec 11, 2024

Choose a reason for hiding this comment

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

@@ -180,8 +238,22 @@ pub fn ensure_post_state(
Ok(execution_report) => {
match test.post.vector_post_value(vector).expect_exception {
// Execution result was successful but an exception was expected.
Some(expected_exception) => {
let error_reason = format!("Expected exception: {expected_exception}");
Some(expected_exceptions) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

ditto about the comment

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@@ -392,6 +395,9 @@ pub fn _run_ef_test_revm(test: &EFTest) -> Result<EFTestReport, EFTestRunnerErro
Err(EFTestRunnerError::Internal(reason)) => {
return Err(EFTestRunnerError::Internal(reason));
}
Err(EFTestRunnerError::ExpectedExceptionDoesNotMatchReceived(_)) => {
// Here should be the logic of execution and expecting an error
Copy link
Contributor

Choose a reason for hiding this comment

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

Clarify this please. It means that exception doesn't match the received but this is not implemented for REVM, right? Because we only do that comparison with LEVM

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@@ -53,6 +53,9 @@ pub fn re_run_failed_ef_test(
}
}
},
EFTestRunnerError::ExpectedExceptionDoesNotMatchReceived(_) => {
// Here should be the logic of re-execution and compare revm result with the expected error
Copy link
Contributor

Choose a reason for hiding this comment

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

Clarify this too. Can this error happen with revm? What do we want to do?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

@JereSalo JereSalo left a comment

Choose a reason for hiding this comment

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

Good, just a typo

cmd/ef_tests/levm/runner/revm_runner.rs Outdated Show resolved Hide resolved
maximopalopoli and others added 2 commits December 11, 2024 16:03
Co-authored-by: Jeremías Salomón <48994069+JereSalo@users.noreply.github.com>
@JereSalo JereSalo added this pull request to the merge queue Dec 11, 2024
Merged via the queue into main with commit 286b937 Dec 11, 2024
16 checks passed
@JereSalo JereSalo deleted the levm/feat/ensure-errors-are-right branch December 11, 2024 19:33
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