@aztec/archiver 0.1.0-alpha44 → 0.1.0-alpha45

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.
@@ -130,7 +130,7 @@ export declare class Archiver implements L2BlockSource, L2LogsSource, ContractDa
130
130
  * Gets the number of the latest L2 block processed by the block source implementation.
131
131
  * @returns The number of the latest L2 block processed by the block source implementation.
132
132
  */
133
- getBlockHeight(): Promise<number>;
133
+ getBlockNumber(): Promise<number>;
134
134
  /**
135
135
  * Gets up to `limit` amount of pending L1 to L2 messages.
136
136
  * @param limit - The number of messages to return.
@@ -244,8 +244,8 @@ export class Archiver {
244
244
  * Gets the number of the latest L2 block processed by the block source implementation.
245
245
  * @returns The number of the latest L2 block processed by the block source implementation.
246
246
  */
247
- getBlockHeight() {
248
- return this.store.getBlockHeight();
247
+ getBlockNumber() {
248
+ return this.store.getBlockNumber();
249
249
  }
250
250
  /**
251
251
  * Gets up to `limit` amount of pending L1 to L2 messages.
@@ -21,7 +21,7 @@ describe('Archiver', () => {
21
21
  });
22
22
  it('can start, sync and stop and handle l1 to l2 messages and logs', async () => {
23
23
  const archiver = new Archiver(publicClient, EthAddress.fromString(rollupAddress), EthAddress.fromString(inboxAddress), EthAddress.fromString(contractDeploymentEmitterAddress), 0, archiverStore, 1000);
24
- let latestBlockNum = await archiver.getBlockHeight();
24
+ let latestBlockNum = await archiver.getBlockNumber();
25
25
  expect(latestBlockNum).toEqual(0);
26
26
  const blocks = blockNums.map(x => L2Block.random(x, 4, x, x + 1, x * 2, x * 3));
27
27
  const rollupTxs = blocks.map(makeRollupTx);
@@ -60,10 +60,10 @@ describe('Archiver', () => {
60
60
  rollupTxs.forEach(tx => publicClient.getTransaction.mockResolvedValueOnce(tx));
61
61
  await archiver.start(false);
62
62
  // Wait until block 3 is processed. If this won't happen the test will fail with timeout.
63
- while ((await archiver.getBlockHeight()) !== 3) {
63
+ while ((await archiver.getBlockNumber()) !== 3) {
64
64
  await sleep(100);
65
65
  }
66
- latestBlockNum = await archiver.getBlockHeight();
66
+ latestBlockNum = await archiver.getBlockNumber();
67
67
  expect(latestBlockNum).toEqual(3);
68
68
  // Check that only 2 messages (l1ToL2MessageAddedEvents[3][2] and l1ToL2MessageAddedEvents[3][3]) are pending.
69
69
  // Other two (l1ToL2MessageAddedEvents[3][0..2]) were cancelled. And the previous messages were confirmed.
@@ -102,7 +102,7 @@ export interface ArchiverDataStore {
102
102
  * Gets the number of the latest L2 block processed.
103
103
  * @returns The number of the latest L2 block processed.
104
104
  */
105
- getBlockHeight(): Promise<number>;
105
+ getBlockNumber(): Promise<number>;
106
106
  /**
107
107
  * Gets the length of L2 blocks in store.
108
108
  * @returns The length of L2 Blocks stored.
@@ -241,7 +241,7 @@ export declare class MemoryArchiverStore implements ArchiverDataStore {
241
241
  * Gets the number of the latest L2 block processed.
242
242
  * @returns The number of the latest L2 block processed.
243
243
  */
244
- getBlockHeight(): Promise<number>;
244
+ getBlockNumber(): Promise<number>;
245
245
  /**
246
246
  * Gets the length of L2 blocks in store.
247
247
  * @returns The length of L2 Blocks array.
@@ -226,7 +226,7 @@ export class MemoryArchiverStore {
226
226
  * Gets the number of the latest L2 block processed.
227
227
  * @returns The number of the latest L2 block processed.
228
228
  */
229
- getBlockHeight() {
229
+ getBlockNumber() {
230
230
  if (this.l2Blocks.length === 0)
231
231
  return Promise.resolve(INITIAL_L2_BLOCK_NUM - 1);
232
232
  return Promise.resolve(this.l2Blocks[this.l2Blocks.length - 1].number);
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@aztec/archiver",
3
- "version": "0.1.0-alpha44",
3
+ "version": "0.1.0-alpha45",
4
4
  "exports": "./dest/index.js",
5
5
  "type": "module",
6
6
  "dependencies": {
7
- "@aztec/circuits.js": "0.1.0-alpha44",
8
- "@aztec/ethereum": "0.1.0-alpha44",
9
- "@aztec/foundation": "0.1.0-alpha44",
10
- "@aztec/l1-artifacts": "0.1.0-alpha44",
11
- "@aztec/types": "0.1.0-alpha44",
7
+ "@aztec/circuits.js": "0.1.0-alpha45",
8
+ "@aztec/ethereum": "0.1.0-alpha45",
9
+ "@aztec/foundation": "0.1.0-alpha45",
10
+ "@aztec/l1-artifacts": "0.1.0-alpha45",
11
+ "@aztec/types": "0.1.0-alpha45",
12
12
  "@types/lodash.omit": "^4.5.7",
13
13
  "debug": "^4.3.4",
14
14
  "lodash.omit": "^4.5.0",
@@ -42,7 +42,7 @@ describe('Archiver', () => {
42
42
  1000,
43
43
  );
44
44
 
45
- let latestBlockNum = await archiver.getBlockHeight();
45
+ let latestBlockNum = await archiver.getBlockNumber();
46
46
  expect(latestBlockNum).toEqual(0);
47
47
 
48
48
  const blocks = blockNums.map(x => L2Block.random(x, 4, x, x + 1, x * 2, x * 3));
@@ -95,11 +95,11 @@ describe('Archiver', () => {
95
95
  await archiver.start(false);
96
96
 
97
97
  // Wait until block 3 is processed. If this won't happen the test will fail with timeout.
98
- while ((await archiver.getBlockHeight()) !== 3) {
98
+ while ((await archiver.getBlockNumber()) !== 3) {
99
99
  await sleep(100);
100
100
  }
101
101
 
102
- latestBlockNum = await archiver.getBlockHeight();
102
+ latestBlockNum = await archiver.getBlockNumber();
103
103
  expect(latestBlockNum).toEqual(3);
104
104
 
105
105
  // Check that only 2 messages (l1ToL2MessageAddedEvents[3][2] and l1ToL2MessageAddedEvents[3][3]) are pending.
@@ -353,8 +353,8 @@ export class Archiver implements L2BlockSource, L2LogsSource, ContractDataSource
353
353
  * Gets the number of the latest L2 block processed by the block source implementation.
354
354
  * @returns The number of the latest L2 block processed by the block source implementation.
355
355
  */
356
- public getBlockHeight(): Promise<number> {
357
- return this.store.getBlockHeight();
356
+ public getBlockNumber(): Promise<number> {
357
+ return this.store.getBlockNumber();
358
358
  }
359
359
 
360
360
  /**
@@ -127,7 +127,7 @@ export interface ArchiverDataStore {
127
127
  * Gets the number of the latest L2 block processed.
128
128
  * @returns The number of the latest L2 block processed.
129
129
  */
130
- getBlockHeight(): Promise<number>;
130
+ getBlockNumber(): Promise<number>;
131
131
 
132
132
  /**
133
133
  * Gets the length of L2 blocks in store.
@@ -382,7 +382,7 @@ export class MemoryArchiverStore implements ArchiverDataStore {
382
382
  * Gets the number of the latest L2 block processed.
383
383
  * @returns The number of the latest L2 block processed.
384
384
  */
385
- public getBlockHeight(): Promise<number> {
385
+ public getBlockNumber(): Promise<number> {
386
386
  if (this.l2Blocks.length === 0) return Promise.resolve(INITIAL_L2_BLOCK_NUM - 1);
387
387
  return Promise.resolve(this.l2Blocks[this.l2Blocks.length - 1].number);
388
388
  }