Skip to content

Reorganize semantic tests for calldata and abicoder#16483

Merged
cameel merged 5 commits into
developfrom
reorganize-calldata-semantic-tests
Apr 30, 2026
Merged

Reorganize semantic tests for calldata and abicoder#16483
cameel merged 5 commits into
developfrom
reorganize-calldata-semantic-tests

Conversation

@cameel
Copy link
Copy Markdown
Collaborator

@cameel cameel commented Feb 19, 2026

This is just a refactor in preparation for fixing a bug in calldata validation. I needed to figure out what we have coverage for and since our tests for this are all over the place, I did some renaming and reorganization of the test dirs.

Summary of changes:

  • abiEncodeDecode/, abiEncoderV1/, abiEncoderV2/, calldata/ under semanticTests/ all had random subsets of ABI encoding and calldata tests. I merged them all into a single abicoder/ dir with subdirs for validation, cleanup, structs, arrays, etc. Also moved some tests from arrays/ and structs/ there.
  • This revealed that some of the tests are almost exact duplicates. I removed these.
    • Note that tests without the abicoder pragma cover both v1 and v2 since isoltest inserts a pragma depending on whether it runs with or without --abiencoderv1. Those with v2 pragma cover only v2. Those with v1 pragma cover v1 via evmasm and v2 via Yul (since the compiler ignores the pragma via Yul).
    • There are also quite a few non-identical tests covering the same thing. I intentionally left those, as I did not want to get into figuring out which version is better and should be left in.
  • I enabled debug revert strings in tests covering validations. Otherwise it's not clear which validation failed in the test. Sometimes that required creating separate v1 and v2 versions.
  • Other minor corrections: one test no longer needs compileViaYul: false. Another mixed tabs and spaces. Etc.

@cameel cameel self-assigned this Feb 19, 2026
@cameel cameel force-pushed the reorganize-calldata-semantic-tests branch from 6095512 to f20af71 Compare February 19, 2026 19:35
@cameel
Copy link
Copy Markdown
Collaborator Author

cameel commented Feb 19, 2026

copy_from_calldata_removes_bytes_data.sol is the only test I left under calldata/. It does not really test decoding, but I'm also not sure what it really tests. It comes from #12289, which extracted tests from SolidityEndToEndTest.cpp, but this does not seem to be one of them. It's as if it appeared out of nowhere. It's even weirder that I reviewed that PR and apparently did see the original back then. I suspect that something got botched when the PR was rebased.

In any case, this test could be covering some ancient, long fixed bug, but in isolation it looks a bit worthless and weird (why unused set() function?) so I'm considering just removing it.

rodiazet
rodiazet previously approved these changes Feb 26, 2026
Copy link
Copy Markdown
Contributor

@rodiazet rodiazet left a comment

Choose a reason for hiding this comment

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

LGTM. Some comments or rather questions added and I proposed to move one test.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This test is a copy of test/libsolidity/semanticTests/array/calldata_array_bounds_check_nested_bytes.sol Shouldn't this be moved to test/libsolidity/semanticTests/abicoder/calldataDecoding/array

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This test is a copy of test/libsolidity/semanticTests/array/calldata_array_bounds_check_nested_bytes.sol

Yes, that's why I kept only one of them.

Shouldn't this be moved to test/libsolidity/semanticTests/abicoder/calldataDecoding/array

Well, we have many tests that would fit in more than one place. When it comes to calldata arrays, for example, there is a big overlap between array behavior and calldata decoding. This case IMO is more about the former. The test checks that accessing an element past the end of the array reverts. This is not specific to calldata and happens with all kinds of arrays (note that it's Panic, not Error).

@cameel cameel force-pushed the reorganize-calldata-semantic-tests branch from f20af71 to d45a45e Compare March 12, 2026 16:39
@cameel cameel force-pushed the reorganize-calldata-semantic-tests branch from d45a45e to 0df51f7 Compare March 12, 2026 18:16
@cameel
Copy link
Copy Markdown
Collaborator Author

cameel commented Mar 12, 2026

copy_from_calldata_removes_bytes_data.sol is the only test I left under calldata/.

Still not sure what to do about it, but for now I decided to move it to abicoder/calldataDecoding/ to avoid having an almost empty calldata/ dir. If we keep it, things will get messy again, because people will start adding new tests there.

@cameel cameel force-pushed the reorganize-calldata-semantic-tests branch from 0df51f7 to 8b17183 Compare March 12, 2026 18:20
@cameel cameel requested a review from rodiazet March 12, 2026 18:21
Copy link
Copy Markdown
Contributor

@rodiazet rodiazet left a comment

Choose a reason for hiding this comment

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

LGTM

@github-actions github-actions Bot added the stale The issue/PR was marked as stale because it has been open for too long. label Apr 1, 2026
@cameel cameel removed the stale The issue/PR was marked as stale because it has been open for too long. label Apr 3, 2026
@github-actions github-actions Bot added the stale The issue/PR was marked as stale because it has been open for too long. label Apr 18, 2026
@cameel cameel removed the stale The issue/PR was marked as stale because it has been open for too long. label Apr 18, 2026
@cameel cameel force-pushed the reorganize-calldata-semantic-tests branch from 8b17183 to 511cdc0 Compare April 30, 2026 16:35
@argotorg argotorg deleted a comment from github-actions Bot Apr 30, 2026
@argotorg argotorg deleted a comment from github-actions Bot Apr 30, 2026
@cameel cameel merged commit 68d1a77 into develop Apr 30, 2026
83 checks passed
@cameel cameel deleted the reorganize-calldata-semantic-tests branch April 30, 2026 20:54
franciscoarturorivera371-cyber

This comment was marked as spam.

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