@aztec/aztec.js 0.87.3-nightly.20250529 → 0.87.4
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/contract/proven_tx.js +2 -2
- package/dest/test/anvil_test_watcher.d.ts +2 -3
- package/dest/test/anvil_test_watcher.d.ts.map +1 -1
- package/dest/test/anvil_test_watcher.js +14 -15
- package/package.json +8 -8
- package/src/contract/proven_tx.ts +2 -2
- package/src/test/anvil_test_watcher.ts +15 -16
|
@@ -7,11 +7,11 @@ import { SentTx } from './sent_tx.js';
|
|
|
7
7
|
timings;
|
|
8
8
|
constructor(wallet, tx, // eslint-disable-next-line jsdoc/require-jsdoc
|
|
9
9
|
timings){
|
|
10
|
-
super(tx.data, tx.clientIvcProof, tx.
|
|
10
|
+
super(tx.data, tx.clientIvcProof, tx.contractClassLogs, tx.publicFunctionCalldata), this.wallet = wallet, this.timings = timings;
|
|
11
11
|
}
|
|
12
12
|
// Clone the TX data to get a serializable object.
|
|
13
13
|
getPlainDataTx() {
|
|
14
|
-
return new Tx(this.data, this.clientIvcProof, this.
|
|
14
|
+
return new Tx(this.data, this.clientIvcProof, this.contractClassLogs, this.publicFunctionCalldata);
|
|
15
15
|
}
|
|
16
16
|
/**
|
|
17
17
|
* Sends the transaction to the network via the provided wallet.
|
|
@@ -15,9 +15,8 @@ export declare class AnvilTestWatcher {
|
|
|
15
15
|
private isSandbox;
|
|
16
16
|
private rollup;
|
|
17
17
|
private rollupCheatCodes;
|
|
18
|
-
private l2SlotDuration;
|
|
19
18
|
private filledRunningPromise?;
|
|
20
|
-
private
|
|
19
|
+
private mineIfOutdatedPromise?;
|
|
21
20
|
private markingAsProvenRunningPromise?;
|
|
22
21
|
private logger;
|
|
23
22
|
private isMarkingAsProven;
|
|
@@ -28,7 +27,7 @@ export declare class AnvilTestWatcher {
|
|
|
28
27
|
stop(): Promise<void>;
|
|
29
28
|
trigger(): Promise<void>;
|
|
30
29
|
markAsProven(): Promise<void>;
|
|
31
|
-
|
|
30
|
+
mineIfOutdated(): Promise<void>;
|
|
32
31
|
warpTimeIfNeeded(): Promise<void>;
|
|
33
32
|
}
|
|
34
33
|
//# sourceMappingURL=anvil_test_watcher.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"anvil_test_watcher.d.ts","sourceRoot":"","sources":["../../src/test/anvil_test_watcher.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAGhE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAOhE;;;;;;GAMG;AACH,qBAAa,gBAAgB;
|
|
1
|
+
{"version":3,"file":"anvil_test_watcher.d.ts","sourceRoot":"","sources":["../../src/test/anvil_test_watcher.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAGhE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAOhE;;;;;;GAMG;AACH,qBAAa,gBAAgB;IAezB,OAAO,CAAC,UAAU;IAGlB,OAAO,CAAC,YAAY,CAAC;IAjBvB,OAAO,CAAC,SAAS,CAAkB;IAEnC,OAAO,CAAC,MAAM,CAAsD;IACpE,OAAO,CAAC,gBAAgB,CAAmB;IAE3C,OAAO,CAAC,oBAAoB,CAAC,CAAiB;IAC9C,OAAO,CAAC,qBAAqB,CAAC,CAAiB;IAC/C,OAAO,CAAC,6BAA6B,CAAC,CAAiB;IAEvD,OAAO,CAAC,MAAM,CAAiD;IAE/D,OAAO,CAAC,iBAAiB,CAAQ;gBAGvB,UAAU,EAAE,aAAa,EACjC,aAAa,EAAE,UAAU,EACzB,QAAQ,EAAE,UAAU,EACZ,YAAY,CAAC,EAAE,gBAAgB,YAAA;IAezC,oBAAoB,CAAC,iBAAiB,EAAE,OAAO;IAI/C,YAAY,CAAC,SAAS,EAAE,OAAO;IAIzB,KAAK;IAwBL,IAAI;IAMJ,OAAO;IAMP,YAAY;IAOZ,cAAc;IAoBd,gBAAgB;CAwCvB"}
|
|
@@ -15,9 +15,8 @@ import { RollupCheatCodes } from './rollup_cheat_codes.js';
|
|
|
15
15
|
isSandbox;
|
|
16
16
|
rollup;
|
|
17
17
|
rollupCheatCodes;
|
|
18
|
-
l2SlotDuration;
|
|
19
18
|
filledRunningPromise;
|
|
20
|
-
|
|
19
|
+
mineIfOutdatedPromise;
|
|
21
20
|
markingAsProvenRunningPromise;
|
|
22
21
|
logger;
|
|
23
22
|
isMarkingAsProven;
|
|
@@ -47,8 +46,6 @@ import { RollupCheatCodes } from './rollup_cheat_codes.js';
|
|
|
47
46
|
if (this.filledRunningPromise) {
|
|
48
47
|
throw new Error('Watcher already watching for filled slot');
|
|
49
48
|
}
|
|
50
|
-
const config = await this.rollupCheatCodes.getConfig();
|
|
51
|
-
this.l2SlotDuration = config.slotDuration;
|
|
52
49
|
// If auto mining is not supported (e.g., we are on a real network), then we
|
|
53
50
|
// will simple do nothing. But if on an anvil or the like, this make sure that
|
|
54
51
|
// the sandbox and tests don't break because time is frozen and we never get to
|
|
@@ -57,8 +54,8 @@ import { RollupCheatCodes } from './rollup_cheat_codes.js';
|
|
|
57
54
|
if (isAutoMining) {
|
|
58
55
|
this.filledRunningPromise = new RunningPromise(()=>this.warpTimeIfNeeded(), this.logger, 200);
|
|
59
56
|
this.filledRunningPromise.start();
|
|
60
|
-
this.
|
|
61
|
-
this.
|
|
57
|
+
this.mineIfOutdatedPromise = new RunningPromise(()=>this.mineIfOutdated(), this.logger, 200);
|
|
58
|
+
this.mineIfOutdatedPromise.start();
|
|
62
59
|
this.markingAsProvenRunningPromise = new RunningPromise(()=>this.markAsProven(), this.logger, 200);
|
|
63
60
|
this.markingAsProvenRunningPromise.start();
|
|
64
61
|
this.logger.info(`Watcher started for rollup at ${this.rollup.address}`);
|
|
@@ -68,12 +65,12 @@ import { RollupCheatCodes } from './rollup_cheat_codes.js';
|
|
|
68
65
|
}
|
|
69
66
|
async stop() {
|
|
70
67
|
await this.filledRunningPromise?.stop();
|
|
71
|
-
await this.
|
|
68
|
+
await this.mineIfOutdatedPromise?.stop();
|
|
72
69
|
await this.markingAsProvenRunningPromise?.stop();
|
|
73
70
|
}
|
|
74
71
|
async trigger() {
|
|
75
72
|
await this.filledRunningPromise?.trigger();
|
|
76
|
-
await this.
|
|
73
|
+
await this.mineIfOutdatedPromise?.trigger();
|
|
77
74
|
await this.markingAsProvenRunningPromise?.trigger();
|
|
78
75
|
}
|
|
79
76
|
async markAsProven() {
|
|
@@ -82,19 +79,21 @@ import { RollupCheatCodes } from './rollup_cheat_codes.js';
|
|
|
82
79
|
}
|
|
83
80
|
await this.rollupCheatCodes.markAsProven();
|
|
84
81
|
}
|
|
85
|
-
async
|
|
82
|
+
async mineIfOutdated() {
|
|
86
83
|
// this doesn't apply to the sandbox, because we don't have a date provider in the sandbox
|
|
87
84
|
if (!this.dateProvider) {
|
|
88
85
|
return;
|
|
89
86
|
}
|
|
90
87
|
const l1Time = await this.cheatcodes.timestamp() * 1000;
|
|
91
88
|
const wallTime = this.dateProvider.now();
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
this.
|
|
97
|
-
await this.cheatcodes.
|
|
89
|
+
// If the wall time is more than 24 seconds away from L1 time,
|
|
90
|
+
// mine a block and sync the clocks
|
|
91
|
+
if (Math.abs(wallTime - l1Time) > 24 * 1000) {
|
|
92
|
+
this.logger.warn(`Wall time is more than 24 seconds away from L1 time, mining a block and syncing clocks`);
|
|
93
|
+
await this.cheatcodes.evmMine();
|
|
94
|
+
const newL1Time = await this.cheatcodes.timestamp();
|
|
95
|
+
this.logger.info(`New L1 time: ${newL1Time}`);
|
|
96
|
+
this.dateProvider.setTime(newL1Time * 1000);
|
|
98
97
|
}
|
|
99
98
|
}
|
|
100
99
|
async warpTimeIfNeeded() {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/aztec.js",
|
|
3
3
|
"homepage": "https://github.com/AztecProtocol/aztec-packages/tree/master/yarn-project/aztec.js",
|
|
4
|
-
"version": "0.87.
|
|
4
|
+
"version": "0.87.4",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
7
7
|
".": "./dest/index.js",
|
|
@@ -78,13 +78,13 @@
|
|
|
78
78
|
]
|
|
79
79
|
},
|
|
80
80
|
"dependencies": {
|
|
81
|
-
"@aztec/constants": "0.87.
|
|
82
|
-
"@aztec/entrypoints": "0.87.
|
|
83
|
-
"@aztec/ethereum": "0.87.
|
|
84
|
-
"@aztec/foundation": "0.87.
|
|
85
|
-
"@aztec/l1-artifacts": "0.87.
|
|
86
|
-
"@aztec/protocol-contracts": "0.87.
|
|
87
|
-
"@aztec/stdlib": "0.87.
|
|
81
|
+
"@aztec/constants": "0.87.4",
|
|
82
|
+
"@aztec/entrypoints": "0.87.4",
|
|
83
|
+
"@aztec/ethereum": "0.87.4",
|
|
84
|
+
"@aztec/foundation": "0.87.4",
|
|
85
|
+
"@aztec/l1-artifacts": "0.87.4",
|
|
86
|
+
"@aztec/protocol-contracts": "0.87.4",
|
|
87
|
+
"@aztec/stdlib": "0.87.4",
|
|
88
88
|
"axios": "^1.8.2",
|
|
89
89
|
"tslib": "^2.4.0",
|
|
90
90
|
"viem": "2.23.7"
|
|
@@ -13,12 +13,12 @@ export class ProvenTx extends Tx {
|
|
|
13
13
|
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
14
14
|
public timings?: ProvingTimings,
|
|
15
15
|
) {
|
|
16
|
-
super(tx.data, tx.clientIvcProof, tx.
|
|
16
|
+
super(tx.data, tx.clientIvcProof, tx.contractClassLogs, tx.publicFunctionCalldata);
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
// Clone the TX data to get a serializable object.
|
|
20
20
|
protected getPlainDataTx(): Tx {
|
|
21
|
-
return new Tx(this.data, this.clientIvcProof, this.
|
|
21
|
+
return new Tx(this.data, this.clientIvcProof, this.contractClassLogs, this.publicFunctionCalldata);
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
/**
|
|
@@ -22,10 +22,9 @@ export class AnvilTestWatcher {
|
|
|
22
22
|
|
|
23
23
|
private rollup: GetContractReturnType<typeof RollupAbi, ViemClient>;
|
|
24
24
|
private rollupCheatCodes: RollupCheatCodes;
|
|
25
|
-
private l2SlotDuration!: bigint;
|
|
26
25
|
|
|
27
26
|
private filledRunningPromise?: RunningPromise;
|
|
28
|
-
private
|
|
27
|
+
private mineIfOutdatedPromise?: RunningPromise;
|
|
29
28
|
private markingAsProvenRunningPromise?: RunningPromise;
|
|
30
29
|
|
|
31
30
|
private logger: Logger = createLogger(`aztecjs:utils:watcher`);
|
|
@@ -64,9 +63,6 @@ export class AnvilTestWatcher {
|
|
|
64
63
|
throw new Error('Watcher already watching for filled slot');
|
|
65
64
|
}
|
|
66
65
|
|
|
67
|
-
const config = await this.rollupCheatCodes.getConfig();
|
|
68
|
-
this.l2SlotDuration = config.slotDuration;
|
|
69
|
-
|
|
70
66
|
// If auto mining is not supported (e.g., we are on a real network), then we
|
|
71
67
|
// will simple do nothing. But if on an anvil or the like, this make sure that
|
|
72
68
|
// the sandbox and tests don't break because time is frozen and we never get to
|
|
@@ -76,8 +72,8 @@ export class AnvilTestWatcher {
|
|
|
76
72
|
if (isAutoMining) {
|
|
77
73
|
this.filledRunningPromise = new RunningPromise(() => this.warpTimeIfNeeded(), this.logger, 200);
|
|
78
74
|
this.filledRunningPromise.start();
|
|
79
|
-
this.
|
|
80
|
-
this.
|
|
75
|
+
this.mineIfOutdatedPromise = new RunningPromise(() => this.mineIfOutdated(), this.logger, 200);
|
|
76
|
+
this.mineIfOutdatedPromise.start();
|
|
81
77
|
this.markingAsProvenRunningPromise = new RunningPromise(() => this.markAsProven(), this.logger, 200);
|
|
82
78
|
this.markingAsProvenRunningPromise.start();
|
|
83
79
|
this.logger.info(`Watcher started for rollup at ${this.rollup.address}`);
|
|
@@ -88,13 +84,13 @@ export class AnvilTestWatcher {
|
|
|
88
84
|
|
|
89
85
|
async stop() {
|
|
90
86
|
await this.filledRunningPromise?.stop();
|
|
91
|
-
await this.
|
|
87
|
+
await this.mineIfOutdatedPromise?.stop();
|
|
92
88
|
await this.markingAsProvenRunningPromise?.stop();
|
|
93
89
|
}
|
|
94
90
|
|
|
95
91
|
async trigger() {
|
|
96
92
|
await this.filledRunningPromise?.trigger();
|
|
97
|
-
await this.
|
|
93
|
+
await this.mineIfOutdatedPromise?.trigger();
|
|
98
94
|
await this.markingAsProvenRunningPromise?.trigger();
|
|
99
95
|
}
|
|
100
96
|
|
|
@@ -105,7 +101,7 @@ export class AnvilTestWatcher {
|
|
|
105
101
|
await this.rollupCheatCodes.markAsProven();
|
|
106
102
|
}
|
|
107
103
|
|
|
108
|
-
async
|
|
104
|
+
async mineIfOutdated() {
|
|
109
105
|
// this doesn't apply to the sandbox, because we don't have a date provider in the sandbox
|
|
110
106
|
if (!this.dateProvider) {
|
|
111
107
|
return;
|
|
@@ -113,12 +109,15 @@ export class AnvilTestWatcher {
|
|
|
113
109
|
|
|
114
110
|
const l1Time = (await this.cheatcodes.timestamp()) * 1000;
|
|
115
111
|
const wallTime = this.dateProvider.now();
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
this.logger.warn(`
|
|
121
|
-
await this.cheatcodes.
|
|
112
|
+
|
|
113
|
+
// If the wall time is more than 24 seconds away from L1 time,
|
|
114
|
+
// mine a block and sync the clocks
|
|
115
|
+
if (Math.abs(wallTime - l1Time) > 24 * 1000) {
|
|
116
|
+
this.logger.warn(`Wall time is more than 24 seconds away from L1 time, mining a block and syncing clocks`);
|
|
117
|
+
await this.cheatcodes.evmMine();
|
|
118
|
+
const newL1Time = await this.cheatcodes.timestamp();
|
|
119
|
+
this.logger.info(`New L1 time: ${newL1Time}`);
|
|
120
|
+
this.dateProvider.setTime(newL1Time * 1000);
|
|
122
121
|
}
|
|
123
122
|
}
|
|
124
123
|
|