@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,7 @@ import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
|
3
3
|
|
|
4
4
|
import { Checkpoint } from '../checkpoint/checkpoint.js';
|
|
5
5
|
import { ConsensusPayload } from '../p2p/consensus_payload.js';
|
|
6
|
-
import {
|
|
6
|
+
import { type CoordinationSignatureContext, getHashedSignaturePayloadTypedData } from '../p2p/signature_utils.js';
|
|
7
7
|
import type { CommitteeAttestation } from './proposal/committee_attestation.js';
|
|
8
8
|
|
|
9
9
|
/**
|
|
@@ -32,11 +32,14 @@ export type AttestationInfo =
|
|
|
32
32
|
* Extracts attestation information from a published checkpoint.
|
|
33
33
|
* Returns info for each attestation, preserving array indices.
|
|
34
34
|
*/
|
|
35
|
-
export function getAttestationInfoFromPublishedCheckpoint(
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
35
|
+
export function getAttestationInfoFromPublishedCheckpoint(
|
|
36
|
+
block: {
|
|
37
|
+
attestations: CommitteeAttestation[];
|
|
38
|
+
checkpoint: Checkpoint;
|
|
39
|
+
},
|
|
40
|
+
signatureContext: CoordinationSignatureContext,
|
|
41
|
+
): AttestationInfo[] {
|
|
42
|
+
const payload = ConsensusPayload.fromCheckpoint(block.checkpoint, signatureContext);
|
|
40
43
|
return getAttestationInfoFromPayload(payload, block.attestations);
|
|
41
44
|
}
|
|
42
45
|
|
|
@@ -44,10 +47,7 @@ export function getAttestationInfoFromPayload(
|
|
|
44
47
|
payload: ConsensusPayload,
|
|
45
48
|
attestations: CommitteeAttestation[],
|
|
46
49
|
): AttestationInfo[] {
|
|
47
|
-
const hashedPayload =
|
|
48
|
-
payload,
|
|
49
|
-
SignatureDomainSeparator.checkpointAttestation,
|
|
50
|
-
);
|
|
50
|
+
const hashedPayload = getHashedSignaturePayloadTypedData(payload);
|
|
51
51
|
|
|
52
52
|
return attestations.map(attestation => {
|
|
53
53
|
// If signature is empty, check if we have an address directly
|
|
@@ -62,7 +62,7 @@ export function getAttestationInfoFromPayload(
|
|
|
62
62
|
|
|
63
63
|
// Try to recover address from signature
|
|
64
64
|
try {
|
|
65
|
-
const recoveredAddress = recoverAddress(hashedPayload, attestation.signature);
|
|
65
|
+
const recoveredAddress = recoverAddress(hashedPayload, attestation.signature, { allowYParityAsV: true });
|
|
66
66
|
return { address: recoveredAddress, status: 'recovered-from-signature' as const };
|
|
67
67
|
} catch {
|
|
68
68
|
// Signature present but recovery failed
|
package/src/block/block_data.ts
CHANGED
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
import { CheckpointNumberSchema, IndexWithinCheckpointSchema } from '@aztec/foundation/branded-types';
|
|
2
2
|
import type { CheckpointNumber, IndexWithinCheckpoint } from '@aztec/foundation/branded-types';
|
|
3
|
-
import type { Fr } from '@aztec/foundation/curves/bn254';
|
|
4
|
-
import { schemas } from '@aztec/foundation/schemas';
|
|
5
3
|
|
|
6
4
|
import { z } from 'zod';
|
|
7
5
|
|
|
6
|
+
import { CheckpointDataSchema } from '../checkpoint/checkpoint_data.js';
|
|
7
|
+
import { L1PublishedData } from '../checkpoint/published_checkpoint.js';
|
|
8
8
|
import { AppendOnlyTreeSnapshot } from '../trees/append_only_tree_snapshot.js';
|
|
9
9
|
import { BlockHeader } from '../tx/block_header.js';
|
|
10
|
+
import { BlockHash } from './block_hash.js';
|
|
11
|
+
import { CommitteeAttestation } from './proposal/committee_attestation.js';
|
|
10
12
|
|
|
11
13
|
/** L2Block metadata. Equivalent to L2Block but without block body containing tx data. */
|
|
12
14
|
export type BlockData = {
|
|
13
15
|
header: BlockHeader;
|
|
14
16
|
archive: AppendOnlyTreeSnapshot;
|
|
15
|
-
blockHash:
|
|
17
|
+
blockHash: BlockHash;
|
|
16
18
|
checkpointNumber: CheckpointNumber;
|
|
17
19
|
indexWithinCheckpoint: IndexWithinCheckpoint;
|
|
18
20
|
};
|
|
@@ -20,7 +22,21 @@ export type BlockData = {
|
|
|
20
22
|
export const BlockDataSchema = z.object({
|
|
21
23
|
header: BlockHeader.schema,
|
|
22
24
|
archive: AppendOnlyTreeSnapshot.schema,
|
|
23
|
-
blockHash:
|
|
25
|
+
blockHash: BlockHash.schema,
|
|
24
26
|
checkpointNumber: CheckpointNumberSchema,
|
|
25
27
|
indexWithinCheckpoint: IndexWithinCheckpointSchema,
|
|
26
28
|
});
|
|
29
|
+
|
|
30
|
+
export const BlockDataWithCheckpointContextSchema = z
|
|
31
|
+
.object({
|
|
32
|
+
data: BlockDataSchema,
|
|
33
|
+
checkpoint: CheckpointDataSchema.optional(),
|
|
34
|
+
l1: L1PublishedData.schema.optional(),
|
|
35
|
+
attestations: z.array(CommitteeAttestation.schema),
|
|
36
|
+
})
|
|
37
|
+
.transform(obj => ({
|
|
38
|
+
data: obj.data,
|
|
39
|
+
checkpoint: obj.checkpoint,
|
|
40
|
+
l1: obj.l1,
|
|
41
|
+
attestations: obj.attestations,
|
|
42
|
+
}));
|
package/src/block/block_hash.ts
CHANGED
|
@@ -1,21 +1,24 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { GENESIS_BLOCK_HEADER_HASH as GENESIS_BLOCK_HEADER_HASH_FR } from '@aztec/constants';
|
|
2
|
+
import { BaseFr, Fr } from '@aztec/foundation/curves/bn254';
|
|
2
3
|
import type { ZodFor } from '@aztec/foundation/schemas';
|
|
4
|
+
import type { BufferReader } from '@aztec/foundation/serialize';
|
|
3
5
|
|
|
4
6
|
import { inspect } from 'util';
|
|
5
7
|
|
|
6
8
|
import { hexSchemaFor } from '../schemas/schemas.js';
|
|
7
9
|
|
|
8
|
-
const BLOCK_HASH_BRAND = Symbol.for('aztec.BlockHash');
|
|
9
|
-
|
|
10
10
|
/** Hash of an L2 block. */
|
|
11
|
-
export class BlockHash extends
|
|
12
|
-
|
|
11
|
+
export class BlockHash extends BaseFr {
|
|
12
|
+
/** Branding for nominal typing. */
|
|
13
|
+
declare private readonly _branding: 'BlockHash';
|
|
14
|
+
|
|
15
|
+
static ZERO = new BlockHash(Fr.ZERO);
|
|
13
16
|
|
|
14
17
|
constructor(hash: Fr) {
|
|
15
18
|
super(hash);
|
|
16
19
|
}
|
|
17
20
|
|
|
18
|
-
|
|
21
|
+
[inspect.custom]() {
|
|
19
22
|
return `BlockHash<${this.toString()}>`;
|
|
20
23
|
}
|
|
21
24
|
|
|
@@ -23,23 +26,27 @@ export class BlockHash extends Fr {
|
|
|
23
26
|
return new Fr(this.toBigInt());
|
|
24
27
|
}
|
|
25
28
|
|
|
26
|
-
/**
|
|
27
|
-
* Type guard that checks if a value is a BlockHash instance.
|
|
28
|
-
* Uses Symbol.for to ensure cross-module compatibility.
|
|
29
|
-
*/
|
|
29
|
+
/** Type guard that checks if a value is a BlockHash instance. */
|
|
30
30
|
static isBlockHash(value: unknown): value is BlockHash {
|
|
31
|
-
return
|
|
31
|
+
return value instanceof BlockHash;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
static
|
|
34
|
+
static random() {
|
|
35
35
|
return new BlockHash(Fr.random());
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
static
|
|
38
|
+
static fromBuffer(buffer: Buffer | BufferReader): BlockHash {
|
|
39
|
+
return new BlockHash(Fr.fromBuffer(buffer));
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
static fromString(str: string): BlockHash {
|
|
39
43
|
return new BlockHash(Fr.fromString(str));
|
|
40
44
|
}
|
|
41
45
|
|
|
42
|
-
static
|
|
46
|
+
static get schema() {
|
|
43
47
|
return hexSchemaFor(BlockHash) as ZodFor<BlockHash>;
|
|
44
48
|
}
|
|
45
49
|
}
|
|
50
|
+
|
|
51
|
+
/** The block header hash for the genesis block (block 0). */
|
|
52
|
+
export const GENESIS_BLOCK_HEADER_HASH: BlockHash = new BlockHash(GENESIS_BLOCK_HEADER_HASH_FR);
|
|
@@ -1,10 +1,43 @@
|
|
|
1
1
|
import { BlockNumberSchema } from '@aztec/foundation/branded-types';
|
|
2
|
+
import { jsonStringify } from '@aztec/foundation/json-rpc';
|
|
3
|
+
import { schemas } from '@aztec/foundation/schemas';
|
|
2
4
|
|
|
3
5
|
import { z } from 'zod';
|
|
4
6
|
|
|
7
|
+
import { ChainTipSchema } from '../interfaces/chain_tips.js';
|
|
5
8
|
import { BlockHash } from './block_hash.js';
|
|
6
9
|
|
|
7
|
-
|
|
10
|
+
/**
|
|
11
|
+
* Selector for a block in RPC calls.
|
|
12
|
+
*
|
|
13
|
+
* Accepts a block number, a {@link BlockHash}, a chain-tip name (e.g. `'proven'`, `'checkpointed'`),
|
|
14
|
+
* `'latest'` (alias for `'proposed'`), or the explicit object variants `{ number }`, `{ hash }`,
|
|
15
|
+
* and `{ archive }`.
|
|
16
|
+
*/
|
|
17
|
+
export const BlockParameterSchema = z.union([
|
|
18
|
+
BlockHash.schema,
|
|
19
|
+
BlockNumberSchema,
|
|
20
|
+
ChainTipSchema,
|
|
21
|
+
z.literal('latest'),
|
|
22
|
+
z.object({ number: BlockNumberSchema }),
|
|
23
|
+
z.object({ hash: BlockHash.schema }),
|
|
24
|
+
z.object({ archive: schemas.Fr }),
|
|
25
|
+
]);
|
|
8
26
|
|
|
9
|
-
/** Block parameter - either a specific BlockNumber, block hash (BlockHash), or 'latest' */
|
|
10
27
|
export type BlockParameter = z.infer<typeof BlockParameterSchema>;
|
|
28
|
+
|
|
29
|
+
export function inspectBlockParameter(param: BlockParameter) {
|
|
30
|
+
if (typeof param === 'number') {
|
|
31
|
+
return param.toString();
|
|
32
|
+
} else if (typeof param === 'string') {
|
|
33
|
+
return param;
|
|
34
|
+
} else if ('number' in param) {
|
|
35
|
+
return `number=${param.number.toString()}`;
|
|
36
|
+
} else if ('hash' in param) {
|
|
37
|
+
return `hash=${param.hash.toString()}`;
|
|
38
|
+
} else if ('archive' in param) {
|
|
39
|
+
return `archive=${param.archive.toString()}`;
|
|
40
|
+
} else {
|
|
41
|
+
return jsonStringify(param);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -5,8 +5,10 @@ import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
|
5
5
|
|
|
6
6
|
import { z } from 'zod';
|
|
7
7
|
|
|
8
|
+
import { BlockHash } from './block_hash.js';
|
|
9
|
+
|
|
8
10
|
export type L2BlockInfo = {
|
|
9
|
-
blockHash?:
|
|
11
|
+
blockHash?: BlockHash;
|
|
10
12
|
archive: Fr;
|
|
11
13
|
lastArchive: Fr;
|
|
12
14
|
blockNumber: BlockNumber;
|
|
@@ -17,7 +19,7 @@ export type L2BlockInfo = {
|
|
|
17
19
|
|
|
18
20
|
export function randomBlockInfo(blockNumber?: BlockNumber | number): L2BlockInfo {
|
|
19
21
|
return {
|
|
20
|
-
blockHash:
|
|
22
|
+
blockHash: BlockHash.random(),
|
|
21
23
|
archive: Fr.random(),
|
|
22
24
|
lastArchive: Fr.random(),
|
|
23
25
|
blockNumber: BlockNumber(blockNumber ?? Math.floor(Math.random() * 100000) + 1),
|
|
@@ -28,7 +30,7 @@ export function randomBlockInfo(blockNumber?: BlockNumber | number): L2BlockInfo
|
|
|
28
30
|
}
|
|
29
31
|
|
|
30
32
|
export const BlockInfoSchema = z.object({
|
|
31
|
-
blockHash:
|
|
33
|
+
blockHash: BlockHash.schema.optional(),
|
|
32
34
|
archive: schemas.Fr,
|
|
33
35
|
lastArchive: schemas.Fr,
|
|
34
36
|
blockNumber: BlockNumberSchema,
|
|
@@ -39,7 +41,7 @@ export const BlockInfoSchema = z.object({
|
|
|
39
41
|
|
|
40
42
|
export function serializeBlockInfo(blockInfo: L2BlockInfo): Buffer {
|
|
41
43
|
return serializeToBuffer(
|
|
42
|
-
blockInfo.blockHash ??
|
|
44
|
+
blockInfo.blockHash ?? BlockHash.ZERO,
|
|
43
45
|
blockInfo.archive,
|
|
44
46
|
blockInfo.lastArchive,
|
|
45
47
|
blockInfo.blockNumber,
|
|
@@ -51,9 +53,9 @@ export function serializeBlockInfo(blockInfo: L2BlockInfo): Buffer {
|
|
|
51
53
|
|
|
52
54
|
export function deserializeBlockInfo(buffer: Buffer | BufferReader): L2BlockInfo {
|
|
53
55
|
const reader = BufferReader.asReader(buffer);
|
|
54
|
-
const blockHash =
|
|
56
|
+
const blockHash = BlockHash.fromBuffer(reader);
|
|
55
57
|
return {
|
|
56
|
-
blockHash: blockHash.equals(
|
|
58
|
+
blockHash: blockHash.equals(BlockHash.ZERO) ? undefined : blockHash,
|
|
57
59
|
archive: reader.readObject(Fr),
|
|
58
60
|
lastArchive: reader.readObject(Fr),
|
|
59
61
|
blockNumber: BlockNumber(reader.readNumber()),
|
|
@@ -14,7 +14,7 @@ import { z } from 'zod';
|
|
|
14
14
|
|
|
15
15
|
import type { Checkpoint } from '../checkpoint/checkpoint.js';
|
|
16
16
|
import type { CheckpointData, CommonCheckpointData, ProposedCheckpointData } from '../checkpoint/checkpoint_data.js';
|
|
17
|
-
import type { PublishedCheckpoint } from '../checkpoint/published_checkpoint.js';
|
|
17
|
+
import type { L1PublishedData, PublishedCheckpoint } from '../checkpoint/published_checkpoint.js';
|
|
18
18
|
import type { L1RollupConstants } from '../epoch-helpers/index.js';
|
|
19
19
|
import { CheckpointHeader } from '../rollup/checkpoint_header.js';
|
|
20
20
|
import type { BlockHeader } from '../tx/block_header.js';
|
|
@@ -25,8 +25,17 @@ import type { BlockData } from './block_data.js';
|
|
|
25
25
|
import type { BlockHash } from './block_hash.js';
|
|
26
26
|
import type { CheckpointedL2Block } from './checkpointed_l2_block.js';
|
|
27
27
|
import type { L2Block } from './l2_block.js';
|
|
28
|
+
import type { CommitteeAttestation } from './proposal/committee_attestation.js';
|
|
28
29
|
import type { ValidateCheckpointNegativeResult, ValidateCheckpointResult } from './validate_block_result.js';
|
|
29
30
|
|
|
31
|
+
/** Block metadata plus checkpoint-derived context (L1 publish info, attestations). */
|
|
32
|
+
export type BlockDataWithCheckpointContext = {
|
|
33
|
+
data: BlockData;
|
|
34
|
+
checkpoint?: CheckpointData;
|
|
35
|
+
l1?: L1PublishedData;
|
|
36
|
+
attestations: CommitteeAttestation[];
|
|
37
|
+
};
|
|
38
|
+
|
|
30
39
|
/**
|
|
31
40
|
* Interface of classes allowing for the retrieval of L2 blocks.
|
|
32
41
|
*/
|
|
@@ -111,6 +120,37 @@ export interface L2BlockSource {
|
|
|
111
120
|
*/
|
|
112
121
|
getCheckpointsDataForEpoch(epochNumber: EpochNumber): Promise<CheckpointData[]>;
|
|
113
122
|
|
|
123
|
+
/**
|
|
124
|
+
* Gets lightweight checkpoint metadata for a single checkpoint.
|
|
125
|
+
* Cheap passthrough for metadata-only queries (no block body reads).
|
|
126
|
+
* @param checkpointNumber - The checkpoint number to retrieve.
|
|
127
|
+
* @returns The requested checkpoint data (or undefined if not found).
|
|
128
|
+
*/
|
|
129
|
+
getCheckpointData(checkpointNumber: CheckpointNumber): Promise<CheckpointData | undefined>;
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Gets up to `limit` amount of checkpoint metadata entries starting from `from`.
|
|
133
|
+
* Cheap passthrough for metadata-only queries (no block body reads).
|
|
134
|
+
* @param from - The first checkpoint number to return (inclusive).
|
|
135
|
+
* @param limit - The maximum number of checkpoints to return.
|
|
136
|
+
*/
|
|
137
|
+
getCheckpointDataRange(from: CheckpointNumber, limit: number): Promise<CheckpointData[]>;
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Looks up the checkpoint number that contains the given slot.
|
|
141
|
+
* @param slot - The slot number to look up.
|
|
142
|
+
* @returns The checkpoint number (or undefined if not found).
|
|
143
|
+
*/
|
|
144
|
+
getCheckpointNumberBySlot(slot: SlotNumber): Promise<CheckpointNumber | undefined>;
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Gets block metadata plus checkpoint-derived context (L1 publish info, attestations)
|
|
148
|
+
* without deserializing tx bodies. Uses checkpoint-level values when the block is
|
|
149
|
+
* checkpointed; otherwise returns `l1: undefined` and empty attestations.
|
|
150
|
+
* @param number - The block number to retrieve.
|
|
151
|
+
*/
|
|
152
|
+
getBlockDataWithCheckpointContext(number: BlockNumber): Promise<BlockDataWithCheckpointContext | undefined>;
|
|
153
|
+
|
|
114
154
|
/**
|
|
115
155
|
* Gets a block header by its hash.
|
|
116
156
|
* @param blockHash - The block hash to retrieve.
|
|
@@ -230,10 +270,10 @@ export interface L2BlockSource {
|
|
|
230
270
|
getPendingChainValidationStatus(): Promise<ValidateCheckpointResult>;
|
|
231
271
|
|
|
232
272
|
/** Returns the checkpoint at the proposed chain tip. */
|
|
233
|
-
|
|
273
|
+
getLastCheckpoint(): Promise<CommonCheckpointData | undefined>;
|
|
234
274
|
|
|
235
275
|
/** Returns proposed checkpoint, if set, undefined if not*/
|
|
236
|
-
|
|
276
|
+
getLastProposedCheckpoint(): Promise<ProposedCheckpointData | undefined>;
|
|
237
277
|
|
|
238
278
|
/** Force a sync. */
|
|
239
279
|
syncImmediate(): Promise<void>;
|
|
@@ -2,10 +2,14 @@ import type { PublishedCheckpoint } from '../../checkpoint/published_checkpoint.
|
|
|
2
2
|
import type { L2Block } from '../l2_block.js';
|
|
3
3
|
import type { CheckpointId, L2BlockId, L2Tips } from '../l2_block_source.js';
|
|
4
4
|
|
|
5
|
+
/** Provides the current chain tips. Implemented by world-state, l2-tips-store, and AztecNode. */
|
|
6
|
+
export interface L2TipsProvider {
|
|
7
|
+
getL2Tips(): Promise<L2Tips>;
|
|
8
|
+
}
|
|
9
|
+
|
|
5
10
|
/** Interface to the local view of the chain. Implemented by world-state and l2-tips-store. */
|
|
6
|
-
export interface L2BlockStreamLocalDataProvider {
|
|
11
|
+
export interface L2BlockStreamLocalDataProvider extends L2TipsProvider {
|
|
7
12
|
getL2BlockHash(number: number): Promise<string | undefined>;
|
|
8
|
-
getL2Tips(): Promise<L2Tips>;
|
|
9
13
|
}
|
|
10
14
|
|
|
11
15
|
/** Interface to a handler of events emitted. */
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { GENESIS_BLOCK_HEADER_HASH } from '@aztec/constants';
|
|
2
1
|
import { BlockNumber, CheckpointNumber } from '@aztec/foundation/branded-types';
|
|
3
2
|
|
|
4
3
|
import type { PublishedCheckpoint } from '../../checkpoint/published_checkpoint.js';
|
|
4
|
+
import { GENESIS_BLOCK_HEADER_HASH } from '../block_hash.js';
|
|
5
5
|
import type { L2Block } from '../l2_block.js';
|
|
6
6
|
import {
|
|
7
7
|
type CheckpointId,
|
|
@@ -4,26 +4,37 @@ import { hexToBuffer } from '@aztec/foundation/string';
|
|
|
4
4
|
import { encodeAbiParameters, parseAbiParameters } from 'viem';
|
|
5
5
|
import { z } from 'zod';
|
|
6
6
|
|
|
7
|
-
import
|
|
7
|
+
import {
|
|
8
|
+
type CoordinationSignatureContext,
|
|
9
|
+
type CoordinationSignatureType,
|
|
10
|
+
type Signable,
|
|
11
|
+
coordinationSignatureContextSchema,
|
|
12
|
+
} from '../../p2p/signature_utils.js';
|
|
8
13
|
import { CommitteeAttestation, EthAddress } from './committee_attestation.js';
|
|
9
14
|
|
|
10
15
|
export class CommitteeAttestationsAndSigners implements Signable {
|
|
11
|
-
|
|
16
|
+
readonly primaryType: CoordinationSignatureType = 'AttestationsAndSigners';
|
|
17
|
+
|
|
18
|
+
constructor(
|
|
19
|
+
public attestations: CommitteeAttestation[],
|
|
20
|
+
public readonly signatureContext: CoordinationSignatureContext,
|
|
21
|
+
) {}
|
|
12
22
|
|
|
13
23
|
static get schema() {
|
|
14
24
|
return z
|
|
15
25
|
.object({
|
|
16
26
|
attestations: CommitteeAttestation.schema.array(),
|
|
27
|
+
signatureContext: coordinationSignatureContextSchema,
|
|
17
28
|
})
|
|
18
|
-
.transform(obj => new CommitteeAttestationsAndSigners(obj.attestations));
|
|
29
|
+
.transform(obj => new CommitteeAttestationsAndSigners(obj.attestations, obj.signatureContext));
|
|
19
30
|
}
|
|
20
31
|
|
|
21
|
-
getPayloadToSign(
|
|
22
|
-
|
|
32
|
+
getPayloadToSign(): Buffer {
|
|
33
|
+
// Matches the L1 abi.encode(attestations, signers) in AttestationLib.sol#getAttestationsAndSignersDigest.
|
|
34
|
+
const abi = parseAbiParameters('(bytes,bytes),address[]');
|
|
23
35
|
const packed = this.getPackedAttestations();
|
|
24
36
|
|
|
25
37
|
const encodedData = encodeAbiParameters(abi, [
|
|
26
|
-
domainSeparator,
|
|
27
38
|
[packed.signatureIndices, packed.signaturesOrAddresses],
|
|
28
39
|
this.getSigners().map(s => s.toString()),
|
|
29
40
|
]);
|
|
@@ -31,8 +42,8 @@ export class CommitteeAttestationsAndSigners implements Signable {
|
|
|
31
42
|
return hexToBuffer(encodedData);
|
|
32
43
|
}
|
|
33
44
|
|
|
34
|
-
static empty(): CommitteeAttestationsAndSigners {
|
|
35
|
-
return new CommitteeAttestationsAndSigners([]);
|
|
45
|
+
static empty(signatureContext: CoordinationSignatureContext): CommitteeAttestationsAndSigners {
|
|
46
|
+
return new CommitteeAttestationsAndSigners([], signatureContext);
|
|
36
47
|
}
|
|
37
48
|
|
|
38
49
|
toString() {
|
|
@@ -53,9 +64,9 @@ export class CommitteeAttestationsAndSigners implements Signable {
|
|
|
53
64
|
* @param attestations - Array of committee attestations with addresses and signatures
|
|
54
65
|
* @returns Packed attestations with bitmap and tightly packed signature/address data
|
|
55
66
|
*/
|
|
56
|
-
|
|
57
|
-
const length =
|
|
58
|
-
const
|
|
67
|
+
static packAttestations(attestations: CommitteeAttestation[]): ViemCommitteeAttestations {
|
|
68
|
+
const length = attestations.length;
|
|
69
|
+
const viemAttestations = attestations.map(a => a.toViem());
|
|
59
70
|
|
|
60
71
|
// Calculate bitmap size (1 bit per attestation, rounded up to nearest byte)
|
|
61
72
|
const bitmapSize = Math.ceil(length / 8);
|
|
@@ -63,8 +74,8 @@ export class CommitteeAttestationsAndSigners implements Signable {
|
|
|
63
74
|
|
|
64
75
|
// Calculate total data size needed
|
|
65
76
|
let totalDataSize = 0;
|
|
66
|
-
for (
|
|
67
|
-
const signature =
|
|
77
|
+
for (const attestation of viemAttestations) {
|
|
78
|
+
const signature = attestation.signature;
|
|
68
79
|
// Check if signature is empty (v = 0)
|
|
69
80
|
const isEmpty = signature.v === 0;
|
|
70
81
|
|
|
@@ -79,8 +90,7 @@ export class CommitteeAttestationsAndSigners implements Signable {
|
|
|
79
90
|
let dataIndex = 0;
|
|
80
91
|
|
|
81
92
|
// Pack the data
|
|
82
|
-
for (
|
|
83
|
-
const attestation = attestations[i];
|
|
93
|
+
for (const [i, attestation] of viemAttestations.entries()) {
|
|
84
94
|
const signature = attestation.signature;
|
|
85
95
|
|
|
86
96
|
// Check if signature is empty
|
|
@@ -90,7 +100,7 @@ export class CommitteeAttestationsAndSigners implements Signable {
|
|
|
90
100
|
// Set bit in bitmap (bit 7-0 in each byte, left to right)
|
|
91
101
|
const byteIndex = Math.floor(i / 8);
|
|
92
102
|
const bitIndex = 7 - (i % 8);
|
|
93
|
-
signatureIndices[byteIndex]
|
|
103
|
+
signatureIndices[byteIndex] = (signatureIndices[byteIndex] ?? 0) | (1 << bitIndex);
|
|
94
104
|
|
|
95
105
|
// Pack signature: v + r + s
|
|
96
106
|
signaturesOrAddresses[dataIndex] = signature.v;
|
|
@@ -118,6 +128,10 @@ export class CommitteeAttestationsAndSigners implements Signable {
|
|
|
118
128
|
signaturesOrAddresses: `0x${Buffer.from(signaturesOrAddresses).toString('hex')}`,
|
|
119
129
|
};
|
|
120
130
|
}
|
|
131
|
+
|
|
132
|
+
getPackedAttestations(): ViemCommitteeAttestations {
|
|
133
|
+
return CommitteeAttestationsAndSigners.packAttestations(this.attestations);
|
|
134
|
+
}
|
|
121
135
|
}
|
|
122
136
|
|
|
123
137
|
/**
|
|
@@ -130,8 +144,9 @@ export class MaliciousCommitteeAttestationsAndSigners extends CommitteeAttestati
|
|
|
130
144
|
constructor(
|
|
131
145
|
attestations: CommitteeAttestation[],
|
|
132
146
|
private signers: EthAddress[],
|
|
147
|
+
signatureContext: CoordinationSignatureContext,
|
|
133
148
|
) {
|
|
134
|
-
super(attestations);
|
|
149
|
+
super(attestations, signatureContext);
|
|
135
150
|
}
|
|
136
151
|
|
|
137
152
|
override getSigners(): EthAddress[] {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { GENESIS_BLOCK_HEADER_HASH } from '@aztec/constants';
|
|
2
1
|
import { BlockNumber, CheckpointNumber } from '@aztec/foundation/branded-types';
|
|
3
2
|
import { times } from '@aztec/foundation/collection';
|
|
4
3
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
@@ -13,6 +12,7 @@ import { Checkpoint, L1PublishedData, PublishedCheckpoint } from '@aztec/stdlib/
|
|
|
13
12
|
|
|
14
13
|
import { jestExpect as expect } from '@jest/expect';
|
|
15
14
|
|
|
15
|
+
import { GENESIS_BLOCK_HEADER_HASH } from '../block_hash.js';
|
|
16
16
|
import type { L2TipsStore } from '../l2_block_stream/index.js';
|
|
17
17
|
|
|
18
18
|
export function testL2TipsStore(makeTipsStore: () => Promise<L2TipsStore>) {
|
|
@@ -32,6 +32,8 @@ export type L1EnrichedCheckpointData = {
|
|
|
32
32
|
export type StorageEnrichedCheckpointData = {
|
|
33
33
|
archive: AppendOnlyTreeSnapshot;
|
|
34
34
|
checkpointOutHash: Fr;
|
|
35
|
+
/** Fee asset price modifier in basis points. Defaults to 0 (no change) when not explicitly set. */
|
|
36
|
+
feeAssetPriceModifier: bigint;
|
|
35
37
|
};
|
|
36
38
|
|
|
37
39
|
/** Data stored only with proposed checkpoint data */
|
|
@@ -70,6 +72,7 @@ export const CheckpointDataSchema = z
|
|
|
70
72
|
checkpointOutHash: schemas.Fr,
|
|
71
73
|
startBlock: BlockNumberSchema,
|
|
72
74
|
blockCount: schemas.Integer,
|
|
75
|
+
feeAssetPriceModifier: schemas.BigInt,
|
|
73
76
|
attestations: z.array(CommitteeAttestation.schema),
|
|
74
77
|
l1: L1PublishedData.schema,
|
|
75
78
|
})
|
|
@@ -81,6 +84,7 @@ export const CheckpointDataSchema = z
|
|
|
81
84
|
checkpointOutHash: obj.checkpointOutHash,
|
|
82
85
|
startBlock: obj.startBlock,
|
|
83
86
|
blockCount: obj.blockCount,
|
|
87
|
+
feeAssetPriceModifier: obj.feeAssetPriceModifier,
|
|
84
88
|
attestations: obj.attestations,
|
|
85
89
|
l1: obj.l1,
|
|
86
90
|
}),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { l1ContractAddressesMapping } from '@aztec/ethereum/l1-contract-addresses';
|
|
2
|
-
import type
|
|
2
|
+
import { type ConfigMappingsType, numberConfigHelper } from '@aztec/foundation/config';
|
|
3
3
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
4
4
|
|
|
5
5
|
export { type SequencerConfig, SequencerConfigSchema } from '../interfaces/configs.js';
|
|
@@ -14,14 +14,19 @@ export const emptyChainConfig: ChainConfig = {
|
|
|
14
14
|
export const chainConfigMappings: ConfigMappingsType<ChainConfig> = {
|
|
15
15
|
l1ChainId: {
|
|
16
16
|
env: 'L1_CHAIN_ID',
|
|
17
|
-
|
|
18
|
-
defaultValue: 31337,
|
|
17
|
+
...numberConfigHelper(31337),
|
|
19
18
|
description: 'The chain ID of the ethereum host.',
|
|
20
19
|
},
|
|
21
20
|
rollupVersion: {
|
|
22
21
|
env: 'ROLLUP_VERSION',
|
|
23
22
|
description: 'The version of the rollup.',
|
|
24
|
-
parseEnv: (val: string) =>
|
|
23
|
+
parseEnv: (val: string) => {
|
|
24
|
+
const parsed = parseInt(val, 10);
|
|
25
|
+
if (!Number.isSafeInteger(parsed)) {
|
|
26
|
+
throw new Error(`Invalid rollup version: ${val}`);
|
|
27
|
+
}
|
|
28
|
+
return parsed;
|
|
29
|
+
},
|
|
25
30
|
},
|
|
26
31
|
l1Contracts: {
|
|
27
32
|
description: 'The deployed L1 contract addresses',
|
|
@@ -1,10 +1,19 @@
|
|
|
1
|
-
import
|
|
1
|
+
import {
|
|
2
|
+
type ConfigMappingsType,
|
|
3
|
+
floatConfigHelper,
|
|
4
|
+
numberConfigHelper,
|
|
5
|
+
optionalNumberConfigHelper,
|
|
6
|
+
} from '@aztec/foundation/config';
|
|
2
7
|
|
|
3
8
|
import type { SequencerConfig } from '../interfaces/configs.js';
|
|
9
|
+
import { DEFAULT_P2P_PROPAGATION_TIME } from '../timetable/index.js';
|
|
4
10
|
|
|
5
11
|
/** Default maximum number of transactions per block. */
|
|
6
12
|
export const DEFAULT_MAX_TXS_PER_BLOCK = 32;
|
|
7
13
|
|
|
14
|
+
/** Default maximum number of blocks the sequencer packs into a single checkpoint. */
|
|
15
|
+
export const DEFAULT_MAX_BLOCKS_PER_CHECKPOINT = 24;
|
|
16
|
+
|
|
8
17
|
/**
|
|
9
18
|
* Partial sequencer config mappings for fields that need to be shared across packages.
|
|
10
19
|
* The full sequencer config mappings remain in sequencer-client, but shared fields
|
|
@@ -12,26 +21,45 @@ export const DEFAULT_MAX_TXS_PER_BLOCK = 32;
|
|
|
12
21
|
* to avoid duplication.
|
|
13
22
|
*/
|
|
14
23
|
export const sharedSequencerConfigMappings: ConfigMappingsType<
|
|
15
|
-
Pick<
|
|
24
|
+
Pick<
|
|
25
|
+
SequencerConfig,
|
|
26
|
+
| 'blockDurationMs'
|
|
27
|
+
| 'expectedBlockProposalsPerSlot'
|
|
28
|
+
| 'maxTxsPerBlock'
|
|
29
|
+
| 'attestationPropagationTime'
|
|
30
|
+
| 'maxBlocksPerCheckpoint'
|
|
31
|
+
>
|
|
16
32
|
> = {
|
|
17
33
|
blockDurationMs: {
|
|
18
34
|
env: 'SEQ_BLOCK_DURATION_MS',
|
|
19
35
|
description:
|
|
20
36
|
'Duration per block in milliseconds when building multiple blocks per slot. ' +
|
|
21
37
|
'If undefined (default), builds a single block per slot using the full slot duration.',
|
|
22
|
-
|
|
38
|
+
...optionalNumberConfigHelper(),
|
|
23
39
|
},
|
|
24
40
|
expectedBlockProposalsPerSlot: {
|
|
25
41
|
env: 'SEQ_EXPECTED_BLOCK_PROPOSALS_PER_SLOT',
|
|
26
42
|
description:
|
|
27
43
|
'Expected number of block proposals per slot for P2P peer scoring. ' +
|
|
28
44
|
'0 (default) disables block proposal scoring. Set to a positive value to enable.',
|
|
29
|
-
|
|
30
|
-
defaultValue: 0,
|
|
45
|
+
...numberConfigHelper(0),
|
|
31
46
|
},
|
|
32
47
|
maxTxsPerBlock: {
|
|
33
48
|
env: 'SEQ_MAX_TX_PER_BLOCK',
|
|
34
49
|
description: 'The maximum number of txs to include in a block.',
|
|
35
|
-
|
|
50
|
+
...optionalNumberConfigHelper(),
|
|
51
|
+
},
|
|
52
|
+
attestationPropagationTime: {
|
|
53
|
+
env: 'SEQ_ATTESTATION_PROPAGATION_TIME',
|
|
54
|
+
description: 'How many seconds it takes for proposals and attestations to travel across the p2p layer (one-way).',
|
|
55
|
+
defaultValue: DEFAULT_P2P_PROPAGATION_TIME,
|
|
56
|
+
...floatConfigHelper(DEFAULT_P2P_PROPAGATION_TIME),
|
|
57
|
+
},
|
|
58
|
+
maxBlocksPerCheckpoint: {
|
|
59
|
+
env: 'MAX_BLOCKS_PER_CHECKPOINT',
|
|
60
|
+
description:
|
|
61
|
+
'Maximum number of blocks the sequencer packs into a single checkpoint, and the maximum indexWithinCheckpoint accepted on inbound block proposals.',
|
|
62
|
+
parseEnv: (val: string) => parseInt(val, 10),
|
|
63
|
+
defaultValue: DEFAULT_MAX_BLOCKS_PER_CHECKPOINT,
|
|
36
64
|
},
|
|
37
65
|
};
|
|
@@ -13,7 +13,7 @@ import type { ContractInstance } from './interfaces/contract_instance.js';
|
|
|
13
13
|
/**
|
|
14
14
|
* Returns the deployment address for a given contract instance.
|
|
15
15
|
* ```
|
|
16
|
-
* salted_initialization_hash = poseidon2(
|
|
16
|
+
* salted_initialization_hash = poseidon2(DOM_SEP__SALTED_INITIALIZATION_HASH, [salt, initialization_hash, deployer])
|
|
17
17
|
* partial_address = poseidon2(DOM_SEP__PARTIAL_ADDRESS, [contract_class_id, salted_initialization_hash])
|
|
18
18
|
* address = ((poseidon2(DOM_SEP__CONTRACT_ADDRESS_V1, [public_keys_hash, partial_address]) * G) + ivpk_m).x <- the x-coordinate of the address point
|
|
19
19
|
* ```
|
|
@@ -57,7 +57,7 @@ export function computeSaltedInitializationHash(
|
|
|
57
57
|
): Promise<Fr> {
|
|
58
58
|
return poseidon2HashWithSeparator(
|
|
59
59
|
[instance.salt, instance.initializationHash, instance.deployer],
|
|
60
|
-
DomainSeparator.
|
|
60
|
+
DomainSeparator.SALTED_INITIALIZATION_HASH,
|
|
61
61
|
);
|
|
62
62
|
}
|
|
63
63
|
|
|
@@ -3,6 +3,7 @@ import { poseidon2Hash, poseidon2HashWithSeparator } from '@aztec/foundation/cry
|
|
|
3
3
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
4
4
|
import { type MerkleTree, MerkleTreeCalculator } from '@aztec/foundation/trees';
|
|
5
5
|
|
|
6
|
+
import { computeMerkleHash } from '../hash/hash.js';
|
|
6
7
|
import type { PrivateFunction } from './interfaces/contract_class.js';
|
|
7
8
|
|
|
8
9
|
// Memoize the merkle tree calculators to avoid re-computing the zero-hash for each level in each call
|
|
@@ -42,7 +43,8 @@ async function getPrivateFunctionTreeCalculator(): Promise<MerkleTreeCalculator>
|
|
|
42
43
|
privateFunctionTreeCalculator = await MerkleTreeCalculator.create(
|
|
43
44
|
FUNCTION_TREE_HEIGHT,
|
|
44
45
|
functionTreeZeroLeaf,
|
|
45
|
-
async (left, right) =>
|
|
46
|
+
async (left, right) =>
|
|
47
|
+
(await computeMerkleHash(Fr.fromBuffer(left), Fr.fromBuffer(right))).toBuffer() as Buffer<ArrayBuffer>,
|
|
46
48
|
);
|
|
47
49
|
}
|
|
48
50
|
return privateFunctionTreeCalculator;
|