@aztec/stdlib 0.0.1-commit.6c91f13 → 0.0.1-commit.7d4e6cd
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/contract_artifact.d.ts +2 -2
- package/dest/abi/contract_artifact.d.ts.map +1 -1
- package/dest/abi/contract_artifact.js +1 -1
- package/dest/abi/selector.js +3 -1
- package/dest/avm/avm_accumulated_data.js +5 -2
- package/dest/avm/avm_circuit_public_inputs.js +3 -1
- package/dest/avm/public_data_update_request.js +3 -1
- package/dest/avm/public_inner_call_request.js +3 -1
- package/dest/avm/revert_code.js +3 -1
- package/dest/aztec-address/index.js +4 -2
- package/dest/block/attestation_info.d.ts +5 -5
- package/dest/block/attestation_info.d.ts.map +1 -1
- package/dest/block/attestation_info.js +4 -4
- package/dest/block/body.js +3 -1
- package/dest/block/l2_block.d.ts +6 -3
- package/dest/block/l2_block.d.ts.map +1 -1
- package/dest/block/l2_block.js +6 -4
- package/dest/block/l2_block_code_to_purge.d.ts +2 -3
- package/dest/block/l2_block_code_to_purge.d.ts.map +1 -1
- package/dest/block/l2_block_code_to_purge.js +2 -8
- package/dest/block/l2_block_header.d.ts +8 -12
- package/dest/block/l2_block_header.d.ts.map +1 -1
- package/dest/block/l2_block_header.js +25 -18
- package/dest/block/l2_block_new.d.ts +1 -2
- package/dest/block/l2_block_new.d.ts.map +1 -1
- package/dest/block/l2_block_new.js +4 -1
- package/dest/block/l2_block_source.d.ts +245 -41
- package/dest/block/l2_block_source.d.ts.map +1 -1
- package/dest/block/l2_block_source.js +23 -5
- package/dest/block/l2_block_stream/index.d.ts +2 -1
- package/dest/block/l2_block_stream/index.d.ts.map +1 -1
- package/dest/block/l2_block_stream/index.js +1 -0
- package/dest/block/l2_block_stream/interfaces.d.ts +12 -5
- package/dest/block/l2_block_stream/interfaces.d.ts.map +1 -1
- package/dest/block/l2_block_stream/l2_block_stream.d.ts +4 -2
- package/dest/block/l2_block_stream/l2_block_stream.d.ts.map +1 -1
- package/dest/block/l2_block_stream/l2_block_stream.js +102 -30
- package/dest/block/l2_block_stream/l2_tips_memory_store.d.ts +24 -16
- package/dest/block/l2_block_stream/l2_tips_memory_store.d.ts.map +1 -1
- package/dest/block/l2_block_stream/l2_tips_memory_store.js +55 -61
- package/dest/block/l2_block_stream/l2_tips_store_base.d.ts +49 -0
- package/dest/block/l2_block_stream/l2_tips_store_base.d.ts.map +1 -0
- package/dest/block/l2_block_stream/l2_tips_store_base.js +179 -0
- 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 +483 -38
- package/dest/block/validate_block_result.d.ts +24 -24
- package/dest/block/validate_block_result.d.ts.map +1 -1
- package/dest/block/validate_block_result.js +13 -13
- package/dest/checkpoint/checkpoint.d.ts +1 -1
- package/dest/checkpoint/checkpoint.d.ts.map +1 -1
- package/dest/checkpoint/checkpoint.js +1 -0
- package/dest/checkpoint/checkpoint_info.d.ts +32 -3
- package/dest/checkpoint/checkpoint_info.d.ts.map +1 -1
- package/dest/checkpoint/checkpoint_info.js +34 -1
- 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/database-version/version_manager.js +3 -1
- package/dest/gas/gas.js +3 -1
- package/dest/gas/gas_fees.js +3 -1
- package/dest/interfaces/api_limit.d.ts +2 -1
- package/dest/interfaces/api_limit.d.ts.map +1 -1
- package/dest/interfaces/api_limit.js +1 -0
- package/dest/interfaces/archiver.d.ts +6 -6
- package/dest/interfaces/archiver.d.ts.map +1 -1
- package/dest/interfaces/archiver.js +6 -4
- package/dest/interfaces/aztec-node-admin.d.ts +12 -6
- package/dest/interfaces/aztec-node-admin.d.ts.map +1 -1
- package/dest/interfaces/aztec-node-admin.js +2 -2
- package/dest/interfaces/aztec-node.d.ts +11 -10
- package/dest/interfaces/aztec-node.d.ts.map +1 -1
- package/dest/interfaces/aztec-node.js +10 -5
- package/dest/interfaces/configs.d.ts +6 -1
- package/dest/interfaces/configs.d.ts.map +1 -1
- package/dest/interfaces/configs.js +2 -1
- package/dest/interfaces/p2p.d.ts +7 -9
- package/dest/interfaces/p2p.d.ts.map +1 -1
- package/dest/interfaces/p2p.js +3 -4
- package/dest/interfaces/proving-job.d.ts +170 -170
- package/dest/interfaces/proving-job.d.ts.map +1 -1
- package/dest/interfaces/proving-job.js +1 -7
- package/dest/interfaces/server_circuit_prover.d.ts +4 -3
- package/dest/interfaces/server_circuit_prover.d.ts.map +1 -1
- package/dest/interfaces/validator.d.ts +41 -7
- package/dest/interfaces/validator.d.ts.map +1 -1
- package/dest/interfaces/validator.js +3 -1
- package/dest/kernel/claimed_length_array.js +3 -1
- package/dest/kernel/hints/build_note_hash_read_request_hints.d.ts +6 -5
- package/dest/kernel/hints/build_note_hash_read_request_hints.d.ts.map +1 -1
- package/dest/kernel/hints/build_note_hash_read_request_hints.js +5 -6
- package/dest/kernel/hints/transient_data_squashing_hint.js +3 -1
- package/dest/kernel/log_hash.js +3 -1
- package/dest/kernel/private_log_data.js +5 -2
- package/dest/kernel/private_to_avm_accumulated_data.js +5 -2
- package/dest/kernel/private_to_public_accumulated_data.js +3 -1
- package/dest/kernel/private_to_rollup_accumulated_data.js +3 -1
- package/dest/kernel/private_validation_requests.js +3 -1
- package/dest/kernel/public_call_request.js +5 -2
- package/dest/logs/contract_class_log.js +3 -1
- package/dest/logs/private_log.js +3 -1
- package/dest/logs/public_log.js +3 -1
- package/dest/messaging/in_hash.d.ts +4 -2
- package/dest/messaging/in_hash.d.ts.map +1 -1
- package/dest/messaging/in_hash.js +3 -1
- package/dest/messaging/l2_to_l1_membership.d.ts +88 -6
- package/dest/messaging/l2_to_l1_membership.d.ts.map +1 -1
- package/dest/messaging/l2_to_l1_membership.js +158 -42
- package/dest/messaging/out_hash.d.ts +2 -1
- package/dest/messaging/out_hash.d.ts.map +1 -1
- package/dest/messaging/out_hash.js +13 -4
- package/dest/p2p/attestation_utils.d.ts +3 -3
- package/dest/p2p/attestation_utils.d.ts.map +1 -1
- package/dest/p2p/attestation_utils.js +1 -1
- package/dest/p2p/block_proposal.d.ts +85 -21
- package/dest/p2p/block_proposal.d.ts.map +1 -1
- package/dest/p2p/block_proposal.js +120 -37
- package/dest/p2p/checkpoint_attestation.d.ts +77 -0
- package/dest/p2p/checkpoint_attestation.d.ts.map +1 -0
- package/dest/p2p/{block_attestation.js → checkpoint_attestation.js} +22 -19
- package/dest/p2p/checkpoint_proposal.d.ts +154 -0
- package/dest/p2p/checkpoint_proposal.d.ts.map +1 -0
- package/dest/p2p/checkpoint_proposal.js +217 -0
- package/dest/p2p/consensus_payload.d.ts +6 -7
- package/dest/p2p/consensus_payload.d.ts.map +1 -1
- package/dest/p2p/consensus_payload.js +3 -2
- package/dest/p2p/gossipable.d.ts +4 -3
- package/dest/p2p/gossipable.d.ts.map +1 -1
- package/dest/p2p/gossipable.js +16 -5
- package/dest/p2p/index.d.ts +4 -2
- package/dest/p2p/index.d.ts.map +1 -1
- package/dest/p2p/index.js +3 -1
- package/dest/p2p/signature_utils.d.ts +5 -3
- package/dest/p2p/signature_utils.d.ts.map +1 -1
- package/dest/p2p/signature_utils.js +3 -1
- package/dest/p2p/signed_txs.d.ts +40 -0
- package/dest/p2p/signed_txs.d.ts.map +1 -0
- package/dest/p2p/signed_txs.js +70 -0
- package/dest/p2p/topic_type.d.ts +3 -2
- package/dest/p2p/topic_type.d.ts.map +1 -1
- package/dest/p2p/topic_type.js +8 -2
- package/dest/rollup/block_rollup_public_inputs.d.ts +4 -9
- package/dest/rollup/block_rollup_public_inputs.d.ts.map +1 -1
- package/dest/rollup/block_rollup_public_inputs.js +6 -10
- package/dest/rollup/checkpoint_constant_data.js +3 -1
- package/dest/rollup/checkpoint_header.d.ts +15 -12
- package/dest/rollup/checkpoint_header.d.ts.map +1 -1
- package/dest/rollup/checkpoint_header.js +33 -19
- package/dest/rollup/checkpoint_rollup_public_inputs.d.ts +6 -1
- package/dest/rollup/checkpoint_rollup_public_inputs.d.ts.map +1 -1
- package/dest/rollup/checkpoint_rollup_public_inputs.js +6 -2
- package/dest/rollup/root_rollup_public_inputs.d.ts +8 -3
- package/dest/rollup/root_rollup_public_inputs.d.ts.map +1 -1
- package/dest/rollup/root_rollup_public_inputs.js +6 -3
- package/dest/tests/factories.d.ts +15 -7
- package/dest/tests/factories.d.ts.map +1 -1
- package/dest/tests/factories.js +57 -13
- package/dest/tests/mocks.d.ts +59 -10
- package/dest/tests/mocks.d.ts.map +1 -1
- package/dest/tests/mocks.js +89 -41
- package/dest/trees/append_only_tree_snapshot.js +3 -1
- package/dest/tx/block_header.js +3 -1
- package/dest/tx/call_context.js +3 -1
- package/dest/tx/global_variable_builder.d.ts +2 -2
- package/dest/tx/global_variable_builder.d.ts.map +1 -1
- package/dest/tx/global_variables.js +3 -1
- package/dest/tx/index.d.ts +1 -2
- package/dest/tx/index.d.ts.map +1 -1
- package/dest/tx/index.js +0 -1
- package/dest/tx/private_execution_result.d.ts +1 -5
- package/dest/tx/private_execution_result.d.ts.map +1 -1
- package/dest/tx/private_execution_result.js +3 -20
- package/dest/tx/public_call_request_with_calldata.js +3 -1
- package/dest/tx/state_reference.js +3 -1
- package/dest/tx/tree_snapshots.js +3 -1
- package/dest/tx/tx.d.ts +1 -1
- package/dest/tx/tx.d.ts.map +1 -1
- package/dest/tx/tx.js +3 -1
- package/dest/tx/tx_effect.js +3 -1
- package/dest/tx/tx_execution_request.d.ts +1 -1
- package/dest/tx/tx_execution_request.d.ts.map +1 -1
- package/dest/tx/tx_execution_request.js +6 -2
- package/package.json +8 -8
- package/src/abi/contract_artifact.ts +10 -10
- package/src/block/attestation_info.ts +9 -6
- package/src/block/l2_block.ts +6 -5
- package/src/block/l2_block_code_to_purge.ts +3 -11
- package/src/block/l2_block_header.ts +26 -17
- package/src/block/l2_block_new.ts +5 -1
- package/src/block/l2_block_source.ts +66 -16
- package/src/block/l2_block_stream/index.ts +1 -0
- package/src/block/l2_block_stream/interfaces.ts +12 -4
- package/src/block/l2_block_stream/l2_block_stream.ts +121 -38
- package/src/block/l2_block_stream/l2_tips_memory_store.ts +62 -56
- package/src/block/l2_block_stream/l2_tips_store_base.ts +226 -0
- package/src/block/test/l2_tips_store_test_suite.ts +485 -36
- package/src/block/validate_block_result.ts +35 -31
- package/src/checkpoint/checkpoint.ts +1 -0
- package/src/checkpoint/checkpoint_info.ts +45 -2
- package/src/checkpoint/index.ts +1 -0
- package/src/interfaces/api_limit.ts +1 -0
- package/src/interfaces/archiver.ts +14 -6
- package/src/interfaces/aztec-node-admin.ts +5 -2
- package/src/interfaces/aztec-node.ts +43 -13
- package/src/interfaces/configs.ts +5 -0
- package/src/interfaces/p2p.ts +8 -12
- package/src/interfaces/proving-job.ts +2 -11
- package/src/interfaces/server_circuit_prover.ts +3 -2
- package/src/interfaces/validator.ts +57 -7
- package/src/kernel/hints/build_note_hash_read_request_hints.ts +5 -8
- package/src/messaging/in_hash.ts +3 -1
- package/src/messaging/l2_to_l1_membership.ts +176 -52
- package/src/messaging/out_hash.ts +17 -7
- package/src/p2p/attestation_utils.ts +3 -3
- package/src/p2p/block_proposal.ts +185 -41
- package/src/p2p/{block_attestation.ts → checkpoint_attestation.ts} +31 -25
- package/src/p2p/checkpoint_proposal.ts +337 -0
- package/src/p2p/consensus_payload.ts +5 -2
- package/src/p2p/gossipable.ts +14 -4
- package/src/p2p/index.ts +3 -1
- package/src/p2p/signature_utils.ts +3 -1
- package/src/p2p/signed_txs.ts +83 -0
- package/src/p2p/topic_type.ts +3 -2
- package/src/rollup/block_rollup_public_inputs.ts +3 -9
- package/src/rollup/checkpoint_header.ts +43 -20
- package/src/rollup/checkpoint_rollup_public_inputs.ts +6 -0
- package/src/rollup/root_rollup_public_inputs.ts +6 -0
- package/src/tests/factories.ts +53 -17
- package/src/tests/mocks.ts +166 -64
- package/src/tx/global_variable_builder.ts +1 -1
- package/src/tx/index.ts +0 -1
- package/src/tx/private_execution_result.ts +0 -15
- package/src/tx/tx.ts +2 -0
- package/src/tx/tx_execution_request.ts +2 -0
- package/dest/p2p/block_attestation.d.ts +0 -80
- package/dest/p2p/block_attestation.d.ts.map +0 -1
- package/dest/tx/content_commitment.d.ts +0 -49
- package/dest/tx/content_commitment.d.ts.map +0 -1
- package/dest/tx/content_commitment.js +0 -90
- package/src/tx/content_commitment.ts +0 -113
package/dest/tx/tx_effect.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
var _computedKey;
|
|
1
2
|
import { decodeTxBlobData, encodeTxBlobData, getNumTxBlobFields } from '@aztec/blob-lib/encoding';
|
|
2
3
|
import { MAX_CONTRACT_CLASS_LOGS_PER_TX, MAX_L2_TO_L1_MSGS_PER_TX, MAX_NOTE_HASHES_PER_TX, MAX_NULLIFIERS_PER_TX, MAX_PRIVATE_LOGS_PER_TX, MAX_TOTAL_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX } from '@aztec/constants';
|
|
3
4
|
import { makeTuple, makeTupleAsync } from '@aztec/foundation/array';
|
|
@@ -15,6 +16,7 @@ import { PrivateLog } from '../logs/private_log.js';
|
|
|
15
16
|
import { FlatPublicLogs, PublicLog } from '../logs/public_log.js';
|
|
16
17
|
import { computeTxOutHash } from '../messaging/out_hash.js';
|
|
17
18
|
import { TxHash } from './tx_hash.js';
|
|
19
|
+
_computedKey = inspect.custom;
|
|
18
20
|
export class TxEffect {
|
|
19
21
|
revertCode;
|
|
20
22
|
txHash;
|
|
@@ -232,7 +234,7 @@ export class TxEffect {
|
|
|
232
234
|
contractClassLogs: z.array(ContractClassLog.schema)
|
|
233
235
|
}).transform(TxEffect.from);
|
|
234
236
|
}
|
|
235
|
-
[
|
|
237
|
+
[_computedKey]() {
|
|
236
238
|
return `TxEffect {
|
|
237
239
|
revertCode: ${this.revertCode.getCode()},
|
|
238
240
|
txHash: ${this.txHash},
|
|
@@ -89,4 +89,4 @@ export declare class TxExecutionRequest {
|
|
|
89
89
|
static random(): Promise<TxExecutionRequest>;
|
|
90
90
|
[inspect.custom](): string;
|
|
91
91
|
}
|
|
92
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
92
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHhfZXhlY3V0aW9uX3JlcXVlc3QuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy90eC90eF9leGVjdXRpb25fcmVxdWVzdC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsRUFBRSxFQUFFLE1BQU0sZ0NBQWdDLENBQUM7QUFDcEQsT0FBTyxFQUFFLFlBQVksRUFBcUIsTUFBTSw2QkFBNkIsQ0FBQztBQUU5RSxPQUFPLEtBQUssRUFBRSxRQUFRLEVBQUUsTUFBTSx5QkFBeUIsQ0FBQztBQUV4RCxPQUFPLEVBQUUsT0FBTyxFQUFFLE1BQU0sTUFBTSxDQUFDO0FBRy9CLE9BQU8sRUFBRSxnQkFBZ0IsRUFBRSxNQUFNLDZCQUE2QixDQUFDO0FBQy9ELE9BQU8sRUFBRSxXQUFXLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQztBQUM5RCxPQUFPLEVBQUUsWUFBWSxFQUFFLE1BQU0sMkJBQTJCLENBQUM7QUFDekQsT0FBTyxFQUFFLEtBQUssTUFBTSxFQUFXLE1BQU0scUJBQXFCLENBQUM7QUFFM0QsT0FBTyxFQUFFLE9BQU8sRUFBRSxNQUFNLGNBQWMsQ0FBQztBQUV2QyxPQUFPLEVBQUUsWUFBWSxFQUFFLE1BQU0sb0JBQW9CLENBQUM7QUFDbEQsT0FBTyxFQUFFLFNBQVMsRUFBRSxNQUFNLGlCQUFpQixDQUFDO0FBQzVDLE9BQU8sRUFBRSxTQUFTLEVBQUUsTUFBTSxpQkFBaUIsQ0FBQztBQUU1Qzs7R0FFRztBQUVILHFCQUFhLGtCQUFrQjtJQUtwQixNQUFNLEVBQUUsWUFBWTtJQUlwQixnQkFBZ0IsRUFBRSxnQkFBZ0I7SUFLbEMsaUJBQWlCLEVBQUUsRUFBRTtJQUlyQixTQUFTLEVBQUUsU0FBUztJQU1wQixXQUFXLEVBQUUsWUFBWSxFQUFFO0lBSzNCLGFBQWEsRUFBRSxXQUFXLEVBQUU7SUFJNUIsUUFBUSxFQUFFLE9BQU8sRUFBRTtJQUtuQixJQUFJO0lBckNiO0lBQ0U7O09BRUc7SUFDSSxNQUFNLEVBQUUsWUFBWTtJQUMzQjs7T0FFRztJQUNJLGdCQUFnQixFQUFFLGdCQUFnQjtJQUN6Qzs7O09BR0c7SUFDSSxpQkFBaUIsRUFBRSxFQUFFO0lBQzVCOztPQUVHO0lBQ0ksU0FBUyxFQUFFLFNBQVM7SUFDM0I7Ozs7T0FJRztJQUNJLFdBQVcsRUFBRSxZQUFZLEVBQUU7SUFDbEM7OztPQUdHO0lBQ0ksYUFBYSxFQUFFLFdBQVcsRUFBRTtJQUNuQzs7T0FFRztJQUNJLFFBQVEsRUFBRSxPQUFPLEVBQUU7SUFDMUI7OztPQUdHO0lBQ0ksSUFBSSxLQUFjLEVBQ3ZCO0lBR0osTUFBTSxLQUFLLE1BQU0sSUFBSSxNQUFNLENBQUMsa0JBQWtCLENBQUMsQ0FhOUM7SUFFRCxXQUFXLElBQUksU0FBUyxDQVN2QjtJQUVELE1BQU0sQ0FBQyxTQUFTLENBQUMsTUFBTSxFQUFFLFFBQVEsQ0FBQyxrQkFBa0IsQ0FBQywwR0FXcEQ7SUFFRCxNQUFNLENBQUMsSUFBSSxDQUFDLE1BQU0sRUFBRSxRQUFRLENBQUMsa0JBQWtCLENBQUMsR0FBRyxrQkFBa0IsQ0FFcEU7SUFFRDs7O09BR0c7SUFDSCxRQUFRLDRCQVdQO0lBRUQ7OztPQUdHO0lBQ0gsUUFBUSxrQkFFUDtJQUVEOzs7O09BSUc7SUFDSCxNQUFNLENBQUMsVUFBVSxDQUFDLE1BQU0sRUFBRSxNQUFNLEdBQUcsWUFBWSxHQUFHLGtCQUFrQixDQVluRTtJQUVEOzs7O09BSUc7SUFDSCxNQUFNLENBQUMsVUFBVSxDQUFDLEdBQUcsRUFBRSxNQUFNLEdBQUcsa0JBQWtCLENBRWpEO0lBRUQsT0FBYSxNQUFNLGdDQWNsQjtJQUVELENBQUMsT0FBTyxDQUFDLE1BQU0sQ0FBQyxXQUVmO0NBQ0YifQ==
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tx_execution_request.d.ts","sourceRoot":"","sources":["../../src/tx/tx_execution_request.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACpD,OAAO,EAAE,YAAY,EAAqB,MAAM,6BAA6B,CAAC;AAE9E,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAExD,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAG/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,KAAK,MAAM,EAAW,MAAM,qBAAqB,CAAC;AAE3D,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C;;GAEG;
|
|
1
|
+
{"version":3,"file":"tx_execution_request.d.ts","sourceRoot":"","sources":["../../src/tx/tx_execution_request.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACpD,OAAO,EAAE,YAAY,EAAqB,MAAM,6BAA6B,CAAC;AAE9E,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAExD,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAG/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,KAAK,MAAM,EAAW,MAAM,qBAAqB,CAAC;AAE3D,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C;;GAEG;AAEH,qBAAa,kBAAkB;IAKpB,MAAM,EAAE,YAAY;IAIpB,gBAAgB,EAAE,gBAAgB;IAKlC,iBAAiB,EAAE,EAAE;IAIrB,SAAS,EAAE,SAAS;IAMpB,WAAW,EAAE,YAAY,EAAE;IAK3B,aAAa,EAAE,WAAW,EAAE;IAI5B,QAAQ,EAAE,OAAO,EAAE;IAKnB,IAAI;IArCb;IACE;;OAEG;IACI,MAAM,EAAE,YAAY;IAC3B;;OAEG;IACI,gBAAgB,EAAE,gBAAgB;IACzC;;;OAGG;IACI,iBAAiB,EAAE,EAAE;IAC5B;;OAEG;IACI,SAAS,EAAE,SAAS;IAC3B;;;;OAIG;IACI,WAAW,EAAE,YAAY,EAAE;IAClC;;;OAGG;IACI,aAAa,EAAE,WAAW,EAAE;IACnC;;OAEG;IACI,QAAQ,EAAE,OAAO,EAAE;IAC1B;;;OAGG;IACI,IAAI,KAAc,EACvB;IAGJ,MAAM,KAAK,MAAM,IAAI,MAAM,CAAC,kBAAkB,CAAC,CAa9C;IAED,WAAW,IAAI,SAAS,CASvB;IAED,MAAM,CAAC,SAAS,CAAC,MAAM,EAAE,QAAQ,CAAC,kBAAkB,CAAC,0GAWpD;IAED,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,QAAQ,CAAC,kBAAkB,CAAC,GAAG,kBAAkB,CAEpE;IAED;;;OAGG;IACH,QAAQ,4BAWP;IAED;;;OAGG;IACH,QAAQ,kBAEP;IAED;;;;OAIG;IACH,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY,GAAG,kBAAkB,CAYnE;IAED;;;;OAIG;IACH,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,kBAAkB,CAEjD;IAED,OAAa,MAAM,gCAclB;IAED,CAAC,OAAO,CAAC,MAAM,CAAC,WAEf;CACF"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
var _computedKey;
|
|
1
2
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
3
|
import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
3
4
|
import { bufferToHex, hexToBuffer } from '@aztec/foundation/string';
|
|
@@ -13,9 +14,11 @@ import { FunctionData } from './function_data.js';
|
|
|
13
14
|
import { HashedValues } from './hashed_values.js';
|
|
14
15
|
import { TxContext } from './tx_context.js';
|
|
15
16
|
import { TxRequest } from './tx_request.js';
|
|
17
|
+
_computedKey = inspect.custom;
|
|
16
18
|
/**
|
|
17
19
|
* Request to execute a transaction. Similar to TxRequest, but has the full args.
|
|
18
|
-
*/
|
|
20
|
+
*/ // docs:start:tx_execution_request_class
|
|
21
|
+
export class TxExecutionRequest {
|
|
19
22
|
origin;
|
|
20
23
|
functionSelector;
|
|
21
24
|
firstCallArgsHash;
|
|
@@ -55,6 +58,7 @@ import { TxRequest } from './tx_request.js';
|
|
|
55
58
|
this.capsules = capsules;
|
|
56
59
|
this.salt = salt;
|
|
57
60
|
}
|
|
61
|
+
// docs:end:tx_execution_request_class
|
|
58
62
|
static get schema() {
|
|
59
63
|
return z.object({
|
|
60
64
|
origin: schemas.AztecAddress,
|
|
@@ -128,7 +132,7 @@ import { TxRequest } from './tx_request.js';
|
|
|
128
132
|
])
|
|
129
133
|
], Fr.random());
|
|
130
134
|
}
|
|
131
|
-
[
|
|
135
|
+
[_computedKey]() {
|
|
132
136
|
return `TxExecutionRequest(${this.origin} called ${this.functionSelector})`;
|
|
133
137
|
}
|
|
134
138
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/stdlib",
|
|
3
|
-
"version": "0.0.1-commit.
|
|
3
|
+
"version": "0.0.1-commit.7d4e6cd",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"inherits": [
|
|
6
6
|
"../package.common.json",
|
|
@@ -77,13 +77,13 @@
|
|
|
77
77
|
},
|
|
78
78
|
"dependencies": {
|
|
79
79
|
"@aws-sdk/client-s3": "^3.892.0",
|
|
80
|
-
"@aztec/bb.js": "0.0.1-commit.
|
|
81
|
-
"@aztec/blob-lib": "0.0.1-commit.
|
|
82
|
-
"@aztec/constants": "0.0.1-commit.
|
|
83
|
-
"@aztec/ethereum": "0.0.1-commit.
|
|
84
|
-
"@aztec/foundation": "0.0.1-commit.
|
|
85
|
-
"@aztec/l1-artifacts": "0.0.1-commit.
|
|
86
|
-
"@aztec/noir-noirc_abi": "0.0.1-commit.
|
|
80
|
+
"@aztec/bb.js": "0.0.1-commit.7d4e6cd",
|
|
81
|
+
"@aztec/blob-lib": "0.0.1-commit.7d4e6cd",
|
|
82
|
+
"@aztec/constants": "0.0.1-commit.7d4e6cd",
|
|
83
|
+
"@aztec/ethereum": "0.0.1-commit.7d4e6cd",
|
|
84
|
+
"@aztec/foundation": "0.0.1-commit.7d4e6cd",
|
|
85
|
+
"@aztec/l1-artifacts": "0.0.1-commit.7d4e6cd",
|
|
86
|
+
"@aztec/noir-noirc_abi": "0.0.1-commit.7d4e6cd",
|
|
87
87
|
"@google-cloud/storage": "^7.15.0",
|
|
88
88
|
"axios": "^1.12.0",
|
|
89
89
|
"json-stringify-deterministic": "1.0.12",
|
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
import { jsonParseWithSchema, jsonStringify } from '@aztec/foundation/json-rpc';
|
|
2
2
|
|
|
3
|
+
import {
|
|
4
|
+
AZTEC_INITIALIZER_ATTRIBUTE,
|
|
5
|
+
AZTEC_ONLY_SELF_ATTRIBUTE,
|
|
6
|
+
AZTEC_PRIVATE_ATTRIBUTE,
|
|
7
|
+
AZTEC_PUBLIC_ATTRIBUTE,
|
|
8
|
+
AZTEC_UTILITY_ATTRIBUTE,
|
|
9
|
+
AZTEC_VIEW_ATTRIBUTE,
|
|
10
|
+
type NoirCompiledContract,
|
|
11
|
+
} from '../noir/index.js';
|
|
3
12
|
import {
|
|
4
13
|
type ABIParameter,
|
|
5
14
|
type ABIParameterVisibility,
|
|
@@ -14,16 +23,7 @@ import {
|
|
|
14
23
|
type IntegerValue,
|
|
15
24
|
type StructValue,
|
|
16
25
|
type TypedStructFieldValue,
|
|
17
|
-
} from '
|
|
18
|
-
import {
|
|
19
|
-
AZTEC_INITIALIZER_ATTRIBUTE,
|
|
20
|
-
AZTEC_ONLY_SELF_ATTRIBUTE,
|
|
21
|
-
AZTEC_PRIVATE_ATTRIBUTE,
|
|
22
|
-
AZTEC_PUBLIC_ATTRIBUTE,
|
|
23
|
-
AZTEC_UTILITY_ATTRIBUTE,
|
|
24
|
-
AZTEC_VIEW_ATTRIBUTE,
|
|
25
|
-
type NoirCompiledContract,
|
|
26
|
-
} from '../noir/index.js';
|
|
26
|
+
} from './abi.js';
|
|
27
27
|
|
|
28
28
|
/**
|
|
29
29
|
* Serializes a contract artifact to a buffer for storage.
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { recoverAddress } from '@aztec/foundation/crypto/secp256k1-signer';
|
|
2
2
|
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
3
3
|
|
|
4
|
+
import { Checkpoint } from '../checkpoint/checkpoint.js';
|
|
4
5
|
import { ConsensusPayload } from '../p2p/consensus_payload.js';
|
|
5
6
|
import { SignatureDomainSeparator, getHashedSignaturePayloadEthSignedMessage } from '../p2p/signature_utils.js';
|
|
6
|
-
import type { L2Block } from './l2_block.js';
|
|
7
7
|
import type { CommitteeAttestation } from './proposal/committee_attestation.js';
|
|
8
8
|
|
|
9
9
|
/**
|
|
@@ -29,14 +29,14 @@ export type AttestationInfo =
|
|
|
29
29
|
};
|
|
30
30
|
|
|
31
31
|
/**
|
|
32
|
-
* Extracts attestation information from a published
|
|
32
|
+
* Extracts attestation information from a published checkpoint.
|
|
33
33
|
* Returns info for each attestation, preserving array indices.
|
|
34
34
|
*/
|
|
35
|
-
export function
|
|
35
|
+
export function getAttestationInfoFromPublishedCheckpoint(block: {
|
|
36
36
|
attestations: CommitteeAttestation[];
|
|
37
|
-
|
|
37
|
+
checkpoint: Checkpoint;
|
|
38
38
|
}): AttestationInfo[] {
|
|
39
|
-
const payload = ConsensusPayload.
|
|
39
|
+
const payload = ConsensusPayload.fromCheckpoint(block.checkpoint);
|
|
40
40
|
return getAttestationInfoFromPayload(payload, block.attestations);
|
|
41
41
|
}
|
|
42
42
|
|
|
@@ -44,7 +44,10 @@ export function getAttestationInfoFromPayload(
|
|
|
44
44
|
payload: ConsensusPayload,
|
|
45
45
|
attestations: CommitteeAttestation[],
|
|
46
46
|
): AttestationInfo[] {
|
|
47
|
-
const hashedPayload = getHashedSignaturePayloadEthSignedMessage(
|
|
47
|
+
const hashedPayload = getHashedSignaturePayloadEthSignedMessage(
|
|
48
|
+
payload,
|
|
49
|
+
SignatureDomainSeparator.checkpointAttestation,
|
|
50
|
+
);
|
|
48
51
|
|
|
49
52
|
return attestations.map(attestation => {
|
|
50
53
|
// If signature is empty, check if we have an address directly
|
package/src/block/l2_block.ts
CHANGED
|
@@ -101,7 +101,7 @@ export class L2Block {
|
|
|
101
101
|
|
|
102
102
|
return new L2Block(
|
|
103
103
|
makeAppendOnlyTreeSnapshot(l2BlockNum + 1),
|
|
104
|
-
makeL2BlockHeader(0, l2BlockNum, slotNumber ?? l2BlockNum, {
|
|
104
|
+
makeL2BlockHeader(0, l2BlockNum, slotNumber ?? l2BlockNum, { inHash }),
|
|
105
105
|
body,
|
|
106
106
|
);
|
|
107
107
|
}
|
|
@@ -151,13 +151,13 @@ export class L2Block {
|
|
|
151
151
|
return this.header.toBlockHeader();
|
|
152
152
|
}
|
|
153
153
|
|
|
154
|
-
public toL2Block() {
|
|
154
|
+
public toL2Block(args: { checkpointNumber?: CheckpointNumber; indexWithinCheckpoint?: number } = {}): L2BlockNew {
|
|
155
155
|
return new L2BlockNew(
|
|
156
156
|
this.archive,
|
|
157
157
|
this.getBlockHeader(),
|
|
158
158
|
this.body,
|
|
159
|
-
CheckpointNumber.fromBlockNumber(this.number),
|
|
160
|
-
0,
|
|
159
|
+
args?.checkpointNumber ?? CheckpointNumber.fromBlockNumber(this.number),
|
|
160
|
+
args?.indexWithinCheckpoint ?? 0,
|
|
161
161
|
);
|
|
162
162
|
}
|
|
163
163
|
|
|
@@ -175,7 +175,8 @@ export class L2Block {
|
|
|
175
175
|
const block = checkpoint.blocks.at(-1)!;
|
|
176
176
|
const header = new L2BlockHeader(
|
|
177
177
|
new AppendOnlyTreeSnapshot(checkpointHeader.lastArchiveRoot, block.number),
|
|
178
|
-
checkpointHeader.
|
|
178
|
+
checkpointHeader.blobsHash,
|
|
179
|
+
checkpointHeader.inHash,
|
|
179
180
|
block.header.state,
|
|
180
181
|
block.header.globalVariables,
|
|
181
182
|
block.header.totalFees,
|
|
@@ -7,7 +7,6 @@ import type { FieldsOf } from '@aztec/foundation/types';
|
|
|
7
7
|
import { AztecAddress } from '../aztec-address/index.js';
|
|
8
8
|
import { GasFees } from '../gas/gas_fees.js';
|
|
9
9
|
import { AppendOnlyTreeSnapshot } from '../trees/append_only_tree_snapshot.js';
|
|
10
|
-
import { ContentCommitment } from '../tx/content_commitment.js';
|
|
11
10
|
import { GlobalVariables } from '../tx/global_variables.js';
|
|
12
11
|
import { PartialStateReference } from '../tx/partial_state_reference.js';
|
|
13
12
|
import { StateReference } from '../tx/state_reference.js';
|
|
@@ -18,12 +17,12 @@ export function makeL2BlockHeader(
|
|
|
18
17
|
blockNumber?: number,
|
|
19
18
|
slotNumber?: number,
|
|
20
19
|
overrides: Partial<FieldsOf<L2BlockHeader>> = {},
|
|
21
|
-
inHash?: Fr,
|
|
22
20
|
) {
|
|
23
21
|
return new L2BlockHeader(
|
|
24
22
|
makeAppendOnlyTreeSnapshot(seed + 0x100),
|
|
25
|
-
overrides
|
|
26
|
-
overrides
|
|
23
|
+
overrides.blobsHash ?? new Fr(seed + 0x200),
|
|
24
|
+
overrides.inHash ?? new Fr(seed + 0x300),
|
|
25
|
+
overrides.state ?? makeStateReference(seed + 0x600),
|
|
27
26
|
makeGlobalVariables((seed += 0x700), {
|
|
28
27
|
...(blockNumber ? { blockNumber: BlockNumber(blockNumber) } : {}),
|
|
29
28
|
...(slotNumber ? { slotNumber: SlotNumber(slotNumber) } : {}),
|
|
@@ -44,13 +43,6 @@ export function makeAppendOnlyTreeSnapshot(seed = 1): AppendOnlyTreeSnapshot {
|
|
|
44
43
|
return new AppendOnlyTreeSnapshot(new Fr(seed), seed);
|
|
45
44
|
}
|
|
46
45
|
|
|
47
|
-
/**
|
|
48
|
-
* Makes content commitment
|
|
49
|
-
*/
|
|
50
|
-
function makeContentCommitment(seed = 0, inHash?: Fr): ContentCommitment {
|
|
51
|
-
return new ContentCommitment(new Fr(seed + 0x100), inHash ?? new Fr(seed + 0x200), new Fr(seed + 0x300));
|
|
52
|
-
}
|
|
53
|
-
|
|
54
46
|
/**
|
|
55
47
|
* Makes arbitrary state reference.
|
|
56
48
|
* @param seed - The seed to use for generating the state reference.
|
|
@@ -10,7 +10,7 @@ import { z } from 'zod';
|
|
|
10
10
|
|
|
11
11
|
import { CheckpointHeader } from '../rollup/checkpoint_header.js';
|
|
12
12
|
import { AppendOnlyTreeSnapshot } from '../trees/append_only_tree_snapshot.js';
|
|
13
|
-
import { BlockHeader,
|
|
13
|
+
import { BlockHeader, GlobalVariables, StateReference } from '../tx/index.js';
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* TO BE DELETED
|
|
@@ -25,8 +25,8 @@ export class L2BlockHeader {
|
|
|
25
25
|
constructor(
|
|
26
26
|
/** Snapshot of archive before the block is applied. */
|
|
27
27
|
public lastArchive: AppendOnlyTreeSnapshot,
|
|
28
|
-
|
|
29
|
-
public
|
|
28
|
+
public blobsHash: Fr,
|
|
29
|
+
public inHash: Fr,
|
|
30
30
|
/** State reference. */
|
|
31
31
|
public state: StateReference,
|
|
32
32
|
/** Global variables of an L2 block. */
|
|
@@ -45,7 +45,8 @@ export class L2BlockHeader {
|
|
|
45
45
|
return z
|
|
46
46
|
.object({
|
|
47
47
|
lastArchive: AppendOnlyTreeSnapshot.schema,
|
|
48
|
-
|
|
48
|
+
blobsHash: schemas.Fr,
|
|
49
|
+
inHash: schemas.Fr,
|
|
49
50
|
state: StateReference.schema,
|
|
50
51
|
globalVariables: GlobalVariables.schema,
|
|
51
52
|
totalFees: schemas.Fr,
|
|
@@ -59,7 +60,8 @@ export class L2BlockHeader {
|
|
|
59
60
|
static getFields(fields: FieldsOf<L2BlockHeader>) {
|
|
60
61
|
return [
|
|
61
62
|
fields.lastArchive,
|
|
62
|
-
fields.
|
|
63
|
+
fields.blobsHash,
|
|
64
|
+
fields.inHash,
|
|
63
65
|
fields.state,
|
|
64
66
|
fields.globalVariables,
|
|
65
67
|
fields.totalFees,
|
|
@@ -84,7 +86,8 @@ export class L2BlockHeader {
|
|
|
84
86
|
getSize() {
|
|
85
87
|
return (
|
|
86
88
|
this.lastArchive.getSize() +
|
|
87
|
-
this.
|
|
89
|
+
this.blobsHash.size +
|
|
90
|
+
this.inHash.size +
|
|
88
91
|
this.state.getSize() +
|
|
89
92
|
this.globalVariables.getSize() +
|
|
90
93
|
this.totalFees.size +
|
|
@@ -111,7 +114,8 @@ export class L2BlockHeader {
|
|
|
111
114
|
|
|
112
115
|
return new L2BlockHeader(
|
|
113
116
|
reader.readObject(AppendOnlyTreeSnapshot),
|
|
114
|
-
reader.readObject(
|
|
117
|
+
reader.readObject(Fr),
|
|
118
|
+
reader.readObject(Fr),
|
|
115
119
|
reader.readObject(StateReference),
|
|
116
120
|
reader.readObject(GlobalVariables),
|
|
117
121
|
reader.readObject(Fr),
|
|
@@ -126,7 +130,8 @@ export class L2BlockHeader {
|
|
|
126
130
|
|
|
127
131
|
return new L2BlockHeader(
|
|
128
132
|
AppendOnlyTreeSnapshot.fromFields(reader),
|
|
129
|
-
|
|
133
|
+
reader.readField(),
|
|
134
|
+
reader.readField(),
|
|
130
135
|
StateReference.fromFields(reader),
|
|
131
136
|
GlobalVariables.fromFields(reader),
|
|
132
137
|
reader.readField(),
|
|
@@ -139,7 +144,8 @@ export class L2BlockHeader {
|
|
|
139
144
|
static empty(fields: Partial<FieldsOf<L2BlockHeader>> = {}) {
|
|
140
145
|
return L2BlockHeader.from({
|
|
141
146
|
lastArchive: AppendOnlyTreeSnapshot.empty(),
|
|
142
|
-
|
|
147
|
+
blobsHash: Fr.ZERO,
|
|
148
|
+
inHash: Fr.ZERO,
|
|
143
149
|
state: StateReference.empty(),
|
|
144
150
|
globalVariables: GlobalVariables.empty(),
|
|
145
151
|
totalFees: Fr.ZERO,
|
|
@@ -153,7 +159,8 @@ export class L2BlockHeader {
|
|
|
153
159
|
isEmpty(): boolean {
|
|
154
160
|
return (
|
|
155
161
|
this.lastArchive.isEmpty() &&
|
|
156
|
-
this.
|
|
162
|
+
this.blobsHash.isZero() &&
|
|
163
|
+
this.inHash.isZero() &&
|
|
157
164
|
this.state.isEmpty() &&
|
|
158
165
|
this.globalVariables.isEmpty() &&
|
|
159
166
|
this.totalFees.isZero() &&
|
|
@@ -179,7 +186,8 @@ export class L2BlockHeader {
|
|
|
179
186
|
return new CheckpointHeader(
|
|
180
187
|
this.lastArchive.root,
|
|
181
188
|
this.blockHeadersHash,
|
|
182
|
-
this.
|
|
189
|
+
this.blobsHash,
|
|
190
|
+
this.inHash,
|
|
183
191
|
this.globalVariables.slotNumber,
|
|
184
192
|
this.globalVariables.timestamp,
|
|
185
193
|
this.globalVariables.coinbase,
|
|
@@ -203,7 +211,8 @@ export class L2BlockHeader {
|
|
|
203
211
|
toInspect() {
|
|
204
212
|
return {
|
|
205
213
|
lastArchive: this.lastArchive.root.toString(),
|
|
206
|
-
|
|
214
|
+
blobsHash: this.blobsHash.toString(),
|
|
215
|
+
inHash: this.inHash.toString(),
|
|
207
216
|
state: this.state.toInspect(),
|
|
208
217
|
globalVariables: this.globalVariables.toInspect(),
|
|
209
218
|
totalFees: this.totalFees.toBigInt(),
|
|
@@ -216,9 +225,8 @@ export class L2BlockHeader {
|
|
|
216
225
|
[inspect.custom]() {
|
|
217
226
|
return `L2BlockHeader {
|
|
218
227
|
lastArchive: ${inspect(this.lastArchive)},
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
contentCommitment.outHash: ${inspect(this.contentCommitment.outHash)},
|
|
228
|
+
blobsHash: ${inspect(this.blobsHash)},
|
|
229
|
+
inHash: ${inspect(this.inHash)},
|
|
222
230
|
state.l1ToL2MessageTree: ${inspect(this.state.l1ToL2MessageTree)},
|
|
223
231
|
state.noteHashTree: ${inspect(this.state.partial.noteHashTree)},
|
|
224
232
|
state.nullifierTree: ${inspect(this.state.partial.nullifierTree)},
|
|
@@ -233,12 +241,13 @@ export class L2BlockHeader {
|
|
|
233
241
|
|
|
234
242
|
public equals(other: this): boolean {
|
|
235
243
|
return (
|
|
236
|
-
this.
|
|
244
|
+
this.lastArchive.equals(other.lastArchive) &&
|
|
245
|
+
this.blobsHash.equals(other.blobsHash) &&
|
|
246
|
+
this.inHash.equals(other.inHash) &&
|
|
237
247
|
this.state.equals(other.state) &&
|
|
238
248
|
this.globalVariables.equals(other.globalVariables) &&
|
|
239
249
|
this.totalFees.equals(other.totalFees) &&
|
|
240
250
|
this.totalManaUsed.equals(other.totalManaUsed) &&
|
|
241
|
-
this.lastArchive.equals(other.lastArchive) &&
|
|
242
251
|
this.spongeBlobHash.equals(other.spongeBlobHash) &&
|
|
243
252
|
this.blockHeadersHash.equals(other.blockHeadersHash)
|
|
244
253
|
);
|
|
@@ -11,9 +11,13 @@ import { BlockHeader } from '../tx/block_header.js';
|
|
|
11
11
|
import { Body } from './body.js';
|
|
12
12
|
import type { L2BlockInfo } from './l2_block_info.js';
|
|
13
13
|
|
|
14
|
+
// TODO(palla/mbps): Delete the existing `L2Block` class and rename this to `L2Block`.
|
|
15
|
+
// TODO(palla/mbps): Consider moving the checkpointNumber and indexWithinCheckpoint to the header:
|
|
16
|
+
// if the blockNumber is there, why not these as well? Consider whether they should be part of the
|
|
17
|
+
// circuits structs though.
|
|
18
|
+
|
|
14
19
|
/**
|
|
15
20
|
* An L2 block with a header and a body.
|
|
16
|
-
* TODO: Delete the existing `L2Block` class and rename this to `L2Block`.
|
|
17
21
|
*/
|
|
18
22
|
export class L2BlockNew {
|
|
19
23
|
constructor(
|
|
@@ -2,6 +2,7 @@ import {
|
|
|
2
2
|
BlockNumber,
|
|
3
3
|
BlockNumberSchema,
|
|
4
4
|
CheckpointNumber,
|
|
5
|
+
CheckpointNumberSchema,
|
|
5
6
|
type EpochNumber,
|
|
6
7
|
type SlotNumber,
|
|
7
8
|
} from '@aztec/foundation/branded-types';
|
|
@@ -14,6 +15,7 @@ import { z } from 'zod';
|
|
|
14
15
|
import type { Checkpoint } from '../checkpoint/checkpoint.js';
|
|
15
16
|
import type { PublishedCheckpoint } from '../checkpoint/published_checkpoint.js';
|
|
16
17
|
import type { L1RollupConstants } from '../epoch-helpers/index.js';
|
|
18
|
+
import { CheckpointHeader } from '../rollup/checkpoint_header.js';
|
|
17
19
|
import type { BlockHeader } from '../tx/block_header.js';
|
|
18
20
|
import type { IndexedTxEffect } from '../tx/indexed_tx_effect.js';
|
|
19
21
|
import type { TxHash } from '../tx/tx_hash.js';
|
|
@@ -21,7 +23,7 @@ import type { TxReceipt } from '../tx/tx_receipt.js';
|
|
|
21
23
|
import { type CheckpointedL2Block, PublishedL2Block } from './checkpointed_l2_block.js';
|
|
22
24
|
import type { L2Block } from './l2_block.js';
|
|
23
25
|
import type { L2BlockNew } from './l2_block_new.js';
|
|
24
|
-
import type {
|
|
26
|
+
import type { ValidateCheckpointNegativeResult, ValidateCheckpointResult } from './validate_block_result.js';
|
|
25
27
|
|
|
26
28
|
/**
|
|
27
29
|
* Interface of classes allowing for the retrieval of L2 blocks.
|
|
@@ -66,6 +68,8 @@ export interface L2BlockSource {
|
|
|
66
68
|
*/
|
|
67
69
|
getCheckpointedBlock(number: BlockNumber): Promise<CheckpointedL2Block | undefined>;
|
|
68
70
|
|
|
71
|
+
getCheckpointedBlocks(from: BlockNumber, limit: number, proven?: boolean): Promise<CheckpointedL2Block[]>;
|
|
72
|
+
|
|
69
73
|
/**
|
|
70
74
|
* Retrieves a collection of published checkpoints
|
|
71
75
|
* @param checkpointNumber The first checkpoint to be retrieved
|
|
@@ -161,10 +165,10 @@ export interface L2BlockSource {
|
|
|
161
165
|
isPendingChainInvalid(): Promise<boolean>;
|
|
162
166
|
|
|
163
167
|
/**
|
|
164
|
-
* Returns the status of the pending chain validation. If the chain is invalid, reports the earliest consecutive
|
|
165
|
-
* that is invalid, along with the reason for being invalid, which can be used to trigger an invalidation.
|
|
168
|
+
* Returns the status of the pending chain validation. If the chain is invalid, reports the earliest consecutive
|
|
169
|
+
* checkpoint that is invalid, along with the reason for being invalid, which can be used to trigger an invalidation.
|
|
166
170
|
*/
|
|
167
|
-
getPendingChainValidationStatus(): Promise<
|
|
171
|
+
getPendingChainValidationStatus(): Promise<ValidateCheckpointResult>;
|
|
168
172
|
|
|
169
173
|
/** Force a sync. */
|
|
170
174
|
syncImmediate(): Promise<void>;
|
|
@@ -179,6 +183,10 @@ export interface L2BlockSource {
|
|
|
179
183
|
*/
|
|
180
184
|
getBlock(number: BlockNumber): Promise<L2Block | undefined>;
|
|
181
185
|
|
|
186
|
+
getL2BlockNew(number: BlockNumber): Promise<L2BlockNew | undefined>;
|
|
187
|
+
|
|
188
|
+
getL2BlocksNew(from: BlockNumber, limit: number, proven?: boolean): Promise<L2BlockNew[]>;
|
|
189
|
+
|
|
182
190
|
/**
|
|
183
191
|
* Returns all blocks for a given epoch.
|
|
184
192
|
* @dev Use this method only with recent epochs, since it walks the block list backwards.
|
|
@@ -232,24 +240,44 @@ export interface L2BlockSink {
|
|
|
232
240
|
export type ArchiverEmitter = TypedEventEmitter<{
|
|
233
241
|
[L2BlockSourceEvents.L2PruneDetected]: (args: L2BlockPruneEvent) => void;
|
|
234
242
|
[L2BlockSourceEvents.L2BlockProven]: (args: L2BlockProvenEvent) => void;
|
|
235
|
-
[L2BlockSourceEvents.
|
|
243
|
+
[L2BlockSourceEvents.InvalidAttestationsCheckpointDetected]: (args: InvalidCheckpointDetectedEvent) => void;
|
|
244
|
+
[L2BlockSourceEvents.L2BlocksCheckpointed]: (args: L2CheckpointEvent) => void;
|
|
236
245
|
}>;
|
|
237
246
|
export interface L2BlockSourceEventEmitter extends L2BlockSource, ArchiverEmitter {}
|
|
238
247
|
|
|
239
248
|
/**
|
|
240
249
|
* Identifier for L2 block tags.
|
|
241
|
-
* -
|
|
250
|
+
* - proposed: Latest block proposed on L2.
|
|
251
|
+
* - checkpointed: Checkpointed block on L1.
|
|
242
252
|
* - proven: Proven block on L1.
|
|
243
253
|
* - finalized: Proven block on a finalized L1 block (not implemented, set to proven for now).
|
|
244
254
|
*/
|
|
245
|
-
export type L2BlockTag = '
|
|
255
|
+
export type L2BlockTag = 'proposed' | 'checkpointed' | 'proven' | 'finalized';
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* Reason for L2 block prune.
|
|
259
|
+
* - uncheckpointed: L2 blocks were pruned due to a failure to checkpoint.
|
|
260
|
+
* - unproven: L2 blocks were pruned due to a failure to prove.
|
|
261
|
+
*/
|
|
262
|
+
export type L2BlockPruneReason = 'uncheckpointed' | 'unproven';
|
|
246
263
|
|
|
247
264
|
/** Tips of the L2 chain. */
|
|
248
|
-
export type L2Tips =
|
|
265
|
+
export type L2Tips = {
|
|
266
|
+
proposed: L2BlockId;
|
|
267
|
+
checkpointed: L2TipId;
|
|
268
|
+
proven: L2TipId;
|
|
269
|
+
finalized: L2TipId;
|
|
270
|
+
};
|
|
271
|
+
|
|
272
|
+
export const GENESIS_CHECKPOINT_HEADER_HASH = CheckpointHeader.empty().hash();
|
|
249
273
|
|
|
250
274
|
/** Identifies a block by number and hash. */
|
|
251
275
|
export type L2BlockId = { number: BlockNumber; hash: string };
|
|
252
276
|
|
|
277
|
+
export type CheckpointId = { number: CheckpointNumber; hash: string };
|
|
278
|
+
|
|
279
|
+
export type L2TipId = { block: L2BlockId; checkpoint: CheckpointId };
|
|
280
|
+
|
|
253
281
|
/** Creates an L2 block id */
|
|
254
282
|
export function makeL2BlockId(number: BlockNumber, hash?: string): L2BlockId {
|
|
255
283
|
if (number !== 0 && !hash) {
|
|
@@ -258,21 +286,38 @@ export function makeL2BlockId(number: BlockNumber, hash?: string): L2BlockId {
|
|
|
258
286
|
return { number, hash: hash! };
|
|
259
287
|
}
|
|
260
288
|
|
|
289
|
+
/** Creates an L2 checkpoint id */
|
|
290
|
+
export function makeL2CheckpointId(number: CheckpointNumber, hash: string): CheckpointId {
|
|
291
|
+
return { number, hash };
|
|
292
|
+
}
|
|
293
|
+
|
|
261
294
|
const L2BlockIdSchema = z.object({
|
|
262
295
|
number: BlockNumberSchema,
|
|
263
296
|
hash: z.string(),
|
|
264
297
|
});
|
|
265
298
|
|
|
299
|
+
const L2CheckpointIdSchema = z.object({
|
|
300
|
+
number: CheckpointNumberSchema,
|
|
301
|
+
hash: z.string(),
|
|
302
|
+
});
|
|
303
|
+
|
|
304
|
+
const L2TipIdSchema = z.object({
|
|
305
|
+
block: L2BlockIdSchema,
|
|
306
|
+
checkpoint: L2CheckpointIdSchema,
|
|
307
|
+
});
|
|
308
|
+
|
|
266
309
|
export const L2TipsSchema = z.object({
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
310
|
+
proposed: L2BlockIdSchema,
|
|
311
|
+
checkpointed: L2TipIdSchema,
|
|
312
|
+
proven: L2TipIdSchema,
|
|
313
|
+
finalized: L2TipIdSchema,
|
|
270
314
|
});
|
|
271
315
|
|
|
272
316
|
export enum L2BlockSourceEvents {
|
|
273
317
|
L2PruneDetected = 'l2PruneDetected',
|
|
274
318
|
L2BlockProven = 'l2BlockProven',
|
|
275
|
-
|
|
319
|
+
L2BlocksCheckpointed = 'l2BlocksCheckpointed',
|
|
320
|
+
InvalidAttestationsCheckpointDetected = 'invalidCheckpointDetected',
|
|
276
321
|
}
|
|
277
322
|
|
|
278
323
|
export type L2BlockProvenEvent = {
|
|
@@ -285,10 +330,15 @@ export type L2BlockProvenEvent = {
|
|
|
285
330
|
export type L2BlockPruneEvent = {
|
|
286
331
|
type: 'l2PruneDetected';
|
|
287
332
|
epochNumber: EpochNumber;
|
|
288
|
-
blocks:
|
|
333
|
+
blocks: L2BlockNew[];
|
|
334
|
+
};
|
|
335
|
+
|
|
336
|
+
export type L2CheckpointEvent = {
|
|
337
|
+
type: 'l2BlocksCheckpointed';
|
|
338
|
+
checkpoint: PublishedCheckpoint;
|
|
289
339
|
};
|
|
290
340
|
|
|
291
|
-
export type
|
|
292
|
-
type: '
|
|
293
|
-
validationResult:
|
|
341
|
+
export type InvalidCheckpointDetectedEvent = {
|
|
342
|
+
type: 'invalidCheckpointDetected';
|
|
343
|
+
validationResult: ValidateCheckpointNegativeResult;
|
|
294
344
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
1
|
+
import type { PublishedCheckpoint } from '../../checkpoint/published_checkpoint.js';
|
|
2
|
+
import type { L2BlockNew } from '../l2_block_new.js';
|
|
3
|
+
import type { CheckpointId, L2BlockId, L2BlockPruneReason, L2Tips } from '../l2_block_source.js';
|
|
3
4
|
|
|
4
5
|
/** Interface to the local view of the chain. Implemented by world-state and l2-tips-store. */
|
|
5
6
|
export interface L2BlockStreamLocalDataProvider {
|
|
@@ -15,11 +16,18 @@ export interface L2BlockStreamEventHandler {
|
|
|
15
16
|
export type L2BlockStreamEvent =
|
|
16
17
|
| /** Emits blocks added to the chain. */ {
|
|
17
18
|
type: 'blocks-added';
|
|
18
|
-
blocks:
|
|
19
|
+
blocks: L2BlockNew[];
|
|
19
20
|
}
|
|
20
|
-
| /**
|
|
21
|
+
| /** Emits checkpoints published to L1. */ {
|
|
22
|
+
type: 'chain-checkpointed';
|
|
23
|
+
checkpoint: PublishedCheckpoint;
|
|
24
|
+
block: L2BlockId;
|
|
25
|
+
}
|
|
26
|
+
| /** Reports last correct block (new tip of the proposed chain). */ {
|
|
21
27
|
type: 'chain-pruned';
|
|
28
|
+
reason: L2BlockPruneReason;
|
|
22
29
|
block: L2BlockId;
|
|
30
|
+
checkpoint: CheckpointId;
|
|
23
31
|
}
|
|
24
32
|
| /** Reports new proven block. */ {
|
|
25
33
|
type: 'chain-proven';
|