@aztec/aztec 1.2.0 → 2.0.0-nightly.20250813

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/dest/cli/chain_l2_config.d.ts +6 -2
  2. package/dest/cli/chain_l2_config.d.ts.map +1 -1
  3. package/dest/cli/chain_l2_config.js +25 -13
  4. package/dest/cli/cmds/start_node.d.ts.map +1 -1
  5. package/dest/cli/cmds/start_node.js +9 -2
  6. package/dest/cli/cmds/start_p2p_bootstrap.d.ts.map +1 -1
  7. package/dest/cli/cmds/start_p2p_bootstrap.js +3 -2
  8. package/dest/cli/cmds/start_prover_agent.d.ts.map +1 -1
  9. package/dest/cli/cmds/start_prover_agent.js +0 -5
  10. package/dest/cli/cmds/start_prover_node.d.ts.map +1 -1
  11. package/dest/cli/cmds/start_prover_node.js +0 -5
  12. package/dest/examples/token.js +21 -10
  13. package/dest/sandbox/banana_fpc.js +5 -3
  14. package/dest/sandbox/sandbox.d.ts.map +1 -1
  15. package/dest/sandbox/sandbox.js +10 -2
  16. package/dest/sandbox/sponsored_fpc.d.ts.map +1 -1
  17. package/dest/sandbox/sponsored_fpc.js +2 -2
  18. package/dest/testing/anvil_test_watcher.d.ts +34 -0
  19. package/dest/testing/anvil_test_watcher.d.ts.map +1 -0
  20. package/dest/testing/anvil_test_watcher.js +143 -0
  21. package/dest/testing/aztec_cheat_codes.d.ts +59 -0
  22. package/dest/testing/aztec_cheat_codes.d.ts.map +1 -0
  23. package/dest/testing/aztec_cheat_codes.js +62 -0
  24. package/dest/testing/cheat_codes.d.ts +44 -0
  25. package/dest/testing/cheat_codes.d.ts.map +1 -0
  26. package/dest/testing/cheat_codes.js +63 -0
  27. package/dest/testing/index.d.ts +5 -0
  28. package/dest/testing/index.d.ts.map +1 -0
  29. package/dest/testing/index.js +4 -0
  30. package/package.json +33 -31
  31. package/src/cli/chain_l2_config.ts +39 -15
  32. package/src/cli/cmds/start_node.ts +8 -2
  33. package/src/cli/cmds/start_p2p_bootstrap.ts +9 -2
  34. package/src/cli/cmds/start_prover_agent.ts +0 -6
  35. package/src/cli/cmds/start_prover_node.ts +1 -7
  36. package/src/examples/token.ts +11 -10
  37. package/src/sandbox/banana_fpc.ts +5 -5
  38. package/src/sandbox/sandbox.ts +8 -2
  39. package/src/sandbox/sponsored_fpc.ts +7 -2
  40. package/src/testing/anvil_test_watcher.ts +167 -0
  41. package/src/testing/aztec_cheat_codes.ts +77 -0
  42. package/src/testing/cheat_codes.ts +79 -0
  43. package/src/testing/index.ts +4 -0
@@ -0,0 +1,62 @@
1
+ import { Fr } from '@aztec/foundation/fields';
2
+ import { createLogger } from '@aztec/foundation/log';
3
+ import { deriveStorageSlotInMap } from '@aztec/stdlib/hash';
4
+ /**
5
+ * A class that provides utility functions for interacting with the aztec chain.
6
+ */ export class AztecCheatCodes {
7
+ pxe;
8
+ logger;
9
+ constructor(/**
10
+ * The PXE Service to use for interacting with the chain
11
+ */ pxe, /**
12
+ * The logger to use for the aztec cheatcodes
13
+ */ logger = createLogger('aztecjs:cheat_codes')){
14
+ this.pxe = pxe;
15
+ this.logger = logger;
16
+ }
17
+ /**
18
+ * Computes the slot value for a given map and key.
19
+ * @param mapSlot - The slot of the map (specified in Aztec.nr contract)
20
+ * @param key - The key to lookup in the map
21
+ * @returns The storage slot of the value in the map
22
+ */ computeSlotInMap(mapSlot, key) {
23
+ const keyFr = typeof key === 'bigint' ? new Fr(key) : key.toField();
24
+ return deriveStorageSlotInMap(mapSlot, keyFr);
25
+ }
26
+ /**
27
+ * Get the current blocknumber
28
+ * @returns The current block number
29
+ */ async blockNumber() {
30
+ return await this.pxe.getBlockNumber();
31
+ }
32
+ /**
33
+ * Get the current timestamp
34
+ * @returns The current timestamp
35
+ */ async timestamp() {
36
+ const res = await this.pxe.getBlock(await this.blockNumber());
37
+ return Number(res?.header.globalVariables.timestamp ?? 0);
38
+ }
39
+ /**
40
+ * Loads the value stored at the given slot in the public storage of the given contract.
41
+ * @param who - The address of the contract
42
+ * @param slot - The storage slot to lookup
43
+ * @returns The value stored at the given slot
44
+ */ async loadPublic(who, slot) {
45
+ const storageValue = await this.pxe.getPublicStorageAt(who, new Fr(slot));
46
+ return storageValue;
47
+ }
48
+ /**
49
+ * Loads the value stored at the given slot in the private storage of the given contract.
50
+ * @param contract - The address of the contract
51
+ * @param recipient - The address whose public key was used to encrypt the note
52
+ * @param slot - The storage slot to lookup
53
+ * @returns The notes stored at the given slot
54
+ */ async loadPrivate(recipient, contract, slot) {
55
+ const extendedNotes = await this.pxe.getNotes({
56
+ recipient,
57
+ contractAddress: contract,
58
+ storageSlot: new Fr(slot)
59
+ });
60
+ return extendedNotes.map((extendedNote)=>extendedNote.note);
61
+ }
62
+ }
@@ -0,0 +1,44 @@
1
+ import { EthCheatCodes, RollupCheatCodes } from '@aztec/ethereum/test';
2
+ import type { SequencerClient } from '@aztec/sequencer-client';
3
+ import type { AztecNode, PXE } from '@aztec/stdlib/interfaces/client';
4
+ import { AztecCheatCodes } from './aztec_cheat_codes.js';
5
+ /**
6
+ * A class that provides utility functions for interacting with the chain.
7
+ */
8
+ export declare class CheatCodes {
9
+ /** Cheat codes for L1.*/
10
+ eth: EthCheatCodes;
11
+ /** Cheat codes for Aztec L2. */
12
+ aztec: AztecCheatCodes;
13
+ /** Cheat codes for the Aztec Rollup contract on L1. */
14
+ rollup: RollupCheatCodes;
15
+ constructor(
16
+ /** Cheat codes for L1.*/
17
+ eth: EthCheatCodes,
18
+ /** Cheat codes for Aztec L2. */
19
+ aztec: AztecCheatCodes,
20
+ /** Cheat codes for the Aztec Rollup contract on L1. */
21
+ rollup: RollupCheatCodes);
22
+ static create(rpcUrls: string[], pxe: PXE): Promise<CheatCodes>;
23
+ /**
24
+ * Warps the L1 timestamp to a target timestamp and mines an L2 block that advances the L2 timestamp to at least
25
+ * the target timestamp. L2 timestamp is not advanced exactly to the target timestamp because it is determined
26
+ * by the slot number, which advances in fixed intervals.
27
+ * This is useful for testing time-dependent contract behavior.
28
+ * @param sequencerClient - The sequencer client to use to force an empty block to be mined.
29
+ * @param node - The Aztec node used to query if a new block has been mined.
30
+ * @param targetTimestamp - The target timestamp to warp to (in seconds)
31
+ */
32
+ warpL2TimeAtLeastTo(sequencerClient: SequencerClient, node: AztecNode, targetTimestamp: bigint | number): Promise<void>;
33
+ /**
34
+ * Warps the L1 timestamp forward by a specified duration and mines an L2 block that advances the L2 timestamp at
35
+ * least by the duration. L2 timestamp is not advanced exactly by the duration because it is determined by the slot
36
+ * number, which advances in fixed intervals.
37
+ * This is useful for testing time-dependent contract behavior.
38
+ * @param sequencerClient - The sequencer client to use to force an empty block to be mined.
39
+ * @param node - The Aztec node used to query if a new block has been mined.
40
+ * @param duration - The duration to advance time by (in seconds)
41
+ */
42
+ warpL2TimeAtLeastBy(sequencerClient: SequencerClient, node: AztecNode, duration: bigint | number): Promise<void>;
43
+ }
44
+ //# sourceMappingURL=cheat_codes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cheat_codes.d.ts","sourceRoot":"","sources":["../../src/testing/cheat_codes.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACvE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,iCAAiC,CAAC;AAEtE,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD;;GAEG;AACH,qBAAa,UAAU;IAEnB,yBAAyB;IAClB,GAAG,EAAE,aAAa;IACzB,gCAAgC;IACzB,KAAK,EAAE,eAAe;IAC7B,uDAAuD;IAChD,MAAM,EAAE,gBAAgB;;IAL/B,yBAAyB;IAClB,GAAG,EAAE,aAAa;IACzB,gCAAgC;IACzB,KAAK,EAAE,eAAe;IAC7B,uDAAuD;IAChD,MAAM,EAAE,gBAAgB;WAGpB,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,UAAU,CAAC;IAUrE;;;;;;;;OAQG;IACG,mBAAmB,CAAC,eAAe,EAAE,eAAe,EAAE,IAAI,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,GAAG,MAAM;IAyB7G;;;;;;;;OAQG;IACG,mBAAmB,CAAC,eAAe,EAAE,eAAe,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM;CAKvG"}
@@ -0,0 +1,63 @@
1
+ import { retryUntil } from '@aztec/aztec.js';
2
+ import { EthCheatCodes, RollupCheatCodes } from '@aztec/ethereum/test';
3
+ import { AztecCheatCodes } from './aztec_cheat_codes.js';
4
+ /**
5
+ * A class that provides utility functions for interacting with the chain.
6
+ */ export class CheatCodes {
7
+ eth;
8
+ aztec;
9
+ rollup;
10
+ constructor(/** Cheat codes for L1.*/ eth, /** Cheat codes for Aztec L2. */ aztec, /** Cheat codes for the Aztec Rollup contract on L1. */ rollup){
11
+ this.eth = eth;
12
+ this.aztec = aztec;
13
+ this.rollup = rollup;
14
+ }
15
+ static async create(rpcUrls, pxe) {
16
+ const ethCheatCodes = new EthCheatCodes(rpcUrls);
17
+ const aztecCheatCodes = new AztecCheatCodes(pxe);
18
+ const rollupCheatCodes = new RollupCheatCodes(ethCheatCodes, await pxe.getNodeInfo().then((n)=>n.l1ContractAddresses));
19
+ return new CheatCodes(ethCheatCodes, aztecCheatCodes, rollupCheatCodes);
20
+ }
21
+ /**
22
+ * Warps the L1 timestamp to a target timestamp and mines an L2 block that advances the L2 timestamp to at least
23
+ * the target timestamp. L2 timestamp is not advanced exactly to the target timestamp because it is determined
24
+ * by the slot number, which advances in fixed intervals.
25
+ * This is useful for testing time-dependent contract behavior.
26
+ * @param sequencerClient - The sequencer client to use to force an empty block to be mined.
27
+ * @param node - The Aztec node used to query if a new block has been mined.
28
+ * @param targetTimestamp - The target timestamp to warp to (in seconds)
29
+ */ async warpL2TimeAtLeastTo(sequencerClient, node, targetTimestamp) {
30
+ const currentL2BlockNumber = await node.getBlockNumber();
31
+ // We warp the L1 timestamp
32
+ await this.eth.warp(targetTimestamp, {
33
+ resetBlockInterval: true
34
+ });
35
+ // Wait until an L2 block is mined
36
+ const sequencer = sequencerClient.getSequencer();
37
+ const minTxsPerBlock = sequencer.getConfig().minTxsPerBlock;
38
+ sequencer.updateConfig({
39
+ minTxsPerBlock: 0
40
+ });
41
+ await retryUntil(async ()=>{
42
+ const newL2BlockNumber = await node.getBlockNumber();
43
+ return newL2BlockNumber > currentL2BlockNumber;
44
+ }, 'new block after warping L2 time', 36, 1);
45
+ // Restore original minTxsPerBlock
46
+ sequencer.updateConfig({
47
+ minTxsPerBlock
48
+ });
49
+ }
50
+ /**
51
+ * Warps the L1 timestamp forward by a specified duration and mines an L2 block that advances the L2 timestamp at
52
+ * least by the duration. L2 timestamp is not advanced exactly by the duration because it is determined by the slot
53
+ * number, which advances in fixed intervals.
54
+ * This is useful for testing time-dependent contract behavior.
55
+ * @param sequencerClient - The sequencer client to use to force an empty block to be mined.
56
+ * @param node - The Aztec node used to query if a new block has been mined.
57
+ * @param duration - The duration to advance time by (in seconds)
58
+ */ async warpL2TimeAtLeastBy(sequencerClient, node, duration) {
59
+ const currentTimestamp = await this.eth.timestamp();
60
+ const targetTimestamp = BigInt(currentTimestamp) + BigInt(duration);
61
+ await this.warpL2TimeAtLeastTo(sequencerClient, node, targetTimestamp);
62
+ }
63
+ }
@@ -0,0 +1,5 @@
1
+ export { AnvilTestWatcher } from './anvil_test_watcher.js';
2
+ export { EthCheatCodes, RollupCheatCodes } from '@aztec/ethereum/test';
3
+ export { AztecCheatCodes } from './aztec_cheat_codes.js';
4
+ export { CheatCodes } from './cheat_codes.js';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/testing/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACvE,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC"}
@@ -0,0 +1,4 @@
1
+ export { AnvilTestWatcher } from './anvil_test_watcher.js';
2
+ export { EthCheatCodes, RollupCheatCodes } from '@aztec/ethereum/test';
3
+ export { AztecCheatCodes } from './aztec_cheat_codes.js';
4
+ export { CheatCodes } from './cheat_codes.js';
package/package.json CHANGED
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "name": "@aztec/aztec",
3
- "version": "1.2.0",
3
+ "version": "2.0.0-nightly.20250813",
4
4
  "type": "module",
5
5
  "exports": {
6
- ".": "./dest/index.js"
6
+ ".": "./dest/index.js",
7
+ "./testing": "./dest/testing/index.js"
7
8
  },
8
9
  "bin": "./dest/bin/index.js",
9
10
  "typedocOptions": {
@@ -27,35 +28,36 @@
27
28
  "../package.common.json"
28
29
  ],
29
30
  "dependencies": {
30
- "@aztec/accounts": "1.2.0",
31
- "@aztec/archiver": "1.2.0",
32
- "@aztec/aztec-faucet": "1.2.0",
33
- "@aztec/aztec-node": "1.2.0",
34
- "@aztec/aztec.js": "1.2.0",
35
- "@aztec/bb-prover": "1.2.0",
36
- "@aztec/bb.js": "1.2.0",
37
- "@aztec/blob-sink": "1.2.0",
38
- "@aztec/bot": "1.2.0",
39
- "@aztec/builder": "1.2.0",
40
- "@aztec/cli": "1.2.0",
41
- "@aztec/cli-wallet": "1.2.0",
42
- "@aztec/constants": "1.2.0",
43
- "@aztec/entrypoints": "1.2.0",
44
- "@aztec/ethereum": "1.2.0",
45
- "@aztec/foundation": "1.2.0",
46
- "@aztec/kv-store": "1.2.0",
47
- "@aztec/noir-contracts.js": "1.2.0",
48
- "@aztec/noir-protocol-circuits-types": "1.2.0",
49
- "@aztec/p2p": "1.2.0",
50
- "@aztec/p2p-bootstrap": "1.2.0",
51
- "@aztec/protocol-contracts": "1.2.0",
52
- "@aztec/prover-client": "1.2.0",
53
- "@aztec/prover-node": "1.2.0",
54
- "@aztec/pxe": "1.2.0",
55
- "@aztec/stdlib": "1.2.0",
56
- "@aztec/telemetry-client": "1.2.0",
57
- "@aztec/txe": "1.2.0",
58
- "@aztec/world-state": "1.2.0",
31
+ "@aztec/accounts": "2.0.0-nightly.20250813",
32
+ "@aztec/archiver": "2.0.0-nightly.20250813",
33
+ "@aztec/aztec-faucet": "2.0.0-nightly.20250813",
34
+ "@aztec/aztec-node": "2.0.0-nightly.20250813",
35
+ "@aztec/aztec.js": "2.0.0-nightly.20250813",
36
+ "@aztec/bb-prover": "2.0.0-nightly.20250813",
37
+ "@aztec/bb.js": "2.0.0-nightly.20250813",
38
+ "@aztec/blob-sink": "2.0.0-nightly.20250813",
39
+ "@aztec/bot": "2.0.0-nightly.20250813",
40
+ "@aztec/builder": "2.0.0-nightly.20250813",
41
+ "@aztec/cli": "2.0.0-nightly.20250813",
42
+ "@aztec/cli-wallet": "2.0.0-nightly.20250813",
43
+ "@aztec/constants": "2.0.0-nightly.20250813",
44
+ "@aztec/entrypoints": "2.0.0-nightly.20250813",
45
+ "@aztec/ethereum": "2.0.0-nightly.20250813",
46
+ "@aztec/foundation": "2.0.0-nightly.20250813",
47
+ "@aztec/kv-store": "2.0.0-nightly.20250813",
48
+ "@aztec/l1-artifacts": "2.0.0-nightly.20250813",
49
+ "@aztec/noir-contracts.js": "2.0.0-nightly.20250813",
50
+ "@aztec/noir-protocol-circuits-types": "2.0.0-nightly.20250813",
51
+ "@aztec/p2p": "2.0.0-nightly.20250813",
52
+ "@aztec/p2p-bootstrap": "2.0.0-nightly.20250813",
53
+ "@aztec/protocol-contracts": "2.0.0-nightly.20250813",
54
+ "@aztec/prover-client": "2.0.0-nightly.20250813",
55
+ "@aztec/prover-node": "2.0.0-nightly.20250813",
56
+ "@aztec/pxe": "2.0.0-nightly.20250813",
57
+ "@aztec/stdlib": "2.0.0-nightly.20250813",
58
+ "@aztec/telemetry-client": "2.0.0-nightly.20250813",
59
+ "@aztec/txe": "2.0.0-nightly.20250813",
60
+ "@aztec/world-state": "2.0.0-nightly.20250813",
59
61
  "@types/chalk": "^2.2.0",
60
62
  "abitype": "^0.8.11",
61
63
  "chalk": "^5.3.0",
@@ -8,6 +8,7 @@ import path, { dirname, join } from 'path';
8
8
 
9
9
  import publicIncludeMetrics from '../../public_include_metric_prefixes.json' with { type: 'json' };
10
10
 
11
+ // REFACTOR: We should be `pick`ing keys from existing config types
11
12
  export type L2ChainConfig = {
12
13
  l1ChainId: number;
13
14
  testAccounts: boolean;
@@ -41,9 +42,9 @@ export type L2ChainConfig = {
41
42
  /** The number of epochs after an epoch ends that proofs are still accepted. */
42
43
  aztecProofSubmissionEpochs: number;
43
44
  /** The deposit amount for a validator */
44
- depositAmount: bigint;
45
+ activationThreshold: bigint;
45
46
  /** The minimum stake for a validator. */
46
- minimumStake: bigint;
47
+ ejectionThreshold: bigint;
47
48
  /** The slashing quorum */
48
49
  slashingQuorum: number;
49
50
  /** The slashing round size */
@@ -70,6 +71,10 @@ export type L2ChainConfig = {
70
71
  slashInvalidBlockEnabled: boolean;
71
72
  slashInvalidBlockPenalty: bigint;
72
73
  slashInvalidBlockMaxPenalty: bigint;
74
+ slashProposeInvalidAttestationsPenalty: bigint;
75
+ slashProposeInvalidAttestationsMaxPenalty: bigint;
76
+ slashAttestDescendantOfInvalidPenalty: bigint;
77
+ slashAttestDescendantOfInvalidMaxPenalty: bigint;
73
78
  // control whether sentinel is enabled or not. Needed for slashing
74
79
  sentinelEnabled: boolean;
75
80
  };
@@ -103,9 +108,9 @@ export const testnetIgnitionL2ChainConfig: L2ChainConfig = {
103
108
  /** The number of epochs after an epoch ends that proofs are still accepted. */
104
109
  aztecProofSubmissionEpochs: 1,
105
110
  /** The deposit amount for a validator */
106
- depositAmount: DefaultL1ContractsConfig.depositAmount,
111
+ activationThreshold: DefaultL1ContractsConfig.activationThreshold,
107
112
  /** The minimum stake for a validator. */
108
- minimumStake: DefaultL1ContractsConfig.minimumStake,
113
+ ejectionThreshold: DefaultL1ContractsConfig.ejectionThreshold,
109
114
  /** The slashing quorum */
110
115
  slashingQuorum: DefaultL1ContractsConfig.slashingQuorum,
111
116
  /** The slashing round size */
@@ -132,6 +137,10 @@ export const testnetIgnitionL2ChainConfig: L2ChainConfig = {
132
137
  slashPruneMaxPenalty: 0n,
133
138
  slashInvalidBlockPenalty: 0n,
134
139
  slashInvalidBlockMaxPenalty: 0n,
140
+ slashProposeInvalidAttestationsPenalty: 0n,
141
+ slashProposeInvalidAttestationsMaxPenalty: 0n,
142
+ slashAttestDescendantOfInvalidPenalty: 0n,
143
+ slashAttestDescendantOfInvalidMaxPenalty: 0n,
135
144
  sentinelEnabled: false,
136
145
  };
137
146
 
@@ -167,9 +176,9 @@ export const alphaTestnetL2ChainConfig: L2ChainConfig = {
167
176
  /** The number of epochs after an epoch ends that proofs are still accepted. */
168
177
  aztecProofSubmissionEpochs: 1,
169
178
  /** The deposit amount for a validator */
170
- depositAmount: DefaultL1ContractsConfig.depositAmount,
179
+ activationThreshold: DefaultL1ContractsConfig.activationThreshold,
171
180
  /** The minimum stake for a validator. */
172
- minimumStake: DefaultL1ContractsConfig.minimumStake,
181
+ ejectionThreshold: DefaultL1ContractsConfig.ejectionThreshold,
173
182
  /** The slashing quorum */
174
183
  slashingQuorum: 101,
175
184
  /** The slashing round size */
@@ -186,16 +195,20 @@ export const alphaTestnetL2ChainConfig: L2ChainConfig = {
186
195
  // slashing stuff
187
196
  slashPayloadTtlSeconds: 36 * 32 * 24, // 24 epochs
188
197
  slashPruneEnabled: true,
189
- slashPrunePenalty: 17n * (DefaultL1ContractsConfig.depositAmount / 100n),
190
- slashPruneMaxPenalty: 17n * (DefaultL1ContractsConfig.depositAmount / 100n),
198
+ slashPrunePenalty: 17n * (DefaultL1ContractsConfig.activationThreshold / 100n),
199
+ slashPruneMaxPenalty: 17n * (DefaultL1ContractsConfig.activationThreshold / 100n),
191
200
  slashInactivityEnabled: true,
192
201
  slashInactivityCreateTargetPercentage: 1,
193
- slashInactivitySignalTargetPercentage: 1,
194
- slashInactivityCreatePenalty: 17n * (DefaultL1ContractsConfig.depositAmount / 100n),
195
- slashInactivityMaxPenalty: 17n * (DefaultL1ContractsConfig.depositAmount / 100n),
202
+ slashInactivitySignalTargetPercentage: 0.67,
203
+ slashInactivityCreatePenalty: 17n * (DefaultL1ContractsConfig.activationThreshold / 100n),
204
+ slashInactivityMaxPenalty: 17n * (DefaultL1ContractsConfig.activationThreshold / 100n),
196
205
  slashInvalidBlockEnabled: true,
197
- slashInvalidBlockPenalty: DefaultL1ContractsConfig.depositAmount,
198
- slashInvalidBlockMaxPenalty: DefaultL1ContractsConfig.depositAmount,
206
+ slashInvalidBlockPenalty: DefaultL1ContractsConfig.activationThreshold,
207
+ slashInvalidBlockMaxPenalty: DefaultL1ContractsConfig.activationThreshold,
208
+ slashProposeInvalidAttestationsPenalty: DefaultL1ContractsConfig.activationThreshold,
209
+ slashProposeInvalidAttestationsMaxPenalty: DefaultL1ContractsConfig.activationThreshold,
210
+ slashAttestDescendantOfInvalidPenalty: DefaultL1ContractsConfig.activationThreshold,
211
+ slashAttestDescendantOfInvalidMaxPenalty: DefaultL1ContractsConfig.activationThreshold,
199
212
  sentinelEnabled: true,
200
213
  };
201
214
 
@@ -336,8 +349,8 @@ export async function enrichEnvironmentWithChainConfig(networkName: NetworkNames
336
349
  enrichVar('AZTEC_EPOCH_DURATION', config.aztecEpochDuration.toString());
337
350
  enrichVar('AZTEC_TARGET_COMMITTEE_SIZE', config.aztecTargetCommitteeSize.toString());
338
351
  enrichVar('AZTEC_PROOF_SUBMISSION_EPOCHS', config.aztecProofSubmissionEpochs.toString());
339
- enrichVar('AZTEC_DEPOSIT_AMOUNT', config.depositAmount.toString());
340
- enrichVar('AZTEC_MINIMUM_STAKE', config.minimumStake.toString());
352
+ enrichVar('AZTEC_ACTIVATION_THRESHOLD', config.activationThreshold.toString());
353
+ enrichVar('AZTEC_EJECTION_THRESHOLD', config.ejectionThreshold.toString());
341
354
  enrichVar('AZTEC_SLASHING_QUORUM', config.slashingQuorum.toString());
342
355
  enrichVar('AZTEC_SLASHING_ROUND_SIZE', config.slashingRoundSize.toString());
343
356
  enrichVar('AZTEC_GOVERNANCE_PROPOSER_QUORUM', config.governanceProposerQuorum.toString());
@@ -358,5 +371,16 @@ export async function enrichEnvironmentWithChainConfig(networkName: NetworkNames
358
371
  enrichVar('SLASH_INVALID_BLOCK_ENABLED', config.slashInvalidBlockEnabled.toString());
359
372
  enrichVar('SLASH_INVALID_BLOCK_PENALTY', config.slashInvalidBlockPenalty.toString());
360
373
  enrichVar('SLASH_INVALID_BLOCK_MAX_PENALTY', config.slashInvalidBlockMaxPenalty.toString());
374
+ enrichVar('SLASH_PROPOSE_INVALID_ATTESTATIONS_PENALTY', config.slashProposeInvalidAttestationsPenalty.toString());
375
+ enrichVar(
376
+ 'SLASH_PROPOSE_INVALID_ATTESTATIONS_MAX_PENALTY',
377
+ config.slashProposeInvalidAttestationsMaxPenalty.toString(),
378
+ );
379
+ enrichVar('SLASH_ATTEST_DESCENDANT_OF_INVALID_PENALTY', config.slashAttestDescendantOfInvalidPenalty.toString());
380
+ enrichVar(
381
+ 'SLASH_ATTEST_DESCENDANT_OF_INVALID_MAX_PENALTY',
382
+ config.slashAttestDescendantOfInvalidMaxPenalty.toString(),
383
+ );
384
+
361
385
  enrichVar('SENTINEL_ENABLED', config.sentinelEnabled.toString());
362
386
  }
@@ -6,6 +6,7 @@ import { NULL_KEY, getAddressFromPrivateKey, getPublicClient } from '@aztec/ethe
6
6
  import { SecretValue } from '@aztec/foundation/config';
7
7
  import type { NamespacedApiHandlers } from '@aztec/foundation/json-rpc/server';
8
8
  import type { LogFn } from '@aztec/foundation/log';
9
+ import { bufferToHex } from '@aztec/foundation/string';
9
10
  import { AztecNodeAdminApiSchema, AztecNodeApiSchema, type PXE } from '@aztec/stdlib/interfaces/client';
10
11
  import { P2PApiSchema } from '@aztec/stdlib/interfaces/server';
11
12
  import {
@@ -117,7 +118,6 @@ export async function startNode(
117
118
  };
118
119
  }
119
120
 
120
- // if no publisher private key, then use l1Mnemonic
121
121
  if (!options.archiver) {
122
122
  // expect archiver url in node config
123
123
  const archiverUrl = nodeConfig.archiverUrl;
@@ -137,7 +137,7 @@ export async function startNode(
137
137
  };
138
138
  let account;
139
139
  if (sequencerConfig.publisherPrivateKey.getValue() === NULL_KEY) {
140
- if (sequencerConfig.validatorPrivateKeys.getValue().length) {
140
+ if (sequencerConfig.validatorPrivateKeys?.getValue().length) {
141
141
  sequencerConfig.publisherPrivateKey = new SecretValue(sequencerConfig.validatorPrivateKeys.getValue()[0]);
142
142
  } else if (!options.l1Mnemonic) {
143
143
  userLog(
@@ -154,6 +154,12 @@ export async function startNode(
154
154
  nodeConfig.coinbase ??= EthAddress.fromString(getAddressFromPrivateKey(nodeConfig.publisherPrivateKey.getValue()));
155
155
  }
156
156
 
157
+ // If we dont have a slasher private key, derive one from the mnemonic if provided, using account index 1 (zero was used for the sequencer)
158
+ if (options.l1Mnemonic && (!nodeConfig.slasherPrivateKey || nodeConfig.slasherPrivateKey.getValue() === NULL_KEY)) {
159
+ const account = mnemonicToAccount(options.l1Mnemonic, { accountIndex: 1 });
160
+ nodeConfig.slasherPrivateKey = new SecretValue(bufferToHex(Buffer.from(account.getHdKey().privateKey!)));
161
+ }
162
+
157
163
  if (nodeConfig.p2pEnabled) {
158
164
  // ensure bootstrapNodes is an array
159
165
  if (nodeConfig.bootstrapNodes && typeof nodeConfig.bootstrapNodes === 'string') {
@@ -5,7 +5,11 @@ import { createStore } from '@aztec/kv-store/lmdb-v2';
5
5
  import { type BootnodeConfig, BootstrapNode, bootnodeConfigMappings } from '@aztec/p2p';
6
6
  import { emptyChainConfig } from '@aztec/stdlib/config';
7
7
  import { P2PBootstrapApiSchema } from '@aztec/stdlib/interfaces/server';
8
- import { getConfigEnvVars as getTelemetryClientConfig, initTelemetryClient } from '@aztec/telemetry-client';
8
+ import {
9
+ type TelemetryClientConfig,
10
+ initTelemetryClient,
11
+ telemetryClientConfigMappings,
12
+ } from '@aztec/telemetry-client';
9
13
 
10
14
  import { extractRelevantOptions } from '../util.js';
11
15
 
@@ -19,7 +23,10 @@ export async function startP2PBootstrap(
19
23
  const config = extractRelevantOptions<BootnodeConfig>(options, bootnodeConfigMappings, 'p2p');
20
24
  const safeConfig = { ...config, peerIdPrivateKey: '<redacted>' };
21
25
  userLog(`Starting P2P bootstrap node with config: ${jsonStringify(safeConfig)}`);
22
- const telemetryClient = initTelemetryClient(getTelemetryClientConfig());
26
+
27
+ const telemetryConfig = extractRelevantOptions<TelemetryClientConfig>(options, telemetryClientConfigMappings, 'tel');
28
+ const telemetryClient = initTelemetryClient(telemetryConfig);
29
+
23
30
  const store = await createStore('p2p-bootstrap', 1, config, createLogger('p2p:bootstrap:store'));
24
31
  const node = new BootstrapNode(store, telemetryClient);
25
32
  await node.start(config);
@@ -28,12 +28,6 @@ export async function startProverAgent(
28
28
  process.exit(1);
29
29
  }
30
30
 
31
- // Check if running on ARM and fast-fail if so.
32
- if (process.arch.startsWith('arm')) {
33
- userLog(`Prover agent is not supported on ARM architecture (detected: ${process.arch}). Exiting.`);
34
- process.exit(1);
35
- }
36
-
37
31
  const config = {
38
32
  ...getProverNodeAgentConfigFromEnv(), // get default config from env
39
33
  ...extractRelevantOptions<ProverAgentConfig>(options, proverAgentConfigMappings, 'proverAgent'), // override with command line options
@@ -35,12 +35,6 @@ export async function startProverNode(
35
35
  process.exit(1);
36
36
  }
37
37
 
38
- // Check if running on ARM and fast-fail if so.
39
- if (process.arch.startsWith('arm')) {
40
- userLog(`Prover node is not supported on ARM architecture (detected: ${process.arch}). Exiting.`);
41
- process.exit(1);
42
- }
43
-
44
38
  let proverConfig = {
45
39
  ...getProverNodeConfigFromEnv(), // get default config from env
46
40
  ...extractRelevantOptions<ProverNodeConfig>(options, proverNodeConfigMappings, 'proverNode'), // override with command line options
@@ -118,7 +112,7 @@ export async function startProverNode(
118
112
  services.proverNode = [proverNode, ProverNodeApiSchema];
119
113
 
120
114
  if (proverNode.getP2P()) {
121
- services.p2p = [proverNode.getP2P()!, P2PApiSchema];
115
+ services.p2p = [proverNode.getP2P(), P2PApiSchema];
122
116
  }
123
117
 
124
118
  if (!proverConfig.proverBrokerUrl) {
@@ -19,13 +19,15 @@ async function main() {
19
19
  logger.info('Running token contract test on HTTP interface.');
20
20
 
21
21
  const [aliceWallet, bobWallet] = await getDeployedTestAccountsWallets(pxe);
22
- const alice = aliceWallet.getCompleteAddress();
23
- const bob = bobWallet.getCompleteAddress();
22
+ const alice = aliceWallet.getAddress();
23
+ const bob = bobWallet.getAddress();
24
24
 
25
- logger.info(`Fetched Alice and Bob accounts: ${alice.address.toString()}, ${bob.address.toString()}`);
25
+ logger.info(`Fetched Alice and Bob accounts: ${alice.toString()}, ${bob.toString()}`);
26
26
 
27
27
  logger.info('Deploying Token...');
28
- const token = await TokenContract.deploy(aliceWallet, alice, 'TokenName', 'TokenSymbol', 18).send().deployed();
28
+ const token = await TokenContract.deploy(aliceWallet, alice, 'TokenName', 'TokenSymbol', 18)
29
+ .send({ from: alice })
30
+ .deployed();
29
31
  logger.info('Token deployed');
30
32
 
31
33
  // Create the contract abstraction and link it to Alice's and Bob's wallet for future signing
@@ -34,23 +36,22 @@ async function main() {
34
36
 
35
37
  // Mint tokens to Alice
36
38
  logger.info(`Minting ${ALICE_MINT_BALANCE} more coins to Alice...`);
37
- const from = aliceWallet.getAddress(); // we are setting from to Alice here because we need a sender to calculate the tag
38
- await tokenAlice.methods.mint_to_private(from, aliceWallet.getAddress(), ALICE_MINT_BALANCE).send().wait();
39
+ await tokenAlice.methods.mint_to_private(alice, ALICE_MINT_BALANCE).send({ from: alice }).wait();
39
40
 
40
41
  logger.info(`${ALICE_MINT_BALANCE} tokens were successfully minted by Alice and transferred to private`);
41
42
 
42
- const balanceAfterMint = await tokenAlice.methods.balance_of_private(alice).simulate();
43
+ const balanceAfterMint = await tokenAlice.methods.balance_of_private(alice).simulate({ from: alice });
43
44
  logger.info(`Tokens successfully minted. New Alice's balance: ${balanceAfterMint}`);
44
45
 
45
46
  // We will now transfer tokens from Alice to Bob
46
47
  logger.info(`Transferring ${TRANSFER_AMOUNT} tokens from Alice to Bob...`);
47
- await tokenAlice.methods.transfer(bob, TRANSFER_AMOUNT).send().wait();
48
+ await tokenAlice.methods.transfer(bob, TRANSFER_AMOUNT).send({ from: alice }).wait();
48
49
 
49
50
  // Check the new balances
50
- const aliceBalance = await tokenAlice.methods.balance_of_private(alice).simulate();
51
+ const aliceBalance = await tokenAlice.methods.balance_of_private(alice).simulate({ from: alice });
51
52
  logger.info(`Alice's balance ${aliceBalance}`);
52
53
 
53
- const bobBalance = await tokenBob.methods.balance_of_private(bob).simulate();
54
+ const bobBalance = await tokenBob.methods.balance_of_private(bob).simulate({ from: bob });
54
55
  logger.info(`Bob's balance ${bobBalance}`);
55
56
  }
56
57
 
@@ -5,7 +5,7 @@ import type { LogFn } from '@aztec/foundation/log';
5
5
  import { FPCContract } from '@aztec/noir-contracts.js/FPC';
6
6
  import { TokenContract } from '@aztec/noir-contracts.js/Token';
7
7
  import { AztecAddress } from '@aztec/stdlib/aztec-address';
8
- import { type ContractInstanceWithAddress, getContractInstanceFromDeployParams } from '@aztec/stdlib/contract';
8
+ import { type ContractInstanceWithAddress, getContractInstanceFromInstantiationParams } from '@aztec/stdlib/contract';
9
9
  import type { PXE } from '@aztec/stdlib/interfaces/client';
10
10
 
11
11
  const BANANA_COIN_SALT = new Fr(0);
@@ -23,7 +23,7 @@ function getBananaAdmin(initialAccounts: InitialAccountData[]): AztecAddress {
23
23
 
24
24
  async function getBananaCoinInstance(initialAccounts: InitialAccountData[]): Promise<ContractInstanceWithAddress> {
25
25
  const admin = getBananaAdmin(initialAccounts);
26
- return await getContractInstanceFromDeployParams(TokenContract.artifact, {
26
+ return await getContractInstanceFromInstantiationParams(TokenContract.artifact, {
27
27
  constructorArgs: [admin, bananaCoinArgs.name, bananaCoinArgs.symbol, bananaCoinArgs.decimal],
28
28
  salt: BANANA_COIN_SALT,
29
29
  });
@@ -36,7 +36,7 @@ export async function getBananaCoinAddress(initialAccounts: InitialAccountData[]
36
36
  async function getBananaFPCInstance(initialAccounts: InitialAccountData[]): Promise<ContractInstanceWithAddress> {
37
37
  const bananaCoin = await getBananaCoinAddress(initialAccounts);
38
38
  const admin = getBananaAdmin(initialAccounts);
39
- return await getContractInstanceFromDeployParams(FPCContract.artifact, {
39
+ return await getContractInstanceFromInstantiationParams(FPCContract.artifact, {
40
40
  constructorArgs: [bananaCoin, admin],
41
41
  salt: BANANA_FPC_SALT,
42
42
  });
@@ -51,10 +51,10 @@ export async function setupBananaFPC(initialAccounts: InitialAccountData[], depl
51
51
  const admin = getBananaAdmin(initialAccounts);
52
52
  const [bananaCoin, fpc] = await Promise.all([
53
53
  TokenContract.deploy(deployer, admin, bananaCoinArgs.name, bananaCoinArgs.symbol, bananaCoinArgs.decimal)
54
- .send({ contractAddressSalt: BANANA_COIN_SALT, universalDeploy: true })
54
+ .send({ from: admin, contractAddressSalt: BANANA_COIN_SALT, universalDeploy: true })
55
55
  .deployed(),
56
56
  FPCContract.deploy(deployer, bananaCoinAddress, admin)
57
- .send({ contractAddressSalt: BANANA_FPC_SALT, universalDeploy: true })
57
+ .send({ from: admin, contractAddressSalt: BANANA_FPC_SALT, universalDeploy: true })
58
58
  .deployed(),
59
59
  ]);
60
60
 
@@ -2,7 +2,6 @@
2
2
  import { getSchnorrWallet } from '@aztec/accounts/schnorr';
3
3
  import { deployFundedSchnorrAccounts, getInitialTestAccounts } from '@aztec/accounts/testing';
4
4
  import { type AztecNodeConfig, AztecNodeService, getConfigEnvVars } from '@aztec/aztec-node';
5
- import { AnvilTestWatcher, EthCheatCodes } from '@aztec/aztec.js/testing';
6
5
  import { type BlobSinkClientInterface, createBlobSinkClient } from '@aztec/blob-sink/client';
7
6
  import { setupSponsoredFPC } from '@aztec/cli/cli-utils';
8
7
  import { GENESIS_ARCHIVE_ROOT } from '@aztec/constants';
@@ -14,6 +13,7 @@ import {
14
13
  getL1ContractsConfigEnvVars,
15
14
  waitForPublicClient,
16
15
  } from '@aztec/ethereum';
16
+ import { EthCheatCodes } from '@aztec/ethereum/test';
17
17
  import { SecretValue } from '@aztec/foundation/config';
18
18
  import { Fr } from '@aztec/foundation/fields';
19
19
  import { type LogFn, createLogger } from '@aztec/foundation/log';
@@ -36,6 +36,7 @@ import { foundry } from 'viem/chains';
36
36
 
37
37
  import { createAccountLogs } from '../cli/util.js';
38
38
  import { DefaultMnemonic } from '../mnemonic.js';
39
+ import { AnvilTestWatcher } from '../testing/anvil_test_watcher.js';
39
40
  import { getBananaFPCAddress, setupBananaFPC } from './banana_fpc.js';
40
41
  import { getSponsoredFPCAddress } from './sponsored_fpc.js';
41
42
 
@@ -124,10 +125,15 @@ export async function createSandbox(config: Partial<SandboxConfig> = {}, userLog
124
125
  const privKey = hdAccount.getHdKey().privateKey;
125
126
  aztecNodeConfig.publisherPrivateKey = new SecretValue(`0x${Buffer.from(privKey!).toString('hex')}` as const);
126
127
  }
127
- if (!aztecNodeConfig.validatorPrivateKeys.getValue().length) {
128
+ if (!aztecNodeConfig.validatorPrivateKeys?.getValue().length) {
128
129
  const privKey = hdAccount.getHdKey().privateKey;
129
130
  aztecNodeConfig.validatorPrivateKeys = new SecretValue([`0x${Buffer.from(privKey!).toString('hex')}`]);
130
131
  }
132
+ if (!aztecNodeConfig.slasherPrivateKey?.getValue() || aztecNodeConfig.slasherPrivateKey?.getValue() === NULL_KEY) {
133
+ const account = mnemonicToAccount(config.l1Mnemonic || DefaultMnemonic, { accountIndex: 1 });
134
+ const privKey = account.getHdKey().privateKey;
135
+ aztecNodeConfig.slasherPrivateKey = new SecretValue(`0x${Buffer.from(privKey!).toString('hex')}` as const);
136
+ }
131
137
 
132
138
  const initialAccounts = await (async () => {
133
139
  if (config.testAccounts === true || config.testAccounts === undefined) {
@@ -1,9 +1,14 @@
1
- import { type ContractInstanceWithAddress, Fr, type PXE, getContractInstanceFromDeployParams } from '@aztec/aztec.js';
1
+ import {
2
+ type ContractInstanceWithAddress,
3
+ Fr,
4
+ type PXE,
5
+ getContractInstanceFromInstantiationParams,
6
+ } from '@aztec/aztec.js';
2
7
  import { SPONSORED_FPC_SALT } from '@aztec/constants';
3
8
  import { SponsoredFPCContract } from '@aztec/noir-contracts.js/SponsoredFPC';
4
9
 
5
10
  async function getSponsoredFPCInstance(): Promise<ContractInstanceWithAddress> {
6
- return await getContractInstanceFromDeployParams(SponsoredFPCContract.artifact, {
11
+ return await getContractInstanceFromInstantiationParams(SponsoredFPCContract.artifact, {
7
12
  salt: new Fr(SPONSORED_FPC_SALT),
8
13
  });
9
14
  }