@aztec/stdlib 3.0.0-nightly.20251014 → 3.0.0-nightly.20251015
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/abi/abi.d.ts +8 -8
- package/dest/abi/abi.js +1 -1
- package/dest/abi/function_call.d.ts +7 -2
- package/dest/abi/function_call.d.ts.map +1 -1
- package/dest/abi/function_call.js +6 -2
- package/dest/avm/avm.d.ts +54 -54
- package/dest/avm/avm_proving_request.d.ts +30 -30
- package/dest/contract/interfaces/contract_instance.d.ts +2 -2
- package/dest/interfaces/proving-job.d.ts +30 -30
- package/dest/kernel/private_circuit_public_inputs.d.ts +1 -1
- package/dest/kernel/private_to_public_accumulated_data.d.ts +1 -1
- package/dest/kernel/private_to_rollup_accumulated_data.d.ts +1 -1
- package/dest/keys/derivation.d.ts +0 -2
- package/dest/keys/derivation.d.ts.map +1 -1
- package/dest/keys/derivation.js +1 -21
- package/dest/logs/directional_app_tagging_secret.d.ts +40 -0
- package/dest/logs/directional_app_tagging_secret.d.ts.map +1 -0
- package/dest/logs/directional_app_tagging_secret.js +64 -0
- package/dest/logs/index.d.ts +1 -0
- package/dest/logs/index.d.ts.map +1 -1
- package/dest/logs/index.js +1 -0
- package/dest/logs/indexed_tagging_secret.d.ts +32 -26
- package/dest/logs/indexed_tagging_secret.d.ts.map +1 -1
- package/dest/logs/indexed_tagging_secret.js +7 -50
- package/dest/rollup/checkpoint_rollup_public_inputs.d.ts +1 -0
- package/dest/rollup/checkpoint_rollup_public_inputs.d.ts.map +1 -1
- package/dest/rollup/checkpoint_rollup_public_inputs.js +3 -0
- package/dest/tests/factories.d.ts +2 -1
- package/dest/tests/factories.d.ts.map +1 -1
- package/dest/tests/factories.js +15 -9
- package/dest/tests/mocks.d.ts +3 -1
- package/dest/tests/mocks.d.ts.map +1 -1
- package/dest/tests/mocks.js +4 -2
- package/dest/tx/private_execution_result.d.ts +5 -0
- package/dest/tx/private_execution_result.d.ts.map +1 -1
- package/dest/tx/private_execution_result.js +7 -3
- package/dest/tx/simulated_tx.d.ts +3 -3
- package/package.json +8 -8
- package/src/abi/abi.ts +1 -1
- package/src/abi/function_call.ts +5 -1
- package/src/keys/derivation.ts +1 -26
- package/src/logs/directional_app_tagging_secret.ts +78 -0
- package/src/logs/index.ts +1 -0
- package/src/logs/indexed_tagging_secret.ts +21 -44
- package/src/rollup/checkpoint_rollup_public_inputs.ts +4 -0
- package/src/tests/factories.ts +11 -4
- package/src/tests/mocks.ts +5 -0
- package/src/tx/private_execution_result.ts +6 -0
package/dest/tests/factories.js
CHANGED
|
@@ -16,6 +16,7 @@ import { PublicDataWrite } from '../avm/public_data_write.js';
|
|
|
16
16
|
import { AztecAddress } from '../aztec-address/index.js';
|
|
17
17
|
import { L2BlockHeader } from '../block/index.js';
|
|
18
18
|
import { SerializableContractInstance, computeContractClassId, computePublicBytecodeCommitment } from '../contract/index.js';
|
|
19
|
+
import { computeEffectiveGasFees } from '../fees/transaction_fee.js';
|
|
19
20
|
import { Gas, GasFees, GasSettings } from '../gas/index.js';
|
|
20
21
|
import { computeCalldataHash } from '../hash/hash.js';
|
|
21
22
|
import { KeyValidationRequest } from '../kernel/hints/key_validation_request.js';
|
|
@@ -902,7 +903,11 @@ export async function makeAvmTxHint(seed = 0) {
|
|
|
902
903
|
}
|
|
903
904
|
/** Makes a bloated processed tx for testing purposes. */ export async function makeBloatedProcessedTx({ seed = 1, header, db, chainId = Fr.ZERO, version = Fr.ZERO, gasSettings = GasSettings.default({
|
|
904
905
|
maxFeesPerGas: new GasFees(10, 10)
|
|
905
|
-
}), vkTreeRoot = Fr.ZERO, protocolContracts = makeProtocolContracts(seed + 0x100), globalVariables = GlobalVariables.empty(), newL1ToL2Snapshot = AppendOnlyTreeSnapshot.empty(), feePayer, feePaymentPublicDataWrite,
|
|
906
|
+
}), vkTreeRoot = Fr.ZERO, protocolContracts = makeProtocolContracts(seed + 0x100), globalVariables = GlobalVariables.empty(), newL1ToL2Snapshot = AppendOnlyTreeSnapshot.empty(), feePayer, feePaymentPublicDataWrite, // The default gasUsed is the tx overhead.
|
|
907
|
+
gasUsed = Gas.from({
|
|
908
|
+
daGas: FIXED_DA_GAS,
|
|
909
|
+
l2Gas: FIXED_L2_GAS
|
|
910
|
+
}), privateOnly = false } = {}) {
|
|
906
911
|
seed *= 0x1000; // Avoid clashing with the previous mock values if seed only increases by 1.
|
|
907
912
|
header ??= db?.getInitialHeader() ?? makeHeader(seed);
|
|
908
913
|
feePayer ??= await AztecAddress.random();
|
|
@@ -914,22 +919,19 @@ export async function makeAvmTxHint(seed = 0) {
|
|
|
914
919
|
txConstantData.vkTreeRoot = vkTreeRoot;
|
|
915
920
|
txConstantData.protocolContractsHash = await protocolContracts.hash();
|
|
916
921
|
const tx = !privateOnly ? await mockTx(seed, {
|
|
917
|
-
feePayer
|
|
922
|
+
feePayer,
|
|
923
|
+
gasUsed
|
|
918
924
|
}) : await mockTx(seed, {
|
|
919
925
|
numberOfNonRevertiblePublicCallRequests: 0,
|
|
920
926
|
numberOfRevertiblePublicCallRequests: 0,
|
|
921
|
-
feePayer
|
|
927
|
+
feePayer,
|
|
928
|
+
gasUsed
|
|
922
929
|
});
|
|
923
930
|
tx.data.constants = txConstantData;
|
|
924
|
-
|
|
925
|
-
tx.data.gasUsed = Gas.from({
|
|
926
|
-
daGas: FIXED_DA_GAS,
|
|
927
|
-
l2Gas: FIXED_L2_GAS
|
|
928
|
-
});
|
|
931
|
+
const transactionFee = tx.data.gasUsed.computeFee(globalVariables.gasFees);
|
|
929
932
|
if (privateOnly) {
|
|
930
933
|
const data = makePrivateToRollupAccumulatedData(seed + 0x1000);
|
|
931
934
|
clearContractClassLogs(data);
|
|
932
|
-
const transactionFee = tx.data.gasUsed.computeFee(globalVariables.gasFees);
|
|
933
935
|
feePaymentPublicDataWrite ??= new PublicDataWrite(Fr.random(), Fr.random());
|
|
934
936
|
tx.data.forRollup.end = data;
|
|
935
937
|
await tx.recomputeHash();
|
|
@@ -948,6 +950,7 @@ export async function makeAvmTxHint(seed = 0) {
|
|
|
948
950
|
avmOutput.protocolContracts = protocolContracts;
|
|
949
951
|
avmOutput.startTreeSnapshots.l1ToL2MessageTree = newL1ToL2Snapshot;
|
|
950
952
|
avmOutput.endTreeSnapshots.l1ToL2MessageTree = newL1ToL2Snapshot;
|
|
953
|
+
avmOutput.effectiveGasFees = computeEffectiveGasFees(globalVariables.gasFees, gasSettings);
|
|
951
954
|
// Assign data from private.
|
|
952
955
|
avmOutput.globalVariables = globalVariables;
|
|
953
956
|
avmOutput.startGasUsed = tx.data.gasUsed;
|
|
@@ -968,6 +971,9 @@ export async function makeAvmTxHint(seed = 0) {
|
|
|
968
971
|
avmOutput.accumulatedData.publicDataWrites = makeTuple(MAX_TOTAL_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX, (i)=>new PublicDataWrite(new Fr(i), new Fr(i + 10)), seed + 0x2000);
|
|
969
972
|
avmOutput.accumulatedDataArrayLengths = avmOutput.accumulatedData.getArrayLengths();
|
|
970
973
|
avmOutput.gasSettings = gasSettings;
|
|
974
|
+
// Note: The fee is computed from the tx's gas used, which only includes the gas used in private. But this shouldn't
|
|
975
|
+
// be a problem for the tests.
|
|
976
|
+
avmOutput.transactionFee = transactionFee;
|
|
971
977
|
const avmCircuitInputs = await makeAvmCircuitInputs(seed + 0x3000, {
|
|
972
978
|
publicInputs: avmOutput
|
|
973
979
|
});
|
package/dest/tests/mocks.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ import { L2Block } from '../block/l2_block.js';
|
|
|
7
7
|
import type { CommitteeAttestationsAndSigners } from '../block/proposal/attestations_and_signers.js';
|
|
8
8
|
import { PublishedL2Block } from '../block/published_l2_block.js';
|
|
9
9
|
import type { ContractInstanceWithAddress } from '../contract/index.js';
|
|
10
|
+
import { Gas } from '../gas/gas.js';
|
|
10
11
|
import { GasFees } from '../gas/gas_fees.js';
|
|
11
12
|
import { ExtendedNote, UniqueNote } from '../note/extended_note.js';
|
|
12
13
|
import { BlockAttestation } from '../p2p/block_attestation.js';
|
|
@@ -18,7 +19,7 @@ import { TxHash } from '../tx/tx_hash.js';
|
|
|
18
19
|
export declare const randomTxHash: () => TxHash;
|
|
19
20
|
export declare const randomExtendedNote: ({ note, recipient, contractAddress, txHash, storageSlot, }?: Partial<ExtendedNote>) => Promise<ExtendedNote>;
|
|
20
21
|
export declare const randomUniqueNote: ({ note, recipient, contractAddress, txHash, storageSlot, noteNonce, }?: Partial<UniqueNote>) => Promise<UniqueNote>;
|
|
21
|
-
export declare const mockTx: (seed?: number, { numberOfNonRevertiblePublicCallRequests, numberOfRevertiblePublicCallRequests, numberOfRevertibleNullifiers, hasPublicTeardownCallRequest, publicCalldataSize, feePayer, clientIvcProof, maxPriorityFeesPerGas, chainId, version, vkTreeRoot, protocolContractsHash, }?: {
|
|
22
|
+
export declare const mockTx: (seed?: number, { numberOfNonRevertiblePublicCallRequests, numberOfRevertiblePublicCallRequests, numberOfRevertibleNullifiers, hasPublicTeardownCallRequest, publicCalldataSize, feePayer, clientIvcProof, maxPriorityFeesPerGas, gasUsed, chainId, version, vkTreeRoot, protocolContractsHash, }?: {
|
|
22
23
|
numberOfNonRevertiblePublicCallRequests?: number;
|
|
23
24
|
numberOfRevertiblePublicCallRequests?: number;
|
|
24
25
|
numberOfRevertibleNullifiers?: number;
|
|
@@ -27,6 +28,7 @@ export declare const mockTx: (seed?: number, { numberOfNonRevertiblePublicCallRe
|
|
|
27
28
|
feePayer?: AztecAddress;
|
|
28
29
|
clientIvcProof?: ClientIvcProof;
|
|
29
30
|
maxPriorityFeesPerGas?: GasFees;
|
|
31
|
+
gasUsed?: Gas;
|
|
30
32
|
chainId?: Fr;
|
|
31
33
|
version?: Fr;
|
|
32
34
|
vkTreeRoot?: Fr;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mocks.d.ts","sourceRoot":"","sources":["../../src/tests/mocks.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAA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C,0CAOnD,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAAI,UAAU,2BAA2B,KAAG,aAOzE,CAAC;AAGF,eAAO,MAAM,oBAAoB,GAAI,UAAU,2BAA2B,KAAG,gBAM5E,CAAC;AAEF,eAAO,MAAM,6BAA6B,GAAI,OAAO,OAAO,EAAE,SAAS,eAAe,KAAG,gBAQxF,CAAC;AAEF,wBAAsB,sBAAsB,CAC1C,aAAa,EAAE,MAAM,EACrB,IAAI,GAAE;IAAE,OAAO,CAAC,EAAE,eAAe,EAAE,CAAA;CAAO,GACzC,OAAO,CAAC,gBAAgB,CAAC,CAc3B"}
|
package/dest/tests/mocks.js
CHANGED
|
@@ -10,6 +10,7 @@ import { PublishedL2Block } from '../block/published_l2_block.js';
|
|
|
10
10
|
import { computeContractAddressFromInstance } from '../contract/contract_address.js';
|
|
11
11
|
import { getContractClassFromArtifact } from '../contract/contract_class.js';
|
|
12
12
|
import { SerializableContractInstance } from '../contract/contract_instance.js';
|
|
13
|
+
import { Gas } from '../gas/gas.js';
|
|
13
14
|
import { GasFees } from '../gas/gas_fees.js';
|
|
14
15
|
import { GasSettings } from '../gas/gas_settings.js';
|
|
15
16
|
import { Nullifier } from '../kernel/nullifier.js';
|
|
@@ -36,7 +37,7 @@ export const randomExtendedNote = async ({ note = Note.random(), recipient = und
|
|
|
36
37
|
export const randomUniqueNote = async ({ note = Note.random(), recipient = undefined, contractAddress = undefined, txHash = randomTxHash(), storageSlot = Fr.random(), noteNonce = Fr.random() } = {})=>{
|
|
37
38
|
return new UniqueNote(note, recipient ?? await AztecAddress.random(), contractAddress ?? await AztecAddress.random(), storageSlot, txHash, noteNonce);
|
|
38
39
|
};
|
|
39
|
-
export const mockTx = async (seed = 1, { numberOfNonRevertiblePublicCallRequests = MAX_ENQUEUED_CALLS_PER_TX / 2, numberOfRevertiblePublicCallRequests = MAX_ENQUEUED_CALLS_PER_TX / 2, numberOfRevertibleNullifiers = 0, hasPublicTeardownCallRequest = false, publicCalldataSize = 2, feePayer, clientIvcProof = ClientIvcProof.random(), maxPriorityFeesPerGas, chainId = Fr.ZERO, version = Fr.ZERO, vkTreeRoot = Fr.ZERO, protocolContractsHash = Fr.ZERO } = {})=>{
|
|
40
|
+
export const mockTx = async (seed = 1, { numberOfNonRevertiblePublicCallRequests = MAX_ENQUEUED_CALLS_PER_TX / 2, numberOfRevertiblePublicCallRequests = MAX_ENQUEUED_CALLS_PER_TX / 2, numberOfRevertibleNullifiers = 0, hasPublicTeardownCallRequest = false, publicCalldataSize = 2, feePayer, clientIvcProof = ClientIvcProof.random(), maxPriorityFeesPerGas, gasUsed = Gas.empty(), chainId = Fr.ZERO, version = Fr.ZERO, vkTreeRoot = Fr.ZERO, protocolContractsHash = Fr.ZERO } = {})=>{
|
|
40
41
|
const totalPublicCallRequests = numberOfNonRevertiblePublicCallRequests + numberOfRevertiblePublicCallRequests + (hasPublicTeardownCallRequest ? 1 : 0);
|
|
41
42
|
const isForPublic = totalPublicCallRequests > 0;
|
|
42
43
|
const data = PrivateKernelTailCircuitPublicInputs.empty();
|
|
@@ -46,6 +47,7 @@ export const mockTx = async (seed = 1, { numberOfNonRevertiblePublicCallRequests
|
|
|
46
47
|
maxPriorityFeesPerGas
|
|
47
48
|
});
|
|
48
49
|
data.feePayer = feePayer ?? await AztecAddress.random();
|
|
50
|
+
data.gasUsed = gasUsed;
|
|
49
51
|
data.constants.txContext.chainId = chainId;
|
|
50
52
|
data.constants.txContext.version = version;
|
|
51
53
|
data.constants.vkTreeRoot = vkTreeRoot;
|
|
@@ -89,7 +91,7 @@ export const mockTxForRollup = (seed = 1, opts = {})=>mockTx(seed, {
|
|
|
89
91
|
numberOfNonRevertiblePublicCallRequests: 0,
|
|
90
92
|
numberOfRevertiblePublicCallRequests: 0
|
|
91
93
|
});
|
|
92
|
-
const emptyPrivateCallExecutionResult = ()=>new PrivateCallExecutionResult(Buffer.from(''), Buffer.from(''), new Map(), PrivateCircuitPublicInputs.empty(), new Map(), [], new Map(), [], [], [], []);
|
|
94
|
+
const emptyPrivateCallExecutionResult = ()=>new PrivateCallExecutionResult(Buffer.from(''), Buffer.from(''), new Map(), PrivateCircuitPublicInputs.empty(), new Map(), [], new Map(), [], [], [], [], []);
|
|
93
95
|
const emptyPrivateExecutionResult = ()=>new PrivateExecutionResult(emptyPrivateCallExecutionResult(), Fr.zero(), []);
|
|
94
96
|
export const mockSimulatedTx = async (seed = 1)=>{
|
|
95
97
|
const privateExecutionResult = emptyPrivateExecutionResult();
|
|
@@ -5,6 +5,7 @@ import { NoteSelector } from '../abi/note_selector.js';
|
|
|
5
5
|
import { PrivateCircuitPublicInputs } from '../kernel/private_circuit_public_inputs.js';
|
|
6
6
|
import type { IsEmpty } from '../kernel/utils/interfaces.js';
|
|
7
7
|
import { ContractClassLog, ContractClassLogFields } from '../logs/contract_class_log.js';
|
|
8
|
+
import { type IndexedTaggingSecret } from '../logs/indexed_tagging_secret.js';
|
|
8
9
|
import { Note } from '../note/note.js';
|
|
9
10
|
import { type ZodFor } from '../schemas/index.js';
|
|
10
11
|
import type { UInt32 } from '../types/index.js';
|
|
@@ -122,6 +123,8 @@ export declare class PrivateCallExecutionResult {
|
|
|
122
123
|
offchainEffects: {
|
|
123
124
|
data: Fr[];
|
|
124
125
|
}[];
|
|
126
|
+
/** The tagging indexes incremented by this execution along with the directional app tagging secrets. */
|
|
127
|
+
indexedTaggingSecrets: IndexedTaggingSecret[];
|
|
125
128
|
/** The nested executions. */
|
|
126
129
|
nestedExecutionResults: PrivateCallExecutionResult[];
|
|
127
130
|
/**
|
|
@@ -152,6 +155,8 @@ export declare class PrivateCallExecutionResult {
|
|
|
152
155
|
offchainEffects: {
|
|
153
156
|
data: Fr[];
|
|
154
157
|
}[],
|
|
158
|
+
/** The tagging indexes incremented by this execution along with the directional app tagging secrets. */
|
|
159
|
+
indexedTaggingSecrets: IndexedTaggingSecret[],
|
|
155
160
|
/** The nested executions. */
|
|
156
161
|
nestedExecutionResults: PrivateCallExecutionResult[],
|
|
157
162
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"private_execution_result.d.ts","sourceRoot":"","sources":["../../src/tx/private_execution_result.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAExD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,0BAA0B,EAAE,MAAM,4CAA4C,CAAC;AACxF,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAE7D,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AACzF,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAE,KAAK,MAAM,EAAsB,MAAM,qBAAqB,CAAC;AACtE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAE3D;;GAEG;AACH,qBAAa,WAAW;IAEpB,gBAAgB;IACT,IAAI,EAAE,IAAI;IACjB,oCAAoC;IAC7B,WAAW,EAAE,EAAE;IACtB,gCAAgC;IACzB,UAAU,EAAE,YAAY;;IAL/B,gBAAgB;IACT,IAAI,EAAE,IAAI;IACjB,oCAAoC;IAC7B,WAAW,EAAE,EAAE;IACtB,gCAAgC;IACzB,UAAU,EAAE,YAAY;IAGjC,MAAM,KAAK,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAQhB;IAED,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,QAAQ,CAAC,WAAW,CAAC;IAIzC,MAAM,CAAC,MAAM;CAGd;AAED,qBAAa,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PrivateCircuitPublicInputs } from '../kernel/private_circuit_public_inputs.js';
|
|
7
7
|
import { sortByCounter } from '../kernel/utils/order_and_comparison.js';
|
|
8
8
|
import { ContractClassLog } from '../logs/contract_class_log.js';
|
|
9
|
+
import { IndexedTaggingSecretSchema } from '../logs/indexed_tagging_secret.js';
|
|
9
10
|
import { Note } from '../note/note.js';
|
|
10
11
|
import { mapSchema, schemas } from '../schemas/index.js';
|
|
11
12
|
import { HashedValues } from './hashed_values.js';
|
|
@@ -97,12 +98,13 @@ export class PrivateExecutionResult {
|
|
|
97
98
|
noteHashNullifierCounterMap;
|
|
98
99
|
returnValues;
|
|
99
100
|
offchainEffects;
|
|
101
|
+
indexedTaggingSecrets;
|
|
100
102
|
nestedExecutionResults;
|
|
101
103
|
contractClassLogs;
|
|
102
104
|
profileResult;
|
|
103
105
|
constructor(// Needed for prover
|
|
104
106
|
/** The ACIR bytecode. */ acir, /** The verification key. */ vk, /** The partial witness. */ partialWitness, // Needed for the verifier (kernel)
|
|
105
|
-
/** The call stack item. */ publicInputs, /** Mapping of note hash to its index in the note hash tree. Used for building hints for note hash read requests. */ noteHashLeafIndexMap, /** The notes created in the executed function. */ newNotes, /** Mapping of note hash counter to the counter of its nullifier. */ noteHashNullifierCounterMap, /** The raw return values of the executed function. */ returnValues, /** The offchain effects emitted during execution of this function call via the `emit_offchain_effect` oracle. */ offchainEffects, /** The nested executions. */ nestedExecutionResults, /**
|
|
107
|
+
/** The call stack item. */ publicInputs, /** Mapping of note hash to its index in the note hash tree. Used for building hints for note hash read requests. */ noteHashLeafIndexMap, /** The notes created in the executed function. */ newNotes, /** Mapping of note hash counter to the counter of its nullifier. */ noteHashNullifierCounterMap, /** The raw return values of the executed function. */ returnValues, /** The offchain effects emitted during execution of this function call via the `emit_offchain_effect` oracle. */ offchainEffects, /** The tagging indexes incremented by this execution along with the directional app tagging secrets. */ indexedTaggingSecrets, /** The nested executions. */ nestedExecutionResults, /**
|
|
106
108
|
* Contract class logs emitted during execution of this function call.
|
|
107
109
|
* Note: We only need to collect the ContractClassLogFields as preimages for the tx.
|
|
108
110
|
* But keep them as ContractClassLog so that we can verify the log hashes before submitting the tx (TODO).
|
|
@@ -116,6 +118,7 @@ export class PrivateExecutionResult {
|
|
|
116
118
|
this.noteHashNullifierCounterMap = noteHashNullifierCounterMap;
|
|
117
119
|
this.returnValues = returnValues;
|
|
118
120
|
this.offchainEffects = offchainEffects;
|
|
121
|
+
this.indexedTaggingSecrets = indexedTaggingSecrets;
|
|
119
122
|
this.nestedExecutionResults = nestedExecutionResults;
|
|
120
123
|
this.contractClassLogs = contractClassLogs;
|
|
121
124
|
this.profileResult = profileResult;
|
|
@@ -133,12 +136,13 @@ export class PrivateExecutionResult {
|
|
|
133
136
|
offchainEffects: z.array(z.object({
|
|
134
137
|
data: z.array(schemas.Fr)
|
|
135
138
|
})),
|
|
139
|
+
indexedTaggingSecrets: z.array(IndexedTaggingSecretSchema),
|
|
136
140
|
nestedExecutionResults: z.array(z.lazy(()=>PrivateCallExecutionResult.schema)),
|
|
137
141
|
contractClassLogs: z.array(CountedContractClassLog.schema)
|
|
138
142
|
}).transform(PrivateCallExecutionResult.from);
|
|
139
143
|
}
|
|
140
144
|
static from(fields) {
|
|
141
|
-
return new PrivateCallExecutionResult(fields.acir, fields.vk, fields.partialWitness, fields.publicInputs, fields.noteHashLeafIndexMap, fields.newNotes, fields.noteHashNullifierCounterMap, fields.returnValues, fields.offchainEffects, fields.nestedExecutionResults, fields.contractClassLogs);
|
|
145
|
+
return new PrivateCallExecutionResult(fields.acir, fields.vk, fields.partialWitness, fields.publicInputs, fields.noteHashLeafIndexMap, fields.newNotes, fields.noteHashNullifierCounterMap, fields.returnValues, fields.offchainEffects, fields.indexedTaggingSecrets, fields.nestedExecutionResults, fields.contractClassLogs);
|
|
142
146
|
}
|
|
143
147
|
static async random(nested = 1) {
|
|
144
148
|
return new PrivateCallExecutionResult(randomBytes(4), randomBytes(4), new Map([
|
|
@@ -166,7 +170,7 @@ export class PrivateExecutionResult {
|
|
|
166
170
|
Fr.random()
|
|
167
171
|
]
|
|
168
172
|
}
|
|
169
|
-
], await timesParallel(nested, ()=>PrivateCallExecutionResult.random(0)), [
|
|
173
|
+
], [], await timesParallel(nested, ()=>PrivateCallExecutionResult.random(0)), [
|
|
170
174
|
new CountedContractClassLog(await ContractClassLog.random(), randomInt(10))
|
|
171
175
|
]);
|
|
172
176
|
}
|
|
@@ -49,11 +49,11 @@ export declare class SimulationOverrides {
|
|
|
49
49
|
}, "strip", z.ZodTypeAny, {
|
|
50
50
|
version: 1;
|
|
51
51
|
salt: import("@aztec/foundation/schemas").Fr;
|
|
52
|
-
publicKeys: import("../keys/public_keys.js").PublicKeys;
|
|
53
52
|
deployer: import("../aztec-address/index.js").AztecAddress;
|
|
54
53
|
currentContractClassId: import("@aztec/foundation/schemas").Fr;
|
|
55
54
|
originalContractClassId: import("@aztec/foundation/schemas").Fr;
|
|
56
55
|
initializationHash: import("@aztec/foundation/schemas").Fr;
|
|
56
|
+
publicKeys: import("../keys/public_keys.js").PublicKeys;
|
|
57
57
|
}, {
|
|
58
58
|
version: 1;
|
|
59
59
|
publicKeys: {
|
|
@@ -79,11 +79,11 @@ export declare class SimulationOverrides {
|
|
|
79
79
|
instance: {
|
|
80
80
|
version: 1;
|
|
81
81
|
salt: import("@aztec/foundation/schemas").Fr;
|
|
82
|
-
publicKeys: import("../keys/public_keys.js").PublicKeys;
|
|
83
82
|
deployer: import("../aztec-address/index.js").AztecAddress;
|
|
84
83
|
currentContractClassId: import("@aztec/foundation/schemas").Fr;
|
|
85
84
|
originalContractClassId: import("@aztec/foundation/schemas").Fr;
|
|
86
85
|
initializationHash: import("@aztec/foundation/schemas").Fr;
|
|
86
|
+
publicKeys: import("../keys/public_keys.js").PublicKeys;
|
|
87
87
|
} & {
|
|
88
88
|
address: import("../aztec-address/index.js").AztecAddress;
|
|
89
89
|
};
|
|
@@ -112,11 +112,11 @@ export declare class SimulationOverrides {
|
|
|
112
112
|
instance: {
|
|
113
113
|
version: 1;
|
|
114
114
|
salt: import("@aztec/foundation/schemas").Fr;
|
|
115
|
-
publicKeys: import("../keys/public_keys.js").PublicKeys;
|
|
116
115
|
deployer: import("../aztec-address/index.js").AztecAddress;
|
|
117
116
|
currentContractClassId: import("@aztec/foundation/schemas").Fr;
|
|
118
117
|
originalContractClassId: import("@aztec/foundation/schemas").Fr;
|
|
119
118
|
initializationHash: import("@aztec/foundation/schemas").Fr;
|
|
119
|
+
publicKeys: import("../keys/public_keys.js").PublicKeys;
|
|
120
120
|
} & {
|
|
121
121
|
address: import("../aztec-address/index.js").AztecAddress;
|
|
122
122
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/stdlib",
|
|
3
|
-
"version": "3.0.0-nightly.
|
|
3
|
+
"version": "3.0.0-nightly.20251015",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"inherits": [
|
|
6
6
|
"../package.common.json",
|
|
@@ -70,13 +70,13 @@
|
|
|
70
70
|
},
|
|
71
71
|
"dependencies": {
|
|
72
72
|
"@aws-sdk/client-s3": "^3.892.0",
|
|
73
|
-
"@aztec/bb.js": "3.0.0-nightly.
|
|
74
|
-
"@aztec/blob-lib": "3.0.0-nightly.
|
|
75
|
-
"@aztec/constants": "3.0.0-nightly.
|
|
76
|
-
"@aztec/ethereum": "3.0.0-nightly.
|
|
77
|
-
"@aztec/foundation": "3.0.0-nightly.
|
|
78
|
-
"@aztec/l1-artifacts": "3.0.0-nightly.
|
|
79
|
-
"@aztec/noir-noirc_abi": "3.0.0-nightly.
|
|
73
|
+
"@aztec/bb.js": "3.0.0-nightly.20251015",
|
|
74
|
+
"@aztec/blob-lib": "3.0.0-nightly.20251015",
|
|
75
|
+
"@aztec/constants": "3.0.0-nightly.20251015",
|
|
76
|
+
"@aztec/ethereum": "3.0.0-nightly.20251015",
|
|
77
|
+
"@aztec/foundation": "3.0.0-nightly.20251015",
|
|
78
|
+
"@aztec/l1-artifacts": "3.0.0-nightly.20251015",
|
|
79
|
+
"@aztec/noir-noirc_abi": "3.0.0-nightly.20251015",
|
|
80
80
|
"@google-cloud/storage": "^7.15.0",
|
|
81
81
|
"axios": "^1.12.0",
|
|
82
82
|
"json-stringify-deterministic": "1.0.12",
|
package/src/abi/abi.ts
CHANGED
|
@@ -195,7 +195,7 @@ export const FunctionAbiSchema = z.object({
|
|
|
195
195
|
isInitializer: z.boolean(),
|
|
196
196
|
parameters: z.array(z.object({ name: z.string(), type: AbiTypeSchema, visibility: z.enum(ABIParameterVisibility) })),
|
|
197
197
|
returnTypes: z.array(AbiTypeSchema),
|
|
198
|
-
errorTypes: z.record(AbiErrorTypeSchema),
|
|
198
|
+
errorTypes: z.record(z.string(), AbiErrorTypeSchema.optional()),
|
|
199
199
|
}) satisfies z.ZodType<FunctionAbi>;
|
|
200
200
|
|
|
201
201
|
/** Debug metadata for a function. */
|
package/src/abi/function_call.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { AztecAddress } from '../aztec-address/index.js';
|
|
|
5
5
|
import { type AbiType, FunctionType } from './abi.js';
|
|
6
6
|
import { FunctionSelector } from './function_selector.js';
|
|
7
7
|
|
|
8
|
-
/** A request to call a function on a contract
|
|
8
|
+
/** A request to call a function on a contract. */
|
|
9
9
|
export class FunctionCall {
|
|
10
10
|
constructor(
|
|
11
11
|
/** The name of the function to call */
|
|
@@ -16,6 +16,8 @@ export class FunctionCall {
|
|
|
16
16
|
public selector: FunctionSelector,
|
|
17
17
|
/** Type of the function */
|
|
18
18
|
public type: FunctionType,
|
|
19
|
+
/** Only applicable for enqueued public function calls. `hideMsgSender = true` will set the msg_sender field (the caller's address) to "null", meaning the public function (and observers around the world) won't know which smart contract address made the call. */
|
|
20
|
+
public hideMsgSender: boolean,
|
|
19
21
|
/** Whether this call can make modifications to state or not */
|
|
20
22
|
public isStatic: boolean,
|
|
21
23
|
/** The encoded args */
|
|
@@ -30,6 +32,7 @@ export class FunctionCall {
|
|
|
30
32
|
fields.to,
|
|
31
33
|
fields.selector,
|
|
32
34
|
fields.type,
|
|
35
|
+
fields.hideMsgSender,
|
|
33
36
|
fields.isStatic,
|
|
34
37
|
fields.args,
|
|
35
38
|
fields.returnTypes,
|
|
@@ -50,6 +53,7 @@ export class FunctionCall {
|
|
|
50
53
|
to: AztecAddress.ZERO,
|
|
51
54
|
selector: FunctionSelector.empty(),
|
|
52
55
|
type: FunctionType.PUBLIC,
|
|
56
|
+
hideMsgSender: false,
|
|
53
57
|
isStatic: false,
|
|
54
58
|
args: [],
|
|
55
59
|
returnTypes: [],
|
package/src/keys/derivation.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { GeneratorIndex } from '@aztec/constants';
|
|
2
|
-
import { Grumpkin,
|
|
2
|
+
import { Grumpkin, poseidon2HashWithSeparator, sha512ToGrumpkinScalar } from '@aztec/foundation/crypto';
|
|
3
3
|
import { Fq, Fr, GrumpkinScalar } from '@aztec/foundation/fields';
|
|
4
4
|
|
|
5
5
|
import { AztecAddress } from '../aztec-address/index.js';
|
|
6
|
-
import type { CompleteAddress } from '../contract/complete_address.js';
|
|
7
6
|
import type { KeyPrefix } from './key_types.js';
|
|
8
7
|
import { PublicKeys } from './public_keys.js';
|
|
9
8
|
import { getKeyGenerator } from './utils.js';
|
|
@@ -121,27 +120,3 @@ export async function deriveKeys(secretKey: Fr) {
|
|
|
121
120
|
publicKeys,
|
|
122
121
|
};
|
|
123
122
|
}
|
|
124
|
-
|
|
125
|
-
// Returns shared tagging secret computed with Diffie-Hellman key exchange.
|
|
126
|
-
async function computeTaggingSecretPoint(knownAddress: CompleteAddress, ivsk: Fq, externalAddress: AztecAddress) {
|
|
127
|
-
const knownPreaddress = await computePreaddress(await knownAddress.publicKeys.hash(), knownAddress.partialAddress);
|
|
128
|
-
// TODO: #8970 - Computation of address point from x coordinate might fail
|
|
129
|
-
const externalAddressPoint = await externalAddress.toAddressPoint();
|
|
130
|
-
const curve = new Grumpkin();
|
|
131
|
-
// Given A (known complete address) -> B (external address) and h == preaddress
|
|
132
|
-
// Compute shared secret as S = (h_A + ivsk_A) * Addr_Point_B
|
|
133
|
-
|
|
134
|
-
// Beware! h_a + ivsk_a (also known as the address secret) can lead to an address point with a negative y-coordinate, since there's two possible candidates
|
|
135
|
-
// computeAddressSecret takes care of selecting the one that leads to a positive y-coordinate, which is the only valid address point
|
|
136
|
-
return curve.mul(externalAddressPoint, await computeAddressSecret(knownPreaddress, ivsk));
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
export async function computeAppTaggingSecret(
|
|
140
|
-
knownAddress: CompleteAddress,
|
|
141
|
-
ivsk: Fq,
|
|
142
|
-
externalAddress: AztecAddress,
|
|
143
|
-
app: AztecAddress,
|
|
144
|
-
) {
|
|
145
|
-
const taggingSecretPoint = await computeTaggingSecretPoint(knownAddress, ivsk, externalAddress);
|
|
146
|
-
return poseidon2Hash([taggingSecretPoint.x, taggingSecretPoint.y, app]);
|
|
147
|
-
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { Grumpkin, poseidon2Hash } from '@aztec/foundation/crypto';
|
|
2
|
+
import { type Fq, Fr, type Point } from '@aztec/foundation/fields';
|
|
3
|
+
|
|
4
|
+
import { z } from 'zod';
|
|
5
|
+
|
|
6
|
+
import type { AztecAddress } from '../aztec-address/index.js';
|
|
7
|
+
import type { CompleteAddress } from '../contract/complete_address.js';
|
|
8
|
+
import { computeAddressSecret, computePreaddress } from '../keys/derivation.js';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Directional application tagging secret used for log tagging.
|
|
12
|
+
*
|
|
13
|
+
* "Directional" because the derived secret is bound to the recipient
|
|
14
|
+
* address: A→B differs from B→A even with the same participants and app.
|
|
15
|
+
*
|
|
16
|
+
* Note: It's a bit unfortunate that this type resides in `stdlib` as the rest of the tagging functionality resides
|
|
17
|
+
* in `pxe/src/tagging`. We need to use this type in `IndexedTaggingSecret` that in turn is used by other types
|
|
18
|
+
* in stdlib hence there doesn't seem to be a good way around this.
|
|
19
|
+
*/
|
|
20
|
+
export class DirectionalAppTaggingSecret {
|
|
21
|
+
private constructor(public readonly value: Fr) {}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Derives shared tagging secret and from that, the app address and recipient derives the directional app tagging
|
|
25
|
+
* secret.
|
|
26
|
+
*
|
|
27
|
+
* @param localAddress - The complete address of entity A in the shared tagging secret derivation scheme
|
|
28
|
+
* @param localIvsk - The incoming viewing secret key of entity A
|
|
29
|
+
* @param externalAddress - The address of entity B in the shared tagging secret derivation scheme
|
|
30
|
+
* @param app - Contract address to silo the secret to
|
|
31
|
+
* @param recipient - Recipient of the log. Defines the "direction of the secret".
|
|
32
|
+
* @returns The secret that can be used along with an index to compute a tag to be included in a log.
|
|
33
|
+
*/
|
|
34
|
+
static async compute(
|
|
35
|
+
localAddress: CompleteAddress,
|
|
36
|
+
localIvsk: Fq,
|
|
37
|
+
externalAddress: AztecAddress,
|
|
38
|
+
app: AztecAddress,
|
|
39
|
+
recipient: AztecAddress,
|
|
40
|
+
): Promise<DirectionalAppTaggingSecret> {
|
|
41
|
+
const taggingSecretPoint = await computeSharedTaggingSecret(localAddress, localIvsk, externalAddress);
|
|
42
|
+
const appTaggingSecret = await poseidon2Hash([taggingSecretPoint.x, taggingSecretPoint.y, app]);
|
|
43
|
+
const directionalAppTaggingSecret = await poseidon2Hash([appTaggingSecret, recipient]);
|
|
44
|
+
|
|
45
|
+
return new DirectionalAppTaggingSecret(directionalAppTaggingSecret);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
toString(): string {
|
|
49
|
+
return this.value.toString();
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
static fromString(str: string): DirectionalAppTaggingSecret {
|
|
53
|
+
return new DirectionalAppTaggingSecret(Fr.fromString(str));
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// Returns shared tagging secret computed with Diffie-Hellman key exchange.
|
|
58
|
+
async function computeSharedTaggingSecret(
|
|
59
|
+
localAddress: CompleteAddress,
|
|
60
|
+
localIvsk: Fq,
|
|
61
|
+
externalAddress: AztecAddress,
|
|
62
|
+
): Promise<Point> {
|
|
63
|
+
const knownPreaddress = await computePreaddress(await localAddress.publicKeys.hash(), localAddress.partialAddress);
|
|
64
|
+
// TODO: #8970 - Computation of address point from x coordinate might fail
|
|
65
|
+
const externalAddressPoint = await externalAddress.toAddressPoint();
|
|
66
|
+
const curve = new Grumpkin();
|
|
67
|
+
// Given A (local complete address) -> B (external address) and h == preaddress
|
|
68
|
+
// Compute shared secret as S = (h_A + local_ivsk_A) * Addr_Point_B
|
|
69
|
+
|
|
70
|
+
// Beware! h_a + local_ivsk_a (also known as the address secret) can lead to an address point with a negative
|
|
71
|
+
// y-coordinate, since there's two possible candidates computeAddressSecret takes care of selecting the one that
|
|
72
|
+
// leads to a positive y-coordinate, which is the only valid address point
|
|
73
|
+
return curve.mul(externalAddressPoint, await computeAddressSecret(knownPreaddress, localIvsk));
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export const DirectionalAppTaggingSecretSchema = z.object({
|
|
77
|
+
value: Fr.schema,
|
|
78
|
+
});
|
package/src/logs/index.ts
CHANGED
|
@@ -1,48 +1,25 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Fr } from '@aztec/foundation/fields';
|
|
1
|
+
import { schemas } from '@aztec/foundation/schemas';
|
|
3
2
|
|
|
4
|
-
import
|
|
3
|
+
import { z } from 'zod';
|
|
5
4
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
) {
|
|
11
|
-
if (index < 0) {
|
|
12
|
-
throw new Error('IndexedTaggingSecret index out of bounds');
|
|
13
|
-
}
|
|
14
|
-
}
|
|
5
|
+
import {
|
|
6
|
+
type DirectionalAppTaggingSecret,
|
|
7
|
+
DirectionalAppTaggingSecretSchema,
|
|
8
|
+
} from './directional_app_tagging_secret.js';
|
|
15
9
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
10
|
+
/**
|
|
11
|
+
* Represents a preimage of a private log tag (see `Tag` in `pxe/src/tagging`).
|
|
12
|
+
*
|
|
13
|
+
* Note: It's a bit unfortunate that this type resides in `stdlib` as the rest of the tagging functionality resides
|
|
14
|
+
* in `pxe/src/tagging`. But this type is used by other types in stdlib hence there doesn't seem to be a good way
|
|
15
|
+
* around this.
|
|
16
|
+
*/
|
|
17
|
+
export type IndexedTaggingSecret = {
|
|
18
|
+
secret: DirectionalAppTaggingSecret;
|
|
19
|
+
index: number;
|
|
20
|
+
};
|
|
19
21
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Computes the tag based on the app tagging secret, recipient and index.
|
|
26
|
-
* @dev By including the recipient we achieve "directionality" of the tag (when sending a note in the other
|
|
27
|
-
* direction, the tag will be different).
|
|
28
|
-
* @param recipient The recipient of the note
|
|
29
|
-
* @returns The tag.
|
|
30
|
-
*/
|
|
31
|
-
computeTag(recipient: AztecAddress) {
|
|
32
|
-
return poseidon2Hash([this.appTaggingSecret, recipient, this.index]);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Computes the siloed tag.
|
|
37
|
-
* @dev We do this second layer of siloing (one was already done as the tagging secret is app-siloed) because kernels
|
|
38
|
-
* do that to protect against contract impersonation attacks. This extra layer of siloing in kernels ensures that
|
|
39
|
-
* a malicious contract cannot emit a note with a tag corresponding to another contract.
|
|
40
|
-
* @param recipient The recipient of the note
|
|
41
|
-
* @param app The app address
|
|
42
|
-
* @returns The siloed tag.
|
|
43
|
-
*/
|
|
44
|
-
async computeSiloedTag(recipient: AztecAddress, app: AztecAddress) {
|
|
45
|
-
const tag = await this.computeTag(recipient);
|
|
46
|
-
return poseidon2Hash([app, tag]);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
22
|
+
export const IndexedTaggingSecretSchema = z.object({
|
|
23
|
+
secret: DirectionalAppTaggingSecretSchema,
|
|
24
|
+
index: schemas.Integer,
|
|
25
|
+
});
|
|
@@ -118,6 +118,10 @@ export class FeeRecipient {
|
|
|
118
118
|
return serializeToFields(...FeeRecipient.getFields(this));
|
|
119
119
|
}
|
|
120
120
|
|
|
121
|
+
static empty() {
|
|
122
|
+
return new FeeRecipient(EthAddress.ZERO, Fr.ZERO);
|
|
123
|
+
}
|
|
124
|
+
|
|
121
125
|
isEmpty() {
|
|
122
126
|
return this.value.isZero() && this.recipient.isZero();
|
|
123
127
|
}
|
package/src/tests/factories.ts
CHANGED
|
@@ -88,6 +88,7 @@ import {
|
|
|
88
88
|
computeContractClassId,
|
|
89
89
|
computePublicBytecodeCommitment,
|
|
90
90
|
} from '../contract/index.js';
|
|
91
|
+
import { computeEffectiveGasFees } from '../fees/transaction_fee.js';
|
|
91
92
|
import { Gas, GasFees, GasSettings, type GasUsed } from '../gas/index.js';
|
|
92
93
|
import { computeCalldataHash } from '../hash/hash.js';
|
|
93
94
|
import type { MerkleTreeReadOperations } from '../interfaces/merkle_tree_operations.js';
|
|
@@ -1544,6 +1545,8 @@ export async function makeBloatedProcessedTx({
|
|
|
1544
1545
|
newL1ToL2Snapshot = AppendOnlyTreeSnapshot.empty(),
|
|
1545
1546
|
feePayer,
|
|
1546
1547
|
feePaymentPublicDataWrite,
|
|
1548
|
+
// The default gasUsed is the tx overhead.
|
|
1549
|
+
gasUsed = Gas.from({ daGas: FIXED_DA_GAS, l2Gas: FIXED_L2_GAS }),
|
|
1547
1550
|
privateOnly = false,
|
|
1548
1551
|
}: {
|
|
1549
1552
|
seed?: number;
|
|
@@ -1558,6 +1561,7 @@ export async function makeBloatedProcessedTx({
|
|
|
1558
1561
|
protocolContracts?: ProtocolContracts;
|
|
1559
1562
|
feePayer?: AztecAddress;
|
|
1560
1563
|
feePaymentPublicDataWrite?: PublicDataWrite;
|
|
1564
|
+
gasUsed?: Gas;
|
|
1561
1565
|
privateOnly?: boolean;
|
|
1562
1566
|
} = {}) {
|
|
1563
1567
|
seed *= 0x1000; // Avoid clashing with the previous mock values if seed only increases by 1.
|
|
@@ -1573,22 +1577,21 @@ export async function makeBloatedProcessedTx({
|
|
|
1573
1577
|
txConstantData.protocolContractsHash = await protocolContracts.hash();
|
|
1574
1578
|
|
|
1575
1579
|
const tx = !privateOnly
|
|
1576
|
-
? await mockTx(seed, { feePayer })
|
|
1580
|
+
? await mockTx(seed, { feePayer, gasUsed })
|
|
1577
1581
|
: await mockTx(seed, {
|
|
1578
1582
|
numberOfNonRevertiblePublicCallRequests: 0,
|
|
1579
1583
|
numberOfRevertiblePublicCallRequests: 0,
|
|
1580
1584
|
feePayer,
|
|
1585
|
+
gasUsed,
|
|
1581
1586
|
});
|
|
1582
1587
|
tx.data.constants = txConstantData;
|
|
1583
1588
|
|
|
1584
|
-
|
|
1585
|
-
tx.data.gasUsed = Gas.from({ daGas: FIXED_DA_GAS, l2Gas: FIXED_L2_GAS });
|
|
1589
|
+
const transactionFee = tx.data.gasUsed.computeFee(globalVariables.gasFees);
|
|
1586
1590
|
|
|
1587
1591
|
if (privateOnly) {
|
|
1588
1592
|
const data = makePrivateToRollupAccumulatedData(seed + 0x1000);
|
|
1589
1593
|
clearContractClassLogs(data);
|
|
1590
1594
|
|
|
1591
|
-
const transactionFee = tx.data.gasUsed.computeFee(globalVariables.gasFees);
|
|
1592
1595
|
feePaymentPublicDataWrite ??= new PublicDataWrite(Fr.random(), Fr.random());
|
|
1593
1596
|
|
|
1594
1597
|
tx.data.forRollup!.end = data;
|
|
@@ -1612,6 +1615,7 @@ export async function makeBloatedProcessedTx({
|
|
|
1612
1615
|
avmOutput.protocolContracts = protocolContracts;
|
|
1613
1616
|
avmOutput.startTreeSnapshots.l1ToL2MessageTree = newL1ToL2Snapshot;
|
|
1614
1617
|
avmOutput.endTreeSnapshots.l1ToL2MessageTree = newL1ToL2Snapshot;
|
|
1618
|
+
avmOutput.effectiveGasFees = computeEffectiveGasFees(globalVariables.gasFees, gasSettings);
|
|
1615
1619
|
// Assign data from private.
|
|
1616
1620
|
avmOutput.globalVariables = globalVariables;
|
|
1617
1621
|
avmOutput.startGasUsed = tx.data.gasUsed;
|
|
@@ -1654,6 +1658,9 @@ export async function makeBloatedProcessedTx({
|
|
|
1654
1658
|
);
|
|
1655
1659
|
avmOutput.accumulatedDataArrayLengths = avmOutput.accumulatedData.getArrayLengths();
|
|
1656
1660
|
avmOutput.gasSettings = gasSettings;
|
|
1661
|
+
// Note: The fee is computed from the tx's gas used, which only includes the gas used in private. But this shouldn't
|
|
1662
|
+
// be a problem for the tests.
|
|
1663
|
+
avmOutput.transactionFee = transactionFee;
|
|
1657
1664
|
|
|
1658
1665
|
const avmCircuitInputs = await makeAvmCircuitInputs(seed + 0x3000, { publicInputs: avmOutput });
|
|
1659
1666
|
avmCircuitInputs.hints.startingTreeRoots.l1ToL2MessageTree = newL1ToL2Snapshot;
|