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

Fix tests with byzantium and homestead #15631

Merged
merged 4 commits into from
Dec 11, 2024
Merged

Conversation

clonker
Copy link
Member

@clonker clonker commented Dec 10, 2024

  • Constant Optimizer: Do not assert for shl builtin, it is guarded by dialect.evmVersion().hasBitwiseShifting().
  • EVMCodeTransformTests use defaulted evm dialect instead of test-configured one: there was a mismatch between the dialect configured in the test's YulStack and what was used in the test's EVMObjectCompiler, one using the defaulted (latest) version and one the test-configured one, respectively. Also some of the code generation tests fail for byzantium and homestead if configured with the same dialect. So for now I have reverted back to default. (@cameel @rodiazet)

@clonker clonker changed the title Constant Optimizer: Do not assert for shl builtin Fix tests with byzantium and homestead Dec 10, 2024
@clonker clonker requested a review from cameel December 10, 2024 09:22
cameel
cameel previously approved these changes Dec 10, 2024
Copy link
Member

@cameel cameel left a comment

Choose a reason for hiding this comment

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

It's not wrong, but I think we'd be better off just skipping the test on unsupported versions. No need to run it multiple times if the parameters don't change.

test/libyul/EVMCodeTransformTest.cpp Outdated Show resolved Hide resolved
Copy link
Member

Choose a reason for hiding this comment

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

Hard-coding the EVM and EOF version will not prevent the test case from being executed for all combinations, it will just make it run with the same settings every time. What we should do instead is to skip it in unsupported configurations.

One way to do this would be to check versions in the constructor and set TestCase::m_shouldRun to false for unsupported ones.

Another would be to set EVMVersion: =cancun in test cases. This is IMO something we should be doing in general because it gives us the most flexibility. All tests should be running in all configurations by default and need to be restricted explicitly as necessary. Especially in the context of EOF, this approach lets us keep it mostly disabled but still lets us enable it on a case-by-case basis. There are only ~45 cases in this suite so I think this is easily doable and I think we should go with this option.

BTW, perhaps we should think about introducing current as a valid value for EVMVersion to let us select a single version without hard-coding it. This would make this approach easier to reconcile with EVM version updates.

Copy link
Member Author

Choose a reason for hiding this comment

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

I like the idea with current. For now (and for the purpose of this PR) I have set the m_shouldRun flag, but we should do that in a follow up, imo.

Copy link
Member

Choose a reason for hiding this comment

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

Sounds good!

test/libyul/EVMCodeTransformTest.cpp Outdated Show resolved Hide resolved
@clonker clonker force-pushed the no-shl-assert-constant-optimizer branch from 6a26b71 to 8522c28 Compare December 11, 2024 08:08
@cameel cameel force-pushed the no-shl-assert-constant-optimizer branch from 8522c28 to 394dd92 Compare December 11, 2024 13:04
@cameel cameel enabled auto-merge December 11, 2024 13:10
@cameel cameel merged commit d04f70c into develop Dec 11, 2024
73 checks passed
@cameel cameel deleted the no-shl-assert-constant-optimizer branch December 11, 2024 13:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants