@aztec/aztec 0.0.1-commit.993d240 → 0.0.1-commit.9a89641
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.
- package/dest/bin/index.js +2 -0
- package/dest/cli/aztec_start_action.d.ts +1 -1
- package/dest/cli/aztec_start_action.d.ts.map +1 -1
- package/dest/cli/aztec_start_action.js +10 -26
- package/dest/cli/aztec_start_options.js +1 -1
- package/dest/cli/cmds/compile.d.ts +1 -1
- package/dest/cli/cmds/compile.d.ts.map +1 -1
- package/dest/cli/cmds/compile.js +25 -17
- package/dest/cli/cmds/prover.d.ts +4 -0
- package/dest/cli/cmds/prover.d.ts.map +1 -0
- package/dest/cli/cmds/prover.js +24 -0
- package/dest/cli/cmds/standby.d.ts +28 -2
- package/dest/cli/cmds/standby.d.ts.map +1 -1
- package/dest/cli/cmds/standby.js +45 -2
- package/dest/cli/cmds/start_bot.d.ts +1 -1
- package/dest/cli/cmds/start_bot.d.ts.map +1 -1
- package/dest/cli/cmds/start_bot.js +5 -1
- package/dest/cli/cmds/start_node.d.ts +1 -1
- package/dest/cli/cmds/start_node.d.ts.map +1 -1
- package/dest/cli/cmds/start_node.js +14 -23
- package/dest/cli/cmds/utils/artifacts.d.ts +6 -1
- package/dest/cli/cmds/utils/artifacts.d.ts.map +1 -1
- package/dest/cli/util.d.ts +10 -5
- package/dest/cli/util.d.ts.map +1 -1
- package/dest/cli/util.js +20 -49
- package/dest/examples/token.js +3 -3
- package/dest/local-network/auth_registry.d.ts +3 -2
- package/dest/local-network/auth_registry.d.ts.map +1 -1
- package/dest/local-network/auth_registry.js +5 -3
- package/dest/local-network/banana_fpc.d.ts +3 -2
- package/dest/local-network/banana_fpc.d.ts.map +1 -1
- package/dest/local-network/banana_fpc.js +5 -3
- package/dest/local-network/local-network.d.ts +6 -5
- package/dest/local-network/local-network.d.ts.map +1 -1
- package/dest/local-network/local-network.js +43 -78
- package/dest/testing/cheat_codes.d.ts +16 -23
- package/dest/testing/cheat_codes.d.ts.map +1 -1
- package/dest/testing/cheat_codes.js +20 -82
- package/dest/testing/epoch_test_settler.d.ts +2 -2
- package/dest/testing/epoch_test_settler.d.ts.map +1 -1
- package/dest/testing/epoch_test_settler.js +5 -26
- package/dest/testing/index.d.ts +2 -2
- package/dest/testing/index.d.ts.map +1 -1
- package/dest/testing/index.js +1 -1
- package/dest/testing/local-network.d.ts +51 -0
- package/dest/testing/local-network.d.ts.map +1 -0
- package/dest/testing/local-network.js +60 -0
- package/dest/testing/token_allowed_setup.d.ts +9 -4
- package/dest/testing/token_allowed_setup.d.ts.map +1 -1
- package/dest/testing/token_allowed_setup.js +12 -8
- package/package.json +34 -34
- package/scripts/templates/counter/contract/src/main.nr +4 -4
- package/src/bin/index.ts +2 -0
- package/src/cli/aztec_start_action.ts +8 -13
- package/src/cli/aztec_start_options.ts +1 -1
- package/src/cli/cmds/compile.ts +29 -16
- package/src/cli/cmds/prover.ts +42 -0
- package/src/cli/cmds/standby.ts +55 -3
- package/src/cli/cmds/start_bot.ts +6 -1
- package/src/cli/cmds/start_node.ts +17 -23
- package/src/cli/cmds/utils/artifacts.ts +5 -0
- package/src/cli/util.ts +21 -62
- package/src/examples/token.ts +11 -3
- package/src/local-network/auth_registry.ts +8 -3
- package/src/local-network/banana_fpc.ts +9 -2
- package/src/local-network/local-network.ts +48 -89
- package/src/testing/cheat_codes.ts +19 -103
- package/src/testing/epoch_test_settler.ts +8 -30
- package/src/testing/index.ts +1 -1
- package/src/testing/local-network.ts +97 -0
- package/src/testing/token_allowed_setup.ts +15 -8
- package/dest/testing/anvil_test_watcher.d.ts +0 -54
- package/dest/testing/anvil_test_watcher.d.ts.map +0 -1
- package/dest/testing/anvil_test_watcher.js +0 -235
- package/src/testing/anvil_test_watcher.ts +0 -273
|
@@ -1,98 +1,36 @@
|
|
|
1
1
|
import { EthCheatCodes, RollupCheatCodes } from '@aztec/ethereum/test';
|
|
2
|
-
import { SlotNumber } from '@aztec/foundation/branded-types';
|
|
3
|
-
import { createLogger } from '@aztec/foundation/log';
|
|
4
2
|
/**
|
|
5
|
-
*
|
|
6
|
-
* @deprecated
|
|
7
|
-
* they became unused (we now have better testing tools). If you are introducing a new functionality to the cheat
|
|
8
|
-
* 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.
|
|
9
5
|
*/ export class CheatCodes {
|
|
10
6
|
eth;
|
|
11
7
|
rollup;
|
|
12
|
-
|
|
13
|
-
logger;
|
|
14
|
-
constructor(/** Cheat codes for L1.*/ eth, /** Cheat codes for the Aztec Rollup contract on L1. */ rollup, /** When wired, redirects time-warps through the AutomineSequencer queue (test-only). */ automine){
|
|
8
|
+
constructor(/** Cheat codes for L1.*/ eth, /** Cheat codes for the Aztec Rollup contract on L1. */ rollup){
|
|
15
9
|
this.eth = eth;
|
|
16
10
|
this.rollup = rollup;
|
|
17
|
-
this.automine = automine;
|
|
18
|
-
this.logger = createLogger('aztecjs:cheat_codes');
|
|
19
11
|
}
|
|
20
|
-
static async create(rpcUrls, node, dateProvider
|
|
12
|
+
static async create(rpcUrls, node, dateProvider) {
|
|
21
13
|
const ethCheatCodes = new EthCheatCodes(rpcUrls, dateProvider);
|
|
22
14
|
const rollupCheatCodes = new RollupCheatCodes(ethCheatCodes, await node.getNodeInfo().then((n)=>n.l1ContractAddresses));
|
|
23
|
-
return new CheatCodes(ethCheatCodes, rollupCheatCodes
|
|
15
|
+
return new CheatCodes(ethCheatCodes, rollupCheatCodes);
|
|
24
16
|
}
|
|
25
17
|
/**
|
|
26
|
-
* Warps the L1 timestamp to
|
|
27
|
-
* the target
|
|
28
|
-
*
|
|
29
|
-
* @param
|
|
30
|
-
* @
|
|
31
|
-
*/
|
|
32
|
-
|
|
33
|
-
const currentTimestamp = BigInt(await this.eth.lastBlockTimestamp());
|
|
34
|
-
if (targetBigInt <= currentTimestamp) {
|
|
35
|
-
throw new Error(`warpL2TimeAtLeastTo: target timestamp ${targetBigInt} is not in the future (current L1 timestamp is ${currentTimestamp}).`);
|
|
36
|
-
}
|
|
37
|
-
// AutomineSequencer owns time control through its serial queue — delegate to keep warps atomic
|
|
38
|
-
// with respect to any in-flight build, and avoid the mineBlock-loop hack below.
|
|
39
|
-
// `warpTo` internally builds an empty L2 checkpoint, which auto-mines exactly one L1 block at
|
|
40
|
-
// the target slot boundary, so no separate `node.mineBlock()` is needed here.
|
|
41
|
-
if (this.automine) {
|
|
42
|
-
await this.automine.warpTo(Number(targetBigInt));
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
const currentSlot = await this.rollup.getSlot();
|
|
46
|
-
const targetSlot = await this.rollup.getSlotAt(targetBigInt);
|
|
47
|
-
let effectiveTimestamp = targetBigInt;
|
|
48
|
-
let effectiveTargetSlot = targetSlot;
|
|
49
|
-
if (targetSlot <= currentSlot) {
|
|
50
|
-
// Target lands in the same (or earlier) slot — auto-adjust to the next slot's start.
|
|
51
|
-
const nextSlot = SlotNumber(currentSlot + 1);
|
|
52
|
-
const nextSlotTimestamp = await this.rollup.getTimestampForSlot(nextSlot);
|
|
53
|
-
this.logger.warn(`warpL2TimeAtLeastTo: target timestamp ${targetBigInt} falls in current slot ${currentSlot}. ` + `Auto-adjusting to start of slot ${nextSlot} at timestamp ${nextSlotTimestamp}.`);
|
|
54
|
-
effectiveTimestamp = nextSlotTimestamp;
|
|
55
|
-
effectiveTargetSlot = nextSlot;
|
|
56
|
-
}
|
|
57
|
-
await this.eth.warp(effectiveTimestamp, {
|
|
58
|
-
resetBlockInterval: true
|
|
59
|
-
});
|
|
60
|
-
// The sequencer's polling loop may have a `work()` cycle in flight that captured pre-warp slot/timestamp values
|
|
61
|
-
// just before our warp landed. That cycle would mine an L2 block at the stale slot — the L1 sync prunes such a
|
|
62
|
-
// block from the canonical chain, but it lingers in local world state and the PXE will use it as the anchor for
|
|
63
|
-
// subsequent txs, leading to `expiration_timestamp` values that are already in the past relative to L1. Mine
|
|
64
|
-
// until we observe an L2 block at (or past) the post-warp slot, ensuring the next tx anchors to a fresh block.
|
|
65
|
-
const maxAttempts = 5;
|
|
66
|
-
for(let attempt = 1; attempt <= maxAttempts; attempt++){
|
|
67
|
-
await node.mineBlock();
|
|
68
|
-
const blockData = await node.getBlockData('latest');
|
|
69
|
-
const blockSlot = blockData?.header.globalVariables.slotNumber;
|
|
70
|
-
if (blockSlot !== undefined && BigInt(blockSlot) >= BigInt(effectiveTargetSlot)) {
|
|
71
|
-
return;
|
|
72
|
-
}
|
|
73
|
-
this.logger.warn(`warpL2TimeAtLeastTo: mined L2 block at slot ${blockSlot}, expected at least ${effectiveTargetSlot}. ` + `Retrying mineBlock (attempt ${attempt}/${maxAttempts}).`);
|
|
74
|
-
}
|
|
75
|
-
throw new Error(`warpL2TimeAtLeastTo: failed to mine an L2 block at or past slot ${effectiveTargetSlot} after ${maxAttempts} attempts.`);
|
|
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));
|
|
76
25
|
}
|
|
77
26
|
/**
|
|
78
|
-
* Warps the L1 timestamp forward by
|
|
79
|
-
* least by the duration.
|
|
80
|
-
*
|
|
81
|
-
* @param node - The Aztec node
|
|
82
|
-
* @param duration - The duration to advance time by (in seconds)
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
}
|
|
87
|
-
// Advance relative to whichever clock leads. A live sequencer mines L2 blocks at slot boundaries that can run
|
|
88
|
-
// ahead of anvil's L1 timestamp, so basing the target on L1 alone would advance the L2 timestamp by less than
|
|
89
|
-
// `duration`. Anchoring to the latest L2 block timestamp when it leads guarantees the post-warp L2 block is at
|
|
90
|
-
// least `duration` ahead of the current one.
|
|
91
|
-
const currentL1Timestamp = BigInt(await this.eth.lastBlockTimestamp());
|
|
92
|
-
const latestBlockData = await node.getBlockData('latest');
|
|
93
|
-
const latestL2Timestamp = latestBlockData ? BigInt(latestBlockData.header.globalVariables.timestamp) : 0n;
|
|
94
|
-
const baseTimestamp = latestL2Timestamp > currentL1Timestamp ? latestL2Timestamp : currentL1Timestamp;
|
|
95
|
-
const targetTimestamp = baseTimestamp + BigInt(duration);
|
|
96
|
-
await this.warpL2TimeAtLeastTo(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));
|
|
97
35
|
}
|
|
98
36
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type EthCheatCodes } from '@aztec/ethereum/test';
|
|
2
|
-
import {
|
|
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,
|
|
19
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZXBvY2hfdGVzdF9zZXR0bGVyLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvdGVzdGluZy9lcG9jaF90ZXN0X3NldHRsZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLEtBQUssYUFBYSxFQUFvQixNQUFNLHNCQUFzQixDQUFDO0FBQzVFLE9BQU8sS0FBSyxFQUFFLFdBQVcsRUFBRSxNQUFNLGlDQUFpQyxDQUFDO0FBQ25FLE9BQU8sS0FBSyxFQUFFLE1BQU0sRUFBRSxNQUFNLHVCQUF1QixDQUFDO0FBR3BELE9BQU8sS0FBSyxFQUFFLFVBQVUsRUFBRSxhQUFhLEVBQUUsTUFBTSxxQkFBcUIsQ0FBQztBQUVyRSxxQkFBYSxnQkFBZ0I7SUFPekIsT0FBTyxDQUFDLGFBQWE7SUFDckIsT0FBTyxDQUFDLEdBQUc7SUFDWCxPQUFPLENBQUMsT0FBTztJQVJqQixPQUFPLENBQUMsZ0JBQWdCLENBQW1CO0lBQzNDLE9BQU8sQ0FBQyxZQUFZLENBQUMsQ0FBZTtJQUVwQyxZQUNFLFVBQVUsRUFBRSxhQUFhLEVBQ3pCLGFBQWEsRUFBRSxVQUFVLEVBQ2pCLGFBQWEsRUFBRSxhQUFhLEVBQzVCLEdBQUcsRUFBRSxNQUFNLEVBQ1gsT0FBTyxFQUFFO1FBQUUsaUJBQWlCLEVBQUUsTUFBTSxDQUFDO1FBQUMsY0FBYyxDQUFDLEVBQUUsTUFBTSxDQUFBO0tBQUUsRUFHeEU7SUFFSyxLQUFLLGtCQUlWO0lBRUssSUFBSSxrQkFFVDtJQUVLLHVCQUF1QixDQUFDLEtBQUssRUFBRSxXQUFXLEdBQUcsT0FBTyxDQUFDLE9BQU8sQ0FBQyxDQWNsRTtDQUNGIn0=
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"epoch_test_settler.d.ts","sourceRoot":"","sources":["../../src/testing/epoch_test_settler.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"epoch_test_settler.d.ts","sourceRoot":"","sources":["../../src/testing/epoch_test_settler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAoB,MAAM,sBAAsB,CAAC;AAC5E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAGpD,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAErE,qBAAa,gBAAgB;IAOzB,OAAO,CAAC,aAAa;IACrB,OAAO,CAAC,GAAG;IACX,OAAO,CAAC,OAAO;IARjB,OAAO,CAAC,gBAAgB,CAAmB;IAC3C,OAAO,CAAC,YAAY,CAAC,CAAe;IAEpC,YACE,UAAU,EAAE,aAAa,EACzB,aAAa,EAAE,UAAU,EACjB,aAAa,EAAE,aAAa,EAC5B,GAAG,EAAE,MAAM,EACX,OAAO,EAAE;QAAE,iBAAiB,EAAE,MAAM,CAAC;QAAC,cAAc,CAAC,EAAE,MAAM,CAAA;KAAE,EAGxE;IAEK,KAAK,kBAIV;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 {
|
|
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,32 +26,12 @@ export class EpochTestSettler {
|
|
|
27
26
|
await this.epochMonitor?.stop();
|
|
28
27
|
}
|
|
29
28
|
async handleEpochReadyToProve(epoch) {
|
|
30
|
-
const
|
|
29
|
+
const lastCheckpoint = await settleEpochOutbox({
|
|
30
|
+
rollupCheatCodes: this.rollupCheatCodes,
|
|
31
|
+
l2BlockSource: this.l2BlockSource,
|
|
31
32
|
epoch,
|
|
32
|
-
|
|
33
|
+
log: this.log
|
|
33
34
|
});
|
|
34
|
-
this.log.info(`Settling epoch ${epoch} with blocks ${blocks[0]?.header.getBlockNumber()} to ${blocks.at(-1)?.header.getBlockNumber()}`, {
|
|
35
|
-
blocks: blocks.map((b)=>b.toBlockInfo())
|
|
36
|
-
});
|
|
37
|
-
const messagesInEpoch = [];
|
|
38
|
-
let previousSlotNumber = SlotNumber.ZERO;
|
|
39
|
-
let checkpointIndex = -1;
|
|
40
|
-
for (const block of blocks){
|
|
41
|
-
const slotNumber = block.header.globalVariables.slotNumber;
|
|
42
|
-
if (slotNumber !== previousSlotNumber) {
|
|
43
|
-
checkpointIndex++;
|
|
44
|
-
messagesInEpoch[checkpointIndex] = [];
|
|
45
|
-
previousSlotNumber = slotNumber;
|
|
46
|
-
}
|
|
47
|
-
messagesInEpoch[checkpointIndex].push(block.body.txEffects.map((txEffect)=>txEffect.l2ToL1Msgs));
|
|
48
|
-
}
|
|
49
|
-
const outHash = computeEpochOutHash(messagesInEpoch);
|
|
50
|
-
if (!outHash.isZero()) {
|
|
51
|
-
await this.rollupCheatCodes.insertOutbox(epoch, messagesInEpoch.length, outHash.toBigInt());
|
|
52
|
-
} else {
|
|
53
|
-
this.log.info(`No L2 to L1 messages in epoch ${epoch}`);
|
|
54
|
-
}
|
|
55
|
-
const lastCheckpoint = blocks.at(-1)?.checkpointNumber;
|
|
56
35
|
if (lastCheckpoint !== undefined) {
|
|
57
36
|
await this.rollupCheatCodes.markAsProven(lastCheckpoint);
|
|
58
37
|
} else {
|
package/dest/testing/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { AnvilTestWatcher, type AnvilTestWatcherOpts } 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';
|
|
4
|
+
export { setupLocalNetwork, TEST_FEE_PADDING, type LocalNetwork, type LocalNetworkOptions } from './local-network.js';
|
|
5
5
|
export { getTokenAllowedSetupFunctions } from './token_allowed_setup.js';
|
|
6
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
6
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy90ZXN0aW5nL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxhQUFhLEVBQUUsZ0JBQWdCLEVBQUUsTUFBTSxzQkFBc0IsQ0FBQztBQUN2RSxPQUFPLEVBQUUsVUFBVSxFQUFFLE1BQU0sa0JBQWtCLENBQUM7QUFDOUMsT0FBTyxFQUFFLGdCQUFnQixFQUFFLE1BQU0seUJBQXlCLENBQUM7QUFDM0QsT0FBTyxFQUFFLGlCQUFpQixFQUFFLGdCQUFnQixFQUFFLEtBQUssWUFBWSxFQUFFLEtBQUssbUJBQW1CLEVBQUUsTUFBTSxvQkFBb0IsQ0FBQztBQUN0SCxPQUFPLEVBQUUsNkJBQTZCLEVBQUUsTUFBTSwwQkFBMEIsQ0FBQyJ9
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/testing/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
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,iBAAiB,EAAE,gBAAgB,EAAE,KAAK,YAAY,EAAE,KAAK,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACtH,OAAO,EAAE,6BAA6B,EAAE,MAAM,0BAA0B,CAAC"}
|
package/dest/testing/index.js
CHANGED
|
@@ -1,5 +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';
|
|
4
|
+
export { setupLocalNetwork, TEST_FEE_PADDING } from './local-network.js';
|
|
5
5
|
export { getTokenAllowedSetupFunctions } from './token_allowed_setup.js';
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { AztecNodeService } from '@aztec/aztec-node';
|
|
2
|
+
import type { AztecNodeConfig } from '@aztec/aztec-node/config';
|
|
3
|
+
import type { Fr } from '@aztec/aztec.js/fields';
|
|
4
|
+
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
5
|
+
/** A running in-process local network: an inline Aztec node backed by its own anvil L1. */
|
|
6
|
+
export interface LocalNetwork extends AsyncDisposable {
|
|
7
|
+
/** Fully-synced Aztec node, ready to serve client requests. */
|
|
8
|
+
node: AztecNodeService;
|
|
9
|
+
/** RPC URL of the spawned anvil instance. */
|
|
10
|
+
l1RpcUrl: string;
|
|
11
|
+
/** Chain id used on L1 (foundry's default 31337). */
|
|
12
|
+
l1ChainId: number;
|
|
13
|
+
/** Stops every process started by the fixture: node and anvil. Also invoked by `await using`. */
|
|
14
|
+
stop: () => Promise<void>;
|
|
15
|
+
}
|
|
16
|
+
/** Options for {@link setupLocalNetwork}. */
|
|
17
|
+
export interface LocalNetworkOptions {
|
|
18
|
+
/**
|
|
19
|
+
* Addresses that should hold fee juice at genesis. Saves each of these the round-trip of bridging
|
|
20
|
+
* + claiming fee juice before they can pay for gas.
|
|
21
|
+
*/
|
|
22
|
+
fundedAddresses?: AztecAddress[];
|
|
23
|
+
/** Override the default per-address genesis fee juice granted to {@link fundedAddresses}. */
|
|
24
|
+
initialAccountFeeJuice?: Fr;
|
|
25
|
+
/** Node config overrides, e.g. `realProofs`, `aztecEpochDuration`, `p2pEnabled`. */
|
|
26
|
+
config?: Partial<AztecNodeConfig>;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Spin up an in-process local network with the given addresses pre-funded.
|
|
30
|
+
*
|
|
31
|
+
* Each call spawns its own anvil on an OS-assigned random port and runs the Aztec node inline via
|
|
32
|
+
* the same {@link createLocalNetwork} codepath that backs `aztec start --local-network` (with the
|
|
33
|
+
* sandbox account/FPC/token setup skipped). Distinct ports let independent suites run in parallel.
|
|
34
|
+
* The caller must `await result.stop()` in its teardown (or hold the result with `await using`).
|
|
35
|
+
*
|
|
36
|
+
* Requires a Foundry toolchain (`anvil`/`forge`), installed via `aztec-up` or `foundryup`. Binaries
|
|
37
|
+
* are located in the standard install directories or on `PATH`; set `$ANVIL_BIN` / `$FORGE_BIN` to
|
|
38
|
+
* pin specific ones.
|
|
39
|
+
*/
|
|
40
|
+
export declare function setupLocalNetwork(opts?: LocalNetworkOptions): Promise<LocalNetwork>;
|
|
41
|
+
/**
|
|
42
|
+
* Min-fee padding multiplier for test wallets whose txs may mine well after their fee estimate.
|
|
43
|
+
* The automine sequencer builds one block per tx and advances L1 time in big jumps, and proposer
|
|
44
|
+
* pipelining evolves the fee-asset price across the build/publish gap (~20x observed in CI), so the
|
|
45
|
+
* network's congestion base fee can swing sharply between the wallet's fee estimate and the block
|
|
46
|
+
* the tx actually lands in. The default wallet padding isn't enough and trips
|
|
47
|
+
* `maxFeesPerGas.feePerL2Gas must be >= gasFees.feePerL2Gas`. Apply via
|
|
48
|
+
* `wallet.setMinFeePadding(TEST_FEE_PADDING)` on every test wallet that sends txs.
|
|
49
|
+
*/
|
|
50
|
+
export declare const TEST_FEE_PADDING = 30;
|
|
51
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibG9jYWwtbmV0d29yay5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3Rlc3RpbmcvbG9jYWwtbmV0d29yay50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssRUFBRSxnQkFBZ0IsRUFBRSxNQUFNLG1CQUFtQixDQUFDO0FBQzFELE9BQU8sS0FBSyxFQUFFLGVBQWUsRUFBRSxNQUFNLDBCQUEwQixDQUFDO0FBQ2hFLE9BQU8sS0FBSyxFQUFFLEVBQUUsRUFBRSxNQUFNLHdCQUF3QixDQUFDO0FBRWpELE9BQU8sS0FBSyxFQUFFLFlBQVksRUFBRSxNQUFNLDZCQUE2QixDQUFDO0FBTWhFLDJGQUEyRjtBQUMzRixNQUFNLFdBQVcsWUFBYSxTQUFRLGVBQWU7SUFDbkQsK0RBQStEO0lBQy9ELElBQUksRUFBRSxnQkFBZ0IsQ0FBQztJQUN2Qiw2Q0FBNkM7SUFDN0MsUUFBUSxFQUFFLE1BQU0sQ0FBQztJQUNqQixxREFBcUQ7SUFDckQsU0FBUyxFQUFFLE1BQU0sQ0FBQztJQUNsQixpR0FBaUc7SUFDakcsSUFBSSxFQUFFLE1BQU0sT0FBTyxDQUFDLElBQUksQ0FBQyxDQUFDO0NBQzNCO0FBRUQsNkNBQTZDO0FBQzdDLE1BQU0sV0FBVyxtQkFBbUI7SUFDbEM7OztPQUdHO0lBQ0gsZUFBZSxDQUFDLEVBQUUsWUFBWSxFQUFFLENBQUM7SUFDakMsNkZBQTZGO0lBQzdGLHNCQUFzQixDQUFDLEVBQUUsRUFBRSxDQUFDO0lBQzVCLG9GQUFvRjtJQUNwRixNQUFNLENBQUMsRUFBRSxPQUFPLENBQUMsZUFBZSxDQUFDLENBQUM7Q0FDbkM7QUFFRDs7Ozs7Ozs7Ozs7R0FXRztBQUNILHdCQUFzQixpQkFBaUIsQ0FBQyxJQUFJLEdBQUUsbUJBQXdCLEdBQUcsT0FBTyxDQUFDLFlBQVksQ0FBQyxDQXNDN0Y7QUFFRDs7Ozs7Ozs7R0FRRztBQUNILGVBQU8sTUFBTSxnQkFBZ0IsS0FBSyxDQUFDIn0=
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"local-network.d.ts","sourceRoot":"","sources":["../../src/testing/local-network.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,wBAAwB,CAAC;AAEjD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAMhE,2FAA2F;AAC3F,MAAM,WAAW,YAAa,SAAQ,eAAe;IACnD,+DAA+D;IAC/D,IAAI,EAAE,gBAAgB,CAAC;IACvB,6CAA6C;IAC7C,QAAQ,EAAE,MAAM,CAAC;IACjB,qDAAqD;IACrD,SAAS,EAAE,MAAM,CAAC;IAClB,iGAAiG;IACjG,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3B;AAED,6CAA6C;AAC7C,MAAM,WAAW,mBAAmB;IAClC;;;OAGG;IACH,eAAe,CAAC,EAAE,YAAY,EAAE,CAAC;IACjC,6FAA6F;IAC7F,sBAAsB,CAAC,EAAE,EAAE,CAAC;IAC5B,oFAAoF;IACpF,MAAM,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,CAAC;CACnC;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,iBAAiB,CAAC,IAAI,GAAE,mBAAwB,GAAG,OAAO,CAAC,YAAY,CAAC,CAsC7F;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,gBAAgB,KAAK,CAAC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { startAnvil } from '@aztec/ethereum/test';
|
|
2
|
+
import { foundry } from 'viem/chains';
|
|
3
|
+
import { createLocalNetwork } from '../local-network/local-network.js';
|
|
4
|
+
/**
|
|
5
|
+
* Spin up an in-process local network with the given addresses pre-funded.
|
|
6
|
+
*
|
|
7
|
+
* Each call spawns its own anvil on an OS-assigned random port and runs the Aztec node inline via
|
|
8
|
+
* the same {@link createLocalNetwork} codepath that backs `aztec start --local-network` (with the
|
|
9
|
+
* sandbox account/FPC/token setup skipped). Distinct ports let independent suites run in parallel.
|
|
10
|
+
* The caller must `await result.stop()` in its teardown (or hold the result with `await using`).
|
|
11
|
+
*
|
|
12
|
+
* Requires a Foundry toolchain (`anvil`/`forge`), installed via `aztec-up` or `foundryup`. Binaries
|
|
13
|
+
* are located in the standard install directories or on `PATH`; set `$ANVIL_BIN` / `$FORGE_BIN` to
|
|
14
|
+
* pin specific ones.
|
|
15
|
+
*/ export async function setupLocalNetwork(opts = {}) {
|
|
16
|
+
// `--port 0` → anvil binds an ephemeral port that `startAnvil` reads back, so parallel suites
|
|
17
|
+
// never collide on a fixed port.
|
|
18
|
+
const { rpcUrl, stop: stopAnvil } = await startAnvil({
|
|
19
|
+
port: 0
|
|
20
|
+
});
|
|
21
|
+
try {
|
|
22
|
+
const { node, stop: stopNode } = await createLocalNetwork({
|
|
23
|
+
...opts.config,
|
|
24
|
+
l1RpcUrls: [
|
|
25
|
+
rpcUrl
|
|
26
|
+
],
|
|
27
|
+
testAccounts: false,
|
|
28
|
+
prefundAddresses: (opts.fundedAddresses ?? []).map((a)=>a.toString()),
|
|
29
|
+
initialAccountFeeJuice: opts.initialAccountFeeJuice
|
|
30
|
+
}, ()=>{});
|
|
31
|
+
// Stop the node before anvil (its teardown still talks to L1); the finally guarantees anvil is
|
|
32
|
+
// reaped even if node shutdown throws.
|
|
33
|
+
const stop = async ()=>{
|
|
34
|
+
try {
|
|
35
|
+
await stopNode();
|
|
36
|
+
} finally{
|
|
37
|
+
await stopAnvil();
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
return {
|
|
41
|
+
node,
|
|
42
|
+
l1RpcUrl: rpcUrl,
|
|
43
|
+
l1ChainId: foundry.id,
|
|
44
|
+
stop,
|
|
45
|
+
[Symbol.asyncDispose]: stop
|
|
46
|
+
};
|
|
47
|
+
} catch (err) {
|
|
48
|
+
await stopAnvil();
|
|
49
|
+
throw err;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Min-fee padding multiplier for test wallets whose txs may mine well after their fee estimate.
|
|
54
|
+
* The automine sequencer builds one block per tx and advances L1 time in big jumps, and proposer
|
|
55
|
+
* pipelining evolves the fee-asset price across the build/publish gap (~20x observed in CI), so the
|
|
56
|
+
* network's congestion base fee can swing sharply between the wallet's fee estimate and the block
|
|
57
|
+
* the tx actually lands in. The default wallet padding isn't enough and trips
|
|
58
|
+
* `maxFeesPerGas.feePerL2Gas must be >= gasFees.feePerL2Gas`. Apply via
|
|
59
|
+
* `wallet.setMinFeePadding(TEST_FEE_PADDING)` on every test wallet that sends txs.
|
|
60
|
+
*/ export const TEST_FEE_PADDING = 30;
|
|
@@ -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
|
|
4
|
-
*
|
|
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,
|
|
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":"
|
|
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
|
|
6
|
-
*
|
|
7
|
-
|
|
8
|
-
|
|
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
|
-
//
|
|
14
|
-
buildAllowedElement(
|
|
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
|
-
//
|
|
18
|
-
buildAllowedElement(
|
|
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.
|
|
3
|
+
"version": "0.0.1-commit.9a89641",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dest/index.js",
|
|
@@ -28,39 +28,39 @@
|
|
|
28
28
|
"../package.common.json"
|
|
29
29
|
],
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@aztec/accounts": "0.0.1-commit.
|
|
32
|
-
"@aztec/archiver": "0.0.1-commit.
|
|
33
|
-
"@aztec/aztec-node": "0.0.1-commit.
|
|
34
|
-
"@aztec/aztec.js": "0.0.1-commit.
|
|
35
|
-
"@aztec/bb-prover": "0.0.1-commit.
|
|
36
|
-
"@aztec/bb.js": "0.0
|
|
37
|
-
"@aztec/blob-client": "0.0.1-commit.
|
|
38
|
-
"@aztec/bot": "0.0.1-commit.
|
|
39
|
-
"@aztec/builder": "0.0.1-commit.
|
|
40
|
-
"@aztec/cli": "0.0.1-commit.
|
|
41
|
-
"@aztec/constants": "0.0.1-commit.
|
|
42
|
-
"@aztec/entrypoints": "0.0.1-commit.
|
|
43
|
-
"@aztec/ethereum": "0.0.1-commit.
|
|
44
|
-
"@aztec/foundation": "0.0.1-commit.
|
|
45
|
-
"@aztec/kv-store": "0.0.1-commit.
|
|
46
|
-
"@aztec/l1-artifacts": "0.0
|
|
47
|
-
"@aztec/node-lib": "0.0.1-commit.
|
|
48
|
-
"@aztec/noir-contracts.js": "0.0.1-commit.
|
|
49
|
-
"@aztec/noir-protocol-circuits-types": "0.0.1-commit.
|
|
50
|
-
"@aztec/p2p": "0.0.1-commit.
|
|
51
|
-
"@aztec/p2p-bootstrap": "0.0.1-commit.
|
|
52
|
-
"@aztec/protocol-contracts": "0.0.1-commit.
|
|
53
|
-
"@aztec/prover-client": "0.0.1-commit.
|
|
54
|
-
"@aztec/prover-node": "0.0.1-commit.
|
|
55
|
-
"@aztec/pxe": "0.0.1-commit.
|
|
56
|
-
"@aztec/sequencer-client": "0.0.1-commit.
|
|
57
|
-
"@aztec/standard-contracts": "0.0.1-commit.
|
|
58
|
-
"@aztec/stdlib": "0.0.1-commit.
|
|
59
|
-
"@aztec/telemetry-client": "0.0.1-commit.
|
|
60
|
-
"@aztec/txe": "0.0.1-commit.
|
|
61
|
-
"@aztec/validator-ha-signer": "0.0.1-commit.
|
|
62
|
-
"@aztec/wallets": "0.0.1-commit.
|
|
63
|
-
"@aztec/world-state": "0.0.1-commit.
|
|
31
|
+
"@aztec/accounts": "0.0.1-commit.9a89641",
|
|
32
|
+
"@aztec/archiver": "0.0.1-commit.9a89641",
|
|
33
|
+
"@aztec/aztec-node": "0.0.1-commit.9a89641",
|
|
34
|
+
"@aztec/aztec.js": "0.0.1-commit.9a89641",
|
|
35
|
+
"@aztec/bb-prover": "0.0.1-commit.9a89641",
|
|
36
|
+
"@aztec/bb.js": "6.0.0-nightly.20260807",
|
|
37
|
+
"@aztec/blob-client": "0.0.1-commit.9a89641",
|
|
38
|
+
"@aztec/bot": "0.0.1-commit.9a89641",
|
|
39
|
+
"@aztec/builder": "0.0.1-commit.9a89641",
|
|
40
|
+
"@aztec/cli": "0.0.1-commit.9a89641",
|
|
41
|
+
"@aztec/constants": "0.0.1-commit.9a89641",
|
|
42
|
+
"@aztec/entrypoints": "0.0.1-commit.9a89641",
|
|
43
|
+
"@aztec/ethereum": "0.0.1-commit.9a89641",
|
|
44
|
+
"@aztec/foundation": "0.0.1-commit.9a89641",
|
|
45
|
+
"@aztec/kv-store": "0.0.1-commit.9a89641",
|
|
46
|
+
"@aztec/l1-artifacts": "6.0.0-nightly.20260807",
|
|
47
|
+
"@aztec/node-lib": "0.0.1-commit.9a89641",
|
|
48
|
+
"@aztec/noir-contracts.js": "0.0.1-commit.9a89641",
|
|
49
|
+
"@aztec/noir-protocol-circuits-types": "0.0.1-commit.9a89641",
|
|
50
|
+
"@aztec/p2p": "0.0.1-commit.9a89641",
|
|
51
|
+
"@aztec/p2p-bootstrap": "0.0.1-commit.9a89641",
|
|
52
|
+
"@aztec/protocol-contracts": "0.0.1-commit.9a89641",
|
|
53
|
+
"@aztec/prover-client": "0.0.1-commit.9a89641",
|
|
54
|
+
"@aztec/prover-node": "0.0.1-commit.9a89641",
|
|
55
|
+
"@aztec/pxe": "0.0.1-commit.9a89641",
|
|
56
|
+
"@aztec/sequencer-client": "0.0.1-commit.9a89641",
|
|
57
|
+
"@aztec/standard-contracts": "0.0.1-commit.9a89641",
|
|
58
|
+
"@aztec/stdlib": "0.0.1-commit.9a89641",
|
|
59
|
+
"@aztec/telemetry-client": "0.0.1-commit.9a89641",
|
|
60
|
+
"@aztec/txe": "0.0.1-commit.9a89641",
|
|
61
|
+
"@aztec/validator-ha-signer": "0.0.1-commit.9a89641",
|
|
62
|
+
"@aztec/wallets": "0.0.1-commit.9a89641",
|
|
63
|
+
"@aztec/world-state": "0.0.1-commit.9a89641",
|
|
64
64
|
"@iarna/toml": "^2.2.5",
|
|
65
65
|
"@types/chalk": "^2.2.0",
|
|
66
66
|
"abitype": "^0.8.11",
|
|
@@ -4,7 +4,7 @@ use aztec::macros::aztec;
|
|
|
4
4
|
pub contract Counter {
|
|
5
5
|
use aztec::{
|
|
6
6
|
macros::{functions::{external, initializer}, storage::storage},
|
|
7
|
-
messages::
|
|
7
|
+
messages::delivery::MessageDelivery,
|
|
8
8
|
protocol::address::AztecAddress,
|
|
9
9
|
state_vars::Owned,
|
|
10
10
|
};
|
|
@@ -24,17 +24,17 @@ pub contract Counter {
|
|
|
24
24
|
#[initializer]
|
|
25
25
|
#[external("private")]
|
|
26
26
|
fn constructor(initial_value: u128, owner: AztecAddress) {
|
|
27
|
-
// Delivers the note to the recipient onchain
|
|
27
|
+
// Delivers the note to the recipient onchain.
|
|
28
28
|
// Without delivery, the recipient can't find or decrypt the note.
|
|
29
29
|
self.storage.counters.at(owner).add(initial_value).deliver(
|
|
30
|
-
MessageDelivery::
|
|
30
|
+
MessageDelivery::onchain_unconstrained(),
|
|
31
31
|
);
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
// Adds 1 to the owner's counter.
|
|
35
35
|
#[external("private")]
|
|
36
36
|
fn increment(owner: AztecAddress) {
|
|
37
|
-
self.storage.counters.at(owner).add(1).deliver(MessageDelivery::
|
|
37
|
+
self.storage.counters.at(owner).add(1).deliver(MessageDelivery::onchain_unconstrained());
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
// Returns the current value of the owner's counter.
|
package/src/bin/index.ts
CHANGED
|
@@ -18,6 +18,7 @@ import { Command } from 'commander';
|
|
|
18
18
|
import { injectCompileCommand } from '../cli/cmds/compile.js';
|
|
19
19
|
import { injectMigrateCommand } from '../cli/cmds/migrate_ha_db.js';
|
|
20
20
|
import { injectProfileCommand } from '../cli/cmds/profile.js';
|
|
21
|
+
import { injectProverCommand } from '../cli/cmds/prover.js';
|
|
21
22
|
import { injectAztecCommands } from '../cli/index.js';
|
|
22
23
|
|
|
23
24
|
const NETWORK_FLAG = 'network';
|
|
@@ -61,6 +62,7 @@ async function main() {
|
|
|
61
62
|
program = injectCompileCommand(program, userLog);
|
|
62
63
|
program = injectProfileCommand(program, userLog);
|
|
63
64
|
program = injectMigrateCommand(program, userLog);
|
|
65
|
+
program = injectProverCommand(program, userLog);
|
|
64
66
|
|
|
65
67
|
await program.parseAsync(process.argv);
|
|
66
68
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { registerAztecNodeRpcHandlers } from '@aztec/aztec-node';
|
|
1
2
|
import { getActiveNetworkName } from '@aztec/foundation/config';
|
|
2
3
|
import {
|
|
3
4
|
type NamespacedApiHandlers,
|
|
@@ -7,7 +8,6 @@ import {
|
|
|
7
8
|
} from '@aztec/foundation/json-rpc/server';
|
|
8
9
|
import type { LogFn, Logger } from '@aztec/foundation/log';
|
|
9
10
|
import type { ChainConfig } from '@aztec/stdlib/config';
|
|
10
|
-
import { AztecNodeAdminApiSchema, AztecNodeApiSchema, AztecNodeDebugApiSchema } from '@aztec/stdlib/interfaces/client';
|
|
11
11
|
import { getPackageVersion } from '@aztec/stdlib/update-checker';
|
|
12
12
|
import { getVersioningMiddleware } from '@aztec/stdlib/versioning';
|
|
13
13
|
import { getOtelJsonRpcDiagnosticsMiddleware, getOtelJsonRpcPropagationMiddleware } from '@aztec/telemetry-client';
|
|
@@ -36,21 +36,13 @@ export async function aztecStart(options: any, userLog: LogFn, debugLogger: Logg
|
|
|
36
36
|
l1Mnemonic: localNetwork.l1Mnemonic,
|
|
37
37
|
l1RpcUrls: options.l1RpcUrls,
|
|
38
38
|
testAccounts: localNetwork.testAccounts,
|
|
39
|
-
realProofs: false,
|
|
40
|
-
// Setting the epoch duration to 2 by default for local network. This allows the epoch to be "proven" faster, so
|
|
41
|
-
// the users can consume out hash without having to wait for a long time.
|
|
42
|
-
// Note: We are not proving anything in the local network (realProofs == false). But in `createLocalNetwork`,
|
|
43
|
-
// the EpochTestSettler will set the out hash to the outbox when an epoch is complete.
|
|
44
|
-
aztecEpochDuration: 2,
|
|
45
39
|
},
|
|
46
40
|
userLog,
|
|
47
41
|
);
|
|
48
42
|
|
|
49
43
|
// Start Node and PXE JSON-RPC server
|
|
50
44
|
signalHandlers.push(stop);
|
|
51
|
-
|
|
52
|
-
adminServices.node = [node, AztecNodeAdminApiSchema];
|
|
53
|
-
services.nodeDebug = [node, AztecNodeDebugApiSchema];
|
|
45
|
+
registerAztecNodeRpcHandlers(node, services, adminServices, { debug: true });
|
|
54
46
|
} else {
|
|
55
47
|
// Route --prover-node through startNode
|
|
56
48
|
if (options.proverNode && !options.node) {
|
|
@@ -61,9 +53,6 @@ export async function aztecStart(options: any, userLog: LogFn, debugLogger: Logg
|
|
|
61
53
|
const { startNode } = await import('./cmds/start_node.js');
|
|
62
54
|
const networkName = getActiveNetworkName(options.network);
|
|
63
55
|
({ config } = await startNode(options, signalHandlers, services, adminServices, userLog, networkName));
|
|
64
|
-
if (options.nodeDebug && services.node) {
|
|
65
|
-
services.nodeDebug = [services.node[0], AztecNodeDebugApiSchema];
|
|
66
|
-
}
|
|
67
56
|
} else if (options.bot) {
|
|
68
57
|
const { startBot } = await import('./cmds/start_bot.js');
|
|
69
58
|
await startBot(options, signalHandlers, services, userLog);
|
|
@@ -94,6 +83,12 @@ export async function aztecStart(options: any, userLog: LogFn, debugLogger: Logg
|
|
|
94
83
|
|
|
95
84
|
// Start the main JSON-RPC server
|
|
96
85
|
if (Object.entries(services).length > 0) {
|
|
86
|
+
if (services.aztec) {
|
|
87
|
+
const { BarretenbergSync } = await import('@aztec/bb.js');
|
|
88
|
+
// JSON-RPC schema parsing may decompress compressed Chonk proofs before the node handler runs.
|
|
89
|
+
await BarretenbergSync.initSingleton();
|
|
90
|
+
}
|
|
91
|
+
|
|
97
92
|
const rpcServer = createNamespacedSafeJsonRpcServer(services, {
|
|
98
93
|
diagnostic: getOtelJsonRpcDiagnosticsMiddleware(),
|
|
99
94
|
http200OnError: false,
|
|
@@ -109,7 +109,7 @@ export const aztecStartOptions: { [key: string]: AztecStartOption[] } = {
|
|
|
109
109
|
env: 'NETWORK',
|
|
110
110
|
},
|
|
111
111
|
|
|
112
|
-
configToFlag('--enable-
|
|
112
|
+
configToFlag('--enable-auto-shutdown', sharedNodeConfigMappings.enableAutoShutdown),
|
|
113
113
|
|
|
114
114
|
configToFlag('--sync-mode', sharedNodeConfigMappings.syncMode),
|
|
115
115
|
configToFlag('--snapshots-urls', sharedNodeConfigMappings.snapshotsUrls),
|