@aztec/stdlib 0.0.1-commit.d431d1c → 0.0.1-commit.e310a4c8
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 +2 -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 +4 -4
- 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/archiver.d.ts +1 -1
- package/dest/interfaces/archiver.d.ts.map +1 -1
- package/dest/interfaces/archiver.js +17 -16
- 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 +50 -57
- 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/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/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_receipt.d.ts +42 -14
- package/dest/tx/tx_receipt.d.ts.map +1 -1
- package/dest/tx/tx_receipt.js +46 -15
- 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 +5 -6
- 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/archiver.ts +17 -25
- package/src/interfaces/aztec-node.ts +72 -116
- package/src/interfaces/block-builder.ts +15 -5
- package/src/interfaces/configs.ts +1 -3
- 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/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_receipt.ts +75 -18
- 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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"block_header.d.ts","sourceRoot":"","sources":["../../src/tx/block_header.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAG1E,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACpD,OAAO,EAAE,KAAK,MAAM,EAAW,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,WAAW,EAAwC,MAAM,6BAA6B,CAAC;AAE9G,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAExD,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAG/B,OAAO,EAAE,sBAAsB,EAAE,MAAM,uCAAuC,CAAC;AAC/E,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD,+BAA+B;AAC/B,qBAAa,WAAW;IAIpB,uDAAuD;aACvC,WAAW,EAAE,sBAAsB;IACnD,uBAAuB;aACP,K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AO,CAAC,MAAM,CAAC,WAYf;IAEM,MAAM,CAAC,KAAK,EAAE,IAAI,GAAG,OAAO,CASlC;CACF"}
|
package/dest/tx/block_header.js
CHANGED
|
@@ -8,6 +8,7 @@ import { BufferReader, FieldReader, serializeToBuffer, serializeToFields } from
|
|
|
8
8
|
import { bufferToHex, hexToBuffer } from '@aztec/foundation/string';
|
|
9
9
|
import { inspect } from 'util';
|
|
10
10
|
import { z } from 'zod';
|
|
11
|
+
import { BlockHash } from '../block/block_hash.js';
|
|
11
12
|
import { AppendOnlyTreeSnapshot } from '../trees/append_only_tree_snapshot.js';
|
|
12
13
|
import { GlobalVariables } from './global_variables.js';
|
|
13
14
|
import { StateReference } from './state_reference.js';
|
|
@@ -109,12 +110,12 @@ _computedKey = inspect.custom;
|
|
|
109
110
|
}
|
|
110
111
|
hash() {
|
|
111
112
|
if (!this._cachedHash) {
|
|
112
|
-
this._cachedHash = poseidon2HashWithSeparator(this.toFields(), GeneratorIndex.
|
|
113
|
+
this._cachedHash = poseidon2HashWithSeparator(this.toFields(), GeneratorIndex.BLOCK_HEADER_HASH).then((fr)=>new BlockHash(fr));
|
|
113
114
|
}
|
|
114
115
|
return this._cachedHash;
|
|
115
116
|
}
|
|
116
117
|
/** Manually set the hash for this block header if already computed */ setHash(hashed) {
|
|
117
|
-
this._cachedHash = Promise.resolve(hashed);
|
|
118
|
+
this._cachedHash = Promise.resolve(new BlockHash(hashed));
|
|
118
119
|
}
|
|
119
120
|
static random(overrides = {}) {
|
|
120
121
|
return BlockHeader.from({
|
package/dest/tx/in_tx.d.ts
CHANGED
|
@@ -7,15 +7,15 @@ export type InTx = InBlock & {
|
|
|
7
7
|
export declare function randomInTx(): InTx;
|
|
8
8
|
export declare function inTxSchema(): z.ZodIntersection<z.ZodObject<{
|
|
9
9
|
l2BlockNumber: z.ZodEffects<z.ZodPipeline<z.ZodUnion<[z.ZodNumber, z.ZodBigInt, z.ZodString]>, z.ZodNumber>, import("@aztec/foundation/branded-types").BlockNumber, string | number | bigint>;
|
|
10
|
-
l2BlockHash:
|
|
10
|
+
l2BlockHash: import("@aztec/foundation/schemas").ZodFor<import("../block/block_hash.js").BlockHash>;
|
|
11
11
|
}, "strip", z.ZodTypeAny, {
|
|
12
12
|
l2BlockNumber: number & {
|
|
13
13
|
_branding: "BlockNumber";
|
|
14
14
|
};
|
|
15
|
-
l2BlockHash: import("../block/block_hash.js").
|
|
15
|
+
l2BlockHash: import("../block/block_hash.js").BlockHash;
|
|
16
16
|
}, {
|
|
17
17
|
l2BlockNumber: string | number | bigint;
|
|
18
|
-
l2BlockHash
|
|
18
|
+
l2BlockHash?: any;
|
|
19
19
|
}>, z.ZodObject<{
|
|
20
20
|
txHash: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, Buffer<ArrayBuffer>, string>, TxHash, string>;
|
|
21
21
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
2
|
-
import {
|
|
2
|
+
import { BlockHash } from '../block/block_hash.js';
|
|
3
3
|
import { type DataInBlock } from '../block/in_block.js';
|
|
4
4
|
import { TxEffect } from './tx_effect.js';
|
|
5
5
|
export type IndexedTxEffect = DataInBlock<TxEffect> & {
|
|
@@ -7,7 +7,7 @@ export type IndexedTxEffect = DataInBlock<TxEffect> & {
|
|
|
7
7
|
};
|
|
8
8
|
export declare function indexedTxSchema(): import("zod").ZodObject<{
|
|
9
9
|
l2BlockNumber: import("zod").ZodEffects<import("zod").ZodPipeline<import("zod").ZodUnion<[import("zod").ZodNumber, import("zod").ZodBigInt, import("zod").ZodString]>, import("zod").ZodNumber>, BlockNumber, string | number | bigint>;
|
|
10
|
-
l2BlockHash: import("
|
|
10
|
+
l2BlockHash: import("@aztec/foundation/schemas").ZodFor<BlockHash>;
|
|
11
11
|
} & {
|
|
12
12
|
data: import("@aztec/foundation/schemas").ZodFor<TxEffect>;
|
|
13
13
|
} & {
|
|
@@ -16,16 +16,16 @@ export declare function indexedTxSchema(): import("zod").ZodObject<{
|
|
|
16
16
|
l2BlockNumber: number & {
|
|
17
17
|
_branding: "BlockNumber";
|
|
18
18
|
};
|
|
19
|
-
l2BlockHash:
|
|
19
|
+
l2BlockHash: BlockHash;
|
|
20
20
|
data: TxEffect;
|
|
21
21
|
txIndexInBlock: number;
|
|
22
22
|
}, {
|
|
23
23
|
l2BlockNumber: string | number | bigint;
|
|
24
|
-
l2BlockHash
|
|
24
|
+
l2BlockHash?: any;
|
|
25
25
|
data?: any;
|
|
26
26
|
txIndexInBlock: string | number | bigint;
|
|
27
27
|
}>;
|
|
28
28
|
export declare function randomIndexedTxEffect(): Promise<IndexedTxEffect>;
|
|
29
29
|
export declare function serializeIndexedTxEffect(effect: IndexedTxEffect): Buffer;
|
|
30
30
|
export declare function deserializeIndexedTxEffect(buffer: Buffer): IndexedTxEffect;
|
|
31
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
31
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXhlZF90eF9lZmZlY3QuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy90eC9pbmRleGVkX3R4X2VmZmVjdC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsV0FBVyxFQUFFLE1BQU0saUNBQWlDLENBQUM7QUFLOUQsT0FBTyxFQUFFLFNBQVMsRUFBRSxNQUFNLHdCQUF3QixDQUFDO0FBQ25ELE9BQU8sRUFBRSxLQUFLLFdBQVcsRUFBMkMsTUFBTSxzQkFBc0IsQ0FBQztBQUNqRyxPQUFPLEVBQUUsUUFBUSxFQUFFLE1BQU0sZ0JBQWdCLENBQUM7QUFFMUMsTUFBTSxNQUFNLGVBQWUsR0FBRyxXQUFXLENBQUMsUUFBUSxDQUFDLEdBQUc7SUFBRSxjQUFjLEVBQUUsTUFBTSxDQUFBO0NBQUUsQ0FBQztBQUVqRix3QkFBZ0IsZUFBZTs7Ozs7Ozs7Ozs7Ozs7Ozs7OztHQUU5QjtBQUVELHdCQUFzQixxQkFBcUIsSUFBSSxPQUFPLENBQUMsZUFBZSxDQUFDLENBS3RFO0FBRUQsd0JBQWdCLHdCQUF3QixDQUFDLE1BQU0sRUFBRSxlQUFlLEdBQUcsTUFBTSxDQUV4RTtBQUVELHdCQUFnQiwwQkFBMEIsQ0FBQyxNQUFNLEVBQUUsTUFBTSxHQUFHLGVBQWUsQ0FjMUUifQ==
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"indexed_tx_effect.d.ts","sourceRoot":"","sources":["../../src/tx/indexed_tx_effect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"indexed_tx_effect.d.ts","sourceRoot":"","sources":["../../src/tx/indexed_tx_effect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAK9D,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,KAAK,WAAW,EAA2C,MAAM,sBAAsB,CAAC;AACjG,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C,MAAM,MAAM,eAAe,GAAG,WAAW,CAAC,QAAQ,CAAC,GAAG;IAAE,cAAc,EAAE,MAAM,CAAA;CAAE,CAAC;AAEjF,wBAAgB,eAAe;;;;;;;;;;;;;;;;;;;GAE9B;AAED,wBAAsB,qBAAqB,IAAI,OAAO,CAAC,eAAe,CAAC,CAKtE;AAED,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,eAAe,GAAG,MAAM,CAExE;AAED,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,MAAM,GAAG,eAAe,CAc1E"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
2
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
3
|
import { schemas } from '@aztec/foundation/schemas';
|
|
3
4
|
import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
4
|
-
import {
|
|
5
|
+
import { BlockHash } from '../block/block_hash.js';
|
|
5
6
|
import { dataInBlockSchemaFor, randomDataInBlock } from '../block/in_block.js';
|
|
6
7
|
import { TxEffect } from './tx_effect.js';
|
|
7
8
|
export function indexedTxSchema() {
|
|
@@ -22,7 +23,7 @@ export function serializeIndexedTxEffect(effect) {
|
|
|
22
23
|
}
|
|
23
24
|
export function deserializeIndexedTxEffect(buffer) {
|
|
24
25
|
const reader = BufferReader.asReader(buffer);
|
|
25
|
-
const l2BlockHash = reader.readObject(
|
|
26
|
+
const l2BlockHash = new BlockHash(reader.readObject(Fr));
|
|
26
27
|
const l2BlockNumber = BlockNumber(reader.readNumber());
|
|
27
28
|
const txIndexInBlock = reader.readNumber();
|
|
28
29
|
const data = reader.readObject(TxEffect);
|
package/dest/tx/tx_receipt.d.ts
CHANGED
|
@@ -1,15 +1,21 @@
|
|
|
1
1
|
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
2
|
-
import type { FieldsOf } from '@aztec/foundation/types';
|
|
3
2
|
import { RevertCode } from '../avm/revert_code.js';
|
|
4
|
-
import {
|
|
3
|
+
import { BlockHash } from '../block/block_hash.js';
|
|
5
4
|
import { type ZodFor } from '../schemas/schemas.js';
|
|
6
5
|
import { TxHash } from './tx_hash.js';
|
|
7
|
-
/**
|
|
8
|
-
* Possible status of a transaction.
|
|
9
|
-
*/
|
|
6
|
+
/** Block inclusion/finalization status. */
|
|
10
7
|
export declare enum TxStatus {
|
|
11
8
|
DROPPED = "dropped",
|
|
12
9
|
PENDING = "pending",
|
|
10
|
+
PROPOSED = "proposed",
|
|
11
|
+
CHECKPOINTED = "checkpointed",
|
|
12
|
+
PROVEN = "proven",
|
|
13
|
+
FINALIZED = "finalized"
|
|
14
|
+
}
|
|
15
|
+
/** Tx status sorted by finalization progress. */
|
|
16
|
+
export declare const SortedTxStatuses: TxStatus[];
|
|
17
|
+
/** Execution result - only set when tx is in a block. */
|
|
18
|
+
export declare enum TxExecutionResult {
|
|
13
19
|
SUCCESS = "success",
|
|
14
20
|
APP_LOGIC_REVERTED = "app_logic_reverted",
|
|
15
21
|
TEARDOWN_REVERTED = "teardown_reverted",
|
|
@@ -24,32 +30,54 @@ export declare enum TxStatus {
|
|
|
24
30
|
export declare class TxReceipt {
|
|
25
31
|
/** A unique identifier for a transaction. */
|
|
26
32
|
txHash: TxHash;
|
|
27
|
-
/** The transaction's status. */
|
|
33
|
+
/** The transaction's block finalization status. */
|
|
28
34
|
status: TxStatus;
|
|
35
|
+
/** The execution result of the transaction, only set when tx is in a block. */
|
|
36
|
+
executionResult: TxExecutionResult | undefined;
|
|
29
37
|
/** Description of transaction error, if any. */
|
|
30
|
-
error: string;
|
|
38
|
+
error: string | undefined;
|
|
31
39
|
/** The transaction fee paid for the transaction. */
|
|
32
40
|
transactionFee?: bigint | undefined;
|
|
33
41
|
/** The hash of the block containing the transaction. */
|
|
34
|
-
blockHash?:
|
|
42
|
+
blockHash?: BlockHash | undefined;
|
|
35
43
|
/** The block number in which the transaction was included. */
|
|
36
44
|
blockNumber?: BlockNumber | undefined;
|
|
37
45
|
constructor(
|
|
38
46
|
/** A unique identifier for a transaction. */
|
|
39
47
|
txHash: TxHash,
|
|
40
|
-
/** The transaction's status. */
|
|
48
|
+
/** The transaction's block finalization status. */
|
|
41
49
|
status: TxStatus,
|
|
50
|
+
/** The execution result of the transaction, only set when tx is in a block. */
|
|
51
|
+
executionResult: TxExecutionResult | undefined,
|
|
42
52
|
/** Description of transaction error, if any. */
|
|
43
|
-
error: string,
|
|
53
|
+
error: string | undefined,
|
|
44
54
|
/** The transaction fee paid for the transaction. */
|
|
45
55
|
transactionFee?: bigint | undefined,
|
|
46
56
|
/** The hash of the block containing the transaction. */
|
|
47
|
-
blockHash?:
|
|
57
|
+
blockHash?: BlockHash | undefined,
|
|
48
58
|
/** The block number in which the transaction was included. */
|
|
49
59
|
blockNumber?: BlockNumber | undefined);
|
|
60
|
+
/** Returns true if the transaction was executed successfully. */
|
|
61
|
+
hasExecutionSucceeded(): boolean;
|
|
62
|
+
/** Returns true if the transaction execution reverted. */
|
|
63
|
+
hasExecutionReverted(): boolean;
|
|
64
|
+
/** Returns true if the transaction has been included in a block (proposed, checkpointed, proven, or finalized). */
|
|
65
|
+
isMined(): boolean;
|
|
66
|
+
/** Returns true if the transaction is pending. */
|
|
67
|
+
isPending(): boolean;
|
|
68
|
+
/** Returns true if the transaction was dropped. */
|
|
69
|
+
isDropped(): boolean;
|
|
50
70
|
static empty(): TxReceipt;
|
|
51
71
|
static get schema(): ZodFor<TxReceipt>;
|
|
52
|
-
static from(fields:
|
|
53
|
-
|
|
72
|
+
static from(fields: {
|
|
73
|
+
txHash: TxHash;
|
|
74
|
+
status: TxStatus;
|
|
75
|
+
executionResult?: TxExecutionResult;
|
|
76
|
+
error?: string;
|
|
77
|
+
transactionFee?: bigint;
|
|
78
|
+
blockHash?: BlockHash;
|
|
79
|
+
blockNumber?: BlockNumber;
|
|
80
|
+
}): TxReceipt;
|
|
81
|
+
static executionResultFromRevertCode(revertCode: RevertCode): TxExecutionResult;
|
|
54
82
|
}
|
|
55
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
83
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHhfcmVjZWlwdC5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3R4L3R4X3JlY2VpcHQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFdBQVcsRUFBcUIsTUFBTSxpQ0FBaUMsQ0FBQztBQUlqRixPQUFPLEVBQUUsVUFBVSxFQUFFLE1BQU0sdUJBQXV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LGlCQUFpQixDQVlyRjtDQUNGIn0=
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tx_receipt.d.ts","sourceRoot":"","sources":["../../src/tx/tx_receipt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAqB,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"tx_receipt.d.ts","sourceRoot":"","sources":["../../src/tx/tx_receipt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAqB,MAAM,iCAAiC,CAAC;AAIjF,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,KAAK,MAAM,EAAW,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC,2CAA2C;AAC3C,oBAAY,QAAQ;IAClB,OAAO,YAAY;IACnB,OAAO,YAAY;IACnB,QAAQ,aAAa;IACrB,YAAY,iBAAiB;IAC7B,MAAM,WAAW;IACjB,SAAS,cAAc;CACxB;AAED,iDAAiD;AACjD,eAAO,MAAM,gBAAgB,EAAE,QAAQ,EAOtC,CAAC;AAEF,yDAAyD;AACzD,oBAAY,iBAAiB;IAC3B,OAAO,YAAY;IACnB,kBAAkB,uBAAuB;IACzC,iBAAiB,sBAAsB;IACvC,aAAa,kBAAkB;CAChC;AAED;;;;;GAKG;AACH,qBAAa,SAAS;IAElB,6CAA6C;IACtC,MAAM,EAAE,MAAM;IACrB,mDAAmD;IAC5C,MAAM,EAAE,QAAQ;IACvB,+EAA+E;IACxE,eAAe,EAAE,iBAAiB,GAAG,SAAS;IACrD,gDAAgD;IACzC,KAAK,EAAE,MAAM,GAAG,SAAS;IAChC,oDAAoD;IAC7C,cAAc,CAAC;IACtB,wDAAwD;IACjD,SAAS,CAAC;IACjB,8DAA8D;IACvD,WAAW,CAAC;IAdrB;IACE,6CAA6C;IACtC,MAAM,EAAE,MAAM;IACrB,mDAAmD;IAC5C,MAAM,EAAE,QAAQ;IACvB,+EAA+E;IACxE,eAAe,EAAE,iBAAiB,GAAG,SAAS;IACrD,gDAAgD;IACzC,KAAK,EAAE,MAAM,GAAG,SAAS;IAChC,oDAAoD;IAC7C,cAAc,CAAC,oBAAQ;IAC9B,wDAAwD;IACjD,SAAS,CAAC,uBAAW;IAC5B,8DAA8D;IACvD,WAAW,CAAC,yBAAa,EAC9B;IAEJ,iEAAiE;IACjE,qBAAqB,IAAI,OAAO,CAE/B;IAED,0DAA0D;IAC1D,oBAAoB,IAAI,OAAO,CAE9B;IAED,mHAAmH;IACnH,OAAO,IAAI,OAAO,CAOjB;IAED,kDAAkD;IAClD,SAAS,IAAI,OAAO,CAEnB;IAED,mDAAmD;IACnD,SAAS,IAAI,OAAO,CAEnB;IAED,MAAM,CAAC,KAAK,cAEX;IAED,MAAM,KAAK,MAAM,IAAI,MAAM,CAAC,SAAS,CAAC,CAYrC;IAED,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE;QAClB,MAAM,EAAE,MAAM,CAAC;QACf,MAAM,EAAE,QAAQ,CAAC;QACjB,eAAe,CAAC,EAAE,iBAAiB,CAAC;QACpC,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,SAAS,CAAC,EAAE,SAAS,CAAC;QACtB,WAAW,CAAC,EAAE,WAAW,CAAC;KAC3B,aAUA;IAED,OAAc,6BAA6B,CAAC,UAAU,EAAE,UAAU,GAAG,iBAAiB,CAYrF;CACF"}
|
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)) {
|
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.e310a4c8",
|
|
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.e310a4c8",
|
|
83
|
+
"@aztec/blob-lib": "0.0.1-commit.e310a4c8",
|
|
84
|
+
"@aztec/constants": "0.0.1-commit.e310a4c8",
|
|
85
|
+
"@aztec/ethereum": "0.0.1-commit.e310a4c8",
|
|
86
|
+
"@aztec/foundation": "0.0.1-commit.e310a4c8",
|
|
87
|
+
"@aztec/l1-artifacts": "0.0.1-commit.e310a4c8",
|
|
88
|
+
"@aztec/noir-noirc_abi": "0.0.1-commit.e310a4c8",
|
|
89
|
+
"@aztec/validator-ha-signer": "0.0.1-commit.e310a4c8",
|
|
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