@aztec/stdlib 0.0.1-commit.f295ac2 → 0.0.1-commit.fc805bf
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/block/block_hash.d.ts +16 -18
- package/dest/block/block_hash.d.ts.map +1 -1
- package/dest/block/block_hash.js +21 -31
- package/dest/block/block_parameter.d.ts +4 -4
- package/dest/block/block_parameter.d.ts.map +1 -1
- package/dest/block/block_parameter.js +2 -2
- package/dest/block/checkpointed_l2_block.d.ts +6 -6
- package/dest/block/checkpointed_l2_block.d.ts.map +1 -1
- package/dest/block/checkpointed_l2_block.js +3 -3
- package/dest/block/in_block.d.ts +11 -11
- package/dest/block/in_block.d.ts.map +1 -1
- package/dest/block/in_block.js +4 -4
- package/dest/block/index.d.ts +2 -2
- package/dest/block/index.d.ts.map +1 -1
- package/dest/block/index.js +1 -1
- package/dest/block/{l2_block_new.d.ts → l2_block.d.ts} +8 -7
- package/dest/block/l2_block.d.ts.map +1 -0
- package/dest/block/{l2_block_new.js → l2_block.js} +5 -9
- package/dest/block/l2_block_source.d.ts +39 -30
- package/dest/block/l2_block_source.d.ts.map +1 -1
- package/dest/block/l2_block_stream/interfaces.d.ts +3 -3
- package/dest/block/l2_block_stream/interfaces.d.ts.map +1 -1
- package/dest/block/l2_block_stream/l2_block_stream.d.ts +6 -3
- package/dest/block/l2_block_stream/l2_block_stream.d.ts.map +1 -1
- package/dest/block/l2_block_stream/l2_block_stream.js +37 -25
- package/dest/block/l2_block_stream/l2_tips_store_base.d.ts +3 -3
- package/dest/block/l2_block_stream/l2_tips_store_base.d.ts.map +1 -1
- package/dest/block/test/l2_tips_store_test_suite.js +2 -2
- package/dest/checkpoint/checkpoint.d.ts +8 -8
- package/dest/checkpoint/checkpoint.d.ts.map +1 -1
- package/dest/checkpoint/checkpoint.js +4 -4
- package/dest/checkpoint/published_checkpoint.d.ts +2 -2
- package/dest/config/node-rpc-config.js +1 -1
- package/dest/contract/contract_address.js +1 -1
- package/dest/contract/contract_class_id.d.ts +1 -1
- package/dest/contract/contract_class_id.js +1 -1
- package/dest/contract/private_function.d.ts +1 -1
- package/dest/contract/private_function.d.ts.map +1 -1
- package/dest/contract/private_function.js +2 -3
- package/dest/contract/private_function_membership_proof.d.ts +1 -1
- package/dest/contract/private_function_membership_proof.js +1 -1
- package/dest/database-version/database_version.d.ts +58 -0
- package/dest/database-version/database_version.d.ts.map +1 -0
- package/dest/database-version/database_version.js +69 -0
- package/dest/database-version/version_manager.d.ts +2 -50
- package/dest/database-version/version_manager.d.ts.map +1 -1
- package/dest/database-version/version_manager.js +1 -66
- package/dest/delayed_public_mutable/delayed_public_mutable_values.d.ts +2 -2
- package/dest/delayed_public_mutable/delayed_public_mutable_values.d.ts.map +1 -1
- package/dest/delayed_public_mutable/delayed_public_mutable_values.js +7 -10
- package/dest/epoch-helpers/index.d.ts +3 -1
- package/dest/epoch-helpers/index.d.ts.map +1 -1
- package/dest/epoch-helpers/index.js +5 -1
- package/dest/hash/hash.js +2 -2
- package/dest/hash/map_slot.d.ts +1 -1
- package/dest/hash/map_slot.d.ts.map +1 -1
- package/dest/hash/map_slot.js +4 -3
- 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 +1 -1
- package/dest/interfaces/archiver.d.ts.map +1 -1
- package/dest/interfaces/archiver.js +19 -18
- package/dest/interfaces/aztec-node-admin.d.ts +4 -1
- package/dest/interfaces/aztec-node-admin.d.ts.map +1 -1
- package/dest/interfaces/aztec-node.d.ts +64 -62
- package/dest/interfaces/aztec-node.d.ts.map +1 -1
- package/dest/interfaces/aztec-node.js +13 -17
- package/dest/interfaces/block-builder.d.ts +13 -7
- package/dest/interfaces/block-builder.d.ts.map +1 -1
- package/dest/interfaces/block-builder.js +7 -0
- package/dest/interfaces/configs.d.ts +2 -2
- package/dest/interfaces/configs.d.ts.map +1 -1
- package/dest/interfaces/get_logs_response.d.ts +7 -7
- package/dest/interfaces/l2_logs_source.d.ts +14 -5
- package/dest/interfaces/l2_logs_source.d.ts.map +1 -1
- package/dest/interfaces/prover-client.d.ts +10 -1
- package/dest/interfaces/prover-client.d.ts.map +1 -1
- package/dest/interfaces/prover-client.js +7 -1
- package/dest/interfaces/tx_provider.d.ts +3 -3
- package/dest/interfaces/tx_provider.d.ts.map +1 -1
- package/dest/interfaces/validator.d.ts +3 -3
- package/dest/interfaces/validator.d.ts.map +1 -1
- package/dest/kernel/hints/build_nullifier_read_request_hints.d.ts +3 -3
- package/dest/kernel/hints/build_nullifier_read_request_hints.d.ts.map +1 -1
- package/dest/kernel/hints/build_nullifier_read_request_hints.js +4 -6
- package/dest/keys/derivation.d.ts +3 -3
- package/dest/keys/derivation.js +8 -8
- package/dest/keys/key_types.d.ts +1 -1
- package/dest/keys/utils.d.ts +1 -1
- package/dest/keys/utils.d.ts.map +1 -1
- package/dest/keys/utils.js +7 -3
- package/dest/l1-contracts/slash_factory.d.ts +1 -1
- package/dest/l1-contracts/slash_factory.d.ts.map +1 -1
- package/dest/l1-contracts/slash_factory.js +1 -0
- package/dest/logs/extended_public_log.d.ts +6 -6
- package/dest/logs/log_id.d.ts +8 -8
- package/dest/logs/log_id.d.ts.map +1 -1
- package/dest/logs/log_id.js +6 -5
- package/dest/logs/siloed_tag.d.ts +1 -1
- package/dest/logs/siloed_tag.d.ts.map +1 -1
- package/dest/logs/siloed_tag.js +4 -3
- package/dest/p2p/block_proposal.d.ts +13 -6
- package/dest/p2p/block_proposal.d.ts.map +1 -1
- package/dest/p2p/block_proposal.js +1 -1
- package/dest/p2p/checkpoint_proposal.d.ts +10 -3
- package/dest/p2p/checkpoint_proposal.d.ts.map +1 -1
- package/dest/p2p/constants.d.ts +3 -0
- package/dest/p2p/constants.d.ts.map +1 -0
- package/dest/p2p/constants.js +2 -0
- package/dest/p2p/index.d.ts +2 -1
- package/dest/p2p/index.d.ts.map +1 -1
- package/dest/p2p/index.js +1 -0
- package/dest/p2p/message_validator.d.ts +18 -3
- package/dest/p2p/message_validator.d.ts.map +1 -1
- package/dest/p2p/message_validator.js +2 -1
- package/dest/stats/stats.d.ts +1 -3
- package/dest/stats/stats.d.ts.map +1 -1
- package/dest/tests/factories.js +1 -1
- package/dest/tests/jest.d.ts +4 -4
- package/dest/tests/jest.js +9 -9
- package/dest/tests/mocks.d.ts +15 -10
- package/dest/tests/mocks.d.ts.map +1 -1
- package/dest/tests/mocks.js +19 -13
- package/dest/tx/block_header.d.ts +3 -2
- package/dest/tx/block_header.d.ts.map +1 -1
- package/dest/tx/block_header.js +3 -2
- package/dest/tx/in_tx.d.ts +3 -3
- package/dest/tx/indexed_tx_effect.d.ts +5 -5
- package/dest/tx/indexed_tx_effect.d.ts.map +1 -1
- package/dest/tx/indexed_tx_effect.js +3 -2
- package/dest/tx/tx.d.ts +2 -1
- package/dest/tx/tx.d.ts.map +1 -1
- package/dest/tx/tx.js +6 -3
- package/dest/tx/tx_receipt.d.ts +42 -14
- package/dest/tx/tx_receipt.d.ts.map +1 -1
- package/dest/tx/tx_receipt.js +46 -15
- package/dest/tx/validator/error_texts.d.ts +2 -1
- package/dest/tx/validator/error_texts.d.ts.map +1 -1
- package/dest/tx/validator/error_texts.js +2 -0
- package/package.json +11 -10
- package/src/block/block_hash.ts +26 -47
- package/src/block/block_parameter.ts +3 -3
- package/src/block/checkpointed_l2_block.ts +4 -4
- package/src/block/in_block.ts +7 -7
- package/src/block/index.ts +1 -1
- package/src/block/{l2_block_new.ts → l2_block.ts} +8 -12
- package/src/block/l2_block_source.ts +40 -31
- package/src/block/l2_block_stream/interfaces.ts +2 -2
- package/src/block/l2_block_stream/l2_block_stream.ts +44 -27
- package/src/block/l2_block_stream/l2_tips_store_base.ts +2 -2
- package/src/block/test/l2_tips_store_test_suite.ts +4 -4
- package/src/checkpoint/checkpoint.ts +7 -7
- package/src/config/node-rpc-config.ts +1 -1
- package/src/contract/contract_address.ts +1 -1
- package/src/contract/contract_class_id.ts +1 -1
- package/src/contract/private_function.ts +2 -3
- package/src/contract/private_function_membership_proof.ts +1 -1
- package/src/database-version/database_version.ts +87 -0
- package/src/database-version/version_manager.ts +1 -77
- package/src/delayed_public_mutable/delayed_public_mutable_values.ts +9 -10
- package/src/epoch-helpers/index.ts +10 -1
- package/src/hash/hash.ts +2 -2
- package/src/hash/map_slot.ts +3 -2
- package/src/interfaces/api_limit.ts +1 -0
- package/src/interfaces/archiver.ts +19 -27
- package/src/interfaces/aztec-node.ts +89 -120
- package/src/interfaces/block-builder.ts +15 -5
- package/src/interfaces/configs.ts +1 -3
- package/src/interfaces/l2_logs_source.ts +17 -4
- package/src/interfaces/prover-client.ts +15 -0
- package/src/interfaces/tx_provider.ts +2 -2
- package/src/interfaces/validator.ts +2 -4
- package/src/kernel/hints/build_nullifier_read_request_hints.ts +1 -10
- package/src/keys/derivation.ts +8 -8
- package/src/keys/key_types.ts +1 -1
- package/src/keys/utils.ts +7 -3
- package/src/l1-contracts/slash_factory.ts +1 -0
- package/src/logs/log_id.ts +7 -6
- package/src/logs/siloed_tag.ts +3 -2
- package/src/p2p/block_proposal.ts +12 -5
- package/src/p2p/checkpoint_proposal.ts +9 -2
- package/src/p2p/constants.ts +3 -0
- package/src/p2p/index.ts +1 -0
- package/src/p2p/message_validator.ts +14 -2
- package/src/stats/stats.ts +0 -2
- package/src/tests/factories.ts +1 -1
- package/src/tests/jest.ts +9 -9
- package/src/tests/mocks.ts +26 -17
- package/src/tx/block_header.ts +7 -4
- package/src/tx/indexed_tx_effect.ts +3 -2
- package/src/tx/tx.ts +8 -9
- package/src/tx/tx_receipt.ts +75 -18
- package/src/tx/validator/error_texts.ts +3 -0
- package/dest/block/l2_block_new.d.ts.map +0 -1
- package/dest/database-version/index.d.ts +0 -2
- package/dest/database-version/index.d.ts.map +0 -1
- package/dest/database-version/index.js +0 -1
- package/src/database-version/index.ts +0 -1
package/dest/tx/tx_receipt.js
CHANGED
|
@@ -1,20 +1,33 @@
|
|
|
1
1
|
import { BlockNumberSchema } from '@aztec/foundation/branded-types';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import { RevertCode } from '../avm/revert_code.js';
|
|
4
|
-
import {
|
|
4
|
+
import { BlockHash } from '../block/block_hash.js';
|
|
5
5
|
import { schemas } from '../schemas/schemas.js';
|
|
6
6
|
import { TxHash } from './tx_hash.js';
|
|
7
|
-
/**
|
|
8
|
-
* Possible status of a transaction.
|
|
9
|
-
*/ export var TxStatus = /*#__PURE__*/ function(TxStatus) {
|
|
7
|
+
/** Block inclusion/finalization status. */ export var TxStatus = /*#__PURE__*/ function(TxStatus) {
|
|
10
8
|
TxStatus["DROPPED"] = "dropped";
|
|
11
9
|
TxStatus["PENDING"] = "pending";
|
|
12
|
-
TxStatus["
|
|
13
|
-
TxStatus["
|
|
14
|
-
TxStatus["
|
|
15
|
-
TxStatus["
|
|
10
|
+
TxStatus["PROPOSED"] = "proposed";
|
|
11
|
+
TxStatus["CHECKPOINTED"] = "checkpointed";
|
|
12
|
+
TxStatus["PROVEN"] = "proven";
|
|
13
|
+
TxStatus["FINALIZED"] = "finalized";
|
|
16
14
|
return TxStatus;
|
|
17
15
|
}({});
|
|
16
|
+
/** Tx status sorted by finalization progress. */ export const SortedTxStatuses = [
|
|
17
|
+
"dropped",
|
|
18
|
+
"pending",
|
|
19
|
+
"proposed",
|
|
20
|
+
"checkpointed",
|
|
21
|
+
"proven",
|
|
22
|
+
"finalized"
|
|
23
|
+
];
|
|
24
|
+
/** Execution result - only set when tx is in a block. */ export var TxExecutionResult = /*#__PURE__*/ function(TxExecutionResult) {
|
|
25
|
+
TxExecutionResult["SUCCESS"] = "success";
|
|
26
|
+
TxExecutionResult["APP_LOGIC_REVERTED"] = "app_logic_reverted";
|
|
27
|
+
TxExecutionResult["TEARDOWN_REVERTED"] = "teardown_reverted";
|
|
28
|
+
TxExecutionResult["BOTH_REVERTED"] = "both_reverted";
|
|
29
|
+
return TxExecutionResult;
|
|
30
|
+
}({});
|
|
18
31
|
/**
|
|
19
32
|
* Represents a transaction receipt in the Aztec network.
|
|
20
33
|
* Contains essential information about the transaction including its status, origin, and associated addresses.
|
|
@@ -23,35 +36,53 @@ import { TxHash } from './tx_hash.js';
|
|
|
23
36
|
*/ export class TxReceipt {
|
|
24
37
|
txHash;
|
|
25
38
|
status;
|
|
39
|
+
executionResult;
|
|
26
40
|
error;
|
|
27
41
|
transactionFee;
|
|
28
42
|
blockHash;
|
|
29
43
|
blockNumber;
|
|
30
|
-
constructor(/** A unique identifier for a transaction. */ txHash, /** The transaction's status. */ status, /** Description of transaction error, if any. */ error, /** The transaction fee paid for the transaction. */ transactionFee, /** The hash of the block containing the transaction. */ blockHash, /** The block number in which the transaction was included. */ blockNumber){
|
|
44
|
+
constructor(/** A unique identifier for a transaction. */ txHash, /** The transaction's block finalization status. */ status, /** The execution result of the transaction, only set when tx is in a block. */ executionResult, /** Description of transaction error, if any. */ error, /** The transaction fee paid for the transaction. */ transactionFee, /** The hash of the block containing the transaction. */ blockHash, /** The block number in which the transaction was included. */ blockNumber){
|
|
31
45
|
this.txHash = txHash;
|
|
32
46
|
this.status = status;
|
|
47
|
+
this.executionResult = executionResult;
|
|
33
48
|
this.error = error;
|
|
34
49
|
this.transactionFee = transactionFee;
|
|
35
50
|
this.blockHash = blockHash;
|
|
36
51
|
this.blockNumber = blockNumber;
|
|
37
52
|
}
|
|
53
|
+
/** Returns true if the transaction was executed successfully. */ hasExecutionSucceeded() {
|
|
54
|
+
return this.executionResult === "success";
|
|
55
|
+
}
|
|
56
|
+
/** Returns true if the transaction execution reverted. */ hasExecutionReverted() {
|
|
57
|
+
return this.executionResult !== undefined && this.executionResult !== "success";
|
|
58
|
+
}
|
|
59
|
+
/** Returns true if the transaction has been included in a block (proposed, checkpointed, proven, or finalized). */ isMined() {
|
|
60
|
+
return this.status === "proposed" || this.status === "checkpointed" || this.status === "proven" || this.status === "finalized";
|
|
61
|
+
}
|
|
62
|
+
/** Returns true if the transaction is pending. */ isPending() {
|
|
63
|
+
return this.status === "pending";
|
|
64
|
+
}
|
|
65
|
+
/** Returns true if the transaction was dropped. */ isDropped() {
|
|
66
|
+
return this.status === "dropped";
|
|
67
|
+
}
|
|
38
68
|
static empty() {
|
|
39
|
-
return new TxReceipt(TxHash.zero(), "dropped",
|
|
69
|
+
return new TxReceipt(TxHash.zero(), "dropped", undefined, undefined);
|
|
40
70
|
}
|
|
41
71
|
static get schema() {
|
|
42
72
|
return z.object({
|
|
43
73
|
txHash: TxHash.schema,
|
|
44
74
|
status: z.nativeEnum(TxStatus),
|
|
45
|
-
|
|
46
|
-
|
|
75
|
+
executionResult: z.nativeEnum(TxExecutionResult).optional(),
|
|
76
|
+
error: z.string().optional(),
|
|
77
|
+
blockHash: BlockHash.schema.optional(),
|
|
47
78
|
blockNumber: BlockNumberSchema.optional(),
|
|
48
79
|
transactionFee: schemas.BigInt.optional()
|
|
49
|
-
}).transform(TxReceipt.from);
|
|
80
|
+
}).transform((fields)=>TxReceipt.from(fields));
|
|
50
81
|
}
|
|
51
82
|
static from(fields) {
|
|
52
|
-
return new TxReceipt(fields.txHash, fields.status, fields.error, fields.transactionFee, fields.blockHash, fields.blockNumber);
|
|
83
|
+
return new TxReceipt(fields.txHash, fields.status, fields.executionResult, fields.error, fields.transactionFee, fields.blockHash, fields.blockNumber);
|
|
53
84
|
}
|
|
54
|
-
static
|
|
85
|
+
static executionResultFromRevertCode(revertCode) {
|
|
55
86
|
if (revertCode.equals(RevertCode.OK)) {
|
|
56
87
|
return "success";
|
|
57
88
|
} else if (revertCode.equals(RevertCode.APP_LOGIC_REVERTED)) {
|
|
@@ -19,6 +19,7 @@ export declare const TX_ERROR_CONTRACT_CLASS_LOG_LENGTH = "Incorrect contract cl
|
|
|
19
19
|
export declare const TX_ERROR_CONTRACT_CLASS_LOGS = "Mismatched contract class logs";
|
|
20
20
|
export declare const TX_ERROR_CONTRACT_CLASS_LOG_SORTING = "Incorrectly sorted contract class logs";
|
|
21
21
|
export declare const TX_ERROR_INCORRECT_HASH = "Incorrect tx hash";
|
|
22
|
+
export declare const TX_ERROR_SIZE_ABOVE_LIMIT = "Transaction size above size limit";
|
|
22
23
|
export declare const TX_ERROR_BLOCK_HEADER = "Block header not found";
|
|
23
24
|
export declare const TX_ERROR_DURING_VALIDATION = "Unexpected error during validation";
|
|
24
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
25
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZXJyb3JfdGV4dHMuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy90eC92YWxpZGF0b3IvZXJyb3JfdGV4dHMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQ0EsZUFBTyxNQUFNLGlDQUFpQyw2QkFBNkIsQ0FBQztBQUM1RSxlQUFPLE1BQU0sdUNBQXVDLG1DQUFtQyxDQUFDO0FBQ3hGLGVBQU8sTUFBTSwrQkFBK0IsOENBQThDLENBQUM7QUFDM0YsZUFBTyxNQUFNLDJCQUEyQix3RUFBd0UsQ0FBQztBQUdqSCxlQUFPLE1BQU0sbUNBQW1DLHFDQUFxQyxDQUFDO0FBR3RGLGVBQU8sTUFBTSxrQ0FBa0MsOEJBQThCLENBQUM7QUFDOUUsZUFBTyxNQUFNLDJCQUEyQix1QkFBdUIsQ0FBQztBQUdoRSxlQUFPLE1BQU0scUNBQXFDLGlDQUFpQyxDQUFDO0FBQ3BGLGVBQU8sTUFBTSw4QkFBOEIsMEJBQTBCLENBQUM7QUFDdEUsZUFBTyxNQUFNLGlDQUFpQyw2QkFBNkIsQ0FBQztBQUM1RSxlQUFPLE1BQU0sK0JBQStCLDBDQUEwQyxDQUFDO0FBQ3ZGLGVBQU8sTUFBTSwwQ0FBMEMsc0NBQXNDLENBQUM7QUFHOUYsZUFBTyxNQUFNLHNCQUFzQixrQkFBa0IsQ0FBQztBQUd0RCxlQUFPLE1BQU0sMkJBQTJCLHVDQUF1QyxDQUFDO0FBQ2hGLGVBQU8sTUFBTSxnQ0FBZ0MsOENBQThDLENBQUM7QUFDNUYsZUFBTyxNQUFNLGlDQUFpQyx1REFBdUQsQ0FBQztBQUN0RyxlQUFPLE1BQU0saUNBQWlDLDZDQUE2QyxDQUFDO0FBQzVGLGVBQU8sTUFBTSxrQ0FBa0MseUNBQXlDLENBQUM7QUFDekYsZUFBTyxNQUFNLDRCQUE0QixtQ0FBbUMsQ0FBQztBQUM3RSxlQUFPLE1BQU0sbUNBQW1DLDJDQUEyQyxDQUFDO0FBQzVGLGVBQU8sTUFBTSx1QkFBdUIsc0JBQXNCLENBQUM7QUFHM0QsZUFBTyxNQUFNLHlCQUF5QixzQ0FBc0MsQ0FBQztBQUc3RSxlQUFPLE1BQU0scUJBQXFCLDJCQUEyQixDQUFDO0FBRzlELGVBQU8sTUFBTSwwQkFBMEIsdUNBQXVDLENBQUMifQ==
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error_texts.d.ts","sourceRoot":"","sources":["../../../src/tx/validator/error_texts.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,iCAAiC,6BAA6B,CAAC;AAC5E,eAAO,MAAM,uCAAuC,mCAAmC,CAAC;AACxF,eAAO,MAAM,+BAA+B,8CAA8C,CAAC;AAC3F,eAAO,MAAM,2BAA2B,wEAAwE,CAAC;AAGjH,eAAO,MAAM,mCAAmC,qCAAqC,CAAC;AAGtF,eAAO,MAAM,kCAAkC,8BAA8B,CAAC;AAC9E,eAAO,MAAM,2BAA2B,uBAAuB,CAAC;AAGhE,eAAO,MAAM,qCAAqC,iCAAiC,CAAC;AACpF,eAAO,MAAM,8BAA8B,0BAA0B,CAAC;AACtE,eAAO,MAAM,iCAAiC,6BAA6B,CAAC;AAC5E,eAAO,MAAM,+BAA+B,0CAA0C,CAAC;AACvF,eAAO,MAAM,0CAA0C,sCAAsC,CAAC;AAG9F,eAAO,MAAM,sBAAsB,kBAAkB,CAAC;AAGtD,eAAO,MAAM,2BAA2B,uCAAuC,CAAC;AAChF,eAAO,MAAM,gCAAgC,8CAA8C,CAAC;AAC5F,eAAO,MAAM,iCAAiC,uDAAuD,CAAC;AACtG,eAAO,MAAM,iCAAiC,6CAA6C,CAAC;AAC5F,eAAO,MAAM,kCAAkC,yCAAyC,CAAC;AACzF,eAAO,MAAM,4BAA4B,mCAAmC,CAAC;AAC7E,eAAO,MAAM,mCAAmC,2CAA2C,CAAC;AAC5F,eAAO,MAAM,uBAAuB,sBAAsB,CAAC;AAG3D,eAAO,MAAM,qBAAqB,2BAA2B,CAAC;AAG9D,eAAO,MAAM,0BAA0B,uCAAuC,CAAC"}
|
|
1
|
+
{"version":3,"file":"error_texts.d.ts","sourceRoot":"","sources":["../../../src/tx/validator/error_texts.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,iCAAiC,6BAA6B,CAAC;AAC5E,eAAO,MAAM,uCAAuC,mCAAmC,CAAC;AACxF,eAAO,MAAM,+BAA+B,8CAA8C,CAAC;AAC3F,eAAO,MAAM,2BAA2B,wEAAwE,CAAC;AAGjH,eAAO,MAAM,mCAAmC,qCAAqC,CAAC;AAGtF,eAAO,MAAM,kCAAkC,8BAA8B,CAAC;AAC9E,eAAO,MAAM,2BAA2B,uBAAuB,CAAC;AAGhE,eAAO,MAAM,qCAAqC,iCAAiC,CAAC;AACpF,eAAO,MAAM,8BAA8B,0BAA0B,CAAC;AACtE,eAAO,MAAM,iCAAiC,6BAA6B,CAAC;AAC5E,eAAO,MAAM,+BAA+B,0CAA0C,CAAC;AACvF,eAAO,MAAM,0CAA0C,sCAAsC,CAAC;AAG9F,eAAO,MAAM,sBAAsB,kBAAkB,CAAC;AAGtD,eAAO,MAAM,2BAA2B,uCAAuC,CAAC;AAChF,eAAO,MAAM,gCAAgC,8CAA8C,CAAC;AAC5F,eAAO,MAAM,iCAAiC,uDAAuD,CAAC;AACtG,eAAO,MAAM,iCAAiC,6CAA6C,CAAC;AAC5F,eAAO,MAAM,kCAAkC,yCAAyC,CAAC;AACzF,eAAO,MAAM,4BAA4B,mCAAmC,CAAC;AAC7E,eAAO,MAAM,mCAAmC,2CAA2C,CAAC;AAC5F,eAAO,MAAM,uBAAuB,sBAAsB,CAAC;AAG3D,eAAO,MAAM,yBAAyB,sCAAsC,CAAC;AAG7E,eAAO,MAAM,qBAAqB,2BAA2B,CAAC;AAG9D,eAAO,MAAM,0BAA0B,uCAAuC,CAAC"}
|
|
@@ -25,6 +25,8 @@ export const TX_ERROR_CONTRACT_CLASS_LOG_LENGTH = 'Incorrect contract class logs
|
|
|
25
25
|
export const TX_ERROR_CONTRACT_CLASS_LOGS = 'Mismatched contract class logs';
|
|
26
26
|
export const TX_ERROR_CONTRACT_CLASS_LOG_SORTING = 'Incorrectly sorted contract class logs';
|
|
27
27
|
export const TX_ERROR_INCORRECT_HASH = 'Incorrect tx hash';
|
|
28
|
+
// Size
|
|
29
|
+
export const TX_ERROR_SIZE_ABOVE_LIMIT = 'Transaction size above size limit';
|
|
28
30
|
// Block header
|
|
29
31
|
export const TX_ERROR_BLOCK_HEADER = 'Block header not found';
|
|
30
32
|
// General
|
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.fc805bf",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"inherits": [
|
|
6
6
|
"../package.common.json",
|
|
@@ -52,7 +52,8 @@
|
|
|
52
52
|
"./epoch-helpers": "./dest/epoch-helpers/index.js",
|
|
53
53
|
"./config": "./dest/config/index.js",
|
|
54
54
|
"./testing/jest": "./dest/tests/jest.js",
|
|
55
|
-
"./database-version": "./dest/database-version/
|
|
55
|
+
"./database-version/version": "./dest/database-version/database_version.js",
|
|
56
|
+
"./database-version/manager": "./dest/database-version/version_manager.js",
|
|
56
57
|
"./validators": "./dest/validators/index.js",
|
|
57
58
|
"./file-store": "./dest/file-store/index.js",
|
|
58
59
|
"./snapshots": "./dest/snapshots/index.js",
|
|
@@ -78,14 +79,14 @@
|
|
|
78
79
|
},
|
|
79
80
|
"dependencies": {
|
|
80
81
|
"@aws-sdk/client-s3": "^3.892.0",
|
|
81
|
-
"@aztec/bb.js": "0.0.1-commit.
|
|
82
|
-
"@aztec/blob-lib": "0.0.1-commit.
|
|
83
|
-
"@aztec/constants": "0.0.1-commit.
|
|
84
|
-
"@aztec/ethereum": "0.0.1-commit.
|
|
85
|
-
"@aztec/foundation": "0.0.1-commit.
|
|
86
|
-
"@aztec/l1-artifacts": "0.0.1-commit.
|
|
87
|
-
"@aztec/noir-noirc_abi": "0.0.1-commit.
|
|
88
|
-
"@aztec/validator-ha-signer": "0.0.1-commit.
|
|
82
|
+
"@aztec/bb.js": "0.0.1-commit.fc805bf",
|
|
83
|
+
"@aztec/blob-lib": "0.0.1-commit.fc805bf",
|
|
84
|
+
"@aztec/constants": "0.0.1-commit.fc805bf",
|
|
85
|
+
"@aztec/ethereum": "0.0.1-commit.fc805bf",
|
|
86
|
+
"@aztec/foundation": "0.0.1-commit.fc805bf",
|
|
87
|
+
"@aztec/l1-artifacts": "0.0.1-commit.fc805bf",
|
|
88
|
+
"@aztec/noir-noirc_abi": "0.0.1-commit.fc805bf",
|
|
89
|
+
"@aztec/validator-ha-signer": "0.0.1-commit.fc805bf",
|
|
89
90
|
"@google-cloud/storage": "^7.15.0",
|
|
90
91
|
"axios": "^1.12.0",
|
|
91
92
|
"json-stringify-deterministic": "1.0.12",
|
package/src/block/block_hash.ts
CHANGED
|
@@ -1,66 +1,45 @@
|
|
|
1
|
-
import { Buffer32 } from '@aztec/foundation/buffer';
|
|
2
1
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
3
|
-
import {
|
|
2
|
+
import type { ZodFor } from '@aztec/foundation/schemas';
|
|
4
3
|
|
|
5
|
-
import {
|
|
4
|
+
import { inspect } from 'util';
|
|
6
5
|
|
|
7
|
-
|
|
8
|
-
export class L2BlockHash extends Buffer32 {
|
|
9
|
-
constructor(
|
|
10
|
-
/** The buffer containing the hash. */
|
|
11
|
-
hash: Buffer,
|
|
12
|
-
) {
|
|
13
|
-
super(hash);
|
|
14
|
-
}
|
|
6
|
+
import { hexSchemaFor } from '../schemas/schemas.js';
|
|
15
7
|
|
|
16
|
-
|
|
17
|
-
* Type guard that checks if a value is an L2BlockHash instance.
|
|
18
|
-
* Uses duck typing to handle cases where instanceof fails due to module duplication.
|
|
19
|
-
* Checks for Buffer32-like structure with a 32-byte buffer.
|
|
20
|
-
*/
|
|
21
|
-
static isL2BlockHash(value: unknown): value is L2BlockHash {
|
|
22
|
-
if (value instanceof L2BlockHash) {
|
|
23
|
-
return true;
|
|
24
|
-
}
|
|
25
|
-
// Duck typing fallback: check if it looks like a Buffer32 with a 32-byte buffer
|
|
26
|
-
// This helps when instanceof fails due to module duplication
|
|
27
|
-
return (
|
|
28
|
-
typeof value === 'object' &&
|
|
29
|
-
value !== null &&
|
|
30
|
-
'buffer' in value &&
|
|
31
|
-
Buffer.isBuffer((value as Buffer32).buffer) &&
|
|
32
|
-
(value as Buffer32).buffer.length === 32 &&
|
|
33
|
-
'toBuffer' in value &&
|
|
34
|
-
typeof (value as Buffer32).toBuffer === 'function'
|
|
35
|
-
);
|
|
36
|
-
}
|
|
8
|
+
const BLOCK_HASH_BRAND = Symbol.for('aztec.BlockHash');
|
|
37
9
|
|
|
38
|
-
|
|
39
|
-
|
|
10
|
+
/** Hash of an L2 block. */
|
|
11
|
+
export class BlockHash extends Fr {
|
|
12
|
+
readonly [BLOCK_HASH_BRAND] = true as const;
|
|
13
|
+
|
|
14
|
+
constructor(hash: Fr) {
|
|
15
|
+
super(hash);
|
|
40
16
|
}
|
|
41
17
|
|
|
42
|
-
|
|
43
|
-
return
|
|
18
|
+
override [inspect.custom]() {
|
|
19
|
+
return `BlockHash<${this.toString()}>`;
|
|
44
20
|
}
|
|
45
21
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
return new L2BlockHash(reader.readBytes(L2BlockHash.SIZE));
|
|
22
|
+
toFr(): Fr {
|
|
23
|
+
return new Fr(this.toBigInt());
|
|
49
24
|
}
|
|
50
25
|
|
|
51
|
-
|
|
52
|
-
|
|
26
|
+
/**
|
|
27
|
+
* Type guard that checks if a value is a BlockHash instance.
|
|
28
|
+
* Uses Symbol.for to ensure cross-module compatibility.
|
|
29
|
+
*/
|
|
30
|
+
static isBlockHash(value: unknown): value is BlockHash {
|
|
31
|
+
return typeof value === 'object' && value !== null && BLOCK_HASH_BRAND in value;
|
|
53
32
|
}
|
|
54
33
|
|
|
55
|
-
static
|
|
56
|
-
return
|
|
34
|
+
static override random() {
|
|
35
|
+
return new BlockHash(Fr.random());
|
|
57
36
|
}
|
|
58
37
|
|
|
59
|
-
static
|
|
60
|
-
return new
|
|
38
|
+
static override fromString(str: string): BlockHash {
|
|
39
|
+
return new BlockHash(Fr.fromString(str));
|
|
61
40
|
}
|
|
62
41
|
|
|
63
|
-
static override
|
|
64
|
-
return
|
|
42
|
+
static override get schema() {
|
|
43
|
+
return hexSchemaFor(BlockHash) as ZodFor<BlockHash>;
|
|
65
44
|
}
|
|
66
45
|
}
|
|
@@ -2,9 +2,9 @@ import { BlockNumberSchema } from '@aztec/foundation/branded-types';
|
|
|
2
2
|
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { BlockHash } from './block_hash.js';
|
|
6
6
|
|
|
7
|
-
export const BlockParameterSchema = z.union([
|
|
7
|
+
export const BlockParameterSchema = z.union([BlockHash.schema, BlockNumberSchema, z.literal('latest')]);
|
|
8
8
|
|
|
9
|
-
/** Block parameter - either a specific BlockNumber, block hash (
|
|
9
|
+
/** Block parameter - either a specific BlockNumber, block hash (BlockHash), or 'latest' */
|
|
10
10
|
export type BlockParameter = z.infer<typeof BlockParameterSchema>;
|
|
@@ -7,7 +7,7 @@ import { z } from 'zod';
|
|
|
7
7
|
|
|
8
8
|
import { L1PublishedData } from '../checkpoint/published_checkpoint.js';
|
|
9
9
|
import { MAX_BLOCK_HASH_STRING_LENGTH, MAX_COMMITTEE_SIZE } from '../deserialization/index.js';
|
|
10
|
-
import {
|
|
10
|
+
import { L2Block } from './l2_block.js';
|
|
11
11
|
import { CommitteeAttestation } from './proposal/committee_attestation.js';
|
|
12
12
|
|
|
13
13
|
/**
|
|
@@ -16,7 +16,7 @@ import { CommitteeAttestation } from './proposal/committee_attestation.js';
|
|
|
16
16
|
export class CheckpointedL2Block {
|
|
17
17
|
constructor(
|
|
18
18
|
public checkpointNumber: CheckpointNumber,
|
|
19
|
-
public block:
|
|
19
|
+
public block: L2Block,
|
|
20
20
|
public l1: L1PublishedData,
|
|
21
21
|
public attestations: CommitteeAttestation[],
|
|
22
22
|
) {}
|
|
@@ -24,7 +24,7 @@ export class CheckpointedL2Block {
|
|
|
24
24
|
return z
|
|
25
25
|
.object({
|
|
26
26
|
checkpointNumber: CheckpointNumberSchema,
|
|
27
|
-
block:
|
|
27
|
+
block: L2Block.schema,
|
|
28
28
|
l1: L1PublishedData.schema,
|
|
29
29
|
attestations: z.array(CommitteeAttestation.schema),
|
|
30
30
|
})
|
|
@@ -34,7 +34,7 @@ export class CheckpointedL2Block {
|
|
|
34
34
|
static fromBuffer(bufferOrReader: Buffer | BufferReader): CheckpointedL2Block {
|
|
35
35
|
const reader = BufferReader.asReader(bufferOrReader);
|
|
36
36
|
const checkpointNumber = reader.readNumber();
|
|
37
|
-
const block = reader.readObject(
|
|
37
|
+
const block = reader.readObject(L2Block);
|
|
38
38
|
const l1BlockNumber = reader.readBigInt();
|
|
39
39
|
const l1BlockHash = reader.readString(MAX_BLOCK_HASH_STRING_LENGTH);
|
|
40
40
|
const l1Timestamp = reader.readBigInt();
|
package/src/block/in_block.ts
CHANGED
|
@@ -2,12 +2,12 @@ import { BlockNumber, BlockNumberSchema } from '@aztec/foundation/branded-types'
|
|
|
2
2
|
|
|
3
3
|
import { type ZodTypeAny, z } from 'zod';
|
|
4
4
|
|
|
5
|
-
import {
|
|
6
|
-
import type {
|
|
5
|
+
import { BlockHash } from './block_hash.js';
|
|
6
|
+
import type { L2Block } from './l2_block.js';
|
|
7
7
|
|
|
8
8
|
export type InBlock = {
|
|
9
9
|
l2BlockNumber: BlockNumber;
|
|
10
|
-
l2BlockHash:
|
|
10
|
+
l2BlockHash: BlockHash;
|
|
11
11
|
};
|
|
12
12
|
|
|
13
13
|
// Note: If you expand this type with indexInBlock, then delete `IndexedTxEffect` and use this type instead.
|
|
@@ -18,7 +18,7 @@ export type DataInBlock<T> = {
|
|
|
18
18
|
export function randomInBlock(): InBlock {
|
|
19
19
|
return {
|
|
20
20
|
l2BlockNumber: BlockNumber(Math.floor(Math.random() * 1000)),
|
|
21
|
-
l2BlockHash:
|
|
21
|
+
l2BlockHash: BlockHash.random(),
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
24
|
|
|
@@ -29,18 +29,18 @@ export function randomDataInBlock<T>(data: T): DataInBlock<T> {
|
|
|
29
29
|
};
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
export async function wrapDataInBlock<T>(data: T, block:
|
|
32
|
+
export async function wrapDataInBlock<T>(data: T, block: L2Block): Promise<DataInBlock<T>> {
|
|
33
33
|
return {
|
|
34
34
|
data,
|
|
35
35
|
l2BlockNumber: block.number,
|
|
36
|
-
l2BlockHash:
|
|
36
|
+
l2BlockHash: await block.hash(),
|
|
37
37
|
};
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
export function inBlockSchema() {
|
|
41
41
|
return z.object({
|
|
42
42
|
l2BlockNumber: BlockNumberSchema,
|
|
43
|
-
l2BlockHash:
|
|
43
|
+
l2BlockHash: BlockHash.schema,
|
|
44
44
|
});
|
|
45
45
|
}
|
|
46
46
|
|
package/src/block/index.ts
CHANGED
|
@@ -15,18 +15,14 @@ import { z } from 'zod';
|
|
|
15
15
|
import type { PrivateLog } from '../logs/private_log.js';
|
|
16
16
|
import { AppendOnlyTreeSnapshot } from '../trees/append_only_tree_snapshot.js';
|
|
17
17
|
import { BlockHeader } from '../tx/block_header.js';
|
|
18
|
+
import type { BlockHash } from './block_hash.js';
|
|
18
19
|
import { Body } from './body.js';
|
|
19
20
|
import type { L2BlockInfo } from './l2_block_info.js';
|
|
20
21
|
|
|
21
|
-
// TODO(palla/mbps): Delete the existing `L2Block` class and rename this to `L2Block`.
|
|
22
|
-
// TODO(palla/mbps): Consider moving the checkpointNumber and indexWithinCheckpoint to the header:
|
|
23
|
-
// if the blockNumber is there, why not these as well? Consider whether they should be part of the
|
|
24
|
-
// circuits structs though.
|
|
25
|
-
|
|
26
22
|
/**
|
|
27
23
|
* An L2 block with a header and a body.
|
|
28
24
|
*/
|
|
29
|
-
export class
|
|
25
|
+
export class L2Block {
|
|
30
26
|
constructor(
|
|
31
27
|
/** Snapshot of archive tree after the block is applied. */
|
|
32
28
|
public archive: AppendOnlyTreeSnapshot,
|
|
@@ -63,7 +59,7 @@ export class L2BlockNew {
|
|
|
63
59
|
})
|
|
64
60
|
.transform(
|
|
65
61
|
({ archive, header, body, checkpointNumber, indexWithinCheckpoint }) =>
|
|
66
|
-
new
|
|
62
|
+
new L2Block(archive, header, body, checkpointNumber, indexWithinCheckpoint),
|
|
67
63
|
);
|
|
68
64
|
}
|
|
69
65
|
|
|
@@ -79,7 +75,7 @@ export class L2BlockNew {
|
|
|
79
75
|
const checkpointNumber = CheckpointNumber(reader.readNumber());
|
|
80
76
|
const indexWithinCheckpoint = IndexWithinCheckpoint(reader.readNumber());
|
|
81
77
|
|
|
82
|
-
return new
|
|
78
|
+
return new L2Block(archive, header, body, checkpointNumber, indexWithinCheckpoint);
|
|
83
79
|
}
|
|
84
80
|
|
|
85
81
|
/**
|
|
@@ -94,7 +90,7 @@ export class L2BlockNew {
|
|
|
94
90
|
* Returns the block's hash (hash of block header).
|
|
95
91
|
* @returns The block's hash.
|
|
96
92
|
*/
|
|
97
|
-
public hash(): Promise<
|
|
93
|
+
public hash(): Promise<BlockHash> {
|
|
98
94
|
return this.header.hash();
|
|
99
95
|
}
|
|
100
96
|
|
|
@@ -143,7 +139,7 @@ export class L2BlockNew {
|
|
|
143
139
|
}
|
|
144
140
|
|
|
145
141
|
static empty(header?: BlockHeader) {
|
|
146
|
-
return new
|
|
142
|
+
return new L2Block(
|
|
147
143
|
AppendOnlyTreeSnapshot.empty(),
|
|
148
144
|
header ?? BlockHeader.empty(),
|
|
149
145
|
Body.empty(),
|
|
@@ -177,11 +173,11 @@ export class L2BlockNew {
|
|
|
177
173
|
txOptions?: Partial<Parameters<typeof Body.random>[0]>;
|
|
178
174
|
makeTxOptions?: (txIndex: number) => Partial<Parameters<typeof Body.random>[0]>;
|
|
179
175
|
} & Partial<Parameters<typeof BlockHeader.random>[0]> = {},
|
|
180
|
-
): Promise<
|
|
176
|
+
): Promise<L2Block> {
|
|
181
177
|
const archive = new AppendOnlyTreeSnapshot(Fr.random(), blockNumber + 1);
|
|
182
178
|
const header = BlockHeader.random({ blockNumber, ...blockHeaderOverrides });
|
|
183
179
|
const body = await Body.random({ txsPerBlock, makeTxOptions, ...txOptions });
|
|
184
|
-
return new
|
|
180
|
+
return new L2Block(archive, header, body, checkpointNumber, indexWithinCheckpoint);
|
|
185
181
|
}
|
|
186
182
|
|
|
187
183
|
/**
|
|
@@ -20,8 +20,9 @@ import type { BlockHeader } from '../tx/block_header.js';
|
|
|
20
20
|
import type { IndexedTxEffect } from '../tx/indexed_tx_effect.js';
|
|
21
21
|
import type { TxHash } from '../tx/tx_hash.js';
|
|
22
22
|
import type { TxReceipt } from '../tx/tx_receipt.js';
|
|
23
|
+
import type { BlockHash } from './block_hash.js';
|
|
23
24
|
import type { CheckpointedL2Block } from './checkpointed_l2_block.js';
|
|
24
|
-
import type {
|
|
25
|
+
import type { L2Block } from './l2_block.js';
|
|
25
26
|
import type { ValidateCheckpointNegativeResult, ValidateCheckpointResult } from './validate_block_result.js';
|
|
26
27
|
|
|
27
28
|
/**
|
|
@@ -52,6 +53,20 @@ export interface L2BlockSource {
|
|
|
52
53
|
*/
|
|
53
54
|
getProvenBlockNumber(): Promise<BlockNumber>;
|
|
54
55
|
|
|
56
|
+
/**
|
|
57
|
+
* Gets the number of the latest L2 block checkpointed seen by the block source implementation.
|
|
58
|
+
* @returns The number of the latest L2 block checkpointed seen by the block source implementation.
|
|
59
|
+
*/
|
|
60
|
+
getCheckpointedL2BlockNumber(): Promise<BlockNumber>;
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Computes the finalized block number based on the proven block number.
|
|
64
|
+
* A block is considered finalized when it's 2 epochs behind the proven block.
|
|
65
|
+
* TODO(#13569): Compute proper finalized block number based on L1 finalized block.
|
|
66
|
+
* @returns The finalized block number.
|
|
67
|
+
*/
|
|
68
|
+
getFinalizedL2BlockNumber(): Promise<BlockNumber>;
|
|
69
|
+
|
|
55
70
|
/**
|
|
56
71
|
* Gets an l2 block header.
|
|
57
72
|
* @param number - The block number to return or 'latest' for the most recent one.
|
|
@@ -67,15 +82,15 @@ export interface L2BlockSource {
|
|
|
67
82
|
*/
|
|
68
83
|
getCheckpointedBlock(number: BlockNumber): Promise<CheckpointedL2Block | undefined>;
|
|
69
84
|
|
|
70
|
-
getCheckpointedBlocks(from: BlockNumber, limit: number
|
|
85
|
+
getCheckpointedBlocks(from: BlockNumber, limit: number): Promise<CheckpointedL2Block[]>;
|
|
71
86
|
|
|
72
87
|
/**
|
|
73
|
-
* Retrieves a collection of
|
|
74
|
-
* @param checkpointNumber The first checkpoint to be retrieved
|
|
75
|
-
* @param limit The number of checkpoints to be retrieved
|
|
76
|
-
* @returns The collection of complete checkpoints
|
|
88
|
+
* Retrieves a collection of checkpoints.
|
|
89
|
+
* @param checkpointNumber The first checkpoint to be retrieved.
|
|
90
|
+
* @param limit The number of checkpoints to be retrieved.
|
|
91
|
+
* @returns The collection of complete checkpoints.
|
|
77
92
|
*/
|
|
78
|
-
|
|
93
|
+
getCheckpoints(checkpointNumber: CheckpointNumber, limit: number): Promise<PublishedCheckpoint[]>;
|
|
79
94
|
|
|
80
95
|
/**
|
|
81
96
|
* Gets the checkpoints for a given epoch
|
|
@@ -88,7 +103,7 @@ export interface L2BlockSource {
|
|
|
88
103
|
* @param blockHash - The block hash to retrieve.
|
|
89
104
|
* @returns The requested block header (or undefined if not found).
|
|
90
105
|
*/
|
|
91
|
-
getBlockHeaderByHash(blockHash:
|
|
106
|
+
getBlockHeaderByHash(blockHash: BlockHash): Promise<BlockHeader | undefined>;
|
|
92
107
|
|
|
93
108
|
/**
|
|
94
109
|
* Gets a block header by its archive root.
|
|
@@ -102,21 +117,21 @@ export interface L2BlockSource {
|
|
|
102
117
|
* @param number - The block number to return.
|
|
103
118
|
* @returns The requested L2 block (or undefined if not found).
|
|
104
119
|
*/
|
|
105
|
-
|
|
120
|
+
getL2Block(number: BlockNumber): Promise<L2Block | undefined>;
|
|
106
121
|
|
|
107
122
|
/**
|
|
108
123
|
* Gets an L2 block by its hash.
|
|
109
124
|
* @param blockHash - The block hash to retrieve.
|
|
110
125
|
* @returns The requested L2 block (or undefined if not found).
|
|
111
126
|
*/
|
|
112
|
-
|
|
127
|
+
getL2BlockByHash(blockHash: BlockHash): Promise<L2Block | undefined>;
|
|
113
128
|
|
|
114
129
|
/**
|
|
115
130
|
* Gets an L2 block by its archive root.
|
|
116
131
|
* @param archive - The archive root to retrieve.
|
|
117
132
|
* @returns The requested L2 block (or undefined if not found).
|
|
118
133
|
*/
|
|
119
|
-
|
|
134
|
+
getL2BlockByArchive(archive: Fr): Promise<L2Block | undefined>;
|
|
120
135
|
|
|
121
136
|
/**
|
|
122
137
|
* Gets a tx effect.
|
|
@@ -143,11 +158,11 @@ export interface L2BlockSource {
|
|
|
143
158
|
getL2EpochNumber(): Promise<EpochNumber | undefined>;
|
|
144
159
|
|
|
145
160
|
/**
|
|
146
|
-
* Returns all block headers for a given epoch.
|
|
161
|
+
* Returns all checkpointed block headers for a given epoch.
|
|
147
162
|
* @dev Use this method only with recent epochs, since it walks the block list backwards.
|
|
148
163
|
* @param epochNumber - The epoch number to return headers for.
|
|
149
164
|
*/
|
|
150
|
-
|
|
165
|
+
getCheckpointedBlockHeadersForEpoch(epochNumber: EpochNumber): Promise<BlockHeader[]>;
|
|
151
166
|
|
|
152
167
|
/**
|
|
153
168
|
* Returns whether the given epoch is completed on L1, based on the current L1 and L2 block numbers.
|
|
@@ -193,49 +208,43 @@ export interface L2BlockSource {
|
|
|
193
208
|
* @param number - The block number to return (inclusive).
|
|
194
209
|
* @returns The requested L2 block.
|
|
195
210
|
*/
|
|
196
|
-
getBlock(number: BlockNumber): Promise<
|
|
197
|
-
|
|
198
|
-
getL2BlocksNew(from: BlockNumber, limit: number, proven?: boolean): Promise<L2BlockNew[]>;
|
|
211
|
+
getBlock(number: BlockNumber): Promise<L2Block | undefined>;
|
|
199
212
|
|
|
200
213
|
/**
|
|
201
|
-
* Returns all blocks for a given epoch.
|
|
214
|
+
* Returns all checkpointed blocks for a given epoch.
|
|
202
215
|
* @dev Use this method only with recent epochs, since it walks the block list backwards.
|
|
203
216
|
* @param epochNumber - The epoch number to return blocks for.
|
|
204
217
|
*/
|
|
205
|
-
|
|
218
|
+
getCheckpointedBlocksForEpoch(epochNumber: EpochNumber): Promise<CheckpointedL2Block[]>;
|
|
206
219
|
|
|
207
220
|
/**
|
|
208
221
|
* Returns all blocks for a given slot.
|
|
209
222
|
* @dev Use this method only with recent slots, since it walks the block list backwards.
|
|
210
223
|
* @param slotNumber - The slot number to return blocks for.
|
|
211
224
|
*/
|
|
212
|
-
getBlocksForSlot(slotNumber: SlotNumber): Promise<
|
|
225
|
+
getBlocksForSlot(slotNumber: SlotNumber): Promise<L2Block[]>;
|
|
213
226
|
|
|
214
227
|
/**
|
|
215
|
-
* Gets a
|
|
228
|
+
* Gets a checkpointed block by its block hash.
|
|
216
229
|
* @param blockHash - The block hash to retrieve.
|
|
217
230
|
* @returns The requested block (or undefined if not found).
|
|
218
231
|
*/
|
|
219
|
-
|
|
232
|
+
getCheckpointedBlockByHash(blockHash: BlockHash): Promise<CheckpointedL2Block | undefined>;
|
|
220
233
|
|
|
221
234
|
/**
|
|
222
|
-
* Gets a
|
|
235
|
+
* Gets a checkpointed block by its archive root.
|
|
223
236
|
* @param archive - The archive root to retrieve.
|
|
224
237
|
* @returns The requested block (or undefined if not found).
|
|
225
238
|
*/
|
|
226
|
-
|
|
239
|
+
getCheckpointedBlockByArchive(archive: Fr): Promise<CheckpointedL2Block | undefined>;
|
|
227
240
|
|
|
228
241
|
/**
|
|
229
242
|
* Gets up to `limit` amount of L2 blocks starting from `from`.
|
|
230
243
|
* @param from - Number of the first block to return (inclusive).
|
|
231
244
|
* @param limit - The maximum number of blocks to return.
|
|
232
|
-
* @param proven - If true, only return blocks that have been proven.
|
|
233
245
|
* @returns The requested L2 blocks.
|
|
234
246
|
*/
|
|
235
|
-
getBlocks(from: BlockNumber, limit: number
|
|
236
|
-
|
|
237
|
-
/** Equivalent to getBlocks but includes publish data. */
|
|
238
|
-
getPublishedBlocks(from: BlockNumber, limit: number, proven?: boolean): Promise<CheckpointedL2Block[]>;
|
|
247
|
+
getBlocks(from: BlockNumber, limit: number): Promise<L2Block[]>;
|
|
239
248
|
}
|
|
240
249
|
|
|
241
250
|
/**
|
|
@@ -247,7 +256,7 @@ export interface L2BlockSink {
|
|
|
247
256
|
* @param block - The L2 block to add.
|
|
248
257
|
* @throws If block number is not incremental (i.e., not exactly one more than the last stored block).
|
|
249
258
|
*/
|
|
250
|
-
addBlock(block:
|
|
259
|
+
addBlock(block: L2Block): Promise<void>;
|
|
251
260
|
}
|
|
252
261
|
|
|
253
262
|
/**
|
|
@@ -344,13 +353,13 @@ export type L2BlockProvenEvent = {
|
|
|
344
353
|
export type L2PruneUnprovenEvent = {
|
|
345
354
|
type: 'l2PruneUnproven';
|
|
346
355
|
epochNumber: EpochNumber;
|
|
347
|
-
blocks:
|
|
356
|
+
blocks: L2Block[];
|
|
348
357
|
};
|
|
349
358
|
|
|
350
359
|
export type L2PruneUncheckpointedEvent = {
|
|
351
360
|
type: 'l2PruneUncheckpointed';
|
|
352
361
|
slotNumber: SlotNumber;
|
|
353
|
-
blocks:
|
|
362
|
+
blocks: L2Block[];
|
|
354
363
|
};
|
|
355
364
|
|
|
356
365
|
export type L2CheckpointEvent = {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { PublishedCheckpoint } from '../../checkpoint/published_checkpoint.js';
|
|
2
|
-
import type {
|
|
2
|
+
import type { L2Block } from '../l2_block.js';
|
|
3
3
|
import type { CheckpointId, L2BlockId, L2Tips } from '../l2_block_source.js';
|
|
4
4
|
|
|
5
5
|
/** Interface to the local view of the chain. Implemented by world-state and l2-tips-store. */
|
|
@@ -16,7 +16,7 @@ export interface L2BlockStreamEventHandler {
|
|
|
16
16
|
export type L2BlockStreamEvent =
|
|
17
17
|
| /** Emits blocks added to the chain. */ {
|
|
18
18
|
type: 'blocks-added';
|
|
19
|
-
blocks:
|
|
19
|
+
blocks: L2Block[];
|
|
20
20
|
}
|
|
21
21
|
| /** Emits checkpoints published to L1. */ {
|
|
22
22
|
type: 'chain-checkpointed';
|