@aztec/stdlib 0.0.1-commit.dbf9cec → 0.0.1-commit.e0f15ab9b
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/abi.d.ts +138 -1
- package/dest/abi/abi.d.ts.map +1 -1
- package/dest/abi/abi.js +10 -2
- package/dest/abi/buffer.d.ts +14 -4
- package/dest/abi/buffer.d.ts.map +1 -1
- package/dest/abi/buffer.js +25 -4
- package/dest/abi/decoder.d.ts +2 -2
- package/dest/abi/decoder.d.ts.map +1 -1
- package/dest/abi/decoder.js +6 -1
- package/dest/abi/encoder.d.ts +1 -1
- package/dest/abi/encoder.d.ts.map +1 -1
- package/dest/abi/encoder.js +28 -1
- package/dest/abi/event_metadata_definition.d.ts +3 -1
- package/dest/abi/event_metadata_definition.d.ts.map +1 -1
- package/dest/abi/event_metadata_definition.js +1 -1
- package/dest/abi/utils.d.ts +14 -1
- package/dest/abi/utils.d.ts.map +1 -1
- package/dest/abi/utils.js +15 -0
- package/dest/avm/avm.d.ts +300 -300
- package/dest/block/l2_block.d.ts +9 -1
- package/dest/block/l2_block.d.ts.map +1 -1
- package/dest/block/l2_block.js +12 -2
- package/dest/block/l2_block_source.d.ts +16 -8
- package/dest/block/l2_block_source.d.ts.map +1 -1
- package/dest/checkpoint/checkpoint.d.ts +2 -1
- package/dest/checkpoint/checkpoint.d.ts.map +1 -1
- package/dest/checkpoint/checkpoint.js +9 -4
- package/dest/checkpoint/index.d.ts +2 -1
- package/dest/checkpoint/index.d.ts.map +1 -1
- package/dest/checkpoint/index.js +1 -0
- package/dest/checkpoint/validate.d.ts +36 -0
- package/dest/checkpoint/validate.d.ts.map +1 -0
- package/dest/checkpoint/validate.js +120 -0
- 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/pipelining-config.d.ts +19 -0
- package/dest/config/pipelining-config.d.ts.map +1 -0
- package/dest/config/pipelining-config.js +18 -0
- package/dest/config/sequencer-config.d.ts +4 -2
- package/dest/config/sequencer-config.d.ts.map +1 -1
- package/dest/config/sequencer-config.js +6 -0
- package/dest/contract/contract_address.d.ts +3 -3
- package/dest/contract/contract_address.js +3 -3
- package/dest/contract/contract_class_id.d.ts +2 -2
- package/dest/contract/contract_class_id.js +2 -2
- package/dest/contract/index.d.ts +1 -3
- package/dest/contract/index.d.ts.map +1 -1
- package/dest/contract/index.js +0 -2
- package/dest/contract/interfaces/contract_class.d.ts +3 -156
- package/dest/contract/interfaces/contract_class.d.ts.map +1 -1
- package/dest/contract/interfaces/contract_class.js +1 -28
- 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 +10 -2
- package/dest/gas/gas_fees.d.ts +1 -1
- package/dest/gas/gas_fees.d.ts.map +1 -1
- package/dest/gas/gas_fees.js +4 -1
- package/dest/ha-signing/config.d.ts +49 -14
- package/dest/ha-signing/config.d.ts.map +1 -1
- package/dest/ha-signing/config.js +20 -15
- package/dest/ha-signing/index.d.ts +3 -2
- package/dest/ha-signing/index.d.ts.map +1 -1
- package/dest/ha-signing/index.js +2 -1
- package/dest/ha-signing/local_config.d.ts +63 -0
- package/dest/ha-signing/local_config.d.ts.map +1 -0
- package/dest/ha-signing/local_config.js +24 -0
- package/dest/hash/hash.d.ts +16 -1
- package/dest/hash/hash.d.ts.map +1 -1
- package/dest/hash/hash.js +24 -0
- package/dest/interfaces/allowed_element.d.ts +26 -20
- package/dest/interfaces/allowed_element.d.ts.map +1 -1
- package/dest/interfaces/allowed_element.js +8 -8
- package/dest/interfaces/archiver.d.ts +1 -1
- package/dest/interfaces/archiver.d.ts.map +1 -1
- package/dest/interfaces/archiver.js +3 -2
- package/dest/interfaces/aztec-node-admin.d.ts +76 -30
- package/dest/interfaces/aztec-node-admin.d.ts.map +1 -1
- package/dest/interfaces/aztec-node.d.ts +12 -6
- package/dest/interfaces/aztec-node.d.ts.map +1 -1
- package/dest/interfaces/aztec-node.js +5 -2
- package/dest/interfaces/block-builder.d.ts +38 -11
- package/dest/interfaces/block-builder.d.ts.map +1 -1
- package/dest/interfaces/block-builder.js +13 -6
- package/dest/interfaces/configs.d.ts +62 -32
- package/dest/interfaces/configs.d.ts.map +1 -1
- package/dest/interfaces/configs.js +6 -2
- package/dest/interfaces/l2_logs_source.d.ts +5 -3
- package/dest/interfaces/l2_logs_source.d.ts.map +1 -1
- package/dest/interfaces/merkle_tree_operations.d.ts +9 -19
- package/dest/interfaces/merkle_tree_operations.d.ts.map +1 -1
- package/dest/interfaces/prover-client.d.ts +6 -1
- package/dest/interfaces/prover-client.d.ts.map +1 -1
- package/dest/interfaces/prover-client.js +7 -1
- package/dest/interfaces/proving-job.d.ts +200 -200
- package/dest/interfaces/validator.d.ts +103 -41
- package/dest/interfaces/validator.d.ts.map +1 -1
- package/dest/interfaces/validator.js +8 -4
- package/dest/interfaces/world_state.d.ts +5 -4
- package/dest/interfaces/world_state.d.ts.map +1 -1
- package/dest/kernel/private_kernel_tail_circuit_public_inputs.d.ts +2 -1
- package/dest/kernel/private_kernel_tail_circuit_public_inputs.d.ts.map +1 -1
- package/dest/kernel/private_kernel_tail_circuit_public_inputs.js +4 -0
- package/dest/kv-store/config.d.ts +17 -0
- package/dest/kv-store/config.d.ts.map +1 -0
- package/dest/kv-store/config.js +26 -0
- package/dest/kv-store/index.d.ts +2 -0
- package/dest/kv-store/index.d.ts.map +1 -0
- package/dest/kv-store/index.js +1 -0
- package/dest/logs/index.d.ts +2 -1
- package/dest/logs/index.d.ts.map +1 -1
- package/dest/logs/index.js +1 -0
- package/dest/logs/log_filter.d.ts +4 -1
- package/dest/logs/log_filter.d.ts.map +1 -1
- package/dest/logs/log_filter.js +2 -1
- package/dest/logs/public_log.d.ts +4 -3
- package/dest/logs/public_log.d.ts.map +1 -1
- package/dest/logs/public_log.js +2 -1
- package/dest/logs/tagging_index_range.d.ts +40 -0
- package/dest/logs/tagging_index_range.d.ts.map +1 -0
- package/dest/logs/tagging_index_range.js +8 -0
- package/dest/logs/tx_scoped_l2_log.d.ts +3 -1
- package/dest/logs/tx_scoped_l2_log.d.ts.map +1 -1
- package/dest/logs/tx_scoped_l2_log.js +7 -0
- package/dest/messaging/l1_to_l2_message_source.d.ts +4 -2
- package/dest/messaging/l1_to_l2_message_source.d.ts.map +1 -1
- package/dest/messaging/l2_to_l1_membership.d.ts +32 -6
- package/dest/messaging/l2_to_l1_membership.d.ts.map +1 -1
- package/dest/messaging/l2_to_l1_membership.js +69 -26
- package/dest/noir/index.d.ts +3 -3
- package/dest/noir/index.d.ts.map +1 -1
- package/dest/p2p/checkpoint_proposal.d.ts +1 -6
- package/dest/p2p/checkpoint_proposal.d.ts.map +1 -1
- package/dest/p2p/checkpoint_proposal.js +13 -23
- package/dest/p2p/peer_error.d.ts +3 -1
- package/dest/p2p/peer_error.d.ts.map +1 -1
- package/dest/p2p/peer_error.js +5 -0
- package/dest/slashing/tally.d.ts +7 -2
- package/dest/slashing/tally.d.ts.map +1 -1
- package/dest/slashing/tally.js +30 -2
- package/dest/tests/factories.d.ts +2 -4
- package/dest/tests/factories.d.ts.map +1 -1
- package/dest/tests/factories.js +0 -27
- package/dest/tests/mocks.d.ts +4 -2
- package/dest/tests/mocks.d.ts.map +1 -1
- package/dest/tests/mocks.js +13 -8
- package/dest/tx/block_header.d.ts +3 -1
- package/dest/tx/block_header.d.ts.map +1 -1
- package/dest/tx/block_header.js +4 -0
- package/dest/tx/private_execution_result.d.ts +6 -6
- package/dest/tx/private_execution_result.d.ts.map +1 -1
- package/dest/tx/private_execution_result.js +6 -6
- package/dest/tx/profiling.d.ts +14 -2
- package/dest/tx/profiling.d.ts.map +1 -1
- package/dest/tx/profiling.js +13 -3
- package/dest/tx/simulated_tx.d.ts +113 -2
- package/dest/tx/simulated_tx.d.ts.map +1 -1
- package/dest/tx/simulated_tx.js +4 -1
- package/dest/tx/tx.d.ts +6 -5
- package/dest/tx/tx.d.ts.map +1 -1
- package/dest/tx/tx.js +18 -6
- package/dest/tx/tx_receipt.d.ts +7 -2
- package/dest/tx/tx_receipt.d.ts.map +1 -1
- package/dest/tx/tx_receipt.js +6 -3
- package/dest/tx/validator/error_texts.d.ts +9 -1
- package/dest/tx/validator/error_texts.d.ts.map +1 -1
- package/dest/tx/validator/error_texts.js +10 -0
- package/dest/update-checker/index.d.ts +3 -2
- package/dest/update-checker/index.d.ts.map +1 -1
- package/dest/update-checker/index.js +2 -1
- package/dest/update-checker/package_version.d.ts +3 -0
- package/dest/update-checker/package_version.d.ts.map +1 -0
- package/dest/update-checker/package_version.js +24 -0
- package/dest/update-checker/version_checker.d.ts +25 -0
- package/dest/update-checker/version_checker.d.ts.map +1 -0
- package/dest/update-checker/version_checker.js +50 -0
- package/dest/validators/errors.d.ts +6 -1
- package/dest/validators/errors.d.ts.map +1 -1
- package/dest/validators/errors.js +7 -0
- package/dest/versioning/versioning.d.ts +4 -2
- package/dest/versioning/versioning.d.ts.map +1 -1
- package/dest/versioning/versioning.js +4 -1
- package/package.json +10 -9
- package/src/abi/abi.ts +25 -2
- package/src/abi/buffer.ts +25 -4
- package/src/abi/decoder.ts +14 -2
- package/src/abi/encoder.ts +41 -1
- package/src/abi/event_metadata_definition.ts +2 -0
- package/src/abi/utils.ts +25 -0
- package/src/block/l2_block.ts +13 -1
- package/src/block/l2_block_source.ts +16 -7
- package/src/checkpoint/checkpoint.ts +12 -3
- package/src/checkpoint/index.ts +1 -0
- package/src/checkpoint/validate.ts +230 -0
- package/src/config/index.ts +1 -0
- package/src/config/pipelining-config.ts +31 -0
- package/src/config/sequencer-config.ts +9 -1
- package/src/contract/contract_address.ts +3 -3
- package/src/contract/contract_class_id.ts +2 -2
- package/src/contract/index.ts +0 -2
- package/src/contract/interfaces/contract_class.ts +2 -82
- package/src/epoch-helpers/index.ts +14 -0
- package/src/gas/README.md +123 -0
- package/src/gas/gas_fees.ts +7 -1
- package/src/ha-signing/config.ts +45 -38
- package/src/ha-signing/index.ts +9 -0
- package/src/ha-signing/local_config.ts +46 -0
- package/src/hash/hash.ts +29 -0
- package/src/interfaces/allowed_element.ts +29 -9
- package/src/interfaces/archiver.ts +3 -2
- package/src/interfaces/aztec-node.ts +24 -5
- package/src/interfaces/block-builder.ts +60 -14
- package/src/interfaces/configs.ts +25 -8
- package/src/interfaces/l2_logs_source.ts +4 -1
- package/src/interfaces/merkle_tree_operations.ts +8 -18
- package/src/interfaces/prover-client.ts +8 -0
- package/src/interfaces/validator.ts +50 -28
- package/src/interfaces/world_state.ts +4 -3
- package/src/kernel/private_kernel_tail_circuit_public_inputs.ts +9 -0
- package/src/kv-store/config.ts +36 -0
- package/src/kv-store/index.ts +1 -0
- package/src/logs/index.ts +1 -0
- package/src/logs/log_filter.ts +5 -0
- package/src/logs/public_log.ts +4 -2
- package/src/logs/tagging_index_range.ts +24 -0
- package/src/logs/tx_scoped_l2_log.ts +16 -0
- package/src/messaging/l1_to_l2_message_source.ts +3 -1
- package/src/messaging/l2_to_l1_membership.ts +98 -33
- package/src/noir/index.ts +2 -2
- package/src/p2p/checkpoint_proposal.ts +23 -37
- package/src/p2p/peer_error.ts +7 -0
- package/src/slashing/tally.ts +34 -1
- package/src/tests/factories.ts +0 -33
- package/src/tests/mocks.ts +18 -7
- package/src/tx/block_header.ts +6 -0
- package/src/tx/private_execution_result.ts +5 -5
- package/src/tx/profiling.ts +11 -2
- package/src/tx/simulated_tx.ts +8 -1
- package/src/tx/tx.ts +20 -11
- package/src/tx/tx_receipt.ts +7 -2
- package/src/tx/validator/error_texts.ts +12 -0
- package/src/update-checker/index.ts +2 -1
- package/src/update-checker/package_version.ts +30 -0
- package/src/update-checker/version_checker.ts +65 -0
- package/src/validators/errors.ts +9 -0
- package/src/versioning/versioning.ts +4 -1
- package/dest/contract/private_function_membership_proof.d.ts +0 -32
- package/dest/contract/private_function_membership_proof.d.ts.map +0 -1
- package/dest/contract/private_function_membership_proof.js +0 -124
- package/dest/contract/utility_function_membership_proof.d.ts +0 -27
- package/dest/contract/utility_function_membership_proof.d.ts.map +0 -1
- package/dest/contract/utility_function_membership_proof.js +0 -87
- package/dest/update-checker/update-checker.d.ts +0 -49
- package/dest/update-checker/update-checker.d.ts.map +0 -1
- package/dest/update-checker/update-checker.js +0 -130
- package/src/contract/private_function_membership_proof.ts +0 -167
- package/src/contract/utility_function_membership_proof.ts +0 -118
- package/src/update-checker/update-checker.ts +0 -166
package/dest/tx/tx_receipt.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BlockNumberSchema } from '@aztec/foundation/branded-types';
|
|
1
|
+
import { BlockNumberSchema, EpochNumberSchema } from '@aztec/foundation/branded-types';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import { RevertCode } from '../avm/revert_code.js';
|
|
4
4
|
import { BlockHash } from '../block/block_hash.js';
|
|
@@ -42,8 +42,9 @@ import { TxHash } from './tx_hash.js';
|
|
|
42
42
|
transactionFee;
|
|
43
43
|
blockHash;
|
|
44
44
|
blockNumber;
|
|
45
|
+
epochNumber;
|
|
45
46
|
debugLogs;
|
|
46
|
-
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, /**
|
|
47
|
+
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, /** The epoch number in which the transaction was included. */ epochNumber, /**
|
|
47
48
|
* Debug logs collected during public function execution. Served only when the node is in test mode and placed on
|
|
48
49
|
* the receipt only because it's a convenient place for it (the logs are printed out by the wallet when a mined
|
|
49
50
|
* tx receipt is obtained).
|
|
@@ -55,6 +56,7 @@ import { TxHash } from './tx_hash.js';
|
|
|
55
56
|
this.transactionFee = transactionFee;
|
|
56
57
|
this.blockHash = blockHash;
|
|
57
58
|
this.blockNumber = blockNumber;
|
|
59
|
+
this.epochNumber = epochNumber;
|
|
58
60
|
this.debugLogs = debugLogs;
|
|
59
61
|
}
|
|
60
62
|
/** Returns true if the transaction was executed successfully. */ hasExecutionSucceeded() {
|
|
@@ -83,12 +85,13 @@ import { TxHash } from './tx_hash.js';
|
|
|
83
85
|
error: z.string().optional(),
|
|
84
86
|
blockHash: BlockHash.schema.optional(),
|
|
85
87
|
blockNumber: BlockNumberSchema.optional(),
|
|
88
|
+
epochNumber: EpochNumberSchema.optional(),
|
|
86
89
|
transactionFee: schemas.BigInt.optional(),
|
|
87
90
|
debugLogs: z.array(DebugLog.schema).optional()
|
|
88
91
|
}).transform((fields)=>TxReceipt.from(fields));
|
|
89
92
|
}
|
|
90
93
|
static from(fields) {
|
|
91
|
-
return new TxReceipt(fields.txHash, fields.status, fields.executionResult, fields.error, fields.transactionFee, fields.blockHash, fields.blockNumber, fields.debugLogs);
|
|
94
|
+
return new TxReceipt(fields.txHash, fields.status, fields.executionResult, fields.error, fields.transactionFee, fields.blockHash, fields.blockNumber, fields.epochNumber, fields.debugLogs);
|
|
92
95
|
}
|
|
93
96
|
static executionResultFromRevertCode(revertCode) {
|
|
94
97
|
if (revertCode.equals(RevertCode.OK)) {
|
|
@@ -3,6 +3,10 @@ export declare const TX_ERROR_INSUFFICIENT_FEE_PAYER_BALANCE = "Insufficient fee
|
|
|
3
3
|
export declare const TX_ERROR_INSUFFICIENT_GAS_LIMIT = "Gas limit is below the minimum fixed cost";
|
|
4
4
|
export declare const TX_ERROR_GAS_LIMIT_TOO_HIGH = "Gas limit is higher than the amount of gas that the AVM can process";
|
|
5
5
|
export declare const TX_ERROR_SETUP_FUNCTION_NOT_ALLOWED = "Setup function not on allow list";
|
|
6
|
+
export declare const TX_ERROR_SETUP_FUNCTION_UNKNOWN_CONTRACT = "Setup function targets unknown contract";
|
|
7
|
+
export declare const TX_ERROR_SETUP_ONLY_SELF_WRONG_SENDER = "Setup only_self function called with incorrect msg_sender";
|
|
8
|
+
export declare const TX_ERROR_SETUP_NULL_MSG_SENDER = "Setup function called with null msg sender";
|
|
9
|
+
export declare const TX_ERROR_SETUP_WRONG_CALLDATA_LENGTH = "Setup function called with wrong calldata length";
|
|
6
10
|
export declare const TX_ERROR_DUPLICATE_NULLIFIER_IN_TX = "Duplicate nullifier in tx";
|
|
7
11
|
export declare const TX_ERROR_EXISTING_NULLIFIER = "Existing nullifier";
|
|
8
12
|
export declare const TX_ERROR_INVALID_EXPIRATION_TIMESTAMP = "Invalid expiration timestamp";
|
|
@@ -21,5 +25,9 @@ export declare const TX_ERROR_CONTRACT_CLASS_LOG_SORTING = "Incorrectly sorted c
|
|
|
21
25
|
export declare const TX_ERROR_INCORRECT_HASH = "Incorrect tx hash";
|
|
22
26
|
export declare const TX_ERROR_SIZE_ABOVE_LIMIT = "Transaction size above size limit";
|
|
23
27
|
export declare const TX_ERROR_BLOCK_HEADER = "Block header not found";
|
|
28
|
+
export declare const TX_ERROR_INCORRECT_CONTRACT_ADDRESS = "Incorrect contract instance deployment address";
|
|
29
|
+
export declare const TX_ERROR_MALFORMED_CONTRACT_INSTANCE_LOG = "Failed to parse contract instance deployment log";
|
|
30
|
+
export declare const TX_ERROR_INCORRECT_CONTRACT_CLASS_ID = "Incorrect contract class id";
|
|
31
|
+
export declare const TX_ERROR_MALFORMED_CONTRACT_CLASS_LOG = "Failed to parse contract class registration log";
|
|
24
32
|
export declare const TX_ERROR_DURING_VALIDATION = "Unexpected error during validation";
|
|
25
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
33
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZXJyb3JfdGV4dHMuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL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kNBQTZDLENBQUM7QUFDNUYsZUFBTyxNQUFNLGtDQUFrQyx5Q0FBeUMsQ0FBQztBQUN6RixlQUFPLE1BQU0sNEJBQTRCLG1DQUFtQyxDQUFDO0FBQzdFLGVBQU8sTUFBTSxtQ0FBbUMsMkNBQTJDLENBQUM7QUFDNUYsZUFBTyxNQUFNLHVCQUF1QixzQkFBc0IsQ0FBQztBQUczRCxlQUFPLE1BQU0seUJBQXlCLHNDQUFzQyxDQUFDO0FBRzdFLGVBQU8sTUFBTSxxQkFBcUIsMkJBQTJCLENBQUM7QUFHOUQsZUFBTyxNQUFNLG1DQUFtQyxtREFBbUQsQ0FBQztBQUNwRyxlQUFPLE1BQU0sd0NBQXdDLHFEQUFxRCxDQUFDO0FBRzNHLGVBQU8sTUFBTSxvQ0FBb0MsZ0NBQWdDLENBQUM7QUFDbEYsZUFBTyxNQUFNLHFDQUFxQyxvREFBb0QsQ0FBQztBQUd2RyxlQUFPLE1BQU0sMEJBQTBCLHVDQUF1QyxDQUFDIn0=
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error_texts.d.ts","sourceRoot":"","sources":["../../../src/tx/validator/error_texts.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,iCAAiC,6BAA6B,CAAC;AAC5E,eAAO,MAAM,uCAAuC,mCAAmC,CAAC;AACxF,eAAO,MAAM,+BAA+B,8CAA8C,CAAC;AAC3F,eAAO,MAAM,2BAA2B,wEAAwE,CAAC;AAGjH,eAAO,MAAM,mCAAmC,qCAAqC,CAAC;
|
|
1
|
+
{"version":3,"file":"error_texts.d.ts","sourceRoot":"","sources":["../../../src/tx/validator/error_texts.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,iCAAiC,6BAA6B,CAAC;AAC5E,eAAO,MAAM,uCAAuC,mCAAmC,CAAC;AACxF,eAAO,MAAM,+BAA+B,8CAA8C,CAAC;AAC3F,eAAO,MAAM,2BAA2B,wEAAwE,CAAC;AAGjH,eAAO,MAAM,mCAAmC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|
export const TX_ERROR_GAS_LIMIT_TOO_HIGH = 'Gas limit is higher than the amount of gas that the AVM can process';
|
|
6
6
|
// Phases
|
|
7
7
|
export const TX_ERROR_SETUP_FUNCTION_NOT_ALLOWED = 'Setup function not on allow list';
|
|
8
|
+
export const TX_ERROR_SETUP_FUNCTION_UNKNOWN_CONTRACT = 'Setup function targets unknown contract';
|
|
9
|
+
export const TX_ERROR_SETUP_ONLY_SELF_WRONG_SENDER = 'Setup only_self function called with incorrect msg_sender';
|
|
10
|
+
export const TX_ERROR_SETUP_NULL_MSG_SENDER = 'Setup function called with null msg sender';
|
|
11
|
+
export const TX_ERROR_SETUP_WRONG_CALLDATA_LENGTH = 'Setup function called with wrong calldata length';
|
|
8
12
|
// Nullifiers
|
|
9
13
|
export const TX_ERROR_DUPLICATE_NULLIFIER_IN_TX = 'Duplicate nullifier in tx';
|
|
10
14
|
export const TX_ERROR_EXISTING_NULLIFIER = 'Existing nullifier';
|
|
@@ -29,5 +33,11 @@ export const TX_ERROR_INCORRECT_HASH = 'Incorrect tx hash';
|
|
|
29
33
|
export const TX_ERROR_SIZE_ABOVE_LIMIT = 'Transaction size above size limit';
|
|
30
34
|
// Block header
|
|
31
35
|
export const TX_ERROR_BLOCK_HEADER = 'Block header not found';
|
|
36
|
+
// Contract instance
|
|
37
|
+
export const TX_ERROR_INCORRECT_CONTRACT_ADDRESS = 'Incorrect contract instance deployment address';
|
|
38
|
+
export const TX_ERROR_MALFORMED_CONTRACT_INSTANCE_LOG = 'Failed to parse contract instance deployment log';
|
|
39
|
+
// Contract class
|
|
40
|
+
export const TX_ERROR_INCORRECT_CONTRACT_CLASS_ID = 'Incorrect contract class id';
|
|
41
|
+
export const TX_ERROR_MALFORMED_CONTRACT_CLASS_LOG = 'Failed to parse contract class registration log';
|
|
32
42
|
// General
|
|
33
43
|
export const TX_ERROR_DURING_VALIDATION = 'Unexpected error during validation';
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
export
|
|
2
|
-
|
|
1
|
+
export * from './package_version.js';
|
|
2
|
+
export * from './version_checker.js';
|
|
3
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy91cGRhdGUtY2hlY2tlci9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxjQUFjLHNCQUFzQixDQUFDO0FBQ3JDLGNBQWMsc0JBQXNCLENBQUMifQ==
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/update-checker/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/update-checker/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC"}
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export
|
|
1
|
+
export * from './package_version.js';
|
|
2
|
+
export * from './version_checker.js';
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/** Returns the package version from the release-please manifest or the package.json, or undefined if not found. */
|
|
2
|
+
export declare function getPackageVersion(): string | undefined;
|
|
3
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicGFja2FnZV92ZXJzaW9uLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvdXBkYXRlLWNoZWNrZXIvcGFja2FnZV92ZXJzaW9uLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUtBLG1IQUFtSDtBQUNuSCx3QkFBZ0IsaUJBQWlCLElBQUksTUFBTSxHQUFHLFNBQVMsQ0F1QnREIn0=
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"package_version.d.ts","sourceRoot":"","sources":["../../src/update-checker/package_version.ts"],"names":[],"mappings":"AAKA,mHAAmH;AACnH,wBAAgB,iBAAiB,IAAI,MAAM,GAAG,SAAS,CAuBtD"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { fileURLToPath } from '@aztec/foundation/url';
|
|
2
|
+
import { readFileSync } from 'fs';
|
|
3
|
+
import { dirname, resolve } from 'path';
|
|
4
|
+
/** Returns the package version from the release-please manifest or the package.json, or undefined if not found. */ export function getPackageVersion() {
|
|
5
|
+
const dir = dirname(fileURLToPath(import.meta.url));
|
|
6
|
+
// Try the release-please manifest first (works in dev/repo checkout).
|
|
7
|
+
try {
|
|
8
|
+
const releasePleaseManifestPath = resolve(dir, '../../../../.release-please-manifest.json');
|
|
9
|
+
return JSON.parse(readFileSync(releasePleaseManifestPath).toString())['.'];
|
|
10
|
+
} catch {
|
|
11
|
+
// Not in a repo checkout, fall through.
|
|
12
|
+
}
|
|
13
|
+
// Fall back to the stdlib package.json version (works in npm-installed packages).
|
|
14
|
+
try {
|
|
15
|
+
const packageJsonPath = resolve(dir, '../../package.json');
|
|
16
|
+
const version = JSON.parse(readFileSync(packageJsonPath).toString()).version;
|
|
17
|
+
if (version && version !== '0.1.0') {
|
|
18
|
+
return version;
|
|
19
|
+
}
|
|
20
|
+
} catch {
|
|
21
|
+
// No package.json found either.
|
|
22
|
+
}
|
|
23
|
+
return undefined;
|
|
24
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { EventEmitter } from 'node:events';
|
|
2
|
+
export type EventMap = {
|
|
3
|
+
newVersion: [{
|
|
4
|
+
name: string;
|
|
5
|
+
currentVersion: string;
|
|
6
|
+
latestVersion: string;
|
|
7
|
+
}];
|
|
8
|
+
};
|
|
9
|
+
export type VersionCheck = {
|
|
10
|
+
name: string;
|
|
11
|
+
currentVersion: string;
|
|
12
|
+
getLatestVersion: () => Promise<string | undefined>;
|
|
13
|
+
};
|
|
14
|
+
export declare class VersionChecker extends EventEmitter<EventMap> {
|
|
15
|
+
private checks;
|
|
16
|
+
private logger;
|
|
17
|
+
private runningPromise;
|
|
18
|
+
constructor(checks: Array<VersionCheck>, intervalCheckMs?: number, logger?: import("@aztec/foundation/log").Logger);
|
|
19
|
+
start(): void;
|
|
20
|
+
trigger(): Promise<void>;
|
|
21
|
+
stop(): Promise<void>;
|
|
22
|
+
private run;
|
|
23
|
+
private checkVersion;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidmVyc2lvbl9jaGVja2VyLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvdXBkYXRlLWNoZWNrZXIvdmVyc2lvbl9jaGVja2VyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUdBLE9BQU8sRUFBRSxZQUFZLEVBQUUsTUFBTSxhQUFhLENBQUM7QUFFM0MsTUFBTSxNQUFNLFFBQVEsR0FBRztJQUNyQixVQUFVLEVBQUUsQ0FBQztRQUFFLElBQUksRUFBRSxNQUFNLENBQUM7UUFBQyxjQUFjLEVBQUUsTUFBTSxDQUFDO1FBQUMsYUFBYSxFQUFFLE1BQU0sQ0FBQTtLQUFFLENBQUMsQ0FBQztDQUMvRSxDQUFDO0FBRUYsTUFBTSxNQUFNLFlBQVksR0FBRztJQUN6QixJQUFJLEVBQUUsTUFBTSxDQUFDO0lBQ2IsY0FBYyxFQUFFLE1BQU0sQ0FBQztJQUN2QixnQkFBZ0IsRUFBRSxNQUFNLE9BQU8sQ0FBQyxNQUFNLEdBQUcsU0FBUyxDQUFDLENBQUM7Q0FDckQsQ0FBQztBQUVGLHFCQUFhLGNBQWUsU0FBUSxZQUFZLENBQUMsUUFBUSxDQUFDO0lBR3RELE9BQU8sQ0FBQyxNQUFNO0lBRWQsT0FBTyxDQUFDLE1BQU07SUFKaEIsT0FBTyxDQUFDLGNBQWMsQ0FBaUI7SUFDdkMsWUFDVSxNQUFNLEVBQUUsS0FBSyxDQU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|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { createLogger } from '@aztec/foundation/log';
|
|
2
|
+
import { RunningPromise } from '@aztec/foundation/promise';
|
|
3
|
+
import { EventEmitter } from 'node:events';
|
|
4
|
+
export class VersionChecker extends EventEmitter {
|
|
5
|
+
checks;
|
|
6
|
+
logger;
|
|
7
|
+
runningPromise;
|
|
8
|
+
constructor(checks, intervalCheckMs = 60_000, logger = createLogger('version_checker')){
|
|
9
|
+
super(), this.checks = checks, this.logger = logger, this.run = async ()=>{
|
|
10
|
+
await Promise.allSettled(this.checks.map((check)=>this.checkVersion(check)));
|
|
11
|
+
};
|
|
12
|
+
this.runningPromise = new RunningPromise(this.run, logger, intervalCheckMs);
|
|
13
|
+
}
|
|
14
|
+
start() {
|
|
15
|
+
if (this.runningPromise.isRunning()) {
|
|
16
|
+
this.logger.warn('VersionChecker is already running');
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
this.runningPromise.start();
|
|
20
|
+
this.logger.info('Version check started');
|
|
21
|
+
}
|
|
22
|
+
trigger() {
|
|
23
|
+
return this.runningPromise.trigger();
|
|
24
|
+
}
|
|
25
|
+
async stop() {
|
|
26
|
+
if (!this.runningPromise.isRunning()) {
|
|
27
|
+
this.logger.warn('VersionChecker is not running');
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
await this.runningPromise.stop();
|
|
31
|
+
this.logger.info('Version checker stopped');
|
|
32
|
+
}
|
|
33
|
+
run;
|
|
34
|
+
async checkVersion({ name, currentVersion, getLatestVersion }) {
|
|
35
|
+
try {
|
|
36
|
+
const latestVersion = await getLatestVersion();
|
|
37
|
+
if (latestVersion && latestVersion !== currentVersion) {
|
|
38
|
+
this.emit('newVersion', {
|
|
39
|
+
name,
|
|
40
|
+
latestVersion,
|
|
41
|
+
currentVersion
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
} catch (err) {
|
|
45
|
+
this.logger.warn(`Error checking for new ${name} versions: ${err}`, {
|
|
46
|
+
err
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -19,6 +19,11 @@ export declare class TransactionsNotAvailableError extends ValidatorError {
|
|
|
19
19
|
export declare class FailedToReExecuteTransactionsError extends ValidatorError {
|
|
20
20
|
constructor(txHashes: TxHash[]);
|
|
21
21
|
}
|
|
22
|
+
export declare class ReExInitialStateMismatchError extends ValidatorError {
|
|
23
|
+
readonly expectedArchiveRoot: Fr;
|
|
24
|
+
readonly actualArchiveRoot: Fr;
|
|
25
|
+
constructor(expectedArchiveRoot: Fr, actualArchiveRoot: Fr);
|
|
26
|
+
}
|
|
22
27
|
export declare class ReExStateMismatchError extends ValidatorError {
|
|
23
28
|
readonly expectedArchiveRoot: Fr;
|
|
24
29
|
readonly actualArchiveRoot: Fr;
|
|
@@ -30,4 +35,4 @@ export declare class ReExFailedTxsError extends ValidatorError {
|
|
|
30
35
|
export declare class ReExTimeoutError extends ValidatorError {
|
|
31
36
|
constructor();
|
|
32
37
|
}
|
|
33
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
38
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZXJyb3JzLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvdmFsaWRhdG9ycy9lcnJvcnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxLQUFLLEVBQUUsVUFBVSxFQUFFLE1BQU0saUNBQWlDLENBQUM7QUFDbEUsT0FBTyxLQUFLLEVBQUUsRUFBRSxFQUFFLE1BQU0sZ0NBQWdDLENBQUM7QUFDekQsT0FBTyxLQUFLLEVBQUUsTUFBTSxFQUFFLE1BQU0sa0JBQWtCLENBQUM7QUFFL0MscUJBQWEsY0FBZSxTQUFRLEtBQUs7SUFDdkMsWUFBWSxPQUFPLEVBQUUsTUFBTSxFQUUxQjtDQUNGO0FBRUQscUJBQWEs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":["../../src/validators/errors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACzD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE/C,qBAAa,cAAe,SAAQ,KAAK;IACvC,YAAY,OAAO,EAAE,MAAM,EAE1B;CACF;AAED,qBAAa,+BAAgC,SAAQ,cAAc;IACjE,cAEC;CACF;AAED,qBAAa,uBAAwB,SAAQ,cAAc;aAEvC,cAAc,EAAE,MAAM;aACtB,aAAa,EAAE,MAAM;aACrB,IAAI,EAAE,UAAU;IAHlC,YACkB,cAAc,EAAE,MAAM,EACtB,aAAa,EAAE,MAAM,EACrB,IAAI,EAAE,UAAU,EAGjC;CACF;AAED,qBAAa,6BAA8B,SAAQ,cAAc;IAC/D,YAAY,QAAQ,EAAE,MAAM,EAAE,EAE7B;CACF;AAED,qBAAa,kCAAmC,SAAQ,cAAc;IACpE,YAAY,QAAQ,EAAE,MAAM,EAAE,EAE7B;CACF;AAED,qBAAa,sBAAuB,SAAQ,cAAc;aAEtC,mBAAmB,EAAE,EAAE;aACvB,iBAAiB,EAAE,EAAE;IAFvC,YACkB,mBAAmB,EAAE,EAAE,EACvB,iBAAiB,EAAE,EAAE,EAGtC;CACF;AAED,qBAAa,kBAAmB,SAAQ,cAAc;IACpD,YAAY,YAAY,EAAE,MAAM,EAE/B;CACF;AAED,qBAAa,gBAAiB,SAAQ,cAAc;IAClD,cAEC;CACF"}
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/validators/errors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACzD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE/C,qBAAa,cAAe,SAAQ,KAAK;IACvC,YAAY,OAAO,EAAE,MAAM,EAE1B;CACF;AAED,qBAAa,+BAAgC,SAAQ,cAAc;IACjE,cAEC;CACF;AAED,qBAAa,uBAAwB,SAAQ,cAAc;aAEvC,cAAc,EAAE,MAAM;aACtB,aAAa,EAAE,MAAM;aACrB,IAAI,EAAE,UAAU;IAHlC,YACkB,cAAc,EAAE,MAAM,EACtB,aAAa,EAAE,MAAM,EACrB,IAAI,EAAE,UAAU,EAGjC;CACF;AAED,qBAAa,6BAA8B,SAAQ,cAAc;IAC/D,YAAY,QAAQ,EAAE,MAAM,EAAE,EAE7B;CACF;AAED,qBAAa,kCAAmC,SAAQ,cAAc;IACpE,YAAY,QAAQ,EAAE,MAAM,EAAE,EAE7B;CACF;AAED,qBAAa,6BAA8B,SAAQ,cAAc;aAE7C,mBAAmB,EAAE,EAAE;aACvB,iBAAiB,EAAE,EAAE;IAFvC,YACkB,mBAAmB,EAAE,EAAE,EACvB,iBAAiB,EAAE,EAAE,EAGtC;CACF;AAED,qBAAa,sBAAuB,SAAQ,cAAc;aAEtC,mBAAmB,EAAE,EAAE;aACvB,iBAAiB,EAAE,EAAE;IAFvC,YACkB,mBAAmB,EAAE,EAAE,EACvB,iBAAiB,EAAE,EAAE,EAGtC;CACF;AAED,qBAAa,kBAAmB,SAAQ,cAAc;IACpD,YAAY,YAAY,EAAE,MAAM,EAE/B;CACF;AAED,qBAAa,gBAAiB,SAAQ,cAAc;IAClD,cAEC;CACF"}
|
|
@@ -26,6 +26,13 @@ export class FailedToReExecuteTransactionsError extends ValidatorError {
|
|
|
26
26
|
super(`Failed to re-execute transactions: ${txHashes.join(', ')}`);
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
|
+
export class ReExInitialStateMismatchError extends ValidatorError {
|
|
30
|
+
expectedArchiveRoot;
|
|
31
|
+
actualArchiveRoot;
|
|
32
|
+
constructor(expectedArchiveRoot, actualArchiveRoot){
|
|
33
|
+
super('Re-execution initial state mismatch'), this.expectedArchiveRoot = expectedArchiveRoot, this.actualArchiveRoot = actualArchiveRoot;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
29
36
|
export class ReExStateMismatchError extends ValidatorError {
|
|
30
37
|
expectedArchiveRoot;
|
|
31
38
|
actualArchiveRoot;
|
|
@@ -22,11 +22,13 @@ export declare function checkCompressedComponentVersion(compressed: string, expe
|
|
|
22
22
|
/** Checks that two component versions match. Undefined fields are ignored. */
|
|
23
23
|
export declare function validatePartialComponentVersionsMatch(expected: Partial<ComponentsVersions>, actual: Partial<ComponentsVersions>): void;
|
|
24
24
|
/** Returns a Koa middleware that injects the versioning info as headers. */
|
|
25
|
-
export declare function getVersioningMiddleware(versions: Partial<ComponentsVersions
|
|
25
|
+
export declare function getVersioningMiddleware(versions: Partial<ComponentsVersions>, opts?: {
|
|
26
|
+
packageVersion?: string;
|
|
27
|
+
}): (ctx: Koa.Context, next: () => Promise<void>) => Promise<void>;
|
|
26
28
|
/** Returns a json rpc client handler that rejects responses with mismatching versions. */
|
|
27
29
|
export declare function getVersioningResponseHandler(versions: Partial<ComponentsVersions>): ({ headers }: {
|
|
28
30
|
headers: {
|
|
29
31
|
get: (header: string) => string | null | undefined;
|
|
30
32
|
};
|
|
31
33
|
}) => Promise<void>;
|
|
32
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
34
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidmVyc2lvbmluZy5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3ZlcnNpb25pbmcvdmVyc2lvbmluZy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssRUFBRSxFQUFFLEVBQUUsTUFBTSxnQ0FBZ0MsQ0FBQztBQUN6RCxPQUFPLEtBQUssRUFBRSxVQUFVLEVBQUUsTUFBTSwrQkFBK0IsQ0FBQztBQUdoRSxPQUFP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,wBAAgB,+BAA+B,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,kBAAkB,QA6B/F;AAED,8EAA8E;AAC9E,wBAAgB,qCAAqC,CACnD,QAAQ,EAAE,OAAO,CAAC,kBAAkB,CAAC,EACrC,MAAM,EAAE,OAAO,CAAC,kBAAkB,CAAC,QAiBpC;AAED,4EAA4E;AAC5E,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,OAAO,CAAC,kBAAkB,CAAC,EAAE,IAAI,CAAC,EAAE;IAAE,cAAc,CAAC,EAAE,MAAM,CAAA;CAAE,kEAkBhH;AAED,0FAA0F;AAC1F,wBAAgB,4BAA4B,CAAC,QAAQ,EAAE,OAAO,CAAC,kBAAkB,CAAC;;;;oBAajF"}
|
|
@@ -65,7 +65,7 @@ export class ComponentsVersionsError extends Error {
|
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
|
-
/** Returns a Koa middleware that injects the versioning info as headers. */ export function getVersioningMiddleware(versions) {
|
|
68
|
+
/** Returns a Koa middleware that injects the versioning info as headers. */ export function getVersioningMiddleware(versions, opts) {
|
|
69
69
|
return async (ctx, next)=>{
|
|
70
70
|
try {
|
|
71
71
|
await next();
|
|
@@ -78,6 +78,9 @@ export class ComponentsVersionsError extends Error {
|
|
|
78
78
|
ctx.set(`x-aztec-${key}`, value.toString());
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
|
+
if (opts?.packageVersion) {
|
|
82
|
+
ctx.set('x-aztec-packageVersion', opts.packageVersion);
|
|
83
|
+
}
|
|
81
84
|
}
|
|
82
85
|
};
|
|
83
86
|
}
|
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.e0f15ab9b",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"inherits": [
|
|
6
6
|
"../package.common.json",
|
|
@@ -63,7 +63,8 @@
|
|
|
63
63
|
"./slashing": "./dest/slashing/index.js",
|
|
64
64
|
"./l1-contracts": "./dest/l1-contracts/index.js",
|
|
65
65
|
"./world-state": "./dest/world-state/index.js",
|
|
66
|
-
"./timetable": "./dest/timetable/index.js"
|
|
66
|
+
"./timetable": "./dest/timetable/index.js",
|
|
67
|
+
"./kv-store": "./dest/kv-store/index.js"
|
|
67
68
|
},
|
|
68
69
|
"typedocOptions": {
|
|
69
70
|
"entryPoints": [
|
|
@@ -91,13 +92,13 @@
|
|
|
91
92
|
},
|
|
92
93
|
"dependencies": {
|
|
93
94
|
"@aws-sdk/client-s3": "^3.892.0",
|
|
94
|
-
"@aztec/bb.js": "0.0.1-commit.
|
|
95
|
-
"@aztec/blob-lib": "0.0.1-commit.
|
|
96
|
-
"@aztec/constants": "0.0.1-commit.
|
|
97
|
-
"@aztec/ethereum": "0.0.1-commit.
|
|
98
|
-
"@aztec/foundation": "0.0.1-commit.
|
|
99
|
-
"@aztec/l1-artifacts": "0.0.1-commit.
|
|
100
|
-
"@aztec/noir-noirc_abi": "0.0.1-commit.
|
|
95
|
+
"@aztec/bb.js": "0.0.1-commit.e0f15ab9b",
|
|
96
|
+
"@aztec/blob-lib": "0.0.1-commit.e0f15ab9b",
|
|
97
|
+
"@aztec/constants": "0.0.1-commit.e0f15ab9b",
|
|
98
|
+
"@aztec/ethereum": "0.0.1-commit.e0f15ab9b",
|
|
99
|
+
"@aztec/foundation": "0.0.1-commit.e0f15ab9b",
|
|
100
|
+
"@aztec/l1-artifacts": "0.0.1-commit.e0f15ab9b",
|
|
101
|
+
"@aztec/noir-noirc_abi": "0.0.1-commit.e0f15ab9b",
|
|
101
102
|
"@google-cloud/storage": "^7.15.0",
|
|
102
103
|
"axios": "^1.13.5",
|
|
103
104
|
"json-stringify-deterministic": "1.0.12",
|
package/src/abi/abi.ts
CHANGED
|
@@ -224,7 +224,13 @@ export const FunctionDebugMetadataSchema = z.object({
|
|
|
224
224
|
acir_locations: z.record(z.number()),
|
|
225
225
|
brillig_locations: z.record(z.record(z.number())),
|
|
226
226
|
}),
|
|
227
|
-
files: z.record(
|
|
227
|
+
files: z.record(
|
|
228
|
+
z.object({
|
|
229
|
+
source: z.string(),
|
|
230
|
+
path: z.string(),
|
|
231
|
+
function_locations: z.array(z.object({ start: z.number(), name: z.string() })),
|
|
232
|
+
}),
|
|
233
|
+
),
|
|
228
234
|
}) satisfies z.ZodType<FunctionDebugMetadata>;
|
|
229
235
|
|
|
230
236
|
/** The artifact entry of a function. */
|
|
@@ -305,6 +311,14 @@ export interface ProgramDebugInfo {
|
|
|
305
311
|
debug_infos: Array<DebugInfo>;
|
|
306
312
|
}
|
|
307
313
|
|
|
314
|
+
/** The range a function occupies in a file. */
|
|
315
|
+
export type FunctionLocation = {
|
|
316
|
+
/** The byte where the function starts. */
|
|
317
|
+
start: number;
|
|
318
|
+
/** The name of the function. */
|
|
319
|
+
name: string;
|
|
320
|
+
};
|
|
321
|
+
|
|
308
322
|
/** Maps a file ID to its metadata for debugging purposes. */
|
|
309
323
|
export type DebugFileMap = Record<
|
|
310
324
|
FileId,
|
|
@@ -313,6 +327,8 @@ export type DebugFileMap = Record<
|
|
|
313
327
|
source: string;
|
|
314
328
|
/** The path of the file. */
|
|
315
329
|
path: string;
|
|
330
|
+
/** The range each function occupies in the file. */
|
|
331
|
+
function_locations: FunctionLocation[];
|
|
316
332
|
}
|
|
317
333
|
>;
|
|
318
334
|
|
|
@@ -367,7 +383,14 @@ export const ContractArtifactSchema = zodFor<ContractArtifact>()(
|
|
|
367
383
|
globals: z.record(z.array(AbiValueSchema)),
|
|
368
384
|
}),
|
|
369
385
|
storageLayout: z.record(z.object({ slot: schemas.Fr })),
|
|
370
|
-
fileMap: z.record(
|
|
386
|
+
fileMap: z.record(
|
|
387
|
+
z.coerce.number(),
|
|
388
|
+
z.object({
|
|
389
|
+
source: z.string(),
|
|
390
|
+
path: z.string(),
|
|
391
|
+
function_locations: z.array(z.object({ start: z.number(), name: z.string() })),
|
|
392
|
+
}),
|
|
393
|
+
),
|
|
371
394
|
}),
|
|
372
395
|
);
|
|
373
396
|
|
package/src/abi/buffer.ts
CHANGED
|
@@ -26,11 +26,32 @@ export function bufferAsFields(input: Buffer, targetLength: number): Fr[] {
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
/**
|
|
29
|
-
* Recovers a buffer from an array of fields.
|
|
30
|
-
*
|
|
31
|
-
*
|
|
29
|
+
* Recovers a buffer from an array of fields previously encoded with bufferAsFields.
|
|
30
|
+
*
|
|
31
|
+
* The first field encodes the byte length of the original buffer. The remaining fields
|
|
32
|
+
* each carry 31 bytes of payload (the leading byte of each 32-byte field element is skipped).
|
|
33
|
+
*
|
|
34
|
+
* If the declared byte length exceeds the bytes available from the payload fields, the result
|
|
35
|
+
* is zero-padded to the full declared length. This is important for correctness when the field
|
|
36
|
+
* array has been truncated (e.g. contract class logs reconstructed from blobs using a short
|
|
37
|
+
* emittedLength): without padding, the resulting buffer would be shorter than declared, causing
|
|
38
|
+
* bytecode commitment computations to diverge from what the circuit produced.
|
|
39
|
+
*
|
|
40
|
+
* @param fields - An output from bufferAsFields: [byteLength, ...payloadFields].
|
|
41
|
+
* @returns A buffer of exactly `byteLength` bytes.
|
|
32
42
|
*/
|
|
33
43
|
export function bufferFromFields(fields: Fr[]): Buffer {
|
|
34
44
|
const [length, ...payload] = fields;
|
|
35
|
-
|
|
45
|
+
const byteLength = length.toNumber();
|
|
46
|
+
const raw = Buffer.concat(payload.map(f => f.toBuffer().subarray(1)));
|
|
47
|
+
if (raw.length >= byteLength) {
|
|
48
|
+
return raw.subarray(0, byteLength);
|
|
49
|
+
}
|
|
50
|
+
// Pad with zeros if the declared length exceeds the available payload bytes.
|
|
51
|
+
// This ensures the returned buffer always matches the declared length, so that
|
|
52
|
+
// downstream bytecode commitment computations are consistent even when the
|
|
53
|
+
// source field array was truncated (e.g. reconstructed from blob with a short emittedLength).
|
|
54
|
+
const result = Buffer.alloc(byteLength);
|
|
55
|
+
raw.copy(result);
|
|
56
|
+
return result;
|
|
36
57
|
}
|
package/src/abi/decoder.ts
CHANGED
|
@@ -2,12 +2,19 @@ import { Fr } from '@aztec/foundation/curves/bn254';
|
|
|
2
2
|
|
|
3
3
|
import { AztecAddress } from '../aztec-address/index.js';
|
|
4
4
|
import type { ABIParameter, ABIVariable, AbiType } from './abi.js';
|
|
5
|
-
import { isAztecAddressStruct, parseSignedInt } from './utils.js';
|
|
5
|
+
import { isAztecAddressStruct, isOptionStruct, parseSignedInt } from './utils.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* The type of our decoded ABI.
|
|
9
9
|
*/
|
|
10
|
-
export type AbiDecoded =
|
|
10
|
+
export type AbiDecoded =
|
|
11
|
+
| bigint
|
|
12
|
+
| boolean
|
|
13
|
+
| string
|
|
14
|
+
| AztecAddress
|
|
15
|
+
| AbiDecoded[]
|
|
16
|
+
| { [key: string]: AbiDecoded }
|
|
17
|
+
| undefined;
|
|
11
18
|
|
|
12
19
|
/**
|
|
13
20
|
* Decodes values using a provided ABI.
|
|
@@ -51,6 +58,11 @@ class AbiDecoder {
|
|
|
51
58
|
if (isAztecAddressStruct(abiType)) {
|
|
52
59
|
return new AztecAddress(this.getNextField().toBuffer());
|
|
53
60
|
}
|
|
61
|
+
if (isOptionStruct(abiType)) {
|
|
62
|
+
const isSome = this.decodeNext(abiType.fields[0].type);
|
|
63
|
+
const value = this.decodeNext(abiType.fields[1].type);
|
|
64
|
+
return isSome ? value : undefined;
|
|
65
|
+
}
|
|
54
66
|
|
|
55
67
|
for (const field of abiType.fields) {
|
|
56
68
|
struct[field.name] = this.decodeNext(field.type);
|
package/src/abi/encoder.ts
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
2
|
|
|
3
3
|
import type { AbiType, FunctionAbi } from './abi.js';
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
isAddressStruct,
|
|
6
|
+
isBoundedVecStruct,
|
|
7
|
+
isFunctionSelectorStruct,
|
|
8
|
+
isOptionStruct,
|
|
9
|
+
isWrappedFieldStruct,
|
|
10
|
+
} from './utils.js';
|
|
5
11
|
|
|
6
12
|
/**
|
|
7
13
|
* Encodes arguments for a function call.
|
|
@@ -43,6 +49,32 @@ class ArgumentEncoder {
|
|
|
43
49
|
* @param name - Name.
|
|
44
50
|
*/
|
|
45
51
|
private encodeArgument(abiType: AbiType, arg: any, name?: string) {
|
|
52
|
+
if (isOptionStruct(abiType)) {
|
|
53
|
+
const optionType = abiType as Extract<AbiType, { kind: 'struct' }>;
|
|
54
|
+
const [isSomeField, valueField] = optionType.fields;
|
|
55
|
+
|
|
56
|
+
if (arg === undefined || arg === null) {
|
|
57
|
+
this.encodeArgument(isSomeField.type, false, `${name}._is_some`);
|
|
58
|
+
this.#encodeDefaultValue(valueField.type);
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
if (typeof arg === 'object' && '_is_some' in arg) {
|
|
63
|
+
this.encodeArgument(isSomeField.type, arg._is_some, `${name}._is_some`);
|
|
64
|
+
|
|
65
|
+
if (arg._is_some) {
|
|
66
|
+
this.encodeArgument(valueField.type, arg._value, `${name}._value`);
|
|
67
|
+
} else {
|
|
68
|
+
this.#encodeDefaultValue(valueField.type);
|
|
69
|
+
}
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
this.encodeArgument(isSomeField.type, true, `${name}._is_some`);
|
|
74
|
+
this.encodeArgument(valueField.type, arg, `${name}._value`);
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
|
|
46
78
|
if (arg === undefined || arg == null) {
|
|
47
79
|
throw new Error(`Undefined argument ${name ?? 'unnamed'} of type ${abiType.kind}`);
|
|
48
80
|
}
|
|
@@ -227,6 +259,14 @@ class ArgumentEncoder {
|
|
|
227
259
|
this.encodeArgument(lenField.type, arg.length, 'len');
|
|
228
260
|
}
|
|
229
261
|
}
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* Appends the flattened zero value for an ABI type.
|
|
265
|
+
* Option::None still serializes the wrapped value, so we need to zero-fill its footprint.
|
|
266
|
+
*/
|
|
267
|
+
#encodeDefaultValue(abiType: AbiType) {
|
|
268
|
+
this.flattened.push(...new Array(ArgumentEncoder.typeSize(abiType)).fill(Fr.ZERO));
|
|
269
|
+
}
|
|
230
270
|
}
|
|
231
271
|
|
|
232
272
|
/**
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import type { AbiType } from './abi.js';
|
|
2
2
|
import type { EventSelector } from './event_selector.js';
|
|
3
3
|
|
|
4
|
+
/** Metadata for a contract event, used to decode emitted event logs back into structured data. */
|
|
4
5
|
export type EventMetadataDefinition = {
|
|
5
6
|
eventSelector: EventSelector;
|
|
6
7
|
abiType: AbiType;
|
|
8
|
+
/** Names of the event's struct members (not serialized Noir Field elements). */
|
|
7
9
|
fieldNames: string[];
|
|
8
10
|
};
|
package/src/abi/utils.ts
CHANGED
|
@@ -81,6 +81,31 @@ export function isBoundedVecStruct(abiType: AbiType) {
|
|
|
81
81
|
);
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
+
/**
|
|
85
|
+
* Returns whether the ABI type is Noir's std::option::Option lowered to a struct.
|
|
86
|
+
* @param abiType - Type to check.
|
|
87
|
+
* @returns A boolean indicating whether the ABI type is an Option struct.
|
|
88
|
+
*/
|
|
89
|
+
export function isOptionStruct(abiType: AbiType) {
|
|
90
|
+
return (
|
|
91
|
+
abiType.kind === 'struct' &&
|
|
92
|
+
abiType.path === 'std::option::Option' &&
|
|
93
|
+
abiType.fields.length === 2 &&
|
|
94
|
+
abiType.fields[0].name === '_is_some' &&
|
|
95
|
+
abiType.fields[1].name === '_value'
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Returns whether `null` or `undefined` can be mapped to a valid ABI value for this type.
|
|
101
|
+
*
|
|
102
|
+
* @param abiType - Type to check.
|
|
103
|
+
* @returns A boolean indicating whether nullish values are valid shorthand for this ABI type.
|
|
104
|
+
*/
|
|
105
|
+
export function canBeMappedFromNullOrUndefined(abiType: AbiType) {
|
|
106
|
+
return isOptionStruct(abiType);
|
|
107
|
+
}
|
|
108
|
+
|
|
84
109
|
/**
|
|
85
110
|
* Returns a bigint by parsing a serialized 2's complement signed int.
|
|
86
111
|
* @param b - The signed int as a buffer
|