@aztec/aztec.js 0.87.6 → 1.0.0-nightly.20250604
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 +3 -2
- package/dest/test/anvil_test_watcher.d.ts.map +1 -1
- package/dest/test/anvil_test_watcher.js +15 -14
- package/package.json +8 -8
- package/src/contract/proven_tx.ts +2 -2
- package/src/test/anvil_test_watcher.ts +16 -15
|
@@ -7,11 +7,11 @@ import { SentTx } from './sent_tx.js';
|
|
|
7
7
|
stats;
|
|
8
8
|
constructor(wallet, tx, // eslint-disable-next-line jsdoc/require-jsdoc
|
|
9
9
|
stats){
|
|
10
|
-
super(tx.data, tx.clientIvcProof, tx.
|
|
10
|
+
super(tx.data, tx.clientIvcProof, tx.contractClassLogFields, tx.publicFunctionCalldata), this.wallet = wallet, this.stats = stats;
|
|
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.contractClassLogFields, this.publicFunctionCalldata);
|
|
15
15
|
}
|
|
16
16
|
/**
|
|
17
17
|
* Sends the transaction to the network via the provided wallet.
|
|
@@ -15,8 +15,9 @@ export declare class AnvilTestWatcher {
|
|
|
15
15
|
private isSandbox;
|
|
16
16
|
private rollup;
|
|
17
17
|
private rollupCheatCodes;
|
|
18
|
+
private l2SlotDuration;
|
|
18
19
|
private filledRunningPromise?;
|
|
19
|
-
private
|
|
20
|
+
private syncDateProviderPromise?;
|
|
20
21
|
private markingAsProvenRunningPromise?;
|
|
21
22
|
private logger;
|
|
22
23
|
private isMarkingAsProven;
|
|
@@ -27,7 +28,7 @@ export declare class AnvilTestWatcher {
|
|
|
27
28
|
stop(): Promise<void>;
|
|
28
29
|
trigger(): Promise<void>;
|
|
29
30
|
markAsProven(): Promise<void>;
|
|
30
|
-
|
|
31
|
+
syncDateProviderToL1IfBehind(): Promise<void>;
|
|
31
32
|
warpTimeIfNeeded(): Promise<void>;
|
|
32
33
|
}
|
|
33
34
|
//# 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;IAgBzB,OAAO,CAAC,UAAU;IAGlB,OAAO,CAAC,YAAY,CAAC;IAlBvB,OAAO,CAAC,SAAS,CAAkB;IAEnC,OAAO,CAAC,MAAM,CAAsD;IACpE,OAAO,CAAC,gBAAgB,CAAmB;IAC3C,OAAO,CAAC,cAAc,CAAU;IAEhC,OAAO,CAAC,oBAAoB,CAAC,CAAiB;IAC9C,OAAO,CAAC,uBAAuB,CAAC,CAAiB;IACjD,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;IA2BL,IAAI;IAMJ,OAAO;IAMP,YAAY;IAOZ,4BAA4B;IAiB5B,gBAAgB;CAwCvB"}
|
|
@@ -15,8 +15,9 @@ import { RollupCheatCodes } from './rollup_cheat_codes.js';
|
|
|
15
15
|
isSandbox;
|
|
16
16
|
rollup;
|
|
17
17
|
rollupCheatCodes;
|
|
18
|
+
l2SlotDuration;
|
|
18
19
|
filledRunningPromise;
|
|
19
|
-
|
|
20
|
+
syncDateProviderPromise;
|
|
20
21
|
markingAsProvenRunningPromise;
|
|
21
22
|
logger;
|
|
22
23
|
isMarkingAsProven;
|
|
@@ -46,6 +47,8 @@ import { RollupCheatCodes } from './rollup_cheat_codes.js';
|
|
|
46
47
|
if (this.filledRunningPromise) {
|
|
47
48
|
throw new Error('Watcher already watching for filled slot');
|
|
48
49
|
}
|
|
50
|
+
const config = await this.rollupCheatCodes.getConfig();
|
|
51
|
+
this.l2SlotDuration = config.slotDuration;
|
|
49
52
|
// If auto mining is not supported (e.g., we are on a real network), then we
|
|
50
53
|
// will simple do nothing. But if on an anvil or the like, this make sure that
|
|
51
54
|
// the sandbox and tests don't break because time is frozen and we never get to
|
|
@@ -54,8 +57,8 @@ import { RollupCheatCodes } from './rollup_cheat_codes.js';
|
|
|
54
57
|
if (isAutoMining) {
|
|
55
58
|
this.filledRunningPromise = new RunningPromise(()=>this.warpTimeIfNeeded(), this.logger, 200);
|
|
56
59
|
this.filledRunningPromise.start();
|
|
57
|
-
this.
|
|
58
|
-
this.
|
|
60
|
+
this.syncDateProviderPromise = new RunningPromise(()=>this.syncDateProviderToL1IfBehind(), this.logger, 200);
|
|
61
|
+
this.syncDateProviderPromise.start();
|
|
59
62
|
this.markingAsProvenRunningPromise = new RunningPromise(()=>this.markAsProven(), this.logger, 200);
|
|
60
63
|
this.markingAsProvenRunningPromise.start();
|
|
61
64
|
this.logger.info(`Watcher started for rollup at ${this.rollup.address}`);
|
|
@@ -65,12 +68,12 @@ import { RollupCheatCodes } from './rollup_cheat_codes.js';
|
|
|
65
68
|
}
|
|
66
69
|
async stop() {
|
|
67
70
|
await this.filledRunningPromise?.stop();
|
|
68
|
-
await this.
|
|
71
|
+
await this.syncDateProviderPromise?.stop();
|
|
69
72
|
await this.markingAsProvenRunningPromise?.stop();
|
|
70
73
|
}
|
|
71
74
|
async trigger() {
|
|
72
75
|
await this.filledRunningPromise?.trigger();
|
|
73
|
-
await this.
|
|
76
|
+
await this.syncDateProviderPromise?.trigger();
|
|
74
77
|
await this.markingAsProvenRunningPromise?.trigger();
|
|
75
78
|
}
|
|
76
79
|
async markAsProven() {
|
|
@@ -79,21 +82,19 @@ import { RollupCheatCodes } from './rollup_cheat_codes.js';
|
|
|
79
82
|
}
|
|
80
83
|
await this.rollupCheatCodes.markAsProven();
|
|
81
84
|
}
|
|
82
|
-
async
|
|
85
|
+
async syncDateProviderToL1IfBehind() {
|
|
83
86
|
// this doesn't apply to the sandbox, because we don't have a date provider in the sandbox
|
|
84
87
|
if (!this.dateProvider) {
|
|
85
88
|
return;
|
|
86
89
|
}
|
|
87
90
|
const l1Time = await this.cheatcodes.timestamp() * 1000;
|
|
88
91
|
const wallTime = this.dateProvider.now();
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
this.logger.info(`New L1 time: ${newL1Time}`);
|
|
96
|
-
this.dateProvider.setTime(newL1Time * 1000);
|
|
92
|
+
if (l1Time > wallTime) {
|
|
93
|
+
this.logger.warn(`L1 is ahead of wall time. Syncing wall time to L1 time`);
|
|
94
|
+
this.dateProvider.setTime(l1Time);
|
|
95
|
+
} else if (l1Time + Number(this.l2SlotDuration) * 1000 < wallTime) {
|
|
96
|
+
this.logger.warn(`L1 is more than 1 L2 slot behind wall time. Warping to wall time`);
|
|
97
|
+
await this.cheatcodes.warp(Math.ceil(wallTime / 1000));
|
|
97
98
|
}
|
|
98
99
|
}
|
|
99
100
|
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.
|
|
4
|
+
"version": "1.0.0-nightly.20250604",
|
|
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.
|
|
82
|
-
"@aztec/entrypoints": "0.
|
|
83
|
-
"@aztec/ethereum": "0.
|
|
84
|
-
"@aztec/foundation": "0.
|
|
85
|
-
"@aztec/l1-artifacts": "0.
|
|
86
|
-
"@aztec/protocol-contracts": "0.
|
|
87
|
-
"@aztec/stdlib": "0.
|
|
81
|
+
"@aztec/constants": "1.0.0-nightly.20250604",
|
|
82
|
+
"@aztec/entrypoints": "1.0.0-nightly.20250604",
|
|
83
|
+
"@aztec/ethereum": "1.0.0-nightly.20250604",
|
|
84
|
+
"@aztec/foundation": "1.0.0-nightly.20250604",
|
|
85
|
+
"@aztec/l1-artifacts": "1.0.0-nightly.20250604",
|
|
86
|
+
"@aztec/protocol-contracts": "1.0.0-nightly.20250604",
|
|
87
|
+
"@aztec/stdlib": "1.0.0-nightly.20250604",
|
|
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 stats?: ProvingStats,
|
|
15
15
|
) {
|
|
16
|
-
super(tx.data, tx.clientIvcProof, tx.
|
|
16
|
+
super(tx.data, tx.clientIvcProof, tx.contractClassLogFields, 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.contractClassLogFields, this.publicFunctionCalldata);
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
/**
|
|
@@ -22,9 +22,10 @@ export class AnvilTestWatcher {
|
|
|
22
22
|
|
|
23
23
|
private rollup: GetContractReturnType<typeof RollupAbi, ViemClient>;
|
|
24
24
|
private rollupCheatCodes: RollupCheatCodes;
|
|
25
|
+
private l2SlotDuration!: bigint;
|
|
25
26
|
|
|
26
27
|
private filledRunningPromise?: RunningPromise;
|
|
27
|
-
private
|
|
28
|
+
private syncDateProviderPromise?: RunningPromise;
|
|
28
29
|
private markingAsProvenRunningPromise?: RunningPromise;
|
|
29
30
|
|
|
30
31
|
private logger: Logger = createLogger(`aztecjs:utils:watcher`);
|
|
@@ -63,6 +64,9 @@ export class AnvilTestWatcher {
|
|
|
63
64
|
throw new Error('Watcher already watching for filled slot');
|
|
64
65
|
}
|
|
65
66
|
|
|
67
|
+
const config = await this.rollupCheatCodes.getConfig();
|
|
68
|
+
this.l2SlotDuration = config.slotDuration;
|
|
69
|
+
|
|
66
70
|
// If auto mining is not supported (e.g., we are on a real network), then we
|
|
67
71
|
// will simple do nothing. But if on an anvil or the like, this make sure that
|
|
68
72
|
// the sandbox and tests don't break because time is frozen and we never get to
|
|
@@ -72,8 +76,8 @@ export class AnvilTestWatcher {
|
|
|
72
76
|
if (isAutoMining) {
|
|
73
77
|
this.filledRunningPromise = new RunningPromise(() => this.warpTimeIfNeeded(), this.logger, 200);
|
|
74
78
|
this.filledRunningPromise.start();
|
|
75
|
-
this.
|
|
76
|
-
this.
|
|
79
|
+
this.syncDateProviderPromise = new RunningPromise(() => this.syncDateProviderToL1IfBehind(), this.logger, 200);
|
|
80
|
+
this.syncDateProviderPromise.start();
|
|
77
81
|
this.markingAsProvenRunningPromise = new RunningPromise(() => this.markAsProven(), this.logger, 200);
|
|
78
82
|
this.markingAsProvenRunningPromise.start();
|
|
79
83
|
this.logger.info(`Watcher started for rollup at ${this.rollup.address}`);
|
|
@@ -84,13 +88,13 @@ export class AnvilTestWatcher {
|
|
|
84
88
|
|
|
85
89
|
async stop() {
|
|
86
90
|
await this.filledRunningPromise?.stop();
|
|
87
|
-
await this.
|
|
91
|
+
await this.syncDateProviderPromise?.stop();
|
|
88
92
|
await this.markingAsProvenRunningPromise?.stop();
|
|
89
93
|
}
|
|
90
94
|
|
|
91
95
|
async trigger() {
|
|
92
96
|
await this.filledRunningPromise?.trigger();
|
|
93
|
-
await this.
|
|
97
|
+
await this.syncDateProviderPromise?.trigger();
|
|
94
98
|
await this.markingAsProvenRunningPromise?.trigger();
|
|
95
99
|
}
|
|
96
100
|
|
|
@@ -101,7 +105,7 @@ export class AnvilTestWatcher {
|
|
|
101
105
|
await this.rollupCheatCodes.markAsProven();
|
|
102
106
|
}
|
|
103
107
|
|
|
104
|
-
async
|
|
108
|
+
async syncDateProviderToL1IfBehind() {
|
|
105
109
|
// this doesn't apply to the sandbox, because we don't have a date provider in the sandbox
|
|
106
110
|
if (!this.dateProvider) {
|
|
107
111
|
return;
|
|
@@ -109,15 +113,12 @@ export class AnvilTestWatcher {
|
|
|
109
113
|
|
|
110
114
|
const l1Time = (await this.cheatcodes.timestamp()) * 1000;
|
|
111
115
|
const wallTime = this.dateProvider.now();
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
if (
|
|
116
|
-
this.logger.warn(`
|
|
117
|
-
await this.cheatcodes.
|
|
118
|
-
const newL1Time = await this.cheatcodes.timestamp();
|
|
119
|
-
this.logger.info(`New L1 time: ${newL1Time}`);
|
|
120
|
-
this.dateProvider.setTime(newL1Time * 1000);
|
|
116
|
+
if (l1Time > wallTime) {
|
|
117
|
+
this.logger.warn(`L1 is ahead of wall time. Syncing wall time to L1 time`);
|
|
118
|
+
this.dateProvider.setTime(l1Time);
|
|
119
|
+
} else if (l1Time + Number(this.l2SlotDuration) * 1000 < wallTime) {
|
|
120
|
+
this.logger.warn(`L1 is more than 1 L2 slot behind wall time. Warping to wall time`);
|
|
121
|
+
await this.cheatcodes.warp(Math.ceil(wallTime / 1000));
|
|
121
122
|
}
|
|
122
123
|
}
|
|
123
124
|
|