Skip to content

Commit 5e1270e

Browse files
authored
chore(port): forward-port remaining v5-next fairies backlog to next (#24949)
1 parent 2b932d6 commit 5e1270e

87 files changed

Lines changed: 1941 additions & 789 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.

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: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,6 @@ Registering classes and instances are now separate, unvalidated operations. `reg
186186
The new class is used automatically once the upgrade takes effect on chain; no further PXE action is needed. Registering it beforehand is harmless: until the update activates, the node still resolves the contract's current class to the previous one, so it keeps running its old code.
187187

188188
- `pxe.getContractInstance(address)` and `wallet.getContractMetadata(address).instance` now return the contract's **address preimage**, which no longer includes `currentContractClassId`.
189-
190-
191189
### [Aztec.js] `AccountWithSecretKey` removed, read account keys from the `AccountManager` or PXE
192190

193191
`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:

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

docs/examples/webapp-tutorial/scripts/deploy-and-interact.ts

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

1010
const [alice, bob] = await getInitialTestAccountsData();
11-
await wallet.createSchnorrAccount(alice.secret, alice.salt);
12-
await wallet.createSchnorrAccount(bob.secret, bob.salt);
13-
console.log("Accounts ready:", alice.address.toString(), bob.address.toString());
11+
await wallet.createSchnorrAccount(alice.secret, alice.salt, alice.signingKey);
12+
await wallet.createSchnorrAccount(bob.secret, bob.salt, bob.signingKey);
13+
console.log(
14+
"Accounts ready:",
15+
alice.address.toString(),
16+
bob.address.toString(),
17+
);
1418
// docs:end:script-setup
1519

1620
// docs:start:script-deploy
17-
const { contract } = await PodRacingContract.deploy(wallet, alice.address).send({
18-
from: alice.address,
19-
});
21+
const { contract } = await PodRacingContract.deploy(wallet, alice.address).send(
22+
{
23+
from: alice.address,
24+
},
25+
);
2026
console.log("Contract deployed at:", contract.address.toString());
2127
// docs:end:script-deploy
2228

0 commit comments

Comments
 (0)