Skip to content

NHK Mask Feature#52

Merged
JanKuczma merged 1 commit intomainfrom
jk-mask-feat
Mar 5, 2026
Merged

NHK Mask Feature#52
JanKuczma merged 1 commit intomainfrom
jk-mask-feat

Conversation

@JanKuczma
Copy link
Contributor

@JanKuczma JanKuczma commented Mar 5, 2026

Summary by CodeRabbit

Release Notes

  • Documentation

    • Updated integration guide with simplified account-key derivation workflow
    • Added security note regarding nullifier hiding key exposure and future masking improvements
  • Refactor

    • Streamlined nullifier hiding key access API with simplified single-parameter method

@coderabbitai
Copy link

coderabbitai bot commented Mar 5, 2026

Walkthrough

This PR simplifies the NHK (nullifier hiding key) API across the Aztec state migration wallet layer by replacing the multi-parameter getMaskedNhk() and getNhkApp() methods with a single-argument getNhk() method. Changes span interface definitions, implementations, base wallet logic, tests, and documentation.

Changes

Cohort / File(s) Summary
NHK API Refactoring
ts/aztec-state-migration/wallet/migration-account.ts, ts/aztec-state-migration/wallet/migration-base-wallet.ts
Replaced getMaskedNhk(mask) and getNhkApp(contractAddress) with simplified getNhk() method in MigrationAccount interface and implementations (MigrationAccountWithSecretKey, SignerlessMigrationAccount). Removed computeAppNullifierHidingKey import and simplified method logic to return master NHK directly.
Documentation & Specification Updates
docs/spec/mode-b-spec.md, docs/integration-guide.md, docs/security.md
Updated Mode B specification and integration guide to reflect new getNhk() API. Added security note about raw NHK exposure and future masking improvements planned.
E2E Test Updates
e2e-tests/migration-mode-b.test.ts, e2e-tests/nft-migration-mode-b.test.ts, e2e-tests/token-migration-mode-b.test.ts
Updated all test files to call getNhk(oldUserManager.address) instead of getMaskedNhk() with multiple cross-address parameters.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • DamianStraszak

Poem

🐰 The NHK API hops with grace,
From masked chaos to simpler space—
One method now, no hiding games,
Security notes call out the names.
A cleaner wallet, tests in line,
This refactor makes all aligned! ✨

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Title check ⚠️ Warning The title 'NHK Mask Feature' is misleading—the PR actually removes masking functionality, replacing getMaskedNhk() with getNhk(). Update the title to accurately reflect the change, such as 'Simplify NHK access by removing masking' or 'Replace masked NHK API with direct NHK retrieval'.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch jk-mask-feat

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@ts/aztec-state-migration/wallet/migration-account.ts`:
- Around line 92-95: getNhk currently returns the raw masterNullifierHidingKey
(from deriveKeys(getSecretKey())), which exposes a secret; replace this API so
the raw NHK never leaves the wallet boundary — e.g., remove/privatize getNhk and
add a wallet-side method (e.g., performWithNhk or deriveMigrationArtifact) that
calls deriveKeys(this.getSecretKey()), uses masterNullifierHidingKey only
internally to compute and return a safe derived artifact (HMAC/hash/blinded
token/commitment) required by the migration, or accepts a callback to operate on
the NHK inside the wallet and return only non-secret results; update callers to
use that new method instead of expecting the raw NHK from getNhk.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 3fc98d62-508c-4f9c-b125-855a82d2ffe3

📥 Commits

Reviewing files that changed from the base of the PR and between 42a96f1 and bba993a.

📒 Files selected for processing (8)
  • docs/integration-guide.md
  • docs/security.md
  • docs/spec/mode-b-spec.md
  • e2e-tests/migration-mode-b.test.ts
  • e2e-tests/nft-migration-mode-b.test.ts
  • e2e-tests/token-migration-mode-b.test.ts
  • ts/aztec-state-migration/wallet/migration-account.ts
  • ts/aztec-state-migration/wallet/migration-base-wallet.ts

@JanKuczma JanKuczma merged commit e0c107b into main Mar 5, 2026
3 checks passed
@JanKuczma JanKuczma deleted the jk-mask-feat branch March 5, 2026 14:52
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