@aztec/world-state 0.87.4 → 0.87.6

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.
@@ -27,6 +27,7 @@ export declare class ServerWorldStateSynchronizer implements WorldStateSynchroni
27
27
  private latestBlockHashQuery;
28
28
  private syncPromise;
29
29
  protected blockStream: L2BlockStream | undefined;
30
+ private provenBlockNumber;
30
31
  constructor(merkleTreeDb: MerkleTreeAdminDatabase, l2BlockSource: L2BlockSource & L1ToL2MessageSource, config: WorldStateConfig, instrumentation?: WorldStateInstrumentation, log?: Logger);
31
32
  getCommitted(): MerkleTreeReadOperations;
32
33
  getSnapshot(blockNumber: number): MerkleTreeReadOperations;
@@ -1 +1 @@
1
- {"version":3,"file":"server_world_state_synchronizer.d.ts","sourceRoot":"","sources":["../../src/synchronizer/server_world_state_synchronizer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AACnD,OAAO,EAAE,KAAK,MAAM,EAAgB,MAAM,uBAAuB,CAAC;AAKlE,OAAO,KAAK,EAGV,aAAa,EACb,aAAa,EACb,kBAAkB,EAClB,yBAAyB,EACzB,8BAA8B,EAC9B,MAAM,EACP,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAGL,KAAK,sBAAsB,EAC3B,KAAK,4BAA4B,EAClC,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAEhE,OAAO,EAAgB,KAAK,wBAAwB,EAAE,KAAK,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAGlH,OAAO,EAAE,yBAAyB,EAAE,MAAM,uCAAuC,CAAC;AAElF,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAC;AACnF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aA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;OAKG;IACU,aAAa,CAAC,iBAAiB,CAAC,EAAE,MAAM,EAAE,2BAA2B,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC;IA2C9G,oGAAoG;IACvF,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IAexE,gGAAgG;IACnF,SAAS,IAAI,OAAO,CAAC,MAAM,CAAC;IAYzC,oDAAoD;IACvC,sBAAsB,CAAC,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC;IAiB7E;;;;OAIG;YACW,cAAc;IAyB5B;;;;;OAKG;YACW,aAAa;YAuBb,oBAAoB;IAelC,OAAO,CAAC,iBAAiB;YAKX,iBAAiB;IAO/B;;;OAGG;IACH,OAAO,CAAC,eAAe;IAKvB;;;;;OAKG;cACa,0BAA0B,CAAC,cAAc,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM;CAahF"}
1
+ {"version":3,"file":"server_world_state_synchronizer.d.ts","sourceRoot":"","sources":["../../src/synchronizer/server_world_state_synchronizer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AACnD,OAAO,EAAE,KAAK,MAAM,EAAgB,MAAM,uBAAuB,CAAC;AAKlE,OAAO,KAAK,EAGV,aAAa,EACb,aAAa,EACb,kBAAkB,EAClB,yBAAyB,EACzB,8BAA8B,EAC9B,MAAM,EACP,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAGL,KAAK,sBAAsB,EAC3B,KAAK,4BAA4B,EAClC,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAEhE,OAAO,EAAgB,KAAK,wBAAwB,EAAE,KAAK,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAGlH,OAAO,EAAE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CAAC,IAAI,CAAC;IAIhB,KAAK;IAgClB,SAAS,CAAC,iBAAiB,IAAI,aAAa;IAU/B,IAAI;IASJ,MAAM,IAAI,OAAO,CAAC,4BAA4B,CAAC;IAe/C,oBAAoB;IAIpB,QAAQ;IAMd,UAAU;IASjB;;;;;OAKG;IACU,aAAa,CAAC,iBAAiB,CAAC,EAAE,MAAM,EAAE,2BAA2B,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC;IA2C9G,oGAAoG;IACvF,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IAexE,gGAAgG;IACnF,SAAS,IAAI,OAAO,CAAC,MAAM,CAAC;IAYzC,oDAAoD;IACvC,sBAAsB,CAAC,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC;IAiB7E;;;;OAIG;YACW,cAAc;IAyB5B;;;;;OAKG;YACW,aAAa;YAuBb,oBAAoB;IAelC,OAAO,CAAC,iBAAiB;YAMX,iBAAiB;IAQ/B;;;OAGG;IACH,OAAO,CAAC,eAAe;IAKvB;;;;;OAKG;cACa,0BAA0B,CAAC,cAAc,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM;CAahF"}
@@ -26,6 +26,9 @@ import { WorldStateSynchronizerError } from './errors.js';
26
26
  latestBlockHashQuery;
27
27
  syncPromise;
28
28
  blockStream;
29
+ // WorldState doesn't track the proven block number, it only tracks the latest tips of the pending chain and the finalised chain
30
+ // store the proven block number here, in the synchronizer, so that we don't end up spamming the logs with 'chain-proved' events
31
+ provenBlockNumber;
29
32
  constructor(merkleTreeDb, l2BlockSource, config, instrumentation = new WorldStateInstrumentation(getTelemetryClient()), log = createLogger('world_state')){
30
33
  this.merkleTreeDb = merkleTreeDb;
31
34
  this.l2BlockSource = l2BlockSource;
@@ -192,7 +195,7 @@ import { WorldStateSynchronizerError } from './errors.js';
192
195
  hash: ''
193
196
  },
194
197
  proven: {
195
- number: Number(status.finalisedBlockNumber),
198
+ number: Number(this.provenBlockNumber ?? status.finalisedBlockNumber),
196
199
  hash: ''
197
200
  }
198
201
  };
@@ -278,6 +281,7 @@ import { WorldStateSynchronizerError } from './errors.js';
278
281
  this.log.debug(`World state summary `, status.summary);
279
282
  }
280
283
  handleChainProven(blockNumber) {
284
+ this.provenBlockNumber = BigInt(blockNumber);
281
285
  this.log.debug(`Proven chain is now at block ${blockNumber}`);
282
286
  return Promise.resolve();
283
287
  }
@@ -285,6 +289,7 @@ import { WorldStateSynchronizerError } from './errors.js';
285
289
  this.log.warn(`Chain pruned to block ${blockNumber}`);
286
290
  const status = await this.merkleTreeDb.unwindBlocks(BigInt(blockNumber));
287
291
  this.latestBlockHashQuery = undefined;
292
+ this.provenBlockNumber = undefined;
288
293
  this.instrumentation.updateWorldStateMetrics(status);
289
294
  }
290
295
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aztec/world-state",
3
- "version": "0.87.4",
3
+ "version": "0.87.6",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./dest/index.js",
@@ -60,19 +60,19 @@
60
60
  ]
61
61
  },
62
62
  "dependencies": {
63
- "@aztec/constants": "0.87.4",
64
- "@aztec/foundation": "0.87.4",
65
- "@aztec/kv-store": "0.87.4",
66
- "@aztec/merkle-tree": "0.87.4",
67
- "@aztec/native": "0.87.4",
68
- "@aztec/protocol-contracts": "0.87.4",
69
- "@aztec/stdlib": "0.87.4",
70
- "@aztec/telemetry-client": "0.87.4",
63
+ "@aztec/constants": "0.87.6",
64
+ "@aztec/foundation": "0.87.6",
65
+ "@aztec/kv-store": "0.87.6",
66
+ "@aztec/merkle-tree": "0.87.6",
67
+ "@aztec/native": "0.87.6",
68
+ "@aztec/protocol-contracts": "0.87.6",
69
+ "@aztec/stdlib": "0.87.6",
70
+ "@aztec/telemetry-client": "0.87.6",
71
71
  "tslib": "^2.4.0",
72
72
  "zod": "^3.23.8"
73
73
  },
74
74
  "devDependencies": {
75
- "@aztec/archiver": "0.87.4",
75
+ "@aztec/archiver": "0.87.6",
76
76
  "@jest/globals": "^29.5.0",
77
77
  "@types/jest": "^29.5.0",
78
78
  "@types/node": "^22.15.17",
@@ -53,6 +53,10 @@ export class ServerWorldStateSynchronizer
53
53
  private syncPromise = promiseWithResolvers<void>();
54
54
  protected blockStream: L2BlockStream | undefined;
55
55
 
56
+ // WorldState doesn't track the proven block number, it only tracks the latest tips of the pending chain and the finalised chain
57
+ // store the proven block number here, in the synchronizer, so that we don't end up spamming the logs with 'chain-proved' events
58
+ private provenBlockNumber: bigint | undefined;
59
+
56
60
  constructor(
57
61
  private readonly merkleTreeDb: MerkleTreeAdminDatabase,
58
62
  private readonly l2BlockSource: L2BlockSource & L1ToL2MessageSource,
@@ -248,7 +252,7 @@ export class ServerWorldStateSynchronizer
248
252
  return {
249
253
  latest: latestBlockId,
250
254
  finalized: { number: Number(status.finalisedBlockNumber), hash: '' },
251
- proven: { number: Number(status.finalisedBlockNumber), hash: '' }, // TODO(palla/reorg): Using finalised as proven for now
255
+ proven: { number: Number(this.provenBlockNumber ?? status.finalisedBlockNumber), hash: '' }, // TODO(palla/reorg): Using finalised as proven for now
252
256
  };
253
257
  }
254
258
 
@@ -345,6 +349,7 @@ export class ServerWorldStateSynchronizer
345
349
  }
346
350
 
347
351
  private handleChainProven(blockNumber: number) {
352
+ this.provenBlockNumber = BigInt(blockNumber);
348
353
  this.log.debug(`Proven chain is now at block ${blockNumber}`);
349
354
  return Promise.resolve();
350
355
  }
@@ -353,6 +358,7 @@ export class ServerWorldStateSynchronizer
353
358
  this.log.warn(`Chain pruned to block ${blockNumber}`);
354
359
  const status = await this.merkleTreeDb.unwindBlocks(BigInt(blockNumber));
355
360
  this.latestBlockHashQuery = undefined;
361
+ this.provenBlockNumber = undefined;
356
362
  this.instrumentation.updateWorldStateMetrics(status);
357
363
  }
358
364