Skip to content

Upgrade passport circuits to latest Noir version#172

Merged
Bisht13 merged 17 commits into
mainfrom
vr/noir-latest
Sep 4, 2025
Merged

Upgrade passport circuits to latest Noir version#172
Bisht13 merged 17 commits into
mainfrom
vr/noir-latest

Conversation

@0xVikasRushi
Copy link
Copy Markdown
Collaborator

@0xVikasRushi 0xVikasRushi commented Aug 31, 2025

  • Upgraded complete_age_check circuits to the latest Noir version (v1.0.0-beta.11)
  • Added a Rust crate for generating US dummy passport data
  • added noir-rsa

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Aug 31, 2025

CodSpeed WallTime Performance Report

Merging #172 will not alter performance

Comparing vr/noir-latest (c42a3c7) with main (6da2acb)

⚠️ Unknown Walltime execution environment detected

Using the Walltime instrument on standard Hosted Runners will lead to inconsistent data.

For the most accurate results, we recommend using CodSpeed Macro Runners: bare-metal machines fine-tuned for performance measurement consistency.

Summary

✅ 35 untouched benchmarks

@0xVikasRushi 0xVikasRushi changed the title [WIP] Upgrade passport circuits to latest Noir version Upgrade passport circuits to latest Noir version Sep 1, 2025
@0xVikasRushi 0xVikasRushi marked this pull request as ready for review September 1, 2025 17:30
Comment thread noir-examples/noir-passport-examples/complete_age_check/src/main.nr Outdated

[dependencies]
sha256 = { tag = "v0.1.1", git = "https://github.com/noir-lang/sha256" }
sha256 = { tag = "main", git = "https://github.com/noir-lang/sha256" }
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Pin to v0.2.0

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.

there are a few changes in v0.2.0 that are causing bugs. Brillig function call isn’t properly covered by a manual constraint in version 0.2.0. However, latest main branch doesn’t produce these bugs. Both cases works, 0.2.0 but produces brillig bug.

image

Comment thread noir-examples/noir-passport-examples/noir_rsa/Nargo.toml
Comment thread noir-examples/noir-passport-examples/noir_rsa/README.md Outdated
Comment thread noir-examples/noir-passport-examples/zkpassport_libs/sig-check/common/Nargo.toml Outdated
Comment thread Cargo.toml Outdated
@Bisht13 Bisht13 requested a review from Copilot September 2, 2025 21:24
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR upgrades the Noir passport circuits to the latest Noir version (v1.0.0-beta.11), adds a Rust crate for generating US dummy passport data, and includes the noir-rsa dependency for RSA signature verification functionality.

Key changes include:

  • Upgrading Noir compiler version requirements from v0.22.0/v0.35.0 to v1.0.0
  • Updating function signatures to use u32 instead of Field for array indices
  • Adding comprehensive type definitions and test utilities for passport data processing

Reviewed Changes

Copilot reviewed 58 out of 58 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
noir-examples/noir-r1cs-test-programs/*/src/main.nr Updated array indexing parameters from Field to u32 for memory operations
noir-examples/noir-passport-examples/zkpassport_libs/utils/src/types.nr Added comprehensive type definitions for DG1, MRZ, and passport data structures
noir-examples/noir-passport-examples/zkpassport_libs/utils/src/tests.nr Added extensive test suite with DG1Builder utility and validation functions
noir-examples/noir-passport-examples/zkpassport_libs/utils/src/lib.nr Enhanced utility functions with new data extraction methods and improved type safety
noir-examples/noir-passport-examples/zkpassport_libs/sig-check/*/Nargo.toml Updated dependency versions and compiler requirements
noir-examples/noir-passport-examples/zkpassport_libs/commitment/*/src/lib.nr Updated commitment functions with improved error messages and parameter handling

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.


/// Returns total TLV length (tag + length field + content) for any
/// ASN.1 element using DER/BER **definite-length** encoding with a
/// single-byte tag (tag number field < 31)
Copy link

Copilot AI Sep 2, 2025

Choose a reason for hiding this comment

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

The function name includes 'unsafe' but lacks documentation explaining why it's unsafe and what safety precautions callers should take. Add a doc comment explaining the safety implications and proper usage.

Copilot uses AI. Check for mistakes.
Comment on lines +654 to +655
/// Safety: This is safe because the offset is only used as a starting point
/// to verify the substring exists
Copy link

Copilot AI Sep 2, 2025

Choose a reason for hiding this comment

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

This function is marked as 'unsafe' but lacks documentation explaining the safety implications. The safety comment on line 654-655 should be moved to a proper doc comment on this function.

Suggested change
/// Safety: This is safe because the offset is only used as a starting point
/// to verify the substring exists
/**
* Safety: This is safe because the offset is only used as a starting point
* to verify the substring exists
*/

Copilot uses AI. Check for mistakes.
data_to_sign: [u8; DATA_TO_SIGN_LEN],
data_to_sign_len: u64,
data_to_sign: [u8; DATA_TO_SIGN_MAX_LEN],
data_to_sign_len: u32,
Copy link

Copilot AI Sep 2, 2025

Choose a reason for hiding this comment

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

The parameter type changed from u64 to u32 for data_to_sign_len. This could be a breaking change if the original u64 was intentional for handling very large data sizes. Verify this change is intentional and doesn't limit functionality.

Suggested change
data_to_sign_len: u32,
data_to_sign_len: u64,

Copilot uses AI. Check for mistakes.
Comment on lines +47 to +53
if issuing_country == ZKR_COUNTRY_CODE_BYTES {
// Set the scoped nullifier to 1 to indicate the issuing country is not a real one
// and prevent the use of these proofs in production
// Note: ZKPassport's registries on mainnet blockchains will not include
// the ZKR certificates but still this distinction can be useful for testnets/devnets
scoped_nullifier = 1;
}
Copy link

Copilot AI Sep 2, 2025

Choose a reason for hiding this comment

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

Using the magic number 1 as a special value for test nullifiers is unclear. Consider defining a named constant like TEST_NULLIFIER_VALUE to make the intent more explicit.

Copilot uses AI. Check for mistakes.
@Bisht13 Bisht13 merged commit 21311aa into main Sep 4, 2025
4 of 5 checks passed
@Bisht13 Bisht13 deleted the vr/noir-latest branch September 4, 2025 17:13
dcbuild3r pushed a commit that referenced this pull request May 16, 2026
Upgrade passport circuits to latest Noir version
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