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

Testing code generation errors #15612

Merged
merged 3 commits into from
Dec 20, 2024
Merged

Testing code generation errors #15612

merged 3 commits into from
Dec 20, 2024

Conversation

cameel
Copy link
Member

@cameel cameel commented Dec 4, 2024

Depends on #15611. Merged.
Depends on #15667. Merged.

The PR makes it possible to create Yul syntax tests that cover code generation errors. We only had one such error until now (access to an uninitialized immutable), but with EOF they will be much more common due to the limits imposed by the format that cannot be checked before bytecode generation. Treating those as ICEs is not acceptable. They must be properly reported to the user as errors and also covered with tests.

In this PR I'm making Yul syntax tests not stop after parsing but actually proceed with optimization and assembling. We already do the same thing in Solidity syntax tests.

The PR then adds code generation errors and tests for two EOF cases to make sure the new mechanism works properly.

@cameel cameel added testing 🔨 has dependencies The PR depends on other PRs that must be merged first labels Dec 4, 2024
@cameel cameel self-assigned this Dec 4, 2024
Comment on lines +1559 to +1651
throw Error(
2202_error,
Error::Type::CodeGenerationError,
"Code section too large for EOF."
);
Copy link
Member Author

Choose a reason for hiding this comment

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

@rodiazet Once this PR gets merged, this is how EOF errors triggerable by user code should be reported.

The analyzer checks for the number of subs and functions should be replaced with this.

@cameel cameel force-pushed the unify-yul-parsing-across-test-suites branch 2 times, most recently from 0abfe3a to 812efab Compare December 4, 2024 05:14
@cameel cameel force-pushed the testing-code-generation-errors branch from 13b4f30 to 126b33f Compare December 4, 2024 05:14
@cameel cameel force-pushed the unify-yul-parsing-across-test-suites branch from 812efab to 609fd43 Compare December 4, 2024 05:52
@cameel cameel force-pushed the testing-code-generation-errors branch 2 times, most recently from 6cab972 to 0d31dde Compare December 7, 2024 04:26
@cameel cameel force-pushed the unify-yul-parsing-across-test-suites branch from 609fd43 to 4d3140e Compare December 7, 2024 04:26
@cameel cameel force-pushed the testing-code-generation-errors branch from 0d31dde to dce96ab Compare December 11, 2024 00:05
@cameel cameel force-pushed the unify-yul-parsing-across-test-suites branch 2 times, most recently from 48fd3d0 to 29c2a39 Compare December 11, 2024 00:37
@cameel cameel force-pushed the testing-code-generation-errors branch from dce96ab to 24dcbc6 Compare December 11, 2024 00:37
@cameel cameel force-pushed the unify-yul-parsing-across-test-suites branch from 29c2a39 to f1e44cf Compare December 11, 2024 18:45
@cameel cameel force-pushed the testing-code-generation-errors branch from 24dcbc6 to 336001a Compare December 11, 2024 18:45
@cameel cameel force-pushed the unify-yul-parsing-across-test-suites branch 2 times, most recently from e797b3c to fcbfbf5 Compare December 11, 2024 21:07
@cameel cameel force-pushed the testing-code-generation-errors branch from 336001a to 0ae3cef Compare December 11, 2024 21:46
@cameel cameel force-pushed the unify-yul-parsing-across-test-suites branch from fcbfbf5 to 9acd665 Compare December 12, 2024 17:51
@cameel cameel force-pushed the testing-code-generation-errors branch from 0ae3cef to f59e518 Compare December 12, 2024 17:51
@cameel cameel force-pushed the unify-yul-parsing-across-test-suites branch from 9acd665 to 3d8ff6b Compare December 13, 2024 14:26
@cameel cameel force-pushed the testing-code-generation-errors branch from f59e518 to 81e56aa Compare December 13, 2024 20:23
@cameel cameel force-pushed the unify-yul-parsing-across-test-suites branch from 3d8ff6b to 2f4d58f Compare December 13, 2024 20:23
@cameel cameel force-pushed the unify-yul-parsing-across-test-suites branch from 2f4d58f to 46b0616 Compare December 17, 2024 14:55
@cameel cameel force-pushed the testing-code-generation-errors branch from 81e56aa to ef2a623 Compare December 17, 2024 14:55
Base automatically changed from unify-yul-parsing-across-test-suites to develop December 17, 2024 15:42
@cameel cameel force-pushed the testing-code-generation-errors branch from ef2a623 to c6179ea Compare December 17, 2024 15:44
@cameel cameel removed the has dependencies The PR depends on other PRs that must be merged first label Dec 17, 2024
@cameel cameel marked this pull request as ready for review December 17, 2024 15:44
matheusaaguiar
matheusaaguiar previously approved these changes Dec 18, 2024
Copy link
Collaborator

@matheusaaguiar matheusaaguiar left a comment

Choose a reason for hiding this comment

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

Just a question about a minor detail.

libevmasm/Assembly.cpp Outdated Show resolved Hide resolved
@cameel cameel force-pushed the testing-code-generation-errors branch 2 times, most recently from 1b82389 to ba35d52 Compare December 19, 2024 15:40
@cameel cameel added the has dependencies The PR depends on other PRs that must be merged first label Dec 19, 2024
@cameel cameel changed the base branch from develop to fix-eof-data-section-size-validation December 19, 2024 15:47
@cameel cameel force-pushed the fix-eof-data-section-size-validation branch from 2115f2a to c158522 Compare December 19, 2024 16:36
@cameel cameel force-pushed the testing-code-generation-errors branch 2 times, most recently from d5ff624 to 3966f44 Compare December 19, 2024 16:44
@cameel cameel force-pushed the fix-eof-data-section-size-validation branch from c158522 to bb9d694 Compare December 19, 2024 16:44
Base automatically changed from fix-eof-data-section-size-validation to develop December 19, 2024 17:25
@cameel cameel force-pushed the testing-code-generation-errors branch from 3966f44 to 43b84f0 Compare December 19, 2024 18:51
@cameel cameel merged commit 4a11836 into develop Dec 20, 2024
73 checks passed
@cameel cameel deleted the testing-code-generation-errors branch December 20, 2024 12:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
has dependencies The PR depends on other PRs that must be merged first testing 🔨
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants