@aztec/stdlib 5.0.0-rc.1 → 5.0.0
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/buffer.d.ts +6 -2
- package/dest/abi/buffer.d.ts.map +1 -1
- package/dest/abi/buffer.js +13 -1
- package/dest/avm/avm.js +1 -1
- package/dest/aztec-address/index.d.ts +35 -5
- package/dest/aztec-address/index.d.ts.map +1 -1
- package/dest/aztec-address/index.js +32 -8
- package/dest/block/attestation_info.d.ts +1 -1
- package/dest/block/attestation_info.d.ts.map +1 -1
- package/dest/block/attestation_info.js +7 -4
- package/dest/block/l2_block_source.d.ts +44 -27
- package/dest/block/l2_block_source.d.ts.map +1 -1
- package/dest/block/l2_block_source.js +15 -1
- package/dest/block/l2_block_stream/event_driven_l2_block_stream.d.ts +39 -0
- package/dest/block/l2_block_stream/event_driven_l2_block_stream.d.ts.map +1 -0
- package/dest/block/l2_block_stream/event_driven_l2_block_stream.js +165 -0
- package/dest/block/l2_block_stream/index.d.ts +2 -1
- package/dest/block/l2_block_stream/index.d.ts.map +1 -1
- package/dest/block/l2_block_stream/index.js +1 -0
- package/dest/block/l2_block_stream/interfaces.d.ts +40 -6
- package/dest/block/l2_block_stream/interfaces.d.ts.map +1 -1
- package/dest/block/l2_block_stream/interfaces.js +25 -1
- package/dest/block/l2_block_stream/l2_block_stream.d.ts +23 -15
- package/dest/block/l2_block_stream/l2_block_stream.d.ts.map +1 -1
- package/dest/block/l2_block_stream/l2_block_stream.js +140 -152
- package/dest/block/l2_block_stream/l2_tips_store_base.d.ts +10 -2
- package/dest/block/l2_block_stream/l2_tips_store_base.d.ts.map +1 -1
- package/dest/block/l2_block_stream/l2_tips_store_base.js +33 -15
- package/dest/block/proposal/attestations_and_signers.d.ts +19 -1
- package/dest/block/proposal/attestations_and_signers.d.ts.map +1 -1
- package/dest/block/proposal/attestations_and_signers.js +47 -7
- package/dest/block/test/l2_tips_store_test_suite.d.ts +1 -1
- package/dest/block/test/l2_tips_store_test_suite.d.ts.map +1 -1
- package/dest/block/test/l2_tips_store_test_suite.js +94 -3
- package/dest/block/validate_block_result.d.ts +16 -1
- package/dest/block/validate_block_result.d.ts.map +1 -1
- package/dest/block/validate_block_result.js +18 -3
- package/dest/checkpoint/index.d.ts +2 -1
- package/dest/checkpoint/index.d.ts.map +1 -1
- package/dest/checkpoint/index.js +1 -0
- package/dest/checkpoint/simulation_overrides.d.ts +61 -0
- package/dest/checkpoint/simulation_overrides.d.ts.map +1 -0
- package/dest/checkpoint/simulation_overrides.js +98 -0
- package/dest/config/network-consensus-config.d.ts +1 -1
- package/dest/config/network-consensus-config.d.ts.map +1 -1
- package/dest/config/network-consensus-config.js +2 -10
- package/dest/contract/contract_address.d.ts +5 -4
- package/dest/contract/contract_address.d.ts.map +1 -1
- package/dest/contract/contract_instance.d.ts +16 -2
- package/dest/contract/contract_instance.d.ts.map +1 -1
- package/dest/contract/contract_instance.js +45 -0
- package/dest/contract/interfaces/contract_data_source.d.ts +3 -5
- package/dest/contract/interfaces/contract_data_source.d.ts.map +1 -1
- package/dest/contract/interfaces/contract_instance.d.ts +71 -10
- package/dest/contract/interfaces/contract_instance.d.ts.map +1 -1
- package/dest/contract/interfaces/contract_instance.js +7 -2
- package/dest/contract/partial_address.d.ts +9 -3
- package/dest/contract/partial_address.d.ts.map +1 -1
- package/dest/contract/partial_address.js +8 -2
- package/dest/database-version/version_manager.d.ts +18 -4
- package/dest/database-version/version_manager.d.ts.map +1 -1
- package/dest/database-version/version_manager.js +76 -6
- package/dest/file-store/factory.d.ts +1 -1
- package/dest/file-store/factory.d.ts.map +1 -1
- package/dest/file-store/factory.js +7 -0
- package/dest/file-store/index.d.ts +2 -1
- package/dest/file-store/index.d.ts.map +1 -1
- package/dest/file-store/index.js +1 -0
- package/dest/file-store/memory.d.ts +24 -0
- package/dest/file-store/memory.d.ts.map +1 -0
- package/dest/file-store/memory.js +80 -0
- package/dest/ha-signing/config.d.ts +19 -5
- package/dest/ha-signing/config.d.ts.map +1 -1
- package/dest/ha-signing/config.js +9 -3
- package/dest/ha-signing/local_config.d.ts +10 -2
- package/dest/ha-signing/local_config.d.ts.map +1 -1
- package/dest/ha-signing/local_config.js +8 -2
- package/dest/hash/hash.d.ts +1 -2
- package/dest/hash/hash.d.ts.map +1 -1
- package/dest/hash/hash.js +0 -7
- package/dest/interfaces/archiver.d.ts +8 -1
- package/dest/interfaces/archiver.d.ts.map +1 -1
- package/dest/interfaces/archiver.js +3 -2
- package/dest/interfaces/aztec-node-admin.d.ts +5 -2
- package/dest/interfaces/aztec-node-admin.d.ts.map +1 -1
- package/dest/interfaces/aztec-node-debug.d.ts +26 -1
- package/dest/interfaces/aztec-node-debug.d.ts.map +1 -1
- package/dest/interfaces/aztec-node-debug.js +20 -0
- package/dest/interfaces/aztec-node.d.ts +20 -20
- package/dest/interfaces/aztec-node.d.ts.map +1 -1
- package/dest/interfaces/aztec-node.js +8 -15
- package/dest/interfaces/chain_tips.d.ts +8 -47
- package/dest/interfaces/chain_tips.d.ts.map +1 -1
- package/dest/interfaces/chain_tips.js +1 -6
- package/dest/interfaces/checkpoint_parameter.d.ts +3 -3
- package/dest/interfaces/checkpoint_parameter.d.ts.map +1 -1
- package/dest/interfaces/checkpoint_parameter.js +3 -3
- package/dest/interfaces/configs.d.ts +4 -1
- package/dest/interfaces/configs.d.ts.map +1 -1
- package/dest/interfaces/configs.js +1 -0
- package/dest/interfaces/private_kernel_prover.d.ts +9 -11
- package/dest/interfaces/private_kernel_prover.d.ts.map +1 -1
- package/dest/interfaces/prover-node.d.ts +6 -7
- package/dest/interfaces/prover-node.d.ts.map +1 -1
- package/dest/interfaces/prover-node.js +15 -10
- package/dest/interfaces/proving-job.d.ts +87 -74
- package/dest/interfaces/proving-job.d.ts.map +1 -1
- package/dest/interfaces/proving-job.js +13 -4
- package/dest/interfaces/server_circuit_prover.d.ts +3 -3
- package/dest/interfaces/server_circuit_prover.d.ts.map +1 -1
- package/dest/interfaces/validator.d.ts +7 -3
- package/dest/interfaces/validator.d.ts.map +1 -1
- package/dest/interfaces/world_state.d.ts +14 -1
- package/dest/interfaces/world_state.d.ts.map +1 -1
- package/dest/kernel/hints/find_private_kernel_reset_dimensions.d.ts +8 -2
- package/dest/kernel/hints/find_private_kernel_reset_dimensions.d.ts.map +1 -1
- package/dest/kernel/hints/find_private_kernel_reset_dimensions.js +12 -74
- package/dest/kernel/hints/read_request.js +1 -1
- package/dest/kernel/index.d.ts +2 -2
- package/dest/kernel/index.d.ts.map +1 -1
- package/dest/kernel/index.js +1 -1
- package/dest/kernel/log_hash.d.ts +1 -1
- package/dest/kernel/log_hash.d.ts.map +1 -1
- package/dest/kernel/log_hash.js +2 -2
- package/dest/kernel/note_hash.js +1 -1
- package/dest/kernel/nullifier.js +1 -1
- package/dest/kernel/private_circuit_public_inputs.d.ts +13 -3
- package/dest/kernel/private_circuit_public_inputs.d.ts.map +1 -1
- package/dest/kernel/private_circuit_public_inputs.js +14 -7
- package/dest/kernel/private_context_inputs.d.ts +4 -3
- package/dest/kernel/private_context_inputs.d.ts.map +1 -1
- package/dest/kernel/private_context_inputs.js +7 -3
- package/dest/kernel/private_kernel_circuit_public_inputs.d.ts +7 -1
- package/dest/kernel/private_kernel_circuit_public_inputs.d.ts.map +1 -1
- package/dest/kernel/private_kernel_circuit_public_inputs.js +7 -0
- package/dest/kernel/private_kernel_init_2_circuit_private_inputs.d.ts +2 -3
- package/dest/kernel/private_kernel_init_2_circuit_private_inputs.d.ts.map +1 -1
- package/dest/kernel/private_kernel_init_2_circuit_private_inputs.js +3 -5
- package/dest/kernel/private_kernel_init_3_circuit_private_inputs.d.ts +2 -3
- package/dest/kernel/private_kernel_init_3_circuit_private_inputs.d.ts.map +1 -1
- package/dest/kernel/private_kernel_init_3_circuit_private_inputs.js +3 -5
- package/dest/kernel/private_kernel_init_circuit_private_inputs.d.ts +1 -9
- package/dest/kernel/private_kernel_init_circuit_private_inputs.d.ts.map +1 -1
- package/dest/kernel/private_kernel_init_circuit_private_inputs.js +2 -6
- package/dest/kernel/private_kernel_reset_dimensions.d.ts +7 -8
- package/dest/kernel/private_kernel_reset_dimensions.d.ts.map +1 -1
- package/dest/kernel/private_kernel_reset_tail_circuit_private_inputs.d.ts +29 -0
- package/dest/kernel/private_kernel_reset_tail_circuit_private_inputs.d.ts.map +1 -0
- package/dest/kernel/private_kernel_reset_tail_circuit_private_inputs.js +36 -0
- package/dest/kernel/private_log_data.d.ts +1 -1
- package/dest/kernel/private_log_data.d.ts.map +1 -1
- package/dest/kernel/private_log_data.js +1 -1
- package/dest/keys/derivation.d.ts +41 -6
- package/dest/keys/derivation.d.ts.map +1 -1
- package/dest/keys/derivation.js +49 -26
- package/dest/logs/app_tagging_secret.d.ts +30 -7
- package/dest/logs/app_tagging_secret.d.ts.map +1 -1
- package/dest/logs/app_tagging_secret.js +46 -39
- package/dest/logs/contract_class_log.d.ts +1 -2
- package/dest/logs/contract_class_log.d.ts.map +1 -1
- package/dest/logs/contract_class_log.js +0 -4
- package/dest/logs/index.d.ts +1 -3
- package/dest/logs/index.d.ts.map +1 -1
- package/dest/logs/index.js +0 -2
- package/dest/logs/shared_secret_derivation.d.ts +19 -6
- package/dest/logs/shared_secret_derivation.d.ts.map +1 -1
- package/dest/logs/shared_secret_derivation.js +26 -11
- package/dest/messaging/l1_to_l2_message.d.ts +23 -2
- package/dest/messaging/l1_to_l2_message.d.ts.map +1 -1
- package/dest/messaging/l1_to_l2_message.js +36 -11
- package/dest/p2p/attestation_utils.d.ts +1 -1
- package/dest/p2p/attestation_utils.d.ts.map +1 -1
- package/dest/p2p/attestation_utils.js +8 -1
- package/dest/p2p/checkpoint_attestation.d.ts +10 -1
- package/dest/p2p/checkpoint_attestation.d.ts.map +1 -1
- package/dest/p2p/checkpoint_attestation.js +10 -0
- package/dest/p2p/checkpoint_proposal.d.ts +2 -1
- package/dest/p2p/checkpoint_proposal.d.ts.map +1 -1
- package/dest/p2p/consensus_payload.d.ts +2 -1
- package/dest/p2p/consensus_payload.d.ts.map +1 -1
- package/dest/p2p/signature_utils.d.ts +10 -1
- package/dest/p2p/signature_utils.d.ts.map +1 -1
- package/dest/p2p/signature_utils.js +9 -1
- package/dest/rollup/avm_proof_data.d.ts +3 -3
- package/dest/rollup/avm_proof_data.d.ts.map +1 -1
- package/dest/rollup/checkpoint_header.d.ts +8 -3
- package/dest/rollup/checkpoint_header.d.ts.map +1 -1
- package/dest/rollup/checkpoint_header.js +20 -10
- package/dest/stats/stats.d.ts +2 -2
- package/dest/stats/stats.d.ts.map +1 -1
- package/dest/tests/factories.d.ts +1 -1
- package/dest/tests/factories.d.ts.map +1 -1
- package/dest/tests/factories.js +7 -15
- package/dest/trees/nullifier_membership_witness.d.ts +5 -8
- package/dest/trees/nullifier_membership_witness.d.ts.map +1 -1
- package/dest/trees/nullifier_membership_witness.js +0 -9
- package/dest/trees/public_data_witness.d.ts +7 -17
- package/dest/trees/public_data_witness.d.ts.map +1 -1
- package/dest/trees/public_data_witness.js +0 -27
- package/dest/tx/execution_payload.d.ts +1 -1
- package/dest/tx/execution_payload.d.ts.map +1 -1
- package/dest/tx/execution_payload.js +1 -1
- package/dest/tx/global_variable_builder.d.ts +2 -12
- package/dest/tx/global_variable_builder.d.ts.map +1 -1
- package/dest/tx/global_variables.js +2 -2
- package/dest/tx/private_tx_constant_data.d.ts +18 -2
- package/dest/tx/private_tx_constant_data.d.ts.map +1 -1
- package/dest/tx/private_tx_constant_data.js +13 -4
- package/dest/tx/simulated_tx.d.ts +10 -6
- package/dest/tx/simulated_tx.d.ts.map +1 -1
- package/dest/world-state/genesis_data.d.ts +9 -1
- package/dest/world-state/genesis_data.d.ts.map +1 -1
- package/dest/world-state/genesis_data.js +1 -0
- package/package.json +8 -8
- package/src/abi/buffer.ts +13 -1
- package/src/avm/avm.ts +1 -1
- package/src/aztec-address/index.ts +36 -6
- package/src/block/attestation_info.ts +7 -2
- package/src/block/l2_block_source.ts +64 -17
- package/src/block/l2_block_stream/event_driven_l2_block_stream.ts +207 -0
- package/src/block/l2_block_stream/index.ts +1 -0
- package/src/block/l2_block_stream/interfaces.ts +60 -6
- package/src/block/l2_block_stream/l2_block_stream.ts +201 -178
- package/src/block/l2_block_stream/l2_tips_store_base.ts +36 -15
- package/src/block/proposal/attestations_and_signers.ts +53 -7
- package/src/block/test/l2_tips_store_test_suite.ts +73 -4
- package/src/block/validate_block_result.ts +48 -2
- package/src/checkpoint/index.ts +1 -0
- package/src/checkpoint/simulation_overrides.ts +171 -0
- package/src/config/network-consensus-config.ts +2 -13
- package/src/contract/contract_address.ts +4 -3
- package/src/contract/contract_instance.ts +62 -1
- package/src/contract/interfaces/contract_data_source.ts +2 -4
- package/src/contract/interfaces/contract_instance.ts +26 -8
- package/src/contract/partial_address.ts +8 -2
- package/src/database-version/version_manager.ts +96 -6
- package/src/file-store/factory.ts +7 -0
- package/src/file-store/index.ts +1 -0
- package/src/file-store/memory.ts +94 -0
- package/src/ha-signing/config.ts +23 -5
- package/src/ha-signing/local_config.ts +20 -1
- package/src/hash/hash.ts +0 -8
- package/src/interfaces/archiver.ts +9 -1
- package/src/interfaces/aztec-node-debug.ts +37 -0
- package/src/interfaces/aztec-node.ts +30 -33
- package/src/interfaces/chain_tips.ts +8 -16
- package/src/interfaces/checkpoint_parameter.ts +3 -3
- package/src/interfaces/configs.ts +3 -0
- package/src/interfaces/private_kernel_prover.ts +10 -12
- package/src/interfaces/prover-node.ts +19 -11
- package/src/interfaces/proving-job.ts +15 -3
- package/src/interfaces/server_circuit_prover.ts +2 -2
- package/src/interfaces/world_state.ts +14 -0
- package/src/kernel/hints/find_private_kernel_reset_dimensions.ts +22 -112
- package/src/kernel/hints/read_request.ts +1 -1
- package/src/kernel/index.ts +1 -1
- package/src/kernel/log_hash.ts +5 -2
- package/src/kernel/note_hash.ts +1 -1
- package/src/kernel/nullifier.ts +1 -1
- package/src/kernel/private_circuit_public_inputs.ts +12 -1
- package/src/kernel/private_context_inputs.ts +10 -3
- package/src/kernel/private_kernel_circuit_public_inputs.ts +9 -0
- package/src/kernel/private_kernel_init_2_circuit_private_inputs.ts +0 -3
- package/src/kernel/private_kernel_init_3_circuit_private_inputs.ts +0 -3
- package/src/kernel/private_kernel_init_circuit_private_inputs.ts +0 -6
- package/src/kernel/private_kernel_reset_dimensions.ts +15 -5
- package/src/kernel/private_kernel_reset_tail_circuit_private_inputs.ts +69 -0
- package/src/kernel/private_log_data.ts +4 -1
- package/src/keys/derivation.ts +69 -24
- package/src/logs/app_tagging_secret.ts +62 -39
- package/src/logs/contract_class_log.ts +0 -9
- package/src/logs/index.ts +0 -2
- package/src/logs/shared_secret_derivation.ts +31 -15
- package/src/messaging/l1_to_l2_message.ts +51 -13
- package/src/p2p/attestation_utils.ts +8 -1
- package/src/p2p/checkpoint_attestation.ts +12 -0
- package/src/p2p/signature_utils.ts +9 -0
- package/src/rollup/avm_proof_data.ts +2 -2
- package/src/rollup/checkpoint_header.ts +16 -2
- package/src/stats/stats.ts +2 -2
- package/src/tests/factories.ts +6 -12
- package/src/trees/nullifier_membership_witness.ts +0 -11
- package/src/trees/public_data_witness.ts +0 -31
- package/src/tx/execution_payload.ts +2 -1
- package/src/tx/global_variable_builder.ts +1 -17
- package/src/tx/global_variables.ts +2 -2
- package/src/tx/private_tx_constant_data.ts +25 -2
- package/src/world-state/genesis_data.ts +10 -0
- package/dest/kernel/private_kernel_tail_circuit_private_inputs.d.ts +0 -47
- package/dest/kernel/private_kernel_tail_circuit_private_inputs.d.ts.map +0 -1
- package/dest/kernel/private_kernel_tail_circuit_private_inputs.js +0 -38
- package/dest/logs/message_context.d.ts +0 -27
- package/dest/logs/message_context.d.ts.map +0 -1
- package/dest/logs/message_context.js +0 -74
- package/dest/logs/pending_tagged_log.d.ts +0 -13
- package/dest/logs/pending_tagged_log.d.ts.map +0 -1
- package/dest/logs/pending_tagged_log.js +0 -34
- package/src/kernel/private_kernel_tail_circuit_private_inputs.ts +0 -58
- package/src/logs/message_context.ts +0 -76
- package/src/logs/pending_tagged_log.ts +0 -39
|
@@ -2,18 +2,18 @@ import { CheckpointNumberSchema, SlotNumberSchema } from '@aztec/foundation/bran
|
|
|
2
2
|
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { CheckpointTagSchema } from './chain_tips.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Selector for a checkpoint in RPC calls.
|
|
9
9
|
*
|
|
10
10
|
* Accepts a numeric checkpoint number (or `{ number }`), a slot number (`{ slot }`),
|
|
11
|
-
* or a
|
|
11
|
+
* or a checkpoint-tip name (e.g. `'checkpointed'`, `'proven'`, `'finalized'`).
|
|
12
12
|
*/
|
|
13
13
|
export const CheckpointParameterSchema = z.union([
|
|
14
14
|
z.object({ number: CheckpointNumberSchema }).strict(),
|
|
15
15
|
z.object({ slot: SlotNumberSchema }).strict(),
|
|
16
|
-
|
|
16
|
+
CheckpointTagSchema,
|
|
17
17
|
CheckpointNumberSchema,
|
|
18
18
|
]);
|
|
19
19
|
|
|
@@ -96,6 +96,8 @@ export interface SequencerConfig {
|
|
|
96
96
|
injectHighSValueAttestation?: boolean;
|
|
97
97
|
/** Inject an attestation with an unrecoverable signature (for testing only) */
|
|
98
98
|
injectUnrecoverableSignatureAttestation?: boolean;
|
|
99
|
+
/** Inject a non-proposer attestation slot in yParity (v ∈ {0, 1}) form in the packed L1 tuple (for testing only) */
|
|
100
|
+
injectYParityAttestation?: boolean;
|
|
99
101
|
/** Whether to run in fisherman mode: builds blocks on every slot for validation without publishing */
|
|
100
102
|
fishermanMode?: boolean;
|
|
101
103
|
/** Shuffle attestation ordering to create invalid ordering (for testing only) */
|
|
@@ -165,6 +167,7 @@ export const SequencerConfigSchema = zodFor<SequencerConfig>()(
|
|
|
165
167
|
injectFakeAttestation: z.boolean().optional(),
|
|
166
168
|
injectHighSValueAttestation: z.boolean().optional(),
|
|
167
169
|
injectUnrecoverableSignatureAttestation: z.boolean().optional(),
|
|
170
|
+
injectYParityAttestation: z.boolean().optional(),
|
|
168
171
|
fishermanMode: z.boolean().optional(),
|
|
169
172
|
shuffleAttestationOrdering: z.boolean().optional(),
|
|
170
173
|
blockDurationMs: z.number().positive().optional(),
|
|
@@ -10,8 +10,8 @@ import type {
|
|
|
10
10
|
PrivateKernelInner3CircuitPrivateInputs,
|
|
11
11
|
PrivateKernelInnerCircuitPrivateInputs,
|
|
12
12
|
PrivateKernelResetCircuitPrivateInputs,
|
|
13
|
+
PrivateKernelResetTailCircuitPrivateInputs,
|
|
13
14
|
PrivateKernelSimulateOutput,
|
|
14
|
-
PrivateKernelTailCircuitPrivateInputs,
|
|
15
15
|
PrivateKernelTailCircuitPublicInputs,
|
|
16
16
|
} from '../kernel/index.js';
|
|
17
17
|
import type { ChonkProofWithPublicInputs } from '../proofs/chonk_proof.js';
|
|
@@ -166,23 +166,21 @@ export interface PrivateKernelProver {
|
|
|
166
166
|
): Promise<PrivateKernelSimulateOutput<PrivateKernelCircuitPublicInputs>>;
|
|
167
167
|
|
|
168
168
|
/**
|
|
169
|
-
* Creates a proof output
|
|
169
|
+
* Creates a proof output for the terminal reset+tail step. Dispatches to the rollup-bound or
|
|
170
|
+
* public-bound family based on `inputs.isForPublic()`.
|
|
170
171
|
*
|
|
171
|
-
* @param
|
|
172
|
-
* @returns A Promise resolving to a ProofOutput
|
|
172
|
+
* @param privateKernelInputs - Reset hints, dimensions, and tail params.
|
|
173
|
+
* @returns A Promise resolving to a ProofOutput containing the tail-shaped public inputs.
|
|
173
174
|
*/
|
|
174
|
-
|
|
175
|
-
|
|
175
|
+
generateResetTailOutput(
|
|
176
|
+
privateKernelInputs: PrivateKernelResetTailCircuitPrivateInputs,
|
|
176
177
|
): Promise<PrivateKernelSimulateOutput<PrivateKernelTailCircuitPublicInputs>>;
|
|
177
178
|
|
|
178
179
|
/**
|
|
179
|
-
*
|
|
180
|
-
*
|
|
181
|
-
* @param privateKernelInputsTail - The private input data structure for the final ordering iteration.
|
|
182
|
-
* @returns A Promise resolving to a ProofOutput object containing public inputs an empty kernel proof.
|
|
180
|
+
* Simulates the terminal reset+tail step without generating a proof.
|
|
183
181
|
*/
|
|
184
|
-
|
|
185
|
-
|
|
182
|
+
simulateResetTail(
|
|
183
|
+
privateKernelInputs: PrivateKernelResetTailCircuitPrivateInputs,
|
|
186
184
|
): Promise<PrivateKernelSimulateOutput<PrivateKernelTailCircuitPublicInputs>>;
|
|
187
185
|
|
|
188
186
|
generateHidingToRollupOutput(
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
+
import { createSafeJsonRpcClient, defaultFetch } from '@aztec/foundation/json-rpc/client';
|
|
2
|
+
|
|
1
3
|
import { z } from 'zod';
|
|
2
4
|
|
|
3
|
-
import { type L2Tips, L2TipsSchema } from '../block/l2_block_source.js';
|
|
4
5
|
import { type ApiSchemaFor, schemas } from '../schemas/index.js';
|
|
5
|
-
import { type
|
|
6
|
+
import { type ComponentsVersions, getVersioningResponseHandler } from '../versioning/index.js';
|
|
6
7
|
|
|
7
8
|
const EpochProvingJobState = [
|
|
8
9
|
'initialized',
|
|
9
10
|
'awaiting-checkpoints',
|
|
11
|
+
'awaiting-root',
|
|
10
12
|
'awaiting-predecessor',
|
|
11
13
|
'publishing-proof',
|
|
12
14
|
'completed',
|
|
@@ -30,7 +32,7 @@ export const EpochProvingJobTerminalState: EpochProvingJobState[] = [
|
|
|
30
32
|
|
|
31
33
|
export type EpochProvingJobTerminalState = (typeof EpochProvingJobTerminalState)[number];
|
|
32
34
|
|
|
33
|
-
/** JSON RPC
|
|
35
|
+
/** JSON RPC admin interface to a prover node. */
|
|
34
36
|
export interface ProverNodeApi {
|
|
35
37
|
getJobs(): Promise<{ uuid: string; status: EpochProvingJobState; epochNumber: number }[]>;
|
|
36
38
|
|
|
@@ -40,10 +42,6 @@ export interface ProverNodeApi {
|
|
|
40
42
|
* track the returned job's progress.
|
|
41
43
|
*/
|
|
42
44
|
startProof(epochNumber: number): Promise<string>;
|
|
43
|
-
|
|
44
|
-
getL2Tips(): Promise<L2Tips>;
|
|
45
|
-
|
|
46
|
-
getWorldStateSyncStatus(): Promise<WorldStateSyncStatus>;
|
|
47
45
|
}
|
|
48
46
|
|
|
49
47
|
/** Schemas for prover node API functions. */
|
|
@@ -54,8 +52,18 @@ export const ProverNodeApiSchema: ApiSchemaFor<ProverNodeApi> = {
|
|
|
54
52
|
}),
|
|
55
53
|
|
|
56
54
|
startProof: z.function({ input: z.tuple([schemas.Integer]), output: z.string() }),
|
|
57
|
-
|
|
58
|
-
getL2Tips: z.function({ input: z.tuple([]), output: L2TipsSchema }),
|
|
59
|
-
|
|
60
|
-
getWorldStateSyncStatus: z.function({ input: z.tuple([]), output: WorldStateSyncStatusSchema }),
|
|
61
55
|
};
|
|
56
|
+
|
|
57
|
+
export function createProverNodeAdminClient(
|
|
58
|
+
url: string,
|
|
59
|
+
versions: Partial<ComponentsVersions> = {},
|
|
60
|
+
fetch = defaultFetch,
|
|
61
|
+
apiKey?: string,
|
|
62
|
+
): ProverNodeApi {
|
|
63
|
+
return createSafeJsonRpcClient<ProverNodeApi>(url, ProverNodeApiSchema, {
|
|
64
|
+
namespaceMethods: 'prover',
|
|
65
|
+
fetch,
|
|
66
|
+
onResponse: getVersioningResponseHandler(versions),
|
|
67
|
+
...(apiKey ? { extraHeaders: { 'x-api-key': apiKey } } : {}),
|
|
68
|
+
});
|
|
69
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
2
|
+
AVM_V2_PROOF_LENGTH_IN_FIELDS,
|
|
3
3
|
NESTED_RECURSIVE_PROOF_LENGTH,
|
|
4
4
|
NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH,
|
|
5
5
|
RECURSIVE_PROOF_LENGTH,
|
|
@@ -204,7 +204,7 @@ export type ProvingJobInputsMap = {
|
|
|
204
204
|
export const ProvingJobResult = z.discriminatedUnion('type', [
|
|
205
205
|
z.object({
|
|
206
206
|
type: z.literal(ProvingRequestType.PUBLIC_VM),
|
|
207
|
-
result: RecursiveProof.schemaFor(
|
|
207
|
+
result: RecursiveProof.schemaFor(AVM_V2_PROOF_LENGTH_IN_FIELDS),
|
|
208
208
|
}),
|
|
209
209
|
z.object({
|
|
210
210
|
type: z.literal(ProvingRequestType.PUBLIC_CHONK_VERIFIER),
|
|
@@ -319,7 +319,7 @@ export const ProvingJobResult = z.discriminatedUnion('type', [
|
|
|
319
319
|
]);
|
|
320
320
|
export type ProvingJobResult = z.infer<typeof ProvingJobResult>;
|
|
321
321
|
export type ProvingJobResultsMap = {
|
|
322
|
-
[ProvingRequestType.PUBLIC_VM]: RecursiveProof<typeof
|
|
322
|
+
[ProvingRequestType.PUBLIC_VM]: RecursiveProof<typeof AVM_V2_PROOF_LENGTH_IN_FIELDS>;
|
|
323
323
|
[ProvingRequestType.PUBLIC_CHONK_VERIFIER]: PublicInputsAndRecursiveProof<
|
|
324
324
|
PublicChonkVerifierPublicInputs,
|
|
325
325
|
typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH
|
|
@@ -441,9 +441,20 @@ export const ProvingJobRejectedResult = z.object({
|
|
|
441
441
|
});
|
|
442
442
|
export type ProvingJobRejectedResult = z.infer<typeof ProvingJobRejectedResult>;
|
|
443
443
|
|
|
444
|
+
/**
|
|
445
|
+
* The result of a job that was cancelled by its producer. Unlike a fulfilled or rejected result it
|
|
446
|
+
* is not truly terminal: re-enqueuing the same job id revives it, so an abort never permanently
|
|
447
|
+
* blocks a proof from being produced.
|
|
448
|
+
*/
|
|
449
|
+
export const ProvingJobAbortedResult = z.object({
|
|
450
|
+
status: z.literal('aborted'),
|
|
451
|
+
});
|
|
452
|
+
export type ProvingJobAbortedResult = z.infer<typeof ProvingJobAbortedResult>;
|
|
453
|
+
|
|
444
454
|
export const ProvingJobSettledResult = z.discriminatedUnion('status', [
|
|
445
455
|
ProvingJobFulfilledResult,
|
|
446
456
|
ProvingJobRejectedResult,
|
|
457
|
+
ProvingJobAbortedResult,
|
|
447
458
|
]);
|
|
448
459
|
export type ProvingJobSettledResult = z.infer<typeof ProvingJobSettledResult>;
|
|
449
460
|
|
|
@@ -453,5 +464,6 @@ export const ProvingJobStatus = z.discriminatedUnion('status', [
|
|
|
453
464
|
z.object({ status: z.literal('not-found') }),
|
|
454
465
|
ProvingJobFulfilledResult,
|
|
455
466
|
ProvingJobRejectedResult,
|
|
467
|
+
ProvingJobAbortedResult,
|
|
456
468
|
]);
|
|
457
469
|
export type ProvingJobStatus = z.infer<typeof ProvingJobStatus>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type {
|
|
2
|
-
|
|
2
|
+
AVM_V2_PROOF_LENGTH_IN_FIELDS,
|
|
3
3
|
NESTED_RECURSIVE_PROOF_LENGTH,
|
|
4
4
|
NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH,
|
|
5
5
|
RECURSIVE_PROOF_LENGTH,
|
|
@@ -189,7 +189,7 @@ export interface ServerCircuitProver {
|
|
|
189
189
|
inputs: AvmCircuitInputs,
|
|
190
190
|
signal?: AbortSignal,
|
|
191
191
|
epochNumber?: number,
|
|
192
|
-
): Promise<RecursiveProof<typeof
|
|
192
|
+
): Promise<RecursiveProof<typeof AVM_V2_PROOF_LENGTH_IN_FIELDS>>;
|
|
193
193
|
}
|
|
194
194
|
|
|
195
195
|
export type IVCProofVerificationResult = {
|
|
@@ -65,6 +65,20 @@ export interface ReadonlyWorldStateAccess {
|
|
|
65
65
|
|
|
66
66
|
/** Defines the interface for a world state synchronizer. */
|
|
67
67
|
export interface WorldStateSynchronizer extends ReadonlyWorldStateAccess, ForkMerkleTreeOperations {
|
|
68
|
+
/**
|
|
69
|
+
* Returns a read handle to the world state at `blockNumber`, but only after verifying that the block at that
|
|
70
|
+
* height is on the fork identified by `blockHash`. This pins the returned view to a specific fork so a reorg
|
|
71
|
+
* that replaced the block at `blockNumber` cannot be served silently, closing the gap between resolving a query
|
|
72
|
+
* and reading its snapshot.
|
|
73
|
+
*
|
|
74
|
+
* Rejects if the block at `blockNumber` does not match `blockHash` (a reorg), or if the block's hash cannot be
|
|
75
|
+
* read from the requested view. Both are transient from a caller's perspective: re-resolving the query against
|
|
76
|
+
* the current chain and retrying may succeed or produce a more precise error. However, if the block's history
|
|
77
|
+
* has been pruned away (it predates the oldest historical block kept by world state), the rejection is terminal:
|
|
78
|
+
* retrying cannot bring the data back.
|
|
79
|
+
*/
|
|
80
|
+
getVerifiedSnapshot(blockNumber: BlockNumber, blockHash: BlockHash): Promise<MerkleTreeReadOperations>;
|
|
81
|
+
|
|
68
82
|
/** Starts the synchronizer. */
|
|
69
83
|
start(): Promise<void | PromiseWithResolvers<void>>;
|
|
70
84
|
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { isDefined } from '@aztec/foundation/types';
|
|
2
|
-
|
|
3
1
|
import {
|
|
4
2
|
PrivateKernelResetDimensions,
|
|
5
3
|
type PrivateKernelResetDimensionsConfig,
|
|
4
|
+
type ResetCatalogEntry,
|
|
6
5
|
privateKernelResetDimensionNames,
|
|
7
6
|
} from '../private_kernel_reset_dimensions.js';
|
|
8
7
|
|
|
@@ -12,13 +11,6 @@ interface DimensionOption {
|
|
|
12
11
|
remainder?: PrivateKernelResetDimensions;
|
|
13
12
|
}
|
|
14
13
|
|
|
15
|
-
function computeCost(dimensions: PrivateKernelResetDimensions, config: PrivateKernelResetDimensionsConfig) {
|
|
16
|
-
return privateKernelResetDimensionNames.reduce(
|
|
17
|
-
(accum, name) => accum + dimensions[name] * config.dimensions[name].cost,
|
|
18
|
-
0,
|
|
19
|
-
);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
14
|
function getSize(dimensions: PrivateKernelResetDimensions) {
|
|
23
15
|
return privateKernelResetDimensionNames.reduce((accum, name) => accum + dimensions[name], 0);
|
|
24
16
|
}
|
|
@@ -38,124 +30,42 @@ function getRemainder(
|
|
|
38
30
|
return remainingDimensions ? remainder : undefined;
|
|
39
31
|
}
|
|
40
32
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
// If no such value is found, returns the max value.
|
|
49
|
-
return minGte ?? Math.max(...values);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
function pickCheapest(options: DimensionOption[]) {
|
|
53
|
-
return options.reduce((prev, curr) => (curr.cost < prev.cost ? curr : prev), options[0]);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
function pickSmallestRemainder(options: DimensionOption[]) {
|
|
57
|
-
const optionsWithSize = options
|
|
58
|
-
.filter(o => o.remainder)
|
|
59
|
-
.map(option => ({ option, size: getSize(option.remainder!) }));
|
|
60
|
-
return optionsWithSize.reduce((prev, curr) => (curr.size < prev.size ? curr : prev), optionsWithSize[0])?.option;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
function pickBestOption(options: DimensionOption[]) {
|
|
64
|
-
const optionsResetAll = options.filter(opt => !opt.remainder);
|
|
65
|
-
const optionsResetPartial = options.filter(opt => opt.remainder);
|
|
66
|
-
// The best option is the cheapest one that can reset all dimensions.
|
|
67
|
-
// If no such option exists, find one that can reset the most data.
|
|
68
|
-
return pickCheapest(optionsResetAll) || pickSmallestRemainder(optionsResetPartial);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
function findVariant(
|
|
72
|
-
requestedDimensions: PrivateKernelResetDimensions,
|
|
73
|
-
config: PrivateKernelResetDimensionsConfig,
|
|
74
|
-
isQualified: (dimensions: PrivateKernelResetDimensions) => boolean,
|
|
75
|
-
): DimensionOption | undefined {
|
|
76
|
-
const variant = PrivateKernelResetDimensions.empty();
|
|
77
|
-
privateKernelResetDimensionNames.forEach(name => {
|
|
78
|
-
variant[name] = pickFromValues(requestedDimensions[name], config.dimensions[name].variants);
|
|
79
|
-
});
|
|
80
|
-
if (!isQualified(variant)) {
|
|
81
|
-
return;
|
|
33
|
+
// Returns the cheapest option that fully covers the request, or the option with the smallest
|
|
34
|
+
// remainder if none do. Caller must pass a non-empty list.
|
|
35
|
+
function pickBestOption(options: DimensionOption[]): DimensionOption {
|
|
36
|
+
const fullCoverage = options.filter(opt => !opt.remainder);
|
|
37
|
+
if (fullCoverage.length) {
|
|
38
|
+
return fullCoverage.reduce((prev, curr) => (curr.cost < prev.cost ? curr : prev));
|
|
82
39
|
}
|
|
83
|
-
|
|
84
|
-
return {
|
|
85
|
-
dimensions: variant,
|
|
86
|
-
cost: computeCost(variant, config),
|
|
87
|
-
remainder: getRemainder(requestedDimensions, variant),
|
|
88
|
-
};
|
|
40
|
+
return options.reduce((prev, curr) => (getSize(curr.remainder!) < getSize(prev.remainder!) ? curr : prev));
|
|
89
41
|
}
|
|
90
42
|
|
|
91
|
-
function
|
|
92
|
-
|
|
93
|
-
config: PrivateKernelResetDimensionsConfig,
|
|
94
|
-
isQualified: (dimensions: PrivateKernelResetDimensions) => boolean,
|
|
95
|
-
): DimensionOption | undefined {
|
|
96
|
-
const needsReset = privateKernelResetDimensionNames.filter(name => requestedDimensions[name] > 0);
|
|
97
|
-
if (needsReset.length !== 1) {
|
|
98
|
-
// At the moment, we only use standalone to reset one dimension when it's about to overflow.
|
|
99
|
-
return;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
const name = needsReset[0];
|
|
103
|
-
const value = pickFromValues(requestedDimensions[name], config.dimensions[name].standalone);
|
|
104
|
-
if (!value) {
|
|
105
|
-
return;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
const dimensions = PrivateKernelResetDimensions.from({ [name]: value });
|
|
109
|
-
if (!isQualified(dimensions)) {
|
|
110
|
-
return;
|
|
111
|
-
}
|
|
112
|
-
|
|
43
|
+
function buildOption(entry: ResetCatalogEntry, requestedDimensions: PrivateKernelResetDimensions): DimensionOption {
|
|
44
|
+
const dimensions = PrivateKernelResetDimensions.fromValues(entry.dimensions);
|
|
113
45
|
return {
|
|
114
46
|
dimensions,
|
|
115
|
-
cost:
|
|
47
|
+
cost: entry.cost,
|
|
116
48
|
remainder: getRemainder(requestedDimensions, dimensions),
|
|
117
49
|
};
|
|
118
50
|
}
|
|
119
51
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
const options = specialCases.filter(isQualified).map(dimensions => ({
|
|
127
|
-
dimensions,
|
|
128
|
-
cost: computeCost(dimensions, config),
|
|
129
|
-
remainder: getRemainder(requestedDimensions, dimensions),
|
|
130
|
-
}));
|
|
131
|
-
return pickBestOption(options);
|
|
132
|
-
}
|
|
52
|
+
/**
|
|
53
|
+
* Picks which catalog group the selector should search. Mid-tx resets go to `inner` (no
|
|
54
|
+
* siloing); terminal kernels go to `finalTail` or `finalTailToPublic`, depending on whether
|
|
55
|
+
* the tx has public function calls.
|
|
56
|
+
*/
|
|
57
|
+
export type ResetDimensionsMode = 'inner' | 'finalTail' | 'finalTailToPublic';
|
|
133
58
|
|
|
134
59
|
export function findPrivateKernelResetDimensions(
|
|
135
60
|
requestedDimensions: PrivateKernelResetDimensions,
|
|
136
61
|
config: PrivateKernelResetDimensionsConfig,
|
|
137
|
-
|
|
62
|
+
mode: ResetDimensionsMode,
|
|
138
63
|
allowRemainder = false,
|
|
139
64
|
) {
|
|
140
|
-
const
|
|
141
|
-
const
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
const isQualified = !isInner
|
|
146
|
-
? isEnough
|
|
147
|
-
: // If isInner is true, it's a reset to prevent overflow. The following must be zero because siloing can't be done at the moment.
|
|
148
|
-
(dimensions: PrivateKernelResetDimensions) =>
|
|
149
|
-
dimensions.NOTE_HASH_SILOING === 0 &&
|
|
150
|
-
dimensions.NULLIFIER_SILOING === 0 &&
|
|
151
|
-
dimensions.PRIVATE_LOG_SILOING === 0 &&
|
|
152
|
-
isEnough(dimensions);
|
|
153
|
-
|
|
154
|
-
const options = [
|
|
155
|
-
findVariant(requestedDimensions, config, isQualified),
|
|
156
|
-
findStandalone(requestedDimensions, config, isQualified),
|
|
157
|
-
findSpecialCase(requestedDimensions, config, isQualified),
|
|
158
|
-
].filter(isDefined);
|
|
65
|
+
const catalog = config[mode];
|
|
66
|
+
const options = catalog
|
|
67
|
+
.map(entry => buildOption(entry, requestedDimensions))
|
|
68
|
+
.filter(option => allowRemainder || !option.remainder);
|
|
159
69
|
|
|
160
70
|
if (!options.length) {
|
|
161
71
|
throw new Error(`Cannot find an option for dimension: ${requestedDimensions.toValues()}`);
|
|
@@ -112,7 +112,7 @@ export class ScopedReadRequest {
|
|
|
112
112
|
|
|
113
113
|
static fromFields(fields: Fr[] | FieldReader) {
|
|
114
114
|
const reader = FieldReader.asReader(fields);
|
|
115
|
-
return new ScopedReadRequest(reader.readObject(ReadRequest), AztecAddress.
|
|
115
|
+
return new ScopedReadRequest(reader.readObject(ReadRequest), AztecAddress.fromFieldUnsafe(reader.readField()));
|
|
116
116
|
}
|
|
117
117
|
|
|
118
118
|
/**
|
package/src/kernel/index.ts
CHANGED
|
@@ -14,7 +14,7 @@ export * from './private_kernel_inner_2_circuit_private_inputs.js';
|
|
|
14
14
|
export * from './private_kernel_inner_3_circuit_private_inputs.js';
|
|
15
15
|
export * from './private_kernel_reset_circuit_private_inputs.js';
|
|
16
16
|
export * from './private_kernel_reset_dimensions.js';
|
|
17
|
-
export * from './
|
|
17
|
+
export * from './private_kernel_reset_tail_circuit_private_inputs.js';
|
|
18
18
|
export * from './private_kernel_tail_circuit_public_inputs.js';
|
|
19
19
|
export * from './private_to_avm_accumulated_data.js';
|
|
20
20
|
export * from './private_to_public_accumulated_data.js';
|
package/src/kernel/log_hash.ts
CHANGED
|
@@ -114,7 +114,7 @@ export class ScopedLogHash {
|
|
|
114
114
|
|
|
115
115
|
static fromFields(fields: Fr[] | FieldReader) {
|
|
116
116
|
const reader = FieldReader.asReader(fields);
|
|
117
|
-
return new ScopedLogHash(reader.readObject(LogHash), AztecAddress.
|
|
117
|
+
return new ScopedLogHash(reader.readObject(LogHash), AztecAddress.fromFieldUnsafe(reader.readField()));
|
|
118
118
|
}
|
|
119
119
|
|
|
120
120
|
isEmpty() {
|
|
@@ -156,7 +156,10 @@ export class ScopedCountedLogHash {
|
|
|
156
156
|
|
|
157
157
|
static fromFields(fields: Fr[] | FieldReader) {
|
|
158
158
|
const reader = FieldReader.asReader(fields);
|
|
159
|
-
return new ScopedCountedLogHash(
|
|
159
|
+
return new ScopedCountedLogHash(
|
|
160
|
+
reader.readObject(CountedLogHash),
|
|
161
|
+
AztecAddress.fromFieldUnsafe(reader.readField()),
|
|
162
|
+
);
|
|
160
163
|
}
|
|
161
164
|
|
|
162
165
|
toBuffer(): Buffer;
|
package/src/kernel/note_hash.ts
CHANGED
|
@@ -65,7 +65,7 @@ export class ScopedNoteHash implements Ordered {
|
|
|
65
65
|
|
|
66
66
|
static fromFields(fields: Fr[] | FieldReader) {
|
|
67
67
|
const reader = FieldReader.asReader(fields);
|
|
68
|
-
return new ScopedNoteHash(reader.readObject(NoteHash), AztecAddress.
|
|
68
|
+
return new ScopedNoteHash(reader.readObject(NoteHash), AztecAddress.fromFieldUnsafe(reader.readField()));
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
isEmpty() {
|
package/src/kernel/nullifier.ts
CHANGED
|
@@ -70,7 +70,7 @@ export class ScopedNullifier implements Ordered {
|
|
|
70
70
|
|
|
71
71
|
static fromFields(fields: Fr[] | FieldReader) {
|
|
72
72
|
const reader = FieldReader.asReader(fields);
|
|
73
|
-
return new ScopedNullifier(reader.readObject(Nullifier), AztecAddress.
|
|
73
|
+
return new ScopedNullifier(reader.readObject(Nullifier), AztecAddress.fromFieldUnsafe(reader.readField()));
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
isEmpty() {
|
|
@@ -144,6 +144,11 @@ export class PrivateCircuitPublicInputs {
|
|
|
144
144
|
* Hash of the contract class logs emitted in this function call.
|
|
145
145
|
*/
|
|
146
146
|
public contractClassLogsHashes: ClaimedLengthArray<CountedLogHash, typeof MAX_CONTRACT_CLASS_LOGS_PER_CALL>,
|
|
147
|
+
/**
|
|
148
|
+
* The tx request's salt. Keeps `tx_request.hash()` (the protocol nullifier) unpredictable, and lets the init
|
|
149
|
+
* kernel bind this proof to a specific tx request (it asserts this equals `tx_request.salt`).
|
|
150
|
+
*/
|
|
151
|
+
public txRequestSalt: Fr,
|
|
147
152
|
) {}
|
|
148
153
|
|
|
149
154
|
/**
|
|
@@ -188,6 +193,7 @@ export class PrivateCircuitPublicInputs {
|
|
|
188
193
|
reader.readObject(ClaimedLengthArrayFromBuffer(CountedL2ToL1Message, MAX_L2_TO_L1_MSGS_PER_CALL)),
|
|
189
194
|
reader.readObject(ClaimedLengthArrayFromBuffer(PrivateLogData, MAX_PRIVATE_LOGS_PER_CALL)),
|
|
190
195
|
reader.readObject(ClaimedLengthArrayFromBuffer(CountedLogHash, MAX_CONTRACT_CLASS_LOGS_PER_CALL)),
|
|
196
|
+
reader.readObject(Fr),
|
|
191
197
|
);
|
|
192
198
|
}
|
|
193
199
|
|
|
@@ -219,6 +225,7 @@ export class PrivateCircuitPublicInputs {
|
|
|
219
225
|
reader.readObject(ClaimedLengthArrayFromFields(CountedL2ToL1Message, MAX_L2_TO_L1_MSGS_PER_CALL)),
|
|
220
226
|
reader.readObject(ClaimedLengthArrayFromFields(PrivateLogData, MAX_PRIVATE_LOGS_PER_CALL)),
|
|
221
227
|
reader.readObject(ClaimedLengthArrayFromFields(CountedLogHash, MAX_CONTRACT_CLASS_LOGS_PER_CALL)),
|
|
228
|
+
reader.readField(),
|
|
222
229
|
);
|
|
223
230
|
}
|
|
224
231
|
|
|
@@ -251,6 +258,7 @@ export class PrivateCircuitPublicInputs {
|
|
|
251
258
|
ClaimedLengthArray.empty(CountedL2ToL1Message, MAX_L2_TO_L1_MSGS_PER_CALL),
|
|
252
259
|
ClaimedLengthArray.empty(PrivateLogData, MAX_PRIVATE_LOGS_PER_CALL),
|
|
253
260
|
ClaimedLengthArray.empty(CountedLogHash, MAX_CONTRACT_CLASS_LOGS_PER_CALL),
|
|
261
|
+
Fr.ZERO,
|
|
254
262
|
);
|
|
255
263
|
}
|
|
256
264
|
|
|
@@ -278,7 +286,8 @@ export class PrivateCircuitPublicInputs {
|
|
|
278
286
|
this.nullifiers.isEmpty() &&
|
|
279
287
|
this.l2ToL1Msgs.isEmpty() &&
|
|
280
288
|
this.privateLogs.isEmpty() &&
|
|
281
|
-
this.contractClassLogsHashes.isEmpty()
|
|
289
|
+
this.contractClassLogsHashes.isEmpty() &&
|
|
290
|
+
this.txRequestSalt.isZero()
|
|
282
291
|
);
|
|
283
292
|
}
|
|
284
293
|
|
|
@@ -312,6 +321,7 @@ export class PrivateCircuitPublicInputs {
|
|
|
312
321
|
fields.l2ToL1Msgs,
|
|
313
322
|
fields.privateLogs,
|
|
314
323
|
fields.contractClassLogsHashes,
|
|
324
|
+
fields.txRequestSalt,
|
|
315
325
|
] as const;
|
|
316
326
|
}
|
|
317
327
|
|
|
@@ -346,6 +356,7 @@ export class PrivateCircuitPublicInputs {
|
|
|
346
356
|
this.l2ToL1Msgs,
|
|
347
357
|
this.privateLogs,
|
|
348
358
|
this.contractClassLogsHashes,
|
|
359
|
+
this.txRequestSalt,
|
|
349
360
|
]);
|
|
350
361
|
}
|
|
351
362
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
2
|
import { serializeToFields } from '@aztec/foundation/serialize';
|
|
3
3
|
|
|
4
4
|
import { BlockHeader } from '../tx/block_header.js';
|
|
@@ -11,13 +11,20 @@ export class PrivateContextInputs {
|
|
|
11
11
|
public anchorBlockHeader: BlockHeader,
|
|
12
12
|
public txContext: TxContext,
|
|
13
13
|
public startSideEffectCounter: number,
|
|
14
|
+
public txRequestSalt: Fr,
|
|
14
15
|
) {}
|
|
15
16
|
|
|
16
17
|
public static empty(): PrivateContextInputs {
|
|
17
|
-
return new PrivateContextInputs(CallContext.empty(), BlockHeader.empty(), TxContext.empty(), 0);
|
|
18
|
+
return new PrivateContextInputs(CallContext.empty(), BlockHeader.empty(), TxContext.empty(), 0, Fr.ZERO);
|
|
18
19
|
}
|
|
19
20
|
|
|
20
21
|
public toFields(): Fr[] {
|
|
21
|
-
return serializeToFields([
|
|
22
|
+
return serializeToFields([
|
|
23
|
+
this.callContext,
|
|
24
|
+
this.anchorBlockHeader,
|
|
25
|
+
this.txContext,
|
|
26
|
+
this.startSideEffectCounter,
|
|
27
|
+
this.txRequestSalt,
|
|
28
|
+
]);
|
|
22
29
|
}
|
|
23
30
|
}
|
|
@@ -115,3 +115,12 @@ export class PrivateKernelCircuitPublicInputs {
|
|
|
115
115
|
);
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Returns true iff the tx requires the public-bound terminal path: it has either un-processed
|
|
121
|
+
* public-call requests in the side-effect stream or a pending public-teardown call request. Every
|
|
122
|
+
* site picking between the rollup-bound and public-bound terminal artifact must route through this.
|
|
123
|
+
*/
|
|
124
|
+
export function kernelStateIsForPublic(publicInputs: PrivateKernelCircuitPublicInputs): boolean {
|
|
125
|
+
return publicInputs.end.publicCallRequests.claimedLength > 0 || !publicInputs.publicTeardownCallRequest.isEmpty();
|
|
126
|
+
}
|
|
@@ -17,7 +17,6 @@ export class PrivateKernelInit2CircuitPrivateInputs {
|
|
|
17
17
|
public privateCall0: PrivateCallData,
|
|
18
18
|
public privateCall1: PrivateCallData,
|
|
19
19
|
public isPrivateOnly: boolean,
|
|
20
|
-
public firstNullifierHint: Fr,
|
|
21
20
|
public revertibleCounterHint: number,
|
|
22
21
|
) {}
|
|
23
22
|
|
|
@@ -28,7 +27,6 @@ export class PrivateKernelInit2CircuitPrivateInputs {
|
|
|
28
27
|
this.protocolContracts,
|
|
29
28
|
this.privateCall0,
|
|
30
29
|
this.privateCall1,
|
|
31
|
-
this.firstNullifierHint,
|
|
32
30
|
this.revertibleCounterHint,
|
|
33
31
|
);
|
|
34
32
|
}
|
|
@@ -42,7 +40,6 @@ export class PrivateKernelInit2CircuitPrivateInputs {
|
|
|
42
40
|
reader.readObject(PrivateCallData),
|
|
43
41
|
reader.readObject(PrivateCallData),
|
|
44
42
|
reader.readBoolean(),
|
|
45
|
-
Fr.fromBuffer(reader),
|
|
46
43
|
reader.readNumber(),
|
|
47
44
|
);
|
|
48
45
|
}
|
|
@@ -18,7 +18,6 @@ export class PrivateKernelInit3CircuitPrivateInputs {
|
|
|
18
18
|
public privateCall1: PrivateCallData,
|
|
19
19
|
public privateCall2: PrivateCallData,
|
|
20
20
|
public isPrivateOnly: boolean,
|
|
21
|
-
public firstNullifierHint: Fr,
|
|
22
21
|
public revertibleCounterHint: number,
|
|
23
22
|
) {}
|
|
24
23
|
|
|
@@ -30,7 +29,6 @@ export class PrivateKernelInit3CircuitPrivateInputs {
|
|
|
30
29
|
this.privateCall0,
|
|
31
30
|
this.privateCall1,
|
|
32
31
|
this.privateCall2,
|
|
33
|
-
this.firstNullifierHint,
|
|
34
32
|
this.revertibleCounterHint,
|
|
35
33
|
);
|
|
36
34
|
}
|
|
@@ -45,7 +43,6 @@ export class PrivateKernelInit3CircuitPrivateInputs {
|
|
|
45
43
|
reader.readObject(PrivateCallData),
|
|
46
44
|
reader.readObject(PrivateCallData),
|
|
47
45
|
reader.readBoolean(),
|
|
48
|
-
Fr.fromBuffer(reader),
|
|
49
46
|
reader.readNumber(),
|
|
50
47
|
);
|
|
51
48
|
}
|
|
@@ -30,10 +30,6 @@ export class PrivateKernelInitCircuitPrivateInputs {
|
|
|
30
30
|
* Wether this tx will make public calls or not.
|
|
31
31
|
*/
|
|
32
32
|
public isPrivateOnly: boolean,
|
|
33
|
-
/**
|
|
34
|
-
* A hint to what will be the first nullifier of the transaction, used for nonce generation.
|
|
35
|
-
*/
|
|
36
|
-
public firstNullifierHint: Fr,
|
|
37
33
|
/**
|
|
38
34
|
* A claim to the final min revertible side effect counter of a tx.
|
|
39
35
|
*/
|
|
@@ -50,7 +46,6 @@ export class PrivateKernelInitCircuitPrivateInputs {
|
|
|
50
46
|
this.vkTreeRoot,
|
|
51
47
|
this.protocolContracts,
|
|
52
48
|
this.privateCall,
|
|
53
|
-
this.firstNullifierHint,
|
|
54
49
|
this.revertibleCounterHint,
|
|
55
50
|
);
|
|
56
51
|
}
|
|
@@ -68,7 +63,6 @@ export class PrivateKernelInitCircuitPrivateInputs {
|
|
|
68
63
|
reader.readObject(ProtocolContracts),
|
|
69
64
|
reader.readObject(PrivateCallData),
|
|
70
65
|
reader.readBoolean(),
|
|
71
|
-
Fr.fromBuffer(reader),
|
|
72
66
|
reader.readNumber(),
|
|
73
67
|
);
|
|
74
68
|
}
|