Skip to content

Commit 0000f6e

Browse files
author
AztecBot
committed
chore: sync public-v5-next with upstream v5-next
2 parents 461f7a4 + 86212eb commit 0000f6e

118 files changed

Lines changed: 1670 additions & 876 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/merge-train-create-pr.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,9 @@ jobs:
5555
if [[ "$branch" == "merge-train/spartan" || "$branch" == "merge-train/spartan-v5" || "$branch" == "merge-train/spartan-v6" || "$branch" == "merge-train/ci" ]]; then
5656
labels="$labels,ci-full-no-test-cache"
5757
fi
58-
# Trains targeting the v5 release line are ports into v5-next.
59-
if [[ "$base_branch" == "v5-next" ]]; then
58+
# Trains targeting a v<N>-next release line (v5-next, v6-next) are
59+
# forward-ported into their base via the private-port-next driver.
60+
if [[ "$base_branch" =~ ^v[0-9]+-next$ ]]; then
6061
labels="$labels,private-port-next"
6162
fi
6263
gh pr create --base "$base_branch" --head "$branch" \

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ services:
7272
environment:
7373
AZTEC_NODE_URL: http://node:8080
7474
NODE_NO_WARNINGS: 1
75-
SECRET_KEY:
75+
SIGNING_KEY:
7676
ETHEREUM_HOSTS:
7777
profiles:
7878
- cli

docs/docs-developers/docs/aztec-js/how_to_create_account.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@ yarn add @aztec/aztec.js@#include_version_without_prefix @aztec/wallets@#include
2020

2121
## Create a new account
2222

23-
Using the [`wallet` from the connection guide](./how_to_connect_to_local_network.md), call `createSchnorrAccount` to create a new account with a random secret and salt:
23+
Using the [`wallet` from the connection guide](./how_to_connect_to_local_network.md), call `createSchnorrAccount` to create a new account with a random secret, salt, and signing key:
2424

2525
#include_code create_account /docs/examples/ts/aztecjs_connection/index.ts typescript
2626

27-
The secret is used to derive the account's encryption keys, and the salt ensures address uniqueness. The signing key is automatically derived from the secret.
27+
The secret derives the account's encryption keys, the signing key authenticates its transactions, and the salt ensures address uniqueness. The signing key is provided independently and is not derived from the secret: it is an ownership key, so keep it separate from the encryption secret that your PXE holds.
2828

29-
:::warning Store your secret and salt
30-
Save the `secret` and `salt` values securely. You need both to recover access to your account. If you lose them, you will permanently lose access to the account and any assets it holds.
29+
:::warning Store your secret, salt, and signing key
30+
Save the `secret`, `salt`, and `signingKey` values securely. You need all three to recover access to your account. If you lose them, you will permanently lose access to the account and any assets it holds.
3131
:::
3232

3333
## Deploy the account

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

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,54 @@ Aztec is in active development. Each version may introduce breaking changes that
99

1010
## TBD
1111

12+
### [Aztec.js] Account signing keys are no longer derived from the privacy secret
13+
14+
Schnorr account signing keys used to be derived from the account's privacy secret (via the now-removed `deriveSigningKey`), which meant the ownership key could be reconstructed from a value the PXE holds. The relationship is now reversed: the signing key is the root, and the privacy secret is derived from it with `deriveSecretKeyFromSigningKey` (exported from `@aztec/accounts/utils`).
15+
16+
As a result:
17+
18+
- `deriveSigningKey` is removed.
19+
- `getSchnorrAccountContractAddress` and `getSchnorrInitializerlessAccountContractAddress` now take the signing key first and an optional secret: `(signingPrivateKey, salt, secretKey?)`. When `secretKey` is omitted it is derived from the signing key.
20+
- The embedded wallet's `createSchnorrAccount` and `createSchnorrInitializerlessAccount` now require an explicit signing key argument.
21+
22+
**Migration:**
23+
24+
```diff
25+
- import { deriveSigningKey } from '@aztec/stdlib/keys';
26+
- const signingKey = deriveSigningKey(secret);
27+
- const address = await getSchnorrAccountContractAddress(secret, salt, signingKey);
28+
+ import { GrumpkinScalar } from '@aztec/aztec.js/fields';
29+
+ const signingKey = GrumpkinScalar.random(); // supply your own signing key
30+
+ const address = await getSchnorrAccountContractAddress(signingKey, salt, secret);
31+
```
32+
33+
**Impact**: Account addresses change, since both the signing key and the privacy secret feed the address. Code that derived the signing key from the secret, or passed the secret first to the address helpers, no longer compiles.
34+
35+
### [Aztec.nr] `MessageContext` removed: message processing uses `ResolvedTx`
36+
37+
`aztec::messages::processing::MessageContext` has been removed in favor of the new `ResolvedTx`, which carries the same `tx_hash`, `unique_note_hashes_in_tx`, and `first_nullifier_in_tx`, plus `block_number` and `block_hash`. The offchain handoff type `OffchainMessageWithContext` is likewise renamed to `OffchainMessageWithTx`.
38+
39+
This affects contracts that implement a custom message handler (registered via `AztecConfig::custom_message_handler`): the handler's context parameter is now a `ResolvedTx`.
40+
41+
**Migration:**
42+
43+
```diff
44+
use aztec::messages::processing::{
45+
- enqueue_event_for_validation, MessageContext,
46+
+ enqueue_event_for_validation, ResolvedTx,
47+
};
48+
49+
unconstrained fn handle_my_message(
50+
// ...
51+
- message_context: MessageContext,
52+
+ resolved_tx: ResolvedTx,
53+
scope: AztecAddress,
54+
) {
55+
- // ...message_context.tx_hash...
56+
+ // ...resolved_tx.tx_hash...
57+
}
58+
```
59+
1260
### [PXE] `pxe.updateContract` removed and `pxe.registerContract` no longer takes an artifact
1361

1462
Registering classes and instances are now separate, unvalidated operations. `registerContractClass(artifact)` registers a class, `registerContract(instance)` registers an instance and no longer takes an artifact. `registerContract` does not check that PXE knows the contract's artifact: a missing artifact surfaces only when the contract is later simulated.
@@ -36,6 +84,7 @@ Registering classes and instances are now separate, unvalidated operations. `reg
3684

3785
- `pxe.getContractInstance(address)` and `wallet.getContractMetadata(address).instance` now return the contract's **address preimage**, which no longer includes `currentContractClassId`.
3886

87+
3988
### [Aztec.js] `AccountWithSecretKey` removed, read account keys from the `AccountManager` or PXE
4089

4190
`AccountWithSecretKey` was a thin wrapper that bundled an account's transaction signer with its master secret key, used mainly to print or export the secret. It has been removed, and `AccountManager.getAccount()` now returns the plain `Account` signer. The wrapper's extra methods are no longer available on that value:
@@ -60,6 +109,24 @@ The PXE never receives the seed nor the message-signing and fallback secret keys
60109

61110
**Impact**: Importing `AccountWithSecretKey`, or calling `getSecretKey()`/`getEncryptionSecret()` on the result of `getAccount()`, no longer compiles. The signer `getAccount()` returns is otherwise unchanged, and passing a single `Fr` or a `MasterSecretKeys` to `wallet.registerContract` keeps working.
62111

112+
### [CLI] `aztec-wallet` `--secret-key` is renamed to `--signing-key`
113+
114+
`aztec-wallet` accounts are now rooted on their signing key rather than on a privacy secret. The `--secret-key` option (on `create-account` and `simulate`) is renamed to `--signing-key`, and the `SECRET_KEY` environment variable to `SIGNING_KEY`. When creating an account, a random signing key is generated by default and the privacy secret is derived from it.
115+
116+
**Migration:**
117+
118+
```diff
119+
- aztec-wallet create-account --secret-key 0x...
120+
+ aztec-wallet create-account --signing-key 0x...
121+
```
122+
123+
**Impact**: The value you save and restore for an account is now its signing key, and account addresses change, so existing wallet databases and funded addresses are not carried over.
124+
125+
### [Bot] `senderPrivateKey` is now the account signing key
126+
127+
The transaction bot previously derived its account's signing key from the configured `senderPrivateKey`. That value is now used directly as the signing key, with the privacy secret derived from it.
128+
129+
**Impact**: The bot's account address changes for a given `senderPrivateKey`, so the account must be re-funded at its new address.
63130

64131
### [PXE] Unconstrained delivery defaults to a non-interactive handshake for external recipients
65132

docs/docs-developers/docs/tutorials/js_tutorials/wallet-extension/04-accounts.md

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,28 +24,27 @@ An Aztec account has:
2424

2525
## Key Derivation
2626

27-
The wallet uses the standard derivation from `@aztec/stdlib/keys`:
27+
The wallet generates a random signing key as the account's root and derives the privacy secret from it:
2828

2929
```typescript
30-
import { deriveSigningKey } from '@aztec/stdlib/keys';
30+
import { GrumpkinScalar } from '@aztec/aztec.js/fields';
31+
import { deriveSecretKeyFromSigningKey } from '@aztec/accounts/utils';
3132

32-
// Generate a random secret
33-
const secret = Fr.random();
34-
35-
// Derive the signing key
36-
const signingKey = deriveSigningKey(secret);
33+
// The signing key is the account's root; the privacy secret is derived from it
34+
const signingKey = GrumpkinScalar.random();
35+
const secret = await deriveSecretKeyFromSigningKey(signingKey);
3736
```
3837

39-
The derivation uses SHA-512 with domain separators to derive different keys:
38+
The nullifier, viewing, and tagging keys are then derived from that secret with SHA-512 and domain separators, while the signing key is supplied to the account contract directly:
4039

4140
```typescript
4241
// From stdlib/src/keys/derivation.ts
43-
export function deriveSigningKey(secretKey: Fr): GrumpkinScalar {
44-
return sha512ToGrumpkinScalar([secretKey, GeneratorIndex.IVSK_M]);
42+
export function deriveMasterIncomingViewingSecretKey(secretKey: Fr): GrumpkinScalar {
43+
return sha512ToGrumpkinScalar([secretKey, DomainSeparator.IVSK_M]);
4544
}
4645

4746
export function deriveMasterNullifierHidingSecretKey(secretKey: Fr): GrumpkinScalar {
48-
return sha512ToGrumpkinScalar([secretKey, GeneratorIndex.NHK_M]);
47+
return sha512ToGrumpkinScalar([secretKey, DomainSeparator.NHK_M]);
4948
}
5049
```
5150

docs/examples/ts/aztecjs_connection/index.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,12 @@ console.log(`Alice's fee juice balance: ${aliceBalance}`);
4545
// docs:end:check_fee_juice
4646

4747
// docs:start:create_account
48-
import { Fr } from "@aztec/aztec.js/fields";
48+
import { Fr, GrumpkinScalar } from "@aztec/aztec.js/fields";
4949

5050
const secret = Fr.random();
5151
const salt = Fr.random();
52-
const newAccount = await wallet.createSchnorrAccount(secret, salt);
52+
const signingKey = GrumpkinScalar.random();
53+
const newAccount = await wallet.createSchnorrAccount(secret, salt, signingKey);
5354
console.log("New account address:", newAccount.address.toString());
5455
// docs:end:create_account
5556

@@ -87,9 +88,11 @@ await deployMethod.send({
8788
// can coexist in one example; in your own code, pick whichever name fits.
8889
const feeJuiceSecret = Fr.random();
8990
const feeJuiceSalt = Fr.random();
91+
const feeJuiceSigningKey = GrumpkinScalar.random();
9092
const feeJuiceAccount = await wallet.createSchnorrAccount(
9193
feeJuiceSecret,
9294
feeJuiceSalt,
95+
feeJuiceSigningKey,
9396
);
9497
// docs:end:create_fee_juice_account
9598

docs/examples/ts/aztecjs_getting_started/index.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,16 @@ const nodeUrl = process.env.AZTEC_NODE_URL ?? "http://localhost:8080";
66
const wallet = await EmbeddedWallet.create(nodeUrl, { ephemeral: true });
77

88
const [alice, bob] = await getInitialTestAccountsData();
9-
await wallet.createSchnorrInitializerlessAccount(alice.secret, alice.salt);
10-
await wallet.createSchnorrInitializerlessAccount(bob.secret, bob.salt);
9+
await wallet.createSchnorrInitializerlessAccount(
10+
alice.secret,
11+
alice.salt,
12+
alice.signingKey,
13+
);
14+
await wallet.createSchnorrInitializerlessAccount(
15+
bob.secret,
16+
bob.salt,
17+
bob.signingKey,
18+
);
1119
// docs:end:setup
1220

1321
// docs:start:deploy

docs/examples/ts/bob_token_contract/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,15 +61,18 @@ async function main() {
6161
const giggleAccountManager = await wallet.createSchnorrInitializerlessAccount(
6262
giggleWalletData.secret,
6363
giggleWalletData.salt,
64+
giggleWalletData.signingKey,
6465
);
6566
const aliceAccountManager = await wallet.createSchnorrInitializerlessAccount(
6667
aliceWalletData.secret,
6768
aliceWalletData.salt,
69+
aliceWalletData.signingKey,
6870
);
6971
const bobClinicAccountManager =
7072
await wallet.createSchnorrInitializerlessAccount(
7173
bobClinicWalletData.secret,
7274
bobClinicWalletData.salt,
75+
bobClinicWalletData.signingKey,
7376
);
7477

7578
const giggleAddress = giggleAccountManager.address;

docs/examples/ts/recursive_verification/index.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { SponsoredFPCContract } from "@aztec/noir-contracts.js/SponsoredFPC";
66
import { ValueNotEqualContract } from "./artifacts/ValueNotEqual.js";
77
import { EmbeddedWallet } from "@aztec/wallets/embedded";
88
import { NO_FROM } from "@aztec/aztec.js/account";
9-
import { Fr } from "@aztec/aztec.js/fields";
9+
import { Fr, GrumpkinScalar } from "@aztec/aztec.js/fields";
1010
import assert from "node:assert";
1111
import fs from "node:fs";
1212

@@ -47,7 +47,11 @@ async function main() {
4747
// Step 1: Setup wallet and create account
4848
// Accounts in Aztec are smart contracts (account abstraction)
4949
const wallet = await setupWallet();
50-
const manager = await wallet.createSchnorrAccount(Fr.random(), Fr.random());
50+
const manager = await wallet.createSchnorrAccount(
51+
Fr.random(),
52+
Fr.random(),
53+
GrumpkinScalar.random(),
54+
);
5155

5256
// Deploy the account contract
5357
const deployMethod = await manager.getDeployMethod();

docs/examples/ts/token_bridge/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ const [accData] = await getInitialTestAccountsData();
3131
const account = await aztecWallet.createSchnorrInitializerlessAccount(
3232
accData.secret,
3333
accData.salt,
34+
accData.signingKey,
3435
);
3536
console.log(`Account: ${account.address.toString()}\n`);
3637

0 commit comments

Comments
 (0)