@aztec/stdlib 0.0.1-commit.e588bc7e5 → 0.0.1-commit.e5a3663dd
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/authorization_selector.d.ts +3 -6
- package/dest/abi/authorization_selector.d.ts.map +1 -1
- package/dest/abi/encoder.d.ts +1 -1
- package/dest/abi/encoder.d.ts.map +1 -1
- package/dest/abi/encoder.js +32 -6
- package/dest/abi/event_selector.d.ts +3 -6
- package/dest/abi/event_selector.d.ts.map +1 -1
- package/dest/abi/function_selector.d.ts +3 -6
- package/dest/abi/function_selector.d.ts.map +1 -1
- package/dest/abi/function_selector.js +1 -3
- package/dest/abi/note_selector.d.ts +3 -6
- package/dest/abi/note_selector.d.ts.map +1 -1
- package/dest/abi/note_selector.js +1 -3
- package/dest/abi/selector.d.ts +2 -2
- package/dest/abi/selector.d.ts.map +1 -1
- package/dest/abi/selector.js +1 -1
- package/dest/avm/revert_code.d.ts +8 -18
- package/dest/avm/revert_code.d.ts.map +1 -1
- package/dest/avm/revert_code.js +15 -30
- package/dest/aztec-address/index.d.ts +3 -6
- package/dest/aztec-address/index.d.ts.map +1 -1
- package/dest/aztec-address/index.js +2 -4
- package/dest/block/attestation_info.d.ts +3 -2
- package/dest/block/attestation_info.d.ts.map +1 -1
- package/dest/block/attestation_info.js +7 -5
- package/dest/block/block_data.d.ts +297 -8
- package/dest/block/block_data.d.ts.map +1 -1
- package/dest/block/block_data.js +16 -2
- package/dest/block/block_hash.d.ts +11 -10
- package/dest/block/block_hash.d.ts.map +1 -1
- package/dest/block/block_hash.js +10 -9
- package/dest/block/block_parameter.d.ts +30 -3
- package/dest/block/block_parameter.d.ts.map +1 -1
- package/dest/block/block_parameter.js +36 -2
- package/dest/block/l2_block_info.d.ts +6 -5
- package/dest/block/l2_block_info.d.ts.map +1 -1
- package/dest/block/l2_block_info.js +6 -5
- package/dest/block/l2_block_source.d.ts +39 -4
- package/dest/block/l2_block_source.d.ts.map +1 -1
- package/dest/block/l2_block_stream/interfaces.d.ts +6 -3
- package/dest/block/l2_block_stream/interfaces.d.ts.map +1 -1
- package/dest/block/l2_block_stream/l2_tips_store_base.d.ts +1 -1
- 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 +1 -1
- package/dest/block/proposal/attestations_and_signers.d.ts +13 -6
- package/dest/block/proposal/attestations_and_signers.d.ts.map +1 -1
- package/dest/block/proposal/attestations_and_signers.js +26 -18
- package/dest/block/test/l2_tips_store_test_suite.js +1 -1
- package/dest/checkpoint/checkpoint_data.d.ts +7 -1
- package/dest/checkpoint/checkpoint_data.d.ts.map +1 -1
- package/dest/checkpoint/checkpoint_data.js +2 -0
- package/dest/config/chain-config.d.ts +2 -2
- package/dest/config/chain-config.d.ts.map +1 -1
- package/dest/config/chain-config.js +9 -3
- package/dest/config/sequencer-config.d.ts +5 -3
- package/dest/config/sequencer-config.d.ts.map +1 -1
- package/dest/config/sequencer-config.js +18 -4
- package/dest/contract/contract_address.d.ts +1 -1
- package/dest/contract/contract_address.js +2 -2
- package/dest/contract/private_function.d.ts +1 -1
- package/dest/contract/private_function.d.ts.map +1 -1
- package/dest/contract/private_function.js +2 -4
- package/dest/gas/fee_math.d.ts +49 -0
- package/dest/gas/fee_math.d.ts.map +1 -0
- package/dest/gas/fee_math.js +80 -0
- package/dest/gas/gas_fees.d.ts +5 -1
- package/dest/gas/gas_fees.d.ts.map +1 -1
- package/dest/gas/gas_fees.js +10 -1
- package/dest/gas/gas_settings.d.ts +40 -3
- package/dest/gas/gas_settings.d.ts.map +1 -1
- package/dest/gas/gas_settings.js +50 -6
- package/dest/gas/index.d.ts +2 -1
- package/dest/gas/index.d.ts.map +1 -1
- package/dest/gas/index.js +1 -0
- package/dest/ha-signing/config.d.ts +6 -6
- package/dest/ha-signing/config.d.ts.map +1 -1
- package/dest/ha-signing/config.js +4 -3
- package/dest/ha-signing/index.d.ts +2 -2
- package/dest/ha-signing/index.d.ts.map +1 -1
- package/dest/ha-signing/index.js +1 -1
- package/dest/ha-signing/local_config.d.ts +1 -1
- package/dest/ha-signing/local_config.d.ts.map +1 -1
- package/dest/ha-signing/local_config.js +2 -2
- package/dest/ha-signing/types.d.ts +37 -32
- package/dest/ha-signing/types.d.ts.map +1 -1
- package/dest/ha-signing/types.js +13 -6
- package/dest/hash/hash.d.ts +16 -1
- package/dest/hash/hash.d.ts.map +1 -1
- package/dest/hash/hash.js +32 -0
- package/dest/interfaces/archiver.d.ts +11 -1
- package/dest/interfaces/archiver.d.ts.map +1 -1
- package/dest/interfaces/archiver.js +10 -4
- package/dest/interfaces/aztec-node-admin.d.ts +22 -14
- package/dest/interfaces/aztec-node-admin.d.ts.map +1 -1
- package/dest/interfaces/aztec-node-admin.js +5 -4
- package/dest/interfaces/aztec-node-debug.d.ts +21 -0
- package/dest/interfaces/aztec-node-debug.d.ts.map +1 -0
- package/dest/interfaces/aztec-node-debug.js +18 -0
- package/dest/interfaces/aztec-node.d.ts +54 -55
- package/dest/interfaces/aztec-node.d.ts.map +1 -1
- package/dest/interfaces/aztec-node.js +20 -16
- package/dest/interfaces/block_response.d.ts +156 -0
- package/dest/interfaces/block_response.d.ts.map +1 -0
- package/dest/interfaces/block_response.js +24 -0
- package/dest/interfaces/chain_tips.d.ts +304 -0
- package/dest/interfaces/chain_tips.d.ts.map +1 -0
- package/dest/interfaces/chain_tips.js +11 -0
- package/dest/interfaces/checkpoint_parameter.d.ts +27 -0
- package/dest/interfaces/checkpoint_parameter.d.ts.map +1 -0
- package/dest/interfaces/checkpoint_parameter.js +20 -0
- package/dest/interfaces/checkpoint_response.d.ts +312 -0
- package/dest/interfaces/checkpoint_response.d.ts.map +1 -0
- package/dest/interfaces/checkpoint_response.js +26 -0
- package/dest/interfaces/client.d.ts +7 -1
- package/dest/interfaces/client.d.ts.map +1 -1
- package/dest/interfaces/client.js +6 -0
- package/dest/interfaces/configs.d.ts +12 -2
- package/dest/interfaces/configs.d.ts.map +1 -1
- package/dest/interfaces/configs.js +3 -1
- package/dest/interfaces/l1_publish_info.d.ts +43 -0
- package/dest/interfaces/l1_publish_info.d.ts.map +1 -0
- package/dest/interfaces/l1_publish_info.js +26 -0
- package/dest/interfaces/merkle_tree_operations.d.ts +4 -3
- package/dest/interfaces/merkle_tree_operations.d.ts.map +1 -1
- package/dest/interfaces/prover-client.d.ts +1 -1
- package/dest/interfaces/prover-client.d.ts.map +1 -1
- package/dest/interfaces/prover-client.js +0 -3
- package/dest/interfaces/proving-job.d.ts +166 -166
- package/dest/interfaces/server.d.ts +6 -1
- package/dest/interfaces/server.d.ts.map +1 -1
- package/dest/interfaces/server.js +5 -0
- package/dest/interfaces/slasher.d.ts +1 -10
- package/dest/interfaces/slasher.d.ts.map +1 -1
- package/dest/interfaces/slasher.js +0 -2
- package/dest/interfaces/validator.d.ts +27 -18
- package/dest/interfaces/validator.d.ts.map +1 -1
- package/dest/interfaces/validator.js +2 -0
- package/dest/l1-contracts/index.d.ts +2 -2
- package/dest/l1-contracts/index.d.ts.map +1 -1
- package/dest/l1-contracts/index.js +1 -1
- package/dest/logs/log_id.d.ts +1 -1
- package/dest/logs/log_id.d.ts.map +1 -1
- package/dest/logs/log_id.js +1 -2
- package/dest/logs/siloed_tag.d.ts +5 -7
- package/dest/logs/siloed_tag.d.ts.map +1 -1
- package/dest/logs/siloed_tag.js +4 -0
- package/dest/logs/tag.d.ts +5 -6
- package/dest/logs/tag.d.ts.map +1 -1
- package/dest/logs/tag.js +4 -0
- package/dest/p2p/block_proposal.d.ts +22 -14
- package/dest/p2p/block_proposal.d.ts.map +1 -1
- package/dest/p2p/block_proposal.js +45 -40
- package/dest/p2p/checkpoint_attestation.d.ts +10 -8
- package/dest/p2p/checkpoint_attestation.d.ts.map +1 -1
- package/dest/p2p/checkpoint_attestation.js +17 -24
- package/dest/p2p/checkpoint_proposal.d.ts +20 -14
- package/dest/p2p/checkpoint_proposal.d.ts.map +1 -1
- package/dest/p2p/checkpoint_proposal.js +34 -51
- package/dest/p2p/consensus_payload.d.ts +18 -7
- package/dest/p2p/consensus_payload.d.ts.map +1 -1
- package/dest/p2p/consensus_payload.js +31 -19
- package/dest/p2p/gossipable.d.ts +4 -4
- package/dest/p2p/gossipable.d.ts.map +1 -1
- package/dest/p2p/signature_utils.d.ts +28 -19
- package/dest/p2p/signature_utils.d.ts.map +1 -1
- package/dest/p2p/signature_utils.js +118 -21
- package/dest/p2p/signed_txs.d.ts +15 -13
- package/dest/p2p/signed_txs.d.ts.map +1 -1
- package/dest/p2p/signed_txs.js +26 -24
- package/dest/parity/parity_base_private_inputs.d.ts +7 -3
- package/dest/parity/parity_base_private_inputs.d.ts.map +1 -1
- package/dest/parity/parity_base_private_inputs.js +7 -5
- package/dest/parity/parity_public_inputs.d.ts +7 -3
- package/dest/parity/parity_public_inputs.d.ts.map +1 -1
- package/dest/parity/parity_public_inputs.js +6 -3
- package/dest/rollup/block_headers_hash.d.ts +1 -1
- package/dest/rollup/block_headers_hash.d.ts.map +1 -1
- package/dest/rollup/block_headers_hash.js +8 -2
- package/dest/slashing/index.d.ts +2 -3
- package/dest/slashing/index.d.ts.map +1 -1
- package/dest/slashing/index.js +1 -2
- package/dest/slashing/serialization.d.ts +2 -6
- package/dest/slashing/serialization.d.ts.map +1 -1
- package/dest/slashing/serialization.js +0 -60
- package/dest/slashing/types.d.ts +4 -90
- package/dest/slashing/types.d.ts.map +1 -1
- package/dest/slashing/types.js +0 -14
- package/dest/slashing/{tally.d.ts → votes.d.ts} +1 -1
- package/dest/slashing/{tally.d.ts.map → votes.d.ts.map} +1 -1
- package/dest/slashing/{tally.js → votes.js} +1 -1
- package/dest/tests/factories.d.ts +2 -7
- package/dest/tests/factories.d.ts.map +1 -1
- package/dest/tests/factories.js +9 -19
- package/dest/tests/mocks.d.ts +7 -1
- package/dest/tests/mocks.d.ts.map +1 -1
- package/dest/tests/mocks.js +39 -30
- package/dest/timetable/index.d.ts +51 -1
- package/dest/timetable/index.d.ts.map +1 -1
- package/dest/timetable/index.js +218 -14
- package/dest/trees/nullifier_leaf.d.ts +2 -1
- package/dest/trees/nullifier_leaf.d.ts.map +1 -1
- package/dest/trees/nullifier_leaf.js +3 -0
- package/dest/tx/block_header.d.ts +2 -2
- package/dest/tx/block_header.d.ts.map +1 -1
- package/dest/tx/block_header.js +1 -1
- package/dest/tx/fee_provider.d.ts +10 -0
- package/dest/tx/fee_provider.d.ts.map +1 -0
- package/dest/tx/fee_provider.js +1 -0
- package/dest/tx/global_variable_builder.d.ts +3 -16
- package/dest/tx/global_variable_builder.d.ts.map +1 -1
- package/dest/tx/index.d.ts +2 -1
- package/dest/tx/index.d.ts.map +1 -1
- package/dest/tx/index.js +1 -0
- package/dest/tx/indexed_tx_effect.d.ts +1 -1
- package/dest/tx/indexed_tx_effect.d.ts.map +1 -1
- package/dest/tx/indexed_tx_effect.js +1 -2
- package/dest/tx/profiling.js +4 -4
- package/dest/tx/simulated_tx.d.ts +4 -4
- package/dest/tx/simulated_tx.d.ts.map +1 -1
- package/dest/tx/simulated_tx.js +3 -3
- package/dest/tx/tx.d.ts +3 -3
- package/dest/tx/tx.d.ts.map +1 -1
- package/dest/tx/tx_receipt.d.ts +8 -4
- package/dest/tx/tx_receipt.d.ts.map +1 -1
- package/dest/tx/tx_receipt.js +8 -15
- package/dest/types/shared.d.ts +1 -10
- package/dest/types/shared.d.ts.map +1 -1
- package/dest/types/shared.js +0 -9
- package/dest/vks/verification_key.d.ts +2 -137
- package/dest/vks/verification_key.d.ts.map +1 -1
- package/dest/vks/verification_key.js +5 -126
- package/dest/world-state/genesis_data.d.ts +11 -0
- package/dest/world-state/genesis_data.d.ts.map +1 -0
- package/dest/world-state/genesis_data.js +4 -0
- package/dest/world-state/index.d.ts +2 -1
- package/dest/world-state/index.d.ts.map +1 -1
- package/dest/world-state/index.js +1 -0
- package/dest/world-state/world_state_revision.d.ts +8 -1
- package/dest/world-state/world_state_revision.d.ts.map +1 -1
- package/dest/world-state/world_state_revision.js +7 -1
- package/package.json +8 -8
- package/src/abi/authorization_selector.ts +2 -8
- package/src/abi/encoder.ts +42 -6
- package/src/abi/event_selector.ts +2 -8
- package/src/abi/function_selector.ts +3 -12
- package/src/abi/note_selector.ts +3 -12
- package/src/abi/selector.ts +1 -1
- package/src/avm/revert_code.ts +25 -39
- package/src/aztec-address/index.ts +4 -10
- package/src/block/attestation_info.ts +11 -11
- package/src/block/block_data.ts +20 -4
- package/src/block/block_hash.ts +21 -14
- package/src/block/block_parameter.ts +35 -2
- package/src/block/l2_block_info.ts +8 -6
- package/src/block/l2_block_source.ts +43 -3
- package/src/block/l2_block_stream/interfaces.ts +6 -2
- package/src/block/l2_block_stream/l2_tips_store_base.ts +1 -1
- package/src/block/proposal/attestations_and_signers.ts +32 -17
- package/src/block/test/l2_tips_store_test_suite.ts +1 -1
- package/src/checkpoint/checkpoint_data.ts +4 -0
- package/src/config/chain-config.ts +9 -4
- package/src/config/sequencer-config.ts +34 -6
- package/src/contract/contract_address.ts +2 -2
- package/src/contract/private_function.ts +3 -1
- package/src/gas/README.md +31 -0
- package/src/gas/fee_math.ts +120 -0
- package/src/gas/gas_fees.ts +17 -4
- package/src/gas/gas_settings.ts +65 -12
- package/src/gas/index.ts +1 -0
- package/src/ha-signing/config.ts +5 -2
- package/src/ha-signing/index.ts +3 -1
- package/src/ha-signing/local_config.ts +2 -2
- package/src/ha-signing/types.ts +48 -34
- package/src/hash/hash.ts +27 -0
- package/src/interfaces/archiver.ts +21 -3
- package/src/interfaces/aztec-node-admin.ts +8 -8
- package/src/interfaces/aztec-node-debug.ts +40 -0
- package/src/interfaces/aztec-node.ts +120 -95
- package/src/interfaces/block_response.ts +79 -0
- package/src/interfaces/chain_tips.ts +24 -0
- package/src/interfaces/checkpoint_parameter.ts +22 -0
- package/src/interfaces/checkpoint_response.ts +84 -0
- package/src/interfaces/client.ts +6 -0
- package/src/interfaces/configs.ts +8 -1
- package/src/interfaces/l1_publish_info.ts +40 -0
- package/src/interfaces/merkle_tree_operations.ts +3 -2
- package/src/interfaces/prover-client.ts +2 -5
- package/src/interfaces/server.ts +5 -0
- package/src/interfaces/slasher.ts +0 -6
- package/src/interfaces/validator.ts +22 -9
- package/src/l1-contracts/index.ts +1 -1
- package/src/logs/log_id.ts +1 -2
- package/src/logs/siloed_tag.ts +8 -9
- package/src/logs/tag.ts +8 -8
- package/src/p2p/block_proposal.ts +96 -36
- package/src/p2p/checkpoint_attestation.ts +20 -29
- package/src/p2p/checkpoint_proposal.ts +88 -71
- package/src/p2p/consensus_payload.ts +50 -28
- package/src/p2p/gossipable.ts +4 -4
- package/src/p2p/signature_utils.ts +110 -25
- package/src/p2p/signed_txs.ts +46 -28
- package/src/parity/parity_base_private_inputs.ts +10 -4
- package/src/parity/parity_public_inputs.ts +9 -2
- package/src/rollup/block_headers_hash.ts +11 -2
- package/src/slashing/index.ts +1 -2
- package/src/slashing/serialization.ts +1 -81
- package/src/slashing/types.ts +3 -35
- package/src/slashing/{tally.ts → votes.ts} +1 -1
- package/src/tests/factories.ts +15 -21
- package/src/tests/mocks.ts +63 -39
- package/src/timetable/index.ts +308 -13
- package/src/trees/nullifier_leaf.ts +4 -0
- package/src/tx/block_header.ts +2 -2
- package/src/tx/fee_provider.ts +10 -0
- package/src/tx/global_variable_builder.ts +2 -18
- package/src/tx/index.ts +1 -0
- package/src/tx/indexed_tx_effect.ts +1 -2
- package/src/tx/profiling.ts +4 -4
- package/src/tx/simulated_tx.ts +6 -2
- package/src/tx/tx.ts +2 -2
- package/src/tx/tx_receipt.ts +11 -14
- package/src/types/shared.ts +0 -10
- package/src/vks/verification_key.ts +5 -184
- package/src/world-state/genesis_data.ts +15 -0
- package/src/world-state/index.ts +1 -0
- package/src/world-state/world_state_revision.ts +9 -1
- package/dest/abi/mocked_keys.d.ts +0 -2
- package/dest/abi/mocked_keys.d.ts.map +0 -1
- package/dest/abi/mocked_keys.js +0 -1
- package/dest/l1-contracts/slash_factory.d.ts +0 -45
- package/dest/l1-contracts/slash_factory.d.ts.map +0 -1
- package/dest/l1-contracts/slash_factory.js +0 -158
- package/dest/slashing/empire.d.ts +0 -31
- package/dest/slashing/empire.d.ts.map +0 -1
- package/dest/slashing/empire.js +0 -87
- package/src/abi/mocked_keys.ts +0 -2
- package/src/l1-contracts/slash_factory.ts +0 -180
- package/src/slashing/empire.ts +0 -104
|
@@ -3,7 +3,8 @@ 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 {
|
|
6
|
+
import { optional } from '../schemas/schemas.js';
|
|
7
|
+
import { type Offense, OffenseSchema } from '../slashing/index.js';
|
|
7
8
|
import { type ComponentsVersions, getVersioningResponseHandler } from '../versioning/index.js';
|
|
8
9
|
import { type ArchiverSpecificConfig, ArchiverSpecificConfigSchema } from './archiver.js';
|
|
9
10
|
import { type SequencerConfig, SequencerConfigSchema } from './configs.js';
|
|
@@ -36,8 +37,9 @@ export interface AztecNodeAdmin {
|
|
|
36
37
|
* Pauses syncing and rolls back the database to the target L2 block number.
|
|
37
38
|
* @param targetBlockNumber - The block number to roll back to.
|
|
38
39
|
* @param force - If true, clears the world state db and p2p dbs if rolling back to behind the finalized block.
|
|
40
|
+
* @param resumeSync - If true (default), resumes archiver and world state sync after rollback.
|
|
39
41
|
*/
|
|
40
|
-
rollbackTo(targetBlockNumber: number, force?: boolean): Promise<void>;
|
|
42
|
+
rollbackTo(targetBlockNumber: number, force?: boolean, resumeSync?: boolean): Promise<void>;
|
|
41
43
|
|
|
42
44
|
/** Pauses archiver and world state syncing. */
|
|
43
45
|
pauseSync(): Promise<void>;
|
|
@@ -45,9 +47,6 @@ export interface AztecNodeAdmin {
|
|
|
45
47
|
/** Resumes archiver and world state syncing. */
|
|
46
48
|
resumeSync(): Promise<void>;
|
|
47
49
|
|
|
48
|
-
/** Returns all monitored payloads by the slasher for the current round. */
|
|
49
|
-
getSlashPayloads(): Promise<SlashPayloadRound[]>;
|
|
50
|
-
|
|
51
50
|
/** Returns all offenses applicable for the given round. */
|
|
52
51
|
getSlashOffenses(round: bigint | 'all' | 'current'): Promise<Offense[]>;
|
|
53
52
|
|
|
@@ -82,6 +81,8 @@ export type AztecNodeAdminConfig = Omit<ValidatorClientFullConfig, 'l1Contracts'
|
|
|
82
81
|
'archiverPollingIntervalMS' | 'archiverBatchSize' | 'skipValidateCheckpointAttestations'
|
|
83
82
|
> & {
|
|
84
83
|
maxPendingTxCount: number;
|
|
84
|
+
// Keep in sync with P2PConfig.skipIncomingProposals (circular dep prevents Pick<P2PConfig, ...> here)
|
|
85
|
+
skipIncomingProposals?: boolean;
|
|
85
86
|
};
|
|
86
87
|
|
|
87
88
|
export const AztecNodeAdminConfigSchema = SequencerConfigSchema.merge(ProverConfigSchema)
|
|
@@ -94,16 +95,15 @@ export const AztecNodeAdminConfigSchema = SequencerConfigSchema.merge(ProverConf
|
|
|
94
95
|
skipValidateCheckpointAttestations: true,
|
|
95
96
|
}),
|
|
96
97
|
)
|
|
97
|
-
.merge(z.object({ maxPendingTxCount: z.number() }));
|
|
98
|
+
.merge(z.object({ maxPendingTxCount: z.number(), skipIncomingProposals: z.boolean().optional() }));
|
|
98
99
|
|
|
99
100
|
export const AztecNodeAdminApiSchema: ApiSchemaFor<AztecNodeAdmin> = {
|
|
100
101
|
getConfig: z.function().returns(AztecNodeAdminConfigSchema),
|
|
101
102
|
setConfig: z.function().args(AztecNodeAdminConfigSchema.partial()).returns(z.void()),
|
|
102
103
|
startSnapshotUpload: z.function().args(z.string()).returns(z.void()),
|
|
103
|
-
rollbackTo: z.function().args(z.number()).returns(z.void()),
|
|
104
|
+
rollbackTo: z.function().args(z.number(), optional(z.boolean()), optional(z.boolean())).returns(z.void()),
|
|
104
105
|
pauseSync: z.function().returns(z.void()),
|
|
105
106
|
resumeSync: z.function().returns(z.void()),
|
|
106
|
-
getSlashPayloads: z.function().returns(z.array(SlashPayloadRoundSchema)),
|
|
107
107
|
getSlashOffenses: z
|
|
108
108
|
.function()
|
|
109
109
|
.args(z.union([z.bigint(), z.literal('all'), z.literal('current')]))
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { createSafeJsonRpcClient, defaultFetch } from '@aztec/foundation/json-rpc/client';
|
|
2
|
+
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
|
|
5
|
+
import type { ApiSchemaFor } from '../schemas/schemas.js';
|
|
6
|
+
import { type ComponentsVersions, getVersioningResponseHandler } from '../versioning/index.js';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Debug interface for Aztec node available in sandbox/local-network mode.
|
|
10
|
+
*/
|
|
11
|
+
export interface AztecNodeDebug {
|
|
12
|
+
/**
|
|
13
|
+
* Triggers the sequencer to produce an L2 block and waits for it to appear.
|
|
14
|
+
*
|
|
15
|
+
* **Precondition**: The current L2 slot must not already contain a block. Callers must ensure L1 time has been
|
|
16
|
+
* advanced to a slot with no existing block before calling this method (e.g. via `EthCheatCodes.warp()`).
|
|
17
|
+
* If the slot is already taken, the sequencer will fail to propose and this call will time out.
|
|
18
|
+
*
|
|
19
|
+
* @throws If no sequencer is running.
|
|
20
|
+
*/
|
|
21
|
+
mineBlock(): Promise<void>;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export const AztecNodeDebugApiSchema: ApiSchemaFor<AztecNodeDebug> = {
|
|
25
|
+
mineBlock: z.function().returns(z.void()),
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export function createAztecNodeDebugClient(
|
|
29
|
+
url: string,
|
|
30
|
+
versions: Partial<ComponentsVersions> = {},
|
|
31
|
+
fetch = defaultFetch,
|
|
32
|
+
apiKey?: string,
|
|
33
|
+
): AztecNodeDebug {
|
|
34
|
+
return createSafeJsonRpcClient<AztecNodeDebug>(url, AztecNodeDebugApiSchema, {
|
|
35
|
+
namespaceMethods: 'nodeDebug',
|
|
36
|
+
fetch,
|
|
37
|
+
onResponse: getVersioningResponseHandler(versions),
|
|
38
|
+
...(apiKey ? { extraHeaders: { 'x-api-key': apiKey } } : {}),
|
|
39
|
+
});
|
|
40
|
+
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { ARCHIVE_HEIGHT, L1_TO_L2_MSG_TREE_HEIGHT, NOTE_HASH_TREE_HEIGHT } from '@aztec/constants';
|
|
2
2
|
import { type L1ContractAddresses, L1ContractAddressesSchema } from '@aztec/ethereum/l1-contract-addresses';
|
|
3
3
|
import {
|
|
4
|
-
BlockNumber,
|
|
4
|
+
type BlockNumber,
|
|
5
5
|
BlockNumberPositiveSchema,
|
|
6
6
|
BlockNumberSchema,
|
|
7
|
-
CheckpointNumber,
|
|
7
|
+
type CheckpointNumber,
|
|
8
8
|
CheckpointNumberPositiveSchema,
|
|
9
9
|
CheckpointNumberSchema,
|
|
10
|
-
EpochNumber,
|
|
10
|
+
type EpochNumber,
|
|
11
11
|
EpochNumberSchema,
|
|
12
12
|
type SlotNumber,
|
|
13
13
|
} from '@aztec/foundation/branded-types';
|
|
@@ -23,10 +23,8 @@ import { BlockHash } from '../block/block_hash.js';
|
|
|
23
23
|
import { type BlockParameter, BlockParameterSchema } from '../block/block_parameter.js';
|
|
24
24
|
import { CheckpointedL2Block } from '../block/checkpointed_l2_block.js';
|
|
25
25
|
import { type DataInBlock, dataInBlockSchemaFor } from '../block/in_block.js';
|
|
26
|
-
import {
|
|
27
|
-
import { type
|
|
28
|
-
import { CheckpointDataSchema } from '../checkpoint/checkpoint_data.js';
|
|
29
|
-
import { PublishedCheckpoint } from '../checkpoint/published_checkpoint.js';
|
|
26
|
+
import { type L2Tips, L2TipsSchema } from '../block/l2_block_source.js';
|
|
27
|
+
import { type CheckpointData, CheckpointDataSchema } from '../checkpoint/checkpoint_data.js';
|
|
30
28
|
import {
|
|
31
29
|
type ContractClassPublic,
|
|
32
30
|
ContractClassPublicSchema,
|
|
@@ -37,6 +35,7 @@ import {
|
|
|
37
35
|
type ProtocolContractAddresses,
|
|
38
36
|
ProtocolContractAddressesSchema,
|
|
39
37
|
} from '../contract/index.js';
|
|
38
|
+
import { ManaUsageEstimate } from '../gas/fee_math.js';
|
|
40
39
|
import { GasFees } from '../gas/gas_fees.js';
|
|
41
40
|
import { SiloedTag, Tag, TxScopedL2Log } from '../logs/index.js';
|
|
42
41
|
import { type LogFilter, LogFilterSchema } from '../logs/log_filter.js';
|
|
@@ -60,6 +59,20 @@ import type { SingleValidatorStats, ValidatorsStats } from '../validators/types.
|
|
|
60
59
|
import { type ComponentsVersions, getVersioningResponseHandler } from '../versioning/index.js';
|
|
61
60
|
import { type AllowedElement, AllowedElementSchema } from './allowed_element.js';
|
|
62
61
|
import { MAX_RPC_BLOCKS_LEN, MAX_RPC_CHECKPOINTS_LEN, MAX_RPC_LEN, MAX_RPC_TXS_LEN } from './api_limit.js';
|
|
62
|
+
import {
|
|
63
|
+
type BlockIncludeOptions,
|
|
64
|
+
BlockIncludeOptionsSchema,
|
|
65
|
+
type BlockResponse,
|
|
66
|
+
BlockResponseSchema,
|
|
67
|
+
} from './block_response.js';
|
|
68
|
+
import { type ChainTip, ChainTipSchema, type ChainTips, ChainTipsSchema } from './chain_tips.js';
|
|
69
|
+
import { type CheckpointParameter, CheckpointParameterSchema } from './checkpoint_parameter.js';
|
|
70
|
+
import {
|
|
71
|
+
type CheckpointIncludeOptions,
|
|
72
|
+
CheckpointIncludeOptionsSchema,
|
|
73
|
+
type CheckpointResponse,
|
|
74
|
+
CheckpointResponseSchema,
|
|
75
|
+
} from './checkpoint_response.js';
|
|
63
76
|
import {
|
|
64
77
|
type GetContractClassLogsResponse,
|
|
65
78
|
GetContractClassLogsResponseSchema,
|
|
@@ -72,21 +85,7 @@ import { type WorldStateSyncStatus, WorldStateSyncStatusSchema } from './world_s
|
|
|
72
85
|
* The aztec node.
|
|
73
86
|
* We will probably implement the additional interfaces by means other than Aztec Node as it's currently a privacy leak
|
|
74
87
|
*/
|
|
75
|
-
export interface AztecNode
|
|
76
|
-
extends Pick<
|
|
77
|
-
L2BlockSource,
|
|
78
|
-
| 'getBlocks'
|
|
79
|
-
| 'getCheckpoints'
|
|
80
|
-
| 'getBlockHeader'
|
|
81
|
-
| 'getL2Tips'
|
|
82
|
-
| 'getCheckpointedBlocks'
|
|
83
|
-
| 'getCheckpointsDataForEpoch'
|
|
84
|
-
> {
|
|
85
|
-
/**
|
|
86
|
-
* Returns the tips of the L2 chain.
|
|
87
|
-
*/
|
|
88
|
-
getL2Tips(): Promise<L2Tips>;
|
|
89
|
-
|
|
88
|
+
export interface AztecNode {
|
|
90
89
|
/**
|
|
91
90
|
* Returns the sync status of the node's world state
|
|
92
91
|
*/
|
|
@@ -201,49 +200,76 @@ export interface AztecNode
|
|
|
201
200
|
getL2ToL1Messages(epoch: EpochNumber): Promise<Fr[][][][]>;
|
|
202
201
|
|
|
203
202
|
/**
|
|
204
|
-
*
|
|
205
|
-
*
|
|
206
|
-
* @returns The requested block.
|
|
203
|
+
* Returns the block number at a given chain tip, or the latest proposed block number when
|
|
204
|
+
* `tip` is omitted.
|
|
207
205
|
*/
|
|
208
|
-
|
|
206
|
+
getBlockNumber(tip?: ChainTip): Promise<BlockNumber>;
|
|
209
207
|
|
|
210
208
|
/**
|
|
211
|
-
*
|
|
212
|
-
*
|
|
213
|
-
*
|
|
209
|
+
* Returns the checkpoint number at a given chain tip, or the latest checkpoint number when
|
|
210
|
+
* `tip` is omitted.
|
|
211
|
+
*
|
|
212
|
+
* @remarks **Semantic foot-gun**: block-side `'proposed'` means "latest proposed block" (chain
|
|
213
|
+
* head), but checkpoint-side `'proposed'` means "latest confirmed checkpoint" — pre-L1-confirm
|
|
214
|
+
* checkpoints are not exposed over RPC. `'checkpointed'` on the checkpoint side is equivalent.
|
|
214
215
|
*/
|
|
215
|
-
|
|
216
|
+
getCheckpointNumber(tip?: ChainTip): Promise<CheckpointNumber>;
|
|
216
217
|
|
|
217
|
-
/**
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
218
|
+
/** Returns the tips of the L2 chain. */
|
|
219
|
+
getChainTips(): Promise<ChainTips>;
|
|
220
|
+
|
|
221
|
+
// TODO(spl/new-rpc-api): the following methods are kept on the interface as a stop-gap because
|
|
222
|
+
// `L2BlockStream` (used by PXE's block synchronizer) and `computeL2ToL1MembershipWitness` (used
|
|
223
|
+
// by end-to-end tests) still consume the internal archiver shapes. Remove them when those
|
|
224
|
+
// consumers are rewired to the unified `BlockResponse` / `CheckpointResponse` API.
|
|
225
|
+
/** @deprecated Scheduled for removal; use `getChainTips` for public callers. */
|
|
226
|
+
getL2Tips(): Promise<L2Tips>;
|
|
227
|
+
/** @deprecated Scheduled for removal; use `getBlock(param).then(r => r?.header)`. */
|
|
228
|
+
getBlockHeader(number: BlockNumber | 'latest'): Promise<BlockHeader | undefined>;
|
|
229
|
+
/** @deprecated Scheduled for removal; use `getBlocks(from, limit, { includeL1PublishInfo: true, includeAttestations: true })`. */
|
|
230
|
+
getCheckpointedBlocks(from: BlockNumber, limit: number): Promise<CheckpointedL2Block[]>;
|
|
231
|
+
/** @deprecated Scheduled for removal; use `getCheckpoints(from, limit)` over an explicit checkpoint range. */
|
|
232
|
+
getCheckpointsDataForEpoch(epoch: EpochNumber): Promise<CheckpointData[]>;
|
|
223
233
|
|
|
224
234
|
/**
|
|
225
|
-
*
|
|
226
|
-
*
|
|
235
|
+
* Unified block fetch. Returns the block identified by `param`, with optional fields controlled
|
|
236
|
+
* by `options`.
|
|
237
|
+
* @param param - A block number, block hash, archive root, chain-tip name, or object variant.
|
|
238
|
+
* @param options - Narrowing options: `includeTransactions`, `includeL1PublishInfo`, `includeAttestations`.
|
|
227
239
|
*/
|
|
228
|
-
|
|
240
|
+
getBlock<Opts extends BlockIncludeOptions = {}>(
|
|
241
|
+
param: BlockParameter,
|
|
242
|
+
options?: Opts,
|
|
243
|
+
): Promise<BlockResponse<Opts> | undefined>;
|
|
229
244
|
|
|
230
245
|
/**
|
|
231
|
-
*
|
|
232
|
-
*
|
|
246
|
+
* Returns up to `limit` blocks starting from `from`, projected to the {@link BlockResponse}
|
|
247
|
+
* shape determined by `options`.
|
|
233
248
|
*/
|
|
234
|
-
|
|
249
|
+
getBlocks<Opts extends BlockIncludeOptions = {}>(
|
|
250
|
+
from: BlockNumber,
|
|
251
|
+
limit: number,
|
|
252
|
+
options?: Opts,
|
|
253
|
+
): Promise<BlockResponse<Opts>[]>;
|
|
235
254
|
|
|
236
255
|
/**
|
|
237
|
-
*
|
|
238
|
-
*
|
|
256
|
+
* Unified checkpoint fetch. Returns the checkpoint identified by `param`, with optional fields
|
|
257
|
+
* controlled by `options`.
|
|
239
258
|
*/
|
|
240
|
-
|
|
259
|
+
getCheckpoint<Opts extends CheckpointIncludeOptions = {}>(
|
|
260
|
+
param: CheckpointParameter,
|
|
261
|
+
options?: Opts,
|
|
262
|
+
): Promise<CheckpointResponse<Opts> | undefined>;
|
|
241
263
|
|
|
242
264
|
/**
|
|
243
|
-
*
|
|
244
|
-
* @
|
|
265
|
+
* Returns up to `limit` checkpoints starting from `from`, projected to the
|
|
266
|
+
* {@link CheckpointResponse} shape determined by `options`.
|
|
245
267
|
*/
|
|
246
|
-
|
|
268
|
+
getCheckpoints<Opts extends CheckpointIncludeOptions = {}>(
|
|
269
|
+
from: CheckpointNumber,
|
|
270
|
+
limit: number,
|
|
271
|
+
options?: Opts,
|
|
272
|
+
): Promise<CheckpointResponse<Opts>[]>;
|
|
247
273
|
|
|
248
274
|
/**
|
|
249
275
|
* Method to determine if the node is ready to accept transactions.
|
|
@@ -258,20 +284,21 @@ export interface AztecNode
|
|
|
258
284
|
*/
|
|
259
285
|
getNodeInfo(): Promise<NodeInfo>;
|
|
260
286
|
|
|
261
|
-
/**
|
|
262
|
-
* Method to request blocks. Will attempt to return all requested blocks but will return only those available.
|
|
263
|
-
* @param from - The start of the range of blocks to return.
|
|
264
|
-
* @param limit - The maximum number of blocks to return.
|
|
265
|
-
* @returns The blocks requested.
|
|
266
|
-
*/
|
|
267
|
-
getBlocks(from: BlockNumber, limit: number): Promise<L2Block[]>;
|
|
268
|
-
|
|
269
287
|
/**
|
|
270
288
|
* Method to fetch the current min fees.
|
|
271
289
|
* @returns The current min fees.
|
|
272
290
|
*/
|
|
273
291
|
getCurrentMinFees(): Promise<GasFees>;
|
|
274
292
|
|
|
293
|
+
/**
|
|
294
|
+
* Returns predicted min fees for the current slot and next N slots.
|
|
295
|
+
* Each entry accounts for the L1 gas oracle transition and congestion growth based on the
|
|
296
|
+
* given mana usage estimate. Defaults to target usage (steady state).
|
|
297
|
+
* @param manaUsage - Expected mana usage per checkpoint (none, target, or limit).
|
|
298
|
+
* @returns An array of GasFees, one per slot in the prediction window.
|
|
299
|
+
*/
|
|
300
|
+
getPredictedMinFees(manaUsage?: ManaUsageEstimate): Promise<GasFees[]>;
|
|
301
|
+
|
|
275
302
|
/**
|
|
276
303
|
* Method to fetch the current max priority fee of txs in the mempool.
|
|
277
304
|
* @returns The current max priority fees.
|
|
@@ -424,20 +451,6 @@ export interface AztecNode
|
|
|
424
451
|
*/
|
|
425
452
|
getPublicStorageAt(referenceBlock: BlockParameter, contract: AztecAddress, slot: Fr): Promise<Fr>;
|
|
426
453
|
|
|
427
|
-
/**
|
|
428
|
-
* Returns the block header for a given block number, block hash, or 'latest'.
|
|
429
|
-
* @param block - The block parameter (block number, block hash, or 'latest'). Defaults to 'latest'.
|
|
430
|
-
* @returns The requested block header.
|
|
431
|
-
*/
|
|
432
|
-
getBlockHeader(block?: BlockParameter): Promise<BlockHeader | undefined>;
|
|
433
|
-
|
|
434
|
-
/**
|
|
435
|
-
* Get a block header specified by its archive root.
|
|
436
|
-
* @param archive - The archive root being requested.
|
|
437
|
-
* @returns The requested block header.
|
|
438
|
-
*/
|
|
439
|
-
getBlockHeaderByArchive(archive: Fr): Promise<BlockHeader | undefined>;
|
|
440
|
-
|
|
441
454
|
/** Returns stats for validators if enabled. */
|
|
442
455
|
getValidatorsStats(): Promise<ValidatorsStats>;
|
|
443
456
|
|
|
@@ -493,8 +506,6 @@ const MAX_SIGNATURES_PER_REGISTER_CALL = 100;
|
|
|
493
506
|
const MAX_SIGNATURE_LEN = 10000;
|
|
494
507
|
|
|
495
508
|
export const AztecNodeApiSchema: ApiSchemaFor<AztecNode> = {
|
|
496
|
-
getL2Tips: z.function().args().returns(L2TipsSchema),
|
|
497
|
-
|
|
498
509
|
getWorldStateSyncStatus: z.function().args().returns(WorldStateSyncStatusSchema),
|
|
499
510
|
|
|
500
511
|
findLeavesIndexes: z
|
|
@@ -541,43 +552,61 @@ export const AztecNodeApiSchema: ApiSchemaFor<AztecNode> = {
|
|
|
541
552
|
.args(EpochNumberSchema)
|
|
542
553
|
.returns(z.array(z.array(z.array(z.array(schemas.Fr))))),
|
|
543
554
|
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
getBlockByHash: z.function().args(BlockHash.schema).returns(L2Block.schema.optional()),
|
|
555
|
+
getBlockNumber: z.function().args(optional(ChainTipSchema)).returns(BlockNumberSchema),
|
|
547
556
|
|
|
548
|
-
|
|
557
|
+
getCheckpointNumber: z.function().args(optional(ChainTipSchema)).returns(CheckpointNumberSchema),
|
|
549
558
|
|
|
550
|
-
|
|
559
|
+
getChainTips: z.function().args().returns(ChainTipsSchema),
|
|
551
560
|
|
|
552
|
-
|
|
561
|
+
getL2Tips: z.function().args().returns(L2TipsSchema),
|
|
553
562
|
|
|
554
|
-
|
|
563
|
+
getBlockHeader: z
|
|
564
|
+
.function()
|
|
565
|
+
.args(z.union([BlockNumberSchema, z.literal('latest')]))
|
|
566
|
+
.returns(BlockHeader.schema.optional()),
|
|
555
567
|
|
|
556
|
-
|
|
568
|
+
getCheckpointedBlocks: z
|
|
569
|
+
.function()
|
|
570
|
+
.args(BlockNumberPositiveSchema, z.number().gt(0).lte(MAX_RPC_BLOCKS_LEN))
|
|
571
|
+
.returns(z.array(CheckpointedL2Block.schema)),
|
|
557
572
|
|
|
558
|
-
|
|
573
|
+
getCheckpointsDataForEpoch: z.function().args(EpochNumberSchema).returns(z.array(CheckpointDataSchema)),
|
|
559
574
|
|
|
560
|
-
|
|
575
|
+
getBlock: z
|
|
576
|
+
.function()
|
|
577
|
+
.args(BlockParameterSchema, optional(BlockIncludeOptionsSchema))
|
|
578
|
+
.returns(BlockResponseSchema.optional()),
|
|
561
579
|
|
|
562
580
|
getBlocks: z
|
|
563
581
|
.function()
|
|
564
|
-
.args(BlockNumberPositiveSchema, z.number().gt(0).lte(MAX_RPC_BLOCKS_LEN))
|
|
565
|
-
.returns(z.array(
|
|
582
|
+
.args(BlockNumberPositiveSchema, z.number().gt(0).lte(MAX_RPC_BLOCKS_LEN), optional(BlockIncludeOptionsSchema))
|
|
583
|
+
.returns(z.array(BlockResponseSchema)),
|
|
566
584
|
|
|
567
|
-
|
|
585
|
+
getCheckpoint: z
|
|
568
586
|
.function()
|
|
569
|
-
.args(
|
|
570
|
-
.returns(
|
|
587
|
+
.args(CheckpointParameterSchema, optional(CheckpointIncludeOptionsSchema))
|
|
588
|
+
.returns(CheckpointResponseSchema.optional()),
|
|
571
589
|
|
|
572
|
-
|
|
590
|
+
getCheckpoints: z
|
|
573
591
|
.function()
|
|
574
|
-
.args(
|
|
575
|
-
|
|
592
|
+
.args(
|
|
593
|
+
CheckpointNumberPositiveSchema,
|
|
594
|
+
z.number().gt(0).lte(MAX_RPC_CHECKPOINTS_LEN),
|
|
595
|
+
optional(CheckpointIncludeOptionsSchema),
|
|
596
|
+
)
|
|
597
|
+
.returns(z.array(CheckpointResponseSchema)),
|
|
576
598
|
|
|
577
|
-
|
|
599
|
+
isReady: z.function().returns(z.boolean()),
|
|
600
|
+
|
|
601
|
+
getNodeInfo: z.function().returns(NodeInfoSchema),
|
|
578
602
|
|
|
579
603
|
getCurrentMinFees: z.function().returns(GasFees.schema),
|
|
580
604
|
|
|
605
|
+
getPredictedMinFees: z
|
|
606
|
+
.function()
|
|
607
|
+
.args(optional(z.nativeEnum(ManaUsageEstimate)))
|
|
608
|
+
.returns(z.array(GasFees.schema)),
|
|
609
|
+
|
|
581
610
|
getMaxPriorityFees: z.function().returns(GasFees.schema),
|
|
582
611
|
|
|
583
612
|
getNodeVersion: z.function().returns(z.string()),
|
|
@@ -633,10 +662,6 @@ export const AztecNodeApiSchema: ApiSchemaFor<AztecNode> = {
|
|
|
633
662
|
|
|
634
663
|
getPublicStorageAt: z.function().args(BlockParameterSchema, schemas.AztecAddress, schemas.Fr).returns(schemas.Fr),
|
|
635
664
|
|
|
636
|
-
getBlockHeader: z.function().args(optional(BlockParameterSchema)).returns(BlockHeader.schema.optional()),
|
|
637
|
-
|
|
638
|
-
getBlockHeaderByArchive: z.function().args(schemas.Fr).returns(BlockHeader.schema.optional()),
|
|
639
|
-
|
|
640
665
|
getValidatorsStats: z.function().returns(ValidatorsStatsSchema),
|
|
641
666
|
|
|
642
667
|
getValidatorStats: z
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import {
|
|
2
|
+
BlockNumberSchema,
|
|
3
|
+
CheckpointNumberSchema,
|
|
4
|
+
IndexWithinCheckpointSchema,
|
|
5
|
+
} from '@aztec/foundation/branded-types';
|
|
6
|
+
import type { BlockNumber, CheckpointNumber, IndexWithinCheckpoint } from '@aztec/foundation/branded-types';
|
|
7
|
+
import type { IfFlag, Prettify } from '@aztec/foundation/types';
|
|
8
|
+
|
|
9
|
+
import { z } from 'zod';
|
|
10
|
+
|
|
11
|
+
import { BlockHash } from '../block/block_hash.js';
|
|
12
|
+
import { Body } from '../block/body.js';
|
|
13
|
+
import { CommitteeAttestation } from '../block/proposal/committee_attestation.js';
|
|
14
|
+
import { AppendOnlyTreeSnapshot } from '../trees/append_only_tree_snapshot.js';
|
|
15
|
+
import { BlockHeader } from '../tx/block_header.js';
|
|
16
|
+
import { type L1PublishInfo, L1PublishInfoSchema } from './l1_publish_info.js';
|
|
17
|
+
|
|
18
|
+
/** Options for narrowing the response of `getBlock` / `getBlocks`. */
|
|
19
|
+
export type BlockIncludeOptions = {
|
|
20
|
+
/** Include the block body (tx effects). Off by default. */
|
|
21
|
+
includeTransactions?: boolean;
|
|
22
|
+
/** Include L1 publish info (populated with `published: false` if not yet on L1). Off by default. */
|
|
23
|
+
includeL1PublishInfo?: boolean;
|
|
24
|
+
/** Include committee attestations. Empty array until the block's checkpoint is published. Off by default. */
|
|
25
|
+
includeAttestations?: boolean;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export const BlockIncludeOptionsSchema: z.ZodType<BlockIncludeOptions> = z.object({
|
|
29
|
+
includeTransactions: z.boolean().optional(),
|
|
30
|
+
includeL1PublishInfo: z.boolean().optional(),
|
|
31
|
+
includeAttestations: z.boolean().optional(),
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
/** Required metadata always present on a {@link BlockResponse}. */
|
|
35
|
+
export type BlockResponseBase = {
|
|
36
|
+
/** Block header. */
|
|
37
|
+
header: BlockHeader;
|
|
38
|
+
/** Archive tree snapshot after this block. */
|
|
39
|
+
archive: AppendOnlyTreeSnapshot;
|
|
40
|
+
/** Hash of the block header. */
|
|
41
|
+
hash: BlockHash;
|
|
42
|
+
/** Checkpoint number this block belongs to. */
|
|
43
|
+
checkpointNumber: CheckpointNumber;
|
|
44
|
+
/** Position of the block within its checkpoint. */
|
|
45
|
+
indexWithinCheckpoint: IndexWithinCheckpoint;
|
|
46
|
+
/** L2 block number. */
|
|
47
|
+
number: BlockNumber;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* RPC-surface representation of an L2 block.
|
|
52
|
+
*
|
|
53
|
+
* Generic over the include-options so that flagged fields become required when the caller passes a
|
|
54
|
+
* literal `true`. The default type argument ({@link BlockIncludeOptions}) yields the widest shape
|
|
55
|
+
* (all include-fields optional) — this is what the JSON-RPC wire layer validates against.
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* const b: BlockResponse<{ includeTransactions: true }> = await node.getBlock(1, { includeTransactions: true });
|
|
59
|
+
* b.body; // required, not optional
|
|
60
|
+
*/
|
|
61
|
+
export type BlockResponse<Opts extends BlockIncludeOptions = BlockIncludeOptions> = Prettify<
|
|
62
|
+
BlockResponseBase &
|
|
63
|
+
IfFlag<BlockIncludeOptions, Opts, 'includeTransactions', { body: Body }> &
|
|
64
|
+
IfFlag<BlockIncludeOptions, Opts, 'includeL1PublishInfo', { l1: L1PublishInfo }> &
|
|
65
|
+
IfFlag<BlockIncludeOptions, Opts, 'includeAttestations', { attestations: CommitteeAttestation[] }>
|
|
66
|
+
>;
|
|
67
|
+
|
|
68
|
+
/** Zod schema for the widest {@link BlockResponse} shape (all include-gated fields optional). */
|
|
69
|
+
export const BlockResponseSchema = z.object({
|
|
70
|
+
header: BlockHeader.schema,
|
|
71
|
+
archive: AppendOnlyTreeSnapshot.schema,
|
|
72
|
+
hash: BlockHash.schema,
|
|
73
|
+
checkpointNumber: CheckpointNumberSchema,
|
|
74
|
+
indexWithinCheckpoint: IndexWithinCheckpointSchema,
|
|
75
|
+
number: BlockNumberSchema,
|
|
76
|
+
body: Body.schema.optional(),
|
|
77
|
+
l1: L1PublishInfoSchema.optional(),
|
|
78
|
+
attestations: z.array(CommitteeAttestation.schema).optional(),
|
|
79
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
import { type L2BlockTag, type L2Tips, L2TipsSchema } from '../block/l2_block_source.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Public chain-tip selectors usable in RPC requests.
|
|
7
|
+
* Omits internal-only tags (e.g. `proposedCheckpoint`) from {@link L2BlockTag}.
|
|
8
|
+
*/
|
|
9
|
+
export type ChainTip = Exclude<L2BlockTag, 'proposedCheckpoint'>;
|
|
10
|
+
|
|
11
|
+
export const ChainTipSchema = z.union([
|
|
12
|
+
z.literal('proposed'),
|
|
13
|
+
z.literal('checkpointed'),
|
|
14
|
+
z.literal('proven'),
|
|
15
|
+
z.literal('finalized'),
|
|
16
|
+
]) satisfies z.ZodType<ChainTip>;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Tips of the L2 chain.
|
|
20
|
+
* Omits the sequencer-internal `proposedCheckpoint` from the public RPC surface.
|
|
21
|
+
*/
|
|
22
|
+
export type ChainTips = Omit<L2Tips, 'proposedCheckpoint'>;
|
|
23
|
+
|
|
24
|
+
export const ChainTipsSchema = L2TipsSchema.omit({ proposedCheckpoint: true });
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { CheckpointNumberSchema, SlotNumberSchema } from '@aztec/foundation/branded-types';
|
|
2
|
+
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
|
|
5
|
+
import { ChainTipSchema } from './chain_tips.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Selector for a checkpoint in RPC calls.
|
|
9
|
+
*
|
|
10
|
+
* Accepts a numeric checkpoint number (or `{ number }`), a slot number (`{ slot }`), a chain-tip
|
|
11
|
+
* name (e.g. `'proven'`), or `'latest'` (alias for `'proposed'` — on the checkpoint side, this
|
|
12
|
+
* means the most recent confirmed checkpoint).
|
|
13
|
+
*/
|
|
14
|
+
export const CheckpointParameterSchema = z.union([
|
|
15
|
+
CheckpointNumberSchema,
|
|
16
|
+
ChainTipSchema,
|
|
17
|
+
z.literal('latest'),
|
|
18
|
+
z.object({ number: CheckpointNumberSchema }),
|
|
19
|
+
z.object({ slot: SlotNumberSchema }),
|
|
20
|
+
]);
|
|
21
|
+
|
|
22
|
+
export type CheckpointParameter = z.infer<typeof CheckpointParameterSchema>;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { BlockNumberSchema, CheckpointNumberSchema } from '@aztec/foundation/branded-types';
|
|
2
|
+
import type { BlockNumber, CheckpointNumber } from '@aztec/foundation/branded-types';
|
|
3
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
4
|
+
import { schemas } from '@aztec/foundation/schemas';
|
|
5
|
+
import type { IfFlag, Prettify } from '@aztec/foundation/types';
|
|
6
|
+
|
|
7
|
+
import { z } from 'zod';
|
|
8
|
+
|
|
9
|
+
import { CommitteeAttestation } from '../block/proposal/committee_attestation.js';
|
|
10
|
+
import { CheckpointHeader } from '../rollup/checkpoint_header.js';
|
|
11
|
+
import { AppendOnlyTreeSnapshot } from '../trees/append_only_tree_snapshot.js';
|
|
12
|
+
import { type BlockResponse, BlockResponseSchema } from './block_response.js';
|
|
13
|
+
import { type L1PublishInfo, L1PublishInfoSchema } from './l1_publish_info.js';
|
|
14
|
+
|
|
15
|
+
/** Options for narrowing the response of `getCheckpoint` / `getCheckpoints`. */
|
|
16
|
+
export type CheckpointIncludeOptions = {
|
|
17
|
+
/** Include the nested blocks. Off by default. */
|
|
18
|
+
includeBlocks?: boolean;
|
|
19
|
+
/** When `includeBlocks` is true, include each block's body (tx effects). Off by default. No-op if `includeBlocks` is false. */
|
|
20
|
+
includeTransactions?: boolean;
|
|
21
|
+
/** Include L1 publish info. Off by default. */
|
|
22
|
+
includeL1PublishInfo?: boolean;
|
|
23
|
+
/** Include committee attestations. Off by default. */
|
|
24
|
+
includeAttestations?: boolean;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export const CheckpointIncludeOptionsSchema: z.ZodType<CheckpointIncludeOptions> = z.object({
|
|
28
|
+
includeBlocks: z.boolean().optional(),
|
|
29
|
+
includeTransactions: z.boolean().optional(),
|
|
30
|
+
includeL1PublishInfo: z.boolean().optional(),
|
|
31
|
+
includeAttestations: z.boolean().optional(),
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
/** Required metadata always present on a {@link CheckpointResponse}. */
|
|
35
|
+
export type CheckpointResponseBase = {
|
|
36
|
+
/** Checkpoint number. */
|
|
37
|
+
number: CheckpointNumber;
|
|
38
|
+
/** Checkpoint header. */
|
|
39
|
+
header: CheckpointHeader;
|
|
40
|
+
/** Archive tree snapshot after this checkpoint. */
|
|
41
|
+
archive: AppendOnlyTreeSnapshot;
|
|
42
|
+
/** Hash of the checkpoint out messages. */
|
|
43
|
+
checkpointOutHash: Fr;
|
|
44
|
+
/** First block number in this checkpoint. */
|
|
45
|
+
startBlock: BlockNumber;
|
|
46
|
+
/** Number of blocks in this checkpoint. */
|
|
47
|
+
blockCount: number;
|
|
48
|
+
/** Fee asset price modifier in basis points applied during this checkpoint. */
|
|
49
|
+
feeAssetPriceModifier: bigint;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
// Only forward `includeTransactions` to nested blocks — the other include-flags on the checkpoint
|
|
53
|
+
// options do not apply to the nested block responses (those carry no independent L1 / attestations).
|
|
54
|
+
type NestedBlockOpts<Opts> = Opts extends { includeTransactions: true } ? { includeTransactions: true } : {};
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* RPC-surface representation of an L2 checkpoint.
|
|
58
|
+
*
|
|
59
|
+
* Generic over the include-options so that flagged fields become required when the caller passes a
|
|
60
|
+
* literal `true`. Only `includeTransactions` is forwarded to nested blocks, so
|
|
61
|
+
* `includeL1PublishInfo` / `includeAttestations` on a checkpoint request do not imply the same on
|
|
62
|
+
* its nested blocks. The default type argument ({@link CheckpointIncludeOptions}) yields the
|
|
63
|
+
* widest shape — what the JSON-RPC wire layer validates against.
|
|
64
|
+
*/
|
|
65
|
+
export type CheckpointResponse<Opts extends CheckpointIncludeOptions = CheckpointIncludeOptions> = Prettify<
|
|
66
|
+
CheckpointResponseBase &
|
|
67
|
+
IfFlag<CheckpointIncludeOptions, Opts, 'includeBlocks', { blocks: BlockResponse<NestedBlockOpts<Opts>>[] }> &
|
|
68
|
+
IfFlag<CheckpointIncludeOptions, Opts, 'includeL1PublishInfo', { l1: L1PublishInfo }> &
|
|
69
|
+
IfFlag<CheckpointIncludeOptions, Opts, 'includeAttestations', { attestations: CommitteeAttestation[] }>
|
|
70
|
+
>;
|
|
71
|
+
|
|
72
|
+
/** Zod schema for the widest {@link CheckpointResponse} shape (all include-gated fields optional). */
|
|
73
|
+
export const CheckpointResponseSchema = z.object({
|
|
74
|
+
number: CheckpointNumberSchema,
|
|
75
|
+
header: CheckpointHeader.schema,
|
|
76
|
+
archive: AppendOnlyTreeSnapshot.schema,
|
|
77
|
+
checkpointOutHash: schemas.Fr,
|
|
78
|
+
startBlock: BlockNumberSchema,
|
|
79
|
+
blockCount: z.number(),
|
|
80
|
+
feeAssetPriceModifier: schemas.BigInt,
|
|
81
|
+
blocks: z.array(BlockResponseSchema).optional(),
|
|
82
|
+
l1: L1PublishInfoSchema.optional(),
|
|
83
|
+
attestations: z.array(CommitteeAttestation.schema).optional(),
|
|
84
|
+
});
|
package/src/interfaces/client.ts
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
export * from './aztec-node.js';
|
|
2
2
|
export * from './aztec-node-admin.js';
|
|
3
|
+
export * from './aztec-node-debug.js';
|
|
4
|
+
export * from './block_response.js';
|
|
5
|
+
export * from './chain_tips.js';
|
|
6
|
+
export * from './checkpoint_parameter.js';
|
|
7
|
+
export * from './checkpoint_response.js';
|
|
8
|
+
export * from './l1_publish_info.js';
|
|
3
9
|
export * from './private_kernel_prover.js';
|
|
4
10
|
export * from './get_logs_response.js';
|
|
5
11
|
export * from './api_limit.js';
|