@aztec/txe 0.0.1-commit.6230a0c → 0.0.1-commit.64b6bbb
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/oracle/txe_oracle_top_level_context.d.ts +2 -2
- package/dest/oracle/txe_oracle_top_level_context.d.ts.map +1 -1
- package/dest/oracle/txe_oracle_top_level_context.js +76 -17
- package/dest/rpc_translator.d.ts +3 -3
- package/dest/rpc_translator.d.ts.map +1 -1
- package/dest/rpc_translator.js +2 -2
- package/dest/state_machine/archiver.d.ts +1 -1
- package/dest/state_machine/archiver.d.ts.map +1 -1
- package/dest/state_machine/archiver.js +2 -0
- package/dest/state_machine/dummy_p2p_client.d.ts +9 -8
- package/dest/state_machine/dummy_p2p_client.d.ts.map +1 -1
- package/dest/state_machine/dummy_p2p_client.js +15 -12
- package/dest/state_machine/index.d.ts +5 -5
- package/dest/state_machine/index.d.ts.map +1 -1
- package/dest/state_machine/index.js +14 -9
- package/dest/state_machine/mock_epoch_cache.d.ts +3 -1
- package/dest/state_machine/mock_epoch_cache.d.ts.map +1 -1
- package/dest/state_machine/mock_epoch_cache.js +4 -0
- package/dest/txe_session.d.ts +1 -1
- package/dest/txe_session.d.ts.map +1 -1
- package/dest/txe_session.js +61 -5
- package/dest/utils/block_creation.d.ts +1 -1
- package/dest/utils/block_creation.d.ts.map +1 -1
- package/dest/utils/block_creation.js +3 -1
- package/package.json +15 -15
- package/src/oracle/txe_oracle_top_level_context.ts +62 -67
- package/src/rpc_translator.ts +2 -2
- package/src/state_machine/archiver.ts +2 -0
- package/src/state_machine/dummy_p2p_client.ts +21 -15
- package/src/state_machine/index.ts +24 -9
- package/src/state_machine/mock_epoch_cache.ts +5 -0
- package/src/txe_session.ts +56 -51
- package/src/utils/block_creation.ts +3 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mock_epoch_cache.d.ts","sourceRoot":"","sources":["../../src/state_machine/mock_epoch_cache.ts"],"names":[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AAC,UAAU,GAAG,SAAS,CAAC,CAEnF;IAED,aAAa,CAAC,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC,CAEtE;IAED,uBAAuB,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC,CAE/C;IAED,iBAAiB,CAAC,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC,CAElF;IAED,cAAc,IAAI,iBAAiB,CAElC;CACF"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { EpochNumber, SlotNumber } from '@aztec/foundation/branded-types';
|
|
2
|
+
import { EmptyL1RollupConstants } from '@aztec/stdlib/epoch-helpers';
|
|
2
3
|
/**
|
|
3
4
|
* Mock implementation of the EpochCacheInterface used to satisfy dependencies of AztecNodeService.
|
|
4
5
|
* Since in TXE we don't validate transactions, mock suffices here.
|
|
@@ -51,4 +52,7 @@ import { EpochNumber, SlotNumber } from '@aztec/foundation/branded-types';
|
|
|
51
52
|
filterInCommittee(_slot, _validators) {
|
|
52
53
|
return Promise.resolve([]);
|
|
53
54
|
}
|
|
55
|
+
getL1Constants() {
|
|
56
|
+
return EmptyL1RollupConstants;
|
|
57
|
+
}
|
|
54
58
|
}
|
package/dest/txe_session.d.ts
CHANGED
|
@@ -72,4 +72,4 @@ export declare class TXESession implements TXESessionStateHandler {
|
|
|
72
72
|
private utilityExecutorForContractSync;
|
|
73
73
|
}
|
|
74
74
|
export {};
|
|
75
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
75
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHhlX3Nlc3Npb24uZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3NyYy90eGVfc2Vzc2lvbi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsV0FBVyxF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SixPQUFhLElBQUksQ0FBQyxpQkFBaUIsRUFBRSxnQkFBZ0IsRUFBRSx1QkFnRnREO0lBRUQ7Ozs7O09BS0c7SUFDSCxlQUFlLENBQUMsWUFBWSxFQUFFLHFCQUFxQixFQUFFLE1BQU0sRUFBRSxlQUFlLEdBQUcsT0FBTyxDQUFDLGlCQUFpQixDQUFDLENBdUJ4RztJQUVLLGtCQUFrQixrQkErQ3ZCO0lBRUssaUJBQWlCLENBQ3JCLGVBQWUsR0FBRSxZQUE4QixFQUMvQyxpQkFBaUIsQ0FBQyxFQUFFLFdBQVcsR0FDOUIsT0FBTyxDQUFDLG9CQUFvQixDQUFDLENBNEQvQjtJQUVLLGdCQUFnQixDQUFDLGVBQWUsQ0FBQyxFQUFFLFlBQVksaUJBc0JwRDtJQUVLLGlCQUFpQixDQUFDLGVBQWUsR0FBRSxZQUE4QixpQkFvQ3RFO0lBRUQsT0FBTyxDQUFDLGlCQUFpQjtZQWlCWCxnQkFBZ0I7WUE2QmhCLGVBQWU7SUFTN0IsT0FBTyxDQUFDLGtCQUFrQjtJQU0xQixPQUFPLENBQUMsOEJBQThCO0NBMkN2QyJ9
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"txe_session.d.ts","sourceRoot":"","sources":["../src/txe_session.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACpD,OAAO,EAAE,KAAK,MAAM,EAAgB,MAAM,uBAAuB,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EACL,YAAY,
|
|
1
|
+
{"version":3,"file":"txe_session.d.ts","sourceRoot":"","sources":["../src/txe_session.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iCAA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AAE,eAAe,EAC7B,kBAAkB,EAAE,kBAAkB,EACtC,qBAAqB,EAAE,qBAAqB,EAC5C,sBAAsB,EAAE,sBAAsB,EAC9C,YAAY,EAAE,YAAY,EAC1B,iBAAiB,EAAE,iBAAiB,EACpC,cAAc,EAAE,cAAc,EAC9B,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,EAAE,EACX,OAAO,EAAE,EAAE,EACX,kBAAkB,EAAE,MAAM,EAChC;IAEJ,OAAa,IAAI,CAAC,iBAAiB,EAAE,gBAAgB,EAAE,uBAgFtD;IAED;;;;;OAKG;IACH,eAAe,CAAC,YAAY,EAAE,qBAAqB,EAAE,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAuBxG;IAEK,kBAAkB,kBA+CvB;IAEK,iBAAiB,CACrB,eAAe,GAAE,YAA8B,EAC/C,iBAAiB,CAAC,EAAE,WAAW,GAC9B,OAAO,CAAC,oBAAoB,CAAC,CA4D/B;IAEK,gBAAgB,CAAC,eAAe,CAAC,EAAE,YAAY,iBAsBpD;IAEK,iBAAiB,CAAC,eAAe,GAAE,YAA8B,iBAoCtE;IAED,OAAO,CAAC,iBAAiB;YAiBX,gBAAgB;YA6BhB,eAAe;IAS7B,OAAO,CAAC,kBAAkB;IAM1B,OAAO,CAAC,8BAA8B;CA2CvC"}
|
package/dest/txe_session.js
CHANGED
|
@@ -3,7 +3,7 @@ import { Fr } from '@aztec/foundation/curves/bn254';
|
|
|
3
3
|
import { createLogger } from '@aztec/foundation/log';
|
|
4
4
|
import { KeyStore } from '@aztec/key-store';
|
|
5
5
|
import { openTmpStore } from '@aztec/kv-store/lmdb-v2';
|
|
6
|
-
import { AddressStore, CapsuleStore, JobCoordinator, NoteService, NoteStore, PrivateEventStore, RecipientTaggingStore, SenderAddressBookStore, SenderTaggingStore } from '@aztec/pxe/server';
|
|
6
|
+
import { AddressStore, AnchorBlockStore, CapsuleStore, JobCoordinator, NoteService, NoteStore, PrivateEventStore, RecipientTaggingStore, SenderAddressBookStore, SenderTaggingStore } from '@aztec/pxe/server';
|
|
7
7
|
import { ExecutionNoteCache, ExecutionTaggingIndexCache, HashedValuesCache, Oracle, PrivateExecutionOracle, UtilityExecutionOracle } from '@aztec/pxe/simulator';
|
|
8
8
|
import { ExecutionError, WASMSimulator, createSimulationError, extractCallStack, resolveAssertionMessageFromError, toACVMWitness } from '@aztec/simulator/client';
|
|
9
9
|
import { FunctionSelector, FunctionType } from '@aztec/stdlib/abi';
|
|
@@ -17,6 +17,7 @@ import { DEFAULT_ADDRESS } from './constants.js';
|
|
|
17
17
|
import { TXEOraclePublicContext } from './oracle/txe_oracle_public_context.js';
|
|
18
18
|
import { TXEOracleTopLevelContext } from './oracle/txe_oracle_top_level_context.js';
|
|
19
19
|
import { RPCTranslator } from './rpc_translator.js';
|
|
20
|
+
import { TXEArchiver } from './state_machine/archiver.js';
|
|
20
21
|
import { TXEStateMachine } from './state_machine/index.js';
|
|
21
22
|
import { TXEAccountStore } from './util/txe_account_store.js';
|
|
22
23
|
import { TXEContractStore } from './util/txe_contract_store.js';
|
|
@@ -96,7 +97,9 @@ import { makeTxEffect } from './utils/tx_effect_creation.js';
|
|
|
96
97
|
await contractStore.addContractArtifact(contractClass.id, artifact);
|
|
97
98
|
await contractStore.addContractInstance(instance);
|
|
98
99
|
}
|
|
99
|
-
const
|
|
100
|
+
const archiver = new TXEArchiver(store);
|
|
101
|
+
const anchorBlockStore = new AnchorBlockStore(store);
|
|
102
|
+
const stateMachine = await TXEStateMachine.create(archiver, anchorBlockStore, contractStore, noteStore);
|
|
100
103
|
const nextBlockTimestamp = BigInt(Math.floor(new Date().getTime() / 1000));
|
|
101
104
|
const version = new Fr(await stateMachine.node.getVersion());
|
|
102
105
|
const chainId = new Fr(await stateMachine.node.getChainId());
|
|
@@ -180,7 +183,30 @@ import { makeTxEffect } from './utils/tx_effect_creation.js';
|
|
|
180
183
|
const noteCache = new ExecutionNoteCache(protocolNullifier);
|
|
181
184
|
const taggingIndexCache = new ExecutionTaggingIndexCache();
|
|
182
185
|
const utilityExecutor = this.utilityExecutorForContractSync(anchorBlock);
|
|
183
|
-
this.oracleHandler = new PrivateExecutionOracle(
|
|
186
|
+
this.oracleHandler = new PrivateExecutionOracle({
|
|
187
|
+
argsHash: Fr.ZERO,
|
|
188
|
+
txContext: new TxContext(this.chainId, this.version, GasSettings.empty()),
|
|
189
|
+
callContext: new CallContext(AztecAddress.ZERO, contractAddress, FunctionSelector.empty(), false),
|
|
190
|
+
anchorBlockHeader: anchorBlock,
|
|
191
|
+
utilityExecutor,
|
|
192
|
+
authWitnesses: [],
|
|
193
|
+
capsules: [],
|
|
194
|
+
executionCache: new HashedValuesCache(),
|
|
195
|
+
noteCache,
|
|
196
|
+
taggingIndexCache,
|
|
197
|
+
contractStore: this.contractStore,
|
|
198
|
+
noteStore: this.noteStore,
|
|
199
|
+
keyStore: this.keyStore,
|
|
200
|
+
addressStore: this.addressStore,
|
|
201
|
+
aztecNode: this.stateMachine.node,
|
|
202
|
+
senderTaggingStore: this.senderTaggingStore,
|
|
203
|
+
recipientTaggingStore: this.recipientTaggingStore,
|
|
204
|
+
senderAddressBookStore: this.senderAddressBookStore,
|
|
205
|
+
capsuleStore: this.capsuleStore,
|
|
206
|
+
privateEventStore: this.privateEventStore,
|
|
207
|
+
contractSyncService: this.stateMachine.contractSyncService,
|
|
208
|
+
jobId: this.currentJobId
|
|
209
|
+
});
|
|
184
210
|
// We store the note and tagging index caches fed into the PrivateExecutionOracle (along with some other auxiliary
|
|
185
211
|
// data) in order to refer to it later, mimicking the way this object is used by the ContractFunctionSimulator. The
|
|
186
212
|
// difference resides in that the simulator has all information needed in order to run the simulation, while ours
|
|
@@ -221,7 +247,22 @@ import { makeTxEffect } from './utils/tx_effect_creation.js';
|
|
|
221
247
|
// be removed from the database.
|
|
222
248
|
// TODO(#12553): make the synchronizer sync here instead and remove this
|
|
223
249
|
await new NoteService(this.noteStore, this.stateMachine.node, anchorBlockHeader, this.currentJobId).syncNoteNullifiers(contractAddress);
|
|
224
|
-
this.oracleHandler = new UtilityExecutionOracle(
|
|
250
|
+
this.oracleHandler = new UtilityExecutionOracle({
|
|
251
|
+
contractAddress,
|
|
252
|
+
authWitnesses: [],
|
|
253
|
+
capsules: [],
|
|
254
|
+
anchorBlockHeader,
|
|
255
|
+
contractStore: this.contractStore,
|
|
256
|
+
noteStore: this.noteStore,
|
|
257
|
+
keyStore: this.keyStore,
|
|
258
|
+
addressStore: this.addressStore,
|
|
259
|
+
aztecNode: this.stateMachine.node,
|
|
260
|
+
recipientTaggingStore: this.recipientTaggingStore,
|
|
261
|
+
senderAddressBookStore: this.senderAddressBookStore,
|
|
262
|
+
capsuleStore: this.capsuleStore,
|
|
263
|
+
privateEventStore: this.privateEventStore,
|
|
264
|
+
jobId: this.currentJobId
|
|
265
|
+
});
|
|
225
266
|
this.state = {
|
|
226
267
|
name: 'UTILITY'
|
|
227
268
|
};
|
|
@@ -284,7 +325,22 @@ import { makeTxEffect } from './utils/tx_effect_creation.js';
|
|
|
284
325
|
throw new Error(`Cannot run ${entryPointArtifact.functionType} function as utility`);
|
|
285
326
|
}
|
|
286
327
|
try {
|
|
287
|
-
const oracle = new UtilityExecutionOracle(
|
|
328
|
+
const oracle = new UtilityExecutionOracle({
|
|
329
|
+
contractAddress: call.to,
|
|
330
|
+
authWitnesses: [],
|
|
331
|
+
capsules: [],
|
|
332
|
+
anchorBlockHeader: anchorBlock,
|
|
333
|
+
contractStore: this.contractStore,
|
|
334
|
+
noteStore: this.noteStore,
|
|
335
|
+
keyStore: this.keyStore,
|
|
336
|
+
addressStore: this.addressStore,
|
|
337
|
+
aztecNode: this.stateMachine.node,
|
|
338
|
+
recipientTaggingStore: this.recipientTaggingStore,
|
|
339
|
+
senderAddressBookStore: this.senderAddressBookStore,
|
|
340
|
+
capsuleStore: this.capsuleStore,
|
|
341
|
+
privateEventStore: this.privateEventStore,
|
|
342
|
+
jobId: this.currentJobId
|
|
343
|
+
});
|
|
288
344
|
await new WASMSimulator().executeUserCircuit(toACVMWitness(0, call.args), entryPointArtifact, new Oracle(oracle).toACIRCallback()).catch((err)=>{
|
|
289
345
|
err.message = resolveAssertionMessageFromError(err, entryPointArtifact);
|
|
290
346
|
throw new ExecutionError(err.message, {
|
|
@@ -25,4 +25,4 @@ export declare function makeTXEBlockHeader(worldTrees: MerkleTreeWriteOperations
|
|
|
25
25
|
* @returns The created L2Block with proper archive chaining
|
|
26
26
|
*/
|
|
27
27
|
export declare function makeTXEBlock(worldTrees: MerkleTreeWriteOperations, globalVariables: GlobalVariables, txEffects: TxEffect[]): Promise<L2Block>;
|
|
28
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
28
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYmxvY2tfY3JlYXRpb24uZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy91dGlscy9ibG9ja19jcmVhdGlvbi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFNQSxPQUFPLEVBQUUsV0FBVyxFQUEyQyxNQUFNLGlDQUFpQyxDQUFDO0FBRXZHLE9BQU8sRUFBRSxFQUFFLEVBQUUsTUFBTSxnQ0FBZ0MsQ0FBQztBQUNwRCxPQUFPLEVBQVEsT0FBTyxFQUFFLE1BQU0scUJBQXFCLENBQUM7QUFDcEQsT0FBTyxFQUF3QyxLQUFLLHlCQUF5QixFQUFFLE1BQU0scUJBQXFCLENBQUM7QUFDM0csT0FBTyxFQUFFLFdBQVcsRUFBRSxlQUFlLEVBQUUsUUFBUSxFQUFFLE1BQU0sa0JBQWtCLENBQUM7QUFFMUU7Ozs7R0FJRztBQUNILHdCQUFnQiwyQkFBMkIsQ0FBQyxXQUFXLEVBQUUsV0FBVyxHQUFHLEVBQUUsQ0FFeEU7QUFFRCx3QkFBc0IsNEJBQTRCLENBQ2hELFFBQVEsRUFBRSxRQUFRLEVBQ2xCLFVBQV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eAAe,EAAE,eAAe,EAChC,SAAS,EAAE,QAAQ,EAAE,GACpB,OAAO,CAAC,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"block_creation.d.ts","sourceRoot":"","sources":["../../src/utils/block_creation.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,WAAW,EAA2C,MAAM,iCAAiC,CAAC;AAEvG,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACpD,OAAO,EAAQ,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAwC,KAAK,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAC3G,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE1E;;;;GAIG;AACH,wBAAgB,2BAA2B,CAAC,WAAW,EAAE,WAAW,GAAG,EAAE,CAExE;AAED,wBAAsB,4BAA4B,CAChD,QAAQ,EAAE,QAAQ,EAClB,UAAU,EAAE,yBAAyB,GACpC,OAAO,CAAC,IAAI,CAAC,CAkBf;AAED,wBAAsB,kBAAkB,CACtC,UAAU,EAAE,yBAAyB,EACrC,eAAe,EAAE,eAAe,GAC/B,OAAO,CAAC,WAAW,CAAC,CAYtB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,YAAY,CAChC,UAAU,EAAE,yBAAyB,EACrC,eAAe,EAAE,eAAe,EAChC,SAAS,EAAE,QAAQ,EAAE,GACpB,OAAO,CAAC,OAAO,CAAC,CAiBlB"}
|
|
@@ -49,7 +49,9 @@ export async function makeTXEBlockHeader(worldTrees, globalVariables) {
|
|
|
49
49
|
// Get the new archive state after updating
|
|
50
50
|
const newArchiveInfo = await worldTrees.getTreeInfo(MerkleTreeId.ARCHIVE);
|
|
51
51
|
const newArchive = new AppendOnlyTreeSnapshot(new Fr(newArchiveInfo.root), Number(newArchiveInfo.size));
|
|
52
|
-
// L2Block requires checkpointNumber and indexWithinCheckpoint
|
|
52
|
+
// L2Block requires checkpointNumber and indexWithinCheckpoint.
|
|
53
|
+
// TXE uses 1-block-per-checkpoint for testing simplicity, so we can use block number as checkpoint number.
|
|
54
|
+
// This uses the deprecated fromBlockNumber method intentionally for the TXE testing environment.
|
|
53
55
|
const checkpointNumber = CheckpointNumber.fromBlockNumber(globalVariables.blockNumber);
|
|
54
56
|
const indexWithinCheckpoint = IndexWithinCheckpoint(0);
|
|
55
57
|
return new L2Block(newArchive, header, new Body(txEffects), checkpointNumber, indexWithinCheckpoint);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/txe",
|
|
3
|
-
"version": "0.0.1-commit.
|
|
3
|
+
"version": "0.0.1-commit.64b6bbb",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": "./dest/index.js",
|
|
6
6
|
"bin": "./dest/bin/index.js",
|
|
@@ -61,20 +61,20 @@
|
|
|
61
61
|
]
|
|
62
62
|
},
|
|
63
63
|
"dependencies": {
|
|
64
|
-
"@aztec/accounts": "0.0.1-commit.
|
|
65
|
-
"@aztec/archiver": "0.0.1-commit.
|
|
66
|
-
"@aztec/aztec-node": "0.0.1-commit.
|
|
67
|
-
"@aztec/aztec.js": "0.0.1-commit.
|
|
68
|
-
"@aztec/bb-prover": "0.0.1-commit.
|
|
69
|
-
"@aztec/constants": "0.0.1-commit.
|
|
70
|
-
"@aztec/foundation": "0.0.1-commit.
|
|
71
|
-
"@aztec/key-store": "0.0.1-commit.
|
|
72
|
-
"@aztec/kv-store": "0.0.1-commit.
|
|
73
|
-
"@aztec/protocol-contracts": "0.0.1-commit.
|
|
74
|
-
"@aztec/pxe": "0.0.1-commit.
|
|
75
|
-
"@aztec/simulator": "0.0.1-commit.
|
|
76
|
-
"@aztec/stdlib": "0.0.1-commit.
|
|
77
|
-
"@aztec/world-state": "0.0.1-commit.
|
|
64
|
+
"@aztec/accounts": "0.0.1-commit.64b6bbb",
|
|
65
|
+
"@aztec/archiver": "0.0.1-commit.64b6bbb",
|
|
66
|
+
"@aztec/aztec-node": "0.0.1-commit.64b6bbb",
|
|
67
|
+
"@aztec/aztec.js": "0.0.1-commit.64b6bbb",
|
|
68
|
+
"@aztec/bb-prover": "0.0.1-commit.64b6bbb",
|
|
69
|
+
"@aztec/constants": "0.0.1-commit.64b6bbb",
|
|
70
|
+
"@aztec/foundation": "0.0.1-commit.64b6bbb",
|
|
71
|
+
"@aztec/key-store": "0.0.1-commit.64b6bbb",
|
|
72
|
+
"@aztec/kv-store": "0.0.1-commit.64b6bbb",
|
|
73
|
+
"@aztec/protocol-contracts": "0.0.1-commit.64b6bbb",
|
|
74
|
+
"@aztec/pxe": "0.0.1-commit.64b6bbb",
|
|
75
|
+
"@aztec/simulator": "0.0.1-commit.64b6bbb",
|
|
76
|
+
"@aztec/stdlib": "0.0.1-commit.64b6bbb",
|
|
77
|
+
"@aztec/world-state": "0.0.1-commit.64b6bbb",
|
|
78
78
|
"zod": "^3.23.8"
|
|
79
79
|
},
|
|
80
80
|
"devDependencies": {
|
|
@@ -22,7 +22,6 @@ import {
|
|
|
22
22
|
SenderAddressBookStore,
|
|
23
23
|
SenderTaggingStore,
|
|
24
24
|
enrichPublicSimulationError,
|
|
25
|
-
syncState,
|
|
26
25
|
} from '@aztec/pxe/server';
|
|
27
26
|
import {
|
|
28
27
|
ExecutionNoteCache,
|
|
@@ -132,13 +131,14 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
|
|
|
132
131
|
}
|
|
133
132
|
|
|
134
133
|
// We instruct users to debug contracts via this oracle, so it makes sense that they'd expect it to also work in tests
|
|
135
|
-
|
|
134
|
+
utilityLog(level: number, message: string, fields: Fr[]): Promise<void> {
|
|
136
135
|
if (!LogLevels[level]) {
|
|
137
|
-
throw new Error(`Invalid
|
|
136
|
+
throw new Error(`Invalid log level: ${level}`);
|
|
138
137
|
}
|
|
139
138
|
const levelName = LogLevels[level];
|
|
140
139
|
|
|
141
140
|
this.logger[levelName](`${applyStringFormatting(message, fields)}`, { module: `${this.logger.module}:debug_log` });
|
|
141
|
+
return Promise.resolve();
|
|
142
142
|
}
|
|
143
143
|
|
|
144
144
|
txeGetDefaultAddress(): AztecAddress {
|
|
@@ -297,19 +297,21 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
|
|
|
297
297
|
throw new Error(message);
|
|
298
298
|
}
|
|
299
299
|
|
|
300
|
+
// When `from` is the zero address (used when creating a new contract account for example),
|
|
301
|
+
// we disable scope filtering by setting effectiveScopes to undefined. This allows these operations
|
|
302
|
+
// to proceed without requiring keys registered for the zero address.
|
|
303
|
+
const effectiveScopes = from.isZero() ? undefined : [from];
|
|
304
|
+
|
|
300
305
|
// Sync notes before executing private function to discover notes from previous transactions
|
|
301
306
|
const utilityExecutor = async (call: FunctionCall) => {
|
|
302
|
-
await this.executeUtilityCall(call);
|
|
307
|
+
await this.executeUtilityCall(call, effectiveScopes);
|
|
303
308
|
};
|
|
304
309
|
|
|
305
310
|
const blockHeader = await this.stateMachine.anchorBlockStore.getBlockHeader();
|
|
306
|
-
await
|
|
311
|
+
await this.stateMachine.contractSyncService.ensureContractSynced(
|
|
307
312
|
targetContractAddress,
|
|
308
|
-
this.contractStore,
|
|
309
313
|
functionSelector,
|
|
310
314
|
utilityExecutor,
|
|
311
|
-
this.noteStore,
|
|
312
|
-
this.stateMachine.node,
|
|
313
315
|
blockHeader,
|
|
314
316
|
this.jobId,
|
|
315
317
|
);
|
|
@@ -335,42 +337,37 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
|
|
|
335
337
|
|
|
336
338
|
const simulator = new WASMSimulator();
|
|
337
339
|
|
|
338
|
-
const privateExecutionOracle = new PrivateExecutionOracle(
|
|
340
|
+
const privateExecutionOracle = new PrivateExecutionOracle({
|
|
339
341
|
argsHash,
|
|
340
342
|
txContext,
|
|
341
343
|
callContext,
|
|
342
|
-
|
|
343
|
-
blockHeader,
|
|
344
|
+
anchorBlockHeader: blockHeader,
|
|
344
345
|
utilityExecutor,
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
[],
|
|
349
|
-
HashedValuesCache.create([new HashedValues(args, argsHash)]),
|
|
346
|
+
authWitnesses: Array.from(this.authwits.values()),
|
|
347
|
+
capsules: [],
|
|
348
|
+
executionCache: HashedValuesCache.create([new HashedValues(args, argsHash)]),
|
|
350
349
|
noteCache,
|
|
351
350
|
taggingIndexCache,
|
|
352
|
-
this.contractStore,
|
|
353
|
-
this.noteStore,
|
|
354
|
-
this.keyStore,
|
|
355
|
-
this.addressStore,
|
|
356
|
-
this.stateMachine.node,
|
|
357
|
-
this.senderTaggingStore,
|
|
358
|
-
this.recipientTaggingStore,
|
|
359
|
-
this.senderAddressBookStore,
|
|
360
|
-
this.capsuleStore,
|
|
361
|
-
this.privateEventStore,
|
|
362
|
-
this.
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
*/
|
|
371
|
-
from,
|
|
351
|
+
contractStore: this.contractStore,
|
|
352
|
+
noteStore: this.noteStore,
|
|
353
|
+
keyStore: this.keyStore,
|
|
354
|
+
addressStore: this.addressStore,
|
|
355
|
+
aztecNode: this.stateMachine.node,
|
|
356
|
+
senderTaggingStore: this.senderTaggingStore,
|
|
357
|
+
recipientTaggingStore: this.recipientTaggingStore,
|
|
358
|
+
senderAddressBookStore: this.senderAddressBookStore,
|
|
359
|
+
capsuleStore: this.capsuleStore,
|
|
360
|
+
privateEventStore: this.privateEventStore,
|
|
361
|
+
contractSyncService: this.stateMachine.contractSyncService,
|
|
362
|
+
jobId: this.jobId,
|
|
363
|
+
totalPublicCalldataCount: 0,
|
|
364
|
+
sideEffectCounter: minRevertibleSideEffectCounter,
|
|
365
|
+
scopes: effectiveScopes,
|
|
366
|
+
// In TXE, the typical transaction entrypoint is skipped, so we need to simulate the actions that such a
|
|
367
|
+
// contract would perform, including setting senderForTags.
|
|
368
|
+
senderForTags: from,
|
|
372
369
|
simulator,
|
|
373
|
-
);
|
|
370
|
+
});
|
|
374
371
|
|
|
375
372
|
// Note: This is a slight modification of simulator.run without any of the checks. Maybe we should modify simulator.run with a boolean value to skip checks.
|
|
376
373
|
let result: PrivateExecutionResult;
|
|
@@ -409,7 +406,7 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
|
|
|
409
406
|
// We pass the non-zero minRevertibleSideEffectCounter to make sure the side effects are split correctly.
|
|
410
407
|
const { publicInputs } = await generateSimulatedProvingResult(
|
|
411
408
|
result,
|
|
412
|
-
this.contractStore,
|
|
409
|
+
(addr, sel) => this.contractStore.getDebugFunctionName(addr, sel),
|
|
413
410
|
minRevertibleSideEffectCounter,
|
|
414
411
|
);
|
|
415
412
|
|
|
@@ -672,34 +669,31 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
|
|
|
672
669
|
|
|
673
670
|
// Sync notes before executing utility function to discover notes from previous transactions
|
|
674
671
|
const blockHeader = await this.stateMachine.anchorBlockStore.getBlockHeader();
|
|
675
|
-
await
|
|
672
|
+
await this.stateMachine.contractSyncService.ensureContractSynced(
|
|
676
673
|
targetContractAddress,
|
|
677
|
-
this.contractStore,
|
|
678
674
|
functionSelector,
|
|
679
675
|
async call => {
|
|
680
676
|
await this.executeUtilityCall(call);
|
|
681
677
|
},
|
|
682
|
-
this.noteStore,
|
|
683
|
-
this.stateMachine.node,
|
|
684
678
|
blockHeader,
|
|
685
679
|
this.jobId,
|
|
686
680
|
);
|
|
687
681
|
|
|
688
|
-
const call =
|
|
689
|
-
artifact.name,
|
|
690
|
-
targetContractAddress,
|
|
691
|
-
functionSelector,
|
|
692
|
-
FunctionType.UTILITY,
|
|
693
|
-
false,
|
|
694
|
-
false,
|
|
682
|
+
const call = FunctionCall.from({
|
|
683
|
+
name: artifact.name,
|
|
684
|
+
to: targetContractAddress,
|
|
685
|
+
selector: functionSelector,
|
|
686
|
+
type: FunctionType.UTILITY,
|
|
687
|
+
hideMsgSender: false,
|
|
688
|
+
isStatic: false,
|
|
695
689
|
args,
|
|
696
|
-
[],
|
|
697
|
-
);
|
|
690
|
+
returnTypes: [],
|
|
691
|
+
});
|
|
698
692
|
|
|
699
693
|
return this.executeUtilityCall(call);
|
|
700
694
|
}
|
|
701
695
|
|
|
702
|
-
private async executeUtilityCall(call: FunctionCall): Promise<Fr[]> {
|
|
696
|
+
private async executeUtilityCall(call: FunctionCall, scopes?: AztecAddress[]): Promise<Fr[]> {
|
|
703
697
|
const entryPointArtifact = await this.contractStore.getFunctionArtifactWithDebugMetadata(call.to, call.selector);
|
|
704
698
|
if (entryPointArtifact.functionType !== FunctionType.UTILITY) {
|
|
705
699
|
throw new Error(`Cannot run ${entryPointArtifact.functionType} function as utility`);
|
|
@@ -712,22 +706,23 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
|
|
|
712
706
|
|
|
713
707
|
try {
|
|
714
708
|
const anchorBlockHeader = await this.stateMachine.anchorBlockStore.getBlockHeader();
|
|
715
|
-
const oracle = new UtilityExecutionOracle(
|
|
716
|
-
call.to,
|
|
717
|
-
[],
|
|
718
|
-
[],
|
|
709
|
+
const oracle = new UtilityExecutionOracle({
|
|
710
|
+
contractAddress: call.to,
|
|
711
|
+
authWitnesses: [],
|
|
712
|
+
capsules: [],
|
|
719
713
|
anchorBlockHeader,
|
|
720
|
-
this.contractStore,
|
|
721
|
-
this.noteStore,
|
|
722
|
-
this.keyStore,
|
|
723
|
-
this.addressStore,
|
|
724
|
-
this.stateMachine.node,
|
|
725
|
-
this.recipientTaggingStore,
|
|
726
|
-
this.senderAddressBookStore,
|
|
727
|
-
this.capsuleStore,
|
|
728
|
-
this.privateEventStore,
|
|
729
|
-
this.jobId,
|
|
730
|
-
|
|
714
|
+
contractStore: this.contractStore,
|
|
715
|
+
noteStore: this.noteStore,
|
|
716
|
+
keyStore: this.keyStore,
|
|
717
|
+
addressStore: this.addressStore,
|
|
718
|
+
aztecNode: this.stateMachine.node,
|
|
719
|
+
recipientTaggingStore: this.recipientTaggingStore,
|
|
720
|
+
senderAddressBookStore: this.senderAddressBookStore,
|
|
721
|
+
capsuleStore: this.capsuleStore,
|
|
722
|
+
privateEventStore: this.privateEventStore,
|
|
723
|
+
jobId: this.jobId,
|
|
724
|
+
scopes,
|
|
725
|
+
});
|
|
731
726
|
const acirExecutionResult = await new WASMSimulator()
|
|
732
727
|
.executeUserCircuit(toACVMWitness(0, call.args), entryPointArtifact, new Oracle(oracle).toACIRCallback())
|
|
733
728
|
.catch((err: Error) => {
|
package/src/rpc_translator.ts
CHANGED
|
@@ -328,7 +328,7 @@ export class RPCTranslator {
|
|
|
328
328
|
|
|
329
329
|
// When the argument is a slice, noir automatically adds a length field to oracle call.
|
|
330
330
|
// When the argument is an array, we add the field length manually to the signature.
|
|
331
|
-
|
|
331
|
+
async utilityLog(
|
|
332
332
|
foreignLevel: ForeignCallSingle,
|
|
333
333
|
foreignMessage: ForeignCallArray,
|
|
334
334
|
_foreignLength: ForeignCallSingle,
|
|
@@ -340,7 +340,7 @@ export class RPCTranslator {
|
|
|
340
340
|
.join('');
|
|
341
341
|
const fields = fromArray(foreignFields);
|
|
342
342
|
|
|
343
|
-
this.handlerAsMisc().
|
|
343
|
+
await this.handlerAsMisc().utilityLog(level, message, fields);
|
|
344
344
|
|
|
345
345
|
return toForeignCallResult([]);
|
|
346
346
|
}
|
|
@@ -59,6 +59,8 @@ export class TXEArchiver extends ArchiverDataSourceBase {
|
|
|
59
59
|
if (!checkpointedBlock) {
|
|
60
60
|
throw new Error(`L2Tips requested from TXE Archiver but no checkpointed block found for block number ${number}`);
|
|
61
61
|
}
|
|
62
|
+
// TXE uses 1-block-per-checkpoint for testing simplicity, so we can use block number as checkpoint number.
|
|
63
|
+
// This uses the deprecated fromBlockNumber method intentionally for the TXE testing environment.
|
|
62
64
|
const checkpoint = await this.store.getRangeOfCheckpoints(CheckpointNumber.fromBlockNumber(number), 1);
|
|
63
65
|
if (checkpoint.length === 0) {
|
|
64
66
|
throw new Error(`L2Tips requested from TXE Archiver but no checkpoint found for block number ${number}`);
|
|
@@ -6,6 +6,8 @@ import type {
|
|
|
6
6
|
P2PBlockReceivedCallback,
|
|
7
7
|
P2PCheckpointReceivedCallback,
|
|
8
8
|
P2PConfig,
|
|
9
|
+
P2PDuplicateAttestationCallback,
|
|
10
|
+
P2PDuplicateProposalCallback,
|
|
9
11
|
P2PSyncState,
|
|
10
12
|
PeerId,
|
|
11
13
|
ReqRespSubProtocol,
|
|
@@ -16,7 +18,7 @@ import type {
|
|
|
16
18
|
import type { EthAddress, L2BlockStreamEvent, L2Tips } from '@aztec/stdlib/block';
|
|
17
19
|
import type { PeerInfo } from '@aztec/stdlib/interfaces/server';
|
|
18
20
|
import type { BlockProposal, CheckpointAttestation, CheckpointProposal } from '@aztec/stdlib/p2p';
|
|
19
|
-
import type { Tx, TxHash } from '@aztec/stdlib/tx';
|
|
21
|
+
import type { BlockHeader, Tx, TxHash } from '@aztec/stdlib/tx';
|
|
20
22
|
|
|
21
23
|
export class DummyP2P implements P2P {
|
|
22
24
|
public validate(_txs: Tx[]): Promise<void> {
|
|
@@ -71,8 +73,8 @@ export class DummyP2P implements P2P {
|
|
|
71
73
|
throw new Error('DummyP2P does not implement "sendTx"');
|
|
72
74
|
}
|
|
73
75
|
|
|
74
|
-
public
|
|
75
|
-
throw new Error('DummyP2P does not implement "
|
|
76
|
+
public handleFailedExecution(_txHashes: TxHash[]): Promise<void> {
|
|
77
|
+
throw new Error('DummyP2P does not implement "handleFailedExecution"');
|
|
76
78
|
}
|
|
77
79
|
|
|
78
80
|
public getTxByHashFromPool(_txHash: TxHash): Promise<Tx | undefined> {
|
|
@@ -133,8 +135,8 @@ export class DummyP2P implements P2P {
|
|
|
133
135
|
throw new Error('DummyP2P does not implement "getCheckpointAttestationsForSlot"');
|
|
134
136
|
}
|
|
135
137
|
|
|
136
|
-
public
|
|
137
|
-
throw new Error('DummyP2P does not implement "
|
|
138
|
+
public addOwnCheckpointAttestations(_attestations: CheckpointAttestation[]): Promise<void> {
|
|
139
|
+
throw new Error('DummyP2P does not implement "addOwnCheckpointAttestations"');
|
|
138
140
|
}
|
|
139
141
|
|
|
140
142
|
public getL2BlockHash(_number: number): Promise<string | undefined> {
|
|
@@ -157,14 +159,6 @@ export class DummyP2P implements P2P {
|
|
|
157
159
|
throw new Error('DummyP2P does not implement "sync"');
|
|
158
160
|
}
|
|
159
161
|
|
|
160
|
-
public requestTxsByHash(_txHashes: TxHash[]): Promise<Tx[]> {
|
|
161
|
-
throw new Error('DummyP2P does not implement "requestTxsByHash"');
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
public getTxs(_filter: 'all' | 'pending' | 'mined'): Promise<Tx[]> {
|
|
165
|
-
throw new Error('DummyP2P does not implement "getTxs"');
|
|
166
|
-
}
|
|
167
|
-
|
|
168
162
|
public getTxsByHashFromPool(_txHashes: TxHash[]): Promise<(Tx | undefined)[]> {
|
|
169
163
|
throw new Error('DummyP2P does not implement "getTxsByHashFromPool"');
|
|
170
164
|
}
|
|
@@ -189,8 +183,12 @@ export class DummyP2P implements P2P {
|
|
|
189
183
|
throw new Error('DummyP2P does not implement "getSyncedLatestSlot"');
|
|
190
184
|
}
|
|
191
185
|
|
|
192
|
-
|
|
193
|
-
throw new Error('DummyP2P does not implement "
|
|
186
|
+
protectTxs(_txHashes: TxHash[], _blockHeader: BlockHeader): Promise<TxHash[]> {
|
|
187
|
+
throw new Error('DummyP2P does not implement "protectTxs".');
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
prepareForSlot(_slotNumber: SlotNumber): Promise<void> {
|
|
191
|
+
return Promise.resolve();
|
|
194
192
|
}
|
|
195
193
|
|
|
196
194
|
addReqRespSubProtocol(
|
|
@@ -206,4 +204,12 @@ export class DummyP2P implements P2P {
|
|
|
206
204
|
|
|
207
205
|
//This is no-op
|
|
208
206
|
public registerThisValidatorAddresses(_address: EthAddress[]): void {}
|
|
207
|
+
|
|
208
|
+
public registerDuplicateProposalCallback(_callback: P2PDuplicateProposalCallback): void {
|
|
209
|
+
throw new Error('DummyP2P does not implement "registerDuplicateProposalCallback"');
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
public registerDuplicateAttestationCallback(_callback: P2PDuplicateAttestationCallback): void {
|
|
213
|
+
throw new Error('DummyP2P does not implement "registerDuplicateAttestationCallback"');
|
|
214
|
+
}
|
|
209
215
|
}
|
|
@@ -3,8 +3,7 @@ import { TestCircuitVerifier } from '@aztec/bb-prover/test';
|
|
|
3
3
|
import { CheckpointNumber } from '@aztec/foundation/branded-types';
|
|
4
4
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
5
5
|
import { createLogger } from '@aztec/foundation/log';
|
|
6
|
-
import type
|
|
7
|
-
import { AnchorBlockStore } from '@aztec/pxe/server';
|
|
6
|
+
import { type AnchorBlockStore, type ContractStore, ContractSyncService, type NoteStore } from '@aztec/pxe/server';
|
|
8
7
|
import { L2Block } from '@aztec/stdlib/block';
|
|
9
8
|
import { Checkpoint, L1PublishedData, PublishedCheckpoint } from '@aztec/stdlib/checkpoint';
|
|
10
9
|
import type { AztecNode } from '@aztec/stdlib/interfaces/client';
|
|
@@ -26,13 +25,16 @@ export class TXEStateMachine {
|
|
|
26
25
|
public synchronizer: TXESynchronizer,
|
|
27
26
|
public archiver: TXEArchiver,
|
|
28
27
|
public anchorBlockStore: AnchorBlockStore,
|
|
28
|
+
public contractSyncService: ContractSyncService,
|
|
29
29
|
) {}
|
|
30
30
|
|
|
31
|
-
public static async create(
|
|
32
|
-
|
|
31
|
+
public static async create(
|
|
32
|
+
archiver: TXEArchiver,
|
|
33
|
+
anchorBlockStore: AnchorBlockStore,
|
|
34
|
+
contractStore: ContractStore,
|
|
35
|
+
noteStore: NoteStore,
|
|
36
|
+
) {
|
|
33
37
|
const synchronizer = await TXESynchronizer.create();
|
|
34
|
-
const anchorBlockStore = new AnchorBlockStore(db);
|
|
35
|
-
|
|
36
38
|
const aztecNodeConfig = {} as AztecNodeConfig;
|
|
37
39
|
|
|
38
40
|
const log = createLogger('txe_node');
|
|
@@ -58,11 +60,21 @@ export class TXEStateMachine {
|
|
|
58
60
|
log,
|
|
59
61
|
);
|
|
60
62
|
|
|
61
|
-
|
|
63
|
+
const contractSyncService = new ContractSyncService(
|
|
64
|
+
node,
|
|
65
|
+
contractStore,
|
|
66
|
+
noteStore,
|
|
67
|
+
createLogger('txe:contract_sync'),
|
|
68
|
+
);
|
|
69
|
+
|
|
70
|
+
return new this(node, synchronizer, archiver, anchorBlockStore, contractSyncService);
|
|
62
71
|
}
|
|
63
72
|
|
|
64
73
|
public async handleL2Block(block: L2Block) {
|
|
65
|
-
// Create a checkpoint from the block manually
|
|
74
|
+
// Create a checkpoint from the block manually.
|
|
75
|
+
// TXE uses 1-block-per-checkpoint for testing simplicity, so we can use block number as checkpoint number.
|
|
76
|
+
// This uses the deprecated fromBlockNumber method intentionally for the TXE testing environment.
|
|
77
|
+
const checkpointNumber = CheckpointNumber.fromBlockNumber(block.number);
|
|
66
78
|
const checkpoint = new Checkpoint(
|
|
67
79
|
block.archive,
|
|
68
80
|
CheckpointHeader.from({
|
|
@@ -79,7 +91,7 @@ export class TXEStateMachine {
|
|
|
79
91
|
totalManaUsed: block.header.totalManaUsed,
|
|
80
92
|
}),
|
|
81
93
|
[block],
|
|
82
|
-
|
|
94
|
+
checkpointNumber,
|
|
83
95
|
);
|
|
84
96
|
|
|
85
97
|
const publishedCheckpoint = new PublishedCheckpoint(
|
|
@@ -91,6 +103,9 @@ export class TXEStateMachine {
|
|
|
91
103
|
),
|
|
92
104
|
[],
|
|
93
105
|
);
|
|
106
|
+
// Wipe contract sync cache when anchor block changes (mirrors BlockSynchronizer behavior)
|
|
107
|
+
this.contractSyncService.wipe();
|
|
108
|
+
|
|
94
109
|
await Promise.all([
|
|
95
110
|
this.synchronizer.handleL2Block(block),
|
|
96
111
|
this.archiver.addCheckpoints([publishedCheckpoint], undefined),
|