Skip to content

Commit 6b90f3f

Browse files
author
AztecBot
committed
Merge branch 'next' into ad/chore/ci-release-pr-canary
2 parents e3c1de7 + 62718b9 commit 6b90f3f

File tree

38 files changed

+191
-147
lines changed

38 files changed

+191
-147
lines changed

.github/workflows/ci3.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,10 @@ jobs:
125125
# Runs two test sets in parallel.
126126
ci-network-scenario:
127127
runs-on: ubuntu-latest
128+
strategy:
129+
fail-fast: false
130+
matrix:
131+
test_set: ["1", "2"]
128132
# We either run after a release (tag starting with v), or when the ci-network-scenario label is present in a PR.
129133
# We exclude ci-release-pr test tags (v0.0.1-commit.*) which are only for testing the release process.
130134
needs: ci
@@ -166,7 +170,7 @@ jobs:
166170
docker_image=""
167171
fi
168172
set -x # print next line
169-
./.github/ci3.sh network-scenarios next-scenario "$namespace" "$docker_image"
173+
./.github/ci3.sh network-scenarios next-scenario "$namespace" "$docker_image" "${{ matrix.test_set }}"
170174
171175
- name: Cleanup network resources
172176
# Clean up if this is a CI label or nightly.
@@ -180,8 +184,7 @@ jobs:
180184
GCP_PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }}
181185
NO_SPOT: 1
182186
run: |
183-
./.github/ci3.sh network-teardown next-scenario "${NAMESPACE}-1" || true
184-
./.github/ci3.sh network-teardown next-scenario "${NAMESPACE}-2" || true
187+
./.github/ci3.sh network-teardown next-scenario "${NAMESPACE}-${{ matrix.test_set }}" || true
185188
186189
#############
187190
# Benchmarks

.github/workflows/test-network-scenarios.yml

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ concurrency:
3232
jobs:
3333
deploy-and-test:
3434
runs-on: ubuntu-latest
35+
strategy:
36+
fail-fast: false
37+
matrix:
38+
test_set: ${{ fromJSON(inputs.test_set == '' && '["1","2"]' || format('["{0}"]', inputs.test_set)) }}
3539
steps:
3640
- name: Checkout
3741
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
@@ -51,8 +55,8 @@ jobs:
5155
run: |
5256
namespace=$(echo "${{ inputs.namespace }}" | sed 's/[^a-z0-9-]/-/g' | cut -c1-20)
5357
echo "NAMESPACE=$namespace" >> $GITHUB_ENV
54-
# Run scenario tests (both sets in parallel, or specific set if provided)
55-
./.github/ci3.sh network-scenarios "${{ inputs.env_file }}" "$namespace" "${{ inputs.docker_image }}" "${{ inputs.test_set }}"
58+
# Run scenario tests for the selected set (matrix expands to 1 or 2).
59+
./.github/ci3.sh network-scenarios "${{ inputs.env_file }}" "$namespace" "${{ inputs.docker_image }}" "${{ matrix.test_set }}"
5660
5761
- name: Cleanup network resources
5862
if: always()
@@ -65,10 +69,4 @@ jobs:
6569
GCP_PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }}
6670
NO_SPOT: 1
6771
run: |
68-
test_set="${{ inputs.test_set }}"
69-
if [[ -z "$test_set" ]]; then
70-
./.github/ci3.sh network-teardown "${{ inputs.env_file }}" "${NAMESPACE}-1" || true
71-
./.github/ci3.sh network-teardown "${{ inputs.env_file }}" "${NAMESPACE}-2" || true
72-
else
73-
./.github/ci3.sh network-teardown "${{ inputs.env_file }}" "${NAMESPACE}-${test_set}" || true
74-
fi
72+
./.github/ci3.sh network-teardown "${{ inputs.env_file }}" "${NAMESPACE}-${{ matrix.test_set }}" || true
Binary file not shown.

barretenberg/docs/src/katex-macros.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module.exports = {
22
"\\sk": "{\\color{red}{sk}}",
33
"\\seed": "{\\color{red}\\text{{seed}}}",
4-
"\\nskm": "{\\color{red}{nsk_m}}",
4+
"\\nhkm": "{\\color{red}{nhk_m}}",
55
"\\tskm": "{\\color{red}{tsk_m}}",
66
"\\ivskm": "{\\color{red}{ivsk_m}}",
77
"\\ovskm": "{\\color{red}{ovsk_m}}",
@@ -16,7 +16,7 @@ module.exports = {
1616
"\\constructorhash": "{\\color{green}{constructor_hash}}",
1717
"\\classid": "{\\color{green}{classid}}",
1818

19-
"\\nskapp": "{\\color{red}{nsk_{app}}}",
19+
"\\nhkapp": "{\\color{red}{nhk_{app}}}",
2020
"\\tskapp": "{\\color{red}{tsk_{app}}}",
2121
"\\ivsk": "{\\color{red}{ivsk}}",
2222
"\\ovskapp": "{\\color{red}{ovsk_{app}}}",

boxes/boxes/vanilla/contracts/src/main.nr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ pub contract PrivateVoting {
3838
fn cast_vote(candidate: Field) {
3939
let msg_sender_npk_m_hash = get_public_keys(self.msg_sender()).npk_m.hash();
4040

41-
let secret = self.context.request_nsk_app(msg_sender_npk_m_hash); // get secret key of caller of function
41+
let secret = self.context.request_nhk_app(msg_sender_npk_m_hash); // get nullifier hiding key of caller of function
4242
let nullifier = poseidon2_hash([self.msg_sender().to_field(), secret]); // derive nullifier from sender and secret
4343
self.context.push_nullifier(nullifier);
4444
self.enqueue_self.add_to_tally_public(candidate);

docs/docs-developers/docs/aztec-nr/framework-description/how_to_implement_custom_notes.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,9 +160,9 @@ impl NoteHash for CustomHashNote {
160160
owner: AztecAddress,
161161
note_hash_for_nullification: Field,
162162
) -> Field {
163-
// Standard nullifier using owner's nullifier secret key
163+
// Standard nullifier using owner's nullifier hiding key
164164
let owner_npk_m = aztec::keys::getters::get_public_keys(owner).npk_m;
165-
let secret = context.request_nsk_app(owner_npk_m.hash());
165+
let secret = context.request_nhk_app(owner_npk_m.hash());
166166
poseidon2_hash_with_separator(
167167
[note_hash_for_nullification, secret],
168168
DOM_SEP__NOTE_NULLIFIER,
@@ -175,7 +175,7 @@ impl NoteHash for CustomHashNote {
175175
note_hash_for_nullification: Field,
176176
) -> Field {
177177
let owner_npk_m = aztec::keys::getters::get_public_keys(owner).npk_m;
178-
let secret = aztec::keys::getters::get_nsk_app(owner_npk_m.hash());
178+
let secret = aztec::keys::getters::get_nhk_app(owner_npk_m.hash());
179179
poseidon2_hash_with_separator(
180180
[note_hash_for_nullification, secret],
181181
DOM_SEP__NOTE_NULLIFIER,

docs/docs-developers/docs/foundational-topics/accounts/keys.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ Nullifier keys enable spending private notes. When using a note (like spending a
4343

4444
**How it works:**
4545

46-
1. Each account has a master nullifier key pair (`Npk_m`, `nsk_m`)
47-
2. For each application, an **app-siloed** key is derived: `nsk_app = hash(nsk_m, app_contract_address)`
46+
1. Each account has a master nullifier key pair (`Npk_m`, `nhk_m`)
47+
2. For each application, an **app-siloed** key is derived: `nhk_app = hash(nhk_m, app_contract_address)`
4848
3. To spend a note, compute its nullifier using the note hash and app-siloed key
4949
4. The protocol verifies the app-siloed key comes from your master key and that your master public key is in your address
5050

@@ -150,7 +150,7 @@ Nullifier keys are **app-siloed** - scoped to each contract that uses them. This
150150
**How it works:**
151151

152152
```text
153-
nsk_app = hash(nsk_m, app_contract_address)
153+
nhk_app = hash(nhk_m, app_contract_address)
154154
```
155155

156156
**Security benefits:**

docs/docs-developers/docs/resources/migration_notes.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,33 @@ These methods were not used by PXE and returned a subset of the information alre
2929

3030
The membership witness methods return both the sibling path and additional context (leaf index, preimage data) needed for proofs.
3131

32+
### [Protocol] "Nullifier secret key" renamed to "nullifier hiding key" (nsk → nhk)
33+
34+
The nullifier secret key (`nsk_m` / `nsk_app`) has been renamed to nullifier hiding key (`nhk_m` / `nhk_app`). This is a protocol-breaking change: the domain separator string changes from `"az_nsk_m"` to `"az_nhk_m"`, producing a different constant value.
35+
36+
**Noir changes:**
37+
```diff
38+
- context.request_nsk_app(npk_m_hash)
39+
+ context.request_nhk_app(npk_m_hash)
40+
41+
- get_nsk_app(npk_m_hash)
42+
+ get_nhk_app(npk_m_hash)
43+
```
44+
45+
**TypeScript changes:**
46+
```diff
47+
- import { computeAppNullifierSecretKey, deriveMasterNullifierSecretKey } from '@aztec/stdlib/keys';
48+
+ import { computeAppNullifierHidingKey, deriveMasterNullifierHidingKey } from '@aztec/stdlib/keys';
49+
50+
- const masterNullifierSecretKey = deriveMasterNullifierSecretKey(secret);
51+
+ const masterNullifierHidingKey = deriveMasterNullifierHidingKey(secret);
52+
53+
- const nskApp = await computeAppNullifierSecretKey(masterNullifierSecretKey, contractAddress);
54+
+ const nhkApp = await computeAppNullifierHidingKey(masterNullifierHidingKey, contractAddress);
55+
```
56+
57+
The `GeneratorIndex.NSK_M` enum member is now `GeneratorIndex.NHK_M`.
58+
3259
### [Aztec.nr] `protocol_types` renamed to `protocol`
3360

3461
The `protocol_types` re-export from the `aztec` crate has been renamed to `protocol`. Update all imports accordingly:

docs/src/katex-macros.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module.exports = {
22
"\\sk": "{\\color{red}{sk}}",
33
"\\seed": "{\\color{red}\\text{{seed}}}",
4-
"\\nskm": "{\\color{red}{nsk_m}}",
4+
"\\nhkm": "{\\color{red}{nhk_m}}",
55
"\\tskm": "{\\color{red}{tsk_m}}",
66
"\\ivskm": "{\\color{red}{ivsk_m}}",
77
"\\ovskm": "{\\color{red}{ovsk_m}}",
@@ -16,7 +16,7 @@ module.exports = {
1616
"\\constructorhash": "{\\color{green}{constructor_hash}}",
1717
"\\classid": "{\\color{green}{classid}}",
1818

19-
"\\nskapp": "{\\color{red}{nsk_{app}}}",
19+
"\\nhkapp": "{\\color{red}{nhk_{app}}}",
2020
"\\tskapp": "{\\color{red}{tsk_{app}}}",
2121
"\\ivsk": "{\\color{red}{ivsk}}",
2222
"\\ovskapp": "{\\color{red}{ovsk_{app}}}",

noir-projects/aztec-nr/aztec/src/context/private_context.nr

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -704,30 +704,30 @@ impl PrivateContext {
704704
self.nullifier_read_requests.push(request);
705705
}
706706

707-
/// Requests the app-siloed nullifier secret key (nsk_app) for the given (hashed) master nullifier public key
707+
/// Requests the app-siloed nullifier hiding key (nhk_app) for the given (hashed) master nullifier public key
708708
/// (npk_m), from the user's PXE.
709709
///
710710
/// Advanced function: Only needed if you're designing your own notes and/or nullifiers.
711711
///
712712
/// Contracts are not allowed to compute nullifiers for other contracts, as that would let them read parts of their
713-
/// private state. Because of this, a contract is only given an "app-siloed secret key", which is constructed by
714-
/// hashing the user's master nullifier secret key with the contract's address. However, because contracts cannot
715-
/// be trusted with a user's master nullifier secret key (because we don't know which contracts are honest or
713+
/// private state. Because of this, a contract is only given an "app-siloed key", which is constructed by
714+
/// hashing the user's master nullifier hiding key with the contract's address. However, because contracts cannot
715+
/// be trusted with a user's master nullifier hiding key (because we don't know which contracts are honest or
716716
/// malicious), the PXE refuses to provide any master secret keys to any app smart contract function. This means
717-
/// app functions are unable to prove that the derivation of an app-siloed nullifier secret key has been computed
718-
/// correctly. Instead, an app function can request to the kernel (via `request_nsk_app`) that it validates the
717+
/// app functions are unable to prove that the derivation of an app-siloed nullifier hiding key has been computed
718+
/// correctly. Instead, an app function can request to the kernel (via `request_nhk_app`) that it validates the
719719
/// siloed derivation, since the kernel has been vetted to not leak any master secret keys.
720720
///
721-
/// A common nullification scheme is to inject a nullifier secret key into the preimage of a nullifier, to make the
721+
/// A common nullification scheme is to inject a nullifier hiding key into the preimage of a nullifier, to make the
722722
/// nullifier deterministic but random-looking. This function enables that flow.
723723
///
724724
/// # Arguments
725725
/// * `npk_m_hash` - A hash of the master nullifier public key of the user whose PXE is executing this function.
726726
///
727727
/// # Returns
728-
/// * The app-siloed nullifier secret key that corresponds to the given `npk_m_hash`.
728+
/// * The app-siloed nullifier hiding key that corresponds to the given `npk_m_hash`.
729729
///
730-
pub fn request_nsk_app(&mut self, npk_m_hash: Field) -> Field {
730+
pub fn request_nhk_app(&mut self, npk_m_hash: Field) -> Field {
731731
self.request_sk_app(npk_m_hash, NULLIFIER_INDEX)
732732
}
733733

0 commit comments

Comments
 (0)