@aztec/txe 5.0.0-rc.2 → 5.0.1
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/AuthRegistry-56AMRLSQ.js +3 -0
- package/dest/AuthRegistry-56AMRLSQ.js.map +7 -0
- package/dest/ContractClassRegistry-N6NA3SFA.js +3 -0
- package/dest/ContractClassRegistry-N6NA3SFA.js.map +7 -0
- package/dest/ContractInstanceRegistry-NADDSLGL.js +3 -0
- package/dest/ContractInstanceRegistry-NADDSLGL.js.map +7 -0
- package/dest/FeeJuice-QBH5JWJV.js +3 -0
- package/dest/FeeJuice-QBH5JWJV.js.map +7 -0
- package/dest/HandshakeRegistry-D2W3AOPD.js +3 -0
- package/dest/HandshakeRegistry-D2W3AOPD.js.map +7 -0
- package/dest/MultiCallEntrypoint-MIDICLQB.js +3 -0
- package/dest/MultiCallEntrypoint-MIDICLQB.js.map +7 -0
- package/dest/SchnorrAccount-HNL7EN7Y.js +3 -0
- package/dest/SchnorrAccount-HNL7EN7Y.js.map +7 -0
- package/dest/SchnorrInitializerlessAccount-TFAFXZW6.js +3 -0
- package/dest/SchnorrInitializerlessAccount-TFAFXZW6.js.map +7 -0
- package/dest/bin/index.js +1 -1
- package/dest/bin/oracle_test_server.js +1 -1
- package/dest/chunk-EKHK6CRD.js +268 -0
- package/dest/chunk-EKHK6CRD.js.map +7 -0
- package/dest/{chunk-I6DL4FT2.js → chunk-RELAEYUE.js} +2 -2
- package/dest/{chunk-I6DL4FT2.js.map → chunk-RELAEYUE.js.map} +3 -3
- package/dest/index.d.ts +1 -1
- package/dest/index.d.ts.map +1 -1
- package/dest/index.js +5 -3
- package/dest/metafile.json +3677 -3076
- package/dest/oracle/interfaces.d.ts +15 -7
- package/dest/oracle/interfaces.d.ts.map +1 -1
- package/dest/oracle/tagging_secret_strategy.d.ts +12 -0
- package/dest/oracle/tagging_secret_strategy.d.ts.map +1 -0
- package/dest/oracle/tagging_secret_strategy.js +12 -0
- package/dest/oracle/test-resolver/default_fixtures.d.ts +3 -3
- package/dest/oracle/test-resolver/default_fixtures.d.ts.map +1 -1
- package/dest/oracle/test-resolver/default_fixtures.js +54 -11
- package/dest/oracle/test-resolver/resolver.d.ts +1 -1
- package/dest/oracle/test-resolver/resolver.js +39 -2
- package/dest/oracle/txe_oracle_public_context.d.ts +6 -6
- package/dest/oracle/txe_oracle_public_context.d.ts.map +1 -1
- package/dest/oracle/txe_oracle_public_context.js +15 -9
- package/dest/oracle/txe_oracle_registry.d.ts +21 -16
- package/dest/oracle/txe_oracle_registry.d.ts.map +1 -1
- package/dest/oracle/txe_oracle_registry.js +59 -17
- package/dest/oracle/txe_oracle_top_level_context.d.ts +22 -7
- package/dest/oracle/txe_oracle_top_level_context.d.ts.map +1 -1
- package/dest/oracle/txe_oracle_top_level_context.js +67 -35
- package/dest/oracle/txe_oracle_version.d.ts +3 -3
- package/dest/oracle/txe_oracle_version.js +3 -3
- package/dest/rpc_translator.d.ts +9 -5
- package/dest/rpc_translator.d.ts.map +1 -1
- package/dest/rpc_translator.js +44 -12
- package/dest/server.bundle.js +1 -1
- package/dest/state_machine/dummy_p2p_client.d.ts +2 -1
- package/dest/state_machine/dummy_p2p_client.d.ts.map +1 -1
- package/dest/state_machine/dummy_p2p_client.js +3 -0
- package/dest/state_machine/index.d.ts +4 -3
- package/dest/state_machine/index.d.ts.map +1 -1
- package/dest/state_machine/index.js +7 -4
- package/dest/state_machine/synchronizer.d.ts +3 -1
- package/dest/state_machine/synchronizer.d.ts.map +1 -1
- package/dest/state_machine/synchronizer.js +3 -0
- package/dest/txe_session.d.ts +3 -2
- package/dest/txe_session.d.ts.map +1 -1
- package/dest/txe_session.js +35 -15
- package/dest/utils/encoding.d.ts +4 -3
- package/dest/utils/encoding.d.ts.map +1 -1
- package/dest/utils/tx_effect_creation.d.ts +1 -1
- package/dest/utils/tx_effect_creation.d.ts.map +1 -1
- package/dest/utils/tx_effect_creation.js +0 -1
- package/dest/utils/txe_public_contract_data_source.d.ts +1 -1
- package/dest/utils/txe_public_contract_data_source.d.ts.map +1 -1
- package/dest/utils/txe_public_contract_data_source.js +7 -4
- package/dest/worker.bundle.js +1 -1
- package/package.json +17 -17
- package/src/bin/oracle_test_server.ts +1 -1
- package/src/index.ts +5 -3
- package/src/oracle/interfaces.ts +17 -6
- package/src/oracle/tagging_secret_strategy.ts +25 -0
- package/src/oracle/test-resolver/default_fixtures.ts +73 -17
- package/src/oracle/test-resolver/resolver.ts +49 -2
- package/src/oracle/txe_oracle_public_context.ts +13 -11
- package/src/oracle/txe_oracle_registry.ts +58 -9
- package/src/oracle/txe_oracle_top_level_context.ts +108 -31
- package/src/oracle/txe_oracle_version.ts +3 -3
- package/src/rpc_translator.ts +51 -13
- package/src/state_machine/dummy_p2p_client.ts +4 -0
- package/src/state_machine/index.ts +19 -2
- package/src/state_machine/synchronizer.ts +5 -0
- package/src/txe_session.ts +63 -15
- package/src/utils/tx_effect_creation.ts +0 -2
- package/src/utils/txe_public_contract_data_source.ts +6 -4
- package/dest/AuthRegistry-URXCCPYF.js +0 -3
- package/dest/AuthRegistry-URXCCPYF.js.map +0 -7
- package/dest/ContractClassRegistry-5RDBM6TC.js +0 -3
- package/dest/ContractClassRegistry-5RDBM6TC.js.map +0 -7
- package/dest/ContractInstanceRegistry-GCR4G4D7.js +0 -3
- package/dest/ContractInstanceRegistry-GCR4G4D7.js.map +0 -7
- package/dest/FeeJuice-O3KOSZO5.js +0 -3
- package/dest/FeeJuice-O3KOSZO5.js.map +0 -7
- package/dest/HandshakeRegistry-TXSMHMNY.js +0 -3
- package/dest/HandshakeRegistry-TXSMHMNY.js.map +0 -7
- package/dest/MultiCallEntrypoint-P4FSRXAD.js +0 -3
- package/dest/MultiCallEntrypoint-P4FSRXAD.js.map +0 -7
- package/dest/SchnorrAccount-AQZX7ROU.js +0 -3
- package/dest/SchnorrAccount-AQZX7ROU.js.map +0 -7
- package/dest/SchnorrInitializerlessAccount-KMX2H3J6.js +0 -3
- package/dest/SchnorrInitializerlessAccount-KMX2H3J6.js.map +0 -7
- package/dest/chunk-IAO54JS2.js +0 -266
- package/dest/chunk-IAO54JS2.js.map +0 -7
package/src/rpc_translator.ts
CHANGED
|
@@ -221,11 +221,21 @@ export class RPCTranslator {
|
|
|
221
221
|
}
|
|
222
222
|
|
|
223
223
|
// eslint-disable-next-line camelcase
|
|
224
|
-
|
|
224
|
+
aztec_txe_setTaggingSecretStrategies(...inputs: ForeignCallArgs) {
|
|
225
225
|
return callTxeHandler({
|
|
226
|
-
oracle: '
|
|
226
|
+
oracle: 'aztec_txe_setTaggingSecretStrategies',
|
|
227
227
|
inputs,
|
|
228
|
-
handler: ([
|
|
228
|
+
handler: ([unconstrainedStrategy, constrainedStrategy]) =>
|
|
229
|
+
this.handlerAsTxe().setTaggingSecretStrategies(unconstrainedStrategy, constrainedStrategy),
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
// eslint-disable-next-line camelcase
|
|
234
|
+
aztec_txe_setAuthorizeAllUtilityCallTargets(...inputs: ForeignCallArgs) {
|
|
235
|
+
return callTxeHandler({
|
|
236
|
+
oracle: 'aztec_txe_setAuthorizeAllUtilityCallTargets',
|
|
237
|
+
inputs,
|
|
238
|
+
handler: ([authorizeAll]) => this.handlerAsTxe().setAuthorizeAllUtilityCallTargets(authorizeAll),
|
|
229
239
|
});
|
|
230
240
|
}
|
|
231
241
|
|
|
@@ -488,12 +498,12 @@ export class RPCTranslator {
|
|
|
488
498
|
}
|
|
489
499
|
|
|
490
500
|
// eslint-disable-next-line camelcase
|
|
491
|
-
|
|
501
|
+
aztec_utl_getL1ToL2MembershipWitnessV2(...inputs: ForeignCallArgs) {
|
|
492
502
|
return callTxeHandler({
|
|
493
|
-
oracle: '
|
|
503
|
+
oracle: 'aztec_utl_getL1ToL2MembershipWitnessV2',
|
|
494
504
|
inputs,
|
|
495
|
-
handler: ([
|
|
496
|
-
this.handlerAsUtility().
|
|
505
|
+
handler: ([messageHash, nullifier]) =>
|
|
506
|
+
this.handlerAsUtility().getL1ToL2MembershipWitnessV2(messageHash, nullifier),
|
|
497
507
|
});
|
|
498
508
|
}
|
|
499
509
|
|
|
@@ -571,6 +581,16 @@ export class RPCTranslator {
|
|
|
571
581
|
});
|
|
572
582
|
}
|
|
573
583
|
|
|
584
|
+
// eslint-disable-next-line camelcase
|
|
585
|
+
aztec_utl_areBlockHashesInArchive(...inputs: ForeignCallArgs) {
|
|
586
|
+
return callTxeHandler({
|
|
587
|
+
oracle: 'aztec_utl_areBlockHashesInArchive',
|
|
588
|
+
inputs,
|
|
589
|
+
handler: ([anchorBlockHash, blockHashes]) =>
|
|
590
|
+
this.handlerAsUtility().areBlockHashesInArchive(anchorBlockHash, blockHashes),
|
|
591
|
+
});
|
|
592
|
+
}
|
|
593
|
+
|
|
574
594
|
// eslint-disable-next-line camelcase
|
|
575
595
|
aztec_utl_getLowNullifierMembershipWitness(...inputs: ForeignCallArgs) {
|
|
576
596
|
return callTxeHandler({
|
|
@@ -582,11 +602,11 @@ export class RPCTranslator {
|
|
|
582
602
|
}
|
|
583
603
|
|
|
584
604
|
// eslint-disable-next-line camelcase
|
|
585
|
-
|
|
605
|
+
aztec_utl_getPendingTaggedLogsV2(...inputs: ForeignCallArgs) {
|
|
586
606
|
return callTxeHandler({
|
|
587
|
-
oracle: '
|
|
607
|
+
oracle: 'aztec_utl_getPendingTaggedLogsV2',
|
|
588
608
|
inputs,
|
|
589
|
-
handler: ([scope, providedSecrets]) => this.handlerAsUtility().
|
|
609
|
+
handler: ([scope, providedSecrets]) => this.handlerAsUtility().getPendingTaggedLogsV2(scope, providedSecrets),
|
|
590
610
|
});
|
|
591
611
|
}
|
|
592
612
|
|
|
@@ -605,11 +625,11 @@ export class RPCTranslator {
|
|
|
605
625
|
}
|
|
606
626
|
|
|
607
627
|
// eslint-disable-next-line camelcase
|
|
608
|
-
|
|
628
|
+
aztec_utl_getLogsByTagV2(...inputs: ForeignCallArgs) {
|
|
609
629
|
return callTxeHandler({
|
|
610
|
-
oracle: '
|
|
630
|
+
oracle: 'aztec_utl_getLogsByTagV2',
|
|
611
631
|
inputs,
|
|
612
|
-
handler: ([requestArrayBaseSlot]) => this.handlerAsUtility().
|
|
632
|
+
handler: ([requestArrayBaseSlot]) => this.handlerAsUtility().getLogsByTagV2(requestArrayBaseSlot),
|
|
613
633
|
});
|
|
614
634
|
}
|
|
615
635
|
|
|
@@ -622,6 +642,15 @@ export class RPCTranslator {
|
|
|
622
642
|
});
|
|
623
643
|
}
|
|
624
644
|
|
|
645
|
+
// eslint-disable-next-line camelcase
|
|
646
|
+
aztec_utl_getTxEffects(...inputs: ForeignCallArgs) {
|
|
647
|
+
return callTxeHandler({
|
|
648
|
+
oracle: 'aztec_utl_getTxEffects',
|
|
649
|
+
inputs,
|
|
650
|
+
handler: ([txHashes]) => this.handlerAsUtility().getTxEffects(txHashes),
|
|
651
|
+
});
|
|
652
|
+
}
|
|
653
|
+
|
|
625
654
|
// eslint-disable-next-line camelcase
|
|
626
655
|
aztec_utl_setCapsule(...inputs: ForeignCallArgs) {
|
|
627
656
|
return callTxeHandler({
|
|
@@ -1161,6 +1190,15 @@ export class RPCTranslator {
|
|
|
1161
1190
|
});
|
|
1162
1191
|
}
|
|
1163
1192
|
|
|
1193
|
+
// eslint-disable-next-line camelcase
|
|
1194
|
+
aztec_prv_resolveCustomRequest(...inputs: ForeignCallArgs) {
|
|
1195
|
+
return callTxeHandler({
|
|
1196
|
+
oracle: 'aztec_prv_resolveCustomRequest',
|
|
1197
|
+
inputs,
|
|
1198
|
+
handler: ([kind, payload]) => this.handlerAsPrivate().resolveCustomRequest(kind, payload),
|
|
1199
|
+
});
|
|
1200
|
+
}
|
|
1201
|
+
|
|
1164
1202
|
// eslint-disable-next-line camelcase
|
|
1165
1203
|
aztec_prv_getAppTaggingSecret(...inputs: ForeignCallArgs) {
|
|
1166
1204
|
return callTxeHandler({
|
|
@@ -122,6 +122,10 @@ export class DummyP2P implements P2P {
|
|
|
122
122
|
throw new Error('DummyP2P does not implement "getPendingTxCount"');
|
|
123
123
|
}
|
|
124
124
|
|
|
125
|
+
public hasEligiblePendingTxs(_minCount: number): Promise<boolean> {
|
|
126
|
+
throw new Error('DummyP2P does not implement "hasEligiblePendingTxs"');
|
|
127
|
+
}
|
|
128
|
+
|
|
125
129
|
public start(): Promise<void> {
|
|
126
130
|
throw new Error('DummyP2P does not implement "start"');
|
|
127
131
|
}
|
|
@@ -3,7 +3,13 @@ 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 {
|
|
6
|
+
import {
|
|
7
|
+
type AnchorBlockStore,
|
|
8
|
+
ContractClassService,
|
|
9
|
+
type ContractStore,
|
|
10
|
+
ContractSyncService,
|
|
11
|
+
type NoteStore,
|
|
12
|
+
} from '@aztec/pxe/server';
|
|
7
13
|
import { TxResolverService } from '@aztec/pxe/simulator';
|
|
8
14
|
import { L2Block, type L2TipsProvider } from '@aztec/stdlib/block';
|
|
9
15
|
import { Checkpoint, L1PublishedData, PublishedCheckpoint } from '@aztec/stdlib/checkpoint';
|
|
@@ -29,6 +35,7 @@ export class TXEStateMachine {
|
|
|
29
35
|
public archiver: TXEArchiver,
|
|
30
36
|
public anchorBlockStore: AnchorBlockStore,
|
|
31
37
|
public contractSyncService: ContractSyncService,
|
|
38
|
+
public contractClassService: ContractClassService,
|
|
32
39
|
public txResolver: TxResolverService,
|
|
33
40
|
) {}
|
|
34
41
|
|
|
@@ -68,16 +75,26 @@ export class TXEStateMachine {
|
|
|
68
75
|
log,
|
|
69
76
|
});
|
|
70
77
|
|
|
78
|
+
const contractClassService = new ContractClassService(node, contractStore);
|
|
71
79
|
const contractSyncService = new ContractSyncService(
|
|
72
80
|
node,
|
|
73
81
|
contractStore,
|
|
82
|
+
contractClassService,
|
|
74
83
|
noteStore,
|
|
75
84
|
createLogger('txe:contract_sync'),
|
|
76
85
|
);
|
|
77
86
|
|
|
78
87
|
const txResolver = new TxResolverService(node);
|
|
79
88
|
|
|
80
|
-
return new this(
|
|
89
|
+
return new this(
|
|
90
|
+
node,
|
|
91
|
+
synchronizer,
|
|
92
|
+
archiver,
|
|
93
|
+
anchorBlockStore,
|
|
94
|
+
contractSyncService,
|
|
95
|
+
contractClassService,
|
|
96
|
+
txResolver,
|
|
97
|
+
);
|
|
81
98
|
}
|
|
82
99
|
|
|
83
100
|
/** Returns an {@link L2TipsProvider} backed by this node's chain tips. */
|
|
@@ -58,6 +58,11 @@ export class TXESynchronizer implements WorldStateSynchronizer {
|
|
|
58
58
|
return this.nativeWorldStateService.getSnapshot(BlockNumber(blockNumber));
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
+
/** Gets a snapshot at the given block number. The TXE has no reorgs, so the fork hash is not verified. */
|
|
62
|
+
public getVerifiedSnapshot(blockNumber: number, _blockHash: BlockHash): Promise<MerkleTreeReadOperations> {
|
|
63
|
+
return Promise.resolve(this.getSnapshot(blockNumber));
|
|
64
|
+
}
|
|
65
|
+
|
|
61
66
|
/** Backups the db to the target path. */
|
|
62
67
|
public backupTo(dstPath: string, compact?: boolean): Promise<Record<Exclude<SnapshotDataKeys, 'archiver'>, string>> {
|
|
63
68
|
return this.nativeWorldStateService.backupTo(dstPath, compact);
|
package/src/txe_session.ts
CHANGED
|
@@ -7,6 +7,7 @@ import { openEphemeralStore } from '@aztec/kv-store/lmdb-v2';
|
|
|
7
7
|
import {
|
|
8
8
|
AddressStore,
|
|
9
9
|
AnchorBlockStore,
|
|
10
|
+
AnchoredContractData,
|
|
10
11
|
CapsuleService,
|
|
11
12
|
CapsuleStore,
|
|
12
13
|
ContractStore,
|
|
@@ -19,7 +20,6 @@ import {
|
|
|
19
20
|
RecipientTaggingStore,
|
|
20
21
|
SenderTaggingStore,
|
|
21
22
|
TaggingSecretSourcesStore,
|
|
22
|
-
type TaggingSecretStrategy,
|
|
23
23
|
composeHooks,
|
|
24
24
|
} from '@aztec/pxe/server';
|
|
25
25
|
import {
|
|
@@ -29,6 +29,7 @@ import {
|
|
|
29
29
|
type IMiscOracle,
|
|
30
30
|
type IPrivateExecutionOracle,
|
|
31
31
|
type IUtilityExecutionOracle,
|
|
32
|
+
LEGACY_ORACLE_REGISTRY,
|
|
32
33
|
Option,
|
|
33
34
|
TransientArrayService,
|
|
34
35
|
UtilityExecutionOracle,
|
|
@@ -56,8 +57,13 @@ import { z } from 'zod';
|
|
|
56
57
|
|
|
57
58
|
import { DEFAULT_ADDRESS, MAX_OFFCHAIN_EFFECTS_PER_TXE_QUERY, MAX_OFFCHAIN_EFFECT_LEN } from './constants.js';
|
|
58
59
|
import type { IAvmExecutionOracle, ITxeExecutionOracle } from './oracle/interfaces.js';
|
|
60
|
+
import {
|
|
61
|
+
type TXETaggingSecretStrategies,
|
|
62
|
+
makeResolveTaggingSecretStrategyHook,
|
|
63
|
+
} from './oracle/tagging_secret_strategy.js';
|
|
59
64
|
import { TXEOraclePublicContext } from './oracle/txe_oracle_public_context.js';
|
|
60
|
-
import {
|
|
65
|
+
import { callTxeLegacyHandler } from './oracle/txe_oracle_registry.js';
|
|
66
|
+
import { TXEOracleTopLevelContext, authorizeAllUtilityCallsHook } from './oracle/txe_oracle_top_level_context.js';
|
|
61
67
|
import { TXE_ORACLE_VERSION_MAJOR, TXE_ORACLE_VERSION_MINOR } from './oracle/txe_oracle_version.js';
|
|
62
68
|
import { TXEPrivateExecutionOracle } from './oracle/txe_private_execution_oracle.js';
|
|
63
69
|
import { RPCTranslator, UnavailableOracleError } from './rpc_translator.js';
|
|
@@ -234,7 +240,8 @@ function emptyLastCallState(): LastCallState {
|
|
|
234
240
|
export class TXESession implements TXESessionStateHandler {
|
|
235
241
|
private state: SessionState = { name: 'TOP_LEVEL' };
|
|
236
242
|
private authwits: Map<string, AuthWitness> = new Map();
|
|
237
|
-
private
|
|
243
|
+
private taggingSecretStrategies: TXETaggingSecretStrategies = new Map();
|
|
244
|
+
private authorizeAllUtilityCallTargets = false;
|
|
238
245
|
private lastCallInfo: LastCallState = emptyLastCallState();
|
|
239
246
|
private txeOracleVersion: { major: number; minor: number } | undefined;
|
|
240
247
|
|
|
@@ -354,7 +361,8 @@ export class TXESession implements TXESessionStateHandler {
|
|
|
354
361
|
version,
|
|
355
362
|
chainId,
|
|
356
363
|
new Map(),
|
|
357
|
-
|
|
364
|
+
new Map(),
|
|
365
|
+
false, // authorizeAllUtilityCallTargets
|
|
358
366
|
artifactResolver,
|
|
359
367
|
rootPath,
|
|
360
368
|
packageName,
|
|
@@ -397,6 +405,18 @@ export class TXESession implements TXESessionStateHandler {
|
|
|
397
405
|
*/
|
|
398
406
|
processFunction(functionName: TXEOracleFunctionName, inputs: ForeignCallArgs): Promise<ForeignCallResult> {
|
|
399
407
|
try {
|
|
408
|
+
// Oracles retired into the PXE legacy registry have no translator method; dispatch them through the same
|
|
409
|
+
// buildACIRCallback legacy path that contract execution uses, keeping TXE's two oracle paths in sync.
|
|
410
|
+
// Use an own-property check: `in` would match inherited `Object.prototype` keys (e.g. `constructor`), routing
|
|
411
|
+
// them into the legacy path instead of letting them fall through to the unknown-oracle error.
|
|
412
|
+
if (Object.hasOwn(LEGACY_ORACLE_REGISTRY, functionName)) {
|
|
413
|
+
return callTxeLegacyHandler(
|
|
414
|
+
functionName,
|
|
415
|
+
inputs,
|
|
416
|
+
this.oracleHandler as Parameters<typeof buildACIRCallback>[0],
|
|
417
|
+
);
|
|
418
|
+
}
|
|
419
|
+
|
|
400
420
|
const translator = new RPCTranslator(this, this.oracleHandler) as any;
|
|
401
421
|
// We perform a runtime validation to check that the function name corresponds to a real oracle handler.
|
|
402
422
|
const validatedFunctionName = z
|
|
@@ -672,7 +692,8 @@ export class TXESession implements TXESessionStateHandler {
|
|
|
672
692
|
this.version,
|
|
673
693
|
this.chainId,
|
|
674
694
|
this.authwits,
|
|
675
|
-
this.
|
|
695
|
+
this.taggingSecretStrategies,
|
|
696
|
+
this.authorizeAllUtilityCallTargets,
|
|
676
697
|
this.artifactResolver,
|
|
677
698
|
this.rootPath,
|
|
678
699
|
this.packageName,
|
|
@@ -717,10 +738,15 @@ export class TXESession implements TXESessionStateHandler {
|
|
|
717
738
|
|
|
718
739
|
const utilityExecutor = this.utilityExecutorForContractSync(anchorBlock);
|
|
719
740
|
const transientArrayService = new TransientArrayService();
|
|
720
|
-
const
|
|
741
|
+
const anchoredContractData = new AnchoredContractData(
|
|
742
|
+
this.contractStore,
|
|
743
|
+
this.stateMachine.contractClassService,
|
|
744
|
+
anchorBlock!,
|
|
745
|
+
);
|
|
721
746
|
this.oracleHandler = new TXEPrivateExecutionOracle({
|
|
722
747
|
argsHash: Fr.ZERO,
|
|
723
748
|
txContext: new TxContext(this.chainId, this.version, gasSettings),
|
|
749
|
+
txRequestSalt: Fr.ZERO,
|
|
724
750
|
callContext: new CallContext(AztecAddress.ZERO, contractAddress, FunctionSelector.empty(), false),
|
|
725
751
|
anchorBlockHeader: anchorBlock!,
|
|
726
752
|
utilityExecutor,
|
|
@@ -729,7 +755,7 @@ export class TXESession implements TXESessionStateHandler {
|
|
|
729
755
|
executionCache: new HashedValuesCache(),
|
|
730
756
|
noteCache,
|
|
731
757
|
taggingIndexCache,
|
|
732
|
-
|
|
758
|
+
anchoredContractData,
|
|
733
759
|
noteStore: this.noteStore,
|
|
734
760
|
keyStore: this.keyStore,
|
|
735
761
|
addressStore: this.addressStore,
|
|
@@ -747,7 +773,8 @@ export class TXESession implements TXESessionStateHandler {
|
|
|
747
773
|
txResolver: this.stateMachine.txResolver,
|
|
748
774
|
simulator: new WASMSimulator(),
|
|
749
775
|
hooks: composeHooks({
|
|
750
|
-
resolveTaggingSecretStrategy:
|
|
776
|
+
resolveTaggingSecretStrategy: makeResolveTaggingSecretStrategyHook(this.taggingSecretStrategies),
|
|
777
|
+
authorizeUtilityCall: this.authorizeAllUtilityCallTargets ? authorizeAllUtilityCallsHook : undefined,
|
|
751
778
|
}),
|
|
752
779
|
transientArrayService,
|
|
753
780
|
});
|
|
@@ -827,7 +854,11 @@ export class TXESession implements TXESessionStateHandler {
|
|
|
827
854
|
authWitnesses: [],
|
|
828
855
|
capsules: [],
|
|
829
856
|
anchorBlockHeader,
|
|
830
|
-
|
|
857
|
+
anchoredContractData: new AnchoredContractData(
|
|
858
|
+
this.contractStore,
|
|
859
|
+
this.stateMachine.contractClassService,
|
|
860
|
+
anchorBlockHeader,
|
|
861
|
+
),
|
|
831
862
|
noteStore: this.noteStore,
|
|
832
863
|
keyStore: this.keyStore,
|
|
833
864
|
addressStore: this.addressStore,
|
|
@@ -844,6 +875,9 @@ export class TXESession implements TXESessionStateHandler {
|
|
|
844
875
|
scopes: await this.keyStore.getAccounts(),
|
|
845
876
|
simulator: new WASMSimulator(),
|
|
846
877
|
utilityExecutor: this.utilityExecutorForContractSync(anchorBlockHeader),
|
|
878
|
+
hooks: composeHooks({
|
|
879
|
+
authorizeUtilityCall: this.authorizeAllUtilityCallTargets ? authorizeAllUtilityCallsHook : undefined,
|
|
880
|
+
}),
|
|
847
881
|
// Execution-tree root (top-level utility run): own store; nested frames inherit it.
|
|
848
882
|
transientArrayService: new TransientArrayService(),
|
|
849
883
|
});
|
|
@@ -866,15 +900,18 @@ export class TXESession implements TXESessionStateHandler {
|
|
|
866
900
|
// accounts to PXE (via `addAccount`), etc. This is a slight inconsistency in the working model of this class, but
|
|
867
901
|
// is not too bad. The `close` call below therefore only hands back the session-scoped values that a test
|
|
868
902
|
// sets directly at the top level, outside any contract execution (e.g. via `advanceTimestampBy`,
|
|
869
|
-
// `addAuthWitness`, `
|
|
903
|
+
// `addAuthWitness`, `setTaggingSecretStrategies`). The oracle handler is discarded on every state transition,
|
|
870
904
|
// so the session must seed these values into the contexts it creates later.
|
|
871
905
|
|
|
872
906
|
// TODO: persisting authwits this way is quite unfortunate: they create a temporary utility context that would
|
|
873
907
|
// otherwise reset them, so we'd not be able to pass more than one per execution. Ideally authwits would be passed
|
|
874
908
|
// alongside a contract call instead of pre-seeded.
|
|
875
|
-
|
|
876
|
-
this.
|
|
877
|
-
|
|
909
|
+
({
|
|
910
|
+
nextBlockTimestamp: this.nextBlockTimestamp,
|
|
911
|
+
authwits: this.authwits,
|
|
912
|
+
taggingSecretStrategies: this.taggingSecretStrategies,
|
|
913
|
+
authorizeAllUtilityCallTargets: this.authorizeAllUtilityCallTargets,
|
|
914
|
+
} = (this.oracleHandler as TXEOracleTopLevelContext).close());
|
|
878
915
|
}
|
|
879
916
|
|
|
880
917
|
private async exitPrivateState() {
|
|
@@ -923,7 +960,18 @@ export class TXESession implements TXESessionStateHandler {
|
|
|
923
960
|
|
|
924
961
|
private utilityExecutorForContractSync(anchorBlock: any) {
|
|
925
962
|
return async (call: FunctionCall, scopes: AztecAddress[]) => {
|
|
926
|
-
const
|
|
963
|
+
const anchoredContractData = new AnchoredContractData(
|
|
964
|
+
this.contractStore,
|
|
965
|
+
this.stateMachine.contractClassService,
|
|
966
|
+
anchorBlock!,
|
|
967
|
+
);
|
|
968
|
+
const entryPointArtifact = await anchoredContractData.getFunctionArtifactWithDebugMetadata(
|
|
969
|
+
call.to,
|
|
970
|
+
call.selector,
|
|
971
|
+
);
|
|
972
|
+
if (!entryPointArtifact) {
|
|
973
|
+
throw new Error(`Cannot run function ${call.selector} on ${call.to}: the contract is not registered.`);
|
|
974
|
+
}
|
|
927
975
|
if (entryPointArtifact.functionType !== FunctionType.UTILITY) {
|
|
928
976
|
throw new Error(`Cannot run ${entryPointArtifact.functionType} function as utility`);
|
|
929
977
|
}
|
|
@@ -940,7 +988,7 @@ export class TXESession implements TXESessionStateHandler {
|
|
|
940
988
|
authWitnesses: [],
|
|
941
989
|
capsules: [],
|
|
942
990
|
anchorBlockHeader: anchorBlock!,
|
|
943
|
-
|
|
991
|
+
anchoredContractData,
|
|
944
992
|
noteStore: this.noteStore,
|
|
945
993
|
keyStore: this.keyStore,
|
|
946
994
|
addressStore: this.addressStore,
|
|
@@ -7,8 +7,6 @@ import { TxEffect, TxHash } from '@aztec/stdlib/tx';
|
|
|
7
7
|
export async function makeTxEffect(noteCache: ExecutionNoteCache, txBlockNumber: BlockNumber): Promise<TxEffect> {
|
|
8
8
|
const txEffect = TxEffect.empty();
|
|
9
9
|
|
|
10
|
-
noteCache.finish();
|
|
11
|
-
|
|
12
10
|
const nonceGenerator = noteCache.getNonceGenerator();
|
|
13
11
|
txEffect.noteHashes = await Promise.all(
|
|
14
12
|
noteCache
|
|
@@ -36,7 +36,8 @@ export class TXEPublicContractDataSource implements ContractDataSource {
|
|
|
36
36
|
|
|
37
37
|
async getContract(address: AztecAddress): Promise<ContractInstanceWithAddress | undefined> {
|
|
38
38
|
const instance = await this.contractStore.getContractInstance(address);
|
|
39
|
-
|
|
39
|
+
// TXE has no contract updates, so the current class always equals the original.
|
|
40
|
+
return instance && { ...instance, address, currentContractClassId: instance.originalContractClassId };
|
|
40
41
|
}
|
|
41
42
|
|
|
42
43
|
getContractClassIds(): Promise<Fr[]> {
|
|
@@ -44,12 +45,13 @@ export class TXEPublicContractDataSource implements ContractDataSource {
|
|
|
44
45
|
}
|
|
45
46
|
|
|
46
47
|
async getContractArtifact(address: AztecAddress): Promise<ContractArtifact | undefined> {
|
|
47
|
-
const instance = await this.
|
|
48
|
-
return instance && this.contractStore.getContractArtifact(instance.
|
|
48
|
+
const instance = await this.getContract(address);
|
|
49
|
+
return instance && this.contractStore.getContractArtifact(instance.originalContractClassId);
|
|
49
50
|
}
|
|
50
51
|
|
|
51
52
|
async getDebugFunctionName(address: AztecAddress, selector: FunctionSelector): Promise<string | undefined> {
|
|
52
|
-
|
|
53
|
+
const instance = await this.getContract(address);
|
|
54
|
+
return instance && this.contractStore.getDebugFunctionName(instance.originalContractClassId, selector);
|
|
53
55
|
}
|
|
54
56
|
|
|
55
57
|
registerContractFunctionSignatures(_signatures: []): Promise<void> {
|