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

Gate Code for Testing Purposes Under testing Modules #688

Open
wants to merge 8 commits into
base: develop
Choose a base branch
from

Conversation

sai-deng
Copy link
Member

@sai-deng sai-deng commented Oct 2, 2024

This PR gates test-specific code under the testing modules.

Please use GitHub’s “Hide whitespace changes” feature for easier reviewing.

@sai-deng sai-deng self-assigned this Oct 2, 2024
@github-actions github-actions bot added crate: trace_decoder Anything related to the trace_decoder crate. crate: evm_arithmetization Anything related to the evm_arithmetization crate. crate: zero_bin Anything related to the zero-bin subcrates. labels Oct 2, 2024
@sai-deng sai-deng marked this pull request as ready for review October 2, 2024 19:06
Copy link
Contributor

@0xaatif 0xaatif left a comment

Choose a reason for hiding this comment

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

I'm in favour of the testing modules, and the code changes you've made, but I'd rather not see a test_utils feature.

  • We don't really care about a narrow API - our only consumer is zero.
  • We don't care about excluding symbols from production builds - dead code elimination is already done by the compiler.
  • Development complexity is increased.
    • Now I've got to tell my editor to use --features test_utils
    • A more complex feature matrix, where we need to add e.g clippy coverage (which is easy to neglect c.f this PR ;) )

@github-actions github-actions bot removed the crate: zero_bin Anything related to the zero-bin subcrates. label Oct 2, 2024
@sai-deng sai-deng changed the title Gate Code for Testing Purposes Under test-utils Flag Gate Code for Testing Purposes Under testing Modules Oct 2, 2024
@sai-deng
Copy link
Member Author

sai-deng commented Oct 2, 2024

I'm in favour of the testing modules, and the code changes you've made, but I'd rather not see a test_utils feature.

  • We don't really care about a narrow API - our only consumer is zero.

  • We don't care about excluding symbols from production builds - dead code elimination is already done by the compiler.

  • Development complexity is increased.

    • Now I've got to tell my editor to use --features test_utils
    • A more complex feature matrix, where we need to add e.g clippy coverage (which is easy to neglect c.f this PR ;) )

Thanks for reviewing! We don’t need to use --features test_utils, as it’s only used in evm_arithmetization/tests and hard coded in Cargo.toml. You’re right about the compiler optimization, so I’ve removed the feature.

@github-actions github-actions bot removed the crate: trace_decoder Anything related to the trace_decoder crate. label Oct 2, 2024
@sai-deng
Copy link
Member Author

sai-deng commented Oct 2, 2024

I'm in favour of the testing modules, and the code changes you've made, but I'd rather not see a test_utils feature.

  • We don't really care about a narrow API - our only consumer is zero.

  • We don't care about excluding symbols from production builds - dead code elimination is already done by the compiler.

  • Development complexity is increased.

    • Now I've got to tell my editor to use --features test_utils
    • A more complex feature matrix, where we need to add e.g clippy coverage (which is easy to neglect c.f this PR ;) )

Thanks for reviewing! We don’t need to use --features test_utils, as it’s only used in evm_arithmetization/tests and hard coded in Cargo.toml. You’re right about the compiler optimization, so I’ve removed the feature.

However, I would argue that without a feature gate or conditional compilation like #[cfg(test)] (which we cannot use, since the code is needed in evm_arithmetization/tests), we cannot guarantee that test-specific code won’t be accidentally used in production. While the Rust optimizer can remove unused code, having the test code always available increases the risk of it being inadvertently referenced or used in production.

Copy link
Collaborator

@Nashtare Nashtare left a comment

Choose a reason for hiding this comment

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

Non-blocking comment, LGTM

Comment on lines +153 to +156
pub fn verify_proof<
F: RichField + Extendable<D>,
C: GenericConfig<D, F = F>,
const D: usize,
Copy link
Collaborator

Choose a reason for hiding this comment

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

In that case we could gate behind a testing module the intermediate verify_foo methods in fixed_recursive_verifier too (i.e. verify_root. / verify_segment_aggregation / verify_batch_aggregation), as well as prove_all_segments

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
crate: evm_arithmetization Anything related to the evm_arithmetization crate.
Projects
Status: Ready To Merge
Development

Successfully merging this pull request may close these issues.

3 participants