Skip to content

Conversation

@derekpierre
Copy link
Member

Type of PR:

  • Bugfix
  • Feature
  • Documentation
  • Other

Required reviews:

  • 1
  • 2
  • 3

What this does:

High-level idea of the changes introduced in this PR.
List relevant API changes (if any), as well as related PRs and issues.

Issues fixed/closed:

  • Fixes #...

Why it's needed:

Explain how this PR fits in the greater context of the NuCypher Network.
E.g., if this PR address a nucypher/productdev issue, let reviewers know!

Notes for reviewers:

What should reviewers focus on?
Is there a particular commit/function/section of your PR that requires more attention from reviewers?

Copy link

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 changes the nonce field type from u64 to Uint256 (a 256-bit unsigned integer) in the UserOperation and PackedUserOperation structures to support larger nonce values as required by the ERC-4337 standard.

Key changes:

  • Introduces a new Uint256 wrapper type around primitive_types::U256 with serialization support
  • Updates all UserOperation and PackedUserOperation structs to use Uint256 for nonce fields
  • Adjusts language bindings (WASM and Python) to handle the larger integer type through string representations

Reviewed Changes

Copilot reviewed 8 out of 9 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
nucypher-core/src/prim_types.rs New module defining the Uint256 wrapper type with conversion and serialization methods
nucypher-core/src/lib.rs Exports the new Uint256 type from the public API
nucypher-core/src/signature_request.rs Updates UserOperation and PackedUserOperation structs to use Uint256 for nonce, changes JSON serialization to use decimal strings
nucypher-core/Cargo.toml Adds primitive-types dependency with serde support
nucypher-core-wasm/src/lib.rs Updates WASM bindings to accept/return nonce as string
nucypher-core-wasm/tests/wasm.rs Updates tests to use string representation for nonce values
nucypher-core-python/src/lib.rs Updates Python bindings to accept PyLong and return BigUint for nonce
nucypher-core-python/Cargo.toml Adds num-bigint dependency and enables pyo3 num-bigint feature
Cargo.lock Updates dependency tree with new crates

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codecov-commenter
Copy link

codecov-commenter commented Nov 13, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 63.96%. Comparing base (806bc81) to head (82a8687).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #126      +/-   ##
==========================================
+ Coverage   63.51%   63.96%   +0.44%     
==========================================
  Files          20       21       +1     
  Lines        4498     4554      +56     
==========================================
+ Hits         2857     2913      +56     
  Misses       1641     1641              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@derekpierre derekpierre changed the title [WIP] Nonce as uint256 Nonce as uint256 Nov 13, 2025
@derekpierre derekpierre marked this pull request as ready for review November 13, 2025 21:12
}

/// Converts the `Uint256` to a big-endian byte array.
pub fn to_be_bytes(&self) -> [u8; 32] {
Copy link
Member

Choose a reason for hiding this comment

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

Would you consider to change this to to_big_endian_bytes?

Copy link
Member Author

@derekpierre derekpierre Nov 17, 2025

Choose a reason for hiding this comment

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

I have no issue changing it at all.

For context, this is a common naming pattern in core Rust:

and also followed by some of our existing code:

If this doesn’t change anything from your perspective, just say the word and I’ll update it.

@derekpierre derekpierre merged commit a36151b into nucypher:main Nov 18, 2025
13 checks passed
derekpierre added a commit to derekpierre/nucypher-core that referenced this pull request Nov 20, 2025
Switch order so that Added is before Fixed.
Copilot AI mentioned this pull request Nov 20, 2025
7 tasks
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.

4 participants