@aztec/stdlib 1.2.0 → 2.0.0-nightly.20250813
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 +0 -67
- package/dest/abi/abi.d.ts.map +1 -1
- package/dest/abi/abi.js +1 -14
- package/dest/abi/authorization_selector.d.ts +52 -0
- package/dest/abi/authorization_selector.d.ts.map +1 -0
- package/dest/abi/authorization_selector.js +70 -0
- package/dest/abi/contract_artifact.d.ts.map +1 -1
- package/dest/abi/contract_artifact.js +0 -40
- package/dest/abi/decoder.d.ts.map +1 -1
- package/dest/abi/decoder.js +3 -6
- package/dest/abi/index.d.ts +1 -0
- package/dest/abi/index.d.ts.map +1 -1
- package/dest/abi/index.js +1 -0
- package/dest/avm/avm.d.ts +278 -412
- package/dest/avm/avm.d.ts.map +1 -1
- package/dest/avm/avm.js +12 -12
- package/dest/avm/avm_proving_request.d.ts +160 -186
- package/dest/avm/avm_proving_request.d.ts.map +1 -1
- package/dest/block/l2_block.d.ts +8 -0
- package/dest/block/l2_block.d.ts.map +1 -1
- package/dest/block/l2_block.js +9 -0
- package/dest/block/l2_block_source.d.ts +446 -2
- package/dest/block/l2_block_source.d.ts.map +1 -1
- package/dest/block/l2_block_source.js +29 -0
- package/dest/block/proposal/committee_attestation.d.ts +3 -1
- package/dest/block/proposal/committee_attestation.d.ts.map +1 -1
- package/dest/block/proposal/committee_attestation.js +3 -0
- package/dest/block/published_l2_block.d.ts +2 -1
- package/dest/block/published_l2_block.d.ts.map +1 -1
- package/dest/block/published_l2_block.js +6 -1
- package/dest/contract/contract_instance.d.ts +3 -3
- package/dest/contract/contract_instance.d.ts.map +1 -1
- package/dest/contract/contract_instance.js +3 -3
- package/dest/contract/interfaces/contract_class.d.ts +2 -2
- package/dest/contract/interfaces/protocol_contract_addresses.d.ts +9 -9
- package/dest/contract/interfaces/protocol_contract_addresses.d.ts.map +1 -1
- package/dest/contract/interfaces/protocol_contract_addresses.js +4 -4
- package/dest/contract/private_function_membership_proof.d.ts +1 -1
- package/dest/contract/private_function_membership_proof.js +1 -1
- package/dest/contract/utility_function_membership_proof.d.ts +1 -1
- package/dest/contract/utility_function_membership_proof.js +1 -1
- package/dest/delayed_public_mutable/delayed_public_mutable_values.d.ts +20 -0
- package/dest/delayed_public_mutable/delayed_public_mutable_values.d.ts.map +1 -0
- package/dest/{shared_mutable/shared_mutable_values.js → delayed_public_mutable/delayed_public_mutable_values.js} +9 -9
- package/dest/{shared_mutable/shared_mutable_values_with_hash.d.ts → delayed_public_mutable/delayed_public_mutable_values_with_hash.d.ts} +6 -6
- package/dest/delayed_public_mutable/delayed_public_mutable_values_with_hash.d.ts.map +1 -0
- package/dest/delayed_public_mutable/delayed_public_mutable_values_with_hash.js +30 -0
- package/dest/delayed_public_mutable/index.d.ts +5 -0
- package/dest/delayed_public_mutable/index.d.ts.map +1 -0
- package/dest/delayed_public_mutable/index.js +4 -0
- package/dest/delayed_public_mutable/scheduled_delay_change.d.ts.map +1 -0
- package/dest/delayed_public_mutable/scheduled_value_change.d.ts.map +1 -0
- package/dest/gas/gas.d.ts +1 -0
- package/dest/gas/gas.d.ts.map +1 -1
- package/dest/gas/gas.js +3 -0
- package/dest/hash/hash.d.ts.map +1 -1
- package/dest/hash/hash.js +1 -4
- package/dest/interfaces/archiver.d.ts.map +1 -1
- package/dest/interfaces/archiver.js +4 -2
- package/dest/interfaces/aztec-node-admin.d.ts +211 -8
- package/dest/interfaces/aztec-node-admin.d.ts.map +1 -1
- package/dest/interfaces/aztec-node-admin.js +9 -3
- package/dest/interfaces/configs.d.ts +27 -0
- package/dest/interfaces/configs.d.ts.map +1 -1
- package/dest/interfaces/configs.js +6 -1
- package/dest/interfaces/get_logs_response.d.ts +1 -1
- package/dest/interfaces/proving-job.d.ts +166 -192
- package/dest/interfaces/proving-job.d.ts.map +1 -1
- package/dest/interfaces/pxe.d.ts +3 -1
- package/dest/interfaces/pxe.d.ts.map +1 -1
- package/dest/interfaces/pxe.js +1 -1
- package/dest/interfaces/server.d.ts +4 -2
- package/dest/interfaces/server.d.ts.map +1 -1
- package/dest/interfaces/server.js +4 -2
- package/dest/interfaces/slasher.d.ts +86 -0
- package/dest/interfaces/slasher.d.ts.map +1 -0
- package/dest/interfaces/slasher.js +23 -0
- package/dest/interfaces/tx_provider.d.ts +24 -0
- package/dest/interfaces/tx_provider.d.ts.map +1 -0
- package/dest/kernel/claimed_length_array.d.ts +34 -0
- package/dest/kernel/claimed_length_array.d.ts.map +1 -0
- package/dest/kernel/claimed_length_array.js +58 -0
- package/dest/kernel/hints/build_note_hash_read_request_hints.d.ts +6 -6
- package/dest/kernel/hints/build_note_hash_read_request_hints.d.ts.map +1 -1
- package/dest/kernel/hints/build_note_hash_read_request_hints.js +18 -20
- package/dest/kernel/hints/build_nullifier_read_request_hints.d.ts +7 -10
- package/dest/kernel/hints/build_nullifier_read_request_hints.d.ts.map +1 -1
- package/dest/kernel/hints/build_nullifier_read_request_hints.js +17 -32
- package/dest/kernel/hints/build_transient_data_hints.d.ts +4 -3
- package/dest/kernel/hints/build_transient_data_hints.d.ts.map +1 -1
- package/dest/kernel/hints/build_transient_data_hints.js +9 -10
- package/dest/kernel/hints/index.d.ts +1 -2
- package/dest/kernel/hints/index.d.ts.map +1 -1
- package/dest/kernel/hints/index.js +1 -2
- package/dest/kernel/hints/note_hash_read_request_hints.d.ts.map +1 -1
- package/dest/kernel/hints/note_hash_read_request_hints.js +4 -4
- package/dest/kernel/hints/nullifier_read_request_hints.d.ts.map +1 -1
- package/dest/kernel/hints/nullifier_read_request_hints.js +4 -4
- package/dest/kernel/hints/private_kernel_reset_hints.d.ts +5 -5
- package/dest/kernel/hints/private_kernel_reset_hints.d.ts.map +1 -1
- package/dest/kernel/hints/private_kernel_reset_hints.js +9 -9
- package/dest/kernel/hints/read_request_hints.d.ts +17 -17
- package/dest/kernel/hints/read_request_hints.d.ts.map +1 -1
- package/dest/kernel/hints/read_request_hints.js +28 -28
- package/dest/kernel/hints/{transient_data_index_hint.d.ts → transient_data_squashing_hint.d.ts} +5 -5
- package/dest/kernel/hints/transient_data_squashing_hint.d.ts.map +1 -0
- package/dest/kernel/hints/{transient_data_index_hint.js → transient_data_squashing_hint.js} +5 -5
- package/dest/kernel/index.d.ts +1 -0
- package/dest/kernel/index.d.ts.map +1 -1
- package/dest/kernel/index.js +1 -0
- package/dest/kernel/private_accumulated_data.d.ts +16 -15
- package/dest/kernel/private_accumulated_data.d.ts.map +1 -1
- package/dest/kernel/private_accumulated_data.js +3 -3
- package/dest/kernel/private_call_data.d.ts +4 -4
- package/dest/kernel/private_call_data.d.ts.map +1 -1
- package/dest/kernel/private_call_data.js +2 -2
- package/dest/kernel/private_circuit_public_inputs.d.ts +26 -25
- package/dest/kernel/private_circuit_public_inputs.d.ts.map +1 -1
- package/dest/kernel/private_circuit_public_inputs.js +33 -15
- package/dest/kernel/private_kernel_circuit_public_inputs.d.ts +9 -0
- package/dest/kernel/private_kernel_circuit_public_inputs.d.ts.map +1 -1
- package/dest/kernel/private_kernel_circuit_public_inputs.js +8 -4
- package/dest/kernel/private_kernel_tail_circuit_private_inputs.d.ts +10 -1
- package/dest/kernel/private_kernel_tail_circuit_private_inputs.d.ts.map +1 -1
- package/dest/kernel/private_kernel_tail_circuit_private_inputs.js +9 -6
- package/dest/kernel/private_kernel_tail_circuit_public_inputs.d.ts +11 -4
- package/dest/kernel/private_kernel_tail_circuit_public_inputs.d.ts.map +1 -1
- package/dest/kernel/private_kernel_tail_circuit_public_inputs.js +20 -18
- package/dest/kernel/private_to_public_kernel_circuit_public_inputs.d.ts +4 -4
- package/dest/kernel/private_to_public_kernel_circuit_public_inputs.d.ts.map +1 -1
- package/dest/kernel/private_to_public_kernel_circuit_public_inputs.js +9 -10
- package/dest/kernel/private_to_rollup_kernel_circuit_public_inputs.d.ts +11 -11
- package/dest/kernel/private_to_rollup_kernel_circuit_public_inputs.d.ts.map +1 -1
- package/dest/kernel/private_to_rollup_kernel_circuit_public_inputs.js +11 -12
- package/dest/kernel/private_validation_requests.d.ts +8 -20
- package/dest/kernel/private_validation_requests.d.ts.map +1 -1
- package/dest/kernel/private_validation_requests.js +9 -21
- package/dest/kernel/utils/order_and_comparison.d.ts +0 -3
- package/dest/kernel/utils/order_and_comparison.d.ts.map +1 -1
- package/dest/kernel/utils/order_and_comparison.js +0 -19
- package/dest/logs/extended_public_log.d.ts +1 -1
- package/dest/logs/shared_secret_derivation.d.ts +1 -1
- package/dest/logs/shared_secret_derivation.js +1 -1
- package/dest/messaging/l2_to_l1_membership.d.ts +4 -1
- package/dest/messaging/l2_to_l1_membership.d.ts.map +1 -1
- package/dest/messaging/l2_to_l1_membership.js +49 -54
- package/dest/messaging/l2_to_l1_message.d.ts +2 -0
- package/dest/messaging/l2_to_l1_message.d.ts.map +1 -1
- package/dest/messaging/l2_to_l1_message.js +7 -0
- package/dest/note/notes_filter.d.ts +5 -2
- package/dest/note/notes_filter.d.ts.map +1 -1
- package/dest/note/notes_filter.js +1 -1
- package/dest/p2p/attestation_utils.d.ts +10 -0
- package/dest/p2p/attestation_utils.d.ts.map +1 -0
- package/dest/p2p/attestation_utils.js +21 -0
- package/dest/p2p/block_attestation.d.ts +3 -4
- package/dest/p2p/block_attestation.d.ts.map +1 -1
- package/dest/p2p/block_attestation.js +3 -4
- package/dest/p2p/block_proposal.d.ts +8 -1
- package/dest/p2p/block_proposal.d.ts.map +1 -1
- package/dest/p2p/block_proposal.js +21 -8
- package/dest/p2p/consensus_payload.d.ts +3 -11
- package/dest/p2p/consensus_payload.d.ts.map +1 -1
- package/dest/p2p/consensus_payload.js +13 -22
- package/dest/p2p/index.d.ts +1 -0
- package/dest/p2p/index.d.ts.map +1 -1
- package/dest/p2p/index.js +1 -0
- package/dest/p2p/topic_type.d.ts.map +1 -1
- package/dest/p2p/topic_type.js +5 -3
- package/dest/rollup/block_root_rollup.d.ts +1 -1
- package/dest/slashing/index.d.ts +51 -0
- package/dest/slashing/index.d.ts.map +1 -0
- package/dest/slashing/index.js +54 -0
- package/dest/stats/stats.d.ts +2 -2
- package/dest/stats/stats.d.ts.map +1 -1
- package/dest/tests/factories.d.ts +0 -2
- package/dest/tests/factories.d.ts.map +1 -1
- package/dest/tests/factories.js +25 -24
- package/dest/tests/mocks.d.ts +2 -0
- package/dest/tests/mocks.d.ts.map +1 -1
- package/dest/tests/mocks.js +31 -22
- package/dest/tx/index.d.ts +0 -1
- package/dest/tx/index.d.ts.map +1 -1
- package/dest/tx/index.js +0 -1
- package/dest/tx/private_execution_result.d.ts +2 -2
- package/dest/tx/private_execution_result.d.ts.map +1 -1
- package/dest/tx/private_execution_result.js +11 -11
- package/dest/tx/processed_tx.d.ts +2 -2
- package/dest/tx/processed_tx.d.ts.map +1 -1
- package/dest/tx/processed_tx.js +4 -4
- package/dest/tx/proven_tx.d.ts +1 -1
- package/dest/tx/proven_tx.d.ts.map +1 -1
- package/dest/tx/proven_tx.js +7 -3
- package/dest/tx/simulated_tx.d.ts +11 -17
- package/dest/tx/simulated_tx.d.ts.map +1 -1
- package/dest/tx/simulated_tx.js +12 -12
- package/dest/tx/tx.d.ts +25 -25
- package/dest/tx/tx.d.ts.map +1 -1
- package/dest/tx/tx.js +60 -48
- package/dest/tx/tx_effect.d.ts +2 -2
- package/dest/tx/tx_effect.d.ts.map +1 -1
- package/dest/tx/tx_effect.js +3 -18
- package/dest/tx/tx_execution_request.js +2 -2
- package/dest/tx/tx_hash.d.ts +7 -0
- package/dest/tx/tx_hash.d.ts.map +1 -1
- package/dest/tx/tx_hash.js +19 -1
- package/dest/tx/tx_request.d.ts +5 -5
- package/dest/tx/tx_request.d.ts.map +1 -1
- package/dest/tx/tx_request.js +7 -7
- package/dest/tx/validator/error_texts.d.ts +1 -0
- package/dest/tx/validator/error_texts.d.ts.map +1 -1
- package/dest/tx/validator/error_texts.js +1 -0
- package/dest/tx/validator/tx_validator.d.ts +6 -4
- package/dest/tx/validator/tx_validator.d.ts.map +1 -1
- package/dest/tx/validator/tx_validator.js +3 -0
- package/dest/versioning/versioning.d.ts.map +1 -1
- package/dest/vks/verification_key.d.ts.map +1 -1
- package/dest/vks/verification_key.js +4 -4
- package/package.json +10 -9
- package/src/abi/abi.ts +0 -38
- package/src/abi/authorization_selector.ts +95 -0
- package/src/abi/contract_artifact.ts +0 -49
- package/src/abi/decoder.ts +3 -6
- package/src/abi/index.ts +1 -0
- package/src/avm/avm.ts +7 -9
- package/src/block/l2_block.ts +18 -0
- package/src/block/l2_block_source.ts +70 -1
- package/src/block/proposal/committee_attestation.ts +5 -1
- package/src/block/published_l2_block.ts +14 -5
- package/src/contract/contract_instance.ts +3 -3
- package/src/contract/interfaces/protocol_contract_addresses.ts +5 -10
- package/src/contract/private_function_membership_proof.ts +1 -1
- package/src/contract/utility_function_membership_proof.ts +1 -1
- package/src/{shared_mutable/shared_mutable_values.ts → delayed_public_mutable/delayed_public_mutable_values.ts} +10 -10
- package/src/delayed_public_mutable/delayed_public_mutable_values_with_hash.ts +38 -0
- package/src/delayed_public_mutable/index.ts +4 -0
- package/src/gas/gas.ts +4 -0
- package/src/hash/hash.ts +1 -4
- package/src/interfaces/archiver.ts +3 -1
- package/src/interfaces/aztec-node-admin.ts +19 -8
- package/src/interfaces/configs.ts +17 -0
- package/src/interfaces/pxe.ts +4 -2
- package/src/interfaces/server.ts +4 -2
- package/src/interfaces/slasher.ts +49 -0
- package/src/interfaces/tx_provider.ts +16 -0
- package/src/kernel/claimed_length_array.ts +104 -0
- package/src/kernel/hints/build_note_hash_read_request_hints.ts +28 -30
- package/src/kernel/hints/build_nullifier_read_request_hints.ts +28 -59
- package/src/kernel/hints/build_transient_data_hints.ts +12 -14
- package/src/kernel/hints/index.ts +1 -2
- package/src/kernel/hints/note_hash_read_request_hints.ts +4 -16
- package/src/kernel/hints/nullifier_read_request_hints.ts +4 -16
- package/src/kernel/hints/private_kernel_reset_hints.ts +7 -7
- package/src/kernel/hints/read_request_hints.ts +22 -22
- package/src/kernel/hints/{transient_data_index_hint.ts → transient_data_squashing_hint.ts} +5 -5
- package/src/kernel/index.ts +1 -0
- package/src/kernel/private_accumulated_data.ts +23 -23
- package/src/kernel/private_call_data.ts +3 -3
- package/src/kernel/private_circuit_public_inputs.ts +92 -68
- package/src/kernel/private_kernel_circuit_public_inputs.ts +9 -1
- package/src/kernel/private_kernel_tail_circuit_private_inputs.ts +13 -4
- package/src/kernel/private_kernel_tail_circuit_public_inputs.ts +20 -20
- package/src/kernel/private_to_public_kernel_circuit_public_inputs.ts +7 -7
- package/src/kernel/private_to_rollup_kernel_circuit_public_inputs.ts +16 -10
- package/src/kernel/private_validation_requests.ts +19 -50
- package/src/kernel/utils/order_and_comparison.ts +0 -25
- package/src/logs/shared_secret_derivation.ts +1 -1
- package/src/messaging/l2_to_l1_membership.ts +76 -85
- package/src/messaging/l2_to_l1_message.ts +9 -0
- package/src/note/notes_filter.ts +6 -3
- package/src/p2p/attestation_utils.ts +35 -0
- package/src/p2p/block_attestation.ts +3 -4
- package/src/p2p/block_proposal.ts +23 -5
- package/src/p2p/consensus_payload.ts +10 -29
- package/src/p2p/index.ts +1 -0
- package/src/p2p/topic_type.ts +3 -1
- package/src/slashing/index.ts +74 -0
- package/src/stats/stats.ts +2 -2
- package/src/tests/factories.ts +37 -27
- package/src/tests/mocks.ts +24 -22
- package/src/tx/index.ts +0 -1
- package/src/tx/private_execution_result.ts +11 -9
- package/src/tx/processed_tx.ts +6 -6
- package/src/tx/proven_tx.ts +7 -8
- package/src/tx/simulated_tx.ts +13 -19
- package/src/tx/tx.ts +70 -57
- package/src/tx/tx_effect.ts +5 -20
- package/src/tx/tx_execution_request.ts +2 -2
- package/src/tx/tx_hash.ts +21 -1
- package/src/tx/tx_request.ts +7 -6
- package/src/tx/validator/error_texts.ts +1 -0
- package/src/tx/validator/tx_validator.ts +5 -0
- package/src/versioning/versioning.ts +0 -3
- package/src/vks/verification_key.ts +4 -7
- package/dest/interfaces/tx-collector.d.ts +0 -15
- package/dest/interfaces/tx-collector.d.ts.map +0 -1
- package/dest/kernel/hints/rollup_validation_requests.d.ts +0 -34
- package/dest/kernel/hints/rollup_validation_requests.d.ts.map +0 -1
- package/dest/kernel/hints/rollup_validation_requests.js +0 -55
- package/dest/kernel/hints/transient_data_index_hint.d.ts.map +0 -1
- package/dest/shared_mutable/index.d.ts +0 -5
- package/dest/shared_mutable/index.d.ts.map +0 -1
- package/dest/shared_mutable/index.js +0 -4
- package/dest/shared_mutable/scheduled_delay_change.d.ts.map +0 -1
- package/dest/shared_mutable/scheduled_value_change.d.ts.map +0 -1
- package/dest/shared_mutable/shared_mutable_values.d.ts +0 -20
- package/dest/shared_mutable/shared_mutable_values.d.ts.map +0 -1
- package/dest/shared_mutable/shared_mutable_values_with_hash.d.ts.map +0 -1
- package/dest/shared_mutable/shared_mutable_values_with_hash.js +0 -30
- package/dest/tx/include_by_timestamp.d.ts +0 -54
- package/dest/tx/include_by_timestamp.d.ts.map +0 -1
- package/dest/tx/include_by_timestamp.js +0 -72
- package/src/interfaces/tx-collector.ts +0 -17
- package/src/kernel/hints/rollup_validation_requests.ts +0 -71
- package/src/shared_mutable/index.ts +0 -4
- package/src/shared_mutable/shared_mutable_values_with_hash.ts +0 -38
- package/src/tx/include_by_timestamp.ts +0 -90
- /package/dest/{shared_mutable → delayed_public_mutable}/scheduled_delay_change.d.ts +0 -0
- /package/dest/{shared_mutable → delayed_public_mutable}/scheduled_delay_change.js +0 -0
- /package/dest/{shared_mutable → delayed_public_mutable}/scheduled_value_change.d.ts +0 -0
- /package/dest/{shared_mutable → delayed_public_mutable}/scheduled_value_change.js +0 -0
- /package/dest/interfaces/{tx-collector.js → tx_provider.js} +0 -0
- /package/src/{shared_mutable → delayed_public_mutable}/scheduled_delay_change.ts +0 -0
- /package/src/{shared_mutable → delayed_public_mutable}/scheduled_value_change.ts +0 -0
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
2
|
+
import { type ZodFor, schemas } from '@aztec/foundation/schemas';
|
|
2
3
|
import type { TypedEventEmitter } from '@aztec/foundation/types';
|
|
3
4
|
|
|
4
5
|
import { z } from 'zod';
|
|
5
6
|
|
|
6
7
|
import type { L1RollupConstants } from '../epoch-helpers/index.js';
|
|
8
|
+
import { BlockAttestation } from '../p2p/block_attestation.js';
|
|
7
9
|
import type { BlockHeader } from '../tx/block_header.js';
|
|
8
10
|
import type { IndexedTxEffect } from '../tx/indexed_tx_effect.js';
|
|
9
11
|
import type { TxHash } from '../tx/tx_hash.js';
|
|
10
12
|
import type { TxReceipt } from '../tx/tx_receipt.js';
|
|
11
13
|
import type { L2Block } from './l2_block.js';
|
|
12
|
-
import
|
|
14
|
+
import { PublishedL2Block } from './published_l2_block.js';
|
|
13
15
|
|
|
14
16
|
/**
|
|
15
17
|
* Interface of classes allowing for the retrieval of L2 blocks.
|
|
@@ -122,10 +124,70 @@ export interface L2BlockSource {
|
|
|
122
124
|
/** Latest synced L1 timestamp. */
|
|
123
125
|
getL1Timestamp(): Promise<bigint>;
|
|
124
126
|
|
|
127
|
+
/**
|
|
128
|
+
* Returns whether the latest block in the pending chain on L1 is invalid (ie its attestations are incorrect).
|
|
129
|
+
* Note that invalid blocks do not get synced, so the latest block returned by the block source is always a valid one.
|
|
130
|
+
*/
|
|
131
|
+
isPendingChainInvalid(): Promise<boolean>;
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Returns the status of the pending chain validation. If the chain is invalid, reports the earliest consecutive block
|
|
135
|
+
* that is invalid, along with the reason for being invalid, which can be used to trigger an invalidation.
|
|
136
|
+
*/
|
|
137
|
+
getPendingChainValidationStatus(): Promise<ValidateBlockResult>;
|
|
138
|
+
|
|
125
139
|
/** Force a sync. */
|
|
126
140
|
syncImmediate(): Promise<void>;
|
|
127
141
|
}
|
|
128
142
|
|
|
143
|
+
/** Subtype for invalid block validation results */
|
|
144
|
+
export type ValidateBlockNegativeResult =
|
|
145
|
+
| {
|
|
146
|
+
valid: false;
|
|
147
|
+
block: PublishedL2Block;
|
|
148
|
+
committee: EthAddress[];
|
|
149
|
+
epoch: bigint;
|
|
150
|
+
seed: bigint;
|
|
151
|
+
attestations: BlockAttestation[];
|
|
152
|
+
reason: 'insufficient-attestations';
|
|
153
|
+
}
|
|
154
|
+
| {
|
|
155
|
+
valid: false;
|
|
156
|
+
block: PublishedL2Block;
|
|
157
|
+
committee: EthAddress[];
|
|
158
|
+
epoch: bigint;
|
|
159
|
+
seed: bigint;
|
|
160
|
+
reason: 'invalid-attestation';
|
|
161
|
+
attestations: BlockAttestation[];
|
|
162
|
+
invalidIndex: number;
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
/** Result type for validating a block attestations */
|
|
166
|
+
export type ValidateBlockResult = { valid: true } | ValidateBlockNegativeResult;
|
|
167
|
+
|
|
168
|
+
export const ValidateBlockResultSchema = z.union([
|
|
169
|
+
z.object({ valid: z.literal(true), block: PublishedL2Block.schema.optional() }),
|
|
170
|
+
z.object({
|
|
171
|
+
valid: z.literal(false),
|
|
172
|
+
block: PublishedL2Block.schema,
|
|
173
|
+
committee: z.array(schemas.EthAddress),
|
|
174
|
+
epoch: schemas.BigInt,
|
|
175
|
+
seed: schemas.BigInt,
|
|
176
|
+
attestations: z.array(BlockAttestation.schema),
|
|
177
|
+
reason: z.literal('insufficient-attestations'),
|
|
178
|
+
}),
|
|
179
|
+
z.object({
|
|
180
|
+
valid: z.literal(false),
|
|
181
|
+
block: PublishedL2Block.schema,
|
|
182
|
+
committee: z.array(schemas.EthAddress),
|
|
183
|
+
epoch: schemas.BigInt,
|
|
184
|
+
seed: schemas.BigInt,
|
|
185
|
+
attestations: z.array(BlockAttestation.schema),
|
|
186
|
+
reason: z.literal('invalid-attestation'),
|
|
187
|
+
invalidIndex: z.number(),
|
|
188
|
+
}),
|
|
189
|
+
]) satisfies ZodFor<ValidateBlockResult>;
|
|
190
|
+
|
|
129
191
|
/**
|
|
130
192
|
* L2BlockSource that emits events upon pending / proven chain changes.
|
|
131
193
|
* see L2BlockSourceEvents for the events emitted.
|
|
@@ -134,6 +196,7 @@ export interface L2BlockSource {
|
|
|
134
196
|
export type ArchiverEmitter = TypedEventEmitter<{
|
|
135
197
|
[L2BlockSourceEvents.L2PruneDetected]: (args: L2BlockPruneEvent) => void;
|
|
136
198
|
[L2BlockSourceEvents.L2BlockProven]: (args: L2BlockProvenEvent) => void;
|
|
199
|
+
[L2BlockSourceEvents.InvalidAttestationsBlockDetected]: (args: InvalidBlockDetectedEvent) => void;
|
|
137
200
|
}>;
|
|
138
201
|
export interface L2BlockSourceEventEmitter extends L2BlockSource, ArchiverEmitter {}
|
|
139
202
|
|
|
@@ -180,6 +243,7 @@ export const L2TipsSchema = z.object({
|
|
|
180
243
|
export enum L2BlockSourceEvents {
|
|
181
244
|
L2PruneDetected = 'l2PruneDetected',
|
|
182
245
|
L2BlockProven = 'l2BlockProven',
|
|
246
|
+
InvalidAttestationsBlockDetected = 'invalidBlockDetected',
|
|
183
247
|
}
|
|
184
248
|
|
|
185
249
|
export type L2BlockProvenEvent = {
|
|
@@ -194,3 +258,8 @@ export type L2BlockPruneEvent = {
|
|
|
194
258
|
epochNumber: bigint;
|
|
195
259
|
blocks: L2Block[];
|
|
196
260
|
};
|
|
261
|
+
|
|
262
|
+
export type InvalidBlockDetectedEvent = {
|
|
263
|
+
type: 'invalidBlockDetected';
|
|
264
|
+
validationResult: ValidateBlockNegativeResult;
|
|
265
|
+
};
|
|
@@ -32,11 +32,15 @@ export class CommitteeAttestation {
|
|
|
32
32
|
return new CommitteeAttestation(address, signature);
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
+
static fromSignature(signature: Signature): CommitteeAttestation {
|
|
36
|
+
return new CommitteeAttestation(EthAddress.ZERO, signature);
|
|
37
|
+
}
|
|
38
|
+
|
|
35
39
|
static fromViem(viem: ViemCommitteeAttestation): CommitteeAttestation {
|
|
36
40
|
return new CommitteeAttestation(EthAddress.fromString(viem.addr), Signature.fromViemSignature(viem.signature));
|
|
37
41
|
}
|
|
38
42
|
|
|
39
|
-
static fromBuffer(buffer: Buffer): CommitteeAttestation {
|
|
43
|
+
static fromBuffer(buffer: Buffer | BufferReader): CommitteeAttestation {
|
|
40
44
|
const reader = BufferReader.asReader(buffer);
|
|
41
45
|
const address = reader.readObject(EthAddress);
|
|
42
46
|
const signature = reader.readObject(Signature);
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
// Ignoring import issue to fix portable inferred type issue in zod schema
|
|
2
|
+
import { Buffer32 } from '@aztec/foundation/buffer';
|
|
3
|
+
import { randomBigInt } from '@aztec/foundation/crypto';
|
|
2
4
|
import { schemas } from '@aztec/foundation/schemas';
|
|
3
5
|
|
|
4
6
|
import { z } from 'zod';
|
|
@@ -22,6 +24,14 @@ export class L1PublishedData {
|
|
|
22
24
|
blockHash: z.string(),
|
|
23
25
|
});
|
|
24
26
|
}
|
|
27
|
+
|
|
28
|
+
static random() {
|
|
29
|
+
return new L1PublishedData(
|
|
30
|
+
randomBigInt(1000n) + 1n,
|
|
31
|
+
BigInt(Math.floor(Date.now() / 1000)),
|
|
32
|
+
Buffer32.random().toString(),
|
|
33
|
+
);
|
|
34
|
+
}
|
|
25
35
|
}
|
|
26
36
|
|
|
27
37
|
export class PublishedL2Block {
|
|
@@ -40,12 +50,11 @@ export class PublishedL2Block {
|
|
|
40
50
|
}
|
|
41
51
|
}
|
|
42
52
|
|
|
43
|
-
export function getAttestationsFromPublishedL2Block(
|
|
53
|
+
export function getAttestationsFromPublishedL2Block(
|
|
54
|
+
block: Pick<PublishedL2Block, 'attestations' | 'block'>,
|
|
55
|
+
): BlockAttestation[] {
|
|
44
56
|
const payload = ConsensusPayload.fromBlock(block.block);
|
|
45
57
|
return block.attestations
|
|
46
58
|
.filter(attestation => !attestation.signature.isEmpty())
|
|
47
|
-
.map(
|
|
48
|
-
attestation =>
|
|
49
|
-
new BlockAttestation(block.block.header.globalVariables.blockNumber, payload, attestation.signature),
|
|
50
|
-
);
|
|
59
|
+
.map(attestation => new BlockAttestation(block.block.number, payload, attestation.signature));
|
|
51
60
|
}
|
|
@@ -100,12 +100,12 @@ export class SerializableContractInstance {
|
|
|
100
100
|
}
|
|
101
101
|
|
|
102
102
|
/**
|
|
103
|
-
* Generates a Contract Instance from
|
|
103
|
+
* Generates a Contract Instance from some instantiation params.
|
|
104
104
|
* @param artifact - The account contract build artifact.
|
|
105
|
-
* @param opts - Options for the
|
|
105
|
+
* @param opts - Options for the contract's instantiation.
|
|
106
106
|
* @returns - The contract instance
|
|
107
107
|
*/
|
|
108
|
-
export async function
|
|
108
|
+
export async function getContractInstanceFromInstantiationParams(
|
|
109
109
|
artifact: ContractArtifact,
|
|
110
110
|
opts: {
|
|
111
111
|
constructorArtifact?: FunctionAbi | string;
|
|
@@ -3,23 +3,18 @@ import { z } from 'zod';
|
|
|
3
3
|
import type { AztecAddress } from '../../aztec-address/index.js';
|
|
4
4
|
import { schemas } from '../../schemas/index.js';
|
|
5
5
|
|
|
6
|
-
export const ProtocolContractsNames = [
|
|
7
|
-
'classRegisterer',
|
|
8
|
-
'feeJuice',
|
|
9
|
-
'instanceDeployer',
|
|
10
|
-
'multiCallEntrypoint',
|
|
11
|
-
] as const;
|
|
6
|
+
export const ProtocolContractsNames = ['classRegistry', 'feeJuice', 'instanceRegistry', 'multiCallEntrypoint'] as const;
|
|
12
7
|
|
|
13
8
|
export type ProtocolContractAddresses = {
|
|
14
|
-
|
|
9
|
+
classRegistry: AztecAddress;
|
|
15
10
|
feeJuice: AztecAddress;
|
|
16
|
-
|
|
11
|
+
instanceRegistry: AztecAddress;
|
|
17
12
|
multiCallEntrypoint: AztecAddress;
|
|
18
13
|
};
|
|
19
14
|
|
|
20
15
|
export const ProtocolContractAddressesSchema = z.object({
|
|
21
|
-
|
|
16
|
+
classRegistry: schemas.AztecAddress,
|
|
22
17
|
feeJuice: schemas.AztecAddress,
|
|
23
|
-
|
|
18
|
+
instanceRegistry: schemas.AztecAddress,
|
|
24
19
|
multiCallEntrypoint: schemas.AztecAddress,
|
|
25
20
|
});
|
|
@@ -91,7 +91,7 @@ export async function createPrivateFunctionMembershipProof(
|
|
|
91
91
|
}
|
|
92
92
|
|
|
93
93
|
/**
|
|
94
|
-
* Verifies that a private function with a membership proof as emitted by the
|
|
94
|
+
* Verifies that a private function with a membership proof as emitted by the ClassRegistry contract is valid,
|
|
95
95
|
* as defined in the protocol specs at contract-deployment/classes:
|
|
96
96
|
*
|
|
97
97
|
* ```
|
|
@@ -66,7 +66,7 @@ export async function createUtilityFunctionMembershipProof(
|
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
/**
|
|
69
|
-
* Verifies that a utility function with a membership proof as emitted by the
|
|
69
|
+
* Verifies that a utility function with a membership proof as emitted by the ClassRegistry contract is valid,
|
|
70
70
|
* as defined in the protocol specs at contract-deployment/classes:
|
|
71
71
|
*
|
|
72
72
|
* ```
|
|
@@ -6,9 +6,9 @@ import { BufferReader, FieldReader, serializeToBuffer } from '@aztec/foundation/
|
|
|
6
6
|
import { ScheduledDelayChange } from './scheduled_delay_change.js';
|
|
7
7
|
import { ScheduledValueChange } from './scheduled_value_change.js';
|
|
8
8
|
|
|
9
|
-
export const
|
|
9
|
+
export const DELAYED_PUBLIC_MUTABLE_VALUES_LEN = 2 * UPDATES_VALUE_SIZE + 1;
|
|
10
10
|
|
|
11
|
-
export class
|
|
11
|
+
export class DelayedPublicMutableValues {
|
|
12
12
|
constructor(
|
|
13
13
|
public svc: ScheduledValueChange,
|
|
14
14
|
public sdc: ScheduledDelayChange,
|
|
@@ -58,32 +58,32 @@ export class SharedMutableValues {
|
|
|
58
58
|
return serializeToBuffer(this.toFields());
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
static fromBuffer(buffer: Buffer | BufferReader, valueSize: number):
|
|
61
|
+
static fromBuffer(buffer: Buffer | BufferReader, valueSize: number): DelayedPublicMutableValues {
|
|
62
62
|
const reader = BufferReader.asReader(buffer);
|
|
63
|
-
return
|
|
63
|
+
return DelayedPublicMutableValues.fromFields(reader.readArray(2 * valueSize + 1, Fr));
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
static empty(valueSize: number) {
|
|
67
67
|
return new this(ScheduledValueChange.empty(valueSize), ScheduledDelayChange.empty());
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
static async readFromTree(
|
|
70
|
+
static async readFromTree(delayedPublicMutableSlot: Fr, readStorage: (storageSlot: Fr) => Promise<Fr>) {
|
|
71
71
|
const fields = [];
|
|
72
|
-
for (let i = 0; i <
|
|
73
|
-
fields.push(await readStorage(
|
|
72
|
+
for (let i = 0; i < DELAYED_PUBLIC_MUTABLE_VALUES_LEN; i++) {
|
|
73
|
+
fields.push(await readStorage(delayedPublicMutableSlot.add(new Fr(i))));
|
|
74
74
|
}
|
|
75
|
-
return
|
|
75
|
+
return DelayedPublicMutableValues.fromFields(fields);
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
isEmpty(): boolean {
|
|
79
79
|
return this.svc.isEmpty() && this.sdc.isEmpty();
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
-
async writeToTree(
|
|
82
|
+
async writeToTree(delayedPublicMutableSlot: Fr, storageWrite: (storageSlot: Fr, value: Fr) => Promise<void>) {
|
|
83
83
|
const fields = this.toFields();
|
|
84
84
|
|
|
85
85
|
for (let i = 0; i < fields.length; i++) {
|
|
86
|
-
await storageWrite(
|
|
86
|
+
await storageWrite(delayedPublicMutableSlot.add(new Fr(i)), fields[i]);
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
89
|
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { UPDATED_CLASS_IDS_SLOT } from '@aztec/constants';
|
|
2
|
+
import { Fr } from '@aztec/foundation/fields';
|
|
3
|
+
|
|
4
|
+
import type { AztecAddress } from '../aztec-address/index.js';
|
|
5
|
+
import { deriveStorageSlotInMap } from '../hash/map_slot.js';
|
|
6
|
+
import { DELAYED_PUBLIC_MUTABLE_VALUES_LEN, DelayedPublicMutableValues } from './delayed_public_mutable_values.js';
|
|
7
|
+
import { ScheduledDelayChange } from './scheduled_delay_change.js';
|
|
8
|
+
import { ScheduledValueChange } from './scheduled_value_change.js';
|
|
9
|
+
|
|
10
|
+
export class DelayedPublicMutableValuesWithHash {
|
|
11
|
+
private dpmv: DelayedPublicMutableValues;
|
|
12
|
+
|
|
13
|
+
constructor(svc: ScheduledValueChange, sdc: ScheduledDelayChange) {
|
|
14
|
+
this.dpmv = new DelayedPublicMutableValues(svc, sdc);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
async toFields(): Promise<Fr[]> {
|
|
18
|
+
return [...this.dpmv.toFields(), await this.dpmv.hash()];
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
async writeToTree(delayedPublicMutableSlot: Fr, storageWrite: (storageSlot: Fr, value: Fr) => Promise<void>) {
|
|
22
|
+
const fields = await this.toFields();
|
|
23
|
+
|
|
24
|
+
for (let i = 0; i < fields.length; i++) {
|
|
25
|
+
await storageWrite(delayedPublicMutableSlot.add(new Fr(i)), fields[i]);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
static async getContractUpdateSlots(contractAddress: AztecAddress) {
|
|
30
|
+
const delayedPublicMutableSlot = await deriveStorageSlotInMap(new Fr(UPDATED_CLASS_IDS_SLOT), contractAddress);
|
|
31
|
+
const delayedPublicMutableHashSlot = delayedPublicMutableSlot.add(new Fr(DELAYED_PUBLIC_MUTABLE_VALUES_LEN));
|
|
32
|
+
|
|
33
|
+
return {
|
|
34
|
+
delayedPublicMutableSlot,
|
|
35
|
+
delayedPublicMutableHashSlot,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
}
|
package/src/gas/gas.ts
CHANGED
package/src/hash/hash.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { GeneratorIndex } from '@aztec/constants';
|
|
2
|
-
import { toBigIntBE } from '@aztec/foundation/bigint-buffer';
|
|
3
2
|
import { poseidon2Hash, poseidon2HashWithSeparator, sha256ToField } from '@aztec/foundation/crypto';
|
|
4
3
|
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
5
4
|
import { Fr } from '@aztec/foundation/fields';
|
|
@@ -13,9 +12,7 @@ import type { AztecAddress } from '../aztec-address/index.js';
|
|
|
13
12
|
*/
|
|
14
13
|
export async function hashVK(keyAsFields: Fr[]): Promise<Fr> {
|
|
15
14
|
// Should match the implementation in barretenberg/cpp/src/barretenberg/flavor/flavor.hpp > hash()
|
|
16
|
-
|
|
17
|
-
// Taking the last 16 bytes (128 bits) of the hash.
|
|
18
|
-
return new Fr(toBigIntBE(hash.subarray(Fr.SIZE_IN_BYTES - 16)));
|
|
15
|
+
return await poseidon2Hash(keyAsFields);
|
|
19
16
|
}
|
|
20
17
|
|
|
21
18
|
/**
|
|
@@ -3,7 +3,7 @@ import type { ApiSchemaFor } from '@aztec/foundation/schemas';
|
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
|
|
5
5
|
import { L2Block } from '../block/l2_block.js';
|
|
6
|
-
import { type L2BlockSource, L2TipsSchema } from '../block/l2_block_source.js';
|
|
6
|
+
import { type L2BlockSource, L2TipsSchema, ValidateBlockResultSchema } from '../block/l2_block_source.js';
|
|
7
7
|
import { PublishedL2Block } from '../block/published_l2_block.js';
|
|
8
8
|
import {
|
|
9
9
|
ContractClassPublicSchema,
|
|
@@ -75,4 +75,6 @@ export const ArchiverApiSchema: ApiSchemaFor<ArchiverApi> = {
|
|
|
75
75
|
getL1Constants: z.function().args().returns(L1RollupConstantsSchema),
|
|
76
76
|
getL1Timestamp: z.function().args().returns(schemas.BigInt),
|
|
77
77
|
syncImmediate: z.function().args().returns(z.void()),
|
|
78
|
+
isPendingChainInvalid: z.function().args().returns(z.boolean()),
|
|
79
|
+
getPendingChainValidationStatus: z.function().args().returns(ValidateBlockResultSchema),
|
|
78
80
|
};
|
|
@@ -3,25 +3,26 @@ import { createSafeJsonRpcClient, defaultFetch } from '@aztec/foundation/json-rp
|
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
|
|
5
5
|
import type { ApiSchemaFor } from '../schemas/schemas.js';
|
|
6
|
+
import { type MonitoredSlashPayload, MonitoredSlashPayloadSchema } from '../slashing/index.js';
|
|
6
7
|
import { type ComponentsVersions, getVersioningResponseHandler } from '../versioning/index.js';
|
|
7
8
|
import { type SequencerConfig, SequencerConfigSchema } from './configs.js';
|
|
8
9
|
import { type ProverConfig, ProverConfigSchema } from './prover-client.js';
|
|
10
|
+
import { type SlasherConfig, SlasherConfigSchema } from './slasher.js';
|
|
9
11
|
|
|
10
12
|
/**
|
|
11
13
|
* Aztec node admin API.
|
|
12
14
|
*/
|
|
13
15
|
export interface AztecNodeAdmin {
|
|
14
16
|
/**
|
|
15
|
-
*
|
|
16
|
-
* @param config - Updated configuration to be merged with the current one.
|
|
17
|
+
* Retrieves the configuration of this node.
|
|
17
18
|
*/
|
|
18
|
-
|
|
19
|
+
getConfig(): Promise<AztecNodeAdminConfig>;
|
|
19
20
|
|
|
20
21
|
/**
|
|
21
|
-
*
|
|
22
|
-
*
|
|
22
|
+
* Updates the configuration of this node.
|
|
23
|
+
* @param config - Updated configuration to be merged with the current one.
|
|
23
24
|
*/
|
|
24
|
-
|
|
25
|
+
setConfig(config: Partial<AztecNodeAdminConfig>): Promise<void>;
|
|
25
26
|
|
|
26
27
|
/**
|
|
27
28
|
* Pauses syncing, creates a backup of archiver and world-state databases, and uploads them. Returns immediately.
|
|
@@ -41,15 +42,25 @@ export interface AztecNodeAdmin {
|
|
|
41
42
|
|
|
42
43
|
/** Resumes archiver and world state syncing. */
|
|
43
44
|
resumeSync(): Promise<void>;
|
|
45
|
+
|
|
46
|
+
/** Returns all monitored payloads by the slasher. */
|
|
47
|
+
getSlasherMonitoredPayloads(): Promise<MonitoredSlashPayload[]>;
|
|
44
48
|
}
|
|
45
49
|
|
|
50
|
+
export type AztecNodeAdminConfig = SequencerConfig & ProverConfig & SlasherConfig & { maxTxPoolSize: number };
|
|
51
|
+
|
|
52
|
+
export const AztecNodeAdminConfigSchema = SequencerConfigSchema.merge(ProverConfigSchema)
|
|
53
|
+
.merge(SlasherConfigSchema)
|
|
54
|
+
.merge(z.object({ maxTxPoolSize: z.number() }));
|
|
55
|
+
|
|
46
56
|
export const AztecNodeAdminApiSchema: ApiSchemaFor<AztecNodeAdmin> = {
|
|
47
|
-
|
|
48
|
-
|
|
57
|
+
getConfig: z.function().returns(AztecNodeAdminConfigSchema),
|
|
58
|
+
setConfig: z.function().args(AztecNodeAdminConfigSchema.partial()).returns(z.void()),
|
|
49
59
|
startSnapshotUpload: z.function().args(z.string()).returns(z.void()),
|
|
50
60
|
rollbackTo: z.function().args(z.number()).returns(z.void()),
|
|
51
61
|
pauseSync: z.function().returns(z.void()),
|
|
52
62
|
resumeSync: z.function().returns(z.void()),
|
|
63
|
+
getSlasherMonitoredPayloads: z.function().returns(z.array(MonitoredSlashPayloadSchema)),
|
|
53
64
|
};
|
|
54
65
|
|
|
55
66
|
export function createAztecNodeAdminClient(
|
|
@@ -40,6 +40,18 @@ export interface SequencerConfig {
|
|
|
40
40
|
enforceTimeTable?: boolean;
|
|
41
41
|
/** How many seconds into an L1 slot we can still send a tx and get it mined. */
|
|
42
42
|
maxL1TxInclusionTimeIntoSlot?: number;
|
|
43
|
+
/** Used for testing to introduce a fake delay after processing each tx */
|
|
44
|
+
fakeProcessingDelayPerTxMs?: number;
|
|
45
|
+
/** How many seconds it takes for proposals and attestations to travel across the p2p layer (one-way) */
|
|
46
|
+
attestationPropagationTime?: number;
|
|
47
|
+
/** How many seconds before invalidating a block as a committee member (zero to never invalidate) */
|
|
48
|
+
secondsBeforeInvalidatingBlockAsCommitteeMember?: number;
|
|
49
|
+
/** How many seconds before invalidating a block as a non-committee member (zero to never invalidate) */
|
|
50
|
+
secondsBeforeInvalidatingBlockAsNonCommitteeMember?: number;
|
|
51
|
+
/** Skip collecting attestations (for testing only) */
|
|
52
|
+
skipCollectingAttestations?: boolean;
|
|
53
|
+
/** Do not invalidate the previous block if invalid when we are the proposer (for testing only) */
|
|
54
|
+
skipInvalidateBlockAsProposer?: boolean;
|
|
43
55
|
}
|
|
44
56
|
|
|
45
57
|
export const SequencerConfigSchema = z.object({
|
|
@@ -58,4 +70,9 @@ export const SequencerConfigSchema = z.object({
|
|
|
58
70
|
governanceProposerPayload: schemas.EthAddress.optional(),
|
|
59
71
|
maxL1TxInclusionTimeIntoSlot: z.number().optional(),
|
|
60
72
|
enforceTimeTable: z.boolean().optional(),
|
|
73
|
+
fakeProcessingDelayPerTxMs: z.number().optional(),
|
|
74
|
+
attestationPropagationTime: z.number().optional(),
|
|
75
|
+
skipCollectingAttestations: z.boolean().optional(),
|
|
76
|
+
secondsBeforeInvalidatingBlockAsCommitteeMember: z.number(),
|
|
77
|
+
secondsBeforeInvalidatingBlockAsNonCommitteeMember: z.number(),
|
|
61
78
|
}) satisfies ZodFor<SequencerConfig>;
|
package/src/interfaces/pxe.ts
CHANGED
|
@@ -125,6 +125,8 @@ export interface PXE {
|
|
|
125
125
|
* This is called by aztec.js when instantiating a contract in a given address with a mismatching artifact.
|
|
126
126
|
* @param contractAddress - The address of the contract to update.
|
|
127
127
|
* @param artifact - The updated artifact for the contract.
|
|
128
|
+
* @throws If the artifact's contract class is not found in the PXE or if the contract class is different from
|
|
129
|
+
* the current one (current one from the point of view of the node to which the PXE is connected).
|
|
128
130
|
*/
|
|
129
131
|
updateContract(contractAddress: AztecAddress, artifact: ContractArtifact): Promise<void>;
|
|
130
132
|
|
|
@@ -417,7 +419,7 @@ export interface PXEInfo {
|
|
|
417
419
|
export interface ContractMetadata {
|
|
418
420
|
contractInstance?: ContractInstanceWithAddress | undefined;
|
|
419
421
|
isContractInitialized: boolean;
|
|
420
|
-
|
|
422
|
+
isContractPublished: boolean;
|
|
421
423
|
}
|
|
422
424
|
|
|
423
425
|
export interface ContractClassMetadata {
|
|
@@ -429,7 +431,7 @@ export interface ContractClassMetadata {
|
|
|
429
431
|
const ContractMetadataSchema = z.object({
|
|
430
432
|
contractInstance: z.union([ContractInstanceWithAddressSchema, z.undefined()]),
|
|
431
433
|
isContractInitialized: z.boolean(),
|
|
432
|
-
|
|
434
|
+
isContractPublished: z.boolean(),
|
|
433
435
|
}) satisfies ZodFor<ContractMetadata>;
|
|
434
436
|
|
|
435
437
|
const ContractClassMetadataSchema = z.object({
|
package/src/interfaces/server.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export * from './allowed_element.js';
|
|
2
|
+
export * from './api_limit.js';
|
|
2
3
|
export * from './archiver.js';
|
|
4
|
+
export * from './aztec-node.js';
|
|
3
5
|
export * from './block-builder.js';
|
|
4
6
|
export * from './configs.js';
|
|
5
7
|
export * from './epoch-prover.js';
|
|
@@ -17,6 +19,6 @@ export * from './proving-job-source.js';
|
|
|
17
19
|
export * from './proving-job.js';
|
|
18
20
|
export * from './server_circuit_prover.js';
|
|
19
21
|
export * from './service.js';
|
|
20
|
-
export * from './
|
|
22
|
+
export * from './slasher.js';
|
|
23
|
+
export * from './tx_provider.js';
|
|
21
24
|
export * from './world_state.js';
|
|
22
|
-
export * from './api_limit.js';
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { SecretValue } from '@aztec/foundation/config';
|
|
2
|
+
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
3
|
+
import { type ZodFor, schemas } from '@aztec/foundation/schemas';
|
|
4
|
+
|
|
5
|
+
import { z } from 'zod';
|
|
6
|
+
|
|
7
|
+
export interface SlasherConfig {
|
|
8
|
+
slashOverridePayload?: EthAddress;
|
|
9
|
+
slashPayloadTtlSeconds: number; // TTL for payloads, in seconds
|
|
10
|
+
slashPruneEnabled: boolean;
|
|
11
|
+
slashPrunePenalty: bigint;
|
|
12
|
+
slashPruneMaxPenalty: bigint;
|
|
13
|
+
slashInvalidBlockEnabled: boolean;
|
|
14
|
+
slashInvalidBlockPenalty: bigint;
|
|
15
|
+
slashInvalidBlockMaxPenalty: bigint;
|
|
16
|
+
slashInactivityEnabled: boolean;
|
|
17
|
+
slashInactivityCreateTargetPercentage: number; // 0-1, 0.9 means 90%. Must be greater than 0
|
|
18
|
+
slashInactivitySignalTargetPercentage: number; // 0-1, 0.6 means 60%. Must be greater than 0
|
|
19
|
+
slashInactivityCreatePenalty: bigint;
|
|
20
|
+
slashInactivityMaxPenalty: bigint;
|
|
21
|
+
slashProposerRoundPollingIntervalSeconds: number;
|
|
22
|
+
slashProposeInvalidAttestationsPenalty: bigint;
|
|
23
|
+
slashProposeInvalidAttestationsMaxPenalty: bigint;
|
|
24
|
+
slashAttestDescendantOfInvalidPenalty: bigint;
|
|
25
|
+
slashAttestDescendantOfInvalidMaxPenalty: bigint;
|
|
26
|
+
slasherPrivateKey: SecretValue<string | undefined>; // Private key of the slasher account used for creating slash payloads
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export const SlasherConfigSchema = z.object({
|
|
30
|
+
slashOverridePayload: schemas.EthAddress.optional(),
|
|
31
|
+
slashPayloadTtlSeconds: z.number(),
|
|
32
|
+
slashPruneEnabled: z.boolean(),
|
|
33
|
+
slashPrunePenalty: schemas.BigInt,
|
|
34
|
+
slashPruneMaxPenalty: schemas.BigInt,
|
|
35
|
+
slashInvalidBlockEnabled: z.boolean(),
|
|
36
|
+
slashInvalidBlockPenalty: schemas.BigInt,
|
|
37
|
+
slashInvalidBlockMaxPenalty: schemas.BigInt,
|
|
38
|
+
slashInactivityEnabled: z.boolean(),
|
|
39
|
+
slashInactivityCreateTargetPercentage: z.number(),
|
|
40
|
+
slashInactivitySignalTargetPercentage: z.number(),
|
|
41
|
+
slashInactivityCreatePenalty: schemas.BigInt,
|
|
42
|
+
slashInactivityMaxPenalty: schemas.BigInt,
|
|
43
|
+
slashProposerRoundPollingIntervalSeconds: z.number(),
|
|
44
|
+
slashProposeInvalidAttestationsPenalty: schemas.BigInt,
|
|
45
|
+
slashProposeInvalidAttestationsMaxPenalty: schemas.BigInt,
|
|
46
|
+
slashAttestDescendantOfInvalidPenalty: schemas.BigInt,
|
|
47
|
+
slashAttestDescendantOfInvalidMaxPenalty: schemas.BigInt,
|
|
48
|
+
slasherPrivateKey: schemas.SecretValue(z.string().optional()),
|
|
49
|
+
}) satisfies ZodFor<SlasherConfig>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { L2Block } from '@aztec/stdlib/block';
|
|
2
|
+
import type { BlockProposal } from '@aztec/stdlib/p2p';
|
|
3
|
+
import { type Tx, TxHash } from '@aztec/stdlib/tx';
|
|
4
|
+
|
|
5
|
+
import type { PeerId } from '@libp2p/interface';
|
|
6
|
+
|
|
7
|
+
export interface ITxProvider {
|
|
8
|
+
getAvailableTxs(txHashes: TxHash[]): Promise<{ txs: Tx[]; missingTxs: TxHash[] }>;
|
|
9
|
+
|
|
10
|
+
getTxsForBlockProposal(
|
|
11
|
+
blockProposal: BlockProposal,
|
|
12
|
+
opts: { pinnedPeer: PeerId | undefined; deadline: Date },
|
|
13
|
+
): Promise<{ txs: Tx[]; missingTxs: TxHash[] }>;
|
|
14
|
+
|
|
15
|
+
getTxsForBlock(block: L2Block, opts: { deadline: Date }): Promise<{ txs: Tx[]; missingTxs: TxHash[] }>;
|
|
16
|
+
}
|