@aztec/aztec 0.0.1-commit.b6e433891 → 0.0.1-commit.b8a057fa

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 (121) hide show
  1. package/dest/bin/index.js +3 -1
  2. package/dest/cli/aztec_start_action.d.ts +1 -1
  3. package/dest/cli/aztec_start_action.d.ts.map +1 -1
  4. package/dest/cli/aztec_start_action.js +16 -24
  5. package/dest/cli/aztec_start_options.d.ts +2 -2
  6. package/dest/cli/aztec_start_options.d.ts.map +1 -1
  7. package/dest/cli/aztec_start_options.js +15 -15
  8. package/dest/cli/cmds/compile.d.ts +1 -1
  9. package/dest/cli/cmds/compile.d.ts.map +1 -1
  10. package/dest/cli/cmds/compile.js +32 -24
  11. package/dest/cli/cmds/profile.d.ts +1 -1
  12. package/dest/cli/cmds/profile.d.ts.map +1 -1
  13. package/dest/cli/cmds/profile.js +1 -1
  14. package/dest/cli/cmds/profile_gates.d.ts +2 -2
  15. package/dest/cli/cmds/profile_gates.d.ts.map +1 -1
  16. package/dest/cli/cmds/profile_gates.js +21 -3
  17. package/dest/cli/cmds/prover.d.ts +4 -0
  18. package/dest/cli/cmds/prover.d.ts.map +1 -0
  19. package/dest/cli/cmds/prover.js +24 -0
  20. package/dest/cli/cmds/standby.d.ts +30 -6
  21. package/dest/cli/cmds/standby.d.ts.map +1 -1
  22. package/dest/cli/cmds/standby.js +48 -5
  23. package/dest/cli/cmds/start_bot.d.ts +1 -1
  24. package/dest/cli/cmds/start_bot.d.ts.map +1 -1
  25. package/dest/cli/cmds/start_bot.js +8 -4
  26. package/dest/cli/cmds/start_node.d.ts +1 -1
  27. package/dest/cli/cmds/start_node.d.ts.map +1 -1
  28. package/dest/cli/cmds/start_node.js +22 -47
  29. package/dest/cli/cmds/start_prover_agent.d.ts +1 -1
  30. package/dest/cli/cmds/start_prover_agent.d.ts.map +1 -1
  31. package/dest/cli/cmds/start_prover_agent.js +5 -17
  32. package/dest/cli/cmds/start_prover_broker.d.ts +1 -1
  33. package/dest/cli/cmds/start_prover_broker.d.ts.map +1 -1
  34. package/dest/cli/cmds/start_prover_broker.js +11 -8
  35. package/dest/cli/cmds/start_txe.d.ts +2 -2
  36. package/dest/cli/cmds/start_txe.d.ts.map +1 -1
  37. package/dest/cli/cmds/start_txe.js +6 -5
  38. package/dest/cli/cmds/utils/artifacts.d.ts +6 -1
  39. package/dest/cli/cmds/utils/artifacts.d.ts.map +1 -1
  40. package/dest/cli/cmds/utils/collect_crate_dirs.d.ts +21 -0
  41. package/dest/cli/cmds/utils/collect_crate_dirs.d.ts.map +1 -0
  42. package/dest/cli/cmds/utils/collect_crate_dirs.js +114 -0
  43. package/dest/cli/cmds/utils/needs_recompile.d.ts +1 -1
  44. package/dest/cli/cmds/utils/needs_recompile.d.ts.map +1 -1
  45. package/dest/cli/cmds/utils/needs_recompile.js +9 -53
  46. package/dest/cli/cmds/utils/warn_if_aztec_version_mismatch.d.ts +4 -0
  47. package/dest/cli/cmds/utils/warn_if_aztec_version_mismatch.d.ts.map +1 -0
  48. package/dest/cli/cmds/utils/warn_if_aztec_version_mismatch.js +61 -0
  49. package/dest/cli/util.d.ts +10 -5
  50. package/dest/cli/util.d.ts.map +1 -1
  51. package/dest/cli/util.js +26 -53
  52. package/dest/examples/token.js +3 -3
  53. package/dest/local-network/auth_registry.d.ts +5 -0
  54. package/dest/local-network/auth_registry.d.ts.map +1 -0
  55. package/dest/local-network/auth_registry.js +17 -0
  56. package/dest/local-network/banana_fpc.d.ts +3 -2
  57. package/dest/local-network/banana_fpc.d.ts.map +1 -1
  58. package/dest/local-network/banana_fpc.js +11 -7
  59. package/dest/local-network/local-network.d.ts +8 -32
  60. package/dest/local-network/local-network.d.ts.map +1 -1
  61. package/dest/local-network/local-network.js +52 -73
  62. package/dest/testing/cheat_codes.d.ts +17 -23
  63. package/dest/testing/cheat_codes.d.ts.map +1 -1
  64. package/dest/testing/cheat_codes.js +17 -43
  65. package/dest/testing/epoch_test_settler.d.ts +2 -2
  66. package/dest/testing/epoch_test_settler.d.ts.map +1 -1
  67. package/dest/testing/epoch_test_settler.js +6 -25
  68. package/dest/testing/index.d.ts +1 -2
  69. package/dest/testing/index.d.ts.map +1 -1
  70. package/dest/testing/index.js +0 -1
  71. package/dest/testing/token_allowed_setup.d.ts +9 -4
  72. package/dest/testing/token_allowed_setup.d.ts.map +1 -1
  73. package/dest/testing/token_allowed_setup.js +12 -8
  74. package/package.json +34 -33
  75. package/scripts/add_crate.sh +11 -60
  76. package/scripts/aztec.sh +6 -2
  77. package/scripts/init.sh +5 -5
  78. package/scripts/new.sh +2 -2
  79. package/scripts/setup_workspace.sh +3 -2
  80. package/scripts/templates/blank/contract/Nargo.toml +6 -0
  81. package/scripts/templates/blank/contract/src/main.nr +10 -0
  82. package/scripts/templates/blank/test/Nargo.toml +7 -0
  83. package/scripts/templates/blank/test/src/lib.nr +11 -0
  84. package/scripts/templates/counter/contract/Nargo.toml +7 -0
  85. package/scripts/templates/counter/contract/src/main.nr +48 -0
  86. package/scripts/templates/counter/test/Nargo.toml +7 -0
  87. package/scripts/templates/counter/test/src/lib.nr +32 -0
  88. package/src/bin/index.ts +3 -1
  89. package/src/cli/aztec_start_action.ts +14 -17
  90. package/src/cli/aztec_start_options.ts +22 -23
  91. package/src/cli/cmds/compile.ts +37 -23
  92. package/src/cli/cmds/profile.ts +2 -1
  93. package/src/cli/cmds/profile_gates.ts +20 -4
  94. package/src/cli/cmds/prover.ts +42 -0
  95. package/src/cli/cmds/standby.ts +59 -7
  96. package/src/cli/cmds/start_bot.ts +9 -6
  97. package/src/cli/cmds/start_node.ts +29 -39
  98. package/src/cli/cmds/start_prover_agent.ts +5 -8
  99. package/src/cli/cmds/start_prover_broker.ts +10 -11
  100. package/src/cli/cmds/start_txe.ts +7 -5
  101. package/src/cli/cmds/utils/artifacts.ts +5 -0
  102. package/src/cli/cmds/utils/collect_crate_dirs.ts +118 -0
  103. package/src/cli/cmds/utils/needs_recompile.ts +8 -61
  104. package/src/cli/cmds/utils/warn_if_aztec_version_mismatch.ts +76 -0
  105. package/src/cli/util.ts +27 -68
  106. package/src/examples/token.ts +3 -3
  107. package/src/local-network/auth_registry.ts +19 -0
  108. package/src/local-network/banana_fpc.ts +12 -8
  109. package/src/local-network/local-network.ts +56 -83
  110. package/src/testing/cheat_codes.ts +18 -49
  111. package/src/testing/epoch_test_settler.ts +8 -31
  112. package/src/testing/index.ts +0 -1
  113. package/src/testing/token_allowed_setup.ts +15 -8
  114. package/dest/cli/cmds/start_archiver.d.ts +0 -9
  115. package/dest/cli/cmds/start_archiver.d.ts.map +0 -1
  116. package/dest/cli/cmds/start_archiver.js +0 -48
  117. package/dest/testing/anvil_test_watcher.d.ts +0 -42
  118. package/dest/testing/anvil_test_watcher.d.ts.map +0 -1
  119. package/dest/testing/anvil_test_watcher.js +0 -181
  120. package/src/cli/cmds/start_archiver.ts +0 -50
  121. package/src/testing/anvil_test_watcher.ts +0 -210
@@ -1,40 +1,42 @@
1
1
  #!/usr/bin/env -S node --no-warnings
2
2
  import { getInitialTestAccountsData } from '@aztec/accounts/testing';
3
- import { AztecNodeService } from '@aztec/aztec-node';
3
+ import { createAztecNodeService } from '@aztec/aztec-node';
4
4
  import { getConfigEnvVars } from '@aztec/aztec-node/config';
5
5
  import { Fr } from '@aztec/aztec.js/fields';
6
6
  import { createLogger } from '@aztec/aztec.js/log';
7
7
  import { createBlobClient } from '@aztec/blob-client/client';
8
8
  import { GENESIS_ARCHIVE_ROOT } from '@aztec/constants';
9
- import { createEthereumChain } from '@aztec/ethereum/chain';
10
9
  import { waitForPublicClient } from '@aztec/ethereum/client';
11
10
  import { getL1ContractsConfigEnvVars } from '@aztec/ethereum/config';
12
11
  import { NULL_KEY } from '@aztec/ethereum/constants';
13
12
  import { deployAztecL1Contracts } from '@aztec/ethereum/deploy-aztec-l1-contracts';
14
- import { EthCheatCodes } from '@aztec/ethereum/test';
15
13
  import { SecretValue } from '@aztec/foundation/config';
16
14
  import { EthAddress } from '@aztec/foundation/eth-address';
17
15
  import { TestDateProvider } from '@aztec/foundation/timer';
18
16
  import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
19
17
  import { protocolContractsHash } from '@aztec/protocol-contracts';
20
- import { SequencerState } from '@aztec/sequencer-client';
21
18
  import { AztecAddress } from '@aztec/stdlib/aztec-address';
19
+ import { TxStatus } from '@aztec/stdlib/tx';
22
20
  import { getConfigEnvVars as getTelemetryClientConfig, initTelemetryClient } from '@aztec/telemetry-client';
23
21
  import { EmbeddedWallet } from '@aztec/wallets/embedded';
24
- import { deployFundedSchnorrAccounts } from '@aztec/wallets/testing';
22
+ import { createFundedInitializerlessAccounts } from '@aztec/wallets/testing';
25
23
  import { getGenesisValues } from '@aztec/world-state/testing';
26
- import { createPublicClient, fallback, http as httpViemTransport } from 'viem';
27
24
  import { mnemonicToAccount, privateKeyToAddress } from 'viem/accounts';
28
25
  import { foundry } from 'viem/chains';
29
26
  import { createAccountLogs } from '../cli/util.js';
30
27
  import { DefaultMnemonic } from '../mnemonic.js';
31
- import { AnvilTestWatcher } from '../testing/anvil_test_watcher.js';
32
- import { EpochTestSettler } from '../testing/epoch_test_settler.js';
33
28
  import { getTokenAllowedSetupFunctions } from '../testing/token_allowed_setup.js';
29
+ import { publishStandardAuthRegistry } from './auth_registry.js';
34
30
  import { getBananaFPCAddress, setupBananaFPC } from './banana_fpc.js';
35
31
  import { getSponsoredFPCAddress } from './sponsored_fpc.js';
36
32
  const logger = createLogger('local-network');
37
- const localAnvil = foundry;
33
+ // The embedded wallet defaults to waiting for PROPOSED, which returns as soon as a tx lands in a
34
+ // proposed L2 block. That is flaky for the serial sandbox setup below: a proposed block can be
35
+ // pruned before its checkpoint is published, dropping a tx we already moved on from ("Tx dropped by
36
+ // P2P node"). Wait for the checkpoint so each setup tx is durably included before the next is sent.
37
+ const setupWaitOpts = {
38
+ waitForStatus: TxStatus.CHECKPOINTED
39
+ };
38
40
  /**
39
41
  * Function to deploy our L1 contracts to the local network L1
40
42
  * @param aztecNodeConfig - The Aztec Node Config
@@ -49,12 +51,12 @@ const localAnvil = foundry;
49
51
  genesisArchiveRoot: opts.genesisArchiveRoot ?? new Fr(GENESIS_ARCHIVE_ROOT),
50
52
  feeJuicePortalInitialBalance: opts.feeJuicePortalInitialBalance,
51
53
  aztecTargetCommitteeSize: 0,
52
- slasherFlavor: 'none',
54
+ slasherEnabled: false,
53
55
  realVerifier: false
54
56
  });
55
- aztecNodeConfig.l1Contracts = l1Contracts.l1ContractAddresses;
57
+ Object.assign(aztecNodeConfig, l1Contracts.l1ContractAddresses);
56
58
  aztecNodeConfig.rollupVersion = l1Contracts.rollupVersion;
57
- return aztecNodeConfig.l1Contracts;
59
+ return l1Contracts.l1ContractAddresses;
58
60
  }
59
61
  /**
60
62
  * Create and start a new Aztec Node and PXE. Deploys L1 contracts.
@@ -72,13 +74,36 @@ const localAnvil = foundry;
72
74
  // The local network deploys a banana FPC with Token contracts, so include Token entries
73
75
  // in the setup allowlist so FPC-based fee payments work out of the box.
74
76
  const tokenAllowList = await getTokenAllowedSetupFunctions();
77
+ const envConfig = getConfigEnvVars();
75
78
  const aztecNodeConfig = {
76
- ...getConfigEnvVars(),
79
+ ...envConfig,
77
80
  ...config,
81
+ skipOrphanProposedBlockPruning: true,
82
+ // The local network builds node config from env without a DATA_DIRECTORY, so the validator's
83
+ // local signing protection runs against an ephemeral store. That is acceptable for this dev
84
+ // network; production validators must persist it and fail-fast when the data directory is unset.
85
+ allowEphemeralSigningProtection: config.allowEphemeralSigningProtection ?? true,
78
86
  txPublicSetupAllowListExtend: [
79
87
  ...tokenAllowList,
80
88
  ...config.txPublicSetupAllowListExtend ?? []
81
- ]
89
+ ],
90
+ // The local network runs against anvil with no committee, so it defaults to the deterministic
91
+ // AutomineSequencer, which owns L1 time control (warps the dateProvider and L1 timestamps to slot
92
+ // boundaries as it builds), replacing the deleted AnvilTestWatcher. This remains true when p2p is
93
+ // enabled for local peer testing; local-network is not a mode for connecting to an existing network.
94
+ useAutomineSequencer: config.useAutomineSequencer ?? true,
95
+ // The AutomineSequencer owns epoch proving in the local network — it writes epoch out hashes to
96
+ // the L1 Outbox and advances the proven tip as checkpoints land, through the same serial queue as
97
+ // its builds — replacing the standalone EpochTestSettler that used to race the build loop.
98
+ automineEnableProveEpoch: config.automineEnableProveEpoch ?? true,
99
+ // Defaults for the local network / sandbox; callers (e.g. the CLI) may override. No real proving
100
+ // happens here — the AutomineSequencer synthetically settles epochs. Short epochs let it write out
101
+ // hashes quickly (so users can consume L2-to-L1 messages without a long wait), with a wider
102
+ // proof-submission window so the synthetic settler has headroom before the rollup would prune an
103
+ // unproven checkpoint.
104
+ realProofs: config.realProofs ?? false,
105
+ aztecEpochDuration: config.aztecEpochDuration ?? 4,
106
+ aztecProofSubmissionEpochs: config.aztecProofSubmissionEpochs ?? 2
82
107
  };
83
108
  const hdAccount = mnemonicToAccount(config.l1Mnemonic || DefaultMnemonic);
84
109
  if (aztecNodeConfig.sequencerPublisherPrivateKeys == undefined || !aztecNodeConfig.sequencerPublisherPrivateKeys.length || aztecNodeConfig.sequencerPublisherPrivateKeys[0].getValue() === NULL_KEY) {
@@ -97,7 +122,7 @@ const localAnvil = foundry;
97
122
  const initialAccounts = await (async ()=>{
98
123
  if (config.testAccounts === true || config.testAccounts === undefined) {
99
124
  if (aztecNodeConfig.p2pEnabled) {
100
- userLog(`Not setting up test accounts as we are connecting to a network`);
125
+ userLog(`Not setting up test accounts when p2p is enabled`);
101
126
  } else {
102
127
  userLog(`Setting up test accounts`);
103
128
  return await getInitialTestAccountsData();
@@ -107,7 +132,7 @@ const localAnvil = foundry;
107
132
  })();
108
133
  const bananaFPC = await getBananaFPCAddress(initialAccounts);
109
134
  const sponsoredFPC = await getSponsoredFPCAddress();
110
- const prefundAddresses = (aztecNodeConfig.prefundAddresses ?? []).map((a)=>AztecAddress.fromString(a));
135
+ const prefundAddresses = (aztecNodeConfig.prefundAddresses ?? []).map((a)=>AztecAddress.fromStringUnsafe(a));
111
136
  const fundedAddresses = [
112
137
  ...initialAccounts.map((a)=>a.address),
113
138
  ...initialAccounts.length ? [
@@ -116,34 +141,13 @@ const localAnvil = foundry;
116
141
  ] : [],
117
142
  ...prefundAddresses
118
143
  ];
119
- const { genesisArchiveRoot, prefilledPublicData, fundingNeeded } = await getGenesisValues(fundedAddresses);
144
+ const { genesisArchiveRoot, genesis, fundingNeeded } = await getGenesisValues(fundedAddresses);
120
145
  const dateProvider = new TestDateProvider();
121
- let cheatcodes;
122
- let rollupAddress;
123
- let watcher;
124
146
  if (!aztecNodeConfig.p2pEnabled) {
125
- ({ rollupAddress } = await deployContractsToL1(aztecNodeConfig, aztecNodeConfig.validatorPrivateKeys.getValue()[0], {
147
+ await deployContractsToL1(aztecNodeConfig, aztecNodeConfig.validatorPrivateKeys.getValue()[0], {
126
148
  genesisArchiveRoot,
127
149
  feeJuicePortalInitialBalance: fundingNeeded
128
- }));
129
- const chain = aztecNodeConfig.l1RpcUrls.length > 0 ? createEthereumChain([
130
- l1RpcUrl
131
- ], aztecNodeConfig.l1ChainId) : {
132
- chainInfo: localAnvil
133
- };
134
- const publicClient = createPublicClient({
135
- chain: chain.chainInfo,
136
- transport: fallback([
137
- httpViemTransport(l1RpcUrl)
138
- ])
139
150
  });
140
- cheatcodes = new EthCheatCodes([
141
- l1RpcUrl
142
- ], dateProvider);
143
- watcher = new AnvilTestWatcher(cheatcodes, rollupAddress, publicClient, dateProvider);
144
- watcher.setisLocalNetwork(true);
145
- watcher.setIsMarkingAsProven(false); // Do not mark as proven in the watcher. It's marked in the epochTestSettler after the out hash is set.
146
- await watcher.start();
147
151
  }
148
152
  const telemetry = await initTelemetryClient(getTelemetryClientConfig());
149
153
  // Create a local blob client client inside the local network, no http connectivity
@@ -153,29 +157,8 @@ const localAnvil = foundry;
153
157
  blobClient,
154
158
  dateProvider
155
159
  }, {
156
- prefilledPublicData
160
+ genesis
157
161
  });
158
- // Now that the node is up, let the watcher check for pending txs so it can skip unfilled slots faster when
159
- // transactions are waiting in the mempool. Also let it check if the sequencer is actively building, to avoid
160
- // warping time out from under an in-progress block.
161
- watcher?.setGetPendingTxCount(()=>node.getPendingTxCount());
162
- const sequencer = node.getSequencer()?.getSequencer();
163
- if (sequencer) {
164
- const idleStates = new Set([
165
- SequencerState.STOPPED,
166
- SequencerState.STOPPING,
167
- SequencerState.IDLE,
168
- SequencerState.SYNCHRONIZING
169
- ]);
170
- watcher?.setIsSequencerBuilding(()=>!idleStates.has(sequencer.getState()));
171
- }
172
- let epochTestSettler;
173
- if (!aztecNodeConfig.p2pEnabled) {
174
- epochTestSettler = new EpochTestSettler(cheatcodes, rollupAddress, node.getBlockSource(), logger.createChild('epoch-settler'), {
175
- pollingIntervalMs: 200
176
- });
177
- await epochTestSettler.start();
178
- }
179
162
  if (initialAccounts.length) {
180
163
  const wallet = await EmbeddedWallet.create(node, {
181
164
  pxeConfig: {
@@ -184,18 +167,18 @@ const localAnvil = foundry;
184
167
  ephemeral: true
185
168
  });
186
169
  userLog('Setting up funded test accounts...');
187
- const accountManagers = await deployFundedSchnorrAccounts(wallet, initialAccounts);
170
+ const accountManagers = await createFundedInitializerlessAccounts(wallet, initialAccounts);
188
171
  const accLogs = await createAccountLogs(accountManagers, wallet);
189
172
  userLog(accLogs.join(''));
190
- await setupBananaFPC(initialAccounts, wallet, userLog);
173
+ userLog('Publishing standard AuthRegistry contract...');
174
+ await publishStandardAuthRegistry(wallet, initialAccounts[0].address, setupWaitOpts);
175
+ await setupBananaFPC(initialAccounts, wallet, userLog, setupWaitOpts);
191
176
  userLog(`SponsoredFPC: ${await getSponsoredFPCAddress()}`);
192
177
  // We no longer need the wallet once we've setup the accounts so we stop the underlying PXE job queue
193
178
  await wallet.stop();
194
179
  }
195
180
  const stop = async ()=>{
196
181
  await node.stop();
197
- await watcher?.stop();
198
- await epochTestSettler?.stop();
199
182
  };
200
183
  return {
201
184
  node,
@@ -207,16 +190,12 @@ const localAnvil = foundry;
207
190
  * @param config - Optional Aztec node settings.
208
191
  */ export async function createAztecNode(config = {}, deps = {}, options = {}) {
209
192
  // TODO(#12272): will clean this up. This is criminal.
210
- const { l1Contracts, ...rest } = getConfigEnvVars();
193
+ // Not sure why this was ever done. Will be fixed in A-989, A-991, A-990.
211
194
  const aztecNodeConfig = {
212
- ...rest,
213
- ...config,
214
- l1Contracts: {
215
- ...l1Contracts,
216
- ...config.l1Contracts
217
- }
195
+ ...getConfigEnvVars(),
196
+ ...config
218
197
  };
219
- const node = await AztecNodeService.createAndSync(aztecNodeConfig, {
198
+ const node = await createAztecNodeService(aztecNodeConfig, {
220
199
  ...deps,
221
200
  proverNodeDeps: {
222
201
  broker: deps.proverBroker
@@ -1,12 +1,9 @@
1
1
  import { EthCheatCodes, RollupCheatCodes } from '@aztec/ethereum/test';
2
2
  import type { DateProvider } from '@aztec/foundation/timer';
3
- import type { SequencerClient } from '@aztec/sequencer-client';
4
- import type { AztecNode } from '@aztec/stdlib/interfaces/client';
3
+ import type { AztecNode, AztecNodeDebug } from '@aztec/stdlib/interfaces/client';
5
4
  /**
6
- * A class that provides utility functions for interacting with the chain.
7
- * @deprecated There used to be 3 kinds of cheat codes: eth, rollup and aztec. We have nuked the Aztec ones because
8
- * they became unused (we now have better testing tools). If you are introducing a new functionality to the cheat
9
- * codes, please consider whether it makes sense to just introduce new utils in your tests instead.
5
+ * Wrapper for Aztec Debug API.
6
+ * @deprecated use the AztecNode debug API directly.
10
7
  */
11
8
  export declare class CheatCodes {
12
9
  /** Cheat codes for L1.*/
@@ -20,24 +17,21 @@ export declare class CheatCodes {
20
17
  rollup: RollupCheatCodes);
21
18
  static create(rpcUrls: string[], node: AztecNode, dateProvider: DateProvider): Promise<CheatCodes>;
22
19
  /**
23
- * Warps the L1 timestamp to a target timestamp and mines an L2 block that advances the L2 timestamp to at least
24
- * the target timestamp. L2 timestamp is not advanced exactly to the target timestamp because it is determined
25
- * by the slot number, which advances in fixed intervals.
26
- * This is useful for testing time-dependent contract behavior.
27
- * @param sequencerClient - The sequencer client to use to force an empty block to be mined.
28
- * @param node - The Aztec node used to query if a new block has been mined.
29
- * @param targetTimestamp - The target timestamp to warp to (in seconds)
20
+ * Warps the L1 timestamp to at least `targetTimestamp` and mines an L2 block advancing the L2 timestamp to at least
21
+ * the target. Forwards to the node's debug API, which serializes the warp through the automine sequencer queue.
22
+ * @param node - The Aztec node whose debug API performs the warp. Must run an automine sequencer.
23
+ * @param targetTimestamp - The target timestamp to warp to (in seconds).
24
+ * @deprecated Call `node.warpL2TimeAtLeastTo(targetTimestamp)` on the node debug API directly.
30
25
  */
31
- warpL2TimeAtLeastTo(sequencerClient: SequencerClient, node: AztecNode, targetTimestamp: bigint | number): Promise<void>;
26
+ warpL2TimeAtLeastTo(node: AztecNode & AztecNodeDebug, targetTimestamp: bigint | number): Promise<void>;
32
27
  /**
33
- * Warps the L1 timestamp forward by a specified duration and mines an L2 block that advances the L2 timestamp at
34
- * least by the duration. L2 timestamp is not advanced exactly by the duration because it is determined by the slot
35
- * number, which advances in fixed intervals.
36
- * This is useful for testing time-dependent contract behavior.
37
- * @param sequencerClient - The sequencer client to use to force an empty block to be mined.
38
- * @param node - The Aztec node used to query if a new block has been mined.
39
- * @param duration - The duration to advance time by (in seconds)
28
+ * Warps the L1 timestamp forward by at least `duration` seconds and mines an L2 block advancing the L2 timestamp at
29
+ * least by the duration. Forwards to the node's debug API, which serializes the warp through the automine sequencer
30
+ * queue.
31
+ * @param node - The Aztec node whose debug API performs the warp. Must run an automine sequencer.
32
+ * @param duration - The duration to advance time by (in seconds).
33
+ * @deprecated Call `node.warpL2TimeAtLeastBy(duration)` on the node debug API directly.
40
34
  */
41
- warpL2TimeAtLeastBy(sequencerClient: SequencerClient, node: AztecNode, duration: bigint | number): Promise<void>;
35
+ warpL2TimeAtLeastBy(node: AztecNode & AztecNodeDebug, duration: bigint | number): Promise<void>;
42
36
  }
43
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2h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QUFtQixDQUFDLElBQUksRUFBRSxTQUFTLEdBQUcsY0FBYyxFQUFFLFFBQVEsRUFBRSxNQUFNLEdBQUcsTUFBTSxHQUFHLE9BQU8sQ0FBQyxJQUFJLENBQUMsQ0FFOUY7Q0FDRiJ9
@@ -1 +1 @@
1
- {"version":3,"file":"cheat_codes.d.ts","sourceRoot":"","sources":["../../src/testing/cheat_codes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAGvE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAEjE;;;;;GAKG;AACH,qBAAa,UAAU;IAEnB,yBAAyB;IAClB,GAAG,EAAE,aAAa;IACzB,uDAAuD;IAChD,MAAM,EAAE,gBAAgB;IAJjC;IACE,yBAAyB;IAClB,GAAG,EAAE,aAAa;IACzB,uDAAuD;IAChD,MAAM,EAAE,gBAAgB,EAC7B;IAEJ,OAAa,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,YAAY,EAAE,YAAY,GAAG,OAAO,CAAC,UAAU,CAAC,CAOvG;IAED;;;;;;;;OAQG;IACG,mBAAmB,CAAC,eAAe,EAAE,eAAe,EAAE,IAAI,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,GAAG,MAAM,iBAuB5G;IAED;;;;;;;;OAQG;IACG,mBAAmB,CAAC,eAAe,EAAE,eAAe,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,iBAIrG;CACF"}
1
+ {"version":3,"file":"cheat_codes.d.ts","sourceRoot":"","sources":["../../src/testing/cheat_codes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACvE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAEjF;;;GAGG;AACH,qBAAa,UAAU;IAEnB,yBAAyB;IAClB,GAAG,EAAE,aAAa;IACzB,uDAAuD;IAChD,MAAM,EAAE,gBAAgB;IAJjC;IACE,yBAAyB;IAClB,GAAG,EAAE,aAAa;IACzB,uDAAuD;IAChD,MAAM,EAAE,gBAAgB,EAC7B;IAEJ,OAAa,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,YAAY,EAAE,YAAY,GAAG,OAAO,CAAC,UAAU,CAAC,CAOvG;IAED;;;;;;OAMG;IACH,mBAAmB,CAAC,IAAI,EAAE,SAAS,GAAG,cAAc,EAAE,eAAe,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAErG;IAED;;;;;;;OAOG;IACH,mBAAmB,CAAC,IAAI,EAAE,SAAS,GAAG,cAAc,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAE9F;CACF"}
@@ -1,10 +1,7 @@
1
1
  import { EthCheatCodes, RollupCheatCodes } from '@aztec/ethereum/test';
2
- import { retryUntil } from '@aztec/foundation/retry';
3
2
  /**
4
- * A class that provides utility functions for interacting with the chain.
5
- * @deprecated There used to be 3 kinds of cheat codes: eth, rollup and aztec. We have nuked the Aztec ones because
6
- * they became unused (we now have better testing tools). If you are introducing a new functionality to the cheat
7
- * codes, please consider whether it makes sense to just introduce new utils in your tests instead.
3
+ * Wrapper for Aztec Debug API.
4
+ * @deprecated use the AztecNode debug API directly.
8
5
  */ export class CheatCodes {
9
6
  eth;
10
7
  rollup;
@@ -18,45 +15,22 @@ import { retryUntil } from '@aztec/foundation/retry';
18
15
  return new CheatCodes(ethCheatCodes, rollupCheatCodes);
19
16
  }
20
17
  /**
21
- * Warps the L1 timestamp to a target timestamp and mines an L2 block that advances the L2 timestamp to at least
22
- * the target timestamp. L2 timestamp is not advanced exactly to the target timestamp because it is determined
23
- * by the slot number, which advances in fixed intervals.
24
- * This is useful for testing time-dependent contract behavior.
25
- * @param sequencerClient - The sequencer client to use to force an empty block to be mined.
26
- * @param node - The Aztec node used to query if a new block has been mined.
27
- * @param targetTimestamp - The target timestamp to warp to (in seconds)
28
- */ async warpL2TimeAtLeastTo(sequencerClient, node, targetTimestamp) {
29
- const currentL2BlockNumber = await node.getBlockNumber();
30
- // We warp the L1 timestamp
31
- await this.eth.warp(targetTimestamp, {
32
- resetBlockInterval: true
33
- });
34
- // Wait until an L2 block is mined
35
- const sequencer = sequencerClient.getSequencer();
36
- const minTxsPerBlock = sequencer.getConfig().minTxsPerBlock;
37
- sequencer.updateConfig({
38
- minTxsPerBlock: 0
39
- });
40
- await retryUntil(async ()=>{
41
- const newL2BlockNumber = await node.getBlockNumber();
42
- return newL2BlockNumber > currentL2BlockNumber;
43
- }, 'new block after warping L2 time', 36, 1);
44
- // Restore original minTxsPerBlock
45
- sequencer.updateConfig({
46
- minTxsPerBlock
47
- });
18
+ * Warps the L1 timestamp to at least `targetTimestamp` and mines an L2 block advancing the L2 timestamp to at least
19
+ * the target. Forwards to the node's debug API, which serializes the warp through the automine sequencer queue.
20
+ * @param node - The Aztec node whose debug API performs the warp. Must run an automine sequencer.
21
+ * @param targetTimestamp - The target timestamp to warp to (in seconds).
22
+ * @deprecated Call `node.warpL2TimeAtLeastTo(targetTimestamp)` on the node debug API directly.
23
+ */ warpL2TimeAtLeastTo(node, targetTimestamp) {
24
+ return node.warpL2TimeAtLeastTo(Number(targetTimestamp));
48
25
  }
49
26
  /**
50
- * Warps the L1 timestamp forward by a specified duration and mines an L2 block that advances the L2 timestamp at
51
- * least by the duration. L2 timestamp is not advanced exactly by the duration because it is determined by the slot
52
- * number, which advances in fixed intervals.
53
- * This is useful for testing time-dependent contract behavior.
54
- * @param sequencerClient - The sequencer client to use to force an empty block to be mined.
55
- * @param node - The Aztec node used to query if a new block has been mined.
56
- * @param duration - The duration to advance time by (in seconds)
57
- */ async warpL2TimeAtLeastBy(sequencerClient, node, duration) {
58
- const currentTimestamp = await this.eth.timestamp();
59
- const targetTimestamp = BigInt(currentTimestamp) + BigInt(duration);
60
- await this.warpL2TimeAtLeastTo(sequencerClient, node, targetTimestamp);
27
+ * Warps the L1 timestamp forward by at least `duration` seconds and mines an L2 block advancing the L2 timestamp at
28
+ * least by the duration. Forwards to the node's debug API, which serializes the warp through the automine sequencer
29
+ * queue.
30
+ * @param node - The Aztec node whose debug API performs the warp. Must run an automine sequencer.
31
+ * @param duration - The duration to advance time by (in seconds).
32
+ * @deprecated Call `node.warpL2TimeAtLeastBy(duration)` on the node debug API directly.
33
+ */ warpL2TimeAtLeastBy(node, duration) {
34
+ return node.warpL2TimeAtLeastBy(Number(duration));
61
35
  }
62
36
  }
@@ -1,5 +1,5 @@
1
1
  import { type EthCheatCodes } from '@aztec/ethereum/test';
2
- import { type EpochNumber } from '@aztec/foundation/branded-types';
2
+ import type { EpochNumber } from '@aztec/foundation/branded-types';
3
3
  import type { Logger } from '@aztec/foundation/log';
4
4
  import type { EthAddress, L2BlockSource } from '@aztec/stdlib/block';
5
5
  export declare class EpochTestSettler {
@@ -16,4 +16,4 @@ export declare class EpochTestSettler {
16
16
  stop(): Promise<void>;
17
17
  handleEpochReadyToProve(epoch: EpochNumber): Promise<boolean>;
18
18
  }
19
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZXBvY2hfdGVzdF9zZXR0bGVyLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvdGVzdGluZy9lcG9jaF90ZXN0X3NldHRsZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQ0EsT0FBTyxFQUFFLEtBQUssYUFBYSxFQUFvQix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BAIV;IAEK,IAAI,kBAET;IAEK,uBAAuB,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,CAclE;CACF"}
@@ -1,7 +1,6 @@
1
1
  import { RollupCheatCodes } from '@aztec/ethereum/test';
2
- import { SlotNumber } from '@aztec/foundation/branded-types';
2
+ import { settleEpochOutbox } from '@aztec/prover-client/test';
3
3
  import { EpochMonitor } from '@aztec/prover-node';
4
- import { computeEpochOutHash } from '@aztec/stdlib/messaging';
5
4
  export class EpochTestSettler {
6
5
  l2BlockSource;
7
6
  log;
@@ -27,30 +26,12 @@ export class EpochTestSettler {
27
26
  await this.epochMonitor?.stop();
28
27
  }
29
28
  async handleEpochReadyToProve(epoch) {
30
- const checkpointedBlocks = await this.l2BlockSource.getCheckpointedBlocksForEpoch(epoch);
31
- const blocks = checkpointedBlocks.map((b)=>b.block);
32
- this.log.info(`Settling epoch ${epoch} with blocks ${blocks[0]?.header.getBlockNumber()} to ${blocks.at(-1)?.header.getBlockNumber()}`, {
33
- blocks: blocks.map((b)=>b.toBlockInfo())
29
+ const lastCheckpoint = await settleEpochOutbox({
30
+ rollupCheatCodes: this.rollupCheatCodes,
31
+ l2BlockSource: this.l2BlockSource,
32
+ epoch,
33
+ log: this.log
34
34
  });
35
- const messagesInEpoch = [];
36
- let previousSlotNumber = SlotNumber.ZERO;
37
- let checkpointIndex = -1;
38
- for (const block of blocks){
39
- const slotNumber = block.header.globalVariables.slotNumber;
40
- if (slotNumber !== previousSlotNumber) {
41
- checkpointIndex++;
42
- messagesInEpoch[checkpointIndex] = [];
43
- previousSlotNumber = slotNumber;
44
- }
45
- messagesInEpoch[checkpointIndex].push(block.body.txEffects.map((txEffect)=>txEffect.l2ToL1Msgs));
46
- }
47
- const outHash = computeEpochOutHash(messagesInEpoch);
48
- if (!outHash.isZero()) {
49
- await this.rollupCheatCodes.insertOutbox(epoch, outHash.toBigInt());
50
- } else {
51
- this.log.info(`No L2 to L1 messages in epoch ${epoch}`);
52
- }
53
- const lastCheckpoint = checkpointedBlocks.at(-1)?.checkpointNumber;
54
35
  if (lastCheckpoint !== undefined) {
55
36
  await this.rollupCheatCodes.markAsProven(lastCheckpoint);
56
37
  } else {
@@ -1,6 +1,5 @@
1
- export { AnvilTestWatcher } from './anvil_test_watcher.js';
2
1
  export { EthCheatCodes, RollupCheatCodes } from '@aztec/ethereum/test';
3
2
  export { CheatCodes } from './cheat_codes.js';
4
3
  export { EpochTestSettler } from './epoch_test_settler.js';
5
4
  export { getTokenAllowedSetupFunctions } from './token_allowed_setup.js';
6
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy90ZXN0aW5nL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxnQkFBZ0IsRUFBRSxNQUFNLHlCQUF5QixDQUFDO0FBQzNELE9BQU8sRUFBRSxhQUFhLEVBQUUsZ0JBQWdCLEVBQUUsTUFBTSxzQkFBc0IsQ0FBQztBQUN2RSxPQUFPLEVBQUUsVUFBVSxFQUFFLE1BQU0sa0JBQWtCLENBQUM7QUFDOUMsT0FBTyxFQUFFLGdCQUFnQixFQUFFLE1BQU0seUJBQXlCLENBQUM7QUFDM0QsT0FBTyxFQUFFLDZCQUE2QixFQUFFLE1BQU0sMEJBQTBCLENBQUMifQ==
5
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy90ZXN0aW5nL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxhQUFhLEVBQUUsZ0JBQWdCLEVBQUUsTUFBTSxzQkFBc0IsQ0FBQztBQUN2RSxPQUFPLEVBQUUsVUFBVSxFQUFFLE1BQU0sa0JBQWtCLENBQUM7QUFDOUMsT0FBTyxFQUFFLGdCQUFnQixFQUFFLE1BQU0seUJBQXlCLENBQUM7QUFDM0QsT0FBTyxFQUFFLDZCQUE2QixFQUFFLE1BQU0sMEJBQTBCLENBQUMifQ==
@@ -1 +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,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,6BAA6B,EAAE,MAAM,0BAA0B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/testing/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,6BAA6B,EAAE,MAAM,0BAA0B,CAAC"}
@@ -1,4 +1,3 @@
1
- export { AnvilTestWatcher } from './anvil_test_watcher.js';
2
1
  export { EthCheatCodes, RollupCheatCodes } from '@aztec/ethereum/test';
3
2
  export { CheatCodes } from './cheat_codes.js';
4
3
  export { EpochTestSettler } from './epoch_test_settler.js';
@@ -1,7 +1,12 @@
1
+ import type { ContractArtifact } from '@aztec/stdlib/abi';
1
2
  import type { AllowedElement } from '@aztec/stdlib/interfaces/server';
2
3
  /**
3
- * Returns Token-specific allowlist entries needed for FPC-based fee payments.
4
- * These are test-only: FPC-based fee payment with custom tokens won't work on mainnet alpha.
4
+ * Returns the allowlist entries needed for FPC-based fee payments, keyed by the contract class of
5
+ * the `artifact` actually deployed as the fee token (defaults to canonical Token). The setup-phase
6
+ * validator matches these entries by class id, so a test deploying the codegen'd TestToken as its
7
+ * fee vehicle must pass `TestTokenContract.artifact` here -- otherwise the FPC fee calls are matched
8
+ * against the wrong class and rejected. Test-only: FPC fee payment with custom tokens won't work on
9
+ * mainnet alpha.
5
10
  */
6
- export declare function getTokenAllowedSetupFunctions(): Promise<AllowedElement[]>;
7
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidG9rZW5fYWxsb3dlZF9zZXR1cC5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3Rlc3RpbmcvdG9rZW5fYWxsb3dlZF9zZXR1cC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFHQSxPQUFPLEtBQUssRUFBRSxjQUFjLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQztBQUV0RTs7O0dBR0c7QUFDSCx3QkFBc0IsNkJBQTZCLElBQUksT0FBTyxDQUFDLGNBQWMsRUFBRSxDQUFDLENBUy9FIn0=
11
+ export declare function getTokenAllowedSetupFunctions(artifact?: ContractArtifact): Promise<AllowedElement[]>;
12
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidG9rZW5fYWxsb3dlZF9zZXR1cC5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3Rlc3RpbmcvdG9rZW5fYWxsb3dlZF9zZXR1cC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFFQSxPQUFPLEtBQUssRUFBRSxnQkFBZ0IsRUFBRSxNQUFNLG1CQUFtQixDQUFDO0FBRTFELE9BQU8sS0FBSyxFQUFFLGNBQWMsRUFBRSxNQUFNLGlDQUFpQyxDQUFDO0FBRXRFOzs7Ozs7O0dBT0c7QUFDSCx3QkFBc0IsNkJBQTZCLENBQ2pELFFBQVEsR0FBRSxnQkFBd0MsR0FDakQsT0FBTyxDQUFDLGNBQWMsRUFBRSxDQUFDLENBUzNCIn0=
@@ -1 +1 @@
1
- {"version":3,"file":"token_allowed_setup.d.ts","sourceRoot":"","sources":["../../src/testing/token_allowed_setup.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAEtE;;;GAGG;AACH,wBAAsB,6BAA6B,IAAI,OAAO,CAAC,cAAc,EAAE,CAAC,CAS/E"}
1
+ {"version":3,"file":"token_allowed_setup.d.ts","sourceRoot":"","sources":["../../src/testing/token_allowed_setup.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAE1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAEtE;;;;;;;GAOG;AACH,wBAAsB,6BAA6B,CACjD,QAAQ,GAAE,gBAAwC,GACjD,OAAO,CAAC,cAAc,EAAE,CAAC,CAS3B"}
@@ -2,19 +2,23 @@ import { TokenContractArtifact } from '@aztec/noir-contracts.js/Token';
2
2
  import { buildAllowedElement } from '@aztec/p2p/msg_validators';
3
3
  import { getContractClassFromArtifact } from '@aztec/stdlib/contract';
4
4
  /**
5
- * Returns Token-specific allowlist entries needed for FPC-based fee payments.
6
- * These are test-only: FPC-based fee payment with custom tokens won't work on mainnet alpha.
7
- */ export async function getTokenAllowedSetupFunctions() {
8
- const tokenClassId = (await getContractClassFromArtifact(TokenContractArtifact)).id;
5
+ * Returns the allowlist entries needed for FPC-based fee payments, keyed by the contract class of
6
+ * the `artifact` actually deployed as the fee token (defaults to canonical Token). The setup-phase
7
+ * validator matches these entries by class id, so a test deploying the codegen'd TestToken as its
8
+ * fee vehicle must pass `TestTokenContract.artifact` here -- otherwise the FPC fee calls are matched
9
+ * against the wrong class and rejected. Test-only: FPC fee payment with custom tokens won't work on
10
+ * mainnet alpha.
11
+ */ export async function getTokenAllowedSetupFunctions(artifact = TokenContractArtifact) {
12
+ const tokenClassId = (await getContractClassFromArtifact(artifact)).id;
9
13
  const target = {
10
14
  classId: tokenClassId
11
15
  };
12
16
  return Promise.all([
13
- // Token: needed for private transfers via FPC (transfer_to_public enqueues this)
14
- buildAllowedElement(TokenContractArtifact, target, '_increase_public_balance', {
17
+ // needed for private transfers via FPC (transfer_to_public enqueues this)
18
+ buildAllowedElement(artifact, target, '_increase_public_balance', {
15
19
  onlySelf: true
16
20
  }),
17
- // Token: needed for public transfers via FPC (fee_entrypoint_public enqueues this)
18
- buildAllowedElement(TokenContractArtifact, target, 'transfer_in_public')
21
+ // needed for public transfers via FPC (fee_entrypoint_public enqueues this)
22
+ buildAllowedElement(artifact, target, 'transfer_in_public')
19
23
  ]);
20
24
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aztec/aztec",
3
- "version": "0.0.1-commit.b6e433891",
3
+ "version": "0.0.1-commit.b8a057fa",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./dest/index.js",
@@ -28,38 +28,39 @@
28
28
  "../package.common.json"
29
29
  ],
30
30
  "dependencies": {
31
- "@aztec/accounts": "0.0.1-commit.b6e433891",
32
- "@aztec/archiver": "0.0.1-commit.b6e433891",
33
- "@aztec/aztec-node": "0.0.1-commit.b6e433891",
34
- "@aztec/aztec.js": "0.0.1-commit.b6e433891",
35
- "@aztec/bb-prover": "0.0.1-commit.b6e433891",
36
- "@aztec/bb.js": "0.0.1-commit.b6e433891",
37
- "@aztec/blob-client": "0.0.1-commit.b6e433891",
38
- "@aztec/bot": "0.0.1-commit.b6e433891",
39
- "@aztec/builder": "0.0.1-commit.b6e433891",
40
- "@aztec/cli": "0.0.1-commit.b6e433891",
41
- "@aztec/constants": "0.0.1-commit.b6e433891",
42
- "@aztec/entrypoints": "0.0.1-commit.b6e433891",
43
- "@aztec/ethereum": "0.0.1-commit.b6e433891",
44
- "@aztec/foundation": "0.0.1-commit.b6e433891",
45
- "@aztec/kv-store": "0.0.1-commit.b6e433891",
46
- "@aztec/l1-artifacts": "0.0.1-commit.b6e433891",
47
- "@aztec/node-lib": "0.0.1-commit.b6e433891",
48
- "@aztec/noir-contracts.js": "0.0.1-commit.b6e433891",
49
- "@aztec/noir-protocol-circuits-types": "0.0.1-commit.b6e433891",
50
- "@aztec/p2p": "0.0.1-commit.b6e433891",
51
- "@aztec/p2p-bootstrap": "0.0.1-commit.b6e433891",
52
- "@aztec/protocol-contracts": "0.0.1-commit.b6e433891",
53
- "@aztec/prover-client": "0.0.1-commit.b6e433891",
54
- "@aztec/prover-node": "0.0.1-commit.b6e433891",
55
- "@aztec/pxe": "0.0.1-commit.b6e433891",
56
- "@aztec/sequencer-client": "0.0.1-commit.b6e433891",
57
- "@aztec/stdlib": "0.0.1-commit.b6e433891",
58
- "@aztec/telemetry-client": "0.0.1-commit.b6e433891",
59
- "@aztec/txe": "0.0.1-commit.b6e433891",
60
- "@aztec/validator-ha-signer": "0.0.1-commit.b6e433891",
61
- "@aztec/wallets": "0.0.1-commit.b6e433891",
62
- "@aztec/world-state": "0.0.1-commit.b6e433891",
31
+ "@aztec/accounts": "0.0.1-commit.b8a057fa",
32
+ "@aztec/archiver": "0.0.1-commit.b8a057fa",
33
+ "@aztec/aztec-node": "0.0.1-commit.b8a057fa",
34
+ "@aztec/aztec.js": "0.0.1-commit.b8a057fa",
35
+ "@aztec/bb-prover": "0.0.1-commit.b8a057fa",
36
+ "@aztec/bb.js": "0.0.1-commit.b8a057fa",
37
+ "@aztec/blob-client": "0.0.1-commit.b8a057fa",
38
+ "@aztec/bot": "0.0.1-commit.b8a057fa",
39
+ "@aztec/builder": "0.0.1-commit.b8a057fa",
40
+ "@aztec/cli": "0.0.1-commit.b8a057fa",
41
+ "@aztec/constants": "0.0.1-commit.b8a057fa",
42
+ "@aztec/entrypoints": "0.0.1-commit.b8a057fa",
43
+ "@aztec/ethereum": "0.0.1-commit.b8a057fa",
44
+ "@aztec/foundation": "0.0.1-commit.b8a057fa",
45
+ "@aztec/kv-store": "0.0.1-commit.b8a057fa",
46
+ "@aztec/l1-artifacts": "0.0.1-commit.b8a057fa",
47
+ "@aztec/node-lib": "0.0.1-commit.b8a057fa",
48
+ "@aztec/noir-contracts.js": "0.0.1-commit.b8a057fa",
49
+ "@aztec/noir-protocol-circuits-types": "0.0.1-commit.b8a057fa",
50
+ "@aztec/p2p": "0.0.1-commit.b8a057fa",
51
+ "@aztec/p2p-bootstrap": "0.0.1-commit.b8a057fa",
52
+ "@aztec/protocol-contracts": "0.0.1-commit.b8a057fa",
53
+ "@aztec/prover-client": "0.0.1-commit.b8a057fa",
54
+ "@aztec/prover-node": "0.0.1-commit.b8a057fa",
55
+ "@aztec/pxe": "0.0.1-commit.b8a057fa",
56
+ "@aztec/sequencer-client": "0.0.1-commit.b8a057fa",
57
+ "@aztec/standard-contracts": "0.0.1-commit.b8a057fa",
58
+ "@aztec/stdlib": "0.0.1-commit.b8a057fa",
59
+ "@aztec/telemetry-client": "0.0.1-commit.b8a057fa",
60
+ "@aztec/txe": "0.0.1-commit.b8a057fa",
61
+ "@aztec/validator-ha-signer": "0.0.1-commit.b8a057fa",
62
+ "@aztec/wallets": "0.0.1-commit.b8a057fa",
63
+ "@aztec/world-state": "0.0.1-commit.b8a057fa",
63
64
  "@iarna/toml": "^2.2.5",
64
65
  "@types/chalk": "^2.2.0",
65
66
  "abitype": "^0.8.11",