@aztec/stdlib 0.0.1-commit.f295ac2 → 0.0.1-commit.f8ca9b2f3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dest/abi/function_call.d.ts +39 -9
- package/dest/abi/function_call.d.ts.map +1 -1
- package/dest/abi/function_call.js +20 -3
- 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 +5 -5
- 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/index.d.ts +2 -1
- package/dest/config/index.d.ts.map +1 -1
- package/dest/config/index.js +1 -0
- package/dest/config/node-rpc-config.js +1 -1
- package/dest/config/sequencer-config.d.ts +10 -0
- package/dest/config/sequencer-config.d.ts.map +1 -0
- package/dest/config/sequencer-config.js +12 -0
- 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/interfaces/node-info.d.ts +3 -1
- package/dest/contract/interfaces/node-info.d.ts.map +1 -1
- package/dest/contract/interfaces/node-info.js +2 -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 +7 -1
- package/dest/epoch-helpers/index.d.ts.map +1 -1
- package/dest/epoch-helpers/index.js +9 -3
- 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 +20 -2
- package/dest/interfaces/aztec-node-admin.d.ts.map +1 -1
- package/dest/interfaces/aztec-node-admin.js +3 -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 +15 -8
- package/dest/interfaces/get_logs_response.d.ts.map +1 -1
- package/dest/interfaces/l2_logs_source.d.ts +14 -5
- package/dest/interfaces/l2_logs_source.d.ts.map +1 -1
- package/dest/interfaces/p2p.d.ts +2 -2
- package/dest/interfaces/p2p.d.ts.map +1 -1
- package/dest/interfaces/prover-broker.d.ts +16 -1
- package/dest/interfaces/prover-broker.d.ts.map +1 -1
- package/dest/interfaces/prover-broker.js +4 -1
- package/dest/interfaces/prover-client.d.ts +15 -1
- package/dest/interfaces/prover-client.d.ts.map +1 -1
- package/dest/interfaces/prover-client.js +12 -1
- package/dest/interfaces/proving-job.d.ts +200 -200
- package/dest/interfaces/slasher.d.ts +9 -1
- package/dest/interfaces/slasher.d.ts.map +1 -1
- package/dest/interfaces/slasher.js +2 -0
- 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 +50 -4
- package/dest/interfaces/validator.d.ts.map +1 -1
- package/dest/interfaces/validator.js +4 -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 +13 -7
- package/dest/logs/extended_public_log.d.ts.map +1 -1
- package/dest/logs/log_id.d.ts +17 -14
- package/dest/logs/log_id.d.ts.map +1 -1
- package/dest/logs/log_id.js +20 -17
- 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/messaging/l2_to_l1_membership.d.ts +2 -2
- package/dest/messaging/l2_to_l1_membership.js +3 -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 +17 -3
- package/dest/p2p/checkpoint_proposal.d.ts.map +1 -1
- package/dest/p2p/checkpoint_proposal.js +9 -0
- package/dest/p2p/constants.d.ts +5 -0
- package/dest/p2p/constants.d.ts.map +1 -0
- package/dest/p2p/constants.js +3 -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/rollup/checkpoint_rollup_public_inputs.d.ts +6 -6
- package/dest/rollup/checkpoint_rollup_public_inputs.d.ts.map +1 -1
- package/dest/rollup/checkpoint_rollup_public_inputs.js +2 -2
- package/dest/rollup/checkpoint_root_rollup_private_inputs.d.ts +2 -2
- package/dest/rollup/checkpoint_root_rollup_private_inputs.d.ts.map +1 -1
- package/dest/rollup/root_rollup_public_inputs.d.ts +6 -6
- package/dest/rollup/root_rollup_public_inputs.d.ts.map +1 -1
- package/dest/rollup/root_rollup_public_inputs.js +3 -3
- package/dest/slashing/empire.d.ts +1 -1
- package/dest/slashing/empire.d.ts.map +1 -1
- package/dest/slashing/empire.js +2 -0
- package/dest/slashing/helpers.d.ts +2 -2
- package/dest/slashing/helpers.d.ts.map +1 -1
- package/dest/slashing/helpers.js +6 -0
- package/dest/slashing/tally.d.ts +2 -1
- package/dest/slashing/tally.d.ts.map +1 -1
- package/dest/slashing/tally.js +6 -2
- package/dest/slashing/types.d.ts +7 -3
- package/dest/slashing/types.d.ts.map +1 -1
- package/dest/slashing/types.js +13 -1
- package/dest/stats/stats.d.ts +1 -3
- package/dest/stats/stats.d.ts.map +1 -1
- package/dest/tests/factories.js +4 -4
- 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/timetable/index.d.ts +37 -0
- package/dest/timetable/index.d.ts.map +1 -0
- package/dest/timetable/index.js +39 -0
- package/dest/trees/public_data_leaf.d.ts +2 -1
- package/dest/trees/public_data_leaf.d.ts.map +1 -1
- package/dest/trees/public_data_leaf.js +7 -6
- 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/empty_validator.d.ts +2 -2
- package/dest/tx/validator/empty_validator.d.ts.map +1 -1
- 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/dest/tx/validator/tx_validator.d.ts +2 -2
- package/dest/tx/validator/tx_validator.d.ts.map +1 -1
- package/package.json +24 -12
- package/src/abi/function_call.ts +25 -3
- 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 +8 -8
- 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/index.ts +1 -0
- package/src/config/node-rpc-config.ts +1 -1
- package/src/config/sequencer-config.ts +19 -0
- package/src/contract/contract_address.ts +1 -1
- package/src/contract/contract_class_id.ts +1 -1
- package/src/contract/interfaces/node-info.ts +3 -0
- 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 +13 -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-admin.ts +3 -2
- 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/p2p.ts +1 -1
- package/src/interfaces/prover-broker.ts +22 -0
- package/src/interfaces/prover-client.ts +22 -0
- package/src/interfaces/slasher.ts +4 -0
- package/src/interfaces/tx_provider.ts +2 -2
- package/src/interfaces/validator.ts +12 -5
- 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 +22 -18
- package/src/logs/siloed_tag.ts +3 -2
- package/src/messaging/l2_to_l1_membership.ts +3 -3
- package/src/p2p/block_proposal.ts +12 -5
- package/src/p2p/checkpoint_proposal.ts +19 -2
- package/src/p2p/constants.ts +6 -0
- package/src/p2p/index.ts +1 -0
- package/src/p2p/message_validator.ts +14 -2
- package/src/rollup/checkpoint_rollup_public_inputs.ts +5 -5
- package/src/rollup/root_rollup_public_inputs.ts +7 -7
- package/src/slashing/empire.ts +3 -1
- package/src/slashing/helpers.ts +8 -0
- package/src/slashing/tally.ts +8 -2
- package/src/slashing/types.ts +14 -0
- package/src/stats/stats.ts +0 -2
- package/src/tests/factories.ts +6 -6
- package/src/tests/jest.ts +9 -9
- package/src/tests/mocks.ts +26 -17
- package/src/timetable/index.ts +66 -0
- package/src/trees/public_data_leaf.ts +11 -5
- 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/empty_validator.ts +1 -1
- package/src/tx/validator/error_texts.ts +3 -0
- package/src/tx/validator/tx_validator.ts +1 -1
- 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.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Buffer32 } from '@aztec/foundation/buffer';
|
|
2
|
-
import { arraySerializedSizeOfNonEmpty } from '@aztec/foundation/collection';
|
|
3
2
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
4
3
|
import { BufferReader, serializeArrayOfBufferableToVector, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
5
4
|
import { z } from 'zod';
|
|
@@ -182,13 +181,17 @@ export class Tx extends Gossipable {
|
|
|
182
181
|
classPublishedCount: this.data.getNonEmptyContractClassLogsHashes().length,
|
|
183
182
|
contractClassLogSize: this.data.getEmittedContractClassLogsLength(),
|
|
184
183
|
proofSize: this.chonkProof.fields.length,
|
|
185
|
-
size: this.
|
|
184
|
+
size: this.getSize(),
|
|
186
185
|
feePaymentMethod: // needsSetup? then we pay through a fee payment contract
|
|
187
186
|
this.data.forPublic?.needsSetup ? 'fpc' : 'fee_juice'
|
|
188
187
|
};
|
|
189
188
|
}
|
|
189
|
+
sizeCache;
|
|
190
190
|
getSize() {
|
|
191
|
-
|
|
191
|
+
if (this.sizeCache == undefined) {
|
|
192
|
+
this.sizeCache = this.toBuffer().length;
|
|
193
|
+
}
|
|
194
|
+
return this.sizeCache;
|
|
192
195
|
}
|
|
193
196
|
/**
|
|
194
197
|
* Estimates the tx size based on its private effects. Note that the actual size of the tx
|
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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHhfcmVjZWlwdC5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3R4L3R4X3JlY2VpcHQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFdBQVcsRUFBcUIsTUFBTSxpQ0FBaUMsQ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UQsT0FBYyw2QkFBNkIsQ0FBQyxVQUFVLEVBQUUsVUFBVSxHQUFHLGlCQUFpQixDQVlyRjtDQUNGIn0=
|
|
@@ -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)) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AnyTx, TxValidationResult, TxValidator } from './tx_validator.js';
|
|
2
|
-
export declare class EmptyTxValidator<T
|
|
2
|
+
export declare class EmptyTxValidator<T = AnyTx> implements TxValidator<T> {
|
|
3
3
|
validateTx(_tx: T): Promise<TxValidationResult>;
|
|
4
4
|
}
|
|
5
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
5
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZW1wdHlfdmFsaWRhdG9yLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvdHgvdmFsaWRhdG9yL2VtcHR5X3ZhbGlkYXRvci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssRUFBRSxLQUFLLEVBQUUsa0JBQWtCLEVBQUUsV0FBVyxFQUFFLE1BQU0sbUJBQW1CLENBQUM7QUFFaEYscUJBQWEsZ0JBQWdCLENBQUMsQ0FBQyxHQUFHLEtBQUssQ0FBRSxZQUFXLFdBQVcsQ0FBQyxDQUFDLENBQUM7SUFDekQsVUFBVSxDQUFDLEdBQUcsRUFBRSxDQUFDLEdBQUcsT0FBTyxDQUFDLGtCQUFrQixDQUFDLENBRXJEO0NBQ0YifQ==
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"empty_validator.d.ts","sourceRoot":"","sources":["../../../src/tx/validator/empty_validator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhF,qBAAa,gBAAgB,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"empty_validator.d.ts","sourceRoot":"","sources":["../../../src/tx/validator/empty_validator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhF,qBAAa,gBAAgB,CAAC,CAAC,GAAG,KAAK,CAAE,YAAW,WAAW,CAAC,CAAC,CAAC;IACzD,UAAU,CAAC,GAAG,EAAE,CAAC,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAErD;CACF"}
|
|
@@ -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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZXJyb3JfdGV4dHMuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy90eC92YWxpZGF0b3IvZXJyb3JfdGV4dHMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQ0EsZUFBTyxNQUFNLGlDQUFpQyw2QkFBNkIsQ0FBQztBQUM1RSxlQUFPLE1BQU0sdUNBQXVDLG1DQUFtQyxDQUFDO0FBQ3hGLGVBQU8sTUFBTSwrQkFBK0IsOENBQThDLENBQUM7QUFDM0YsZUFBTyxNQUFNLDJCQUEyQix3RUFBd0UsQ0FBQztBQUdqSCxlQUFPLE1BQU0sbUNBQW1DLHFDQUFxQyxDQUFDO0FBR3RGLGVBQU8sTUFBTSxrQ0FBa0MsOEJBQThCLENBQUM7QUFDOUUsZUFBTyxNQUFNLDJCQUEyQix1QkFBdUIsQ0FBQztBQUdoRSxlQUFPLE1BQU0scUNBQXFDLGlDQUFpQyxDQUFDO0FBQ3BGLGVBQU8sTUFBTSw4QkFBOEIsMEJBQTBCLENBQUM7QUFDdEUsZUFBTyxNQUFNLGlDQUFpQyw2QkFBNkIsQ0FBQztBQUM1RSxlQUFPLE1BQU0sK0JBQStCLDBDQUEwQyxDQUFDO0FBQ3ZGLGVBQU8sTUFBTSwwQ0FBMEMsc0NBQXNDLENBQUM7QUFHOUYsZUFBTyxNQUFNLHNC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ACtG,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
|
|
@@ -14,7 +14,7 @@ export type TxValidationResult = {
|
|
|
14
14
|
result: 'skipped';
|
|
15
15
|
reason: string[];
|
|
16
16
|
};
|
|
17
|
-
export interface TxValidator<T
|
|
17
|
+
export interface TxValidator<T = AnyTx> {
|
|
18
18
|
validateTx(tx: T): Promise<TxValidationResult>;
|
|
19
19
|
}
|
|
20
20
|
export declare const TxValidationResultSchema: z.ZodDiscriminatedUnion<"result", [z.ZodObject<{
|
|
@@ -42,4 +42,4 @@ export declare const TxValidationResultSchema: z.ZodDiscriminatedUnion<"result",
|
|
|
42
42
|
result: "skipped";
|
|
43
43
|
reason: string[];
|
|
44
44
|
}>]>;
|
|
45
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
45
|
+
//# sourceMappingURL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oRDtBQUVELGVBQU8sTUFBTSx3QkFBd0I7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OztJQU1wQyxDQUFDIn0=
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tx_validator.d.ts","sourceRoot":"","sources":["../../../src/tx/validator/tx_validator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AACnC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAE5C,MAAM,MAAM,KAAK,GAAG,EAAE,GAAG,WAAW,CAAC;AAErC,wBAAgB,SAAS,CAAC,EAAE,EAAE,KAAK,GAAG,MAAM,CAE3C;AAED,wBAAgB,cAAc,CAAC,EAAE,EAAE,KAAK,GAAG,OAAO,CAEjD;AAED,MAAM,MAAM,kBAAkB,GAC1B;IAAE,MAAM,EAAE,OAAO,CAAA;CAAE,GACnB;IAAE,MAAM,EAAE,SAAS,CAAC;IAAC,MAAM,EAAE,MAAM,EAAE,CAAA;CAAE,GACvC;IAAE,MAAM,EAAE,SAAS,CAAC;IAAC,MAAM,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC;AAE5C,MAAM,WAAW,WAAW,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"tx_validator.d.ts","sourceRoot":"","sources":["../../../src/tx/validator/tx_validator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AACnC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAE5C,MAAM,MAAM,KAAK,GAAG,EAAE,GAAG,WAAW,CAAC;AAErC,wBAAgB,SAAS,CAAC,EAAE,EAAE,KAAK,GAAG,MAAM,CAE3C;AAED,wBAAgB,cAAc,CAAC,EAAE,EAAE,KAAK,GAAG,OAAO,CAEjD;AAED,MAAM,MAAM,kBAAkB,GAC1B;IAAE,MAAM,EAAE,OAAO,CAAA;CAAE,GACnB;IAAE,MAAM,EAAE,SAAS,CAAC;IAAC,MAAM,EAAE,MAAM,EAAE,CAAA;CAAE,GACvC;IAAE,MAAM,EAAE,SAAS,CAAC;IAAC,MAAM,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC;AAE5C,MAAM,WAAW,WAAW,CAAC,CAAC,GAAG,KAAK;IACpC,UAAU,CAAC,EAAE,EAAE,CAAC,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;CAChD;AAED,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;IAMpC,CAAC"}
|
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.f8ca9b2f3",
|
|
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",
|
|
@@ -60,11 +61,22 @@
|
|
|
60
61
|
"./zkpassport": "./dest/zkpassport/index.js",
|
|
61
62
|
"./slashing": "./dest/slashing/index.js",
|
|
62
63
|
"./l1-contracts": "./dest/l1-contracts/index.js",
|
|
63
|
-
"./world-state": "./dest/world-state/index.js"
|
|
64
|
+
"./world-state": "./dest/world-state/index.js",
|
|
65
|
+
"./timetable": "./dest/timetable/index.js"
|
|
64
66
|
},
|
|
65
67
|
"typedocOptions": {
|
|
66
68
|
"entryPoints": [
|
|
67
|
-
"./src/index.ts"
|
|
69
|
+
"./src/abi/index.ts",
|
|
70
|
+
"./src/aztec-address/index.ts",
|
|
71
|
+
"./src/block/index.ts",
|
|
72
|
+
"./src/contract/index.ts",
|
|
73
|
+
"./src/gas/index.ts",
|
|
74
|
+
"./src/hash/index.ts",
|
|
75
|
+
"./src/keys/index.ts",
|
|
76
|
+
"./src/logs/index.ts",
|
|
77
|
+
"./src/note/index.ts",
|
|
78
|
+
"./src/proofs/index.ts",
|
|
79
|
+
"./src/tx/index.ts"
|
|
68
80
|
],
|
|
69
81
|
"name": "stdlib",
|
|
70
82
|
"tsconfig": "./tsconfig.json"
|
|
@@ -78,14 +90,14 @@
|
|
|
78
90
|
},
|
|
79
91
|
"dependencies": {
|
|
80
92
|
"@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.
|
|
93
|
+
"@aztec/bb.js": "0.0.1-commit.f8ca9b2f3",
|
|
94
|
+
"@aztec/blob-lib": "0.0.1-commit.f8ca9b2f3",
|
|
95
|
+
"@aztec/constants": "0.0.1-commit.f8ca9b2f3",
|
|
96
|
+
"@aztec/ethereum": "0.0.1-commit.f8ca9b2f3",
|
|
97
|
+
"@aztec/foundation": "0.0.1-commit.f8ca9b2f3",
|
|
98
|
+
"@aztec/l1-artifacts": "0.0.1-commit.f8ca9b2f3",
|
|
99
|
+
"@aztec/noir-noirc_abi": "0.0.1-commit.f8ca9b2f3",
|
|
100
|
+
"@aztec/validator-ha-signer": "0.0.1-commit.f8ca9b2f3",
|
|
89
101
|
"@google-cloud/storage": "^7.15.0",
|
|
90
102
|
"axios": "^1.12.0",
|
|
91
103
|
"json-stringify-deterministic": "1.0.12",
|
package/src/abi/function_call.ts
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import type { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
2
|
import type { FieldsOf } from '@aztec/foundation/types';
|
|
3
3
|
|
|
4
|
+
import { z } from 'zod';
|
|
5
|
+
|
|
4
6
|
import { AztecAddress } from '../aztec-address/index.js';
|
|
5
|
-
import {
|
|
7
|
+
import { schemas } from '../schemas/index.js';
|
|
8
|
+
import { type AbiType, AbiTypeSchema, FunctionType } from './abi.js';
|
|
6
9
|
import { FunctionSelector } from './function_selector.js';
|
|
7
10
|
|
|
8
11
|
/** A request to call a function on a contract. */
|
|
@@ -43,12 +46,31 @@ export class FunctionCall {
|
|
|
43
46
|
return new FunctionCall(...FunctionCall.getFields(fields));
|
|
44
47
|
}
|
|
45
48
|
|
|
49
|
+
static get schema() {
|
|
50
|
+
return z
|
|
51
|
+
.object({
|
|
52
|
+
name: z.string(),
|
|
53
|
+
to: schemas.AztecAddress,
|
|
54
|
+
selector: schemas.FunctionSelector,
|
|
55
|
+
type: z.nativeEnum(FunctionType),
|
|
56
|
+
isStatic: z.boolean(),
|
|
57
|
+
hideMsgSender: z.boolean(),
|
|
58
|
+
args: z.array(schemas.Fr),
|
|
59
|
+
returnTypes: z.array(AbiTypeSchema),
|
|
60
|
+
})
|
|
61
|
+
.transform(FunctionCall.from);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
public isPublicStatic(): boolean {
|
|
65
|
+
return this.type === FunctionType.PUBLIC && this.isStatic;
|
|
66
|
+
}
|
|
67
|
+
|
|
46
68
|
/**
|
|
47
69
|
* Creates an empty function call.
|
|
48
70
|
* @returns an empty function call.
|
|
49
71
|
*/
|
|
50
72
|
public static empty() {
|
|
51
|
-
return {
|
|
73
|
+
return FunctionCall.from({
|
|
52
74
|
name: '',
|
|
53
75
|
to: AztecAddress.ZERO,
|
|
54
76
|
selector: FunctionSelector.empty(),
|
|
@@ -57,6 +79,6 @@ export class FunctionCall {
|
|
|
57
79
|
isStatic: false,
|
|
58
80
|
args: [],
|
|
59
81
|
returnTypes: [],
|
|
60
|
-
};
|
|
82
|
+
});
|
|
61
83
|
}
|
|
62
84
|
}
|
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.
|
|
@@ -17,8 +17,8 @@ export type DataInBlock<T> = {
|
|
|
17
17
|
|
|
18
18
|
export function randomInBlock(): InBlock {
|
|
19
19
|
return {
|
|
20
|
-
l2BlockNumber: BlockNumber(Math.floor(Math.random() * 1000)),
|
|
21
|
-
l2BlockHash:
|
|
20
|
+
l2BlockNumber: BlockNumber(Math.floor(Math.random() * 1000) + 1),
|
|
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