@aztec/stdlib 0.0.1-commit.f504929 → 0.0.1-commit.f650c0a5c
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dest/abi/abi.d.ts +138 -1
- package/dest/abi/abi.d.ts.map +1 -1
- package/dest/abi/abi.js +10 -2
- package/dest/abi/buffer.d.ts +14 -4
- package/dest/abi/buffer.d.ts.map +1 -1
- package/dest/abi/buffer.js +25 -4
- package/dest/abi/decoder.d.ts +5 -44
- package/dest/abi/decoder.d.ts.map +1 -1
- package/dest/abi/decoder.js +12 -67
- package/dest/abi/function_selector.js +1 -1
- package/dest/abi/function_signature_decoder.d.ts +43 -0
- package/dest/abi/function_signature_decoder.d.ts.map +1 -0
- package/dest/abi/function_signature_decoder.js +66 -0
- package/dest/abi/index.d.ts +2 -1
- package/dest/abi/index.d.ts.map +1 -1
- package/dest/abi/index.js +1 -0
- 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/avm.d.ts +300 -300
- 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/block/l2_block.d.ts +9 -1
- package/dest/block/l2_block.d.ts.map +1 -1
- package/dest/block/l2_block.js +12 -2
- package/dest/block/l2_block_source.d.ts +95 -10
- package/dest/block/l2_block_source.d.ts.map +1 -1
- package/dest/block/l2_block_source.js +1 -0
- 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 +17 -4
- package/dest/block/test/l2_tips_store_test_suite.d.ts +1 -1
- package/dest/block/test/l2_tips_store_test_suite.d.ts.map +1 -1
- package/dest/block/test/l2_tips_store_test_suite.js +3 -2
- package/dest/checkpoint/checkpoint.d.ts +8 -1
- package/dest/checkpoint/checkpoint.d.ts.map +1 -1
- package/dest/checkpoint/checkpoint.js +18 -5
- package/dest/checkpoint/checkpoint_data.d.ts +71 -5
- package/dest/checkpoint/checkpoint_data.d.ts.map +1 -1
- package/dest/checkpoint/checkpoint_data.js +10 -0
- package/dest/checkpoint/index.d.ts +2 -1
- package/dest/checkpoint/index.d.ts.map +1 -1
- package/dest/checkpoint/index.js +1 -0
- package/dest/checkpoint/validate.d.ts +36 -0
- package/dest/checkpoint/validate.d.ts.map +1 -0
- package/dest/checkpoint/validate.js +120 -0
- package/dest/config/index.d.ts +2 -1
- package/dest/config/index.d.ts.map +1 -1
- package/dest/config/index.js +1 -0
- package/dest/config/pipelining-config.d.ts +19 -0
- package/dest/config/pipelining-config.d.ts.map +1 -0
- package/dest/config/pipelining-config.js +18 -0
- package/dest/config/sequencer-config.d.ts +2 -2
- package/dest/config/sequencer-config.d.ts.map +1 -1
- package/dest/config/sequencer-config.js +1 -2
- package/dest/contract/contract_address.d.ts +3 -3
- package/dest/contract/contract_address.js +3 -3
- package/dest/contract/contract_class_id.d.ts +2 -2
- package/dest/contract/contract_class_id.js +2 -2
- package/dest/contract/index.d.ts +1 -3
- package/dest/contract/index.d.ts.map +1 -1
- package/dest/contract/index.js +0 -2
- package/dest/contract/interfaces/contract_class.d.ts +3 -156
- package/dest/contract/interfaces/contract_class.d.ts.map +1 -1
- package/dest/contract/interfaces/contract_class.js +1 -28
- package/dest/epoch-helpers/index.d.ts +11 -1
- package/dest/epoch-helpers/index.d.ts.map +1 -1
- package/dest/epoch-helpers/index.js +16 -2
- package/dest/file-store/factory.d.ts +4 -3
- package/dest/file-store/factory.d.ts.map +1 -1
- package/dest/file-store/factory.js +2 -2
- package/dest/file-store/http.d.ts +9 -2
- package/dest/file-store/http.d.ts.map +1 -1
- package/dest/file-store/http.js +20 -9
- package/dest/file-store/index.d.ts +2 -1
- package/dest/file-store/index.d.ts.map +1 -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/ha-signing/config.d.ts +49 -14
- package/dest/ha-signing/config.d.ts.map +1 -1
- package/dest/ha-signing/config.js +20 -15
- package/dest/ha-signing/index.d.ts +3 -2
- package/dest/ha-signing/index.d.ts.map +1 -1
- package/dest/ha-signing/index.js +2 -1
- package/dest/ha-signing/local_config.d.ts +63 -0
- package/dest/ha-signing/local_config.d.ts.map +1 -0
- package/dest/ha-signing/local_config.js +24 -0
- package/dest/hash/hash.d.ts +19 -1
- package/dest/hash/hash.d.ts.map +1 -1
- package/dest/hash/hash.js +29 -0
- package/dest/interfaces/allowed_element.d.ts +25 -1
- package/dest/interfaces/allowed_element.d.ts.map +1 -1
- package/dest/interfaces/allowed_element.js +8 -2
- package/dest/interfaces/archiver.d.ts +1 -1
- package/dest/interfaces/archiver.d.ts.map +1 -1
- package/dest/interfaces/archiver.js +6 -3
- package/dest/interfaces/aztec-node-admin.d.ts +73 -23
- package/dest/interfaces/aztec-node-admin.d.ts.map +1 -1
- package/dest/interfaces/aztec-node-admin.js +3 -3
- package/dest/interfaces/aztec-node.d.ts +12 -6
- package/dest/interfaces/aztec-node.d.ts.map +1 -1
- package/dest/interfaces/aztec-node.js +5 -2
- package/dest/interfaces/block-builder.d.ts +38 -11
- package/dest/interfaces/block-builder.d.ts.map +1 -1
- package/dest/interfaces/block-builder.js +12 -5
- package/dest/interfaces/configs.d.ts +47 -7
- package/dest/interfaces/configs.d.ts.map +1 -1
- package/dest/interfaces/configs.js +3 -1
- package/dest/interfaces/l2_logs_source.d.ts +5 -3
- package/dest/interfaces/l2_logs_source.d.ts.map +1 -1
- package/dest/interfaces/merkle_tree_operations.d.ts +9 -19
- package/dest/interfaces/merkle_tree_operations.d.ts.map +1 -1
- package/dest/interfaces/prover-client.d.ts +6 -1
- package/dest/interfaces/prover-client.d.ts.map +1 -1
- package/dest/interfaces/prover-client.js +7 -1
- package/dest/interfaces/proving-job.d.ts +34 -34
- 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 +103 -35
- package/dest/interfaces/validator.d.ts.map +1 -1
- package/dest/interfaces/validator.js +7 -5
- package/dest/interfaces/world_state.d.ts +5 -4
- package/dest/interfaces/world_state.d.ts.map +1 -1
- package/dest/kernel/private_kernel_tail_circuit_public_inputs.d.ts +2 -1
- package/dest/kernel/private_kernel_tail_circuit_public_inputs.d.ts.map +1 -1
- package/dest/kernel/private_kernel_tail_circuit_public_inputs.js +4 -0
- package/dest/kv-store/config.d.ts +17 -0
- package/dest/kv-store/config.d.ts.map +1 -0
- package/dest/kv-store/config.js +26 -0
- package/dest/kv-store/index.d.ts +2 -0
- package/dest/kv-store/index.d.ts.map +1 -0
- package/dest/kv-store/index.js +1 -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/extended_directional_app_tagging_secret.d.ts +4 -4
- package/dest/logs/extended_directional_app_tagging_secret.d.ts.map +1 -1
- package/dest/logs/extended_directional_app_tagging_secret.js +12 -5
- package/dest/logs/index.d.ts +2 -1
- package/dest/logs/index.d.ts.map +1 -1
- package/dest/logs/index.js +1 -0
- package/dest/logs/log_filter.d.ts +4 -1
- package/dest/logs/log_filter.d.ts.map +1 -1
- package/dest/logs/log_filter.js +2 -1
- package/dest/logs/message_context.d.ts +4 -7
- package/dest/logs/message_context.d.ts.map +1 -1
- package/dest/logs/message_context.js +23 -9
- package/dest/logs/pending_tagged_log.d.ts +2 -3
- package/dest/logs/pending_tagged_log.d.ts.map +1 -1
- package/dest/logs/pending_tagged_log.js +2 -2
- package/dest/logs/shared_secret_derivation.d.ts +11 -10
- package/dest/logs/shared_secret_derivation.d.ts.map +1 -1
- package/dest/logs/shared_secret_derivation.js +15 -9
- package/dest/logs/siloed_tag.d.ts +4 -1
- package/dest/logs/siloed_tag.d.ts.map +1 -1
- package/dest/logs/siloed_tag.js +7 -3
- package/dest/logs/tagging_index_range.d.ts +40 -0
- package/dest/logs/tagging_index_range.d.ts.map +1 -0
- package/dest/logs/tagging_index_range.js +8 -0
- package/dest/logs/tx_scoped_l2_log.d.ts +3 -1
- package/dest/logs/tx_scoped_l2_log.d.ts.map +1 -1
- package/dest/logs/tx_scoped_l2_log.js +7 -0
- package/dest/messaging/l1_to_l2_message.d.ts +3 -2
- package/dest/messaging/l1_to_l2_message.d.ts.map +1 -1
- package/dest/messaging/l1_to_l2_message.js +11 -13
- package/dest/messaging/l1_to_l2_message_source.d.ts +4 -2
- package/dest/messaging/l1_to_l2_message_source.d.ts.map +1 -1
- package/dest/messaging/l2_to_l1_membership.d.ts +32 -6
- package/dest/messaging/l2_to_l1_membership.d.ts.map +1 -1
- package/dest/messaging/l2_to_l1_membership.js +69 -26
- package/dest/noir/index.d.ts +3 -3
- package/dest/noir/index.d.ts.map +1 -1
- package/dest/note/note_dao.d.ts +1 -1
- package/dest/note/note_dao.d.ts.map +1 -1
- package/dest/note/note_dao.js +1 -4
- package/dest/p2p/checkpoint_proposal.d.ts +2 -7
- package/dest/p2p/checkpoint_proposal.d.ts.map +1 -1
- package/dest/p2p/checkpoint_proposal.js +3 -25
- package/dest/p2p/peer_error.d.ts +3 -1
- package/dest/p2p/peer_error.d.ts.map +1 -1
- package/dest/p2p/peer_error.js +5 -0
- package/dest/proofs/chonk_proof.d.ts +46 -2
- package/dest/proofs/chonk_proof.d.ts.map +1 -1
- package/dest/proofs/chonk_proof.js +85 -10
- 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} +5 -6
- package/dest/slashing/votes.d.ts.map +1 -0
- package/dest/slashing/{tally.js → votes.js} +19 -10
- package/dest/tests/factories.d.ts +2 -4
- package/dest/tests/factories.d.ts.map +1 -1
- package/dest/tests/factories.js +11 -28
- package/dest/tests/mocks.d.ts +4 -2
- package/dest/tests/mocks.d.ts.map +1 -1
- package/dest/tests/mocks.js +26 -26
- package/dest/timetable/index.d.ts +2 -1
- package/dest/timetable/index.d.ts.map +1 -1
- package/dest/timetable/index.js +6 -2
- package/dest/tx/block_header.d.ts +3 -1
- package/dest/tx/block_header.d.ts.map +1 -1
- package/dest/tx/block_header.js +4 -0
- package/dest/tx/capsule.d.ts +6 -2
- package/dest/tx/capsule.d.ts.map +1 -1
- package/dest/tx/capsule.js +9 -3
- package/dest/tx/global_variable_builder.d.ts +14 -2
- package/dest/tx/global_variable_builder.d.ts.map +1 -1
- package/dest/tx/private_execution_result.d.ts +6 -6
- package/dest/tx/private_execution_result.d.ts.map +1 -1
- package/dest/tx/private_execution_result.js +6 -6
- package/dest/tx/profiling.d.ts +14 -2
- package/dest/tx/profiling.d.ts.map +1 -1
- package/dest/tx/profiling.js +13 -3
- package/dest/tx/simulated_tx.d.ts +111 -3
- package/dest/tx/simulated_tx.d.ts.map +1 -1
- package/dest/tx/simulated_tx.js +2 -2
- package/dest/tx/tx.d.ts +6 -5
- package/dest/tx/tx.d.ts.map +1 -1
- package/dest/tx/tx.js +18 -6
- package/dest/tx/tx_receipt.d.ts +14 -5
- package/dest/tx/tx_receipt.d.ts.map +1 -1
- package/dest/tx/tx_receipt.js +14 -18
- package/dest/tx/validator/error_texts.d.ts +8 -1
- package/dest/tx/validator/error_texts.d.ts.map +1 -1
- package/dest/tx/validator/error_texts.js +9 -0
- package/dest/update-checker/index.d.ts +3 -2
- package/dest/update-checker/index.d.ts.map +1 -1
- package/dest/update-checker/index.js +2 -1
- package/dest/update-checker/package_version.d.ts +3 -0
- package/dest/update-checker/package_version.d.ts.map +1 -0
- package/dest/update-checker/package_version.js +24 -0
- package/dest/update-checker/version_checker.d.ts +25 -0
- package/dest/update-checker/version_checker.d.ts.map +1 -0
- package/dest/update-checker/version_checker.js +50 -0
- package/dest/validators/errors.d.ts +6 -1
- package/dest/validators/errors.d.ts.map +1 -1
- package/dest/validators/errors.js +7 -0
- package/dest/versioning/versioning.d.ts +4 -2
- package/dest/versioning/versioning.d.ts.map +1 -1
- package/dest/versioning/versioning.js +4 -1
- 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/package.json +10 -9
- package/src/abi/abi.ts +25 -2
- package/src/abi/buffer.ts +25 -4
- package/src/abi/decoder.ts +23 -78
- package/src/abi/function_selector.ts +1 -1
- package/src/abi/function_signature_decoder.ts +77 -0
- package/src/abi/index.ts +1 -0
- package/src/abi/selector.ts +1 -1
- package/src/avm/revert_code.ts +25 -39
- package/src/block/l2_block.ts +13 -1
- package/src/block/l2_block_source.ts +26 -9
- package/src/block/l2_block_stream/l2_tips_store_base.ts +24 -12
- package/src/block/test/l2_tips_store_test_suite.ts +8 -1
- package/src/checkpoint/checkpoint.ts +23 -4
- package/src/checkpoint/checkpoint_data.ts +40 -4
- package/src/checkpoint/index.ts +1 -0
- package/src/checkpoint/validate.ts +230 -0
- package/src/config/index.ts +1 -0
- package/src/config/pipelining-config.ts +31 -0
- package/src/config/sequencer-config.ts +2 -2
- package/src/contract/contract_address.ts +3 -3
- package/src/contract/contract_class_id.ts +2 -2
- package/src/contract/index.ts +0 -2
- package/src/contract/interfaces/contract_class.ts +2 -82
- package/src/epoch-helpers/index.ts +27 -0
- package/src/file-store/factory.ts +13 -4
- package/src/file-store/http.ts +29 -10
- package/src/file-store/index.ts +1 -0
- package/src/gas/README.md +123 -0
- package/src/gas/gas_settings.ts +65 -12
- package/src/ha-signing/config.ts +45 -38
- package/src/ha-signing/index.ts +9 -0
- package/src/ha-signing/local_config.ts +46 -0
- package/src/hash/hash.ts +34 -0
- package/src/interfaces/allowed_element.ts +28 -4
- package/src/interfaces/archiver.ts +6 -3
- package/src/interfaces/aztec-node-admin.ts +5 -7
- package/src/interfaces/aztec-node.ts +24 -5
- package/src/interfaces/block-builder.ts +56 -13
- package/src/interfaces/configs.ts +15 -4
- package/src/interfaces/l2_logs_source.ts +4 -1
- package/src/interfaces/merkle_tree_operations.ts +8 -18
- package/src/interfaces/prover-client.ts +8 -0
- package/src/interfaces/slasher.ts +0 -6
- package/src/interfaces/validator.ts +47 -33
- package/src/interfaces/world_state.ts +4 -3
- package/src/kernel/private_kernel_tail_circuit_public_inputs.ts +9 -0
- package/src/kv-store/config.ts +36 -0
- package/src/kv-store/index.ts +1 -0
- package/src/l1-contracts/index.ts +1 -1
- package/src/logs/extended_directional_app_tagging_secret.ts +19 -8
- package/src/logs/index.ts +1 -0
- package/src/logs/log_filter.ts +5 -0
- package/src/logs/message_context.ts +17 -7
- package/src/logs/pending_tagged_log.ts +1 -3
- package/src/logs/shared_secret_derivation.ts +21 -10
- package/src/logs/siloed_tag.ts +7 -2
- package/src/logs/tagging_index_range.ts +24 -0
- package/src/logs/tx_scoped_l2_log.ts +16 -0
- package/src/messaging/l1_to_l2_message.ts +12 -9
- package/src/messaging/l1_to_l2_message_source.ts +3 -1
- package/src/messaging/l2_to_l1_membership.ts +98 -33
- package/src/noir/index.ts +2 -2
- package/src/note/note_dao.ts +1 -4
- package/src/p2p/checkpoint_proposal.ts +8 -38
- package/src/p2p/peer_error.ts +7 -0
- package/src/proofs/chonk_proof.ts +91 -5
- 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} +22 -4
- package/src/tests/factories.ts +5 -34
- package/src/tests/mocks.ts +31 -18
- package/src/timetable/index.ts +7 -2
- package/src/tx/block_header.ts +6 -0
- package/src/tx/capsule.ts +10 -2
- package/src/tx/global_variable_builder.ts +15 -0
- package/src/tx/private_execution_result.ts +5 -5
- package/src/tx/profiling.ts +11 -2
- package/src/tx/simulated_tx.ts +5 -1
- package/src/tx/tx.ts +20 -11
- package/src/tx/tx_receipt.ts +18 -16
- package/src/tx/validator/error_texts.ts +11 -0
- package/src/update-checker/index.ts +2 -1
- package/src/update-checker/package_version.ts +30 -0
- package/src/update-checker/version_checker.ts +65 -0
- package/src/validators/errors.ts +9 -0
- package/src/versioning/versioning.ts +4 -1
- package/src/world-state/genesis_data.ts +15 -0
- package/src/world-state/index.ts +1 -0
- package/dest/contract/private_function_membership_proof.d.ts +0 -32
- package/dest/contract/private_function_membership_proof.d.ts.map +0 -1
- package/dest/contract/private_function_membership_proof.js +0 -124
- package/dest/contract/utility_function_membership_proof.d.ts +0 -27
- package/dest/contract/utility_function_membership_proof.d.ts.map +0 -1
- package/dest/contract/utility_function_membership_proof.js +0 -87
- 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/dest/slashing/tally.d.ts.map +0 -1
- package/dest/update-checker/update-checker.d.ts +0 -49
- package/dest/update-checker/update-checker.d.ts.map +0 -1
- package/dest/update-checker/update-checker.js +0 -130
- package/src/contract/private_function_membership_proof.ts +0 -167
- package/src/contract/utility_function_membership_proof.ts +0 -118
- package/src/l1-contracts/slash_factory.ts +0 -180
- package/src/slashing/empire.ts +0 -104
- package/src/update-checker/update-checker.ts +0 -166
|
@@ -42,18 +42,6 @@ export class CheckpointProposalHash extends Buffer32 {
|
|
|
42
42
|
get slotNumber() {
|
|
43
43
|
return this.checkpointHeader.slotNumber;
|
|
44
44
|
}
|
|
45
|
-
get blockNumber() {
|
|
46
|
-
if (!this.lastBlock) {
|
|
47
|
-
throw new Error('Cannot get blockNumber without lastBlock');
|
|
48
|
-
}
|
|
49
|
-
return this.lastBlock.blockHeader.getBlockNumber();
|
|
50
|
-
}
|
|
51
|
-
/** Convenience getter for txHashes from lastBlock */ get txHashes() {
|
|
52
|
-
return this.lastBlock?.txHashes ?? [];
|
|
53
|
-
}
|
|
54
|
-
/** Convenience getter for txs from lastBlock */ get txs() {
|
|
55
|
-
return this.lastBlock?.signedTxs?.txs;
|
|
56
|
-
}
|
|
57
45
|
/**
|
|
58
46
|
* Extract a BlockProposal from the last block info.
|
|
59
47
|
* Uses inHash from checkpointHeader.contentCommitment.inHash
|
|
@@ -95,27 +83,17 @@ export class CheckpointProposalHash extends Buffer32 {
|
|
|
95
83
|
serializeSignedBigInt(this.feeAssetPriceModifier)
|
|
96
84
|
]);
|
|
97
85
|
}
|
|
98
|
-
static async createProposalFromSigner(checkpointHeader, archiveRoot, feeAssetPriceModifier,
|
|
86
|
+
static async createProposalFromSigner(checkpointHeader, archiveRoot, feeAssetPriceModifier, lastBlockProposal, payloadSigner) {
|
|
99
87
|
// Sign the checkpoint payload with CHECKPOINT_PROPOSAL duty type
|
|
100
88
|
const tempProposal = new CheckpointProposal(checkpointHeader, archiveRoot, feeAssetPriceModifier, Signature.empty());
|
|
101
89
|
const checkpointHash = getHashedSignaturePayload(tempProposal, SignatureDomainSeparator.checkpointProposal);
|
|
102
90
|
const checkpointContext = {
|
|
103
91
|
slot: checkpointHeader.slotNumber,
|
|
104
|
-
blockNumber:
|
|
92
|
+
blockNumber: lastBlockProposal?.blockNumber ?? BlockNumber(0),
|
|
105
93
|
dutyType: DutyType.CHECKPOINT_PROPOSAL
|
|
106
94
|
};
|
|
107
95
|
const checkpointSignature = await payloadSigner(checkpointHash, checkpointContext);
|
|
108
|
-
|
|
109
|
-
return new CheckpointProposal(checkpointHeader, archiveRoot, feeAssetPriceModifier, checkpointSignature);
|
|
110
|
-
}
|
|
111
|
-
const lastBlockProposal = await BlockProposal.createProposalFromSigner(lastBlockInfo.blockHeader, lastBlockInfo.indexWithinCheckpoint, checkpointHeader.inHash, archiveRoot, lastBlockInfo.txHashes, lastBlockInfo.txs, payloadSigner);
|
|
112
|
-
return new CheckpointProposal(checkpointHeader, archiveRoot, feeAssetPriceModifier, checkpointSignature, {
|
|
113
|
-
blockHeader: lastBlockInfo.blockHeader,
|
|
114
|
-
indexWithinCheckpoint: lastBlockInfo.indexWithinCheckpoint,
|
|
115
|
-
txHashes: lastBlockInfo.txHashes,
|
|
116
|
-
signature: lastBlockProposal.signature,
|
|
117
|
-
signedTxs: lastBlockProposal.signedTxs
|
|
118
|
-
});
|
|
96
|
+
return new CheckpointProposal(checkpointHeader, archiveRoot, feeAssetPriceModifier, checkpointSignature, lastBlockProposal);
|
|
119
97
|
}
|
|
120
98
|
/**
|
|
121
99
|
* Lazily evaluate the sender of the proposal; result is cached.
|
package/dest/p2p/peer_error.d.ts
CHANGED
|
@@ -15,4 +15,6 @@ export declare enum PeerErrorSeverity {
|
|
|
15
15
|
*/
|
|
16
16
|
HighToleranceError = "HighToleranceError"
|
|
17
17
|
}
|
|
18
|
-
|
|
18
|
+
/** Severities ordered from mildest to harshest. */
|
|
19
|
+
export declare const PeerErrorSeverityByHarshness: readonly [PeerErrorSeverity.HighToleranceError, PeerErrorSeverity.MidToleranceError, PeerErrorSeverity.LowToleranceError];
|
|
20
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicGVlcl9lcnJvci5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3AycC9wZWVyX2Vycm9yLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLG9CQUFZLGlCQUFpQjtJQUMzQjs7O09BR0c7SUFDSCxpQkFBaUIsc0JBQXNCO0lBQ3ZDOzs7T0FHRztJQUNILGlCQUFpQixzQkFBc0I7SUFDdkM7OztPQUdHO0lBQ0gsa0JBQWtCLHVCQUF1QjtDQUMxQztBQUVELG1EQUFtRDtBQUNuRCxlQUFPLE1BQU0sNEJBQTRCLDJIQUkvQixDQUFDIn0=
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"peer_error.d.ts","sourceRoot":"","sources":["../../src/p2p/peer_error.ts"],"names":[],"mappings":"AAAA,oBAAY,iBAAiB;IAC3B;;;OAGG;IACH,iBAAiB,sBAAsB;IACvC;;;OAGG;IACH,iBAAiB,sBAAsB;IACvC;;;OAGG;IACH,kBAAkB,uBAAuB;CAC1C"}
|
|
1
|
+
{"version":3,"file":"peer_error.d.ts","sourceRoot":"","sources":["../../src/p2p/peer_error.ts"],"names":[],"mappings":"AAAA,oBAAY,iBAAiB;IAC3B;;;OAGG;IACH,iBAAiB,sBAAsB;IACvC;;;OAGG;IACH,iBAAiB,sBAAsB;IACvC;;;OAGG;IACH,kBAAkB,uBAAuB;CAC1C;AAED,mDAAmD;AACnD,eAAO,MAAM,4BAA4B,2HAI/B,CAAC"}
|
package/dest/p2p/peer_error.js
CHANGED
|
@@ -13,3 +13,8 @@ export var PeerErrorSeverity = /*#__PURE__*/ function(PeerErrorSeverity) {
|
|
|
13
13
|
*/ PeerErrorSeverity["HighToleranceError"] = "HighToleranceError";
|
|
14
14
|
return PeerErrorSeverity;
|
|
15
15
|
}({});
|
|
16
|
+
/** Severities ordered from mildest to harshest. */ export const PeerErrorSeverityByHarshness = [
|
|
17
|
+
"HighToleranceError",
|
|
18
|
+
"MidToleranceError",
|
|
19
|
+
"LowToleranceError"
|
|
20
|
+
];
|
|
@@ -1,19 +1,63 @@
|
|
|
1
1
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
2
|
import { BufferReader } from '@aztec/foundation/serialize';
|
|
3
|
+
/**
|
|
4
|
+
* Serialization format detection for ChonkProof is size-based:
|
|
5
|
+
* - UNCOMPRESSED (legacy): [field_count=1632: uint32] [fields...] → total ≈ 52KB (>= 40KB)
|
|
6
|
+
* - COMPRESSED: [byte_count: uint32] [compressed_bytes] → total ≈ 35KB (< 40KB)
|
|
7
|
+
*
|
|
8
|
+
* Detection: if the first uint32 equals CHONK_PROOF_LENGTH (1632), it's legacy format
|
|
9
|
+
* (field count). Otherwise, it's compressed format (byte count). The old uncompressed
|
|
10
|
+
* format is never smaller than 40KB; compressed proofs are always smaller than 40KB.
|
|
11
|
+
*/
|
|
3
12
|
export declare class ChonkProof {
|
|
4
13
|
fields: Fr[];
|
|
5
|
-
|
|
14
|
+
/**
|
|
15
|
+
* Optional compressed proof bytes from chonk compression (point compression + u256 encoding).
|
|
16
|
+
* When set, toBuffer() will serialize in compressed format (~1.7x smaller).
|
|
17
|
+
* When reading from compressed format, this is populated and fields are decompressed on demand.
|
|
18
|
+
*/
|
|
19
|
+
compressedProof?: Buffer;
|
|
20
|
+
constructor(fields: Fr[], compressedProof?: Buffer);
|
|
6
21
|
attachPublicInputs(publicInputs: Fr[]): ChonkProofWithPublicInputs;
|
|
7
22
|
isEmpty(): boolean;
|
|
8
23
|
static empty(): ChonkProof;
|
|
9
24
|
static random(): ChonkProof;
|
|
10
25
|
static get schema(): import("zod").ZodType<ChonkProof, any, string>;
|
|
11
26
|
toJSON(): Buffer<ArrayBufferLike>;
|
|
27
|
+
/**
|
|
28
|
+
* Deserialize a ChonkProof from a buffer.
|
|
29
|
+
* Supports both legacy (field elements) and compressed (chonk compression) formats.
|
|
30
|
+
*
|
|
31
|
+
* Size-based format detection:
|
|
32
|
+
* - First uint32 == CHONK_PROOF_LENGTH (1632): legacy format, read field elements
|
|
33
|
+
* Total proof data ≈ 52KB (always >= 40KB)
|
|
34
|
+
* - Otherwise: compressed format, first uint32 is byte count of compressed data
|
|
35
|
+
* Total proof data ≈ 35KB (always < 40KB)
|
|
36
|
+
*/
|
|
12
37
|
static fromBuffer(buffer: Buffer | BufferReader): ChonkProof;
|
|
38
|
+
/**
|
|
39
|
+
* Create a ChonkProof from compressed bytes by decompressing via the BarretenbergSync API.
|
|
40
|
+
* The compressed format uses point compression and u256 encoding (from PR #20645).
|
|
41
|
+
*
|
|
42
|
+
* @param compressed - Compressed proof bytes from chonk compression
|
|
43
|
+
* @returns ChonkProof with both fields and compressed bytes populated
|
|
44
|
+
*/
|
|
45
|
+
static fromCompressedBytes(compressed: Buffer): ChonkProof;
|
|
46
|
+
/**
|
|
47
|
+
* Serialize the proof to a buffer.
|
|
48
|
+
* If compressed bytes are available, uses the compressed format (~1.7x smaller).
|
|
49
|
+
* Otherwise falls back to legacy field element format.
|
|
50
|
+
*/
|
|
13
51
|
toBuffer(): Buffer<ArrayBufferLike>;
|
|
14
52
|
}
|
|
15
53
|
export declare class ChonkProofWithPublicInputs {
|
|
16
54
|
fieldsWithPublicInputs: Fr[];
|
|
55
|
+
/**
|
|
56
|
+
* Optional compressed proof bytes (covers the full proof WITH public inputs).
|
|
57
|
+
* Set by the prover when using chonk compression. Flows through to ChonkProof
|
|
58
|
+
* via removePublicInputs() so the Tx can serialize in compressed format.
|
|
59
|
+
*/
|
|
60
|
+
compressedProof?: Buffer;
|
|
17
61
|
constructor(fieldsWithPublicInputs: Fr[]);
|
|
18
62
|
getPublicInputs(): Fr[];
|
|
19
63
|
removePublicInputs(): ChonkProof;
|
|
@@ -25,4 +69,4 @@ export declare class ChonkProofWithPublicInputs {
|
|
|
25
69
|
toBuffer(): Buffer<ArrayBufferLike>;
|
|
26
70
|
static fromBufferArray(fields: Uint8Array[]): ChonkProofWithPublicInputs;
|
|
27
71
|
}
|
|
28
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
72
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2hvbmtfcHJvb2YuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9wcm9vZnMvY2hvbmtfcHJvb2YudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBSUEsT0FBTyxFQUFFLEVBQUUsRUFBRSxNQU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0lBRUQsTUFBTSxLQUFLLE1BQU0sbUVBRWhCO0lBR0QsTUFBTSw0QkFFTDtJQUVELE1BQU0sQ0FBQyxVQUFVLENBQUMsTUFBTSxFQUFFLE1BQU0sR0FBRyxZQUFZLEdBQUcsMEJBQTBCLENBSzNFO0lBRU0sUUFBUSw0QkFFZDtJQUdELE1BQU0sQ0FBQyxlQUFlLENBQUMsTUFBTSxFQUFFLFVBQVUsRUFBRSxHQUFHLDBCQUEwQixDQUd2RTtDQUNGIn0=
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chonk_proof.d.ts","sourceRoot":"","sources":["../../src/proofs/chonk_proof.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"chonk_proof.d.ts","sourceRoot":"","sources":["../../src/proofs/chonk_proof.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AAEpD,OAAO,EAAE,YAAY,EAAoC,MAAM,6BAA6B,CAAC;AAE7F;;;;;;;;GAQG;AAGH,qBAAa,UAAU;IAYZ,MAAM,EAAE,EAAE,EAAE;IAXrB;;;;OAIG;IACI,eAAe,CAAC,EAAE,MAAM,CAAC;IAEhC,YAIS,MAAM,EAAE,EAAE,EAAE,EACnB,eAAe,CAAC,EAAE,MAAM,EAMzB;IAEM,kBAAkB,CAAC,YAAY,EAAE,EAAE,EAAE,8BAE3C;IAEM,OAAO,YAEb;IAED,MAAM,CAAC,KAAK,eAEX;IAED,MAAM,CAAC,MAAM,eAYZ;IAED,MAAM,KAAK,MAAM,mDAEhB;IAGD,MAAM,4BAEL;IAED;;;;;;;;;OASG;IACH,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY,GAAG,UAAU,CAgB3D;IAED;;;;;;OAMG;IACH,MAAM,CAAC,mBAAmB,CAAC,UAAU,EAAE,MAAM,GAAG,UAAU,CAkBzD;IAED;;;;OAIG;IACI,QAAQ,4BAOd;CACF;AAED,qBAAa,0BAA0B;IAW5B,sBAAsB,EAAE,EAAE,EAAE;IAVrC;;;;OAIG;IACI,eAAe,CAAC,EAAE,MAAM,CAAC;IAEhC,YAGS,sBAAsB,EAAE,EAAE,EAAE,EAKpC;IAEM,eAAe,SAGrB;IAEM,kBAAkB,eAIxB;IAEM,OAAO,YAEb;IAED,MAAM,CAAC,KAAK,+BAEX;IAED,MAAM,KAAK,MAAM,mEAEhB;IAGD,MAAM,4BAEL;IAED,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY,GAAG,0BAA0B,CAK3E;IAEM,QAAQ,4BAEd;IAGD,MAAM,CAAC,eAAe,CAAC,MAAM,EAAE,UAAU,EAAE,GAAG,0BAA0B,CAGvE;CACF"}
|
|
@@ -1,20 +1,35 @@
|
|
|
1
|
+
import { BarretenbergSync, flattenChonkProofFields } from '@aztec/bb.js';
|
|
1
2
|
import { CHONK_PROOF_LENGTH } from '@aztec/constants';
|
|
2
3
|
import { times } from '@aztec/foundation/collection';
|
|
3
4
|
import { randomBytes } from '@aztec/foundation/crypto/random';
|
|
4
5
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
5
6
|
import { bufferSchemaFor } from '@aztec/foundation/schemas';
|
|
6
|
-
import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
7
|
-
|
|
7
|
+
import { BufferReader, numToUInt32BE, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
8
|
+
/**
|
|
9
|
+
* Serialization format detection for ChonkProof is size-based:
|
|
10
|
+
* - UNCOMPRESSED (legacy): [field_count=1632: uint32] [fields...] → total ≈ 52KB (>= 40KB)
|
|
11
|
+
* - COMPRESSED: [byte_count: uint32] [compressed_bytes] → total ≈ 35KB (< 40KB)
|
|
12
|
+
*
|
|
13
|
+
* Detection: if the first uint32 equals CHONK_PROOF_LENGTH (1632), it's legacy format
|
|
14
|
+
* (field count). Otherwise, it's compressed format (byte count). The old uncompressed
|
|
15
|
+
* format is never smaller than 40KB; compressed proofs are always smaller than 40KB.
|
|
16
|
+
*/ // CHONK: "Client Honk" - An UltraHonk variant with incremental folding and delayed non-native arithmetic.
|
|
8
17
|
export class ChonkProof {
|
|
9
18
|
fields;
|
|
19
|
+
/**
|
|
20
|
+
* Optional compressed proof bytes from chonk compression (point compression + u256 encoding).
|
|
21
|
+
* When set, toBuffer() will serialize in compressed format (~1.7x smaller).
|
|
22
|
+
* When reading from compressed format, this is populated and fields are decompressed on demand.
|
|
23
|
+
*/ compressedProof;
|
|
10
24
|
constructor(// The proof fields.
|
|
11
25
|
// For native verification, attach public inputs via `attachPublicInputs(publicInputs)`.
|
|
12
26
|
// Not using Tuple here due to the length being too high.
|
|
13
|
-
fields){
|
|
27
|
+
fields, compressedProof){
|
|
14
28
|
this.fields = fields;
|
|
15
29
|
if (fields.length !== CHONK_PROOF_LENGTH) {
|
|
16
30
|
throw new Error(`Invalid ChonkProof length: ${fields.length}`);
|
|
17
31
|
}
|
|
32
|
+
this.compressedProof = compressedProof;
|
|
18
33
|
}
|
|
19
34
|
attachPublicInputs(publicInputs) {
|
|
20
35
|
return new ChonkProofWithPublicInputs([
|
|
@@ -48,18 +63,77 @@ export class ChonkProof {
|
|
|
48
63
|
toJSON() {
|
|
49
64
|
return this.toBuffer();
|
|
50
65
|
}
|
|
51
|
-
|
|
66
|
+
/**
|
|
67
|
+
* Deserialize a ChonkProof from a buffer.
|
|
68
|
+
* Supports both legacy (field elements) and compressed (chonk compression) formats.
|
|
69
|
+
*
|
|
70
|
+
* Size-based format detection:
|
|
71
|
+
* - First uint32 == CHONK_PROOF_LENGTH (1632): legacy format, read field elements
|
|
72
|
+
* Total proof data ≈ 52KB (always >= 40KB)
|
|
73
|
+
* - Otherwise: compressed format, first uint32 is byte count of compressed data
|
|
74
|
+
* Total proof data ≈ 35KB (always < 40KB)
|
|
75
|
+
*/ static fromBuffer(buffer) {
|
|
52
76
|
const reader = BufferReader.asReader(buffer);
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
77
|
+
const firstUint32 = reader.readNumber();
|
|
78
|
+
if (firstUint32 === CHONK_PROOF_LENGTH) {
|
|
79
|
+
// Legacy format: firstUint32 is the field count (1632)
|
|
80
|
+
// Widen to `number` to prevent TS from narrowing to literal 1632,
|
|
81
|
+
// which would cause Tuple<Fr, 1632> to exceed the recursion limit.
|
|
82
|
+
const fieldCount = firstUint32;
|
|
83
|
+
const proof = reader.readArray(fieldCount, Fr);
|
|
84
|
+
return new ChonkProof(proof);
|
|
85
|
+
}
|
|
86
|
+
// Compressed format: firstUint32 is the compressed byte count
|
|
87
|
+
const compressedBytes = reader.readBytes(firstUint32);
|
|
88
|
+
return ChonkProof.fromCompressedBytes(Buffer.from(compressedBytes));
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Create a ChonkProof from compressed bytes by decompressing via the BarretenbergSync API.
|
|
92
|
+
* The compressed format uses point compression and u256 encoding (from PR #20645).
|
|
93
|
+
*
|
|
94
|
+
* @param compressed - Compressed proof bytes from chonk compression
|
|
95
|
+
* @returns ChonkProof with both fields and compressed bytes populated
|
|
96
|
+
*/ static fromCompressedBytes(compressed) {
|
|
97
|
+
const api = BarretenbergSync.getSingleton();
|
|
98
|
+
const result = api.chonkDecompressProof({
|
|
99
|
+
compressedProof: new Uint8Array(compressed)
|
|
100
|
+
});
|
|
101
|
+
// Flatten the structured bb.js ChonkProof into flat Fr[] field elements
|
|
102
|
+
const flatFields = flattenChonkProofFields(result.proof);
|
|
103
|
+
const fields = flatFields.map((f)=>Fr.fromBuffer(Buffer.from(f)));
|
|
104
|
+
// The decompressed proof includes public inputs in hidingOinkProof.
|
|
105
|
+
// Since ChonkProof stores fields WITHOUT public inputs, strip them.
|
|
106
|
+
// The number of public inputs = total fields - CHONK_PROOF_LENGTH
|
|
107
|
+
if (fields.length > CHONK_PROOF_LENGTH) {
|
|
108
|
+
const numPubInputs = fields.length - CHONK_PROOF_LENGTH;
|
|
109
|
+
const proofFields = fields.slice(numPubInputs);
|
|
110
|
+
return new ChonkProof(proofFields, compressed);
|
|
111
|
+
}
|
|
112
|
+
return new ChonkProof(fields, compressed);
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Serialize the proof to a buffer.
|
|
116
|
+
* If compressed bytes are available, uses the compressed format (~1.7x smaller).
|
|
117
|
+
* Otherwise falls back to legacy field element format.
|
|
118
|
+
*/ toBuffer() {
|
|
119
|
+
if (this.compressedProof) {
|
|
120
|
+
// Compressed format: [compressed_byte_count: uint32] [compressed_bytes]
|
|
121
|
+
return Buffer.concat([
|
|
122
|
+
numToUInt32BE(this.compressedProof.length),
|
|
123
|
+
this.compressedProof
|
|
124
|
+
]);
|
|
125
|
+
}
|
|
126
|
+
// Legacy format: [field_count=1632: uint32] [fields...]
|
|
58
127
|
return serializeToBuffer(this.fields.length, this.fields);
|
|
59
128
|
}
|
|
60
129
|
}
|
|
61
130
|
export class ChonkProofWithPublicInputs {
|
|
62
131
|
fieldsWithPublicInputs;
|
|
132
|
+
/**
|
|
133
|
+
* Optional compressed proof bytes (covers the full proof WITH public inputs).
|
|
134
|
+
* Set by the prover when using chonk compression. Flows through to ChonkProof
|
|
135
|
+
* via removePublicInputs() so the Tx can serialize in compressed format.
|
|
136
|
+
*/ compressedProof;
|
|
63
137
|
constructor(// The proof fields with public inputs.
|
|
64
138
|
// For recursive verification, use without public inputs via `removePublicInputs()`.
|
|
65
139
|
fieldsWithPublicInputs){
|
|
@@ -74,7 +148,8 @@ export class ChonkProofWithPublicInputs {
|
|
|
74
148
|
}
|
|
75
149
|
removePublicInputs() {
|
|
76
150
|
const numPublicInputs = this.fieldsWithPublicInputs.length - CHONK_PROOF_LENGTH;
|
|
77
|
-
|
|
151
|
+
// Flow compressed proof bytes through so the ChonkProof can serialize efficiently
|
|
152
|
+
return new ChonkProof(this.fieldsWithPublicInputs.slice(numPublicInputs), this.compressedProof);
|
|
78
153
|
}
|
|
79
154
|
isEmpty() {
|
|
80
155
|
return this.fieldsWithPublicInputs.every((field)=>field.isZero());
|
package/dest/slashing/index.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
export * from './types.js';
|
|
2
2
|
export * from './interfaces.js';
|
|
3
3
|
export * from './helpers.js';
|
|
4
|
-
export * from './
|
|
5
|
-
export * from './tally.js';
|
|
4
|
+
export * from './votes.js';
|
|
6
5
|
export * from './serialization.js';
|
|
7
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
6
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9zbGFzaGluZy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxjQUFjLFlBQVksQ0FBQztBQUMzQixjQUFjLGlCQUFpQixDQUFDO0FBQ2hDLGNBQWMsY0FBYyxDQUFDO0FBQzdCLGNBQWMsWUFBWSxDQUFDO0FBQzNCLGNBQWMsb0JBQW9CLENBQUMifQ==
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/slashing/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/slashing/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,oBAAoB,CAAC"}
|
package/dest/slashing/index.js
CHANGED
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
import type { Offense
|
|
1
|
+
import type { Offense } from './types.js';
|
|
2
2
|
export declare function serializeOffense(offense: Offense): Buffer;
|
|
3
3
|
export declare function deserializeOffense(buffer: Buffer): Offense;
|
|
4
|
-
|
|
5
|
-
export declare function deserializeSlashPayload(buffer: Buffer): SlashPayload;
|
|
6
|
-
export declare function serializeSlashPayloadRound(payload: SlashPayloadRound): Buffer;
|
|
7
|
-
export declare function deserializeSlashPayloadRound(buffer: Buffer): SlashPayloadRound;
|
|
8
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2VyaWFsaXphdGlvbi5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3NsYXNoaW5nL3NlcmlhbGl6YXRpb24udHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBSUEsT0FBTyxLQUFLLEVBQ1YsT0FBTyxFQUVQLFlBQVksRUFDWixpQkFBaUIsRUFHbEIsTUFBTSxZQUFZLENBQUM7QUFFcEIsd0JBQWdCLGdCQUFnQixDQUFDLE9BQU8sRUFBRSxPQUFPLEdBQUcsTUFBTSxDQU96RDtBQUVELHdCQUFnQixrQkFBa0IsQ0FBQyxNQUFNLEVBQUUsTUFBTSxHQUFHLE9BQU8sQ0FRMUQ7QUFpQ0Qsd0JBQWdCLHFCQUFxQixDQUFDLE9BQU8sRUFBRSxZQUFZLEdBQUcsTUFBTSxDQU9uRTtBQUVELHdCQUFnQix1QkFBdUIsQ0FBQyxNQUFNLEVBQUUsTUFBTSxHQUFHLFlBQVksQ0FPcEU7QUFFRCx3QkFBZ0IsMEJBQTBCLENBQUMsT0FBTyxFQUFFLGlCQUFpQixHQUFHLE1BQU0sQ0FTN0U7QUFFRCx3QkFBZ0IsNEJBQTRCLENBQUMsTUFBTSxFQUFFLE1BQU0sR0FBRyxpQkFBaUIsQ0FVOUUifQ==
|
|
4
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2VyaWFsaXphdGlvbi5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3NsYXNoaW5nL3NlcmlhbGl6YXRpb24udHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBR0EsT0FBTyxLQUFLLEVBQUUsT0FBTyxFQUFlLE1BQU0sWUFBWSxDQUFDO0FBRXZELHdCQUFnQixnQkFBZ0IsQ0FBQyxPQUFPLEVBQUUsT0FBTyxHQUFHLE1BQU0sQ0FPekQ7QUFFRCx3QkFBZ0Isa0JBQWtCLENBQUMsTUFBTSxFQUFFLE1BQU0sR0FBRyxPQUFPLENBUTFEIn0=
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serialization.d.ts","sourceRoot":"","sources":["../../src/slashing/serialization.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"serialization.d.ts","sourceRoot":"","sources":["../../src/slashing/serialization.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAe,MAAM,YAAY,CAAC;AAEvD,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,CAOzD;AAED,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAQ1D"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { times } from '@aztec/foundation/collection';
|
|
2
1
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
3
2
|
import { BufferReader, bigintToUInt64BE, bigintToUInt128BE, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
4
3
|
export function serializeOffense(offense) {
|
|
@@ -17,62 +16,3 @@ export function deserializeOffense(buffer) {
|
|
|
17
16
|
epochOrSlot
|
|
18
17
|
};
|
|
19
18
|
}
|
|
20
|
-
function serializeValidatorSlashOffense(offense) {
|
|
21
|
-
return serializeToBuffer(bigintToUInt64BE(offense.epochOrSlot), offense.offenseType);
|
|
22
|
-
}
|
|
23
|
-
function deserializeValidatorSlashOffense(buffer) {
|
|
24
|
-
const reader = BufferReader.asReader(buffer);
|
|
25
|
-
return {
|
|
26
|
-
epochOrSlot: reader.readUInt64(),
|
|
27
|
-
offenseType: reader.readNumber()
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
function serializeValidatorSlash(slash) {
|
|
31
|
-
return serializeToBuffer(slash.validator, bigintToUInt128BE(slash.amount), slash.offenses.length, slash.offenses.map(serializeValidatorSlashOffense));
|
|
32
|
-
}
|
|
33
|
-
function deserializeValidatorSlash(buffer) {
|
|
34
|
-
const reader = BufferReader.asReader(buffer);
|
|
35
|
-
const validator = reader.readObject(EthAddress);
|
|
36
|
-
const amount = reader.readUInt128();
|
|
37
|
-
const offensesCount = reader.readNumber();
|
|
38
|
-
const offenses = times(offensesCount, ()=>deserializeValidatorSlashOffense(reader));
|
|
39
|
-
return {
|
|
40
|
-
validator,
|
|
41
|
-
amount,
|
|
42
|
-
offenses
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
export function serializeSlashPayload(payload) {
|
|
46
|
-
return serializeToBuffer(payload.address, payload.slashes.length, payload.slashes.map(serializeValidatorSlash), bigintToUInt64BE(payload.timestamp));
|
|
47
|
-
}
|
|
48
|
-
export function deserializeSlashPayload(buffer) {
|
|
49
|
-
const reader = BufferReader.asReader(buffer);
|
|
50
|
-
const address = reader.readObject(EthAddress);
|
|
51
|
-
const slashesCount = reader.readNumber();
|
|
52
|
-
const slashes = times(slashesCount, ()=>deserializeValidatorSlash(reader));
|
|
53
|
-
const timestamp = reader.readUInt64();
|
|
54
|
-
return {
|
|
55
|
-
address,
|
|
56
|
-
slashes,
|
|
57
|
-
timestamp
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
export function serializeSlashPayloadRound(payload) {
|
|
61
|
-
return serializeToBuffer(payload.address, payload.slashes.length, payload.slashes.map(serializeValidatorSlash), bigintToUInt64BE(payload.timestamp), Number(payload.votes), bigintToUInt64BE(payload.round));
|
|
62
|
-
}
|
|
63
|
-
export function deserializeSlashPayloadRound(buffer) {
|
|
64
|
-
const reader = BufferReader.asReader(buffer);
|
|
65
|
-
const address = reader.readObject(EthAddress);
|
|
66
|
-
const slashesCount = reader.readNumber();
|
|
67
|
-
const slashes = times(slashesCount, ()=>deserializeValidatorSlash(reader));
|
|
68
|
-
const timestamp = reader.readUInt64();
|
|
69
|
-
const votes = BigInt(reader.readNumber());
|
|
70
|
-
const round = reader.readUInt64();
|
|
71
|
-
return {
|
|
72
|
-
address,
|
|
73
|
-
slashes,
|
|
74
|
-
timestamp,
|
|
75
|
-
votes,
|
|
76
|
-
round
|
|
77
|
-
};
|
|
78
|
-
}
|
package/dest/slashing/types.d.ts
CHANGED
|
@@ -59,107 +59,21 @@ export type ValidatorSlash = {
|
|
|
59
59
|
amount: bigint;
|
|
60
60
|
offenses: ValidatorSlashOffense[];
|
|
61
61
|
};
|
|
62
|
-
/**
|
|
63
|
-
export type SlashPayload = {
|
|
64
|
-
address: EthAddress;
|
|
65
|
-
slashes: ValidatorSlash[];
|
|
66
|
-
timestamp: bigint;
|
|
67
|
-
};
|
|
68
|
-
/** Slash payload with round information from empire slash proposer */
|
|
69
|
-
export type SlashPayloadRound = SlashPayload & {
|
|
70
|
-
votes: bigint;
|
|
71
|
-
round: bigint;
|
|
72
|
-
};
|
|
73
|
-
export declare const SlashPayloadRoundSchema: z.ZodObject<{
|
|
74
|
-
address: import("../schemas/index.js").ZodFor<EthAddress>;
|
|
75
|
-
timestamp: z.ZodPipeline<z.ZodUnion<[z.ZodBigInt, z.ZodNumber, z.ZodString]>, z.ZodBigInt>;
|
|
76
|
-
votes: z.ZodPipeline<z.ZodUnion<[z.ZodBigInt, z.ZodNumber, z.ZodString]>, z.ZodBigInt>;
|
|
77
|
-
round: z.ZodPipeline<z.ZodUnion<[z.ZodBigInt, z.ZodNumber, z.ZodString]>, z.ZodBigInt>;
|
|
78
|
-
slashes: z.ZodArray<z.ZodObject<{
|
|
79
|
-
validator: import("../schemas/index.js").ZodFor<EthAddress>;
|
|
80
|
-
amount: z.ZodPipeline<z.ZodUnion<[z.ZodBigInt, z.ZodNumber, z.ZodString]>, z.ZodBigInt>;
|
|
81
|
-
offenses: z.ZodArray<z.ZodObject<{
|
|
82
|
-
offenseType: z.ZodNativeEnum<typeof OffenseType>;
|
|
83
|
-
epochOrSlot: z.ZodPipeline<z.ZodUnion<[z.ZodBigInt, z.ZodNumber, z.ZodString]>, z.ZodBigInt>;
|
|
84
|
-
}, "strip", z.ZodTypeAny, {
|
|
85
|
-
offenseType: OffenseType;
|
|
86
|
-
epochOrSlot: bigint;
|
|
87
|
-
}, {
|
|
88
|
-
offenseType: OffenseType;
|
|
89
|
-
epochOrSlot: string | number | bigint;
|
|
90
|
-
}>, "many">;
|
|
91
|
-
}, "strip", z.ZodTypeAny, {
|
|
92
|
-
validator: EthAddress;
|
|
93
|
-
amount: bigint;
|
|
94
|
-
offenses: {
|
|
95
|
-
offenseType: OffenseType;
|
|
96
|
-
epochOrSlot: bigint;
|
|
97
|
-
}[];
|
|
98
|
-
}, {
|
|
99
|
-
validator?: any;
|
|
100
|
-
amount: string | number | bigint;
|
|
101
|
-
offenses: {
|
|
102
|
-
offenseType: OffenseType;
|
|
103
|
-
epochOrSlot: string | number | bigint;
|
|
104
|
-
}[];
|
|
105
|
-
}>, "many">;
|
|
106
|
-
}, "strip", z.ZodTypeAny, {
|
|
107
|
-
address: EthAddress;
|
|
108
|
-
timestamp: bigint;
|
|
109
|
-
votes: bigint;
|
|
110
|
-
round: bigint;
|
|
111
|
-
slashes: {
|
|
112
|
-
validator: EthAddress;
|
|
113
|
-
amount: bigint;
|
|
114
|
-
offenses: {
|
|
115
|
-
offenseType: OffenseType;
|
|
116
|
-
epochOrSlot: bigint;
|
|
117
|
-
}[];
|
|
118
|
-
}[];
|
|
119
|
-
}, {
|
|
120
|
-
address?: any;
|
|
121
|
-
timestamp: string | number | bigint;
|
|
122
|
-
votes: string | number | bigint;
|
|
123
|
-
round: string | number | bigint;
|
|
124
|
-
slashes: {
|
|
125
|
-
validator?: any;
|
|
126
|
-
amount: string | number | bigint;
|
|
127
|
-
offenses: {
|
|
128
|
-
offenseType: OffenseType;
|
|
129
|
-
epochOrSlot: string | number | bigint;
|
|
130
|
-
}[];
|
|
131
|
-
}[];
|
|
132
|
-
}>;
|
|
133
|
-
/** Votes for a validator slash in the consensus slash proposer */
|
|
62
|
+
/** Votes for a validator slash in the slashing proposer */
|
|
134
63
|
export type ValidatorSlashVote = number;
|
|
135
64
|
export type ProposerSlashAction =
|
|
136
|
-
/**
|
|
65
|
+
/** Vote for offenses on the slashing proposer */
|
|
137
66
|
{
|
|
138
|
-
type: 'create-empire-payload';
|
|
139
|
-
data: ValidatorSlash[];
|
|
140
|
-
}
|
|
141
|
-
/** Vote for a slashing payload on an empire-based slash proposer */
|
|
142
|
-
| {
|
|
143
|
-
type: 'vote-empire-payload';
|
|
144
|
-
payload: EthAddress;
|
|
145
|
-
}
|
|
146
|
-
/** Execute a slashing payload on an empire-based slash proposer */
|
|
147
|
-
| {
|
|
148
|
-
type: 'execute-empire-payload';
|
|
149
|
-
round: bigint;
|
|
150
|
-
}
|
|
151
|
-
/** Vote for offenses on a consensus slashing proposer */
|
|
152
|
-
| {
|
|
153
67
|
type: 'vote-offenses';
|
|
154
68
|
votes: ValidatorSlashVote[];
|
|
155
69
|
committees: EthAddress[][];
|
|
156
70
|
round: bigint;
|
|
157
71
|
}
|
|
158
|
-
/** Execute a slashing round on
|
|
72
|
+
/** Execute a slashing round on the slashing proposer */
|
|
159
73
|
| {
|
|
160
74
|
type: 'execute-slash';
|
|
161
75
|
committees: EthAddress[][];
|
|
162
76
|
round: bigint;
|
|
163
77
|
};
|
|
164
78
|
export type ProposerSlashActionType = ProposerSlashAction['type'];
|
|
165
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
79
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHlwZXMuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9zbGFzaGluZy90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C,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,WAAW,CAAC;CAC1B,CAAC;AAEF,yFAAyF;AACzF,MAAM,MAAM,cAAc,GAAG;IAC3B,SAAS,EAAE,UAAU,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,qBAAqB,EAAE,CAAC;CACnC,CAAC;AAEF,2DAA2D;AAC3D,MAAM,MAAM,kBAAkB,GAAG,MAAM,CAAC;AAExC,MAAM,MAAM,mBAAmB;AAC7B,iDAAiD;AAC/C;IAAE,IAAI,EAAE,eAAe,CAAC;IAAC,KAAK,EAAE,kBAAkB,EAAE,CAAC;IAAC,UAAU,EAAE,UAAU,EAAE,EAAE,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE;AACnG,wDAAwD;GACtD;IAAE,IAAI,EAAE,eAAe,CAAC;IAAC,UAAU,EAAE,UAAU,EAAE,EAAE,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAEzE,MAAM,MAAM,uBAAuB,GAAG,mBAAmB,CAAC,MAAM,CAAC,CAAC"}
|
package/dest/slashing/types.js
CHANGED
|
@@ -84,17 +84,3 @@ export const OffenseSchema = zodFor()(z.object({
|
|
|
84
84
|
offenseType: OffenseTypeSchema,
|
|
85
85
|
epochOrSlot: schemas.BigInt
|
|
86
86
|
}));
|
|
87
|
-
export const SlashPayloadRoundSchema = zodFor()(z.object({
|
|
88
|
-
address: schemas.EthAddress,
|
|
89
|
-
timestamp: schemas.BigInt,
|
|
90
|
-
votes: schemas.BigInt,
|
|
91
|
-
round: schemas.BigInt,
|
|
92
|
-
slashes: z.array(z.object({
|
|
93
|
-
validator: schemas.EthAddress,
|
|
94
|
-
amount: schemas.BigInt,
|
|
95
|
-
offenses: z.array(z.object({
|
|
96
|
-
offenseType: OffenseTypeSchema,
|
|
97
|
-
epochOrSlot: schemas.BigInt
|
|
98
|
-
}))
|
|
99
|
-
}))
|
|
100
|
-
}));
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
2
|
+
import { type Logger } from '@aztec/foundation/log';
|
|
2
3
|
import type { PartialBy } from '@aztec/foundation/types';
|
|
3
4
|
import type { Offense, ValidatorSlashVote } from './types.js';
|
|
4
5
|
/**
|
|
@@ -8,7 +9,8 @@ import type { Offense, ValidatorSlashVote } from './types.js';
|
|
|
8
9
|
* @param epochsForCommittees - Array of epochs corresponding to each committee
|
|
9
10
|
* @param settings - Settings including slashingAmounts and optional validator override lists
|
|
10
11
|
* @param settings.maxSlashedValidators - If set, limits the total number of [validator, epoch] pairs
|
|
11
|
-
* with non-zero votes.
|
|
12
|
+
* with non-zero votes. The lowest-vote pairs are zeroed out to stay within the limit.
|
|
13
|
+
* @param logger - Logger, logs which validators were dropped.
|
|
12
14
|
* @returns Array of ValidatorSlashVote, where each vote is how many slash units the validator in that position should be slashed
|
|
13
15
|
*/
|
|
14
16
|
export declare function getSlashConsensusVotesFromOffenses(offenses: PartialBy<Offense, 'epochOrSlot'>[], committees: EthAddress[][], epochsForCommittees: bigint[], settings: {
|
|
@@ -16,10 +18,7 @@ export declare function getSlashConsensusVotesFromOffenses(offenses: PartialBy<O
|
|
|
16
18
|
epochDuration: number;
|
|
17
19
|
targetCommitteeSize: number;
|
|
18
20
|
maxSlashedValidators?: number;
|
|
19
|
-
}):
|
|
20
|
-
votes: ValidatorSlashVote[];
|
|
21
|
-
truncatedCount: number;
|
|
22
|
-
};
|
|
21
|
+
}, logger?: Logger): ValidatorSlashVote[];
|
|
23
22
|
/**
|
|
24
23
|
* Encodes a set of slash votes into a Buffer for use in a consensus slashing vote transaction.
|
|
25
24
|
* Each vote is represented as a 2-bit value, which represents how many slashing units the validator should be slashed.
|
|
@@ -27,4 +26,4 @@ export declare function getSlashConsensusVotesFromOffenses(offenses: PartialBy<O
|
|
|
27
26
|
* @returns A Buffer containing the encoded slash votes
|
|
28
27
|
*/
|
|
29
28
|
export declare function encodeSlashCon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