Skip to content

Adds test files inclusion for Voyager verification #3550

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

Open
wants to merge 13 commits into
base: master
Choose a base branch
from

Conversation

ametel01
Copy link
Contributor

Terminal
Adds --test-files flag to include test files in Voyager verification.

This change introduces a new --test-files flag to the sncast verify command. When used with the Voyager verifier, this flag includes files in the src/ directory, even those containing "test" in their path, in the source code uploaded for verification.

Changes

  • Added a test_files boolean field to the Verify struct in crates/sncast/src/starknet_commands/verify/mod.rs with a default value of false.
  • Modified the verify function in crates/sncast/src/starknet_commands/verify/mod.rs to pass the test_files flag to the verifier implementations.
  • Modified the VerificationInterface trait in crates/sncast/src/starknet_commands/verify/explorer.rs to include a test_files parameter in the verify method.
  • Modified the Voyager::verify implementation in crates/sncast/src/starknet_commands/verify/voyager.rs to accept the test_files flag and pass it to self.gather_files.
  • Modified the Voyager::gather_files function to pass the include_test_files flag to the package_source_files function.
  • Modified the package_source_files function to include or exclude test files based on the include_test_files flag. Added logic to walk through the path and check for "test" in the lowercase representation.
  • Added a new test contract map_with_tests including source and test files under crates/sncast/tests/data/contracts/.
  • Added e2e tests to verify if the --test-files flag works correctly by using the new test contract.

Impact

  • The sncast verify command now accepts a --test-files flag.
  • When the --test-files flag is used with the Voyager verifier, test files under src/ are included in the verification process.
  • If the flag is not present, test files are excluded.
  • Walnut verifier remains unaffected by the test_files flag.

ametel01 added 2 commits July 11, 2025 18:29
Introduces a `--test-files` flag to the `verify` command.

This flag allows users to include test files located under the `src/` directory during contract verification with the Voyager verifier.

This ensures that all relevant source code, including test-related code, is considered during the verification process, providing a more comprehensive and accurate verification result.
@ametel01 ametel01 marked this pull request as ready for review July 12, 2025 04:14
@ametel01 ametel01 requested a review from a team as a code owner July 12, 2025 04:14
ametel01 added 4 commits July 21, 2025 09:04
Extends Voyager tests to assert that the presence or absence
of test files in the request to Voyager is correct.
This ensures that the test files flag functions as expected.
Updates the Voyager tests to reflect changes in the location
of the contract files. Simplifies the directory structure by
removing the redundant `map_with_tests` directory and using
`map` instead. This change improves code maintainability
and test clarity.
The `--test-files` flag is not supported when using the Walnut verifier.
This change throws an error when a user attempts to use the flag with the Walnut verifier to prevent unexpected behavior.
@ddoktorski ddoktorski requested a review from cptartur July 21, 2025 08:18
@ametel01 ametel01 requested a review from ddoktorski July 21, 2025 08:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants