@aztec/stdlib 0.84.0 → 0.85.0
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/avm/avm.d.ts +2474 -284
- package/dest/avm/avm.d.ts.map +1 -1
- package/dest/avm/avm.js +116 -17
- package/dest/avm/avm_proving_request.d.ts +1071 -23
- package/dest/avm/avm_proving_request.d.ts.map +1 -1
- package/dest/block/in_block.d.ts.map +1 -1
- package/dest/block/index.d.ts +1 -1
- package/dest/block/index.d.ts.map +1 -1
- package/dest/block/index.js +1 -1
- package/dest/block/l2_block_source.d.ts +8 -5
- package/dest/block/l2_block_source.d.ts.map +1 -1
- package/dest/block/l2_block_source.js +9 -0
- package/dest/block/l2_block_stream/index.d.ts +4 -0
- package/dest/block/l2_block_stream/index.d.ts.map +1 -0
- package/dest/block/l2_block_stream/index.js +3 -0
- package/dest/block/l2_block_stream/interfaces.d.ts +26 -0
- package/dest/block/l2_block_stream/interfaces.d.ts.map +1 -0
- package/dest/block/l2_block_stream/interfaces.js +1 -0
- package/dest/block/{l2_block_downloader → l2_block_stream}/l2_block_stream.d.ts +4 -24
- package/dest/block/l2_block_stream/l2_block_stream.d.ts.map +1 -0
- package/dest/block/{l2_block_downloader → l2_block_stream}/l2_block_stream.js +29 -10
- package/dest/block/l2_block_stream/l2_tips_memory_store.d.ts +18 -0
- package/dest/block/l2_block_stream/l2_tips_memory_store.d.ts.map +1 -0
- package/dest/block/l2_block_stream/l2_tips_memory_store.js +70 -0
- package/dest/block/test/index.d.ts +2 -0
- package/dest/block/test/index.d.ts.map +1 -0
- package/dest/block/test/index.js +1 -0
- package/dest/block/test/l2_tips_store_test_suite.d.ts +3 -0
- package/dest/block/test/l2_tips_store_test_suite.d.ts.map +1 -0
- package/dest/block/test/l2_tips_store_test_suite.js +107 -0
- package/dest/database-version/version_manager.d.ts +21 -5
- package/dest/database-version/version_manager.d.ts.map +1 -1
- package/dest/database-version/version_manager.js +25 -15
- package/dest/epoch-helpers/index.d.ts +9 -0
- package/dest/epoch-helpers/index.d.ts.map +1 -1
- package/dest/epoch-helpers/index.js +15 -2
- package/dest/interfaces/archiver.d.ts.map +1 -1
- package/dest/interfaces/archiver.js +4 -4
- package/dest/interfaces/aztec-node.d.ts +5 -6
- package/dest/interfaces/aztec-node.d.ts.map +1 -1
- package/dest/interfaces/aztec-node.js +2 -3
- package/dest/interfaces/proving-job.d.ts +1071 -23
- package/dest/interfaces/proving-job.d.ts.map +1 -1
- package/dest/interfaces/pxe.d.ts +5 -7
- package/dest/interfaces/pxe.d.ts.map +1 -1
- package/dest/interfaces/pxe.js +2 -7
- package/dest/interfaces/world_state.d.ts +3 -2
- package/dest/interfaces/world_state.d.ts.map +1 -1
- package/dest/logs/log_with_tx_data.d.ts +3 -2
- package/dest/logs/log_with_tx_data.d.ts.map +1 -1
- package/dest/logs/log_with_tx_data.js +3 -2
- package/dest/logs/pending_tagged_log.d.ts +4 -2
- package/dest/logs/pending_tagged_log.d.ts.map +1 -1
- package/dest/logs/pending_tagged_log.js +6 -3
- package/dest/messaging/l1_to_l2_message_source.d.ts +5 -0
- package/dest/messaging/l1_to_l2_message_source.d.ts.map +1 -1
- package/dest/proofs/proof.d.ts +4 -1
- package/dest/proofs/proof.d.ts.map +1 -1
- package/dest/proofs/proof.js +9 -17
- package/dest/tests/factories.d.ts +5 -1
- package/dest/tests/factories.d.ts.map +1 -1
- package/dest/tests/factories.js +23 -7
- package/dest/tests/mocks.d.ts +3 -1
- package/dest/tests/mocks.d.ts.map +1 -1
- package/dest/tests/mocks.js +3 -2
- package/dest/tx/index.d.ts +2 -0
- package/dest/tx/index.d.ts.map +1 -1
- package/dest/tx/index.js +2 -0
- package/dest/tx/indexed_tx_effect.d.ts +24 -0
- package/dest/tx/indexed_tx_effect.d.ts.map +1 -0
- package/dest/tx/indexed_tx_effect.js +14 -0
- package/dest/tx/tx_hash.d.ts.map +1 -1
- package/dest/tx/tx_hash.js +1 -4
- package/dest/tx/validator/error_texts.d.ts +20 -0
- package/dest/tx/validator/error_texts.d.ts.map +1 -0
- package/dest/tx/validator/error_texts.js +27 -0
- package/package.json +8 -6
- package/src/avm/avm.ts +188 -29
- package/src/block/in_block.ts +1 -0
- package/src/block/index.ts +1 -1
- package/src/block/l2_block_source.ts +15 -5
- package/src/block/l2_block_stream/index.ts +3 -0
- package/src/block/l2_block_stream/interfaces.ts +33 -0
- package/src/block/{l2_block_downloader → l2_block_stream}/l2_block_stream.ts +34 -44
- package/src/block/l2_block_stream/l2_tips_memory_store.ts +75 -0
- package/src/block/test/index.ts +1 -0
- package/src/block/test/l2_tips_store_test_suite.ts +87 -0
- package/src/database-version/version_manager.ts +56 -17
- package/src/epoch-helpers/index.ts +19 -0
- package/src/interfaces/archiver.ts +3 -3
- package/src/interfaces/aztec-node.ts +7 -6
- package/src/interfaces/pxe.ts +15 -11
- package/src/interfaces/world_state.ts +3 -2
- package/src/logs/log_with_tx_data.ts +4 -3
- package/src/logs/pending_tagged_log.ts +5 -2
- package/src/messaging/l1_to_l2_message_source.ts +7 -0
- package/src/proofs/proof.ts +9 -19
- package/src/tests/factories.ts +54 -4
- package/src/tests/mocks.ts +6 -1
- package/src/tx/index.ts +2 -0
- package/src/tx/indexed_tx_effect.ts +17 -0
- package/src/tx/tx_hash.ts +0 -4
- package/src/tx/validator/error_texts.ts +34 -0
- package/dest/block/l2_block_downloader/index.d.ts +0 -3
- package/dest/block/l2_block_downloader/index.d.ts.map +0 -1
- package/dest/block/l2_block_downloader/index.js +0 -2
- package/dest/block/l2_block_downloader/l2_block_downloader.d.ts +0 -58
- package/dest/block/l2_block_downloader/l2_block_downloader.d.ts.map +0 -1
- package/dest/block/l2_block_downloader/l2_block_downloader.js +0 -124
- package/dest/block/l2_block_downloader/l2_block_stream.d.ts.map +0 -1
- package/src/block/l2_block_downloader/index.ts +0 -2
- package/src/block/l2_block_downloader/l2_block_downloader.ts +0 -149
package/dest/tx/index.js
CHANGED
|
@@ -24,6 +24,8 @@ export * from './public_simulation_output.js';
|
|
|
24
24
|
export * from './tx_execution_request.js';
|
|
25
25
|
export * from './validator/tx_validator.js';
|
|
26
26
|
export * from './validator/empty_validator.js';
|
|
27
|
+
export * from './validator/error_texts.js';
|
|
27
28
|
export * from './capsule.js';
|
|
28
29
|
export * from './global_variable_builder.js';
|
|
29
30
|
export * from './hashed_values.js';
|
|
31
|
+
export * from './indexed_tx_effect.js';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type InBlock } from '../block/in_block.js';
|
|
2
|
+
import { TxEffect } from './tx_effect.js';
|
|
3
|
+
export type IndexedTxEffect = InBlock<TxEffect> & {
|
|
4
|
+
txIndexInBlock: number;
|
|
5
|
+
};
|
|
6
|
+
export declare function indexedTxSchema(): import("zod").ZodObject<import("zod").objectUtil.extendShape<{
|
|
7
|
+
data: import("@aztec/foundation/schemas").ZodFor<TxEffect>;
|
|
8
|
+
l2BlockNumber: import("zod").ZodPipeline<import("zod").ZodUnion<[import("zod").ZodBigInt, import("zod").ZodNumber, import("zod").ZodString]>, import("zod").ZodNumber>;
|
|
9
|
+
l2BlockHash: import("zod").ZodString;
|
|
10
|
+
}, {
|
|
11
|
+
txIndexInBlock: import("zod").ZodPipeline<import("zod").ZodUnion<[import("zod").ZodBigInt, import("zod").ZodNumber, import("zod").ZodString]>, import("zod").ZodNumber>;
|
|
12
|
+
}>, "strip", import("zod").ZodTypeAny, {
|
|
13
|
+
data: TxEffect;
|
|
14
|
+
l2BlockNumber: number;
|
|
15
|
+
l2BlockHash: string;
|
|
16
|
+
txIndexInBlock: number;
|
|
17
|
+
}, {
|
|
18
|
+
l2BlockNumber: string | number | bigint;
|
|
19
|
+
l2BlockHash: string;
|
|
20
|
+
txIndexInBlock: string | number | bigint;
|
|
21
|
+
data?: any;
|
|
22
|
+
}>;
|
|
23
|
+
export declare function randomIndexedTxEffect(): Promise<IndexedTxEffect>;
|
|
24
|
+
//# sourceMappingURL=indexed_tx_effect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"indexed_tx_effect.d.ts","sourceRoot":"","sources":["../../src/tx/indexed_tx_effect.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,OAAO,EAAmC,MAAM,sBAAsB,CAAC;AACrF,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C,MAAM,MAAM,eAAe,GAAG,OAAO,CAAC,QAAQ,CAAC,GAAG;IAAE,cAAc,EAAE,MAAM,CAAA;CAAE,CAAC;AAE7E,wBAAgB,eAAe;;;;;;;;;;;;;;;;GAE9B;AAED,wBAAsB,qBAAqB,IAAI,OAAO,CAAC,eAAe,CAAC,CAKtE"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { schemas } from '@aztec/foundation/schemas';
|
|
2
|
+
import { inBlockSchemaFor, randomInBlock } from '../block/in_block.js';
|
|
3
|
+
import { TxEffect } from './tx_effect.js';
|
|
4
|
+
export function indexedTxSchema() {
|
|
5
|
+
return inBlockSchemaFor(TxEffect.schema).extend({
|
|
6
|
+
txIndexInBlock: schemas.Integer
|
|
7
|
+
});
|
|
8
|
+
}
|
|
9
|
+
export async function randomIndexedTxEffect() {
|
|
10
|
+
return {
|
|
11
|
+
...randomInBlock(await TxEffect.random()),
|
|
12
|
+
txIndexInBlock: Math.floor(Math.random() * 1000)
|
|
13
|
+
};
|
|
14
|
+
}
|
package/dest/tx/tx_hash.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tx_hash.d.ts","sourceRoot":"","sources":["../../src/tx/tx_hash.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAI3D;;GAEG;AACH,qBAAa,MAAM;IAEf,mGAAmG;aACnF,IAAI,EAAE,EAAE;;IADxB,mGAAmG;IACnF,IAAI,EAAE,EAAE;
|
|
1
|
+
{"version":3,"file":"tx_hash.d.ts","sourceRoot":"","sources":["../../src/tx/tx_hash.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAI3D;;GAEG;AACH,qBAAa,MAAM;IAEf,mGAAmG;aACnF,IAAI,EAAE,EAAE;;IADxB,mGAAmG;IACnF,IAAI,EAAE,EAAE;IAG1B,MAAM,CAAC,MAAM;IAIb,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,UAAU,GAAG,YAAY;IAKnD,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,MAAM;IAI7B,MAAM,CAAC,UAAU,CAAC,KAAK,EAAE,MAAM;IAIxB,QAAQ;IAIR,QAAQ;IAIR,QAAQ;IAIf,MAAM;IAIC,MAAM,CAAC,KAAK,EAAE,MAAM;IAI3B,MAAM,KAAK,MAAM,oMAEhB;IAED,MAAM,CAAC,IAAI;IAIX,MAAM,KAAK,IAAI,WAEd;CACF"}
|
package/dest/tx/tx_hash.js
CHANGED
|
@@ -8,10 +8,7 @@ import { schemas } from '../schemas/index.js';
|
|
|
8
8
|
constructor(/** A field representing the tx hash (tx hash is an output of poseidon hash hence it's a field). */ hash){
|
|
9
9
|
this.hash = hash;
|
|
10
10
|
}
|
|
11
|
-
|
|
12
|
-
* TxHashes are generated from the first nullifier of a transaction, which is a Fr.
|
|
13
|
-
* @returns A random TxHash.
|
|
14
|
-
*/ static random() {
|
|
11
|
+
static random() {
|
|
15
12
|
return new TxHash(Fr.random());
|
|
16
13
|
}
|
|
17
14
|
static fromBuffer(buffer) {
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export declare const TX_ERROR_INSUFFICIENT_FEE_PER_GAS = "Insufficient fee per gas";
|
|
2
|
+
export declare const TX_ERROR_INSUFFICIENT_FEE_PAYER_BALANCE = "Insufficient fee payer balance";
|
|
3
|
+
export declare const TX_ERROR_INSUFFICIENT_GAS_LIMIT = "Gas limit is below the minimum fixed cost";
|
|
4
|
+
export declare const TX_ERROR_SETUP_FUNCTION_NOT_ALLOWED = "Setup function not on allow list";
|
|
5
|
+
export declare const TX_ERROR_DUPLICATE_NULLIFIER_IN_TX = "Duplicate nullifier in tx";
|
|
6
|
+
export declare const TX_ERROR_EXISTING_NULLIFIER = "Existing nullifier";
|
|
7
|
+
export declare const TX_ERROR_INVALID_BLOCK_NUMBER = "Invalid block number";
|
|
8
|
+
export declare const TX_ERROR_INCORRECT_CHAIN_ID = "Incorrect chain id";
|
|
9
|
+
export declare const TX_ERROR_INCORRECT_ROLLUP_VERSION = "Incorrect rollup version";
|
|
10
|
+
export declare const TX_ERROR_INVALID_PROOF = "Invalid proof";
|
|
11
|
+
export declare const TX_ERROR_INCORRECT_CALLDATA = "Incorrect calldata for public call";
|
|
12
|
+
export declare const TX_ERROR_CALLDATA_COUNT_MISMATCH = "Wrong number of calldata for public calls";
|
|
13
|
+
export declare const TX_ERROR_CALLDATA_COUNT_TOO_LARGE = "Total calldata too large for enqueued public calls";
|
|
14
|
+
export declare const TX_ERROR_CONTRACT_CLASS_LOG_COUNT = "Mismatched number of contract class logs";
|
|
15
|
+
export declare const TX_ERROR_CONTRACT_CLASS_LOG_LENGTH = "Mismatched contract class logs length";
|
|
16
|
+
export declare const TX_ERROR_CONTRACT_CLASS_LOGS = "Mismatched contract class logs";
|
|
17
|
+
export declare const TX_ERROR_CONTRACT_CLASS_LOG_SORTING = "Incorrectly sorted contract class logs";
|
|
18
|
+
export declare const TX_ERROR_BLOCK_HEADER = "Block header not found";
|
|
19
|
+
export declare const TX_ERROR_DURING_VALIDATION = "Unexpected error during validation";
|
|
20
|
+
//# sourceMappingURL=error_texts.d.ts.map
|
|
@@ -0,0 +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;AAG3F,eAAO,MAAM,mCAAmC,qCAAqC,CAAC;AAGtF,eAAO,MAAM,kCAAkC,8BAA8B,CAAC;AAC9E,eAAO,MAAM,2BAA2B,uBAAuB,CAAC;AAGhE,eAAO,MAAM,6BAA6B,yBAAyB,CAAC;AACpE,eAAO,MAAM,2BAA2B,uBAAuB,CAAC;AAChE,eAAO,MAAM,iCAAiC,6BAA6B,CAAC;AAG5E,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,0CAA0C,CAAC;AAC1F,eAAO,MAAM,4BAA4B,mCAAmC,CAAC;AAC7E,eAAO,MAAM,mCAAmC,2CAA2C,CAAC;AAG5F,eAAO,MAAM,qBAAqB,2BAA2B,CAAC;AAG9D,eAAO,MAAM,0BAA0B,uCAAuC,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// Gas and fees
|
|
2
|
+
export const TX_ERROR_INSUFFICIENT_FEE_PER_GAS = 'Insufficient fee per gas';
|
|
3
|
+
export const TX_ERROR_INSUFFICIENT_FEE_PAYER_BALANCE = 'Insufficient fee payer balance';
|
|
4
|
+
export const TX_ERROR_INSUFFICIENT_GAS_LIMIT = 'Gas limit is below the minimum fixed cost';
|
|
5
|
+
// Phases
|
|
6
|
+
export const TX_ERROR_SETUP_FUNCTION_NOT_ALLOWED = 'Setup function not on allow list';
|
|
7
|
+
// Nullifiers
|
|
8
|
+
export const TX_ERROR_DUPLICATE_NULLIFIER_IN_TX = 'Duplicate nullifier in tx';
|
|
9
|
+
export const TX_ERROR_EXISTING_NULLIFIER = 'Existing nullifier';
|
|
10
|
+
// Metadata
|
|
11
|
+
export const TX_ERROR_INVALID_BLOCK_NUMBER = 'Invalid block number';
|
|
12
|
+
export const TX_ERROR_INCORRECT_CHAIN_ID = 'Incorrect chain id';
|
|
13
|
+
export const TX_ERROR_INCORRECT_ROLLUP_VERSION = 'Incorrect rollup version';
|
|
14
|
+
// Proof
|
|
15
|
+
export const TX_ERROR_INVALID_PROOF = 'Invalid proof';
|
|
16
|
+
//Data
|
|
17
|
+
export const TX_ERROR_INCORRECT_CALLDATA = 'Incorrect calldata for public call';
|
|
18
|
+
export const TX_ERROR_CALLDATA_COUNT_MISMATCH = 'Wrong number of calldata for public calls';
|
|
19
|
+
export const TX_ERROR_CALLDATA_COUNT_TOO_LARGE = 'Total calldata too large for enqueued public calls';
|
|
20
|
+
export const TX_ERROR_CONTRACT_CLASS_LOG_COUNT = 'Mismatched number of contract class logs';
|
|
21
|
+
export const TX_ERROR_CONTRACT_CLASS_LOG_LENGTH = 'Mismatched contract class logs length';
|
|
22
|
+
export const TX_ERROR_CONTRACT_CLASS_LOGS = 'Mismatched contract class logs';
|
|
23
|
+
export const TX_ERROR_CONTRACT_CLASS_LOG_SORTING = 'Incorrectly sorted contract class logs';
|
|
24
|
+
// Block header
|
|
25
|
+
export const TX_ERROR_BLOCK_HEADER = 'Block header not found';
|
|
26
|
+
// General
|
|
27
|
+
export const TX_ERROR_DURING_VALIDATION = 'Unexpected error during validation';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/stdlib",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.85.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"inherits": [
|
|
6
6
|
"../package.common.json",
|
|
@@ -39,6 +39,7 @@
|
|
|
39
39
|
"./stats": "./dest/stats/index.js",
|
|
40
40
|
"./auth-witness": "./dest/auth_witness/index.js",
|
|
41
41
|
"./block": "./dest/block/index.js",
|
|
42
|
+
"./block/test": "./dest/block/test/index.js",
|
|
42
43
|
"./versioning": "./dest/versioning/index.js",
|
|
43
44
|
"./interfaces/client": "./dest/interfaces/client.js",
|
|
44
45
|
"./interfaces/server": "./dest/interfaces/server.js",
|
|
@@ -67,11 +68,11 @@
|
|
|
67
68
|
"test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --passWithNoTests --maxWorkers=${JEST_MAX_WORKERS:-8}"
|
|
68
69
|
},
|
|
69
70
|
"dependencies": {
|
|
70
|
-
"@aztec/bb.js": "0.
|
|
71
|
-
"@aztec/blob-lib": "0.
|
|
72
|
-
"@aztec/constants": "0.
|
|
73
|
-
"@aztec/ethereum": "0.
|
|
74
|
-
"@aztec/foundation": "0.
|
|
71
|
+
"@aztec/bb.js": "0.85.0",
|
|
72
|
+
"@aztec/blob-lib": "0.85.0",
|
|
73
|
+
"@aztec/constants": "0.85.0",
|
|
74
|
+
"@aztec/ethereum": "0.85.0",
|
|
75
|
+
"@aztec/foundation": "0.85.0",
|
|
75
76
|
"@google-cloud/storage": "^7.15.0",
|
|
76
77
|
"lodash.chunk": "^4.2.0",
|
|
77
78
|
"lodash.isequal": "^4.5.0",
|
|
@@ -84,6 +85,7 @@
|
|
|
84
85
|
"zod": "^3.23.8"
|
|
85
86
|
},
|
|
86
87
|
"devDependencies": {
|
|
88
|
+
"@jest/expect": "^29.5.0",
|
|
87
89
|
"@jest/globals": "^29.5.0",
|
|
88
90
|
"@types/jest": "^29.5.0",
|
|
89
91
|
"@types/lodash.chunk": "^4.2.9",
|
package/src/avm/avm.ts
CHANGED
|
@@ -10,7 +10,7 @@ import { AppendOnlyTreeSnapshot } from '../trees/append_only_tree_snapshot.js';
|
|
|
10
10
|
import { MerkleTreeId } from '../trees/merkle_tree_id.js';
|
|
11
11
|
import { NullifierLeafPreimage } from '../trees/nullifier_leaf.js';
|
|
12
12
|
import { PublicDataTreeLeafPreimage } from '../trees/public_data_leaf.js';
|
|
13
|
-
import type
|
|
13
|
+
import { GlobalVariables, TreeSnapshots, type Tx } from '../tx/index.js';
|
|
14
14
|
import { AvmCircuitPublicInputs } from './avm_circuit_public_inputs.js';
|
|
15
15
|
import { serializeWithMessagePack } from './message_pack.js';
|
|
16
16
|
|
|
@@ -262,6 +262,117 @@ function AvmSequentialInsertHintFactory(klass: IndexedTreeLeafPreimagesClasses)
|
|
|
262
262
|
export class AvmSequentialInsertHintPublicDataTree extends AvmSequentialInsertHintFactory(PublicDataTreeLeafPreimage) {}
|
|
263
263
|
export class AvmSequentialInsertHintNullifierTree extends AvmSequentialInsertHintFactory(NullifierLeafPreimage) {}
|
|
264
264
|
|
|
265
|
+
// Hint for MerkleTreeDB.appendLeaves.
|
|
266
|
+
// Note: only supported for NOTE_HASH_TREE and L1_TO_L2_MESSAGE_TREE.
|
|
267
|
+
export class AvmAppendLeavesHint {
|
|
268
|
+
constructor(
|
|
269
|
+
public readonly hintKey: AppendOnlyTreeSnapshot,
|
|
270
|
+
public readonly stateAfter: AppendOnlyTreeSnapshot,
|
|
271
|
+
// params
|
|
272
|
+
public readonly treeId: MerkleTreeId,
|
|
273
|
+
public readonly leaves: Fr[],
|
|
274
|
+
) {}
|
|
275
|
+
|
|
276
|
+
static get schema() {
|
|
277
|
+
return z
|
|
278
|
+
.object({
|
|
279
|
+
hintKey: AppendOnlyTreeSnapshot.schema,
|
|
280
|
+
stateAfter: AppendOnlyTreeSnapshot.schema,
|
|
281
|
+
treeId: z.number().int().nonnegative(),
|
|
282
|
+
leaves: schemas.Fr.array(),
|
|
283
|
+
})
|
|
284
|
+
.transform(
|
|
285
|
+
({ hintKey, stateAfter, treeId, leaves }) => new AvmAppendLeavesHint(hintKey, stateAfter, treeId, leaves),
|
|
286
|
+
);
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
// Hint for checkpoint actions that don't change the state.
|
|
291
|
+
class AvmCheckpointActionNoStateChangeHint {
|
|
292
|
+
constructor(
|
|
293
|
+
// key
|
|
294
|
+
public readonly actionCounter: number,
|
|
295
|
+
// current checkpoint evolution
|
|
296
|
+
public readonly oldCheckpointId: number,
|
|
297
|
+
public readonly newCheckpointId: number,
|
|
298
|
+
) {}
|
|
299
|
+
|
|
300
|
+
static get schema() {
|
|
301
|
+
return z
|
|
302
|
+
.object({
|
|
303
|
+
actionCounter: z.number().int().nonnegative(),
|
|
304
|
+
oldCheckpointId: z.number().int().nonnegative(),
|
|
305
|
+
newCheckpointId: z.number().int().nonnegative(),
|
|
306
|
+
})
|
|
307
|
+
.transform(
|
|
308
|
+
({ actionCounter, oldCheckpointId, newCheckpointId }) =>
|
|
309
|
+
new AvmCheckpointActionNoStateChangeHint(actionCounter, oldCheckpointId, newCheckpointId),
|
|
310
|
+
);
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
// Hint for MerkleTreeDB.createCheckpoint.
|
|
315
|
+
export class AvmCreateCheckpointHint extends AvmCheckpointActionNoStateChangeHint {}
|
|
316
|
+
|
|
317
|
+
// Hint for MerkleTreeDB.commitCheckpoint.
|
|
318
|
+
export class AvmCommitCheckpointHint extends AvmCheckpointActionNoStateChangeHint {}
|
|
319
|
+
|
|
320
|
+
// Hint for MerkleTreeDB.revertCheckpoint.
|
|
321
|
+
export class AvmRevertCheckpointHint {
|
|
322
|
+
// We use explicit fields for MessagePack.
|
|
323
|
+
constructor(
|
|
324
|
+
// key
|
|
325
|
+
public readonly actionCounter: number,
|
|
326
|
+
// current checkpoint evolution
|
|
327
|
+
public readonly oldCheckpointId: number,
|
|
328
|
+
public readonly newCheckpointId: number,
|
|
329
|
+
// state evolution
|
|
330
|
+
public readonly stateBefore: TreeSnapshots,
|
|
331
|
+
public readonly stateAfter: TreeSnapshots,
|
|
332
|
+
) {}
|
|
333
|
+
|
|
334
|
+
static create(
|
|
335
|
+
actionCounter: number,
|
|
336
|
+
oldCheckpointId: number,
|
|
337
|
+
newCheckpointId: number,
|
|
338
|
+
stateBefore: Record<MerkleTreeId, AppendOnlyTreeSnapshot>,
|
|
339
|
+
stateAfter: Record<MerkleTreeId, AppendOnlyTreeSnapshot>,
|
|
340
|
+
): AvmRevertCheckpointHint {
|
|
341
|
+
return new AvmRevertCheckpointHint(
|
|
342
|
+
actionCounter,
|
|
343
|
+
oldCheckpointId,
|
|
344
|
+
newCheckpointId,
|
|
345
|
+
new TreeSnapshots(
|
|
346
|
+
stateBefore[MerkleTreeId.L1_TO_L2_MESSAGE_TREE],
|
|
347
|
+
stateBefore[MerkleTreeId.NOTE_HASH_TREE],
|
|
348
|
+
stateBefore[MerkleTreeId.NULLIFIER_TREE],
|
|
349
|
+
stateBefore[MerkleTreeId.PUBLIC_DATA_TREE],
|
|
350
|
+
),
|
|
351
|
+
new TreeSnapshots(
|
|
352
|
+
stateAfter[MerkleTreeId.L1_TO_L2_MESSAGE_TREE],
|
|
353
|
+
stateAfter[MerkleTreeId.NOTE_HASH_TREE],
|
|
354
|
+
stateAfter[MerkleTreeId.NULLIFIER_TREE],
|
|
355
|
+
stateAfter[MerkleTreeId.PUBLIC_DATA_TREE],
|
|
356
|
+
),
|
|
357
|
+
);
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
static get schema() {
|
|
361
|
+
return z
|
|
362
|
+
.object({
|
|
363
|
+
actionCounter: z.number().int().nonnegative(),
|
|
364
|
+
oldCheckpointId: z.number().int().nonnegative(),
|
|
365
|
+
newCheckpointId: z.number().int().nonnegative(),
|
|
366
|
+
stateBefore: TreeSnapshots.schema,
|
|
367
|
+
stateAfter: TreeSnapshots.schema,
|
|
368
|
+
})
|
|
369
|
+
.transform(
|
|
370
|
+
({ actionCounter, oldCheckpointId, newCheckpointId, stateBefore, stateAfter }) =>
|
|
371
|
+
new AvmRevertCheckpointHint(actionCounter, oldCheckpointId, newCheckpointId, stateBefore, stateAfter),
|
|
372
|
+
);
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
|
|
265
376
|
////////////////////////////////////////////////////////////////////////////
|
|
266
377
|
// Hints (other)
|
|
267
378
|
////////////////////////////////////////////////////////////////////////////
|
|
@@ -290,6 +401,8 @@ export class AvmEnqueuedCallHint {
|
|
|
290
401
|
|
|
291
402
|
export class AvmTxHint {
|
|
292
403
|
constructor(
|
|
404
|
+
public readonly hash: string,
|
|
405
|
+
public readonly globalVariables: GlobalVariables,
|
|
293
406
|
public readonly nonRevertibleAccumulatedData: {
|
|
294
407
|
noteHashes: Fr[];
|
|
295
408
|
nullifiers: Fr[];
|
|
@@ -307,12 +420,17 @@ export class AvmTxHint {
|
|
|
307
420
|
public readonly teardownEnqueuedCall: AvmEnqueuedCallHint | null,
|
|
308
421
|
) {}
|
|
309
422
|
|
|
310
|
-
static fromTx(tx: Tx): AvmTxHint {
|
|
423
|
+
static async fromTx(tx: Tx): Promise<AvmTxHint> {
|
|
311
424
|
const setupCallRequests = tx.getNonRevertiblePublicCallRequestsWithCalldata();
|
|
312
425
|
const appLogicCallRequests = tx.getRevertiblePublicCallRequestsWithCalldata();
|
|
313
426
|
const teardownCallRequest = tx.getTeardownPublicCallRequestWithCalldata();
|
|
314
427
|
|
|
428
|
+
// For informational purposes. Assumed quick because it should be cached.
|
|
429
|
+
const txHash = await tx.getTxHash();
|
|
430
|
+
|
|
315
431
|
return new AvmTxHint(
|
|
432
|
+
txHash.hash.toString(),
|
|
433
|
+
tx.data.constants.historicalHeader.globalVariables,
|
|
316
434
|
{
|
|
317
435
|
noteHashes: tx.data.forPublic!.nonRevertibleAccumulatedData.noteHashes.filter(x => !x.isZero()),
|
|
318
436
|
nullifiers: tx.data.forPublic!.nonRevertibleAccumulatedData.nullifiers.filter(x => !x.isZero()),
|
|
@@ -351,23 +469,54 @@ export class AvmTxHint {
|
|
|
351
469
|
}
|
|
352
470
|
|
|
353
471
|
static empty() {
|
|
354
|
-
return new AvmTxHint(
|
|
472
|
+
return new AvmTxHint(
|
|
473
|
+
'',
|
|
474
|
+
GlobalVariables.empty(),
|
|
475
|
+
{ noteHashes: [], nullifiers: [] },
|
|
476
|
+
{ noteHashes: [], nullifiers: [] },
|
|
477
|
+
[],
|
|
478
|
+
[],
|
|
479
|
+
null,
|
|
480
|
+
);
|
|
355
481
|
}
|
|
356
482
|
|
|
357
483
|
static get schema() {
|
|
358
|
-
return z
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
484
|
+
return z
|
|
485
|
+
.object({
|
|
486
|
+
hash: z.string(),
|
|
487
|
+
globalVariables: GlobalVariables.schema,
|
|
488
|
+
nonRevertibleAccumulatedData: z.object({
|
|
489
|
+
noteHashes: schemas.Fr.array(),
|
|
490
|
+
nullifiers: schemas.Fr.array(),
|
|
491
|
+
}),
|
|
492
|
+
revertibleAccumulatedData: z.object({
|
|
493
|
+
noteHashes: schemas.Fr.array(),
|
|
494
|
+
nullifiers: schemas.Fr.array(),
|
|
495
|
+
}),
|
|
496
|
+
setupEnqueuedCalls: AvmEnqueuedCallHint.schema.array(),
|
|
497
|
+
appLogicEnqueuedCalls: AvmEnqueuedCallHint.schema.array(),
|
|
498
|
+
teardownEnqueuedCall: AvmEnqueuedCallHint.schema.nullable(),
|
|
499
|
+
})
|
|
500
|
+
.transform(
|
|
501
|
+
({
|
|
502
|
+
hash,
|
|
503
|
+
globalVariables,
|
|
504
|
+
nonRevertibleAccumulatedData,
|
|
505
|
+
revertibleAccumulatedData,
|
|
506
|
+
setupEnqueuedCalls,
|
|
507
|
+
appLogicEnqueuedCalls,
|
|
508
|
+
teardownEnqueuedCall,
|
|
509
|
+
}) =>
|
|
510
|
+
new AvmTxHint(
|
|
511
|
+
hash,
|
|
512
|
+
globalVariables,
|
|
513
|
+
nonRevertibleAccumulatedData,
|
|
514
|
+
revertibleAccumulatedData,
|
|
515
|
+
setupEnqueuedCalls,
|
|
516
|
+
appLogicEnqueuedCalls,
|
|
517
|
+
teardownEnqueuedCall,
|
|
518
|
+
),
|
|
519
|
+
);
|
|
371
520
|
}
|
|
372
521
|
}
|
|
373
522
|
|
|
@@ -379,6 +528,7 @@ export class AvmExecutionHints {
|
|
|
379
528
|
public readonly contractClasses: AvmContractClassHint[] = [],
|
|
380
529
|
public readonly bytecodeCommitments: AvmBytecodeCommitmentHint[] = [],
|
|
381
530
|
// Merkle DB hints.
|
|
531
|
+
public startingTreeRoots: TreeSnapshots = TreeSnapshots.empty(),
|
|
382
532
|
public readonly getSiblingPathHints: AvmGetSiblingPathHint[] = [],
|
|
383
533
|
public readonly getPreviousValueIndexHints: AvmGetPreviousValueIndexHint[] = [],
|
|
384
534
|
public readonly getLeafPreimageHintsPublicDataTree: AvmGetLeafPreimageHintPublicDataTree[] = [],
|
|
@@ -386,6 +536,10 @@ export class AvmExecutionHints {
|
|
|
386
536
|
public readonly getLeafValueHints: AvmGetLeafValueHint[] = [],
|
|
387
537
|
public readonly sequentialInsertHintsPublicDataTree: AvmSequentialInsertHintPublicDataTree[] = [],
|
|
388
538
|
public readonly sequentialInsertHintsNullifierTree: AvmSequentialInsertHintNullifierTree[] = [],
|
|
539
|
+
public readonly appendLeavesHints: AvmAppendLeavesHint[] = [],
|
|
540
|
+
public readonly createCheckpointHints: AvmCreateCheckpointHint[] = [],
|
|
541
|
+
public readonly commitCheckpointHints: AvmCommitCheckpointHint[] = [],
|
|
542
|
+
public readonly revertCheckpointHints: AvmRevertCheckpointHint[] = [],
|
|
389
543
|
) {}
|
|
390
544
|
|
|
391
545
|
static empty() {
|
|
@@ -399,6 +553,7 @@ export class AvmExecutionHints {
|
|
|
399
553
|
contractInstances: AvmContractInstanceHint.schema.array(),
|
|
400
554
|
contractClasses: AvmContractClassHint.schema.array(),
|
|
401
555
|
bytecodeCommitments: AvmBytecodeCommitmentHint.schema.array(),
|
|
556
|
+
startingTreeRoots: TreeSnapshots.schema,
|
|
402
557
|
getSiblingPathHints: AvmGetSiblingPathHint.schema.array(),
|
|
403
558
|
getPreviousValueIndexHints: AvmGetPreviousValueIndexHint.schema.array(),
|
|
404
559
|
getLeafPreimageHintsPublicDataTree: AvmGetLeafPreimageHintPublicDataTree.schema.array(),
|
|
@@ -406,6 +561,10 @@ export class AvmExecutionHints {
|
|
|
406
561
|
getLeafValueHints: AvmGetLeafValueHint.schema.array(),
|
|
407
562
|
sequentialInsertHintsPublicDataTree: AvmSequentialInsertHintPublicDataTree.schema.array(),
|
|
408
563
|
sequentialInsertHintsNullifierTree: AvmSequentialInsertHintNullifierTree.schema.array(),
|
|
564
|
+
appendLeavesHints: AvmAppendLeavesHint.schema.array(),
|
|
565
|
+
createCheckpointHints: AvmCreateCheckpointHint.schema.array(),
|
|
566
|
+
commitCheckpointHints: AvmCommitCheckpointHint.schema.array(),
|
|
567
|
+
revertCheckpointHints: AvmRevertCheckpointHint.schema.array(),
|
|
409
568
|
})
|
|
410
569
|
.transform(
|
|
411
570
|
({
|
|
@@ -413,6 +572,7 @@ export class AvmExecutionHints {
|
|
|
413
572
|
contractInstances,
|
|
414
573
|
contractClasses,
|
|
415
574
|
bytecodeCommitments,
|
|
575
|
+
startingTreeRoots,
|
|
416
576
|
getSiblingPathHints,
|
|
417
577
|
getPreviousValueIndexHints,
|
|
418
578
|
getLeafPreimageHintsPublicDataTree,
|
|
@@ -420,12 +580,17 @@ export class AvmExecutionHints {
|
|
|
420
580
|
getLeafValueHints,
|
|
421
581
|
sequentialInsertHintsPublicDataTree,
|
|
422
582
|
sequentialInsertHintsNullifierTree,
|
|
583
|
+
appendLeavesHints,
|
|
584
|
+
createCheckpointHints,
|
|
585
|
+
commitCheckpointHints,
|
|
586
|
+
revertCheckpointHints,
|
|
423
587
|
}) =>
|
|
424
588
|
new AvmExecutionHints(
|
|
425
589
|
tx,
|
|
426
590
|
contractInstances,
|
|
427
591
|
contractClasses,
|
|
428
592
|
bytecodeCommitments,
|
|
593
|
+
startingTreeRoots,
|
|
429
594
|
getSiblingPathHints,
|
|
430
595
|
getPreviousValueIndexHints,
|
|
431
596
|
getLeafPreimageHintsPublicDataTree,
|
|
@@ -433,35 +598,29 @@ export class AvmExecutionHints {
|
|
|
433
598
|
getLeafValueHints,
|
|
434
599
|
sequentialInsertHintsPublicDataTree,
|
|
435
600
|
sequentialInsertHintsNullifierTree,
|
|
601
|
+
appendLeavesHints,
|
|
602
|
+
createCheckpointHints,
|
|
603
|
+
commitCheckpointHints,
|
|
604
|
+
revertCheckpointHints,
|
|
436
605
|
),
|
|
437
606
|
);
|
|
438
607
|
}
|
|
439
608
|
}
|
|
440
609
|
|
|
441
610
|
export class AvmCircuitInputs {
|
|
442
|
-
constructor(
|
|
443
|
-
public readonly functionName: string, // only informational
|
|
444
|
-
public readonly calldata: Fr[],
|
|
445
|
-
public readonly hints: AvmExecutionHints,
|
|
446
|
-
public publicInputs: AvmCircuitPublicInputs,
|
|
447
|
-
) {}
|
|
611
|
+
constructor(public readonly hints: AvmExecutionHints, public publicInputs: AvmCircuitPublicInputs) {}
|
|
448
612
|
|
|
449
613
|
static empty() {
|
|
450
|
-
return new AvmCircuitInputs(
|
|
614
|
+
return new AvmCircuitInputs(AvmExecutionHints.empty(), AvmCircuitPublicInputs.empty());
|
|
451
615
|
}
|
|
452
616
|
|
|
453
617
|
static get schema() {
|
|
454
618
|
return z
|
|
455
619
|
.object({
|
|
456
|
-
functionName: z.string(),
|
|
457
|
-
calldata: schemas.Fr.array(),
|
|
458
620
|
hints: AvmExecutionHints.schema,
|
|
459
621
|
publicInputs: AvmCircuitPublicInputs.schema,
|
|
460
622
|
})
|
|
461
|
-
.transform(
|
|
462
|
-
({ functionName, calldata, hints, publicInputs }) =>
|
|
463
|
-
new AvmCircuitInputs(functionName, calldata, hints, publicInputs),
|
|
464
|
-
);
|
|
623
|
+
.transform(({ hints, publicInputs }) => new AvmCircuitInputs(hints, publicInputs));
|
|
465
624
|
}
|
|
466
625
|
|
|
467
626
|
public serializeWithMessagePack(): Buffer {
|
package/src/block/in_block.ts
CHANGED
|
@@ -5,6 +5,7 @@ import { type ZodTypeAny, z } from 'zod';
|
|
|
5
5
|
import { schemas } from '../schemas/index.js';
|
|
6
6
|
import type { L2Block } from './l2_block.js';
|
|
7
7
|
|
|
8
|
+
// Note: If you expand this type with indexInBlock, then delete `IndexedTxEffect` and use this type instead.
|
|
8
9
|
export type InBlock<T> = {
|
|
9
10
|
l2BlockNumber: number;
|
|
10
11
|
l2BlockHash: string;
|
package/src/block/index.ts
CHANGED
|
@@ -5,10 +5,9 @@ import { z } from 'zod';
|
|
|
5
5
|
|
|
6
6
|
import type { L1RollupConstants } from '../epoch-helpers/index.js';
|
|
7
7
|
import type { BlockHeader } from '../tx/block_header.js';
|
|
8
|
-
import type {
|
|
8
|
+
import type { IndexedTxEffect } from '../tx/indexed_tx_effect.js';
|
|
9
9
|
import type { TxHash } from '../tx/tx_hash.js';
|
|
10
10
|
import type { TxReceipt } from '../tx/tx_receipt.js';
|
|
11
|
-
import type { InBlock } from './in_block.js';
|
|
12
11
|
import type { L2Block } from './l2_block.js';
|
|
13
12
|
import type { PublishedL2Block } from './published_l2_block.js';
|
|
14
13
|
|
|
@@ -68,10 +67,10 @@ export interface L2BlockSource {
|
|
|
68
67
|
|
|
69
68
|
/**
|
|
70
69
|
* Gets a tx effect.
|
|
71
|
-
* @param txHash - The hash of
|
|
72
|
-
* @returns The requested tx effect.
|
|
70
|
+
* @param txHash - The hash of the tx corresponding to the tx effect.
|
|
71
|
+
* @returns The requested tx effect with block info (or undefined if not found).
|
|
73
72
|
*/
|
|
74
|
-
getTxEffect(txHash: TxHash): Promise<
|
|
73
|
+
getTxEffect(txHash: TxHash): Promise<IndexedTxEffect | undefined>;
|
|
75
74
|
|
|
76
75
|
/**
|
|
77
76
|
* Gets a receipt of a settled tx.
|
|
@@ -119,6 +118,9 @@ export interface L2BlockSource {
|
|
|
119
118
|
* Returns the rollup constants for the current chain.
|
|
120
119
|
*/
|
|
121
120
|
getL1Constants(): Promise<L1RollupConstants>;
|
|
121
|
+
|
|
122
|
+
/** Force a sync. */
|
|
123
|
+
syncImmediate(): Promise<void>;
|
|
122
124
|
}
|
|
123
125
|
|
|
124
126
|
/**
|
|
@@ -141,6 +143,14 @@ export type L2Tips = Record<L2BlockTag, L2BlockId>;
|
|
|
141
143
|
/** Identifies a block by number and hash. */
|
|
142
144
|
export type L2BlockId = z.infer<typeof L2BlockIdSchema>;
|
|
143
145
|
|
|
146
|
+
/** Creates an L2 block id */
|
|
147
|
+
export function makeL2BlockId(number: number, hash?: string): L2BlockId {
|
|
148
|
+
if (number !== 0 && !hash) {
|
|
149
|
+
throw new Error(`Hash is required for non-genesis blocks (got block number ${number})`);
|
|
150
|
+
}
|
|
151
|
+
return { number, hash: hash! };
|
|
152
|
+
}
|
|
153
|
+
|
|
144
154
|
// TODO(palla/schemas): This package should know what is the block hash of the genesis block 0.
|
|
145
155
|
const L2BlockIdSchema = z.union([
|
|
146
156
|
z.object({
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { L2BlockId, L2Tips } from '../l2_block_source.js';
|
|
2
|
+
import type { PublishedL2Block } from '../published_l2_block.js';
|
|
3
|
+
|
|
4
|
+
/** Interface to the local view of the chain. Implemented by world-state and l2-tips-store. */
|
|
5
|
+
export interface L2BlockStreamLocalDataProvider {
|
|
6
|
+
getL2BlockHash(number: number): Promise<string | undefined>;
|
|
7
|
+
getL2Tips(): Promise<L2Tips>;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/** Interface to a handler of events emitted. */
|
|
11
|
+
export interface L2BlockStreamEventHandler {
|
|
12
|
+
handleBlockStreamEvent(event: L2BlockStreamEvent): Promise<void>;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export type L2BlockStreamEvent =
|
|
16
|
+
| /** Emits blocks added to the chain. */ {
|
|
17
|
+
type: 'blocks-added';
|
|
18
|
+
blocks: PublishedL2Block[];
|
|
19
|
+
}
|
|
20
|
+
| /** Reports last correct block (new tip of the unproven chain). */ {
|
|
21
|
+
type: 'chain-pruned';
|
|
22
|
+
block: L2BlockId;
|
|
23
|
+
}
|
|
24
|
+
| /** Reports new proven block. */ {
|
|
25
|
+
type: 'chain-proven';
|
|
26
|
+
block: L2BlockId;
|
|
27
|
+
}
|
|
28
|
+
| /** Reports new finalized block (proven and finalized on L1). */ {
|
|
29
|
+
type: 'chain-finalized';
|
|
30
|
+
block: L2BlockId;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export type L2TipsStore = L2BlockStreamEventHandler & L2BlockStreamLocalDataProvider;
|