@aztec/txe 5.0.0 → 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/HandshakeRegistry-D2W3AOPD.js +3 -0
- package/dest/HandshakeRegistry-D2W3AOPD.js.map +7 -0
- package/dest/{MultiCallEntrypoint-TGICA67H.js → MultiCallEntrypoint-MIDICLQB.js} +1 -1
- package/dest/{MultiCallEntrypoint-TGICA67H.js.map → MultiCallEntrypoint-MIDICLQB.js.map} +2 -2
- 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/{chunk-YP4ODNMQ.js → chunk-EKHK6CRD.js} +7 -7
- package/dest/{chunk-YP4ODNMQ.js.map → chunk-EKHK6CRD.js.map} +4 -4
- package/dest/{chunk-PDOEF22H.js → chunk-RELAEYUE.js} +2 -2
- package/dest/metafile.json +338 -256
- package/dest/oracle/interfaces.d.ts +5 -1
- package/dest/oracle/interfaces.d.ts.map +1 -1
- package/dest/oracle/txe_oracle_registry.d.ts +3 -1
- package/dest/oracle/txe_oracle_registry.d.ts.map +1 -1
- package/dest/oracle/txe_oracle_registry.js +8 -0
- package/dest/oracle/txe_oracle_top_level_context.d.ts +17 -4
- package/dest/oracle/txe_oracle_top_level_context.d.ts.map +1 -1
- package/dest/oracle/txe_oracle_top_level_context.js +22 -6
- package/dest/oracle/txe_oracle_version.d.ts +2 -2
- package/dest/oracle/txe_oracle_version.js +2 -2
- package/dest/rpc_translator.d.ts +3 -1
- package/dest/rpc_translator.d.ts.map +1 -1
- package/dest/rpc_translator.js +16 -0
- package/dest/server.bundle.js +1 -1
- package/dest/txe_session.d.ts +2 -1
- package/dest/txe_session.d.ts.map +1 -1
- package/dest/txe_session.js +11 -5
- package/dest/worker.bundle.js +1 -1
- package/package.json +17 -17
- package/src/oracle/interfaces.ts +4 -0
- package/src/oracle/txe_oracle_registry.ts +4 -0
- package/src/oracle/txe_oracle_top_level_context.ts +28 -2
- package/src/oracle/txe_oracle_version.ts +2 -2
- package/src/rpc_translator.ts +18 -0
- package/src/txe_session.ts +14 -4
- package/dest/AuthRegistry-FSRZIMX6.js +0 -3
- package/dest/AuthRegistry-FSRZIMX6.js.map +0 -7
- package/dest/HandshakeRegistry-KKUEU7XW.js +0 -3
- package/dest/HandshakeRegistry-KKUEU7XW.js.map +0 -7
- package/dest/SchnorrAccount-J5T6OKR3.js +0 -3
- package/dest/SchnorrAccount-J5T6OKR3.js.map +0 -7
- package/dest/SchnorrInitializerlessAccount-OOES6Q4F.js +0 -3
- package/dest/SchnorrInitializerlessAccount-OOES6Q4F.js.map +0 -7
- /package/dest/{chunk-PDOEF22H.js.map → chunk-RELAEYUE.js.map} +0 -0
package/dest/txe_session.js
CHANGED
|
@@ -17,7 +17,7 @@ import { DEFAULT_ADDRESS, MAX_OFFCHAIN_EFFECTS_PER_TXE_QUERY, MAX_OFFCHAIN_EFFEC
|
|
|
17
17
|
import { makeResolveTaggingSecretStrategyHook } from './oracle/tagging_secret_strategy.js';
|
|
18
18
|
import { TXEOraclePublicContext } from './oracle/txe_oracle_public_context.js';
|
|
19
19
|
import { callTxeLegacyHandler } from './oracle/txe_oracle_registry.js';
|
|
20
|
-
import { TXEOracleTopLevelContext } from './oracle/txe_oracle_top_level_context.js';
|
|
20
|
+
import { TXEOracleTopLevelContext, authorizeAllUtilityCallsHook } from './oracle/txe_oracle_top_level_context.js';
|
|
21
21
|
import { TXE_ORACLE_VERSION_MAJOR, TXE_ORACLE_VERSION_MINOR } from './oracle/txe_oracle_version.js';
|
|
22
22
|
import { TXEPrivateExecutionOracle } from './oracle/txe_private_execution_oracle.js';
|
|
23
23
|
import { RPCTranslator, UnavailableOracleError } from './rpc_translator.js';
|
|
@@ -64,6 +64,7 @@ function emptyLastCallState() {
|
|
|
64
64
|
state;
|
|
65
65
|
authwits;
|
|
66
66
|
taggingSecretStrategies;
|
|
67
|
+
authorizeAllUtilityCallTargets;
|
|
67
68
|
lastCallInfo;
|
|
68
69
|
txeOracleVersion;
|
|
69
70
|
disposed;
|
|
@@ -96,6 +97,7 @@ function emptyLastCallState() {
|
|
|
96
97
|
};
|
|
97
98
|
this.authwits = new Map();
|
|
98
99
|
this.taggingSecretStrategies = new Map();
|
|
100
|
+
this.authorizeAllUtilityCallTargets = false;
|
|
99
101
|
this.lastCallInfo = emptyLastCallState();
|
|
100
102
|
this.disposed = false;
|
|
101
103
|
}
|
|
@@ -151,7 +153,7 @@ function emptyLastCallState() {
|
|
|
151
153
|
const chainId = new Fr(await stateMachine.node.getChainId());
|
|
152
154
|
const initialJobId = jobCoordinator.beginJob();
|
|
153
155
|
const logger = createLogger('txe:session');
|
|
154
|
-
const topLevelOracleHandler = new TXEOracleTopLevelContext(stateMachine, contractStore, noteStore, keyStore, addressStore, accountStore, senderTaggingStore, recipientTaggingStore, taggingSecretSourcesStore, capsuleStore, factStore, privateEventStore, nextBlockTimestamp, version, chainId, new Map(), new Map(), artifactResolver, rootPath, packageName);
|
|
156
|
+
const topLevelOracleHandler = new TXEOracleTopLevelContext(stateMachine, contractStore, noteStore, keyStore, addressStore, accountStore, senderTaggingStore, recipientTaggingStore, taggingSecretSourcesStore, capsuleStore, factStore, privateEventStore, nextBlockTimestamp, version, chainId, new Map(), new Map(), false, artifactResolver, rootPath, packageName);
|
|
155
157
|
await topLevelOracleHandler.mineDeploymentNullifiers([
|
|
156
158
|
STANDARD_AUTH_REGISTRY_ADDRESS
|
|
157
159
|
]);
|
|
@@ -347,7 +349,7 @@ function emptyLastCallState() {
|
|
|
347
349
|
}
|
|
348
350
|
// Commit all staged stores from the job that was just completed, then begin a new job
|
|
349
351
|
await this.cycleJob();
|
|
350
|
-
this.oracleHandler = new TXEOracleTopLevelContext(this.stateMachine, this.contractStore, this.noteStore, this.keyStore, this.addressStore, this.accountStore, this.senderTaggingStore, this.recipientTaggingStore, this.taggingSecretSourcesStore, this.capsuleStore, this.factStore, this.privateEventStore, this.nextBlockTimestamp, this.version, this.chainId, this.authwits, this.taggingSecretStrategies, this.artifactResolver, this.rootPath, this.packageName);
|
|
352
|
+
this.oracleHandler = new TXEOracleTopLevelContext(this.stateMachine, this.contractStore, this.noteStore, this.keyStore, this.addressStore, this.accountStore, this.senderTaggingStore, this.recipientTaggingStore, this.taggingSecretSourcesStore, this.capsuleStore, this.factStore, this.privateEventStore, this.nextBlockTimestamp, this.version, this.chainId, this.authwits, this.taggingSecretStrategies, this.authorizeAllUtilityCallTargets, this.artifactResolver, this.rootPath, this.packageName);
|
|
351
353
|
this.state = {
|
|
352
354
|
name: 'TOP_LEVEL'
|
|
353
355
|
};
|
|
@@ -407,7 +409,8 @@ function emptyLastCallState() {
|
|
|
407
409
|
txResolver: this.stateMachine.txResolver,
|
|
408
410
|
simulator: new WASMSimulator(),
|
|
409
411
|
hooks: composeHooks({
|
|
410
|
-
resolveTaggingSecretStrategy: makeResolveTaggingSecretStrategyHook(this.taggingSecretStrategies)
|
|
412
|
+
resolveTaggingSecretStrategy: makeResolveTaggingSecretStrategyHook(this.taggingSecretStrategies),
|
|
413
|
+
authorizeUtilityCall: this.authorizeAllUtilityCallTargets ? authorizeAllUtilityCallsHook : undefined
|
|
411
414
|
}),
|
|
412
415
|
transientArrayService
|
|
413
416
|
});
|
|
@@ -488,6 +491,9 @@ function emptyLastCallState() {
|
|
|
488
491
|
scopes: await this.keyStore.getAccounts(),
|
|
489
492
|
simulator: new WASMSimulator(),
|
|
490
493
|
utilityExecutor: this.utilityExecutorForContractSync(anchorBlockHeader),
|
|
494
|
+
hooks: composeHooks({
|
|
495
|
+
authorizeUtilityCall: this.authorizeAllUtilityCallTargets ? authorizeAllUtilityCallsHook : undefined
|
|
496
|
+
}),
|
|
491
497
|
// Execution-tree root (top-level utility run): own store; nested frames inherit it.
|
|
492
498
|
transientArrayService: new TransientArrayService()
|
|
493
499
|
});
|
|
@@ -513,7 +519,7 @@ function emptyLastCallState() {
|
|
|
513
519
|
// TODO: persisting authwits this way is quite unfortunate: they create a temporary utility context that would
|
|
514
520
|
// otherwise reset them, so we'd not be able to pass more than one per execution. Ideally authwits would be passed
|
|
515
521
|
// alongside a contract call instead of pre-seeded.
|
|
516
|
-
|
|
522
|
+
({ nextBlockTimestamp: this.nextBlockTimestamp, authwits: this.authwits, taggingSecretStrategies: this.taggingSecretStrategies, authorizeAllUtilityCallTargets: this.authorizeAllUtilityCallTargets } = this.oracleHandler.close());
|
|
517
523
|
}
|
|
518
524
|
async exitPrivateState() {
|
|
519
525
|
if (this.state.name != 'PRIVATE') {
|
package/dest/worker.bundle.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { createRequire as __txeCreateRequire } from 'node:module';
|
|
2
2
|
const require = __txeCreateRequire(import.meta.url);
|
|
3
|
-
import{TXEDispatcher,activeSessionCount,createLogger}from"./chunk-
|
|
3
|
+
import{TXEDispatcher,activeSessionCount,createLogger}from"./chunk-EKHK6CRD.js";import{__name}from"./chunk-BJVAAXNA.js";import{BackendType,Barretenberg,BarretenbergSync}from"@aztec/bb.js";import{parentPort,workerData}from"node:worker_threads";Barretenberg.initSingleton({backend:BackendType.Wasm,skipSrsInit:!0,threads:1});BarretenbergSync.initSingleton({backend:BackendType.Wasm});if(!parentPort)throw new Error("worker.ts must be loaded as a worker_thread");var port=parentPort,logger=createLogger("txe:worker"),dispatcherOpts={contractStoreSourceDir:workerData.contractStoreSourceDir,schnorrClassId:workerData.schnorrClassId},dispatcher=new TXEDispatcher(logger,dispatcherOpts);function serializeError(err){return err instanceof Error?{message:err.message,name:err.name,stack:err.stack}:{message:String(err)}}__name(serializeError,"serializeError");process.env.TXE_WORKER_MEMSTAT==="1"&&setInterval(()=>{let m=process.memoryUsage();port.postMessage({type:"memstat",sessions:activeSessionCount(),rss:m.rss,heapTotal:m.heapTotal,heapUsed:m.heapUsed,external:m.external,arrayBuffers:m.arrayBuffers})},2e3).unref();port.on("message",msg=>{switch(msg.type){case"foreign-call":(async()=>{try{let value=await dispatcher.resolve_foreign_call(msg.callData);port.postMessage({type:"result",requestId:msg.requestId,ok:!0,value})}catch(err){port.postMessage({type:"result",requestId:msg.requestId,ok:!1,error:serializeError(err)})}})();return;case"dispose-session":dispatcher.disposeSession(msg.sessionId).catch(err=>logger.warn("disposeSession failed",err));return}});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/txe",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
"./server": {
|
|
@@ -69,22 +69,22 @@
|
|
|
69
69
|
]
|
|
70
70
|
},
|
|
71
71
|
"dependencies": {
|
|
72
|
-
"@aztec/accounts": "5.0.
|
|
73
|
-
"@aztec/archiver": "5.0.
|
|
74
|
-
"@aztec/aztec-node": "5.0.
|
|
75
|
-
"@aztec/aztec.js": "5.0.
|
|
76
|
-
"@aztec/bb-prover": "5.0.
|
|
77
|
-
"@aztec/bb.js": "5.0.
|
|
78
|
-
"@aztec/constants": "5.0.
|
|
79
|
-
"@aztec/foundation": "5.0.
|
|
80
|
-
"@aztec/key-store": "5.0.
|
|
81
|
-
"@aztec/kv-store": "5.0.
|
|
82
|
-
"@aztec/protocol-contracts": "5.0.
|
|
83
|
-
"@aztec/pxe": "5.0.
|
|
84
|
-
"@aztec/simulator": "5.0.
|
|
85
|
-
"@aztec/standard-contracts": "5.0.
|
|
86
|
-
"@aztec/stdlib": "5.0.
|
|
87
|
-
"@aztec/world-state": "5.0.
|
|
72
|
+
"@aztec/accounts": "5.0.1",
|
|
73
|
+
"@aztec/archiver": "5.0.1",
|
|
74
|
+
"@aztec/aztec-node": "5.0.1",
|
|
75
|
+
"@aztec/aztec.js": "5.0.1",
|
|
76
|
+
"@aztec/bb-prover": "5.0.1",
|
|
77
|
+
"@aztec/bb.js": "5.0.1",
|
|
78
|
+
"@aztec/constants": "5.0.1",
|
|
79
|
+
"@aztec/foundation": "5.0.1",
|
|
80
|
+
"@aztec/key-store": "5.0.1",
|
|
81
|
+
"@aztec/kv-store": "5.0.1",
|
|
82
|
+
"@aztec/protocol-contracts": "5.0.1",
|
|
83
|
+
"@aztec/pxe": "5.0.1",
|
|
84
|
+
"@aztec/simulator": "5.0.1",
|
|
85
|
+
"@aztec/standard-contracts": "5.0.1",
|
|
86
|
+
"@aztec/stdlib": "5.0.1",
|
|
87
|
+
"@aztec/world-state": "5.0.1",
|
|
88
88
|
"msgpackr": "^1.11.2",
|
|
89
89
|
"zod": "^4"
|
|
90
90
|
},
|
package/src/oracle/interfaces.ts
CHANGED
|
@@ -81,6 +81,10 @@ export interface ITxeExecutionOracle {
|
|
|
81
81
|
unconstrainedStrategy: Option<TaggingSecretStrategy>,
|
|
82
82
|
constrainedStrategy: Option<TaggingSecretStrategy>,
|
|
83
83
|
): void;
|
|
84
|
+
/**
|
|
85
|
+
* Configures whether the test's simulated wallet authorizes every cross-contract utility call target.
|
|
86
|
+
*/
|
|
87
|
+
setAuthorizeAllUtilityCallTargets(authorizeAll: boolean): void;
|
|
84
88
|
getLastBlockTimestamp(): Promise<bigint>;
|
|
85
89
|
getLastTxEffects(): Promise<{
|
|
86
90
|
txHash: TxHash;
|
|
@@ -327,6 +327,10 @@ export const TXE_ORACLE_REGISTRY = {
|
|
|
327
327
|
],
|
|
328
328
|
}),
|
|
329
329
|
|
|
330
|
+
aztec_txe_setAuthorizeAllUtilityCallTargets: makeEntry({
|
|
331
|
+
params: [{ name: 'authorizeAll', type: BOOL }],
|
|
332
|
+
}),
|
|
333
|
+
|
|
330
334
|
aztec_txe_getLastBlockTimestamp: makeEntry({
|
|
331
335
|
returnType: BIGINT,
|
|
332
336
|
}),
|
|
@@ -126,6 +126,7 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
|
|
|
126
126
|
private chainId: Fr,
|
|
127
127
|
private authwits: Map<string, AuthWitness>,
|
|
128
128
|
private taggingSecretStrategies: TXETaggingSecretStrategies,
|
|
129
|
+
private authorizeAllUtilityCallTargets: boolean,
|
|
129
130
|
private readonly artifactResolver: TXEArtifactResolver,
|
|
130
131
|
private readonly rootPath: string,
|
|
131
132
|
private readonly packageName: string,
|
|
@@ -373,6 +374,10 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
|
|
|
373
374
|
apply(AppTaggingSecretKind.CONSTRAINED, constrainedStrategy);
|
|
374
375
|
}
|
|
375
376
|
|
|
377
|
+
setAuthorizeAllUtilityCallTargets(authorizeAll: boolean): void {
|
|
378
|
+
this.authorizeAllUtilityCallTargets = authorizeAll;
|
|
379
|
+
}
|
|
380
|
+
|
|
376
381
|
async sendL1ToL2Message(content: Fr, secretHash: Fr, sender: EthAddress, recipient: AztecAddress): Promise<Fr> {
|
|
377
382
|
// Messages are appended to the tree, so the next free slot is simply the current tree size.
|
|
378
383
|
const { size } = await this.stateMachine.synchronizer
|
|
@@ -975,9 +980,19 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
|
|
|
975
980
|
}
|
|
976
981
|
}
|
|
977
982
|
|
|
978
|
-
close():
|
|
983
|
+
close(): {
|
|
984
|
+
nextBlockTimestamp: bigint;
|
|
985
|
+
authwits: Map<string, AuthWitness>;
|
|
986
|
+
taggingSecretStrategies: TXETaggingSecretStrategies;
|
|
987
|
+
authorizeAllUtilityCallTargets: boolean;
|
|
988
|
+
} {
|
|
979
989
|
this.logger.debug('Exiting Top Level Context');
|
|
980
|
-
return
|
|
990
|
+
return {
|
|
991
|
+
nextBlockTimestamp: this.nextBlockTimestamp,
|
|
992
|
+
authwits: this.authwits,
|
|
993
|
+
taggingSecretStrategies: this.taggingSecretStrategies,
|
|
994
|
+
authorizeAllUtilityCallTargets: this.authorizeAllUtilityCallTargets,
|
|
995
|
+
};
|
|
981
996
|
}
|
|
982
997
|
|
|
983
998
|
private async getLastBlockNumber(): Promise<BlockNumber> {
|
|
@@ -989,6 +1004,9 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
|
|
|
989
1004
|
callerContext: 'private' | 'private view' | 'utility',
|
|
990
1005
|
authorizedTargets: AztecAddress[],
|
|
991
1006
|
): ExecutionHooks['authorizeUtilityCall'] | undefined {
|
|
1007
|
+
if (this.authorizeAllUtilityCallTargets) {
|
|
1008
|
+
return authorizeAllUtilityCallsHook;
|
|
1009
|
+
}
|
|
992
1010
|
if (authorizedTargets.length === 0) {
|
|
993
1011
|
return undefined;
|
|
994
1012
|
}
|
|
@@ -998,3 +1016,11 @@ export class TXEOracleTopLevelContext implements IMiscOracle, ITxeExecutionOracl
|
|
|
998
1016
|
});
|
|
999
1017
|
}
|
|
1000
1018
|
}
|
|
1019
|
+
|
|
1020
|
+
/**
|
|
1021
|
+
* An `authorizeUtilityCall` hook that authorizes every cross-contract utility call.
|
|
1022
|
+
*
|
|
1023
|
+
* Backs the `aztec_txe_setAuthorizeAllUtilityCallTargets` oracle.
|
|
1024
|
+
*/
|
|
1025
|
+
export const authorizeAllUtilityCallsHook: NonNullable<ExecutionHooks['authorizeUtilityCall']> = () =>
|
|
1026
|
+
Promise.resolve({ authorized: true });
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* The Noir counterparts are in `noir-projects/aztec-nr/aztec/src/test/helpers/txe_oracles.nr`.
|
|
7
7
|
*/
|
|
8
8
|
export const TXE_ORACLE_VERSION_MAJOR = 3;
|
|
9
|
-
export const TXE_ORACLE_VERSION_MINOR =
|
|
9
|
+
export const TXE_ORACLE_VERSION_MINOR = 1;
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* This hash is computed from the TXE oracle interfaces (IAvmExecutionOracle and ITxeExecutionOracle) and is used to
|
|
@@ -14,4 +14,4 @@ export const TXE_ORACLE_VERSION_MINOR = 0;
|
|
|
14
14
|
* - TXE_ORACLE_VERSION_MAJOR (and reset MINOR to 0) for breaking changes, or
|
|
15
15
|
* - TXE_ORACLE_VERSION_MINOR for additive changes (new oracle method added).
|
|
16
16
|
*/
|
|
17
|
-
export const TXE_ORACLE_INTERFACE_HASH = '
|
|
17
|
+
export const TXE_ORACLE_INTERFACE_HASH = '89c60f191f8f60ef72d592e46dd6c4afff10dc47a9e14f4f8d37e31e40857d9c';
|
package/src/rpc_translator.ts
CHANGED
|
@@ -230,6 +230,15 @@ export class RPCTranslator {
|
|
|
230
230
|
});
|
|
231
231
|
}
|
|
232
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),
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
|
|
233
242
|
// PXE oracles
|
|
234
243
|
|
|
235
244
|
// eslint-disable-next-line camelcase
|
|
@@ -633,6 +642,15 @@ export class RPCTranslator {
|
|
|
633
642
|
});
|
|
634
643
|
}
|
|
635
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
|
+
|
|
636
654
|
// eslint-disable-next-line camelcase
|
|
637
655
|
aztec_utl_setCapsule(...inputs: ForeignCallArgs) {
|
|
638
656
|
return callTxeHandler({
|
package/src/txe_session.ts
CHANGED
|
@@ -63,7 +63,7 @@ import {
|
|
|
63
63
|
} from './oracle/tagging_secret_strategy.js';
|
|
64
64
|
import { TXEOraclePublicContext } from './oracle/txe_oracle_public_context.js';
|
|
65
65
|
import { callTxeLegacyHandler } from './oracle/txe_oracle_registry.js';
|
|
66
|
-
import { TXEOracleTopLevelContext } from './oracle/txe_oracle_top_level_context.js';
|
|
66
|
+
import { TXEOracleTopLevelContext, authorizeAllUtilityCallsHook } from './oracle/txe_oracle_top_level_context.js';
|
|
67
67
|
import { TXE_ORACLE_VERSION_MAJOR, TXE_ORACLE_VERSION_MINOR } from './oracle/txe_oracle_version.js';
|
|
68
68
|
import { TXEPrivateExecutionOracle } from './oracle/txe_private_execution_oracle.js';
|
|
69
69
|
import { RPCTranslator, UnavailableOracleError } from './rpc_translator.js';
|
|
@@ -241,6 +241,7 @@ export class TXESession implements TXESessionStateHandler {
|
|
|
241
241
|
private state: SessionState = { name: 'TOP_LEVEL' };
|
|
242
242
|
private authwits: Map<string, AuthWitness> = new Map();
|
|
243
243
|
private taggingSecretStrategies: TXETaggingSecretStrategies = new Map();
|
|
244
|
+
private authorizeAllUtilityCallTargets = false;
|
|
244
245
|
private lastCallInfo: LastCallState = emptyLastCallState();
|
|
245
246
|
private txeOracleVersion: { major: number; minor: number } | undefined;
|
|
246
247
|
|
|
@@ -361,6 +362,7 @@ export class TXESession implements TXESessionStateHandler {
|
|
|
361
362
|
chainId,
|
|
362
363
|
new Map(),
|
|
363
364
|
new Map(),
|
|
365
|
+
false, // authorizeAllUtilityCallTargets
|
|
364
366
|
artifactResolver,
|
|
365
367
|
rootPath,
|
|
366
368
|
packageName,
|
|
@@ -691,6 +693,7 @@ export class TXESession implements TXESessionStateHandler {
|
|
|
691
693
|
this.chainId,
|
|
692
694
|
this.authwits,
|
|
693
695
|
this.taggingSecretStrategies,
|
|
696
|
+
this.authorizeAllUtilityCallTargets,
|
|
694
697
|
this.artifactResolver,
|
|
695
698
|
this.rootPath,
|
|
696
699
|
this.packageName,
|
|
@@ -771,6 +774,7 @@ export class TXESession implements TXESessionStateHandler {
|
|
|
771
774
|
simulator: new WASMSimulator(),
|
|
772
775
|
hooks: composeHooks({
|
|
773
776
|
resolveTaggingSecretStrategy: makeResolveTaggingSecretStrategyHook(this.taggingSecretStrategies),
|
|
777
|
+
authorizeUtilityCall: this.authorizeAllUtilityCallTargets ? authorizeAllUtilityCallsHook : undefined,
|
|
774
778
|
}),
|
|
775
779
|
transientArrayService,
|
|
776
780
|
});
|
|
@@ -871,6 +875,9 @@ export class TXESession implements TXESessionStateHandler {
|
|
|
871
875
|
scopes: await this.keyStore.getAccounts(),
|
|
872
876
|
simulator: new WASMSimulator(),
|
|
873
877
|
utilityExecutor: this.utilityExecutorForContractSync(anchorBlockHeader),
|
|
878
|
+
hooks: composeHooks({
|
|
879
|
+
authorizeUtilityCall: this.authorizeAllUtilityCallTargets ? authorizeAllUtilityCallsHook : undefined,
|
|
880
|
+
}),
|
|
874
881
|
// Execution-tree root (top-level utility run): own store; nested frames inherit it.
|
|
875
882
|
transientArrayService: new TransientArrayService(),
|
|
876
883
|
});
|
|
@@ -899,9 +906,12 @@ export class TXESession implements TXESessionStateHandler {
|
|
|
899
906
|
// TODO: persisting authwits this way is quite unfortunate: they create a temporary utility context that would
|
|
900
907
|
// otherwise reset them, so we'd not be able to pass more than one per execution. Ideally authwits would be passed
|
|
901
908
|
// alongside a contract call instead of pre-seeded.
|
|
902
|
-
|
|
903
|
-
this.
|
|
904
|
-
|
|
909
|
+
({
|
|
910
|
+
nextBlockTimestamp: this.nextBlockTimestamp,
|
|
911
|
+
authwits: this.authwits,
|
|
912
|
+
taggingSecretStrategies: this.taggingSecretStrategies,
|
|
913
|
+
authorizeAllUtilityCallTargets: this.authorizeAllUtilityCallTargets,
|
|
914
|
+
} = (this.oracleHandler as TXEOracleTopLevelContext).close());
|
|
905
915
|
}
|
|
906
916
|
|
|
907
917
|
private async exitPrivateState() {
|