@aztec/stdlib 0.81.0 → 0.82.1-alpha-testnet.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/abi/abi.d.ts +5 -1
- package/dest/abi/abi.d.ts.map +1 -1
- package/dest/abi/abi.js +2 -1
- package/dest/auth_witness/auth_witness.d.ts +21 -0
- package/dest/auth_witness/auth_witness.d.ts.map +1 -1
- package/dest/auth_witness/auth_witness.js +29 -0
- package/dest/avm/avm.d.ts +24 -48
- package/dest/avm/avm.d.ts.map +1 -1
- package/dest/avm/avm_circuit_public_inputs.d.ts +18 -36
- package/dest/avm/avm_circuit_public_inputs.d.ts.map +1 -1
- package/dest/avm/avm_proving_request.d.ts +27 -54
- package/dest/avm/avm_proving_request.d.ts.map +1 -1
- package/dest/block/index.d.ts +0 -1
- package/dest/block/index.d.ts.map +1 -1
- package/dest/block/index.js +0 -1
- package/dest/block/l2_block_downloader/l2_block_stream.d.ts.map +1 -1
- package/dest/block/l2_block_downloader/l2_block_stream.js +0 -2
- package/dest/block/l2_block_source.d.ts +6 -0
- package/dest/block/l2_block_source.d.ts.map +1 -1
- package/dest/contract/contract_class.d.ts.map +1 -1
- package/dest/contract/contract_class.js +3 -21
- package/dest/contract/interfaces/contract_class.d.ts +1 -143
- package/dest/contract/interfaces/contract_class.d.ts.map +1 -1
- package/dest/contract/interfaces/contract_class.js +0 -5
- package/dest/contract/interfaces/contract_data_source.d.ts +3 -8
- package/dest/contract/interfaces/contract_data_source.d.ts.map +1 -1
- package/dest/database-version/version_manager.d.ts +5 -0
- package/dest/database-version/version_manager.d.ts.map +1 -1
- package/dest/database-version/version_manager.js +7 -0
- package/dest/hash/hash.d.ts +8 -1
- package/dest/hash/hash.d.ts.map +1 -1
- package/dest/hash/hash.js +12 -1
- package/dest/interfaces/archiver.d.ts +1 -2
- package/dest/interfaces/archiver.d.ts.map +1 -1
- package/dest/interfaces/archiver.js +2 -4
- package/dest/interfaces/aztec-node-admin.d.ts +20 -0
- package/dest/interfaces/aztec-node-admin.d.ts.map +1 -0
- package/dest/interfaces/aztec-node-admin.js +16 -0
- package/dest/interfaces/aztec-node.d.ts +8 -38
- package/dest/interfaces/aztec-node.d.ts.map +1 -1
- package/dest/interfaces/aztec-node.js +4 -12
- package/dest/interfaces/client.d.ts +1 -0
- package/dest/interfaces/client.d.ts.map +1 -1
- package/dest/interfaces/client.js +1 -0
- package/dest/interfaces/private_kernel_prover.d.ts +2 -3
- package/dest/interfaces/private_kernel_prover.d.ts.map +1 -1
- package/dest/interfaces/prover-client.js +1 -1
- package/dest/interfaces/prover-node.d.ts +1 -2
- package/dest/interfaces/prover-node.d.ts.map +1 -1
- package/dest/interfaces/prover-node.js +5 -4
- package/dest/interfaces/proving-job.d.ts +27 -54
- package/dest/interfaces/proving-job.d.ts.map +1 -1
- package/dest/interfaces/pxe.d.ts +21 -39
- package/dest/interfaces/pxe.d.ts.map +1 -1
- package/dest/interfaces/pxe.js +10 -9
- package/dest/kernel/index.d.ts +1 -1
- package/dest/kernel/index.d.ts.map +1 -1
- package/dest/kernel/index.js +1 -1
- package/dest/kernel/private_kernel_prover_output.d.ts +49 -0
- package/dest/kernel/private_kernel_prover_output.d.ts.map +1 -0
- package/dest/kernel/private_kernel_prover_output.js +8 -0
- package/dest/kernel/private_kernel_simulated_output.d.ts +3 -7
- package/dest/kernel/private_kernel_simulated_output.d.ts.map +1 -1
- package/dest/kernel/public_call_request.d.ts +14 -19
- package/dest/kernel/public_call_request.d.ts.map +1 -1
- package/dest/kernel/public_call_request.js +19 -20
- package/dest/logs/log_with_tx_data.js +2 -2
- package/dest/noir/index.d.ts +5 -1
- package/dest/noir/index.d.ts.map +1 -1
- package/dest/proofs/client_ivc_proof.d.ts +1 -2
- package/dest/proofs/client_ivc_proof.d.ts.map +1 -1
- package/dest/proofs/client_ivc_proof.js +6 -9
- package/dest/rollup/tube_inputs.d.ts +7 -2
- package/dest/rollup/tube_inputs.d.ts.map +1 -1
- package/dest/rollup/tube_inputs.js +10 -4
- package/dest/stats/stats.d.ts +1 -1
- package/dest/stats/stats.d.ts.map +1 -1
- package/dest/tests/factories.d.ts +2 -2
- package/dest/tests/factories.d.ts.map +1 -1
- package/dest/tests/factories.js +3 -13
- package/dest/tests/mocks.d.ts +3 -4
- package/dest/tests/mocks.d.ts.map +1 -1
- package/dest/tests/mocks.js +13 -48
- package/dest/trees/nullifier_membership_witness.d.ts +4 -0
- package/dest/trees/nullifier_membership_witness.d.ts.map +1 -1
- package/dest/trees/nullifier_membership_witness.js +10 -0
- package/dest/trees/public_data_witness.d.ts +5 -5
- package/dest/trees/public_data_witness.d.ts.map +1 -1
- package/dest/trees/public_data_witness.js +13 -0
- package/dest/tx/call_context.d.ts +1 -1
- package/dest/tx/hashed_values.d.ts +16 -4
- package/dest/tx/hashed_values.d.ts.map +1 -1
- package/dest/tx/hashed_values.js +26 -9
- package/dest/tx/index.d.ts +3 -1
- package/dest/tx/index.d.ts.map +1 -1
- package/dest/tx/index.js +3 -1
- package/dest/tx/private_execution_result.d.ts +10 -26
- package/dest/tx/private_execution_result.d.ts.map +1 -1
- package/dest/tx/private_execution_result.js +18 -70
- package/dest/tx/profiled_tx.d.ts +9 -0
- package/dest/tx/profiled_tx.d.ts.map +1 -0
- package/dest/tx/profiled_tx.js +27 -0
- package/dest/tx/proven_tx.d.ts +33 -0
- package/dest/tx/proven_tx.d.ts.map +1 -0
- package/dest/tx/proven_tx.js +33 -0
- package/dest/tx/public_call_request_with_calldata.d.ts +41 -0
- package/dest/tx/public_call_request_with_calldata.d.ts.map +1 -0
- package/dest/tx/public_call_request_with_calldata.js +57 -0
- package/dest/tx/simulated_tx.d.ts +8 -44
- package/dest/tx/simulated_tx.d.ts.map +1 -1
- package/dest/tx/simulated_tx.js +19 -44
- package/dest/tx/tx.d.ts +16 -20
- package/dest/tx/tx.d.ts.map +1 -1
- package/dest/tx/tx.js +56 -42
- package/dest/tx/tx_execution_request.js +1 -1
- package/dest/tx/tx_receipt.d.ts +1 -30
- package/dest/tx/tx_receipt.d.ts.map +1 -1
- package/dest/tx/tx_receipt.js +3 -13
- package/package.json +6 -7
- package/src/abi/abi.ts +7 -2
- package/src/auth_witness/auth_witness.ts +29 -0
- package/src/block/index.ts +0 -1
- package/src/block/l2_block_downloader/l2_block_stream.ts +0 -2
- package/src/block/l2_block_source.ts +7 -0
- package/src/contract/contract_class.ts +7 -26
- package/src/contract/interfaces/contract_class.ts +2 -18
- package/src/contract/interfaces/contract_data_source.ts +3 -9
- package/src/database-version/version_manager.ts +10 -0
- package/src/hash/hash.ts +15 -1
- package/src/interfaces/archiver.ts +3 -12
- package/src/interfaces/aztec-node-admin.ts +39 -0
- package/src/interfaces/aztec-node.ts +9 -71
- package/src/interfaces/client.ts +1 -0
- package/src/interfaces/private_kernel_prover.ts +2 -3
- package/src/interfaces/prover-client.ts +1 -1
- package/src/interfaces/prover-node.ts +2 -4
- package/src/interfaces/pxe.ts +34 -56
- package/src/kernel/index.ts +1 -1
- package/src/kernel/private_kernel_prover_output.ts +44 -0
- package/src/kernel/private_kernel_simulated_output.ts +4 -13
- package/src/kernel/public_call_request.ts +22 -27
- package/src/logs/log_with_tx_data.ts +2 -2
- package/src/noir/index.ts +6 -1
- package/src/proofs/client_ivc_proof.ts +5 -15
- package/src/rollup/tube_inputs.ts +8 -4
- package/src/stats/stats.ts +1 -1
- package/src/tests/factories.ts +3 -24
- package/src/tests/mocks.ts +28 -80
- package/src/trees/nullifier_membership_witness.ts +12 -0
- package/src/trees/public_data_witness.ts +15 -0
- package/src/tx/hashed_values.ts +29 -9
- package/src/tx/index.ts +3 -1
- package/src/tx/private_execution_result.ts +16 -81
- package/src/tx/profiled_tx.ts +27 -0
- package/src/tx/proven_tx.ts +50 -0
- package/src/tx/public_call_request_with_calldata.ts +72 -0
- package/src/tx/simulated_tx.ts +12 -69
- package/src/tx/tx.ts +57 -70
- package/src/tx/tx_execution_request.ts +1 -1
- package/src/tx/tx_receipt.ts +0 -36
- package/dest/block/nullifier_with_block_source.d.ts +0 -6
- package/dest/block/nullifier_with_block_source.d.ts.map +0 -1
- package/dest/block/nullifier_with_block_source.js +0 -1
- package/dest/kernel/private_kernel_prover_profile_result.d.ts +0 -25
- package/dest/kernel/private_kernel_prover_profile_result.d.ts.map +0 -1
- package/dest/kernel/private_kernel_prover_profile_result.js +0 -7
- package/dest/tx/public_execution_request.d.ts +0 -45
- package/dest/tx/public_execution_request.d.ts.map +0 -1
- package/dest/tx/public_execution_request.js +0 -72
- package/src/block/nullifier_with_block_source.ts +0 -7
- package/src/kernel/private_kernel_prover_profile_result.ts +0 -7
- package/src/tx/public_execution_request.ts +0 -97
package/dest/tests/mocks.js
CHANGED
|
@@ -8,7 +8,6 @@ import { getContractClassFromArtifact } from '../contract/contract_class.js';
|
|
|
8
8
|
import { SerializableContractInstance } from '../contract/contract_instance.js';
|
|
9
9
|
import { GasFees } from '../gas/gas_fees.js';
|
|
10
10
|
import { GasSettings } from '../gas/gas_settings.js';
|
|
11
|
-
import { computeVarArgsHash } from '../hash/hash.js';
|
|
12
11
|
import { Nullifier } from '../kernel/nullifier.js';
|
|
13
12
|
import { PrivateCircuitPublicInputs } from '../kernel/private_circuit_public_inputs.js';
|
|
14
13
|
import { PartialPrivateTailPublicInputsForPublic, PrivateKernelTailCircuitPublicInputs } from '../kernel/private_kernel_tail_circuit_public_inputs.js';
|
|
@@ -20,7 +19,7 @@ import { BlockProposal } from '../p2p/block_proposal.js';
|
|
|
20
19
|
import { ConsensusPayload } from '../p2p/consensus_payload.js';
|
|
21
20
|
import { SignatureDomainSeparator, getHashedSignaturePayloadEthSignedMessage } from '../p2p/signature_utils.js';
|
|
22
21
|
import { ClientIvcProof } from '../proofs/client_ivc_proof.js';
|
|
23
|
-
import {
|
|
22
|
+
import { HashedValues, PrivateCallExecutionResult, PrivateExecutionResult, Tx } from '../tx/index.js';
|
|
24
23
|
import { PublicSimulationOutput } from '../tx/public_simulation_output.js';
|
|
25
24
|
import { TxSimulationResult, accumulatePrivateReturnValues } from '../tx/simulated_tx.js';
|
|
26
25
|
import { TxEffect } from '../tx/tx_effect.js';
|
|
@@ -33,35 +32,7 @@ export const randomExtendedNote = async ({ note = Note.random(), recipient = und
|
|
|
33
32
|
export const randomUniqueNote = async ({ note = Note.random(), recipient = undefined, contractAddress = undefined, txHash = randomTxHash(), storageSlot = Fr.random(), nonce = Fr.random() } = {})=>{
|
|
34
33
|
return new UniqueNote(note, recipient ?? await AztecAddress.random(), contractAddress ?? await AztecAddress.random(), storageSlot, txHash, nonce);
|
|
35
34
|
};
|
|
36
|
-
export const
|
|
37
|
-
const totalPublicCallRequests = numberOfNonRevertiblePublicCallRequests + numberOfRevertiblePublicCallRequests + (hasPublicTeardownCallRequest ? 1 : 0);
|
|
38
|
-
const isForPublic = totalPublicCallRequests > 0;
|
|
39
|
-
let enqueuedPublicFunctionCalls = [];
|
|
40
|
-
let publicTeardownFunctionCall = PublicExecutionRequest.empty();
|
|
41
|
-
if (isForPublic) {
|
|
42
|
-
const publicCallRequests = times(totalPublicCallRequests, (i)=>makePublicCallRequest(seed + 0x102 + i)).reverse(); // Reverse it so that they are sorted by counters in descending order.
|
|
43
|
-
const publicFunctionArgs = times(totalPublicCallRequests, (i)=>[
|
|
44
|
-
new Fr(seed + i * 100),
|
|
45
|
-
new Fr(seed + i * 101)
|
|
46
|
-
]);
|
|
47
|
-
for(let i = 0; i < publicCallRequests.length; i++){
|
|
48
|
-
const r = publicCallRequests[i];
|
|
49
|
-
r.argsHash = await computeVarArgsHash(publicFunctionArgs[i]);
|
|
50
|
-
i++;
|
|
51
|
-
}
|
|
52
|
-
if (hasPublicTeardownCallRequest) {
|
|
53
|
-
const request = publicCallRequests.shift();
|
|
54
|
-
const args = publicFunctionArgs.shift();
|
|
55
|
-
publicTeardownFunctionCall = new PublicExecutionRequest(CallContext.fromFields(request.toFields()), args);
|
|
56
|
-
}
|
|
57
|
-
enqueuedPublicFunctionCalls = publicCallRequests.map((r, i)=>new PublicExecutionRequest(CallContext.fromFields(r.toFields()), publicFunctionArgs[i]));
|
|
58
|
-
}
|
|
59
|
-
return new PrivateCallExecutionResult(Buffer.from(''), Buffer.from(''), new Map(), PrivateCircuitPublicInputs.empty(), new Map(), [], new Map(), [], [], enqueuedPublicFunctionCalls.map((call, index)=>new CountedPublicExecutionRequest(call, index)), publicTeardownFunctionCall, []);
|
|
60
|
-
};
|
|
61
|
-
export const mockPrivateExecutionResult = async (seed = 1)=>{
|
|
62
|
-
return new PrivateExecutionResult(await mockPrivateCallExecutionResult(seed), Fr.zero());
|
|
63
|
-
};
|
|
64
|
-
export const mockTx = async (seed = 1, { numberOfNonRevertiblePublicCallRequests = MAX_ENQUEUED_CALLS_PER_TX / 2, numberOfRevertiblePublicCallRequests = MAX_ENQUEUED_CALLS_PER_TX / 2, hasPublicTeardownCallRequest = false, feePayer, clientIvcProof = ClientIvcProof.empty() } = {})=>{
|
|
35
|
+
export const mockTx = async (seed = 1, { numberOfNonRevertiblePublicCallRequests = MAX_ENQUEUED_CALLS_PER_TX / 2, numberOfRevertiblePublicCallRequests = MAX_ENQUEUED_CALLS_PER_TX / 2, hasPublicTeardownCallRequest = false, publicCalldataSize = 2, feePayer, clientIvcProof = ClientIvcProof.empty() } = {})=>{
|
|
65
36
|
const totalPublicCallRequests = numberOfNonRevertiblePublicCallRequests + numberOfRevertiblePublicCallRequests + (hasPublicTeardownCallRequest ? 1 : 0);
|
|
66
37
|
const isForPublic = totalPublicCallRequests > 0;
|
|
67
38
|
const data = PrivateKernelTailCircuitPublicInputs.empty();
|
|
@@ -70,8 +41,7 @@ export const mockTx = async (seed = 1, { numberOfNonRevertiblePublicCallRequests
|
|
|
70
41
|
maxFeesPerGas: new GasFees(10, 10)
|
|
71
42
|
});
|
|
72
43
|
data.feePayer = feePayer ?? await AztecAddress.random();
|
|
73
|
-
|
|
74
|
-
let publicTeardownFunctionCall = PublicExecutionRequest.empty();
|
|
44
|
+
const publicFunctionCalldata = [];
|
|
75
45
|
if (!isForPublic) {
|
|
76
46
|
data.forRollup.end.nullifiers[0] = firstNullifier.value;
|
|
77
47
|
} else {
|
|
@@ -79,34 +49,29 @@ export const mockTx = async (seed = 1, { numberOfNonRevertiblePublicCallRequests
|
|
|
79
49
|
data.forPublic = PartialPrivateTailPublicInputsForPublic.empty();
|
|
80
50
|
const revertibleBuilder = new PrivateToPublicAccumulatedDataBuilder();
|
|
81
51
|
const nonRevertibleBuilder = new PrivateToPublicAccumulatedDataBuilder();
|
|
82
|
-
const publicCallRequests = times(totalPublicCallRequests, (i)=>makePublicCallRequest(seed + 0x102 + i))
|
|
83
|
-
const
|
|
84
|
-
new Fr(seed + i * 100),
|
|
85
|
-
new Fr(seed + i * 101)
|
|
86
|
-
]);
|
|
52
|
+
const publicCallRequests = times(totalPublicCallRequests, (i)=>makePublicCallRequest(seed + 0x102 + i));
|
|
53
|
+
const calldata = times(totalPublicCallRequests, (i)=>times(publicCalldataSize, (j)=>new Fr(seed + (i * 13 + j))));
|
|
87
54
|
for(let i = 0; i < publicCallRequests.length; i++){
|
|
88
|
-
const
|
|
89
|
-
|
|
55
|
+
const hashedCalldata = await HashedValues.fromCalldata(calldata[i]);
|
|
56
|
+
publicFunctionCalldata.push(hashedCalldata);
|
|
57
|
+
publicCallRequests[i].calldataHash = hashedCalldata.hash;
|
|
90
58
|
}
|
|
91
59
|
if (hasPublicTeardownCallRequest) {
|
|
92
|
-
|
|
93
|
-
data.forPublic.publicTeardownCallRequest = request;
|
|
94
|
-
const args = publicFunctionArgs.shift();
|
|
95
|
-
publicTeardownFunctionCall = new PublicExecutionRequest(CallContext.fromFields(request.toFields()), args);
|
|
60
|
+
data.forPublic.publicTeardownCallRequest = publicCallRequests.pop();
|
|
96
61
|
}
|
|
97
|
-
enqueuedPublicFunctionCalls = publicCallRequests.map((r, i)=>new PublicExecutionRequest(CallContext.fromFields(r.toFields()), publicFunctionArgs[i]));
|
|
98
62
|
data.forPublic.nonRevertibleAccumulatedData = nonRevertibleBuilder.pushNullifier(firstNullifier.value).withPublicCallRequests(publicCallRequests.slice(numberOfRevertiblePublicCallRequests)).build();
|
|
99
63
|
data.forPublic.revertibleAccumulatedData = revertibleBuilder.withPublicCallRequests(publicCallRequests.slice(0, numberOfRevertiblePublicCallRequests)).build();
|
|
100
64
|
}
|
|
101
|
-
|
|
102
|
-
return tx;
|
|
65
|
+
return new Tx(data, clientIvcProof, [], publicFunctionCalldata);
|
|
103
66
|
};
|
|
104
67
|
export const mockTxForRollup = (seed = 1)=>mockTx(seed, {
|
|
105
68
|
numberOfNonRevertiblePublicCallRequests: 0,
|
|
106
69
|
numberOfRevertiblePublicCallRequests: 0
|
|
107
70
|
});
|
|
71
|
+
const emptyPrivateCallExecutionResult = ()=>new PrivateCallExecutionResult(Buffer.from(''), Buffer.from(''), new Map(), PrivateCircuitPublicInputs.empty(), new Map(), [], new Map(), [], [], []);
|
|
72
|
+
const emptyPrivateExecutionResult = ()=>new PrivateExecutionResult(emptyPrivateCallExecutionResult(), Fr.zero(), []);
|
|
108
73
|
export const mockSimulatedTx = async (seed = 1)=>{
|
|
109
|
-
const privateExecutionResult =
|
|
74
|
+
const privateExecutionResult = emptyPrivateExecutionResult();
|
|
110
75
|
const tx = await mockTx(seed);
|
|
111
76
|
const output = new PublicSimulationOutput(undefined, makeCombinedConstantData(), await TxEffect.random(), [
|
|
112
77
|
accumulatePrivateReturnValues(privateExecutionResult)
|
|
@@ -108,5 +108,9 @@ export declare class NullifierMembershipWitness {
|
|
|
108
108
|
* @returns A field array representation of a nullifier witness.
|
|
109
109
|
*/
|
|
110
110
|
toFields(): Fr[];
|
|
111
|
+
/**
|
|
112
|
+
* Returns a representation of the nullifier membership witness as expected by intrinsic Noir deserialization.
|
|
113
|
+
*/
|
|
114
|
+
toNoirRepresentation(): (string | string[])[];
|
|
111
115
|
}
|
|
112
116
|
//# sourceMappingURL=nullifier_membership_witness.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nullifier_membership_witness.d.ts","sourceRoot":"","sources":["../../src/trees/nullifier_membership_witness.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEtD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAE5D;;;;;GAKG;AACH,qBAAa,0BAA0B;IAEnC;;OAEG;aACa,KAAK,EAAE,MAAM;IAC7B;;OAEG;aACa,YAAY,EAAE,qBAAqB;IACnD;;OAEG;aACa,WAAW,EAAE,WAAW,CAAC,OAAO,qBAAqB,CAAC;;IAXtE;;OAEG;IACa,KAAK,EAAE,MAAM;IAC7B;;OAEG;IACa,YAAY,EAAE,qBAAqB;IACnD;;OAEG;IACa,WAAW,EAAE,WAAW,CAAC,OAAO,qBAAqB,CAAC;IAGxE,MAAM,KAAK,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAUhB;IAED,MAAM,CAAC,MAAM;IAQb;;;OAGG;IACI,QAAQ,IAAI,EAAE,EAAE;
|
|
1
|
+
{"version":3,"file":"nullifier_membership_witness.d.ts","sourceRoot":"","sources":["../../src/trees/nullifier_membership_witness.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEtD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAE5D;;;;;GAKG;AACH,qBAAa,0BAA0B;IAEnC;;OAEG;aACa,KAAK,EAAE,MAAM;IAC7B;;OAEG;aACa,YAAY,EAAE,qBAAqB;IACnD;;OAEG;aACa,WAAW,EAAE,WAAW,CAAC,OAAO,qBAAqB,CAAC;;IAXtE;;OAEG;IACa,KAAK,EAAE,MAAM;IAC7B;;OAEG;IACa,YAAY,EAAE,qBAAqB;IACnD;;OAEG;IACa,WAAW,EAAE,WAAW,CAAC,OAAO,qBAAqB,CAAC;IAGxE,MAAM,KAAK,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAUhB;IAED,MAAM,CAAC,MAAM;IAQb;;;OAGG;IACI,QAAQ,IAAI,EAAE,EAAE;IAIvB;;OAEG;IACI,oBAAoB,IAAI,CAAC,MAAM,GAAG,MAAM,EAAE,CAAC,EAAE;CAQrD"}
|
|
@@ -44,4 +44,14 @@ import { NullifierLeafPreimage } from './nullifier_leaf.js';
|
|
|
44
44
|
...this.siblingPath.toFields()
|
|
45
45
|
];
|
|
46
46
|
}
|
|
47
|
+
/**
|
|
48
|
+
* Returns a representation of the nullifier membership witness as expected by intrinsic Noir deserialization.
|
|
49
|
+
*/ toNoirRepresentation() {
|
|
50
|
+
// TODO(#12874): remove the stupid as string conversion by modifying ForeignCallOutput type in acvm.js
|
|
51
|
+
return [
|
|
52
|
+
new Fr(this.index).toString(),
|
|
53
|
+
...this.leafPreimage.toFields().map((fr)=>fr.toString()),
|
|
54
|
+
this.siblingPath.toFields().map((fr)=>fr.toString())
|
|
55
|
+
];
|
|
56
|
+
}
|
|
47
57
|
}
|
|
@@ -71,11 +71,7 @@ export declare class PublicDataWitness {
|
|
|
71
71
|
data: number[];
|
|
72
72
|
}, {
|
|
73
73
|
type: "Buffer";
|
|
74
|
-
data: number[];
|
|
75
|
-
* Deserializes an PublicDataWitness object from a buffer.
|
|
76
|
-
* @param buf - Buffer or BufferReader to deserialize.
|
|
77
|
-
* @returns An instance of PublicDataWitness.
|
|
78
|
-
*/
|
|
74
|
+
data: number[];
|
|
79
75
|
}>, Buffer, {
|
|
80
76
|
type: "Buffer";
|
|
81
77
|
data: number[];
|
|
@@ -120,6 +116,10 @@ export declare class PublicDataWitness {
|
|
|
120
116
|
* @returns A field array representation of a public data witness.
|
|
121
117
|
*/
|
|
122
118
|
toFields(): Fr[];
|
|
119
|
+
/**
|
|
120
|
+
* Returns a representation of the public data witness as expected by intrinsic Noir deserialization.
|
|
121
|
+
*/
|
|
122
|
+
toNoirRepresentation(): (string | string[])[];
|
|
123
123
|
toBuffer(): Buffer;
|
|
124
124
|
/**
|
|
125
125
|
* Returns a string representation of the TxEffect object.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"public_data_witness.d.ts","sourceRoot":"","sources":["../../src/trees/public_data_witness.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAE3D,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAqB,MAAM,6BAA6B,CAAC;AAE9E,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEtD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AAEnE;;;;;GAKG;AACH,qBAAa,iBAAiB;IAE1B;;OAEG;aACa,KAAK,EAAE,MAAM;IAC7B;;;OAGG;aACa,YAAY,EAAE,0BAA0B;IACxD;;OAEG;aACa,WAAW,EAAE,WAAW,CAAC,OAAO,uBAAuB,CAAC;;IAZxE;;OAEG;IACa,KAAK,EAAE,MAAM;IAC7B;;;OAGG;IACa,YAAY,EAAE,0BAA0B;IACxD;;OAEG;IACa,WAAW,EAAE,WAAW,CAAC,OAAO,uBAAuB,CAAC;IAG1E,MAAM,KAAK,MAAM
|
|
1
|
+
{"version":3,"file":"public_data_witness.d.ts","sourceRoot":"","sources":["../../src/trees/public_data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toFields()
|
|
49
49
|
];
|
|
50
50
|
}
|
|
51
|
+
/**
|
|
52
|
+
* Returns a representation of the public data witness as expected by intrinsic Noir deserialization.
|
|
53
|
+
*/ toNoirRepresentation() {
|
|
54
|
+
// TODO(#12874): remove the stupid as string conversion by modifying ForeignCallOutput type in acvm.js
|
|
55
|
+
return [
|
|
56
|
+
new Fr(this.index).toString(),
|
|
57
|
+
new Fr(this.leafPreimage.slot).toString(),
|
|
58
|
+
new Fr(this.leafPreimage.value).toString(),
|
|
59
|
+
new Fr(this.leafPreimage.nextSlot).toString(),
|
|
60
|
+
new Fr(this.leafPreimage.nextIndex).toString(),
|
|
61
|
+
this.siblingPath.toFields().map((fr)=>fr.toString())
|
|
62
|
+
];
|
|
63
|
+
}
|
|
51
64
|
toBuffer() {
|
|
52
65
|
return serializeToBuffer([
|
|
53
66
|
this.index,
|
|
@@ -59,8 +59,8 @@ export declare class CallContext {
|
|
|
59
59
|
}, "strip", z.ZodTypeAny, {
|
|
60
60
|
contractAddress: AztecAddress;
|
|
61
61
|
msgSender: AztecAddress;
|
|
62
|
-
functionSelector: FunctionSelector;
|
|
63
62
|
isStaticCall: boolean;
|
|
63
|
+
functionSelector: FunctionSelector;
|
|
64
64
|
}, {
|
|
65
65
|
isStaticCall: boolean;
|
|
66
66
|
contractAddress?: any;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
/// <reference types="node" resolution-mode="require"/>
|
|
3
3
|
import { Fr } from '@aztec/foundation/fields';
|
|
4
4
|
import { BufferReader } from '@aztec/foundation/serialize';
|
|
5
|
+
import type { FieldsOf } from '@aztec/foundation/types';
|
|
5
6
|
import { type ZodFor } from '../schemas/schemas.js';
|
|
6
7
|
/**
|
|
7
8
|
* A container for storing a list of values and their hash.
|
|
@@ -15,12 +16,23 @@ export declare class HashedValues {
|
|
|
15
16
|
* The hash of the raw values
|
|
16
17
|
*/
|
|
17
18
|
readonly hash: Fr;
|
|
18
|
-
|
|
19
|
+
constructor(
|
|
20
|
+
/**
|
|
21
|
+
* Raw values.
|
|
22
|
+
*/
|
|
23
|
+
values: Fr[],
|
|
24
|
+
/**
|
|
25
|
+
* The hash of the raw values
|
|
26
|
+
*/
|
|
27
|
+
hash: Fr);
|
|
28
|
+
getSize(): number;
|
|
19
29
|
static get schema(): ZodFor<HashedValues>;
|
|
20
|
-
|
|
21
|
-
static
|
|
22
|
-
static
|
|
30
|
+
static from(fields: FieldsOf<HashedValues>): HashedValues;
|
|
31
|
+
static getFields(fields: FieldsOf<HashedValues>): readonly [Fr[], Fr];
|
|
32
|
+
static random(): HashedValues;
|
|
23
33
|
toBuffer(): Buffer;
|
|
24
34
|
static fromBuffer(buffer: Buffer | BufferReader): HashedValues;
|
|
35
|
+
static fromArgs(args: Fr[]): Promise<HashedValues>;
|
|
36
|
+
static fromCalldata(calldata: Fr[]): Promise<HashedValues>;
|
|
25
37
|
}
|
|
26
38
|
//# sourceMappingURL=hashed_values.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hashed_values.d.ts","sourceRoot":"","sources":["../../src/tx/hashed_values.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAqB,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"hashed_values.d.ts","sourceRoot":"","sources":["../../src/tx/hashed_values.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAqB,MAAM,6BAA6B,CAAC;AAC9E,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAKxD,OAAO,EAAE,KAAK,MAAM,EAAW,MAAM,uBAAuB,CAAC;AAG7D;;GAEG;AACH,qBAAa,YAAY;IAErB;;OAEG;aACa,MAAM,EAAE,EAAE,EAAE;IAC5B;;OAEG;aACa,IAAI,EAAE,EAAE;;IAPxB;;OAEG;IACa,MAAM,EAAE,EAAE,EAAE;IAC5B;;OAEG;IACa,IAAI,EAAE,EAAE;IAG1B,OAAO;IAIP,MAAM,KAAK,MAAM,IAAI,MAAM,CAAC,YAAY,CAAC,CAOxC;IAED,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,QAAQ,CAAC,YAAY,CAAC,GAAG,YAAY;IAIzD,MAAM,CAAC,SAAS,CAAC,MAAM,EAAE,QAAQ,CAAC,YAAY,CAAC;IAI/C,MAAM,CAAC,MAAM;IAIb,QAAQ;IAIR,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY,GAAG,YAAY;WAMjD,QAAQ,CAAC,IAAI,EAAE,EAAE,EAAE;WAKnB,YAAY,CAAC,QAAQ,EAAE,EAAE,EAAE;CAGzC"}
|
package/dest/tx/hashed_values.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Fr } from '@aztec/foundation/fields';
|
|
2
2
|
import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
3
3
|
import { z } from 'zod';
|
|
4
|
-
import { computeVarArgsHash } from '../hash/index.js';
|
|
4
|
+
import { computeCalldataHash, computeVarArgsHash } from '../hash/index.js';
|
|
5
5
|
import { schemas } from '../schemas/schemas.js';
|
|
6
6
|
import { Vector } from '../types/index.js';
|
|
7
7
|
/**
|
|
@@ -17,20 +17,29 @@ import { Vector } from '../types/index.js';
|
|
|
17
17
|
this.values = values;
|
|
18
18
|
this.hash = hash;
|
|
19
19
|
}
|
|
20
|
+
getSize() {
|
|
21
|
+
return this.values.length + 1 /* hash */ ;
|
|
22
|
+
}
|
|
20
23
|
static get schema() {
|
|
21
|
-
return z.
|
|
24
|
+
return z.object({
|
|
25
|
+
values: z.array(schemas.Fr),
|
|
26
|
+
hash: schemas.Fr
|
|
27
|
+
}).transform(HashedValues.from);
|
|
28
|
+
}
|
|
29
|
+
static from(fields) {
|
|
30
|
+
return new HashedValues(...HashedValues.getFields(fields));
|
|
22
31
|
}
|
|
23
|
-
|
|
24
|
-
return
|
|
32
|
+
static getFields(fields) {
|
|
33
|
+
return [
|
|
34
|
+
fields.values,
|
|
35
|
+
fields.hash
|
|
36
|
+
];
|
|
25
37
|
}
|
|
26
38
|
static random() {
|
|
27
|
-
return HashedValues
|
|
39
|
+
return new HashedValues([
|
|
28
40
|
Fr.random(),
|
|
29
41
|
Fr.random()
|
|
30
|
-
]);
|
|
31
|
-
}
|
|
32
|
-
static async fromValues(values) {
|
|
33
|
-
return new HashedValues(values, await computeVarArgsHash(values));
|
|
42
|
+
], Fr.random());
|
|
34
43
|
}
|
|
35
44
|
toBuffer() {
|
|
36
45
|
return serializeToBuffer(new Vector(this.values), this.hash);
|
|
@@ -39,4 +48,12 @@ import { Vector } from '../types/index.js';
|
|
|
39
48
|
const reader = BufferReader.asReader(buffer);
|
|
40
49
|
return new HashedValues(reader.readVector(Fr), Fr.fromBuffer(reader));
|
|
41
50
|
}
|
|
51
|
+
// Computes the hash of input arguments or return values for private functions, or for authwit creation.
|
|
52
|
+
static async fromArgs(args) {
|
|
53
|
+
return new HashedValues(args, await computeVarArgsHash(args));
|
|
54
|
+
}
|
|
55
|
+
// Computes the hash of calldata for public functions.
|
|
56
|
+
static async fromCalldata(calldata) {
|
|
57
|
+
return new HashedValues(calldata, await computeCalldataHash(calldata));
|
|
58
|
+
}
|
|
42
59
|
}
|
package/dest/tx/index.d.ts
CHANGED
|
@@ -11,11 +11,13 @@ export * from './tx_constant_data.js';
|
|
|
11
11
|
export * from './tx_context.js';
|
|
12
12
|
export * from './tx_request.js';
|
|
13
13
|
export * from './private_execution_result.js';
|
|
14
|
-
export * from './
|
|
14
|
+
export * from './public_call_request_with_calldata.js';
|
|
15
15
|
export * from './tx_hash.js';
|
|
16
16
|
export * from './tx_receipt.js';
|
|
17
17
|
export * from './tx.js';
|
|
18
18
|
export * from './processed_tx.js';
|
|
19
|
+
export * from './proven_tx.js';
|
|
20
|
+
export * from './profiled_tx.js';
|
|
19
21
|
export * from './simulated_tx.js';
|
|
20
22
|
export * from './tx_effect.js';
|
|
21
23
|
export * from './public_simulation_output.js';
|
package/dest/tx/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tx/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC;AACrC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,+BAA+B,CAAC;AAC9C,cAAc
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tx/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC;AACrC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,wCAAwC,CAAC;AACvD,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,SAAS,CAAC;AACxB,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,+BAA+B,CAAC;AAC9C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,cAAc,CAAC;AAC7B,cAAc,8BAA8B,CAAC;AAC7C,cAAc,oBAAoB,CAAC"}
|
package/dest/tx/index.js
CHANGED
|
@@ -11,11 +11,13 @@ export * from './tx_constant_data.js';
|
|
|
11
11
|
export * from './tx_context.js';
|
|
12
12
|
export * from './tx_request.js';
|
|
13
13
|
export * from './private_execution_result.js';
|
|
14
|
-
export * from './
|
|
14
|
+
export * from './public_call_request_with_calldata.js';
|
|
15
15
|
export * from './tx_hash.js';
|
|
16
16
|
export * from './tx_receipt.js';
|
|
17
17
|
export * from './tx.js';
|
|
18
18
|
export * from './processed_tx.js';
|
|
19
|
+
export * from './proven_tx.js';
|
|
20
|
+
export * from './profiled_tx.js';
|
|
19
21
|
export * from './simulated_tx.js';
|
|
20
22
|
export * from './tx_effect.js';
|
|
21
23
|
export * from './public_simulation_output.js';
|
|
@@ -9,7 +9,7 @@ import type { IsEmpty } from '../kernel/utils/interfaces.js';
|
|
|
9
9
|
import { ContractClassLog } from '../logs/contract_class_log.js';
|
|
10
10
|
import { Note } from '../note/note.js';
|
|
11
11
|
import { type ZodFor } from '../schemas/index.js';
|
|
12
|
-
import {
|
|
12
|
+
import { HashedValues } from './hashed_values.js';
|
|
13
13
|
/**
|
|
14
14
|
* The contents of a new note.
|
|
15
15
|
*/
|
|
@@ -79,25 +79,24 @@ export declare class CountedContractClassLog implements IsEmpty {
|
|
|
79
79
|
}): CountedContractClassLog;
|
|
80
80
|
isEmpty(): boolean;
|
|
81
81
|
}
|
|
82
|
-
export declare class CountedPublicExecutionRequest {
|
|
83
|
-
request: PublicExecutionRequest;
|
|
84
|
-
counter: number;
|
|
85
|
-
constructor(request: PublicExecutionRequest, counter: number);
|
|
86
|
-
static get schema(): ZodFor<CountedPublicExecutionRequest>;
|
|
87
|
-
static from(fields: FieldsOf<CountedPublicExecutionRequest>): CountedPublicExecutionRequest;
|
|
88
|
-
isEmpty(): boolean;
|
|
89
|
-
static random(): Promise<CountedPublicExecutionRequest>;
|
|
90
|
-
}
|
|
91
82
|
export declare class PrivateExecutionResult {
|
|
92
83
|
entrypoint: PrivateCallExecutionResult;
|
|
93
84
|
/** The first non revertible nullifier, or zero if there was none. */
|
|
94
85
|
firstNullifier: Fr;
|
|
86
|
+
/** An array of calldata for the enqueued public function calls and the teardown function call. */
|
|
87
|
+
publicFunctionCalldata: HashedValues[];
|
|
95
88
|
constructor(entrypoint: PrivateCallExecutionResult,
|
|
96
89
|
/** The first non revertible nullifier, or zero if there was none. */
|
|
97
|
-
firstNullifier: Fr
|
|
90
|
+
firstNullifier: Fr,
|
|
91
|
+
/** An array of calldata for the enqueued public function calls and the teardown function call. */
|
|
92
|
+
publicFunctionCalldata: HashedValues[]);
|
|
98
93
|
static get schema(): ZodFor<PrivateExecutionResult>;
|
|
99
94
|
static from(fields: FieldsOf<PrivateExecutionResult>): PrivateExecutionResult;
|
|
100
95
|
static random(nested?: number): Promise<PrivateExecutionResult>;
|
|
96
|
+
/**
|
|
97
|
+
* The block number that this execution was simulated with.
|
|
98
|
+
*/
|
|
99
|
+
getSimulationBlockNumber(): number;
|
|
101
100
|
}
|
|
102
101
|
/**
|
|
103
102
|
* The result of executing a call to a private function.
|
|
@@ -121,10 +120,6 @@ export declare class PrivateCallExecutionResult {
|
|
|
121
120
|
returnValues: Fr[];
|
|
122
121
|
/** The nested executions. */
|
|
123
122
|
nestedExecutions: PrivateCallExecutionResult[];
|
|
124
|
-
/** Enqueued public function execution requests to be picked up by the sequencer. */
|
|
125
|
-
enqueuedPublicFunctionCalls: CountedPublicExecutionRequest[];
|
|
126
|
-
/** Public function execution requested for teardown */
|
|
127
|
-
publicTeardownFunctionCall: PublicExecutionRequest;
|
|
128
123
|
/**
|
|
129
124
|
* Contract class logs emitted during execution of this function call.
|
|
130
125
|
* Note: These are preimages to `contractClassLogsHashes`.
|
|
@@ -149,10 +144,6 @@ export declare class PrivateCallExecutionResult {
|
|
|
149
144
|
returnValues: Fr[],
|
|
150
145
|
/** The nested executions. */
|
|
151
146
|
nestedExecutions: PrivateCallExecutionResult[],
|
|
152
|
-
/** Enqueued public function execution requests to be picked up by the sequencer. */
|
|
153
|
-
enqueuedPublicFunctionCalls: CountedPublicExecutionRequest[],
|
|
154
|
-
/** Public function execution requested for teardown */
|
|
155
|
-
publicTeardownFunctionCall: PublicExecutionRequest,
|
|
156
147
|
/**
|
|
157
148
|
* Contract class logs emitted during execution of this function call.
|
|
158
149
|
* Note: These are preimages to `contractClassLogsHashes`.
|
|
@@ -170,13 +161,6 @@ export declare function collectNoteHashNullifierCounterMap(execResult: PrivateEx
|
|
|
170
161
|
* @returns All contract class logs.
|
|
171
162
|
*/
|
|
172
163
|
export declare function collectSortedContractClassLogs(execResult: PrivateExecutionResult): ContractClassLog[];
|
|
173
|
-
/**
|
|
174
|
-
* Collect all enqueued public function calls across all nested executions.
|
|
175
|
-
* @param execResult - The topmost execution result.
|
|
176
|
-
* @returns All enqueued public function calls.
|
|
177
|
-
*/
|
|
178
|
-
export declare function collectEnqueuedPublicFunctionCalls(execResult: PrivateExecutionResult): PublicExecutionRequest[];
|
|
179
|
-
export declare function collectPublicTeardownFunctionCall(execResult: PrivateExecutionResult): PublicExecutionRequest;
|
|
180
164
|
export declare function getFinalMinRevertibleSideEffectCounter(execResult: PrivateExecutionResult): number;
|
|
181
165
|
export declare function collectNested<T>(executionStack: PrivateCallExecutionResult[], extractExecutionItems: (execution: PrivateCallExecutionResult) => T[]): T[];
|
|
182
166
|
//# sourceMappingURL=private_execution_result.d.ts.map
|
|
@@ -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,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAE,KAAK,MAAM,EAAsB,MAAM,qBAAqB,CAAC;AACtE,OAAO,EAAE,
|
|
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,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAE,KAAK,MAAM,EAAsB,MAAM,qBAAqB,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD;;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;IAC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,UAAU,EAAE,sBAAsB,uBAWpF;AAWD;;;;GAIG;AACH,wBAAgB,8BAA8B,CAAC,UAAU,EAAE,sBAAsB,GAAG,gBAAgB,EAAE,CAIrG;AAED,wBAAgB,sCAAsC,CAAC,UAAU,EAAE,sBAAsB,GAAG,MAAM,CAQjG;AAED,wBAAgB,aAAa,CAAC,CAAC,EAC7B,cAAc,EAAE,0BAA0B,EAAE,EAC5C,qBAAqB,EAAE,CAAC,SAAS,EAAE,0BAA0B,KAAK,CAAC,EAAE,GACpE,CAAC,EAAE,CAML"}
|
|
@@ -8,7 +8,7 @@ import { sortByCounter } from '../kernel/utils/order_and_comparison.js';
|
|
|
8
8
|
import { ContractClassLog } from '../logs/contract_class_log.js';
|
|
9
9
|
import { Note } from '../note/note.js';
|
|
10
10
|
import { mapSchema, schemas } from '../schemas/index.js';
|
|
11
|
-
import {
|
|
11
|
+
import { HashedValues } from './hashed_values.js';
|
|
12
12
|
/**
|
|
13
13
|
* The contents of a new note.
|
|
14
14
|
*/ export class NoteAndSlot {
|
|
@@ -54,47 +54,35 @@ export class CountedContractClassLog {
|
|
|
54
54
|
return this.log.isEmpty() && !this.counter;
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
|
-
export class CountedPublicExecutionRequest {
|
|
58
|
-
request;
|
|
59
|
-
counter;
|
|
60
|
-
constructor(request, counter){
|
|
61
|
-
this.request = request;
|
|
62
|
-
this.counter = counter;
|
|
63
|
-
}
|
|
64
|
-
static get schema() {
|
|
65
|
-
return z.object({
|
|
66
|
-
request: PublicExecutionRequest.schema,
|
|
67
|
-
counter: schemas.Integer
|
|
68
|
-
}).transform(CountedPublicExecutionRequest.from);
|
|
69
|
-
}
|
|
70
|
-
static from(fields) {
|
|
71
|
-
return new CountedPublicExecutionRequest(fields.request, fields.counter);
|
|
72
|
-
}
|
|
73
|
-
isEmpty() {
|
|
74
|
-
return this.request.isEmpty() && !this.counter;
|
|
75
|
-
}
|
|
76
|
-
static async random() {
|
|
77
|
-
return new CountedPublicExecutionRequest(await PublicExecutionRequest.random(), 0);
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
57
|
export class PrivateExecutionResult {
|
|
81
58
|
entrypoint;
|
|
82
59
|
firstNullifier;
|
|
83
|
-
|
|
60
|
+
publicFunctionCalldata;
|
|
61
|
+
constructor(entrypoint, /** The first non revertible nullifier, or zero if there was none. */ firstNullifier, /** An array of calldata for the enqueued public function calls and the teardown function call. */ publicFunctionCalldata){
|
|
84
62
|
this.entrypoint = entrypoint;
|
|
85
63
|
this.firstNullifier = firstNullifier;
|
|
64
|
+
this.publicFunctionCalldata = publicFunctionCalldata;
|
|
86
65
|
}
|
|
87
66
|
static get schema() {
|
|
88
67
|
return z.object({
|
|
89
68
|
entrypoint: PrivateCallExecutionResult.schema,
|
|
90
|
-
firstNullifier: schemas.Fr
|
|
69
|
+
firstNullifier: schemas.Fr,
|
|
70
|
+
publicFunctionCalldata: z.array(HashedValues.schema)
|
|
91
71
|
}).transform(PrivateExecutionResult.from);
|
|
92
72
|
}
|
|
93
73
|
static from(fields) {
|
|
94
|
-
return new PrivateExecutionResult(fields.entrypoint, fields.firstNullifier);
|
|
74
|
+
return new PrivateExecutionResult(fields.entrypoint, fields.firstNullifier, fields.publicFunctionCalldata);
|
|
95
75
|
}
|
|
96
76
|
static async random(nested = 1) {
|
|
97
|
-
return new PrivateExecutionResult(await PrivateCallExecutionResult.random(nested), Fr.random()
|
|
77
|
+
return new PrivateExecutionResult(await PrivateCallExecutionResult.random(nested), Fr.random(), [
|
|
78
|
+
HashedValues.random(),
|
|
79
|
+
HashedValues.random()
|
|
80
|
+
]);
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* The block number that this execution was simulated with.
|
|
84
|
+
*/ getSimulationBlockNumber() {
|
|
85
|
+
return this.entrypoint.publicInputs.historicalHeader.globalVariables.blockNumber.toNumber();
|
|
98
86
|
}
|
|
99
87
|
}
|
|
100
88
|
/**
|
|
@@ -109,12 +97,10 @@ export class PrivateExecutionResult {
|
|
|
109
97
|
noteHashNullifierCounterMap;
|
|
110
98
|
returnValues;
|
|
111
99
|
nestedExecutions;
|
|
112
|
-
enqueuedPublicFunctionCalls;
|
|
113
|
-
publicTeardownFunctionCall;
|
|
114
100
|
contractClassLogs;
|
|
115
101
|
constructor(// Needed for prover
|
|
116
102
|
/** The ACIR bytecode. */ acir, /** The verification key. */ vk, /** The partial witness. */ partialWitness, // Needed for the verifier (kernel)
|
|
117
|
-
/** 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 nested executions. */ nestedExecutions, /**
|
|
103
|
+
/** 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 nested executions. */ nestedExecutions, /**
|
|
118
104
|
* Contract class logs emitted during execution of this function call.
|
|
119
105
|
* Note: These are preimages to `contractClassLogsHashes`.
|
|
120
106
|
*/ contractClassLogs){
|
|
@@ -127,8 +113,6 @@ export class PrivateExecutionResult {
|
|
|
127
113
|
this.noteHashNullifierCounterMap = noteHashNullifierCounterMap;
|
|
128
114
|
this.returnValues = returnValues;
|
|
129
115
|
this.nestedExecutions = nestedExecutions;
|
|
130
|
-
this.enqueuedPublicFunctionCalls = enqueuedPublicFunctionCalls;
|
|
131
|
-
this.publicTeardownFunctionCall = publicTeardownFunctionCall;
|
|
132
116
|
this.contractClassLogs = contractClassLogs;
|
|
133
117
|
}
|
|
134
118
|
static get schema() {
|
|
@@ -142,13 +126,11 @@ export class PrivateExecutionResult {
|
|
|
142
126
|
noteHashNullifierCounterMap: mapSchema(z.coerce.number(), z.number()),
|
|
143
127
|
returnValues: z.array(schemas.Fr),
|
|
144
128
|
nestedExecutions: z.array(z.lazy(()=>PrivateCallExecutionResult.schema)),
|
|
145
|
-
enqueuedPublicFunctionCalls: z.array(CountedPublicExecutionRequest.schema),
|
|
146
|
-
publicTeardownFunctionCall: PublicExecutionRequest.schema,
|
|
147
129
|
contractClassLogs: z.array(CountedContractClassLog.schema)
|
|
148
130
|
}).transform(PrivateCallExecutionResult.from);
|
|
149
131
|
}
|
|
150
132
|
static from(fields) {
|
|
151
|
-
return new PrivateCallExecutionResult(fields.acir, fields.vk, fields.partialWitness, fields.publicInputs, fields.noteHashLeafIndexMap, fields.newNotes, fields.noteHashNullifierCounterMap, fields.returnValues, fields.nestedExecutions, fields.
|
|
133
|
+
return new PrivateCallExecutionResult(fields.acir, fields.vk, fields.partialWitness, fields.publicInputs, fields.noteHashLeafIndexMap, fields.newNotes, fields.noteHashNullifierCounterMap, fields.returnValues, fields.nestedExecutions, fields.contractClassLogs);
|
|
152
134
|
}
|
|
153
135
|
static async random(nested = 1) {
|
|
154
136
|
return new PrivateCallExecutionResult(randomBytes(4), randomBytes(4), new Map([
|
|
@@ -171,8 +153,6 @@ export class PrivateExecutionResult {
|
|
|
171
153
|
]), [
|
|
172
154
|
Fr.random()
|
|
173
155
|
], await timesParallel(nested, ()=>PrivateCallExecutionResult.random(0)), [
|
|
174
|
-
await CountedPublicExecutionRequest.random()
|
|
175
|
-
], await PublicExecutionRequest.random(), [
|
|
176
156
|
new CountedContractClassLog(await ContractClassLog.random(), randomInt(10))
|
|
177
157
|
]);
|
|
178
158
|
}
|
|
@@ -214,38 +194,6 @@ export function collectNoteHashNullifierCounterMap(execResult) {
|
|
|
214
194
|
const sortedLogs = sortByCounter(allLogs);
|
|
215
195
|
return sortedLogs.map((l)=>l.log);
|
|
216
196
|
}
|
|
217
|
-
function collectEnqueuedCountedPublicExecutionRequests(execResult) {
|
|
218
|
-
return [
|
|
219
|
-
...execResult.enqueuedPublicFunctionCalls,
|
|
220
|
-
...execResult.nestedExecutions.flatMap(collectEnqueuedCountedPublicExecutionRequests)
|
|
221
|
-
];
|
|
222
|
-
}
|
|
223
|
-
/**
|
|
224
|
-
* Collect all enqueued public function calls across all nested executions.
|
|
225
|
-
* @param execResult - The topmost execution result.
|
|
226
|
-
* @returns All enqueued public function calls.
|
|
227
|
-
*/ export function collectEnqueuedPublicFunctionCalls(execResult) {
|
|
228
|
-
const countedRequests = collectEnqueuedCountedPublicExecutionRequests(execResult.entrypoint);
|
|
229
|
-
// without the reverse sort, the logs will be in a queue like fashion which is wrong
|
|
230
|
-
// as the kernel processes it like a stack, popping items off and pushing them to output
|
|
231
|
-
return sortByCounter(countedRequests, false).map((r)=>r.request);
|
|
232
|
-
}
|
|
233
|
-
export function collectPublicTeardownFunctionCall(execResult) {
|
|
234
|
-
const collectPublicTeardownFunctionCallRecursive = (callResult)=>{
|
|
235
|
-
return [
|
|
236
|
-
callResult.publicTeardownFunctionCall,
|
|
237
|
-
...callResult.nestedExecutions.flatMap(collectPublicTeardownFunctionCallRecursive)
|
|
238
|
-
].filter((call)=>!call.isEmpty());
|
|
239
|
-
};
|
|
240
|
-
const teardownCalls = collectPublicTeardownFunctionCallRecursive(execResult.entrypoint);
|
|
241
|
-
if (teardownCalls.length === 1) {
|
|
242
|
-
return teardownCalls[0];
|
|
243
|
-
}
|
|
244
|
-
if (teardownCalls.length > 1) {
|
|
245
|
-
throw new Error('Multiple public teardown calls detected');
|
|
246
|
-
}
|
|
247
|
-
return PublicExecutionRequest.empty();
|
|
248
|
-
}
|
|
249
197
|
export function getFinalMinRevertibleSideEffectCounter(execResult) {
|
|
250
198
|
const collectFinalMinRevertibleSideEffectCounterRecursive = (callResult)=>{
|
|
251
199
|
return callResult.nestedExecutions.reduce((counter, exec)=>{
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ZodFor } from '@aztec/foundation/schemas';
|
|
2
|
+
import { type PrivateExecutionStep } from '../kernel/private_kernel_prover_output.js';
|
|
3
|
+
export declare class TxProfileResult {
|
|
4
|
+
executionSteps: PrivateExecutionStep[];
|
|
5
|
+
constructor(executionSteps: PrivateExecutionStep[]);
|
|
6
|
+
static get schema(): ZodFor<TxProfileResult>;
|
|
7
|
+
static random(): TxProfileResult;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=profiled_tx.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profiled_tx.d.ts","sourceRoot":"","sources":["../../src/tx/profiled_tx.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AAIxD,OAAO,EAAE,KAAK,oBAAoB,EAA8B,MAAM,2CAA2C,CAAC;AAElH,qBAAa,eAAe;IACP,cAAc,EAAE,oBAAoB,EAAE;gBAAtC,cAAc,EAAE,oBAAoB,EAAE;IAEzD,MAAM,KAAK,MAAM,IAAI,MAAM,CAAC,eAAe,CAAC,CAM3C;IAED,MAAM,CAAC,MAAM,IAAI,eAAe;CASjC"}
|