@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/dest/txe_session.js
CHANGED
|
@@ -3,8 +3,8 @@ 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 { openEphemeralStore } from '@aztec/kv-store/lmdb-v2';
|
|
6
|
-
import { AddressStore, AnchorBlockStore, CapsuleService, CapsuleStore, FactService, FactStore, JobCoordinator, NoteService, NoteStore, PrivateEventStore, RecipientTaggingStore, SenderTaggingStore, TaggingSecretSourcesStore, composeHooks } from '@aztec/pxe/server';
|
|
7
|
-
import { ExecutionNoteCache, ExecutionTaggingIndexCache, HashedValuesCache, TransientArrayService, UtilityExecutionOracle, buildACIRCallback } from '@aztec/pxe/simulator';
|
|
6
|
+
import { AddressStore, AnchorBlockStore, AnchoredContractData, CapsuleService, CapsuleStore, FactService, FactStore, JobCoordinator, NoteService, NoteStore, PrivateEventStore, RecipientTaggingStore, SenderTaggingStore, TaggingSecretSourcesStore, composeHooks } from '@aztec/pxe/server';
|
|
7
|
+
import { ExecutionNoteCache, ExecutionTaggingIndexCache, HashedValuesCache, LEGACY_ORACLE_REGISTRY, TransientArrayService, UtilityExecutionOracle, buildACIRCallback } from '@aztec/pxe/simulator';
|
|
8
8
|
import { ExecutionError, WASMSimulator, createSimulationError, extractCallStack, resolveAssertionMessageFromError, toACVMWitness } from '@aztec/simulator/client';
|
|
9
9
|
import { STANDARD_AUTH_REGISTRY_ADDRESS } from '@aztec/standard-contracts/auth-registry/constants';
|
|
10
10
|
import { FunctionSelector, FunctionType } from '@aztec/stdlib/abi';
|
|
@@ -14,8 +14,10 @@ import { makeGlobalVariables } from '@aztec/stdlib/testing';
|
|
|
14
14
|
import { CallContext, OFFCHAIN_MESSAGE_IDENTIFIER, TxContext } from '@aztec/stdlib/tx';
|
|
15
15
|
import { z } from 'zod';
|
|
16
16
|
import { DEFAULT_ADDRESS, MAX_OFFCHAIN_EFFECTS_PER_TXE_QUERY, MAX_OFFCHAIN_EFFECT_LEN } from './constants.js';
|
|
17
|
+
import { makeResolveTaggingSecretStrategyHook } from './oracle/tagging_secret_strategy.js';
|
|
17
18
|
import { TXEOraclePublicContext } from './oracle/txe_oracle_public_context.js';
|
|
18
|
-
import {
|
|
19
|
+
import { callTxeLegacyHandler } from './oracle/txe_oracle_registry.js';
|
|
20
|
+
import { TXEOracleTopLevelContext, authorizeAllUtilityCallsHook } from './oracle/txe_oracle_top_level_context.js';
|
|
19
21
|
import { TXE_ORACLE_VERSION_MAJOR, TXE_ORACLE_VERSION_MINOR } from './oracle/txe_oracle_version.js';
|
|
20
22
|
import { TXEPrivateExecutionOracle } from './oracle/txe_private_execution_oracle.js';
|
|
21
23
|
import { RPCTranslator, UnavailableOracleError } from './rpc_translator.js';
|
|
@@ -61,7 +63,8 @@ function emptyLastCallState() {
|
|
|
61
63
|
packageName;
|
|
62
64
|
state;
|
|
63
65
|
authwits;
|
|
64
|
-
|
|
66
|
+
taggingSecretStrategies;
|
|
67
|
+
authorizeAllUtilityCallTargets;
|
|
65
68
|
lastCallInfo;
|
|
66
69
|
txeOracleVersion;
|
|
67
70
|
disposed;
|
|
@@ -93,7 +96,8 @@ function emptyLastCallState() {
|
|
|
93
96
|
name: 'TOP_LEVEL'
|
|
94
97
|
};
|
|
95
98
|
this.authwits = new Map();
|
|
96
|
-
this.
|
|
99
|
+
this.taggingSecretStrategies = new Map();
|
|
100
|
+
this.authorizeAllUtilityCallTargets = false;
|
|
97
101
|
this.lastCallInfo = emptyLastCallState();
|
|
98
102
|
this.disposed = false;
|
|
99
103
|
}
|
|
@@ -149,7 +153,7 @@ function emptyLastCallState() {
|
|
|
149
153
|
const chainId = new Fr(await stateMachine.node.getChainId());
|
|
150
154
|
const initialJobId = jobCoordinator.beginJob();
|
|
151
155
|
const logger = createLogger('txe:session');
|
|
152
|
-
const topLevelOracleHandler = new TXEOracleTopLevelContext(stateMachine, contractStore, noteStore, keyStore, addressStore, accountStore, senderTaggingStore, recipientTaggingStore, taggingSecretSourcesStore, capsuleStore, factStore, privateEventStore, nextBlockTimestamp, version, chainId, new Map(),
|
|
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);
|
|
153
157
|
await topLevelOracleHandler.mineDeploymentNullifiers([
|
|
154
158
|
STANDARD_AUTH_REGISTRY_ADDRESS
|
|
155
159
|
]);
|
|
@@ -162,6 +166,13 @@ function emptyLastCallState() {
|
|
|
162
166
|
* @returns The oracle return values.
|
|
163
167
|
*/ processFunction(functionName, inputs) {
|
|
164
168
|
try {
|
|
169
|
+
// Oracles retired into the PXE legacy registry have no translator method; dispatch them through the same
|
|
170
|
+
// buildACIRCallback legacy path that contract execution uses, keeping TXE's two oracle paths in sync.
|
|
171
|
+
// Use an own-property check: `in` would match inherited `Object.prototype` keys (e.g. `constructor`), routing
|
|
172
|
+
// them into the legacy path instead of letting them fall through to the unknown-oracle error.
|
|
173
|
+
if (Object.hasOwn(LEGACY_ORACLE_REGISTRY, functionName)) {
|
|
174
|
+
return callTxeLegacyHandler(functionName, inputs, this.oracleHandler);
|
|
175
|
+
}
|
|
165
176
|
const translator = new RPCTranslator(this, this.oracleHandler);
|
|
166
177
|
// We perform a runtime validation to check that the function name corresponds to a real oracle handler.
|
|
167
178
|
const validatedFunctionName = z.string().refine((fn)=>typeof translator[fn] === 'function' && !fn.startsWith('handlerAs') && fn !== 'constructor').parse(functionName);
|
|
@@ -338,7 +349,7 @@ function emptyLastCallState() {
|
|
|
338
349
|
}
|
|
339
350
|
// Commit all staged stores from the job that was just completed, then begin a new job
|
|
340
351
|
await this.cycleJob();
|
|
341
|
-
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.
|
|
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);
|
|
342
353
|
this.state = {
|
|
343
354
|
name: 'TOP_LEVEL'
|
|
344
355
|
};
|
|
@@ -367,10 +378,11 @@ function emptyLastCallState() {
|
|
|
367
378
|
const taggingIndexCache = new ExecutionTaggingIndexCache();
|
|
368
379
|
const utilityExecutor = this.utilityExecutorForContractSync(anchorBlock);
|
|
369
380
|
const transientArrayService = new TransientArrayService();
|
|
370
|
-
const
|
|
381
|
+
const anchoredContractData = new AnchoredContractData(this.contractStore, this.stateMachine.contractClassService, anchorBlock);
|
|
371
382
|
this.oracleHandler = new TXEPrivateExecutionOracle({
|
|
372
383
|
argsHash: Fr.ZERO,
|
|
373
384
|
txContext: new TxContext(this.chainId, this.version, gasSettings),
|
|
385
|
+
txRequestSalt: Fr.ZERO,
|
|
374
386
|
callContext: new CallContext(AztecAddress.ZERO, contractAddress, FunctionSelector.empty(), false),
|
|
375
387
|
anchorBlockHeader: anchorBlock,
|
|
376
388
|
utilityExecutor,
|
|
@@ -379,7 +391,7 @@ function emptyLastCallState() {
|
|
|
379
391
|
executionCache: new HashedValuesCache(),
|
|
380
392
|
noteCache,
|
|
381
393
|
taggingIndexCache,
|
|
382
|
-
|
|
394
|
+
anchoredContractData,
|
|
383
395
|
noteStore: this.noteStore,
|
|
384
396
|
keyStore: this.keyStore,
|
|
385
397
|
addressStore: this.addressStore,
|
|
@@ -397,7 +409,8 @@ function emptyLastCallState() {
|
|
|
397
409
|
txResolver: this.stateMachine.txResolver,
|
|
398
410
|
simulator: new WASMSimulator(),
|
|
399
411
|
hooks: composeHooks({
|
|
400
|
-
resolveTaggingSecretStrategy:
|
|
412
|
+
resolveTaggingSecretStrategy: makeResolveTaggingSecretStrategyHook(this.taggingSecretStrategies),
|
|
413
|
+
authorizeUtilityCall: this.authorizeAllUtilityCallTargets ? authorizeAllUtilityCallsHook : undefined
|
|
401
414
|
}),
|
|
402
415
|
transientArrayService
|
|
403
416
|
});
|
|
@@ -461,7 +474,7 @@ function emptyLastCallState() {
|
|
|
461
474
|
authWitnesses: [],
|
|
462
475
|
capsules: [],
|
|
463
476
|
anchorBlockHeader,
|
|
464
|
-
|
|
477
|
+
anchoredContractData: new AnchoredContractData(this.contractStore, this.stateMachine.contractClassService, anchorBlockHeader),
|
|
465
478
|
noteStore: this.noteStore,
|
|
466
479
|
keyStore: this.keyStore,
|
|
467
480
|
addressStore: this.addressStore,
|
|
@@ -478,6 +491,9 @@ function emptyLastCallState() {
|
|
|
478
491
|
scopes: await this.keyStore.getAccounts(),
|
|
479
492
|
simulator: new WASMSimulator(),
|
|
480
493
|
utilityExecutor: this.utilityExecutorForContractSync(anchorBlockHeader),
|
|
494
|
+
hooks: composeHooks({
|
|
495
|
+
authorizeUtilityCall: this.authorizeAllUtilityCallTargets ? authorizeAllUtilityCallsHook : undefined
|
|
496
|
+
}),
|
|
481
497
|
// Execution-tree root (top-level utility run): own store; nested frames inherit it.
|
|
482
498
|
transientArrayService: new TransientArrayService()
|
|
483
499
|
});
|
|
@@ -498,12 +514,12 @@ function emptyLastCallState() {
|
|
|
498
514
|
// accounts to PXE (via `addAccount`), etc. This is a slight inconsistency in the working model of this class, but
|
|
499
515
|
// is not too bad. The `close` call below therefore only hands back the session-scoped values that a test
|
|
500
516
|
// sets directly at the top level, outside any contract execution (e.g. via `advanceTimestampBy`,
|
|
501
|
-
// `addAuthWitness`, `
|
|
517
|
+
// `addAuthWitness`, `setTaggingSecretStrategies`). The oracle handler is discarded on every state transition,
|
|
502
518
|
// so the session must seed these values into the contexts it creates later.
|
|
503
519
|
// TODO: persisting authwits this way is quite unfortunate: they create a temporary utility context that would
|
|
504
520
|
// otherwise reset them, so we'd not be able to pass more than one per execution. Ideally authwits would be passed
|
|
505
521
|
// alongside a contract call instead of pre-seeded.
|
|
506
|
-
|
|
522
|
+
({ nextBlockTimestamp: this.nextBlockTimestamp, authwits: this.authwits, taggingSecretStrategies: this.taggingSecretStrategies, authorizeAllUtilityCallTargets: this.authorizeAllUtilityCallTargets } = this.oracleHandler.close());
|
|
507
523
|
}
|
|
508
524
|
async exitPrivateState() {
|
|
509
525
|
if (this.state.name != 'PRIVATE') {
|
|
@@ -542,7 +558,11 @@ function emptyLastCallState() {
|
|
|
542
558
|
}
|
|
543
559
|
utilityExecutorForContractSync(anchorBlock) {
|
|
544
560
|
return async (call, scopes)=>{
|
|
545
|
-
const
|
|
561
|
+
const anchoredContractData = new AnchoredContractData(this.contractStore, this.stateMachine.contractClassService, anchorBlock);
|
|
562
|
+
const entryPointArtifact = await anchoredContractData.getFunctionArtifactWithDebugMetadata(call.to, call.selector);
|
|
563
|
+
if (!entryPointArtifact) {
|
|
564
|
+
throw new Error(`Cannot run function ${call.selector} on ${call.to}: the contract is not registered.`);
|
|
565
|
+
}
|
|
546
566
|
if (entryPointArtifact.functionType !== FunctionType.UTILITY) {
|
|
547
567
|
throw new Error(`Cannot run ${entryPointArtifact.functionType} function as utility`);
|
|
548
568
|
}
|
|
@@ -558,7 +578,7 @@ function emptyLastCallState() {
|
|
|
558
578
|
authWitnesses: [],
|
|
559
579
|
capsules: [],
|
|
560
580
|
anchorBlockHeader: anchorBlock,
|
|
561
|
-
|
|
581
|
+
anchoredContractData,
|
|
562
582
|
noteStore: this.noteStore,
|
|
563
583
|
keyStore: this.keyStore,
|
|
564
584
|
addressStore: this.addressStore,
|
package/dest/utils/encoding.d.ts
CHANGED
|
@@ -159,11 +159,10 @@ export declare const ForeignCallArgsSchema: z.ZodArray<z.ZodUnion<readonly [z.Zo
|
|
|
159
159
|
name: z.ZodString;
|
|
160
160
|
}, z.core.$strip>>;
|
|
161
161
|
}, z.core.$strip>>;
|
|
162
|
-
}, z.core.$strip>, z.ZodIntersection<z.ZodObject<{
|
|
162
|
+
}, z.core.$strip>, z.ZodIntersection<z.ZodIntersection<z.ZodObject<{
|
|
163
163
|
version: z.ZodLiteral<2>;
|
|
164
164
|
salt: import("@aztec/foundation/schemas").ZodFor<Fr>;
|
|
165
165
|
deployer: import("@aztec/foundation/schemas").ZodFor<AztecAddress>;
|
|
166
|
-
currentContractClassId: import("@aztec/foundation/schemas").ZodFor<Fr>;
|
|
167
166
|
originalContractClassId: import("@aztec/foundation/schemas").ZodFor<Fr>;
|
|
168
167
|
initializationHash: import("@aztec/foundation/schemas").ZodFor<Fr>;
|
|
169
168
|
immutablesHash: import("@aztec/foundation/schemas").ZodFor<Fr>;
|
|
@@ -183,9 +182,11 @@ export declare const ForeignCallArgsSchema: z.ZodArray<z.ZodUnion<readonly [z.Zo
|
|
|
183
182
|
fbpkMHash: Fr;
|
|
184
183
|
}>>;
|
|
185
184
|
}, z.core.$strip>, z.ZodObject<{
|
|
185
|
+
currentContractClassId: import("@aztec/foundation/schemas").ZodFor<Fr>;
|
|
186
|
+
}, z.core.$strip>>, z.ZodObject<{
|
|
186
187
|
address: import("@aztec/foundation/schemas").ZodFor<AztecAddress>;
|
|
187
188
|
}, z.core.$strip>>]>>;
|
|
188
189
|
export declare const ForeignCallResultSchema: z.ZodObject<{
|
|
189
190
|
values: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
190
191
|
}, z.core.$strip>;
|
|
191
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
192
|
+
//# sourceMapping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,CAAC;AAE1D,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBAEjC,CAAC;AAEF,eAAO,MAAM,uBAAuB;;iBAElC,CAAC"}
|
|
@@ -2,4 +2,4 @@ import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
|
2
2
|
import type { ExecutionNoteCache } from '@aztec/pxe/simulator';
|
|
3
3
|
import { TxEffect } from '@aztec/stdlib/tx';
|
|
4
4
|
export declare function makeTxEffect(noteCache: ExecutionNoteCache, txBlockNumber: BlockNumber): Promise<TxEffect>;
|
|
5
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
5
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHhfZWZmZWN0X2NyZWF0aW9uLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvdXRpbHMvdHhfZWZmZWN0X2NyZWF0aW9uLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxXQUFXLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQztBQUU5RCxPQUFPLEtBQUssRUFBRSxrQkFBa0IsRUFBRSxNQUFNLHNCQUFzQixDQUFDO0FBRS9ELE9BQU8sRUFBRSxRQUFRLEVBQVUsTUFBTSxrQkFBa0IsQ0FBQztBQUVwRCx3QkFBc0IsWUFBWSxDQUFDLFNBQVMsRUFBRSxrQkFBa0IsRUFBRSxhQUFhLEVBQUUsV0FBVyxHQUFHLE9BQU8sQ0FBQyxRQUFRLENBQUMsQ0FxQi9HIn0=
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tx_effect_creation.d.ts","sourceRoot":"","sources":["../../src/utils/tx_effect_creation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAE9D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE/D,OAAO,EAAE,QAAQ,EAAU,MAAM,kBAAkB,CAAC;AAEpD,wBAAsB,YAAY,CAAC,SAAS,EAAE,kBAAkB,EAAE,aAAa,EAAE,WAAW,GAAG,OAAO,CAAC,QAAQ,CAAC,
|
|
1
|
+
{"version":3,"file":"tx_effect_creation.d.ts","sourceRoot":"","sources":["../../src/utils/tx_effect_creation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAE9D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE/D,OAAO,EAAE,QAAQ,EAAU,MAAM,kBAAkB,CAAC;AAEpD,wBAAsB,YAAY,CAAC,SAAS,EAAE,kBAAkB,EAAE,aAAa,EAAE,WAAW,GAAG,OAAO,CAAC,QAAQ,CAAC,CAqB/G"}
|
|
@@ -3,7 +3,6 @@ import { computeNoteHashNonce, computeUniqueNoteHash, siloNoteHash } from '@azte
|
|
|
3
3
|
import { TxEffect, TxHash } from '@aztec/stdlib/tx';
|
|
4
4
|
export async function makeTxEffect(noteCache, txBlockNumber) {
|
|
5
5
|
const txEffect = TxEffect.empty();
|
|
6
|
-
noteCache.finish();
|
|
7
6
|
const nonceGenerator = noteCache.getNonceGenerator();
|
|
8
7
|
txEffect.noteHashes = await Promise.all(noteCache.getAllNotes().map(async (pendingNote, i)=>computeUniqueNoteHash(await computeNoteHashNonce(nonceGenerator, i), await siloNoteHash(pendingNote.note.contractAddress, pendingNote.noteHashForConsumption))));
|
|
9
8
|
// Nullifiers are already siloed
|
|
@@ -17,4 +17,4 @@ export declare class TXEPublicContractDataSource implements ContractDataSource {
|
|
|
17
17
|
getDebugFunctionName(address: AztecAddress, selector: FunctionSelector): Promise<string | undefined>;
|
|
18
18
|
registerContractFunctionSignatures(_signatures: []): Promise<void>;
|
|
19
19
|
}
|
|
20
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
20
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHhlX3B1YmxpY19jb250cmFjdF9kYXRhX3NvdXJjZS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3V0aWxzL3R4ZV9wdWJsaWNfY29udHJhY3RfZGF0YV9zb3VyY2UudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFdBQVcsRUFBRSxNQUFNLGlDQUFpQyxDQUFDO0FBQzlELE9BQU8sRUFBRSxFQUFFLEVBQUUsTUFBTSxnQ0FBZ0MsQ0FBQztBQUNwRCxPQUFPLEtBQUssRUFBRSxhQUFhLEVBQUUsTUFBTSxtQkFBbUIsQ0FBQztBQUN2RCxPQUFPLEVBQUUsS0FBSyxnQkFBZ0IsRUFBRSxnQkFBZ0IsRUFBRSxNQUFNLG1CQUFtQixDQUFDO0FBQzVFLE9BQU8sS0FBSyxFQUFFLFlBQVksRUFBRSxNQUFNLDZCQUE2QixDQUFDO0FBQ2hFLE9BQU8sS0FBSyxFQUFFLG1CQUFtQixFQUFFLGtCQUFrQixFQUFFLDJCQUEyQixFQUFFLE1BQU0sd0JBQXdCLENBQUM7QUFFbkgscUJBQWEsMkJBQTRCLFlBQVcsa0JBQWtCO0lBRWxFLE9BQU8sQ0FBQyxXQUFXO0lBQ25CLE9BQU8sQ0FBQyxhQUFhO0lBRnZCLFlBQ1UsV0FBVyxFQUFFLFdBQVcsRUFDeEIsYUFBYSxFQUFFLGFBQWEsRUFDbEM7SUFFSixjQUFjLElBQUksT0FBTyxDQUFDLFdBQVcsQ0FBQyxDQUVyQztJQUVLLGdCQUFnQixDQUFDLEVBQUUsRUFBRSxFQUFFLEdBQUcsT0FBTyxDQUFDLG1CQUFtQixHQUFHLFNBQVMsQ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,OAAO,CAAC,EAAE,GAAG,SAAS,CAAC,CAG3D;IAEK,WAAW,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,2BAA2B,GAAG,SAAS,CAAC,CAIzF;IAED,mBAAmB,IAAI,OAAO,CAAC,EAAE,EAAE,CAAC,CAEnC;IAEK,mBAAmB,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,gBAAgB,GAAG,SAAS,CAAC,CAGtF;IAEK,oBAAoB,CAAC,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,gBAAgB,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAGzG;IAED,kCAAkC,CAAC,WAAW,EAAE,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAEjE;CACF"}
|
|
@@ -27,20 +27,23 @@ export class TXEPublicContractDataSource {
|
|
|
27
27
|
}
|
|
28
28
|
async getContract(address) {
|
|
29
29
|
const instance = await this.contractStore.getContractInstance(address);
|
|
30
|
+
// TXE has no contract updates, so the current class always equals the original.
|
|
30
31
|
return instance && {
|
|
31
32
|
...instance,
|
|
32
|
-
address
|
|
33
|
+
address,
|
|
34
|
+
currentContractClassId: instance.originalContractClassId
|
|
33
35
|
};
|
|
34
36
|
}
|
|
35
37
|
getContractClassIds() {
|
|
36
38
|
throw new Error('Method not implemented.');
|
|
37
39
|
}
|
|
38
40
|
async getContractArtifact(address) {
|
|
39
|
-
const instance = await this.
|
|
40
|
-
return instance && this.contractStore.getContractArtifact(instance.
|
|
41
|
+
const instance = await this.getContract(address);
|
|
42
|
+
return instance && this.contractStore.getContractArtifact(instance.originalContractClassId);
|
|
41
43
|
}
|
|
42
44
|
async getDebugFunctionName(address, selector) {
|
|
43
|
-
|
|
45
|
+
const instance = await this.getContract(address);
|
|
46
|
+
return instance && this.contractStore.getDebugFunctionName(instance.originalContractClassId, selector);
|
|
44
47
|
}
|
|
45
48
|
registerContractFunctionSignatures(_signatures) {
|
|
46
49
|
return Promise.resolve();
|
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
|
},
|
|
@@ -6,7 +6,7 @@ import { createOracleTestRpcServer } from '../oracle/test-resolver/index.js';
|
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Starts an HTTP RPC server that resolves oracle foreign calls using auto-synthesized fixture scenarios. Used by
|
|
9
|
-
* `nargo test --oracle-resolver` to run `#[
|
|
9
|
+
* `nargo test --oracle-resolver` to run `#[generate_oracle_tests]` serialization tests against a dedicated resolver.
|
|
10
10
|
* Logs fixture coverage on shutdown.
|
|
11
11
|
*/
|
|
12
12
|
async function main() {
|
package/src/index.ts
CHANGED
|
@@ -21,9 +21,11 @@ import {
|
|
|
21
21
|
} from './utils/encoding.js';
|
|
22
22
|
import { TXEArtifactResolver } from './utils/txe_artifact_resolver.js';
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
export const TXE_REQUIRED_PROTOCOL_CONTRACTS: ProtocolContractName[] = [
|
|
25
|
+
'ContractClassRegistry',
|
|
26
|
+
'ContractInstanceRegistry',
|
|
27
|
+
'FeeJuice',
|
|
28
|
+
];
|
|
27
29
|
|
|
28
30
|
const sessions = new Map<number, TXESession>();
|
|
29
31
|
|
package/src/oracle/interfaces.ts
CHANGED
|
@@ -39,11 +39,11 @@ export interface IAvmExecutionOracle {
|
|
|
39
39
|
nullifierExists(siloedNullifier: Fr): Promise<boolean>;
|
|
40
40
|
storageWrite(slot: Fr, value: Fr): Promise<void>;
|
|
41
41
|
storageRead(slot: Fr, contractAddress: AztecAddress): Promise<Fr>;
|
|
42
|
-
getContractInstanceDeployer(address: AztecAddress): Promise<{ member: Fr; exists: boolean }>;
|
|
43
|
-
getContractInstanceClassId(address: AztecAddress): Promise<{ member: Fr; exists: boolean }>;
|
|
44
|
-
getContractInstanceInitializationHash(address: AztecAddress): Promise<{ member: Fr; exists: boolean }>;
|
|
45
|
-
getContractInstanceImmutablesHash(address: AztecAddress): Promise<{ member: Fr; exists: boolean }>;
|
|
46
|
-
returndataSize(): Promise<
|
|
42
|
+
getContractInstanceDeployer(address: AztecAddress): Promise<{ member: Fr; exists: boolean }[]>;
|
|
43
|
+
getContractInstanceClassId(address: AztecAddress): Promise<{ member: Fr; exists: boolean }[]>;
|
|
44
|
+
getContractInstanceInitializationHash(address: AztecAddress): Promise<{ member: Fr; exists: boolean }[]>;
|
|
45
|
+
getContractInstanceImmutablesHash(address: AztecAddress): Promise<{ member: Fr; exists: boolean }[]>;
|
|
46
|
+
returndataSize(): Promise<number>;
|
|
47
47
|
returndataCopy(rdOffset: number, copySize: number): Promise<Fr[]>;
|
|
48
48
|
call(l2Gas: number, daGas: number, address: AztecAddress, argsLength: number, args: Fr[]): Promise<void>;
|
|
49
49
|
staticCall(l2Gas: number, daGas: number, address: AztecAddress, argsLength: number, args: Fr[]): Promise<void>;
|
|
@@ -73,7 +73,18 @@ export interface ITxeExecutionOracle {
|
|
|
73
73
|
addAccount(secret: Fr): Promise<CompleteAddress>;
|
|
74
74
|
addAuthWitness(address: AztecAddress, messageHash: Fr): Promise<void>;
|
|
75
75
|
sendL1ToL2Message(content: Fr, secretHash: Fr, sender: EthAddress, recipient: AztecAddress): Promise<Fr>;
|
|
76
|
-
|
|
76
|
+
/**
|
|
77
|
+
* Configures the tagging secret strategy the test's simulated wallet resolves for each delivery mode. A `none`
|
|
78
|
+
* clears that mode, so it falls back to the default strategy (or, when both modes end up unset, to no hook at all).
|
|
79
|
+
*/
|
|
80
|
+
setTaggingSecretStrategies(
|
|
81
|
+
unconstrainedStrategy: Option<TaggingSecretStrategy>,
|
|
82
|
+
constrainedStrategy: Option<TaggingSecretStrategy>,
|
|
83
|
+
): void;
|
|
84
|
+
/**
|
|
85
|
+
* Configures whether the test's simulated wallet authorizes every cross-contract utility call target.
|
|
86
|
+
*/
|
|
87
|
+
setAuthorizeAllUtilityCallTargets(authorizeAll: boolean): void;
|
|
77
88
|
getLastBlockTimestamp(): Promise<bigint>;
|
|
78
89
|
getLastTxEffects(): Promise<{
|
|
79
90
|
txHash: TxHash;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DEFAULT_TAGGING_SECRET_STRATEGY,
|
|
3
|
+
type ResolveTaggingSecretStrategy,
|
|
4
|
+
type TaggingSecretStrategy,
|
|
5
|
+
} from '@aztec/pxe/server';
|
|
6
|
+
import type { AppTaggingSecretKind } from '@aztec/stdlib/logs';
|
|
7
|
+
|
|
8
|
+
/** The tagging secret strategies a TXE test has configured, keyed by delivery mode. Absence means "not configured". */
|
|
9
|
+
export type TXETaggingSecretStrategies = Map<AppTaggingSecretKind, TaggingSecretStrategy>;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Builds the `resolveTaggingSecretStrategy` hook backing the `aztec_txe_setTaggingSecretStrategies` oracle. Returns
|
|
13
|
+
* `undefined` when no strategy is configured, so PXE's own no-hook default path is exercised. When at least one mode
|
|
14
|
+
* is configured, modes without an entry resolve to {@link DEFAULT_TAGGING_SECRET_STRATEGY}, matching what PXE would
|
|
15
|
+
* apply without a hook.
|
|
16
|
+
*/
|
|
17
|
+
export function makeResolveTaggingSecretStrategyHook(
|
|
18
|
+
strategies: TXETaggingSecretStrategies,
|
|
19
|
+
): ResolveTaggingSecretStrategy | undefined {
|
|
20
|
+
if (strategies.size === 0) {
|
|
21
|
+
return undefined;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return ({ deliveryMode }) => Promise.resolve(strategies.get(deliveryMode) ?? DEFAULT_TAGGING_SECRET_STRATEGY);
|
|
25
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
2
|
-
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
2
|
+
import { BlockNumber, SlotNumber } from '@aztec/foundation/branded-types';
|
|
3
3
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
4
4
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
5
5
|
import {
|
|
@@ -10,24 +10,29 @@ import {
|
|
|
10
10
|
BOOL,
|
|
11
11
|
BYTE,
|
|
12
12
|
BoundedVec,
|
|
13
|
+
DELIVERY_MODE,
|
|
13
14
|
ETH_ADDRESS,
|
|
14
15
|
FIELD,
|
|
15
16
|
FUNCTION_SELECTOR,
|
|
16
17
|
NOTE_SELECTOR,
|
|
17
18
|
Option,
|
|
18
19
|
type OracleRegistryEntry,
|
|
20
|
+
SLOT_NUMBER,
|
|
21
|
+
type StructField,
|
|
19
22
|
type TypeMapping,
|
|
20
23
|
U32,
|
|
24
|
+
tryFieldWidth,
|
|
21
25
|
} from '@aztec/pxe/simulator';
|
|
22
26
|
import { FunctionSelector, NoteSelector } from '@aztec/stdlib/abi';
|
|
23
27
|
import { BlockHash } from '@aztec/stdlib/block';
|
|
28
|
+
import { AppTaggingSecretKind } from '@aztec/stdlib/logs';
|
|
24
29
|
|
|
25
30
|
import type { OracleTestScenario } from './resolver.js';
|
|
26
31
|
|
|
27
32
|
/**
|
|
28
33
|
* Synthesizes fixture scenarios for every oracle in the registry whose parameters and return are built from scalars,
|
|
29
|
-
* arrays/bounded vecs of them,
|
|
30
|
-
* `#[
|
|
34
|
+
* arrays/bounded vecs of them, `Option`s of them, or `STRUCT`s over them. The matching Noir serialization tests are
|
|
35
|
+
* auto-generated by `#[generate_oracle_tests]` from the same seed/scenario convention.
|
|
31
36
|
*/
|
|
32
37
|
export function synthesizeDefaultFixtures(
|
|
33
38
|
registry: Record<string, OracleRegistryEntry>,
|
|
@@ -45,8 +50,8 @@ export function synthesizeDefaultFixtures(
|
|
|
45
50
|
}
|
|
46
51
|
|
|
47
52
|
/**
|
|
48
|
-
* The test-value implementations, one per oracle type, mirroring the Noir `
|
|
49
|
-
*
|
|
53
|
+
* The test-value implementations, one per oracle type, mirroring the Noir synthesizer tables (`scalars` and
|
|
54
|
+
* `synthesizers` in `noir-projects/aztec-nr/.../macros/oracle_testing.nr`) exactly.
|
|
50
55
|
*/
|
|
51
56
|
const TEST_VALUE_IMPLS: TestValueImpl[] = [
|
|
52
57
|
scalar(FIELD, seed => new Fr(seed)),
|
|
@@ -60,6 +65,11 @@ const TEST_VALUE_IMPLS: TestValueImpl[] = [
|
|
|
60
65
|
scalar(FUNCTION_SELECTOR, seed => FunctionSelector.fromField(new Fr(seed))),
|
|
61
66
|
scalar(NOTE_SELECTOR, seed => NoteSelector.fromField(new Fr(seed))),
|
|
62
67
|
scalar(BLOCK_HASH, seed => new BlockHash(new Fr(seed))),
|
|
68
|
+
scalar(SLOT_NUMBER, seed => SlotNumber(seed)),
|
|
69
|
+
// Only two delivery modes are valid for tagging, so the seed alternates between them, matching the Noir impl.
|
|
70
|
+
scalar(DELIVERY_MODE, seed =>
|
|
71
|
+
seed % 2 === 0 ? AppTaggingSecretKind.UNCONSTRAINED : AppTaggingSecretKind.CONSTRAINED,
|
|
72
|
+
),
|
|
63
73
|
composite(isOption, (type, seed) => [
|
|
64
74
|
named(Option.some(firstValue(type.inner, seed)), 'some'),
|
|
65
75
|
named(Option.none(firstValue(type.inner, seed)), 'none'),
|
|
@@ -73,6 +83,15 @@ const TEST_VALUE_IMPLS: TestValueImpl[] = [
|
|
|
73
83
|
}),
|
|
74
84
|
),
|
|
75
85
|
]),
|
|
86
|
+
composite(isStruct, (type, seed) => [unnamed(structValue(type, seed))]),
|
|
87
|
+
// A fixed-length array uses its real (signature) length, unlike the generic-length ARRAY which is pinned to
|
|
88
|
+
// DEFAULT_ARRAY_LENGTH.
|
|
89
|
+
composite(isFixedArray, (type, seed) => [unnamed(collectionData(type.inner, seed, type.length))]),
|
|
90
|
+
// Same for a fixed-capacity bounded vec: real capacity, DEFAULT_ARRAY_LENGTH elements (its value type is a plain
|
|
91
|
+
// element array, unlike the two-slot BOUNDED_VEC), clamped to the capacity so small vecs stay valid.
|
|
92
|
+
composite(isFixedBoundedVec, (type, seed) => [
|
|
93
|
+
unnamed(collectionData(type.inner, seed, Math.min(DEFAULT_ARRAY_LENGTH, type.maxLength))),
|
|
94
|
+
]),
|
|
76
95
|
];
|
|
77
96
|
|
|
78
97
|
/**
|
|
@@ -107,9 +126,9 @@ function named(value: unknown, name: string): Scenario {
|
|
|
107
126
|
}
|
|
108
127
|
|
|
109
128
|
/**
|
|
110
|
-
* One type's test-value implementation, mirroring a Noir `
|
|
111
|
-
* `scenarios` yields its [`Scenario`]s for `seed`, one per serialization shape, like Noir's
|
|
112
|
-
*
|
|
129
|
+
* One type's test-value implementation, mirroring a Noir `TestValueSynthesizer` entry: `match` selects the type and
|
|
130
|
+
* `scenarios` yields its [`Scenario`]s for `seed`, one per serialization shape, like the Noir entry's `scenarios`
|
|
131
|
+
* function.
|
|
113
132
|
*/
|
|
114
133
|
interface TestValueImpl {
|
|
115
134
|
match: (type: TypeMapping<any>) => boolean;
|
|
@@ -135,8 +154,27 @@ function collectionData(element: TypeMapping<any>, seed: number, length: number)
|
|
|
135
154
|
}
|
|
136
155
|
|
|
137
156
|
/**
|
|
138
|
-
* The
|
|
139
|
-
*
|
|
157
|
+
* The synthesized prop bag for a struct: each field's first scenario, seeded at the field's flat wire offset so the
|
|
158
|
+
* values depend on the wire layout rather than on how each side groups its fields. Mirrors the Noir reflected impls.
|
|
159
|
+
*/
|
|
160
|
+
function structValue(type: StructMapping, seed: number): Record<string, unknown> {
|
|
161
|
+
const value: Record<string, unknown> = {};
|
|
162
|
+
let offset = 0;
|
|
163
|
+
for (const field of type.fields) {
|
|
164
|
+
value[field.name] = firstValue(field.type, seed + offset);
|
|
165
|
+
const width = tryFieldWidth(field.type.shape);
|
|
166
|
+
if (width === undefined) {
|
|
167
|
+
// A variable-width field has no flat offset to seed the next field at, so only this oracle is unsynthesizable.
|
|
168
|
+
throw new UnsynthesizableTypeError(field.type, `struct field '${field.name}' has a variable-width shape`);
|
|
169
|
+
}
|
|
170
|
+
offset += width;
|
|
171
|
+
}
|
|
172
|
+
return value;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* The [`Scenario`]s for `type` at `seed`, one per serialization *shape*, mirroring the Noir `scenarios_for`
|
|
177
|
+
* dispatcher. Throws if the type has no matching impl.
|
|
140
178
|
*/
|
|
141
179
|
function scenariosForType(type: TypeMapping<any>, seed: number): Scenario[] {
|
|
142
180
|
const impl = TEST_VALUE_IMPLS.find(i => i.match(type));
|
|
@@ -152,8 +190,8 @@ function firstValue(type: TypeMapping<any>, seed: number): unknown {
|
|
|
152
190
|
}
|
|
153
191
|
|
|
154
192
|
class UnsynthesizableTypeError extends Error {
|
|
155
|
-
constructor(type: TypeMapping<any
|
|
156
|
-
super(`No test-value impl for type: ${JSON.stringify(Object.keys(type))}`);
|
|
193
|
+
constructor(type: TypeMapping<any>, detail?: string) {
|
|
194
|
+
super(detail ?? `No test-value impl for type: ${JSON.stringify(Object.keys(type))}`);
|
|
157
195
|
this.name = 'UnsynthesizableTypeError';
|
|
158
196
|
}
|
|
159
197
|
}
|
|
@@ -161,7 +199,7 @@ class UnsynthesizableTypeError extends Error {
|
|
|
161
199
|
/**
|
|
162
200
|
* Synthesizes the scenarios for one oracle by zipping every position's [`Scenario`] list to one case per test (a
|
|
163
201
|
* shorter list wraps around via mod), mirroring the Noir macro. Returns `undefined` if any param or return type is
|
|
164
|
-
* unsynthesizable (
|
|
202
|
+
* unsynthesizable (ephemeral arrays, structs with a variable-width field).
|
|
165
203
|
*/
|
|
166
204
|
function synthesizeScenarios(entry: OracleRegistryEntry): OracleTestScenario[] | undefined {
|
|
167
205
|
try {
|
|
@@ -206,14 +244,23 @@ function synthesizeScenariosOrThrow(entry: OracleRegistryEntry): OracleTestScena
|
|
|
206
244
|
}
|
|
207
245
|
|
|
208
246
|
/**
|
|
209
|
-
* The composite `TypeMapping`s (`ARRAY`/`BOUNDED_VEC`/`OPTION`),
|
|
210
|
-
* plus the inner mapping at construction; the registry
|
|
211
|
-
* recover the structure for recursion.
|
|
247
|
+
* The composite `TypeMapping`s (`ARRAY`/`BOUNDED_VEC`/`OPTION`/`STRUCT`/`FIXED_ARRAY`/`FIXED_BOUNDED_VEC`),
|
|
248
|
+
* discriminated by `kind`. The combinators attach `kind` plus the inner mapping(s) at construction; the registry
|
|
249
|
+
* erases params to the base `TypeMapping`, so the guards below recover the structure for recursion.
|
|
212
250
|
*/
|
|
213
251
|
type ArrayMapping = TypeMapping & { kind: 'array'; inner: TypeMapping };
|
|
214
252
|
type BoundedVecMapping = TypeMapping & { kind: 'bounded-vec'; inner: TypeMapping };
|
|
215
253
|
type OptionMapping = TypeMapping & { kind: 'option'; inner: TypeMapping };
|
|
216
|
-
type
|
|
254
|
+
type StructMapping = TypeMapping & { kind: 'struct'; fields: readonly StructField[] };
|
|
255
|
+
type FixedArrayMapping = TypeMapping & { kind: 'fixed-array'; inner: TypeMapping; length: number };
|
|
256
|
+
type FixedBoundedVecMapping = TypeMapping & { kind: 'fixed-bounded-vec'; inner: TypeMapping; maxLength: number };
|
|
257
|
+
type CompositeMapping =
|
|
258
|
+
| ArrayMapping
|
|
259
|
+
| BoundedVecMapping
|
|
260
|
+
| OptionMapping
|
|
261
|
+
| StructMapping
|
|
262
|
+
| FixedArrayMapping
|
|
263
|
+
| FixedBoundedVecMapping;
|
|
217
264
|
|
|
218
265
|
function isArray(type: TypeMapping<any>): type is ArrayMapping {
|
|
219
266
|
return 'kind' in type && type.kind === 'array';
|
|
@@ -224,3 +271,12 @@ function isBoundedVec(type: TypeMapping<any>): type is BoundedVecMapping {
|
|
|
224
271
|
function isOption(type: TypeMapping<any>): type is OptionMapping {
|
|
225
272
|
return 'kind' in type && type.kind === 'option';
|
|
226
273
|
}
|
|
274
|
+
function isStruct(type: TypeMapping<any>): type is StructMapping {
|
|
275
|
+
return 'kind' in type && type.kind === 'struct';
|
|
276
|
+
}
|
|
277
|
+
function isFixedArray(type: TypeMapping<any>): type is FixedArrayMapping {
|
|
278
|
+
return 'kind' in type && type.kind === 'fixed-array';
|
|
279
|
+
}
|
|
280
|
+
function isFixedBoundedVec(type: TypeMapping<any>): type is FixedBoundedVecMapping {
|
|
281
|
+
return 'kind' in type && type.kind === 'fixed-bounded-vec';
|
|
282
|
+
}
|