@aztec/archiver 0.28.1 → 0.30.0
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/archiver/archiver.d.ts +13 -53
- package/dest/archiver/archiver.d.ts.map +1 -1
- package/dest/archiver/archiver.js +60 -199
- package/dest/archiver/archiver_store.d.ts +21 -67
- package/dest/archiver/archiver_store.d.ts.map +1 -1
- package/dest/archiver/archiver_store_test_suite.d.ts.map +1 -1
- package/dest/archiver/archiver_store_test_suite.js +60 -199
- package/dest/archiver/config.d.ts.map +1 -1
- package/dest/archiver/config.js +6 -2
- package/dest/archiver/data_retrieval.d.ts +10 -32
- package/dest/archiver/data_retrieval.d.ts.map +1 -1
- package/dest/archiver/data_retrieval.js +13 -67
- package/dest/archiver/eth_log_handlers.d.ts +7 -38
- package/dest/archiver/eth_log_handlers.d.ts.map +1 -1
- package/dest/archiver/eth_log_handlers.js +9 -77
- package/dest/archiver/kv_archiver_store/block_store.d.ts +5 -4
- package/dest/archiver/kv_archiver_store/block_store.d.ts.map +1 -1
- package/dest/archiver/kv_archiver_store/block_store.js +12 -15
- package/dest/archiver/kv_archiver_store/kv_archiver_store.d.ts +15 -56
- package/dest/archiver/kv_archiver_store/kv_archiver_store.d.ts.map +1 -1
- package/dest/archiver/kv_archiver_store/kv_archiver_store.js +23 -87
- package/dest/archiver/kv_archiver_store/message_store.d.ts +12 -43
- package/dest/archiver/kv_archiver_store/message_store.d.ts.map +1 -1
- package/dest/archiver/kv_archiver_store/message_store.js +32 -141
- package/dest/archiver/memory_archiver_store/l1_to_l2_message_store.d.ts +8 -41
- package/dest/archiver/memory_archiver_store/l1_to_l2_message_store.d.ts.map +1 -1
- package/dest/archiver/memory_archiver_store/l1_to_l2_message_store.js +22 -79
- package/dest/archiver/memory_archiver_store/memory_archiver_store.d.ts +20 -81
- package/dest/archiver/memory_archiver_store/memory_archiver_store.d.ts.map +1 -1
- package/dest/archiver/memory_archiver_store/memory_archiver_store.js +30 -143
- package/dest/index.d.ts.map +1 -1
- package/dest/index.js +3 -15
- package/dest/rpc/archiver_client.d.ts.map +1 -1
- package/dest/rpc/archiver_client.js +2 -6
- package/dest/rpc/archiver_server.d.ts.map +1 -1
- package/dest/rpc/archiver_server.js +2 -6
- package/package.json +9 -9
- package/src/archiver/archiver.ts +80 -267
- package/src/archiver/archiver_store.ts +22 -76
- package/src/archiver/archiver_store_test_suite.ts +78 -243
- package/src/archiver/config.ts +6 -0
- package/src/archiver/data_retrieval.ts +19 -101
- package/src/archiver/eth_log_handlers.ts +14 -108
- package/src/archiver/kv_archiver_store/block_store.ts +13 -14
- package/src/archiver/kv_archiver_store/kv_archiver_store.ts +23 -93
- package/src/archiver/kv_archiver_store/message_store.ts +38 -169
- package/src/archiver/memory_archiver_store/l1_to_l2_message_store.ts +21 -90
- package/src/archiver/memory_archiver_store/memory_archiver_store.ts +33 -161
- package/src/index.ts +1 -15
- package/src/rpc/archiver_client.ts +0 -8
- package/src/rpc/archiver_server.ts +0 -8
- package/dest/archiver/kv_archiver_store/contract_store.d.ts +0 -26
- package/dest/archiver/kv_archiver_store/contract_store.d.ts.map +0 -1
- package/dest/archiver/kv_archiver_store/contract_store.js +0 -49
- package/src/archiver/kv_archiver_store/contract_store.ts +0 -55
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
var
|
|
1
|
+
var _MessageStore_l1ToL2Messages, _MessageStore_l1ToL2MessageIndices, _MessageStore_lastL1BlockMessages, _MessageStore_log, _MessageStore_l1ToL2MessagesSubtreeSize;
|
|
2
2
|
import { __classPrivateFieldGet, __classPrivateFieldSet } from "tslib";
|
|
3
|
-
import {
|
|
4
|
-
import { Fr, L1_TO_L2_MSG_SUBTREE_HEIGHT } from '@aztec/circuits.js';
|
|
3
|
+
import { Fr, INITIAL_L2_BLOCK_NUM, L1_TO_L2_MSG_SUBTREE_HEIGHT, NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP, } from '@aztec/circuits.js';
|
|
5
4
|
import { createDebugLogger } from '@aztec/foundation/log';
|
|
6
5
|
/**
|
|
7
6
|
* LMDB implementation of the ArchiverDataStore interface.
|
|
@@ -9,171 +8,63 @@ import { createDebugLogger } from '@aztec/foundation/log';
|
|
|
9
8
|
export class MessageStore {
|
|
10
9
|
constructor(db) {
|
|
11
10
|
this.db = db;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
_MessageStore_pendingMessagesByFee.set(this, void 0);
|
|
16
|
-
_MessageStore_messages.set(this, void 0);
|
|
17
|
-
_MessageStore_lastL1BlockAddingMessages.set(this, void 0);
|
|
18
|
-
_MessageStore_lastL1BlockCancellingMessages.set(this, void 0);
|
|
11
|
+
_MessageStore_l1ToL2Messages.set(this, void 0);
|
|
12
|
+
_MessageStore_l1ToL2MessageIndices.set(this, void 0);
|
|
13
|
+
_MessageStore_lastL1BlockMessages.set(this, void 0);
|
|
19
14
|
_MessageStore_log.set(this, createDebugLogger('aztec:archiver:message_store'));
|
|
20
15
|
_MessageStore_l1ToL2MessagesSubtreeSize.set(this, 2 ** L1_TO_L2_MSG_SUBTREE_HEIGHT);
|
|
21
|
-
__classPrivateFieldSet(this,
|
|
22
|
-
__classPrivateFieldSet(this,
|
|
23
|
-
__classPrivateFieldSet(this,
|
|
24
|
-
__classPrivateFieldSet(this, _MessageStore_lastL1BlockNewMessages, db.openSingleton('archiver_last_l1_block_new_messages'), "f");
|
|
25
|
-
__classPrivateFieldSet(this, _MessageStore_lastL1BlockAddingMessages, db.openSingleton('archiver_last_l1_block_adding_messages'), "f");
|
|
26
|
-
__classPrivateFieldSet(this, _MessageStore_lastL1BlockCancellingMessages, db.openSingleton('archiver_last_l1_block_cancelling_messages'), "f");
|
|
16
|
+
__classPrivateFieldSet(this, _MessageStore_l1ToL2Messages, db.openMap('archiver_l1_to_l2_messages'), "f");
|
|
17
|
+
__classPrivateFieldSet(this, _MessageStore_l1ToL2MessageIndices, db.openMap('archiver_l1_to_l2_message_indices'), "f");
|
|
18
|
+
__classPrivateFieldSet(this, _MessageStore_lastL1BlockMessages, db.openSingleton('archiver_last_l1_block_new_messages'), "f");
|
|
27
19
|
}
|
|
28
20
|
/**
|
|
29
|
-
* Gets the last L1 block number that emitted new messages
|
|
21
|
+
* Gets the last L1 block number that emitted new messages.
|
|
30
22
|
* @returns The last L1 block number processed
|
|
31
23
|
*/
|
|
32
|
-
|
|
33
|
-
return
|
|
34
|
-
newMessages: __classPrivateFieldGet(this, _MessageStore_lastL1BlockNewMessages, "f").get() ?? 0n,
|
|
35
|
-
// TODO(#4492): Nuke the following when purging the old inbox
|
|
36
|
-
addedMessages: __classPrivateFieldGet(this, _MessageStore_lastL1BlockAddingMessages, "f").get() ?? 0n,
|
|
37
|
-
cancelledMessages: __classPrivateFieldGet(this, _MessageStore_lastL1BlockCancellingMessages, "f").get() ?? 0n,
|
|
38
|
-
};
|
|
24
|
+
getSynchedL1BlockNumber() {
|
|
25
|
+
return __classPrivateFieldGet(this, _MessageStore_lastL1BlockMessages, "f").get() ?? 0n;
|
|
39
26
|
}
|
|
40
27
|
/**
|
|
41
|
-
* Append
|
|
42
|
-
* @param messages - The L1 to L2 messages to be added to the store.
|
|
43
|
-
* @param lastMessageL1BlockNumber - The L1 block number in which the last message was emitted.
|
|
28
|
+
* Append L1 to L2 messages to the store.
|
|
29
|
+
* @param messages - The L1 to L2 messages to be added to the store and the last processed L1 block.
|
|
44
30
|
* @returns True if the operation is successful.
|
|
45
31
|
*/
|
|
46
|
-
|
|
32
|
+
addL1ToL2Messages(messages) {
|
|
47
33
|
return this.db.transaction(() => {
|
|
48
|
-
const lastL1BlockNumber = __classPrivateFieldGet(this,
|
|
49
|
-
if (lastL1BlockNumber >=
|
|
34
|
+
const lastL1BlockNumber = __classPrivateFieldGet(this, _MessageStore_lastL1BlockMessages, "f").get() ?? 0n;
|
|
35
|
+
if (lastL1BlockNumber >= messages.lastProcessedL1BlockNumber) {
|
|
50
36
|
return false;
|
|
51
37
|
}
|
|
52
|
-
void __classPrivateFieldGet(this,
|
|
53
|
-
for (const message of messages) {
|
|
38
|
+
void __classPrivateFieldGet(this, _MessageStore_lastL1BlockMessages, "f").set(messages.lastProcessedL1BlockNumber);
|
|
39
|
+
for (const message of messages.retrievedData) {
|
|
54
40
|
if (message.index >= __classPrivateFieldGet(this, _MessageStore_l1ToL2MessagesSubtreeSize, "f")) {
|
|
55
41
|
throw new Error(`Message index ${message.index} out of subtree range`);
|
|
56
42
|
}
|
|
57
43
|
const key = `${message.blockNumber}-${message.index}`;
|
|
58
|
-
void __classPrivateFieldGet(this,
|
|
44
|
+
void __classPrivateFieldGet(this, _MessageStore_l1ToL2Messages, "f").setIfNotExists(key, message.leaf.toBuffer());
|
|
45
|
+
const indexInTheWholeTree = (message.blockNumber - BigInt(INITIAL_L2_BLOCK_NUM)) * BigInt(NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP) +
|
|
46
|
+
message.index;
|
|
47
|
+
void __classPrivateFieldGet(this, _MessageStore_l1ToL2MessageIndices, "f").setIfNotExists(message.leaf.toString(), indexInTheWholeTree);
|
|
59
48
|
}
|
|
60
49
|
return true;
|
|
61
50
|
});
|
|
62
51
|
}
|
|
63
52
|
/**
|
|
64
|
-
*
|
|
65
|
-
* @param
|
|
66
|
-
* @
|
|
67
|
-
* @returns True if the operation is successful.
|
|
68
|
-
*/
|
|
69
|
-
addPendingMessages(messages, l1BlockNumber) {
|
|
70
|
-
return this.db.transaction(() => {
|
|
71
|
-
const lastL1BlockNumber = __classPrivateFieldGet(this, _MessageStore_lastL1BlockAddingMessages, "f").get() ?? 0n;
|
|
72
|
-
if (lastL1BlockNumber >= l1BlockNumber) {
|
|
73
|
-
return false;
|
|
74
|
-
}
|
|
75
|
-
void __classPrivateFieldGet(this, _MessageStore_lastL1BlockAddingMessages, "f").set(l1BlockNumber);
|
|
76
|
-
for (const message of messages) {
|
|
77
|
-
const entryKey = message.entryKey?.toString();
|
|
78
|
-
if (!entryKey) {
|
|
79
|
-
throw new Error('Message does not have an entry key');
|
|
80
|
-
}
|
|
81
|
-
void __classPrivateFieldGet(this, _MessageStore_messages, "f").setIfNotExists(entryKey, {
|
|
82
|
-
message: message.toBuffer(),
|
|
83
|
-
fee: message.fee,
|
|
84
|
-
confirmed: false,
|
|
85
|
-
});
|
|
86
|
-
void __classPrivateFieldGet(this, _MessageStore_pendingMessagesByFee, "f").update([message.fee, entryKey], 1);
|
|
87
|
-
}
|
|
88
|
-
return true;
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
/**
|
|
92
|
-
* Remove pending L1 to L2 messages from the store (if they were cancelled).
|
|
93
|
-
* @param entryKeys - The entry keys to be removed from the store.
|
|
94
|
-
* @param l1BlockNumber - The L1 block number for which to remove the messages.
|
|
95
|
-
* @returns True if the operation is successful.
|
|
53
|
+
* Gets the L1 to L2 message index in the L1 to L2 message tree.
|
|
54
|
+
* @param l1ToL2Message - The L1 to L2 message.
|
|
55
|
+
* @returns The index of the L1 to L2 message in the L1 to L2 message tree (undefined if not found).
|
|
96
56
|
*/
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
if (lastL1BlockNumber >= l1BlockNumber) {
|
|
101
|
-
return false;
|
|
102
|
-
}
|
|
103
|
-
void __classPrivateFieldGet(this, _MessageStore_lastL1BlockCancellingMessages, "f").set(l1BlockNumber);
|
|
104
|
-
for (const entryKey of entryKeys) {
|
|
105
|
-
const messageCtx = __classPrivateFieldGet(this, _MessageStore_messages, "f").get(entryKey.toString());
|
|
106
|
-
if (!messageCtx) {
|
|
107
|
-
throw new Error(`Message ${entryKey.toString()} not found`);
|
|
108
|
-
}
|
|
109
|
-
void __classPrivateFieldGet(this, _MessageStore_pendingMessagesByFee, "f").update([messageCtx.fee, entryKey.toString()], -1);
|
|
110
|
-
}
|
|
111
|
-
return true;
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
|
-
/**
|
|
115
|
-
* Messages that have been published in an L2 block are confirmed.
|
|
116
|
-
* Add them to the confirmed store, also remove them from the pending store.
|
|
117
|
-
* @param entryKeys - The entry keys to be removed from the store.
|
|
118
|
-
* @returns True if the operation is successful.
|
|
119
|
-
*/
|
|
120
|
-
confirmPendingMessages(entryKeys) {
|
|
121
|
-
return this.db.transaction(() => {
|
|
122
|
-
for (const entryKey of entryKeys) {
|
|
123
|
-
if (entryKey.equals(Fr.ZERO)) {
|
|
124
|
-
continue;
|
|
125
|
-
}
|
|
126
|
-
const messageCtx = __classPrivateFieldGet(this, _MessageStore_messages, "f").get(entryKey.toString());
|
|
127
|
-
if (!messageCtx) {
|
|
128
|
-
throw new Error(`Message ${entryKey.toString()} not found`);
|
|
129
|
-
}
|
|
130
|
-
messageCtx.confirmed = true;
|
|
131
|
-
void __classPrivateFieldGet(this, _MessageStore_messages, "f").set(entryKey.toString(), messageCtx);
|
|
132
|
-
void __classPrivateFieldGet(this, _MessageStore_pendingMessagesByFee, "f").update([messageCtx.fee, entryKey.toString()], -1);
|
|
133
|
-
}
|
|
134
|
-
return true;
|
|
135
|
-
});
|
|
136
|
-
}
|
|
137
|
-
/**
|
|
138
|
-
* Gets the confirmed L1 to L2 message corresponding to the given entry key.
|
|
139
|
-
* @param entryKey - The entry key to look up.
|
|
140
|
-
* @returns The requested L1 to L2 message or throws if not found.
|
|
141
|
-
*/
|
|
142
|
-
getConfirmedMessage(entryKey) {
|
|
143
|
-
const messageCtx = __classPrivateFieldGet(this, _MessageStore_messages, "f").get(entryKey.toString());
|
|
144
|
-
if (!messageCtx) {
|
|
145
|
-
throw new Error(`Message ${entryKey.toString()} not found`);
|
|
146
|
-
}
|
|
147
|
-
if (!messageCtx.confirmed) {
|
|
148
|
-
throw new Error(`Message ${entryKey.toString()} not confirmed`);
|
|
149
|
-
}
|
|
150
|
-
return L1ToL2Message.fromBuffer(messageCtx.message);
|
|
151
|
-
}
|
|
152
|
-
/**
|
|
153
|
-
* Gets up to `limit` amount of pending L1 to L2 messages, sorted by fee
|
|
154
|
-
* @param limit - The number of messages to return (by default NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP).
|
|
155
|
-
* @returns The requested L1 to L2 entry keys.
|
|
156
|
-
*/
|
|
157
|
-
getPendingEntryKeysByFee(limit) {
|
|
158
|
-
const entryKeys = [];
|
|
159
|
-
for (const [[_, entryKey], count] of __classPrivateFieldGet(this, _MessageStore_pendingMessagesByFee, "f").entries({
|
|
160
|
-
reverse: true,
|
|
161
|
-
})) {
|
|
162
|
-
// put `count` copies of this message in the result list
|
|
163
|
-
entryKeys.push(...Array(count).fill(Fr.fromString(entryKey)));
|
|
164
|
-
if (entryKeys.length >= limit) {
|
|
165
|
-
break;
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
return entryKeys;
|
|
57
|
+
getL1ToL2MessageIndex(l1ToL2Message) {
|
|
58
|
+
const index = __classPrivateFieldGet(this, _MessageStore_l1ToL2MessageIndices, "f").get(l1ToL2Message.toString());
|
|
59
|
+
return Promise.resolve(index);
|
|
169
60
|
}
|
|
170
|
-
|
|
61
|
+
getL1ToL2Messages(blockNumber) {
|
|
171
62
|
const messages = [];
|
|
172
63
|
let undefinedMessageFound = false;
|
|
173
64
|
for (let messageIndex = 0; messageIndex < __classPrivateFieldGet(this, _MessageStore_l1ToL2MessagesSubtreeSize, "f"); messageIndex++) {
|
|
174
65
|
// This is inefficient but probably fine for now.
|
|
175
66
|
const key = `${blockNumber}-${messageIndex}`;
|
|
176
|
-
const message = __classPrivateFieldGet(this,
|
|
67
|
+
const message = __classPrivateFieldGet(this, _MessageStore_l1ToL2Messages, "f").get(key);
|
|
177
68
|
if (message) {
|
|
178
69
|
if (undefinedMessageFound) {
|
|
179
70
|
throw new Error(`L1 to L2 message gap found in block ${blockNumber}`);
|
|
@@ -189,5 +80,5 @@ export class MessageStore {
|
|
|
189
80
|
return messages;
|
|
190
81
|
}
|
|
191
82
|
}
|
|
192
|
-
|
|
193
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
83
|
+
_MessageStore_l1ToL2Messages = new WeakMap(), _MessageStore_l1ToL2MessageIndices = new WeakMap(), _MessageStore_lastL1BlockMessages = new WeakMap(), _MessageStore_log = new WeakMap(), _MessageStore_l1ToL2MessagesSubtreeSize = new WeakMap();
|
|
84
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibWVzc2FnZV9zdG9yZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9hcmNoaXZlci9rdl9hcmNoaXZlcl9zdG9yZS9tZXNzYWdlX3N0b3JlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQ0EsT0FBTyxFQUNMLEVBQUUsRUFDRixvQkFBb0IsRUFDcEIsMkJBQTJCLEVBQzNCLG1DQUFtQyxHQUNwQyxNQUFNLG9CQUFvQixDQUFDO0FBQzVCLE9BQU8sRUFBRSxpQkFBaUIsRUFBRSxNQUFNLHVCQUF1QixDQUFDO0FBSzFEOztHQUVHO0FBQ0gsTUFBTSxPQUFPLFlBQVk7SUFTdkIsWUFBb0IsRUFBZ0I7UUFBaEIsT0FBRSxHQUFGLEVBQUUsQ0FBYztRQVJwQywrQ0FBMEM7UUFDMUMscURBQWdEO1FBQ2hELG9EQUE2QztRQUU3Qyw0QkFBTyxpQkFBaUIsQ0FBQyw4QkFBOEIsQ0FBQyxFQUFDO1FBRXpELGtEQUE2QixDQUFDLElBQUksMkJBQTJCLEVBQUM7UUFHNUQsdUJBQUEsSUFBSSxnQ0FBbUIsRUFBRSxDQUFDLE9BQU8sQ0FBQyw0QkFBNEIsQ0FBQyxNQUFBLENBQUM7UUFDaEUsdUJBQUEsSUFBSSxzQ0FBeUIsRUFBRSxDQUFDLE9BQU8sQ0FBQyxtQ0FBbUMsQ0FBQyxNQUFBLENBQUM7UUFDN0UsdUJBQUEsSUFBSSxxQ0FBd0IsRUFBRSxDQUFDLGFBQWEsQ0FBQyxxQ0FBcUMsQ0FBQyxNQUFBLENBQUM7SUFDdEYsQ0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FJLHFCQUFxQixFQUFFLENBQUM7b0JBQzFCLE1BQU0sSUFBSSxLQUFLLENBQUMsdUNBQXVDLFdBQVcsRUFBRSxDQUFDLENBQUM7Z0JBQ3hFLENBQUM7Z0JBQ0QsUUFBUSxDQUFDLElBQUksQ0FBQyxFQUFFLENBQUMsVUFBVSxDQUFDLE9BQU8sQ0FBQyxDQUFDLENBQUM7WUFDeEMsQ0FBQztpQkFBTSxDQUFDO2dCQUNOLHFCQUFxQixHQUFHLElBQUksQ0FBQztnQkFDN0IsOEdBQThHO2dCQUM5RyxtRkFBbUY7WUFDckYsQ0FBQztRQUNILENBQUM7UUFDRCxPQUFPLFFBQVEsQ0FBQztJQUNsQixDQUFDO0NBQ0YifQ==
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { InboxLeaf } from '@aztec/circuit-types';
|
|
2
2
|
import { Fr } from '@aztec/foundation/fields';
|
|
3
3
|
/**
|
|
4
|
-
* A simple in-memory implementation of an L1 to L2 message store
|
|
5
|
-
* that handles message duplication.
|
|
6
|
-
* TODO(#4492): Clean this up
|
|
4
|
+
* A simple in-memory implementation of an L1 to L2 message store.
|
|
7
5
|
*/
|
|
8
|
-
export declare class
|
|
6
|
+
export declare class L1ToL2MessageStore {
|
|
9
7
|
#private;
|
|
10
8
|
/**
|
|
11
9
|
* A map containing the entry key to the corresponding L1 to L2
|
|
@@ -13,44 +11,13 @@ export declare class NewL1ToL2MessageStore {
|
|
|
13
11
|
*/
|
|
14
12
|
protected store: Map<string, Fr>;
|
|
15
13
|
constructor();
|
|
16
|
-
addMessage(message:
|
|
14
|
+
addMessage(message: InboxLeaf): void;
|
|
17
15
|
getMessages(blockNumber: bigint): Fr[];
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* A simple in-memory implementation of an L1 to L2 message store
|
|
21
|
-
* that handles message duplication.
|
|
22
|
-
*/
|
|
23
|
-
export declare class L1ToL2MessageStore {
|
|
24
16
|
/**
|
|
25
|
-
*
|
|
26
|
-
*
|
|
17
|
+
* Gets the L1 to L2 message index in the L1 to L2 message tree.
|
|
18
|
+
* @param l1ToL2Message - The L1 to L2 message.
|
|
19
|
+
* @returns The index of the L1 to L2 message in the L1 to L2 message tree (undefined if not found).
|
|
27
20
|
*/
|
|
28
|
-
|
|
29
|
-
constructor();
|
|
30
|
-
addMessage(entryKey: Fr, message: L1ToL2Message): void;
|
|
31
|
-
getMessage(entryKey: Fr): L1ToL2Message | undefined;
|
|
32
|
-
getMessageAndCount(entryKey: Fr): L1ToL2MessageAndCount | undefined;
|
|
21
|
+
getMessageIndex(l1ToL2Message: Fr): bigint | undefined;
|
|
33
22
|
}
|
|
34
|
-
/**
|
|
35
|
-
* Specifically for the store that will hold pending messages
|
|
36
|
-
* for removing messages or fetching multiple messages.
|
|
37
|
-
*/
|
|
38
|
-
export declare class PendingL1ToL2MessageStore extends L1ToL2MessageStore {
|
|
39
|
-
getEntryKeys(limit: number): Fr[];
|
|
40
|
-
removeMessage(entryKey: Fr): void;
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Useful to keep track of the number of times a message has been seen.
|
|
44
|
-
*/
|
|
45
|
-
type L1ToL2MessageAndCount = {
|
|
46
|
-
/**
|
|
47
|
-
* The message.
|
|
48
|
-
*/
|
|
49
|
-
message: L1ToL2Message;
|
|
50
|
-
/**
|
|
51
|
-
* The number of times the message has been seen.
|
|
52
|
-
*/
|
|
53
|
-
count: number;
|
|
54
|
-
};
|
|
55
|
-
export {};
|
|
56
23
|
//# sourceMappingURL=l1_to_l2_message_store.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"l1_to_l2_message_store.d.ts","sourceRoot":"","sources":["../../../src/archiver/memory_archiver_store/l1_to_l2_message_store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"l1_to_l2_message_store.d.ts","sourceRoot":"","sources":["../../../src/archiver/memory_archiver_store/l1_to_l2_message_store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAMjD,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAE9C;;GAEG;AACH,qBAAa,kBAAkB;;IAC7B;;;OAGG;IACH,SAAS,CAAC,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,EAAE,CAAC,CAAa;;IAM7C,UAAU,CAAC,OAAO,EAAE,SAAS;IAQ7B,WAAW,CAAC,WAAW,EAAE,MAAM,GAAG,EAAE,EAAE;IAqBtC;;;;OAIG;IACH,eAAe,CAAC,aAAa,EAAE,EAAE,GAAG,MAAM,GAAG,SAAS;CAYvD"}
|
|
@@ -1,23 +1,20 @@
|
|
|
1
|
-
var
|
|
1
|
+
var _L1ToL2MessageStore_l1ToL2MessagesSubtreeSize;
|
|
2
2
|
import { __classPrivateFieldGet } from "tslib";
|
|
3
|
-
import { L1_TO_L2_MSG_SUBTREE_HEIGHT } from '@aztec/circuits.js/constants';
|
|
4
|
-
import { Fr } from '@aztec/foundation/fields';
|
|
3
|
+
import { INITIAL_L2_BLOCK_NUM, L1_TO_L2_MSG_SUBTREE_HEIGHT, NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP, } from '@aztec/circuits.js/constants';
|
|
5
4
|
/**
|
|
6
|
-
* A simple in-memory implementation of an L1 to L2 message store
|
|
7
|
-
* that handles message duplication.
|
|
8
|
-
* TODO(#4492): Clean this up
|
|
5
|
+
* A simple in-memory implementation of an L1 to L2 message store.
|
|
9
6
|
*/
|
|
10
|
-
export class
|
|
7
|
+
export class L1ToL2MessageStore {
|
|
11
8
|
constructor() {
|
|
12
9
|
/**
|
|
13
10
|
* A map containing the entry key to the corresponding L1 to L2
|
|
14
11
|
* messages (and the number of times the message has been seen).
|
|
15
12
|
*/
|
|
16
13
|
this.store = new Map();
|
|
17
|
-
|
|
14
|
+
_L1ToL2MessageStore_l1ToL2MessagesSubtreeSize.set(this, 2 ** L1_TO_L2_MSG_SUBTREE_HEIGHT);
|
|
18
15
|
}
|
|
19
16
|
addMessage(message) {
|
|
20
|
-
if (message.index >= __classPrivateFieldGet(this,
|
|
17
|
+
if (message.index >= __classPrivateFieldGet(this, _L1ToL2MessageStore_l1ToL2MessagesSubtreeSize, "f")) {
|
|
21
18
|
throw new Error(`Message index ${message.index} out of subtree range`);
|
|
22
19
|
}
|
|
23
20
|
const key = `${message.blockNumber}-${message.index}`;
|
|
@@ -26,7 +23,7 @@ export class NewL1ToL2MessageStore {
|
|
|
26
23
|
getMessages(blockNumber) {
|
|
27
24
|
const messages = [];
|
|
28
25
|
let undefinedMessageFound = false;
|
|
29
|
-
for (let messageIndex = 0; messageIndex < __classPrivateFieldGet(this,
|
|
26
|
+
for (let messageIndex = 0; messageIndex < __classPrivateFieldGet(this, _L1ToL2MessageStore_l1ToL2MessagesSubtreeSize, "f"); messageIndex++) {
|
|
30
27
|
// This is inefficient but probably fine for now.
|
|
31
28
|
const key = `${blockNumber}-${messageIndex}`;
|
|
32
29
|
const message = this.store.get(key);
|
|
@@ -44,76 +41,22 @@ export class NewL1ToL2MessageStore {
|
|
|
44
41
|
}
|
|
45
42
|
return messages;
|
|
46
43
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
this.store = new Map();
|
|
60
|
-
}
|
|
61
|
-
addMessage(entryKey, message) {
|
|
62
|
-
const entryKeyBigInt = entryKey.toBigInt();
|
|
63
|
-
const msgAndCount = this.store.get(entryKeyBigInt);
|
|
64
|
-
if (msgAndCount) {
|
|
65
|
-
msgAndCount.count++;
|
|
66
|
-
}
|
|
67
|
-
else {
|
|
68
|
-
this.store.set(entryKeyBigInt, { message, count: 1 });
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
getMessage(entryKey) {
|
|
72
|
-
return this.store.get(entryKey.value)?.message;
|
|
73
|
-
}
|
|
74
|
-
getMessageAndCount(entryKey) {
|
|
75
|
-
return this.store.get(entryKey.value);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* Specifically for the store that will hold pending messages
|
|
80
|
-
* for removing messages or fetching multiple messages.
|
|
81
|
-
*/
|
|
82
|
-
export class PendingL1ToL2MessageStore extends L1ToL2MessageStore {
|
|
83
|
-
getEntryKeys(limit) {
|
|
84
|
-
if (limit < 1) {
|
|
85
|
-
return [];
|
|
86
|
-
}
|
|
87
|
-
// fetch `limit` number of messages from the store with the highest fee.
|
|
88
|
-
// Note the store has multiple of the same message. So if a message has count 2, include both of them in the result:
|
|
89
|
-
const messages = [];
|
|
90
|
-
const sortedMessages = Array.from(this.store.values()).sort((a, b) => b.message.fee - a.message.fee);
|
|
91
|
-
for (const messageAndCount of sortedMessages) {
|
|
92
|
-
for (let i = 0; i < messageAndCount.count; i++) {
|
|
93
|
-
messages.push(messageAndCount.message.entryKey);
|
|
94
|
-
if (messages.length === limit) {
|
|
95
|
-
return messages;
|
|
96
|
-
}
|
|
44
|
+
/**
|
|
45
|
+
* Gets the L1 to L2 message index in the L1 to L2 message tree.
|
|
46
|
+
* @param l1ToL2Message - The L1 to L2 message.
|
|
47
|
+
* @returns The index of the L1 to L2 message in the L1 to L2 message tree (undefined if not found).
|
|
48
|
+
*/
|
|
49
|
+
getMessageIndex(l1ToL2Message) {
|
|
50
|
+
for (const [key, message] of this.store.entries()) {
|
|
51
|
+
if (message.equals(l1ToL2Message)) {
|
|
52
|
+
const [blockNumber, messageIndex] = key.split('-');
|
|
53
|
+
const indexInTheWholeTree = (BigInt(blockNumber) - BigInt(INITIAL_L2_BLOCK_NUM)) * BigInt(NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP) +
|
|
54
|
+
BigInt(messageIndex);
|
|
55
|
+
return indexInTheWholeTree;
|
|
97
56
|
}
|
|
98
57
|
}
|
|
99
|
-
return
|
|
100
|
-
}
|
|
101
|
-
removeMessage(entryKey) {
|
|
102
|
-
// ignore 0 - entryKey is a hash, so a 0 can probabilistically never occur. It is best to skip it.
|
|
103
|
-
if (entryKey.equals(Fr.ZERO)) {
|
|
104
|
-
return;
|
|
105
|
-
}
|
|
106
|
-
const entryKeyBigInt = entryKey.value;
|
|
107
|
-
const msgAndCount = this.store.get(entryKeyBigInt);
|
|
108
|
-
if (!msgAndCount) {
|
|
109
|
-
throw new Error(`Unable to remove message: L1 to L2 Message with key ${entryKeyBigInt} not found in store`);
|
|
110
|
-
}
|
|
111
|
-
if (msgAndCount.count > 1) {
|
|
112
|
-
msgAndCount.count--;
|
|
113
|
-
}
|
|
114
|
-
else {
|
|
115
|
-
this.store.delete(entryKeyBigInt);
|
|
116
|
-
}
|
|
58
|
+
return undefined;
|
|
117
59
|
}
|
|
118
60
|
}
|
|
119
|
-
|
|
61
|
+
_L1ToL2MessageStore_l1ToL2MessagesSubtreeSize = new WeakMap();
|
|
62
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibDFfdG9fbDJfbWVzc2FnZV9zdG9yZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9hcmNoaXZlci9tZW1vcnlfYXJjaGl2ZXJfc3RvcmUvbDFfdG9fbDJfbWVzc2FnZV9zdG9yZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUNBLE9BQU8sRUFDTCxvQkFBb0IsRUFDcEIsMkJBQTJCLEVBQzNCLG1DQUFtQyxHQUNwQyxNQUFNLDhCQUE4QixDQUFDO0FBR3RDOztHQUVHO0FBQ0gsTUFBTSxPQUFPLGtCQUFrQjtJQVM3QjtRQVJBOzs7V0FHRztRQUNPLFVBQUssR0FBb0IsSUFBSSxHQUFHLEVBQUUsQ0FBQztRQUU3Qyx3REFBNkIsQ0FBQyxJQUFJLDJCQUEyQixFQUFDO0lBRS9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Q0FBQztpQkFBTSxDQUFDO2dCQUNOLHFCQUFxQixHQUFHLElBQUksQ0FBQztnQkFDN0IsOEdBQThHO2dCQUM5RyxtRkFBbUY7WUFDckYsQ0FBQztRQUNILENBQUM7UUFDRCxPQUFPLFFBQVEsQ0FBQztJQUNsQixDQUFDO0lBRUQ7Ozs7T0FJRztJQUNILGVBQWUsQ0FBQyxhQUFpQjtRQUMvQixLQUFLLE1BQU0sQ0FBQyxHQUFHLEVBQUUsT0FBTyxDQUFDLElBQUksSUFBSSxDQUFDLEtBQUssQ0FBQyxPQUFPLEVBQUUsRUFBRSxDQUFDO1lBQ2xELElBQUksT0FBTyxDQUFDLE1BQU0sQ0FBQyxhQUFhLENBQUMsRUFBRSxDQUFDO2dCQUNsQyxNQUFNLENBQUMsV0FBVyxFQUFFLFlBQVksQ0FBQyxHQUFHLEdBQUcsQ0FBQyxLQUFLLENBQUMsR0FBRyxDQUFDLENBQUM7Z0JBQ25ELE1BQU0sbUJBQW1CLEdBQ3ZCLENBQUMsTUFBTSxDQUFDLFdBQVcsQ0FBQyxHQUFHLE1BQU0sQ0FBQyxvQkFBb0IsQ0FBQyxDQUFDLEdBQUcsTUFBTSxDQUFDLG1DQUFtQyxDQUFDO29CQUNsRyxNQUFNLENBQUMsWUFBWSxDQUFDLENBQUM7Z0JBQ3ZCLE9BQU8sbUJBQW1CLENBQUM7WUFDN0IsQ0FBQztRQUNILENBQUM7UUFDRCxPQUFPLFNBQVMsQ0FBQztJQUNuQixDQUFDO0NBQ0YifQ==
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
-
import { Body,
|
|
2
|
+
import { Body, GetUnencryptedLogsResponse, InboxLeaf, L2Block, L2BlockL2Logs, LogFilter, LogType, TxEffect, TxHash, TxReceipt } from '@aztec/circuit-types';
|
|
3
3
|
import { Fr } from '@aztec/circuits.js';
|
|
4
4
|
import { AztecAddress } from '@aztec/foundation/aztec-address';
|
|
5
5
|
import { ContractClassPublic, ContractInstanceWithAddress } from '@aztec/types/contracts';
|
|
6
|
-
import { ArchiverDataStore } from '../archiver_store.js';
|
|
6
|
+
import { ArchiverDataStore, ArchiverL1SynchPoint } from '../archiver_store.js';
|
|
7
|
+
import { DataRetrieval } from '../data_retrieval.js';
|
|
7
8
|
/**
|
|
8
9
|
* Simple, in-memory implementation of an archiver data store.
|
|
9
10
|
*/
|
|
@@ -33,28 +34,13 @@ export declare class MemoryArchiverStore implements ArchiverDataStore {
|
|
|
33
34
|
*/
|
|
34
35
|
private unencryptedLogsPerBlock;
|
|
35
36
|
/**
|
|
36
|
-
*
|
|
37
|
+
* Contains all L1 to L2 messages.
|
|
37
38
|
*/
|
|
38
|
-
private
|
|
39
|
-
/**
|
|
40
|
-
* A mapping of contract address to extended contract data.
|
|
41
|
-
*/
|
|
42
|
-
private extendedContractData;
|
|
43
|
-
private newL1ToL2Messages;
|
|
44
|
-
/**
|
|
45
|
-
* Contains all the confirmed L1 to L2 messages (i.e. messages that were consumed in an L2 block)
|
|
46
|
-
* It is a map of entryKey to the corresponding L1 to L2 message and the number of times it has appeared
|
|
47
|
-
*/
|
|
48
|
-
private confirmedL1ToL2Messages;
|
|
49
|
-
/**
|
|
50
|
-
* Contains all the pending L1 to L2 messages (accounts for duplication of messages)
|
|
51
|
-
*/
|
|
52
|
-
private pendingL1ToL2Messages;
|
|
39
|
+
private l1ToL2Messages;
|
|
53
40
|
private contractClasses;
|
|
54
41
|
private contractInstances;
|
|
42
|
+
private lastL1BlockNewBlocks;
|
|
55
43
|
private lastL1BlockNewMessages;
|
|
56
|
-
private lastL1BlockAddedMessages;
|
|
57
|
-
private lastL1BlockCancelledMessages;
|
|
58
44
|
constructor(
|
|
59
45
|
/** The max number of logs that can be obtained in 1 "getUnencryptedLogs" call. */
|
|
60
46
|
maxLogs: number);
|
|
@@ -65,10 +51,10 @@ export declare class MemoryArchiverStore implements ArchiverDataStore {
|
|
|
65
51
|
addContractInstances(data: ContractInstanceWithAddress[], _blockNumber: number): Promise<boolean>;
|
|
66
52
|
/**
|
|
67
53
|
* Append new blocks to the store's list.
|
|
68
|
-
* @param blocks - The L2 blocks to be added to the store.
|
|
69
|
-
* @returns True if the operation is successful
|
|
54
|
+
* @param blocks - The L2 blocks to be added to the store and the last processed L1 block.
|
|
55
|
+
* @returns True if the operation is successful.
|
|
70
56
|
*/
|
|
71
|
-
addBlocks(blocks: L2Block
|
|
57
|
+
addBlocks(blocks: DataRetrieval<L2Block>): Promise<boolean>;
|
|
72
58
|
/**
|
|
73
59
|
* Append new block bodies to the store's list.
|
|
74
60
|
* @param blockBodies - The L2 block bodies to be added to the store.
|
|
@@ -91,40 +77,17 @@ export declare class MemoryArchiverStore implements ArchiverDataStore {
|
|
|
91
77
|
*/
|
|
92
78
|
addLogs(encryptedLogs: L2BlockL2Logs, unencryptedLogs: L2BlockL2Logs, blockNumber: number): Promise<boolean>;
|
|
93
79
|
/**
|
|
94
|
-
* Append
|
|
95
|
-
* @param messages - The L1 to L2 messages to be added to the store.
|
|
96
|
-
* @param lastMessageL1BlockNumber - The L1 block number in which the last message was emitted.
|
|
80
|
+
* Append L1 to L2 messages to the store.
|
|
81
|
+
* @param messages - The L1 to L2 messages to be added to the store and the last processed L1 block.
|
|
97
82
|
* @returns True if the operation is successful.
|
|
98
83
|
*/
|
|
99
|
-
|
|
84
|
+
addL1ToL2Messages(messages: DataRetrieval<InboxLeaf>): Promise<boolean>;
|
|
100
85
|
/**
|
|
101
|
-
*
|
|
102
|
-
* @param
|
|
103
|
-
* @
|
|
104
|
-
* @returns True if the operation is successful (always in this implementation).
|
|
86
|
+
* Gets the L1 to L2 message index in the L1 to L2 message tree.
|
|
87
|
+
* @param l1ToL2Message - The L1 to L2 message.
|
|
88
|
+
* @returns The index of the L1 to L2 message in the L1 to L2 message tree (undefined if not found).
|
|
105
89
|
*/
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* Remove pending L1 to L2 messages from the store (if they were cancelled).
|
|
109
|
-
* @param messages - The entry keys to be removed from the store.
|
|
110
|
-
* @param l1BlockNumber - The L1 block number for which to remove the messages.
|
|
111
|
-
* @returns True if the operation is successful (always in this implementation).
|
|
112
|
-
*/
|
|
113
|
-
cancelPendingL1ToL2EntryKeys(messages: Fr[], l1BlockNumber: bigint): Promise<boolean>;
|
|
114
|
-
/**
|
|
115
|
-
* Messages that have been published in an L2 block are confirmed.
|
|
116
|
-
* Add them to the confirmed store, also remove them from the pending store.
|
|
117
|
-
* @param entryKeys - The entry keys to be removed from the store.
|
|
118
|
-
* @returns True if the operation is successful (always in this implementation).
|
|
119
|
-
*/
|
|
120
|
-
confirmL1ToL2EntryKeys(entryKeys: Fr[]): Promise<boolean>;
|
|
121
|
-
/**
|
|
122
|
-
* Store new extended contract data from an L2 block to the store's list.
|
|
123
|
-
* @param data - List of contracts' data to be added.
|
|
124
|
-
* @param blockNum - Number of the L2 block the contract data was deployed in.
|
|
125
|
-
* @returns True if the operation is successful (always in this implementation).
|
|
126
|
-
*/
|
|
127
|
-
addExtendedContractData(data: ExtendedContractData[], blockNum: number): Promise<boolean>;
|
|
90
|
+
getL1ToL2MessageIndex(l1ToL2Message: Fr): Promise<bigint | undefined>;
|
|
128
91
|
/**
|
|
129
92
|
* Gets up to `limit` amount of L2 blocks starting from `from`.
|
|
130
93
|
* @param from - Number of the first block to return (inclusive).
|
|
@@ -146,23 +109,11 @@ export declare class MemoryArchiverStore implements ArchiverDataStore {
|
|
|
146
109
|
*/
|
|
147
110
|
getSettledTxReceipt(txHash: TxHash): Promise<TxReceipt | undefined>;
|
|
148
111
|
/**
|
|
149
|
-
* Gets
|
|
150
|
-
* @param limit - The number of messages to return (by default NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP).
|
|
151
|
-
* @returns The requested L1 to L2 entry keys.
|
|
152
|
-
*/
|
|
153
|
-
getPendingL1ToL2EntryKeys(limit?: number): Promise<Fr[]>;
|
|
154
|
-
/**
|
|
155
|
-
* Gets the confirmed L1 to L2 message corresponding to the given entry key.
|
|
156
|
-
* @param entryKey - The entry key to look up.
|
|
157
|
-
* @returns The requested L1 to L2 message or throws if not found.
|
|
158
|
-
*/
|
|
159
|
-
getConfirmedL1ToL2Message(entryKey: Fr): Promise<L1ToL2Message>;
|
|
160
|
-
/**
|
|
161
|
-
* Gets new L1 to L2 message (to be) included in a given block.
|
|
112
|
+
* Gets L1 to L2 message (to be) included in a given block.
|
|
162
113
|
* @param blockNumber - L2 block number to get messages for.
|
|
163
114
|
* @returns The L1 to L2 messages/leaves of the messages subtree (throws if not found).
|
|
164
115
|
*/
|
|
165
|
-
|
|
116
|
+
getL1ToL2Messages(blockNumber: bigint): Promise<Fr[]>;
|
|
166
117
|
/**
|
|
167
118
|
* Gets up to `limit` amount of logs starting from `from`.
|
|
168
119
|
* @param from - Number of the L2 block to which corresponds the first logs to be returned.
|
|
@@ -178,23 +129,11 @@ export declare class MemoryArchiverStore implements ArchiverDataStore {
|
|
|
178
129
|
* @remarks Works by doing an intersection of all params in the filter.
|
|
179
130
|
*/
|
|
180
131
|
getUnencryptedLogs(filter: LogFilter): Promise<GetUnencryptedLogsResponse>;
|
|
181
|
-
/**
|
|
182
|
-
* Get the extended contract data for this contract.
|
|
183
|
-
* TODO(palla/purge-old-contract-deploy): Delete me?
|
|
184
|
-
* @param contractAddress - The contract data address.
|
|
185
|
-
* @returns The extended contract data or undefined if not found.
|
|
186
|
-
*/
|
|
187
|
-
getExtendedContractData(contractAddress: AztecAddress): Promise<ExtendedContractData | undefined>;
|
|
188
132
|
/**
|
|
189
133
|
* Gets the number of the latest L2 block processed.
|
|
190
134
|
* @returns The number of the latest L2 block processed.
|
|
191
135
|
*/
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
addedBlock: bigint;
|
|
195
|
-
newMessages: bigint;
|
|
196
|
-
addedMessages: bigint;
|
|
197
|
-
cancelledMessages: bigint;
|
|
198
|
-
}>;
|
|
136
|
+
getSynchedL2BlockNumber(): Promise<number>;
|
|
137
|
+
getSynchedL1BlockNumbers(): Promise<ArchiverL1SynchPoint>;
|
|
199
138
|
}
|
|
200
139
|
//# sourceMappingURL=memory_archiver_store.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"memory_archiver_store.d.ts","sourceRoot":"","sources":["../../../src/archiver/memory_archiver_store/memory_archiver_store.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,IAAI,
|
|
1
|
+
{"version":3,"file":"memory_archiver_store.d.ts","sourceRoot":"","sources":["../../../src/archiver/memory_archiver_store/memory_archiver_store.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,IAAI,EAEJ,0BAA0B,EAC1B,SAAS,EACT,OAAO,EAEP,aAAa,EACb,SAAS,EAET,OAAO,EACP,QAAQ,EACR,MAAM,EACN,SAAS,EAGV,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,EAAE,EAAwB,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EAAE,mBAAmB,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AAE1F,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC/E,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAGrD;;GAEG;AACH,qBAAa,mBAAoB,YAAW,iBAAiB;IAyCzD,kFAAkF;aAClE,OAAO,EAAE,MAAM;IAzCjC;;OAEG;IACH,OAAO,CAAC,eAAe,CAAwB;IAE/C;;OAEG;IACH,OAAO,CAAC,aAAa,CAAgC;IAErD;;OAEG;IACH,OAAO,CAAC,SAAS,CAAkB;IAEnC;;;OAGG;IACH,OAAO,CAAC,qBAAqB,CAAuB;IAEpD;;;OAGG;IACH,OAAO,CAAC,uBAAuB,CAAuB;IAEtD;;OAEG;IACH,OAAO,CAAC,cAAc,CAA4B;IAElD,OAAO,CAAC,eAAe,CAA+C;IAEtE,OAAO,CAAC,iBAA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