@aztec/txe 0.0.1-commit.d3ec352c → 0.0.1-commit.d6f2b3f94
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/constants.d.ts +3 -0
- package/dest/constants.d.ts.map +1 -0
- package/dest/constants.js +2 -0
- package/dest/index.d.ts +1 -1
- package/dest/index.d.ts.map +1 -1
- package/dest/index.js +3 -2
- package/dest/oracle/interfaces.d.ts +7 -5
- package/dest/oracle/interfaces.d.ts.map +1 -1
- package/dest/oracle/txe_oracle_public_context.d.ts +5 -5
- package/dest/oracle/txe_oracle_public_context.d.ts.map +1 -1
- package/dest/oracle/txe_oracle_public_context.js +10 -12
- package/dest/oracle/txe_oracle_top_level_context.d.ts +21 -12
- package/dest/oracle/txe_oracle_top_level_context.d.ts.map +1 -1
- package/dest/oracle/txe_oracle_top_level_context.js +119 -63
- package/dest/rpc_translator.d.ts +27 -15
- package/dest/rpc_translator.d.ts.map +1 -1
- package/dest/rpc_translator.js +117 -53
- package/dest/state_machine/archiver.d.ts +21 -57
- package/dest/state_machine/archiver.d.ts.map +1 -1
- package/dest/state_machine/archiver.js +63 -107
- package/dest/state_machine/dummy_p2p_client.d.ts +14 -12
- package/dest/state_machine/dummy_p2p_client.d.ts.map +1 -1
- package/dest/state_machine/dummy_p2p_client.js +29 -21
- package/dest/state_machine/global_variable_builder.d.ts +4 -3
- package/dest/state_machine/global_variable_builder.d.ts.map +1 -1
- package/dest/state_machine/global_variable_builder.js +13 -1
- package/dest/state_machine/index.d.ts +7 -7
- package/dest/state_machine/index.d.ts.map +1 -1
- package/dest/state_machine/index.js +40 -23
- package/dest/state_machine/mock_epoch_cache.d.ts +9 -6
- package/dest/state_machine/mock_epoch_cache.d.ts.map +1 -1
- package/dest/state_machine/mock_epoch_cache.js +14 -7
- package/dest/state_machine/synchronizer.d.ts +3 -3
- package/dest/state_machine/synchronizer.d.ts.map +1 -1
- package/dest/state_machine/synchronizer.js +2 -2
- package/dest/txe_session.d.ts +18 -10
- package/dest/txe_session.d.ts.map +1 -1
- package/dest/txe_session.js +95 -46
- package/dest/util/encoding.d.ts +618 -19
- package/dest/util/encoding.d.ts.map +1 -1
- package/dest/util/encoding.js +1 -1
- package/dest/util/txe_account_store.d.ts +10 -0
- package/dest/util/txe_account_store.d.ts.map +1 -0
- package/dest/util/{txe_account_data_provider.js → txe_account_store.js} +1 -1
- package/dest/util/txe_contract_store.d.ts +12 -0
- package/dest/util/txe_contract_store.d.ts.map +1 -0
- package/dest/util/{txe_contract_data_provider.js → txe_contract_store.js} +3 -3
- package/dest/util/txe_public_contract_data_source.d.ts +5 -5
- package/dest/util/txe_public_contract_data_source.d.ts.map +1 -1
- package/dest/util/txe_public_contract_data_source.js +11 -11
- package/dest/utils/block_creation.d.ts +19 -5
- package/dest/utils/block_creation.d.ts.map +1 -1
- package/dest/utils/block_creation.js +38 -4
- package/dest/utils/tx_effect_creation.d.ts +2 -3
- package/dest/utils/tx_effect_creation.d.ts.map +1 -1
- package/dest/utils/tx_effect_creation.js +4 -7
- package/package.json +16 -16
- package/src/constants.ts +3 -0
- package/src/index.ts +15 -12
- package/src/oracle/interfaces.ts +6 -4
- package/src/oracle/txe_oracle_public_context.ts +10 -17
- package/src/oracle/txe_oracle_top_level_context.ts +189 -92
- package/src/rpc_translator.ts +138 -56
- package/src/state_machine/archiver.ts +59 -131
- package/src/state_machine/dummy_p2p_client.ts +40 -27
- package/src/state_machine/global_variable_builder.ts +19 -2
- package/src/state_machine/index.ts +60 -22
- package/src/state_machine/mock_epoch_cache.ts +15 -11
- package/src/state_machine/synchronizer.ts +3 -4
- package/src/txe_session.ts +189 -79
- package/src/util/encoding.ts +1 -1
- package/src/util/{txe_account_data_provider.ts → txe_account_store.ts} +1 -1
- package/src/util/{txe_contract_data_provider.ts → txe_contract_store.ts} +3 -3
- package/src/util/txe_public_contract_data_source.ts +10 -10
- package/src/utils/block_creation.ts +48 -15
- package/src/utils/tx_effect_creation.ts +4 -12
- package/dest/util/txe_account_data_provider.d.ts +0 -10
- package/dest/util/txe_account_data_provider.d.ts.map +0 -1
- package/dest/util/txe_contract_data_provider.d.ts +0 -12
- package/dest/util/txe_contract_data_provider.d.ts.map +0 -1
package/dest/rpc_translator.js
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { Fr, Point } from '@aztec/aztec.js/fields';
|
|
2
2
|
import { MAX_NOTE_HASHES_PER_TX, MAX_NULLIFIERS_PER_TX } from '@aztec/constants';
|
|
3
3
|
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
4
|
-
import {
|
|
5
|
-
import { FunctionSelector, NoteSelector } from '@aztec/stdlib/abi';
|
|
4
|
+
import { packAsHintedNote } from '@aztec/pxe/simulator';
|
|
5
|
+
import { EventSelector, FunctionSelector, NoteSelector } from '@aztec/stdlib/abi';
|
|
6
6
|
import { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
7
|
-
import {
|
|
7
|
+
import { BlockHash } from '@aztec/stdlib/block';
|
|
8
8
|
import { addressFromSingle, arrayOfArraysToBoundedVecOfArrays, arrayToBoundedVec, bufferToU8Array, fromArray, fromSingle, fromUintArray, fromUintBoundedVec, toArray, toForeignCallResult, toSingle } from './util/encoding.js';
|
|
9
|
+
const MAX_EVENT_LEN = 12; // This is MAX_MESSAGE_CONTENT_LEN - PRIVATE_EVENT_RESERVED_FIELDS
|
|
10
|
+
const MAX_PRIVATE_EVENTS_PER_TXE_QUERY = 5;
|
|
9
11
|
export class UnavailableOracleError extends Error {
|
|
10
12
|
constructor(oracleName){
|
|
11
13
|
super(`${oracleName} oracles not available with the current handler`);
|
|
@@ -81,6 +83,12 @@ export class RPCTranslator {
|
|
|
81
83
|
}
|
|
82
84
|
// Other oracles - these get handled by the oracle handler
|
|
83
85
|
// TXE-specific oracles
|
|
86
|
+
txeGetDefaultAddress() {
|
|
87
|
+
const defaultAddress = this.handlerAsTxe().txeGetDefaultAddress();
|
|
88
|
+
return toForeignCallResult([
|
|
89
|
+
toSingle(defaultAddress)
|
|
90
|
+
]);
|
|
91
|
+
}
|
|
84
92
|
async txeGetNextBlockNumber() {
|
|
85
93
|
const nextBlockNumber = await this.handlerAsTxe().txeGetNextBlockNumber();
|
|
86
94
|
return toForeignCallResult([
|
|
@@ -164,6 +172,28 @@ export class RPCTranslator {
|
|
|
164
172
|
...arrayToBoundedVec(toArray(nullifiers), MAX_NULLIFIERS_PER_TX)
|
|
165
173
|
]);
|
|
166
174
|
}
|
|
175
|
+
async txeGetPrivateEvents(foreignSelector, foreignContractAddress, foreignScope) {
|
|
176
|
+
const selector = EventSelector.fromField(fromSingle(foreignSelector));
|
|
177
|
+
const contractAddress = addressFromSingle(foreignContractAddress);
|
|
178
|
+
const scope = addressFromSingle(foreignScope);
|
|
179
|
+
const events = await this.handlerAsTxe().txeGetPrivateEvents(selector, contractAddress, scope);
|
|
180
|
+
if (events.length > MAX_PRIVATE_EVENTS_PER_TXE_QUERY) {
|
|
181
|
+
throw new Error(`Array of length ${events.length} larger than maxLen ${MAX_PRIVATE_EVENTS_PER_TXE_QUERY}`);
|
|
182
|
+
}
|
|
183
|
+
if (events.some((e)=>e.length > MAX_EVENT_LEN)) {
|
|
184
|
+
throw new Error(`Some private event has length larger than maxLen ${MAX_EVENT_LEN}`);
|
|
185
|
+
}
|
|
186
|
+
// This is a workaround as Noir does not currently let us return nested structs with arrays. We instead return a raw
|
|
187
|
+
// multidimensional array in get_private_events_oracle and create the BoundedVecs here.
|
|
188
|
+
const rawArrayStorage = events.map((e)=>e.concat(Array(MAX_EVENT_LEN - e.length).fill(new Fr(0)))).concat(Array(MAX_PRIVATE_EVENTS_PER_TXE_QUERY - events.length).fill(Array(MAX_EVENT_LEN).fill(new Fr(0)))).flat();
|
|
189
|
+
const eventLengths = events.map((e)=>new Fr(e.length)).concat(Array(MAX_PRIVATE_EVENTS_PER_TXE_QUERY - events.length).fill(new Fr(0)));
|
|
190
|
+
const queryLength = new Fr(events.length);
|
|
191
|
+
return toForeignCallResult([
|
|
192
|
+
toArray(rawArrayStorage),
|
|
193
|
+
toArray(eventLengths),
|
|
194
|
+
toSingle(queryLength)
|
|
195
|
+
]);
|
|
196
|
+
}
|
|
167
197
|
privateStoreInExecutionCache(foreignValues, foreignHash) {
|
|
168
198
|
const values = fromArray(foreignValues);
|
|
169
199
|
const hash = fromSingle(foreignHash);
|
|
@@ -179,34 +209,35 @@ export class RPCTranslator {
|
|
|
179
209
|
}
|
|
180
210
|
// When the argument is a slice, noir automatically adds a length field to oracle call.
|
|
181
211
|
// When the argument is an array, we add the field length manually to the signature.
|
|
182
|
-
utilityDebugLog(foreignLevel, foreignMessage, _foreignLength, foreignFields) {
|
|
212
|
+
async utilityDebugLog(foreignLevel, foreignMessage, _foreignLength, foreignFields) {
|
|
183
213
|
const level = fromSingle(foreignLevel).toNumber();
|
|
184
214
|
const message = fromArray(foreignMessage).map((field)=>String.fromCharCode(field.toNumber())).join('');
|
|
185
215
|
const fields = fromArray(foreignFields);
|
|
186
|
-
this.handlerAsMisc().utilityDebugLog(level, message, fields);
|
|
216
|
+
await this.handlerAsMisc().utilityDebugLog(level, message, fields);
|
|
187
217
|
return toForeignCallResult([]);
|
|
188
218
|
}
|
|
189
|
-
async utilityStorageRead(foreignContractAddress, foreignStartStorageSlot,
|
|
219
|
+
async utilityStorageRead(foreignBlockHash, foreignContractAddress, foreignStartStorageSlot, foreignNumberOfElements) {
|
|
220
|
+
const blockHash = new BlockHash(fromSingle(foreignBlockHash));
|
|
190
221
|
const contractAddress = addressFromSingle(foreignContractAddress);
|
|
191
222
|
const startStorageSlot = fromSingle(foreignStartStorageSlot);
|
|
192
|
-
const blockNumber = BlockNumber(fromSingle(foreignBlockNumber).toNumber());
|
|
193
223
|
const numberOfElements = fromSingle(foreignNumberOfElements).toNumber();
|
|
194
|
-
const values = await this.handlerAsUtility().utilityStorageRead(contractAddress, startStorageSlot,
|
|
224
|
+
const values = await this.handlerAsUtility().utilityStorageRead(blockHash, contractAddress, startStorageSlot, numberOfElements);
|
|
195
225
|
return toForeignCallResult([
|
|
196
226
|
toArray(values)
|
|
197
227
|
]);
|
|
198
228
|
}
|
|
199
|
-
async utilityGetPublicDataWitness(
|
|
200
|
-
const
|
|
229
|
+
async utilityGetPublicDataWitness(foreignBlockHash, foreignLeafSlot) {
|
|
230
|
+
const blockHash = new BlockHash(fromSingle(foreignBlockHash));
|
|
201
231
|
const leafSlot = fromSingle(foreignLeafSlot);
|
|
202
|
-
const witness = await this.handlerAsUtility().utilityGetPublicDataWitness(
|
|
232
|
+
const witness = await this.handlerAsUtility().utilityGetPublicDataWitness(blockHash, leafSlot);
|
|
203
233
|
if (!witness) {
|
|
204
|
-
throw new Error(`Public data witness not found for slot ${leafSlot} at block ${
|
|
234
|
+
throw new Error(`Public data witness not found for slot ${leafSlot} at block ${blockHash.toString()}.`);
|
|
205
235
|
}
|
|
206
236
|
return toForeignCallResult(witness.toNoirRepresentation());
|
|
207
237
|
}
|
|
208
|
-
async utilityGetNotes(
|
|
209
|
-
|
|
238
|
+
async utilityGetNotes(foreignOwnerIsSome, foreignOwnerValue, foreignStorageSlot, foreignNumSelects, foreignSelectByIndexes, foreignSelectByOffsets, foreignSelectByLengths, foreignSelectValues, foreignSelectComparators, foreignSortByIndexes, foreignSortByOffsets, foreignSortByLengths, foreignSortOrder, foreignLimit, foreignOffset, foreignStatus, foreignMaxNotes, foreignPackedHintedNoteLength) {
|
|
239
|
+
// Parse Option<AztecAddress>: ownerIsSome is 0 for None, 1 for Some
|
|
240
|
+
const owner = fromSingle(foreignOwnerIsSome).toBool() ? AztecAddress.fromField(fromSingle(foreignOwnerValue)) : undefined;
|
|
210
241
|
const storageSlot = fromSingle(foreignStorageSlot);
|
|
211
242
|
const numSelects = fromSingle(foreignNumSelects).toNumber();
|
|
212
243
|
const selectByIndexes = fromArray(foreignSelectByIndexes).map((fr)=>fr.toNumber());
|
|
@@ -222,13 +253,21 @@ export class RPCTranslator {
|
|
|
222
253
|
const offset = fromSingle(foreignOffset).toNumber();
|
|
223
254
|
const status = fromSingle(foreignStatus).toNumber();
|
|
224
255
|
const maxNotes = fromSingle(foreignMaxNotes).toNumber();
|
|
225
|
-
const
|
|
256
|
+
const packedHintedNoteLength = fromSingle(foreignPackedHintedNoteLength).toNumber();
|
|
226
257
|
const noteDatas = await this.handlerAsUtility().utilityGetNotes(owner, storageSlot, numSelects, selectByIndexes, selectByOffsets, selectByLengths, selectValues, selectComparators, sortByIndexes, sortByOffsets, sortByLengths, sortOrder, limit, offset, status);
|
|
227
|
-
const returnDataAsArrayOfArrays = noteDatas.map(
|
|
258
|
+
const returnDataAsArrayOfArrays = noteDatas.map((noteData)=>packAsHintedNote({
|
|
259
|
+
contractAddress: noteData.contractAddress,
|
|
260
|
+
owner: noteData.owner,
|
|
261
|
+
randomness: noteData.randomness,
|
|
262
|
+
storageSlot: noteData.storageSlot,
|
|
263
|
+
noteNonce: noteData.noteNonce,
|
|
264
|
+
isPending: noteData.isPending,
|
|
265
|
+
note: noteData.note
|
|
266
|
+
}));
|
|
228
267
|
// Now we convert each sub-array to an array of ForeignCallSingles
|
|
229
268
|
const returnDataAsArrayOfForeignCallSingleArrays = returnDataAsArrayOfArrays.map((subArray)=>subArray.map(toSingle));
|
|
230
269
|
// At last we convert the array of arrays to a bounded vec of arrays
|
|
231
|
-
return toForeignCallResult(arrayOfArraysToBoundedVecOfArrays(returnDataAsArrayOfForeignCallSingleArrays, maxNotes,
|
|
270
|
+
return toForeignCallResult(arrayOfArraysToBoundedVecOfArrays(returnDataAsArrayOfForeignCallSingleArrays, maxNotes, packedHintedNoteLength));
|
|
232
271
|
}
|
|
233
272
|
privateNotifyCreatedNote(foreignOwner, foreignStorageSlot, foreignRandomness, foreignNoteTypeId, foreignNote, foreignNoteHash, foreignCounter) {
|
|
234
273
|
const owner = addressFromSingle(foreignOwner);
|
|
@@ -253,6 +292,14 @@ export class RPCTranslator {
|
|
|
253
292
|
await this.handlerAsPrivate().privateNotifyCreatedNullifier(innerNullifier);
|
|
254
293
|
return toForeignCallResult([]);
|
|
255
294
|
}
|
|
295
|
+
async privateIsNullifierPending(foreignInnerNullifier, foreignContractAddress) {
|
|
296
|
+
const innerNullifier = fromSingle(foreignInnerNullifier);
|
|
297
|
+
const contractAddress = addressFromSingle(foreignContractAddress);
|
|
298
|
+
const isPending = await this.handlerAsPrivate().privateIsNullifierPending(innerNullifier, contractAddress);
|
|
299
|
+
return toForeignCallResult([
|
|
300
|
+
toSingle(new Fr(isPending))
|
|
301
|
+
]);
|
|
302
|
+
}
|
|
256
303
|
async utilityCheckNullifierExists(foreignInnerNullifier) {
|
|
257
304
|
const innerNullifier = fromSingle(foreignInnerNullifier);
|
|
258
305
|
const exists = await this.handlerAsUtility().utilityCheckNullifierExists(innerNullifier);
|
|
@@ -271,15 +318,27 @@ export class RPCTranslator {
|
|
|
271
318
|
...instance.publicKeys.toFields()
|
|
272
319
|
].map(toSingle));
|
|
273
320
|
}
|
|
274
|
-
async
|
|
321
|
+
async utilityTryGetPublicKeysAndPartialAddress(foreignAddress) {
|
|
275
322
|
const address = addressFromSingle(foreignAddress);
|
|
276
|
-
const
|
|
277
|
-
return
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
323
|
+
const result = await this.handlerAsUtility().utilityTryGetPublicKeysAndPartialAddress(address);
|
|
324
|
+
// We are going to return a Noir Option struct to represent the possibility of null values. Options are a struct
|
|
325
|
+
// with two fields: `some` (a boolean) and `value` (a field array in this case).
|
|
326
|
+
if (result === undefined) {
|
|
327
|
+
// No data was found so we set `some` to 0 and pad `value` with zeros get the correct return size.
|
|
328
|
+
return toForeignCallResult([
|
|
329
|
+
toSingle(new Fr(0)),
|
|
330
|
+
toArray(Array(13).fill(new Fr(0)))
|
|
331
|
+
]);
|
|
332
|
+
} else {
|
|
333
|
+
// Data was found so we set `some` to 1 and return it along with `value`.
|
|
334
|
+
return toForeignCallResult([
|
|
335
|
+
toSingle(new Fr(1)),
|
|
336
|
+
toArray([
|
|
337
|
+
...result.publicKeys.toFields(),
|
|
338
|
+
result.partialAddress
|
|
339
|
+
])
|
|
340
|
+
]);
|
|
341
|
+
}
|
|
283
342
|
}
|
|
284
343
|
async utilityGetKeyValidationRequest(foreignPkMHash) {
|
|
285
344
|
const pkMHash = fromSingle(foreignPkMHash);
|
|
@@ -289,12 +348,12 @@ export class RPCTranslator {
|
|
|
289
348
|
privateCallPrivateFunction(_foreignTargetContractAddress, _foreignFunctionSelector, _foreignArgsHash, _foreignSideEffectCounter, _foreignIsStaticCall) {
|
|
290
349
|
throw new Error('Contract calls are forbidden inside a `TestEnvironment::private_context`, use `private_call` instead');
|
|
291
350
|
}
|
|
292
|
-
async utilityGetNullifierMembershipWitness(
|
|
293
|
-
const
|
|
351
|
+
async utilityGetNullifierMembershipWitness(foreignBlockHash, foreignNullifier) {
|
|
352
|
+
const blockHash = new BlockHash(fromSingle(foreignBlockHash));
|
|
294
353
|
const nullifier = fromSingle(foreignNullifier);
|
|
295
|
-
const witness = await this.handlerAsUtility().utilityGetNullifierMembershipWitness(
|
|
354
|
+
const witness = await this.handlerAsUtility().utilityGetNullifierMembershipWitness(blockHash, nullifier);
|
|
296
355
|
if (!witness) {
|
|
297
|
-
throw new Error(`Nullifier membership witness not found at block ${
|
|
356
|
+
throw new Error(`Nullifier membership witness not found at block ${blockHash}.`);
|
|
298
357
|
}
|
|
299
358
|
return toForeignCallResult(witness.toNoirRepresentation());
|
|
300
359
|
}
|
|
@@ -324,8 +383,8 @@ export class RPCTranslator {
|
|
|
324
383
|
toSingle(new Fr(isRevertible))
|
|
325
384
|
]);
|
|
326
385
|
}
|
|
327
|
-
|
|
328
|
-
const context =
|
|
386
|
+
utilityGetUtilityContext() {
|
|
387
|
+
const context = this.handlerAsUtility().utilityGetUtilityContext();
|
|
329
388
|
return toForeignCallResult(context.toNoirRepresentation());
|
|
330
389
|
}
|
|
331
390
|
async utilityGetBlockHeader(foreignBlockNumber) {
|
|
@@ -336,25 +395,30 @@ export class RPCTranslator {
|
|
|
336
395
|
}
|
|
337
396
|
return toForeignCallResult(header.toFields().map(toSingle));
|
|
338
397
|
}
|
|
339
|
-
async
|
|
340
|
-
const
|
|
341
|
-
const
|
|
342
|
-
const
|
|
343
|
-
const witness = await this.handlerAsUtility().utilityGetMembershipWitness(blockNumber, treeId, leafValue);
|
|
398
|
+
async utilityGetNoteHashMembershipWitness(foreignAnchorBlockHash, foreignNoteHash) {
|
|
399
|
+
const blockHash = new BlockHash(fromSingle(foreignAnchorBlockHash));
|
|
400
|
+
const noteHash = fromSingle(foreignNoteHash);
|
|
401
|
+
const witness = await this.handlerAsUtility().utilityGetNoteHashMembershipWitness(blockHash, noteHash);
|
|
344
402
|
if (!witness) {
|
|
345
|
-
throw new Error(`
|
|
403
|
+
throw new Error(`Note hash ${noteHash} not found in the note hash tree at block ${blockHash.toString()}.`);
|
|
346
404
|
}
|
|
347
|
-
return toForeignCallResult(
|
|
348
|
-
toSingle(witness[0]),
|
|
349
|
-
toArray(witness.slice(1))
|
|
350
|
-
]);
|
|
405
|
+
return toForeignCallResult(witness.toNoirRepresentation());
|
|
351
406
|
}
|
|
352
|
-
async
|
|
353
|
-
const
|
|
407
|
+
async utilityGetBlockHashMembershipWitness(foreignAnchorBlockHash, foreignBlockHash) {
|
|
408
|
+
const anchorBlockHash = new BlockHash(fromSingle(foreignAnchorBlockHash));
|
|
409
|
+
const blockHash = new BlockHash(fromSingle(foreignBlockHash));
|
|
410
|
+
const witness = await this.handlerAsUtility().utilityGetBlockHashMembershipWitness(anchorBlockHash, blockHash);
|
|
411
|
+
if (!witness) {
|
|
412
|
+
throw new Error(`Block hash ${blockHash.toString()} not found in the archive tree at anchor block ${anchorBlockHash.toString()}.`);
|
|
413
|
+
}
|
|
414
|
+
return toForeignCallResult(witness.toNoirRepresentation());
|
|
415
|
+
}
|
|
416
|
+
async utilityGetLowNullifierMembershipWitness(foreignBlockHash, foreignNullifier) {
|
|
417
|
+
const blockHash = new BlockHash(fromSingle(foreignBlockHash));
|
|
354
418
|
const nullifier = fromSingle(foreignNullifier);
|
|
355
|
-
const witness = await this.handlerAsUtility().utilityGetLowNullifierMembershipWitness(
|
|
419
|
+
const witness = await this.handlerAsUtility().utilityGetLowNullifierMembershipWitness(blockHash, nullifier);
|
|
356
420
|
if (!witness) {
|
|
357
|
-
throw new Error(`Low nullifier witness not found for nullifier ${nullifier} at block ${
|
|
421
|
+
throw new Error(`Low nullifier witness not found for nullifier ${nullifier} at block ${blockHash}.`);
|
|
358
422
|
}
|
|
359
423
|
return toForeignCallResult(witness.toNoirRepresentation());
|
|
360
424
|
}
|
|
@@ -363,11 +427,11 @@ export class RPCTranslator {
|
|
|
363
427
|
await this.handlerAsUtility().utilityFetchTaggedLogs(pendingTaggedLogArrayBaseSlot);
|
|
364
428
|
return toForeignCallResult([]);
|
|
365
429
|
}
|
|
366
|
-
async
|
|
430
|
+
async utilityValidateAndStoreEnqueuedNotesAndEvents(foreignContractAddress, foreignNoteValidationRequestsArrayBaseSlot, foreignEventValidationRequestsArrayBaseSlot) {
|
|
367
431
|
const contractAddress = AztecAddress.fromField(fromSingle(foreignContractAddress));
|
|
368
432
|
const noteValidationRequestsArrayBaseSlot = fromSingle(foreignNoteValidationRequestsArrayBaseSlot);
|
|
369
433
|
const eventValidationRequestsArrayBaseSlot = fromSingle(foreignEventValidationRequestsArrayBaseSlot);
|
|
370
|
-
await this.handlerAsUtility().
|
|
434
|
+
await this.handlerAsUtility().utilityValidateAndStoreEnqueuedNotesAndEvents(contractAddress, noteValidationRequestsArrayBaseSlot, eventValidationRequestsArrayBaseSlot);
|
|
371
435
|
return toForeignCallResult([]);
|
|
372
436
|
}
|
|
373
437
|
async utilityBulkRetrieveLogs(foreignContractAddress, foreignLogRetrievalRequestsArrayBaseSlot, foreignLogRetrievalResponsesArrayBaseSlot) {
|
|
@@ -448,9 +512,10 @@ export class RPCTranslator {
|
|
|
448
512
|
// TODO(#8811): Implement
|
|
449
513
|
return toForeignCallResult([]);
|
|
450
514
|
}
|
|
451
|
-
async avmOpcodeStorageRead(foreignSlot) {
|
|
515
|
+
async avmOpcodeStorageRead(foreignSlot, foreignContractAddress) {
|
|
452
516
|
const slot = fromSingle(foreignSlot);
|
|
453
|
-
const
|
|
517
|
+
const contractAddress = AztecAddress.fromField(fromSingle(foreignContractAddress));
|
|
518
|
+
const value = (await this.handlerAsAvm().avmOpcodeStorageRead(slot, contractAddress)).value;
|
|
454
519
|
return toForeignCallResult([
|
|
455
520
|
toSingle(new Fr(value))
|
|
456
521
|
]);
|
|
@@ -504,10 +569,9 @@ export class RPCTranslator {
|
|
|
504
569
|
await this.handlerAsAvm().avmOpcodeEmitNoteHash(noteHash);
|
|
505
570
|
return toForeignCallResult([]);
|
|
506
571
|
}
|
|
507
|
-
async avmOpcodeNullifierExists(
|
|
508
|
-
const
|
|
509
|
-
const
|
|
510
|
-
const exists = await this.handlerAsAvm().avmOpcodeNullifierExists(innerNullifier, targetAddress);
|
|
572
|
+
async avmOpcodeNullifierExists(foreignSiloedNullifier) {
|
|
573
|
+
const siloedNullifier = fromSingle(foreignSiloedNullifier);
|
|
574
|
+
const exists = await this.handlerAsAvm().avmOpcodeNullifierExists(siloedNullifier);
|
|
511
575
|
return toForeignCallResult([
|
|
512
576
|
toSingle(new Fr(exists))
|
|
513
577
|
]);
|
|
@@ -1,67 +1,31 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { ArchiverDataSourceBase } from '@aztec/archiver';
|
|
2
|
+
import { type EpochNumber, type SlotNumber } from '@aztec/foundation/branded-types';
|
|
3
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
3
4
|
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
4
|
-
import { Fr } from '@aztec/foundation/fields';
|
|
5
5
|
import type { AztecAsyncKVStore } from '@aztec/kv-store';
|
|
6
|
-
import type {
|
|
7
|
-
import type {
|
|
8
|
-
import type { Checkpoint, PublishedCheckpoint } from '@aztec/stdlib/checkpoint';
|
|
9
|
-
import type { ContractInstanceWithAddress } from '@aztec/stdlib/contract';
|
|
6
|
+
import type { L2Tips, ValidateCheckpointResult } from '@aztec/stdlib/block';
|
|
7
|
+
import type { PublishedCheckpoint } from '@aztec/stdlib/checkpoint';
|
|
10
8
|
import type { L1RollupConstants } from '@aztec/stdlib/epoch-helpers';
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
/**
|
|
10
|
+
* TXE Archiver implementation.
|
|
11
|
+
* Provides most of the endpoints needed by the node for reading from and writing to state,
|
|
12
|
+
* without needing any of the extra overhead that the Archiver itself requires (i.e. an L1 client).
|
|
13
|
+
*/
|
|
14
|
+
export declare class TXEArchiver extends ArchiverDataSourceBase {
|
|
15
|
+
private readonly updater;
|
|
14
16
|
constructor(db: AztecAsyncKVStore);
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
* @returns The number of the latest L2 block processed by the block source implementation.
|
|
19
|
-
*/
|
|
20
|
-
getBlockNumber(): Promise<BlockNumber>;
|
|
21
|
-
/**
|
|
22
|
-
* Gets the number of the latest L2 block proven seen by the block source implementation.
|
|
23
|
-
* @returns The number of the latest L2 block proven seen by the block source implementation.
|
|
24
|
-
*/
|
|
25
|
-
getProvenBlockNumber(): Promise<BlockNumber>;
|
|
26
|
-
/**
|
|
27
|
-
* Gets a published l2 block. If a negative number is passed, the block returned is the most recent.
|
|
28
|
-
* @param number - The block number to return (inclusive).
|
|
29
|
-
* @returns The requested L2 block.
|
|
30
|
-
*/
|
|
31
|
-
getPublishedBlock(number: number): Promise<PublishedL2Block | undefined>;
|
|
32
|
-
/**
|
|
33
|
-
* Gets an l2 block. If a negative number is passed, the block returned is the most recent.
|
|
34
|
-
* @param number - The block number to return (inclusive).
|
|
35
|
-
* @returns The requested L2 block.
|
|
36
|
-
*/
|
|
37
|
-
getBlock(number: number | 'latest'): Promise<L2Block | undefined>;
|
|
38
|
-
/**
|
|
39
|
-
* Gets an l2 block header.
|
|
40
|
-
* @param number - The block number to return or 'latest' for the most recent one.
|
|
41
|
-
* @returns The requested L2 block header.
|
|
42
|
-
*/
|
|
43
|
-
getBlockHeader(number: number | 'latest'): Promise<BlockHeader | undefined>;
|
|
44
|
-
getBlocks(from: number, limit: number, _proven?: boolean): Promise<L2Block[]>;
|
|
45
|
-
getPublishedCheckpoints(_from: CheckpointNumber, _limit: number): Promise<PublishedCheckpoint[]>;
|
|
46
|
-
getCheckpointByArchive(_archive: Fr): Promise<Checkpoint | undefined>;
|
|
47
|
-
getL2SlotNumber(): Promise<SlotNumber | undefined>;
|
|
48
|
-
getL2EpochNumber(): Promise<EpochNumber>;
|
|
49
|
-
getCheckpointsForEpoch(_epochNumber: EpochNumber): Promise<Checkpoint[]>;
|
|
50
|
-
getBlocksForEpoch(_epochNumber: EpochNumber): Promise<L2Block[]>;
|
|
51
|
-
getBlockHeadersForEpoch(_epochNumber: EpochNumber): Promise<BlockHeader[]>;
|
|
52
|
-
getL1ToL2MessagesForCheckpoint(_checkpointNumber: CheckpointNumber): Promise<Fr[]>;
|
|
53
|
-
isEpochComplete(_epochNumber: EpochNumber): Promise<boolean>;
|
|
54
|
-
getL2Tips(): Promise<L2Tips>;
|
|
17
|
+
addCheckpoints(checkpoints: PublishedCheckpoint[], result?: ValidateCheckpointResult): Promise<void>;
|
|
18
|
+
getRollupAddress(): Promise<EthAddress>;
|
|
19
|
+
getRegistryAddress(): Promise<EthAddress>;
|
|
55
20
|
getL1Constants(): Promise<L1RollupConstants>;
|
|
56
21
|
getGenesisValues(): Promise<{
|
|
57
22
|
genesisArchiveRoot: Fr;
|
|
58
23
|
}>;
|
|
24
|
+
getL1Timestamp(): Promise<bigint | undefined>;
|
|
25
|
+
getL2Tips(): Promise<L2Tips>;
|
|
26
|
+
getL2SlotNumber(): Promise<SlotNumber | undefined>;
|
|
27
|
+
getL2EpochNumber(): Promise<EpochNumber | undefined>;
|
|
28
|
+
isEpochComplete(_epochNumber: EpochNumber): Promise<boolean>;
|
|
59
29
|
syncImmediate(): Promise<void>;
|
|
60
|
-
getContract(_address: AztecAddress, _timestamp?: UInt64): Promise<ContractInstanceWithAddress | undefined>;
|
|
61
|
-
getRollupAddress(): Promise<EthAddress>;
|
|
62
|
-
getRegistryAddress(): Promise<EthAddress>;
|
|
63
|
-
getL1Timestamp(): Promise<bigint>;
|
|
64
|
-
isPendingChainInvalid(): Promise<boolean>;
|
|
65
|
-
getPendingChainValidationStatus(): Promise<ValidateBlockResult>;
|
|
66
30
|
}
|
|
67
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
31
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXJjaGl2ZXIuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9zdGF0ZV9tYWNoaW5lL2FyY2hpdmVyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxzQkFBc0IsRUFBaUQsTUFBTSxpQkFBaUIsQ0FBQztBQUV4RyxPQUFPLEVBQW9CLEtBQUssV0FBVyxFQUFFLEtBQUssVUFBVSxFQUFFLE1BQU0saUNBQWlDLENBQUM7QUFDdEcsT0FBTyxFQUFFLEVBQUUsRUFBRSxNQUFNLGdDQUFnQyxDQUFDO0FBQ3BELE9BQU8sS0FBSyxFQUFFLFVBQVUsRUFBRSxNQUFNLCtCQUErQixDQUFDO0FBQ2hFLE9BQU8sS0FBSyxFQUFFLGlCQUFpQixFQUFFLE1BQU0saUJBQWlCLENBQUM7QUFDekQsT0FBTyxLQUFLLEVBQW9DLE1BQU0sRUFBRSx3QkFBd0IsRUFBRSxNQUFNLHFCQUFxQixDQUFDO0FBQzlHLE9BQU8sS0FBSyxFQUFFLG1CQUFtQixFQUFFLE1BQU0sMEJBQTBCLENBQUM7QUFDcEUsT0FBTyxLQUFLLEVBQUUsaUJBQWlCLEVBQUUsTUFBTSw2QkFBNkIsQ0FBQztBQUVyRTs7OztHQUlHO0FBQ0gscUJBQWEsV0FBWSxTQUFRLHNCQUFzQjtJQUNyRCxPQUFPLENBQUMsUUFBUSxDQUFDLE9BQU8sQ0FBNEM7SUFFcEUsWUFBWSxFQUFFLEVBQUUsaUJBQWlCLEVBR2hDO0lBRVksY0FBYyxDQUFDLFdBQVcsRUFBRSxtQkFBbUIsRUFBRSxFQUFFLE1BQU0sQ0FBQyxFQUFFLHdCQUF3QixHQUFHLE9BQU8sQ0FBQyxJQUFJLENBQUMsQ0FFaEg7SUFFTSxnQkFBZ0IsSUFBSSxPQUFPLENBQUMsVUFBVSxDQUFDLENBRTdDO0lBRU0sa0JBQWtCLElBQUksT0FBTyxDQUFDLFVBQVUsQ0FBQyxDQUUvQztJQUVNLGNBQWMsSUFBSSxPQUFPLENBQUMsaUJBQWlCLENBQUMsQ0FFbEQ7SUFFTSxnQkFBZ0IsSUFBSSxPQUFPLENBQUM7UUFBRSxrQkFBa0IsRUFBRSxFQUFFLENBQUE7S0FBRSxDQUFDLENBRTdEO0lBRU0sY0FBYyxJQUFJLE9BQU8sQ0FBQyxNQUFNLEdBQUcsU0FBUyxDQUFDLENBRW5EO0lBRVksU0FBUyxJQUFJLE9BQU8sQ0FBQyxNQUFNLENBQUMsQ0FnQ3hDO0lBRU0sZUFBZSxJQUFJLE9BQU8sQ0FBQyxVQUFVLEdBQUcsU0FBUyxDQUFDLENBRXhEO0lBRU0sZ0JBQWdCLElBQUksT0FBTyxDQUFDLFdBQVcsR0FBRyxTQUFTLENBQUMsQ0FFMUQ7SUFFTSxlQUFlLENBQUMsWUFBWSxFQUFFLFdBQVcsR0FBRyxPQUFPLENBQUMsT0FBTyxDQUFDLENBRWxFO0lBRU0sYUFBYSxJQUFJLE9BQU8sQ0FBQyxJQUFJLENBQUMsQ0FFcEM7Q0FDRiJ9
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"archiver.d.ts","sourceRoot":"","sources":["../../src/state_machine/archiver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"archiver.d.ts","sourceRoot":"","sources":["../../src/state_machine/archiver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAiD,MAAM,iBAAiB,CAAC;AAExG,OAAO,EAAoB,KAAK,WAAW,EAAE,KAAK,UAAU,EAAE,MAAM,iCAAiC,CAAC;AACtG,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACpD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,KAAK,EAAoC,MAAM,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAC9G,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AACpE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAErE;;;;GAIG;AACH,qBAAa,WAAY,SAAQ,sBAAsB;IACrD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA4C;IAEpE,YAAY,EAAE,EAAE,iBAAiB,EAGhC;IAEY,cAAc,CAAC,WAAW,EAAE,mBAAmB,EAAE,EAAE,MAAM,CAAC,EAAE,wBAAwB,GAAG,OAAO,CAAC,IAAI,CAAC,CAEhH;IAEM,gBAAgB,IAAI,OAAO,CAAC,UAAU,CAAC,CAE7C;IAEM,kBAAkB,IAAI,OAAO,CAAC,UAAU,CAAC,CAE/C;IAEM,cAAc,IAAI,OAAO,CAAC,iBAAiB,CAAC,CAElD;IAEM,gBAAgB,IAAI,OAAO,CAAC;QAAE,kBAAkB,EAAE,EAAE,CAAA;KAAE,CAAC,CAE7D;IAEM,cAAc,IAAI,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAEnD;IAEY,SAAS,IAAI,OAAO,CAAC,MAAM,CAAC,CAgCxC;IAEM,eAAe,IAAI,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC,CAExD;IAEM,gBAAgB,IAAI,OAAO,CAAC,WAAW,GAAG,SAAS,CAAC,CAE1D;IAEM,eAAe,CAAC,YAAY,EAAE,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,CAElE;IAEM,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC,CAEpC;CACF"}
|
|
@@ -1,77 +1,76 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ArchiverDataSourceBase, ArchiverDataStoreUpdater, KVArchiverDataStore } from '@aztec/archiver';
|
|
2
2
|
import { GENESIS_ARCHIVE_ROOT } from '@aztec/constants';
|
|
3
|
-
import {
|
|
4
|
-
import { Fr } from '@aztec/foundation/
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
import { CheckpointNumber } from '@aztec/foundation/branded-types';
|
|
4
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
5
|
+
/**
|
|
6
|
+
* TXE Archiver implementation.
|
|
7
|
+
* Provides most of the endpoints needed by the node for reading from and writing to state,
|
|
8
|
+
* without needing any of the extra overhead that the Archiver itself requires (i.e. an L1 client).
|
|
9
|
+
*/ export class TXEArchiver extends ArchiverDataSourceBase {
|
|
10
|
+
updater = new ArchiverDataStoreUpdater(this.store);
|
|
9
11
|
constructor(db){
|
|
10
|
-
|
|
12
|
+
const store = new KVArchiverDataStore(db, 9999, {
|
|
13
|
+
epochDuration: 32
|
|
14
|
+
});
|
|
15
|
+
super(store);
|
|
11
16
|
}
|
|
12
|
-
async
|
|
13
|
-
|
|
14
|
-
this.store.addLogs(blocks.map((block)=>block.block)),
|
|
15
|
-
this.store.addBlocks(blocks)
|
|
16
|
-
]);
|
|
17
|
-
return opResults.every(Boolean);
|
|
17
|
+
async addCheckpoints(checkpoints, result) {
|
|
18
|
+
await this.updater.addCheckpoints(checkpoints, result);
|
|
18
19
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
* @returns The number of the latest L2 block processed by the block source implementation.
|
|
22
|
-
*/ getBlockNumber() {
|
|
23
|
-
return this.store.getSynchedL2BlockNumber();
|
|
20
|
+
getRollupAddress() {
|
|
21
|
+
throw new Error('TXE Archiver does not implement "getRollupAddress"');
|
|
24
22
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
* @returns The number of the latest L2 block proven seen by the block source implementation.
|
|
28
|
-
*/ getProvenBlockNumber() {
|
|
29
|
-
return this.store.getSynchedL2BlockNumber();
|
|
23
|
+
getRegistryAddress() {
|
|
24
|
+
throw new Error('TXE Archiver does not implement "getRegistryAddress"');
|
|
30
25
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
* @param number - The block number to return (inclusive).
|
|
34
|
-
* @returns The requested L2 block.
|
|
35
|
-
*/ async getPublishedBlock(number) {
|
|
36
|
-
// If the number provided is -ve, then return the latest block.
|
|
37
|
-
if (number < 0) {
|
|
38
|
-
number = await this.store.getSynchedL2BlockNumber();
|
|
39
|
-
}
|
|
40
|
-
if (number == 0) {
|
|
41
|
-
return undefined;
|
|
42
|
-
}
|
|
43
|
-
const blocks = await this.store.getPublishedBlocks(BlockNumber(number), 1);
|
|
44
|
-
return blocks.length === 0 ? undefined : blocks[0];
|
|
26
|
+
getL1Constants() {
|
|
27
|
+
throw new Error('TXE Archiver does not implement "getL1Constants"');
|
|
45
28
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
*/ getBlock(number) {
|
|
51
|
-
return this.getPublishedBlock(number != 'latest' ? number : -1).then((block)=>block?.block);
|
|
29
|
+
getGenesisValues() {
|
|
30
|
+
return Promise.resolve({
|
|
31
|
+
genesisArchiveRoot: new Fr(GENESIS_ARCHIVE_ROOT)
|
|
32
|
+
});
|
|
52
33
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
34
|
+
getL1Timestamp() {
|
|
35
|
+
throw new Error('TXE Archiver does not implement "getL1Timestamp"');
|
|
36
|
+
}
|
|
37
|
+
async getL2Tips() {
|
|
38
|
+
// In TXE there is no possibility of reorgs and no blocks are ever getting proven so we just set 'latest', 'proven'
|
|
39
|
+
// and 'finalized' to the latest block.
|
|
40
|
+
const blockHeader = await this.getBlockHeader('latest');
|
|
41
|
+
if (!blockHeader) {
|
|
42
|
+
throw new Error('L2Tips requested from TXE Archiver but no block header found');
|
|
60
43
|
}
|
|
61
|
-
|
|
62
|
-
|
|
44
|
+
const number = blockHeader.globalVariables.blockNumber;
|
|
45
|
+
const hash = (await blockHeader.hash()).toString();
|
|
46
|
+
const checkpointedBlock = await this.getCheckpointedBlock(number);
|
|
47
|
+
if (!checkpointedBlock) {
|
|
48
|
+
throw new Error(`L2Tips requested from TXE Archiver but no checkpointed block found for block number ${number}`);
|
|
63
49
|
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
50
|
+
// TXE uses 1-block-per-checkpoint for testing simplicity, so we can use block number as checkpoint number.
|
|
51
|
+
// This uses the deprecated fromBlockNumber method intentionally for the TXE testing environment.
|
|
52
|
+
const checkpoint = await this.store.getRangeOfCheckpoints(CheckpointNumber.fromBlockNumber(number), 1);
|
|
53
|
+
if (checkpoint.length === 0) {
|
|
54
|
+
throw new Error(`L2Tips requested from TXE Archiver but no checkpoint found for block number ${number}`);
|
|
55
|
+
}
|
|
56
|
+
const blockId = {
|
|
57
|
+
number,
|
|
58
|
+
hash
|
|
59
|
+
};
|
|
60
|
+
const checkpointId = {
|
|
61
|
+
number: checkpoint[0].checkpointNumber,
|
|
62
|
+
hash: checkpoint[0].header.hash().toString()
|
|
63
|
+
};
|
|
64
|
+
const tipId = {
|
|
65
|
+
block: blockId,
|
|
66
|
+
checkpoint: checkpointId
|
|
67
|
+
};
|
|
68
|
+
return {
|
|
69
|
+
proposed: blockId,
|
|
70
|
+
proven: tipId,
|
|
71
|
+
finalized: tipId,
|
|
72
|
+
checkpointed: tipId
|
|
73
|
+
};
|
|
75
74
|
}
|
|
76
75
|
getL2SlotNumber() {
|
|
77
76
|
throw new Error('TXE Archiver does not implement "getL2SlotNumber"');
|
|
@@ -79,53 +78,10 @@ export class TXEArchiver extends ArchiverStoreHelper {
|
|
|
79
78
|
getL2EpochNumber() {
|
|
80
79
|
throw new Error('TXE Archiver does not implement "getL2EpochNumber"');
|
|
81
80
|
}
|
|
82
|
-
getCheckpointsForEpoch(_epochNumber) {
|
|
83
|
-
throw new Error('TXE Archiver does not implement "getCheckpointsForEpoch"');
|
|
84
|
-
}
|
|
85
|
-
getBlocksForEpoch(_epochNumber) {
|
|
86
|
-
throw new Error('TXE Archiver does not implement "getBlocksForEpoch"');
|
|
87
|
-
}
|
|
88
|
-
getBlockHeadersForEpoch(_epochNumber) {
|
|
89
|
-
throw new Error('TXE Archiver does not implement "getBlockHeadersForEpoch"');
|
|
90
|
-
}
|
|
91
|
-
getL1ToL2MessagesForCheckpoint(_checkpointNumber) {
|
|
92
|
-
throw new Error('TXE Archiver does not implement "getL1ToL2MessagesForCheckpoint"');
|
|
93
|
-
}
|
|
94
81
|
isEpochComplete(_epochNumber) {
|
|
95
82
|
throw new Error('TXE Archiver does not implement "isEpochComplete"');
|
|
96
83
|
}
|
|
97
|
-
getL2Tips() {
|
|
98
|
-
throw new Error('TXE Archiver does not implement "getL2Tips"');
|
|
99
|
-
}
|
|
100
|
-
getL1Constants() {
|
|
101
|
-
throw new Error('TXE Archiver does not implement "getL2Constants"');
|
|
102
|
-
}
|
|
103
|
-
getGenesisValues() {
|
|
104
|
-
return Promise.resolve({
|
|
105
|
-
genesisArchiveRoot: new Fr(GENESIS_ARCHIVE_ROOT)
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
84
|
syncImmediate() {
|
|
109
85
|
throw new Error('TXE Archiver does not implement "syncImmediate"');
|
|
110
86
|
}
|
|
111
|
-
getContract(_address, _timestamp) {
|
|
112
|
-
throw new Error('TXE Archiver does not implement "getContract"');
|
|
113
|
-
}
|
|
114
|
-
getRollupAddress() {
|
|
115
|
-
throw new Error('TXE Archiver does not implement "getRollupAddress"');
|
|
116
|
-
}
|
|
117
|
-
getRegistryAddress() {
|
|
118
|
-
throw new Error('TXE Archiver does not implement "getRegistryAddress"');
|
|
119
|
-
}
|
|
120
|
-
getL1Timestamp() {
|
|
121
|
-
throw new Error('TXE Archiver does not implement "getL1Timestamp"');
|
|
122
|
-
}
|
|
123
|
-
isPendingChainInvalid() {
|
|
124
|
-
return Promise.resolve(false);
|
|
125
|
-
}
|
|
126
|
-
getPendingChainValidationStatus() {
|
|
127
|
-
return Promise.resolve({
|
|
128
|
-
valid: true
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
87
|
}
|