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 some fuzzing conditional compilation issues in aptos-crypto #15703

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

alinush
Copy link
Contributor

@alinush alinush commented Jan 10, 2025

Description

Was trying to add a new signature benchmark and noticed that cargo test now fails in crates/aptos-crypto due to some conditional compilation gone awry in #14869 (cc @zi0Black):

alinush@alinush [~/aptos-core/crates/aptos-crypto] (alin/fix-crypto-benches) $ cargo test
   Compiling aptos-crypto v0.0.3 (/Users/alinush/repos/aptos-core/crates/aptos-crypto)
error[E0592]: duplicate definitions with name `from_bytes_unchecked`
  --> crates/aptos-crypto/src/secp256r1_ecdsa/secp256r1_ecdsa_sigs.rs:52:5
   |
39 | /     pub(crate) fn from_bytes_unchecked(
40 | |         bytes: &[u8],
41 | |     ) -> std::result::Result<Signature, CryptoMaterialError> {
   | |____________________________________________________________- other definition for `from_bytes_unchecked`
...
52 | /     pub fn from_bytes_unchecked(
53 | |         bytes: &[u8],
54 | |     ) -> std::result::Result<Signature, CryptoMaterialError> {
   | |____________________________________________________________^ duplicate definitions for `from_bytes_unchecked`

For more information about this error, try `rustc --explain E0592`.
error: could not compile `aptos-crypto` (lib test) due to 1 previous error

Not sure why CI did not catch this.

cc @aptos-labs/prod-eng: is cargo test not being run for crates/aptos-crypto in CI?

How Has This Been Tested?

cargo test in crates/aptos-crypto now compiles:

Key Areas to Review

Type of Change

  • New feature
  • Bug fix
  • Breaking change
  • Performance improvement
  • Refactoring
  • Dependency update
  • Documentation update
  • Tests

Which Components or Systems Does This Change Impact?

  • Validator Node
  • Full Node (API, Indexer, etc.)
  • Move/Aptos Virtual Machine
  • Aptos Framework
  • Aptos CLI/SDK
  • Developer Infrastructure
  • Move Compiler
  • Other (specify)

Checklist

  • I have read and followed the CONTRIBUTING doc
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I identified and added all stakeholders and component owners affected by this change as reviewers
  • I tested both happy and unhappy path of the functionality
  • I have made corresponding changes to the documentation

Copy link

trunk-io bot commented Jan 10, 2025

⏱️ 17m total CI duration on this PR
Job Cumulative Duration Recent Runs
rust-move-tests 13m 🟩
rust-cargo-deny 2m 🟩
check-dynamic-deps 1m 🟩
general-lints 24s 🟩
semgrep/ci 20s 🟩
file_change_determinator 9s 🟩
permission-check 2s 🟩
permission-check 2s 🟩

settingsfeedbackdocs ⋅ learn more about trunk.io

@alinush alinush requested a review from zi0Black January 10, 2025 00:05
@alinush alinush marked this pull request as ready for review January 10, 2025 00:05
@@ -35,7 +35,7 @@ impl Signature {

/// Deserialize an P256Signature, without checking for malleability
/// Uses the SEC1 serialization format.
#[cfg(not(feature = "fuzzing"))]
#[cfg(all(not(feature = "fuzzing"), not(test)))]
Copy link
Contributor

Choose a reason for hiding this comment

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

it seems the code for this case the other case are identical.

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.

2 participants