@aztec/stdlib 0.0.1-commit.ef17749e1 → 0.0.1-commit.f1b29a41e
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 +5 -44
- package/dest/abi/decoder.d.ts.map +1 -1
- package/dest/abi/decoder.js +12 -67
- package/dest/abi/function_selector.js +1 -1
- package/dest/abi/function_signature_decoder.d.ts +43 -0
- package/dest/abi/function_signature_decoder.d.ts.map +1 -0
- package/dest/abi/function_signature_decoder.js +66 -0
- package/dest/abi/index.d.ts +2 -1
- package/dest/abi/index.d.ts.map +1 -1
- package/dest/abi/index.js +1 -0
- package/dest/avm/avm.d.ts +300 -300
- package/dest/block/l2_block_source.d.ts +90 -10
- package/dest/block/l2_block_source.d.ts.map +1 -1
- package/dest/block/l2_block_source.js +1 -0
- package/dest/block/l2_block_stream/l2_tips_store_base.d.ts +1 -1
- package/dest/block/l2_block_stream/l2_tips_store_base.d.ts.map +1 -1
- package/dest/block/l2_block_stream/l2_tips_store_base.js +17 -4
- package/dest/block/test/l2_tips_store_test_suite.d.ts +1 -1
- package/dest/block/test/l2_tips_store_test_suite.d.ts.map +1 -1
- package/dest/block/test/l2_tips_store_test_suite.js +3 -2
- package/dest/checkpoint/checkpoint.d.ts +7 -1
- package/dest/checkpoint/checkpoint.d.ts.map +1 -1
- package/dest/checkpoint/checkpoint.js +9 -1
- package/dest/checkpoint/checkpoint_data.d.ts +71 -5
- package/dest/checkpoint/checkpoint_data.d.ts.map +1 -1
- package/dest/checkpoint/checkpoint_data.js +10 -0
- package/dest/checkpoint/validate.js +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/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/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 +11 -1
- package/dest/epoch-helpers/index.d.ts.map +1 -1
- package/dest/epoch-helpers/index.js +16 -2
- package/dest/file-store/factory.d.ts +4 -3
- package/dest/file-store/factory.d.ts.map +1 -1
- package/dest/file-store/factory.js +2 -2
- package/dest/file-store/http.d.ts +9 -2
- package/dest/file-store/http.d.ts.map +1 -1
- package/dest/file-store/http.js +20 -9
- package/dest/file-store/index.d.ts +2 -1
- package/dest/file-store/index.d.ts.map +1 -1
- package/dest/hash/hash.d.ts +19 -1
- package/dest/hash/hash.d.ts.map +1 -1
- package/dest/hash/hash.js +29 -0
- package/dest/interfaces/archiver.d.ts +1 -1
- package/dest/interfaces/archiver.d.ts.map +1 -1
- package/dest/interfaces/archiver.js +5 -3
- package/dest/interfaces/aztec-node-admin.d.ts +7 -4
- package/dest/interfaces/aztec-node-admin.d.ts.map +1 -1
- package/dest/interfaces/aztec-node.d.ts +3 -2
- package/dest/interfaces/aztec-node.d.ts.map +1 -1
- package/dest/interfaces/aztec-node.js +2 -0
- package/dest/interfaces/block-builder.d.ts +32 -11
- package/dest/interfaces/block-builder.d.ts.map +1 -1
- package/dest/interfaces/block-builder.js +6 -4
- package/dest/interfaces/configs.d.ts +7 -2
- package/dest/interfaces/configs.d.ts.map +1 -1
- package/dest/interfaces/configs.js +1 -0
- 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 +2 -10
- package/dest/interfaces/validator.d.ts.map +1 -1
- package/dest/interfaces/validator.js +0 -1
- package/dest/interfaces/world_state.d.ts +5 -4
- package/dest/interfaces/world_state.d.ts.map +1 -1
- 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/message_context.d.ts +4 -7
- package/dest/logs/message_context.d.ts.map +1 -1
- package/dest/logs/message_context.js +23 -9
- package/dest/logs/pending_tagged_log.d.ts +2 -3
- package/dest/logs/pending_tagged_log.d.ts.map +1 -1
- package/dest/logs/pending_tagged_log.js +2 -2
- package/dest/logs/shared_secret_derivation.d.ts +11 -10
- package/dest/logs/shared_secret_derivation.d.ts.map +1 -1
- package/dest/logs/shared_secret_derivation.js +15 -9
- package/dest/logs/siloed_tag.d.ts +4 -1
- package/dest/logs/siloed_tag.d.ts.map +1 -1
- package/dest/logs/siloed_tag.js +7 -3
- 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.d.ts +3 -2
- package/dest/messaging/l1_to_l2_message.d.ts.map +1 -1
- package/dest/messaging/l1_to_l2_message.js +11 -13
- 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/note/note_dao.d.ts +1 -1
- package/dest/note/note_dao.d.ts.map +1 -1
- package/dest/note/note_dao.js +1 -4
- package/dest/p2p/checkpoint_proposal.d.ts +1 -1
- package/dest/p2p/checkpoint_proposal.d.ts.map +1 -1
- package/dest/p2p/checkpoint_proposal.js +13 -11
- package/dest/proofs/chonk_proof.d.ts +46 -2
- package/dest/proofs/chonk_proof.d.ts.map +1 -1
- package/dest/proofs/chonk_proof.js +85 -10
- package/dest/tests/factories.d.ts +2 -4
- package/dest/tests/factories.d.ts.map +1 -1
- package/dest/tests/factories.js +10 -27
- package/dest/tx/capsule.d.ts +6 -2
- package/dest/tx/capsule.d.ts.map +1 -1
- package/dest/tx/capsule.js +9 -3
- package/dest/tx/global_variable_builder.d.ts +14 -2
- package/dest/tx/global_variable_builder.d.ts.map +1 -1
- 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 +109 -1
- package/dest/tx/simulated_tx.d.ts.map +1 -1
- 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 +5 -1
- package/dest/tx/validator/error_texts.d.ts.map +1 -1
- package/dest/tx/validator/error_texts.js +6 -0
- package/dest/update-checker/package_version.d.ts +2 -2
- package/dest/update-checker/package_version.d.ts.map +1 -1
- package/dest/update-checker/package_version.js +16 -3
- 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 +8 -8
- package/src/abi/abi.ts +25 -2
- package/src/abi/buffer.ts +25 -4
- package/src/abi/decoder.ts +23 -78
- package/src/abi/function_selector.ts +1 -1
- package/src/abi/function_signature_decoder.ts +77 -0
- package/src/abi/index.ts +1 -0
- package/src/block/l2_block_source.ts +20 -9
- package/src/block/l2_block_stream/l2_tips_store_base.ts +24 -12
- package/src/block/test/l2_tips_store_test_suite.ts +8 -1
- package/src/checkpoint/checkpoint.ts +11 -1
- package/src/checkpoint/checkpoint_data.ts +40 -4
- package/src/checkpoint/validate.ts +2 -2
- package/src/config/index.ts +1 -0
- package/src/config/pipelining-config.ts +31 -0
- 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 +27 -0
- package/src/file-store/factory.ts +13 -4
- package/src/file-store/http.ts +29 -10
- package/src/file-store/index.ts +1 -0
- package/src/gas/README.md +123 -0
- package/src/hash/hash.ts +34 -0
- package/src/interfaces/archiver.ts +5 -3
- package/src/interfaces/aztec-node.ts +10 -1
- package/src/interfaces/block-builder.ts +39 -13
- package/src/interfaces/configs.ts +4 -1
- 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 +1 -5
- package/src/interfaces/world_state.ts +4 -3
- package/src/logs/index.ts +1 -0
- package/src/logs/log_filter.ts +5 -0
- package/src/logs/message_context.ts +17 -7
- package/src/logs/pending_tagged_log.ts +1 -3
- package/src/logs/shared_secret_derivation.ts +21 -10
- package/src/logs/siloed_tag.ts +7 -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.ts +12 -9
- 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/note/note_dao.ts +1 -4
- package/src/p2p/checkpoint_proposal.ts +23 -20
- package/src/proofs/chonk_proof.ts +91 -5
- package/src/tests/factories.ts +4 -33
- package/src/tx/capsule.ts +10 -2
- package/src/tx/global_variable_builder.ts +15 -0
- package/src/tx/private_execution_result.ts +5 -5
- package/src/tx/profiling.ts +11 -2
- package/src/tx/tx_receipt.ts +7 -2
- package/src/tx/validator/error_texts.ts +8 -0
- package/src/update-checker/package_version.ts +19 -6
- 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/src/contract/private_function_membership_proof.ts +0 -167
- package/src/contract/utility_function_membership_proof.ts +0 -118
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { booleanConfigHelper, getConfigFromMappings } from '@aztec/foundation/config';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { zodFor } from '../schemas/index.js';
|
|
4
|
+
/**
|
|
5
|
+
* Pipelining config mappings for fields that need to be shared across packages.
|
|
6
|
+
*/ export const pipelineConfigMappings = {
|
|
7
|
+
enableProposerPipelining: {
|
|
8
|
+
env: 'SEQ_ENABLE_PROPOSER_PIPELINING',
|
|
9
|
+
description: 'Whether to enable build-ahead proposer pipelining.',
|
|
10
|
+
...booleanConfigHelper(false)
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
export const PipelineConfigSchema = zodFor()(z.object({
|
|
14
|
+
enableProposerPipelining: z.boolean()
|
|
15
|
+
}));
|
|
16
|
+
export function getPipelineConfigEnvVars() {
|
|
17
|
+
return getConfigFromMappings(pipelineConfigMappings);
|
|
18
|
+
}
|
|
@@ -5,9 +5,9 @@ import type { ContractInstance } from './interfaces/contract_instance.js';
|
|
|
5
5
|
/**
|
|
6
6
|
* Returns the deployment address for a given contract instance.
|
|
7
7
|
* ```
|
|
8
|
-
* salted_initialization_hash =
|
|
9
|
-
* partial_address =
|
|
10
|
-
* address = ((
|
|
8
|
+
* salted_initialization_hash = poseidon2(DOM_SEP__PARTIAL_ADDRESS, [salt, initialization_hash, deployer])
|
|
9
|
+
* partial_address = poseidon2(DOM_SEP__PARTIAL_ADDRESS, [contract_class_id, salted_initialization_hash])
|
|
10
|
+
* address = ((poseidon2(DOM_SEP__CONTRACT_ADDRESS_V1, [public_keys_hash, partial_address]) * G) + ivpk_m).x <- the x-coordinate of the address point
|
|
11
11
|
* ```
|
|
12
12
|
* @param instance - A contract instance for which to calculate the deployment address.
|
|
13
13
|
*/
|
|
@@ -8,9 +8,9 @@ import { computeAddress } from '../keys/index.js';
|
|
|
8
8
|
/**
|
|
9
9
|
* Returns the deployment address for a given contract instance.
|
|
10
10
|
* ```
|
|
11
|
-
* salted_initialization_hash =
|
|
12
|
-
* partial_address =
|
|
13
|
-
* address = ((
|
|
11
|
+
* salted_initialization_hash = poseidon2(DOM_SEP__PARTIAL_ADDRESS, [salt, initialization_hash, deployer])
|
|
12
|
+
* partial_address = poseidon2(DOM_SEP__PARTIAL_ADDRESS, [contract_class_id, salted_initialization_hash])
|
|
13
|
+
* address = ((poseidon2(DOM_SEP__CONTRACT_ADDRESS_V1, [public_keys_hash, partial_address]) * G) + ivpk_m).x <- the x-coordinate of the address point
|
|
14
14
|
* ```
|
|
15
15
|
* @param instance - A contract instance for which to calculate the deployment address.
|
|
16
16
|
*/ export async function computeContractAddressFromInstance(instance) {
|
|
@@ -5,10 +5,10 @@ import type { ContractClass } from './interfaces/contract_class.js';
|
|
|
5
5
|
*
|
|
6
6
|
* ```
|
|
7
7
|
* version = 1
|
|
8
|
-
* private_function_leaves = private_functions.map(fn =>
|
|
8
|
+
* private_function_leaves = private_functions.map(fn => poseidon2(DOM_SEP__PRIVATE_FUNCTION_LEAF, [fn.function_selector as Field, fn.vk_hash]))
|
|
9
9
|
* private_functions_root = merkleize(private_function_leaves)
|
|
10
10
|
* bytecode_commitment = calculate_commitment(packed_bytecode)
|
|
11
|
-
* contract_class_id =
|
|
11
|
+
* contract_class_id = poseidon2(DOM_SEP__CONTRACT_CLASS_ID, [version, artifact_hash, private_functions_root, bytecode_commitment])
|
|
12
12
|
* ```
|
|
13
13
|
* @param contractClass - Contract class.
|
|
14
14
|
* @returns The identifier.
|
|
@@ -9,10 +9,10 @@ import { computePrivateFunctionsRoot } from './private_function.js';
|
|
|
9
9
|
*
|
|
10
10
|
* ```
|
|
11
11
|
* version = 1
|
|
12
|
-
* private_function_leaves = private_functions.map(fn =>
|
|
12
|
+
* private_function_leaves = private_functions.map(fn => poseidon2(DOM_SEP__PRIVATE_FUNCTION_LEAF, [fn.function_selector as Field, fn.vk_hash]))
|
|
13
13
|
* private_functions_root = merkleize(private_function_leaves)
|
|
14
14
|
* bytecode_commitment = calculate_commitment(packed_bytecode)
|
|
15
|
-
* contract_class_id =
|
|
15
|
+
* contract_class_id = poseidon2(DOM_SEP__CONTRACT_CLASS_ID, [version, artifact_hash, private_functions_root, bytecode_commitment])
|
|
16
16
|
* ```
|
|
17
17
|
* @param contractClass - Contract class.
|
|
18
18
|
* @returns The identifier.
|
package/dest/contract/index.d.ts
CHANGED
|
@@ -6,11 +6,9 @@ export * from './contract_deployment_data.js';
|
|
|
6
6
|
export * from './contract_instance.js';
|
|
7
7
|
export * from './contract_instance_update.js';
|
|
8
8
|
export * from './private_function.js';
|
|
9
|
-
export * from './private_function_membership_proof.js';
|
|
10
|
-
export * from './utility_function_membership_proof.js';
|
|
11
9
|
export * from './interfaces/index.js';
|
|
12
10
|
export * from './contract_function_dao.js';
|
|
13
11
|
export * from './partial_address.js';
|
|
14
12
|
export * from './deployment_info.js';
|
|
15
13
|
export * from './complete_address.js';
|
|
16
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
14
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9jb250cmFjdC9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxjQUFjLG9CQUFvQixDQUFDO0FBQ25DLGNBQWMsdUJBQXVCLENBQUM7QUFDdEMsY0FBYyxxQkFBcUIsQ0FBQztBQUNwQyxjQUFjLHdCQUF3QixDQUFDO0FBQ3ZDLGNBQWMsK0JBQStCLENBQUM7QUFDOUMsY0FBYyx3QkFBd0IsQ0FBQztBQUN2QyxjQUFjLCtCQUErQixDQUFDO0FBQzlDLGNBQWMsdUJBQXVCLENBQUM7QUFDdEMsY0FBYyx1QkFBdUIsQ0FBQztBQUN0QyxjQUFjLDRCQUE0QixDQUFDO0FBQzNDLGNBQWMsc0JBQXNCLENBQUM7QUFDckMsY0FBYyxzQkFBc0IsQ0FBQztBQUNyQyxjQUFjLHVCQUF1QixDQUFDIn0=
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/contract/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,wBAAwB,CAAC;AACvC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,uBAAuB,CAAC;AACtC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/contract/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,wBAAwB,CAAC;AACvC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC"}
|
package/dest/contract/index.js
CHANGED
|
@@ -6,8 +6,6 @@ export * from './contract_deployment_data.js';
|
|
|
6
6
|
export * from './contract_instance.js';
|
|
7
7
|
export * from './contract_instance_update.js';
|
|
8
8
|
export * from './private_function.js';
|
|
9
|
-
export * from './private_function_membership_proof.js';
|
|
10
|
-
export * from './utility_function_membership_proof.js';
|
|
11
9
|
export * from './interfaces/index.js';
|
|
12
10
|
export * from './contract_function_dao.js';
|
|
13
11
|
export * from './partial_address.js';
|
|
@@ -28,40 +28,6 @@ export interface PrivateFunction {
|
|
|
28
28
|
/** Hash of the verification key associated to this private function. */
|
|
29
29
|
vkHash: Fr;
|
|
30
30
|
}
|
|
31
|
-
/** Private function definition with executable bytecode. */
|
|
32
|
-
export interface ExecutablePrivateFunction extends PrivateFunction {
|
|
33
|
-
/** ACIR and Brillig bytecode */
|
|
34
|
-
bytecode: Buffer;
|
|
35
|
-
}
|
|
36
|
-
/** Utility function definition. */
|
|
37
|
-
export interface UtilityFunction {
|
|
38
|
-
/** Selector of the function. Calculated as the hash of the method name and parameters. The specification of this is not enforced by the protocol. */
|
|
39
|
-
selector: FunctionSelector;
|
|
40
|
-
/** Brillig. */
|
|
41
|
-
bytecode: Buffer;
|
|
42
|
-
}
|
|
43
|
-
/** Sibling paths and sibling commitments for proving membership of a private function within a contract class. */
|
|
44
|
-
export type PrivateFunctionMembershipProof = {
|
|
45
|
-
artifactMetadataHash: Fr;
|
|
46
|
-
functionMetadataHash: Fr;
|
|
47
|
-
utilityFunctionsTreeRoot: Fr;
|
|
48
|
-
privateFunctionTreeSiblingPath: Fr[];
|
|
49
|
-
privateFunctionTreeLeafIndex: number;
|
|
50
|
-
artifactTreeSiblingPath: Fr[];
|
|
51
|
-
artifactTreeLeafIndex: number;
|
|
52
|
-
};
|
|
53
|
-
/** A private function with a membership proof. */
|
|
54
|
-
export type ExecutablePrivateFunctionWithMembershipProof = ExecutablePrivateFunction & PrivateFunctionMembershipProof;
|
|
55
|
-
/** Sibling paths and commitments for proving membership of a utility function within a contract class. */
|
|
56
|
-
export type UtilityFunctionMembershipProof = {
|
|
57
|
-
artifactMetadataHash: Fr;
|
|
58
|
-
functionMetadataHash: Fr;
|
|
59
|
-
privateFunctionsArtifactTreeRoot: Fr;
|
|
60
|
-
artifactTreeSiblingPath: Fr[];
|
|
61
|
-
artifactTreeLeafIndex: number;
|
|
62
|
-
};
|
|
63
|
-
/** A utility function with a membership proof. */
|
|
64
|
-
export type UtilityFunctionWithMembershipProof = UtilityFunction & UtilityFunctionMembershipProof;
|
|
65
31
|
export declare const ContractClassSchema: z.ZodObject<{
|
|
66
32
|
version: z.ZodLiteral<1>;
|
|
67
33
|
artifactHash: z.ZodType<Fr, any, string>;
|
|
@@ -139,137 +105,18 @@ export declare const ContractClassWithIdSchema: z.ZodObject<{
|
|
|
139
105
|
packedBytecode?: any;
|
|
140
106
|
id: string;
|
|
141
107
|
}>;
|
|
142
|
-
/** A contract class with public bytecode information
|
|
143
|
-
export type ContractClassPublic =
|
|
144
|
-
privateFunctions: ExecutablePrivateFunctionWithMembershipProof[];
|
|
145
|
-
utilityFunctions: UtilityFunctionWithMembershipProof[];
|
|
146
|
-
} & Pick<ContractClassCommitments, 'id' | 'privateFunctionsRoot'> & Omit<ContractClass, 'privateFunctions'>;
|
|
108
|
+
/** A contract class with public bytecode information. */
|
|
109
|
+
export type ContractClassPublic = Pick<ContractClassCommitments, 'id' | 'privateFunctionsRoot'> & Omit<ContractClass, 'privateFunctions'>;
|
|
147
110
|
export type ContractClassPublicWithCommitment = ContractClassPublic & Pick<ContractClassCommitments, 'publicBytecodeCommitment'>;
|
|
148
111
|
export declare const ContractClassPublicSchema: z.ZodIntersection<z.ZodObject<{
|
|
149
112
|
id: z.ZodType<Fr, any, string>;
|
|
150
113
|
privateFunctionsRoot: z.ZodType<Fr, any, string>;
|
|
151
|
-
privateFunctions: z.ZodArray<z.ZodIntersection<z.ZodIntersection<z.ZodObject<{
|
|
152
|
-
selector: import("@aztec/foundation/schemas").ZodFor<FunctionSelector>;
|
|
153
|
-
vkHash: z.ZodType<Fr, any, string>;
|
|
154
|
-
}, "strip", z.ZodTypeAny, {
|
|
155
|
-
selector: FunctionSelector;
|
|
156
|
-
vkHash: Fr;
|
|
157
|
-
}, {
|
|
158
|
-
selector?: any;
|
|
159
|
-
vkHash: string;
|
|
160
|
-
}>, z.ZodObject<{
|
|
161
|
-
bytecode: import("@aztec/foundation/schemas").ZodFor<Buffer<ArrayBufferLike>>;
|
|
162
|
-
}, "strip", z.ZodTypeAny, {
|
|
163
|
-
bytecode: Buffer<ArrayBufferLike>;
|
|
164
|
-
}, {
|
|
165
|
-
bytecode?: any;
|
|
166
|
-
}>>, z.ZodObject<{
|
|
167
|
-
artifactMetadataHash: z.ZodType<Fr, any, string>;
|
|
168
|
-
functionMetadataHash: z.ZodType<Fr, any, string>;
|
|
169
|
-
utilityFunctionsTreeRoot: z.ZodType<Fr, any, string>;
|
|
170
|
-
privateFunctionTreeSiblingPath: z.ZodArray<z.ZodType<Fr, any, string>, "many">;
|
|
171
|
-
privateFunctionTreeLeafIndex: z.ZodPipeline<z.ZodUnion<[z.ZodBigInt, z.ZodNumber, z.ZodString]>, z.ZodNumber>;
|
|
172
|
-
artifactTreeSiblingPath: z.ZodArray<z.ZodType<Fr, any, string>, "many">;
|
|
173
|
-
artifactTreeLeafIndex: z.ZodPipeline<z.ZodUnion<[z.ZodBigInt, z.ZodNumber, z.ZodString]>, z.ZodNumber>;
|
|
174
|
-
}, "strip", z.ZodTypeAny, {
|
|
175
|
-
artifactMetadataHash: Fr;
|
|
176
|
-
functionMetadataHash: Fr;
|
|
177
|
-
utilityFunctionsTreeRoot: Fr;
|
|
178
|
-
privateFunctionTreeSiblingPath: Fr[];
|
|
179
|
-
privateFunctionTreeLeafIndex: number;
|
|
180
|
-
artifactTreeSiblingPath: Fr[];
|
|
181
|
-
artifactTreeLeafIndex: number;
|
|
182
|
-
}, {
|
|
183
|
-
artifactMetadataHash: string;
|
|
184
|
-
functionMetadataHash: string;
|
|
185
|
-
utilityFunctionsTreeRoot: string;
|
|
186
|
-
privateFunctionTreeSiblingPath: string[];
|
|
187
|
-
privateFunctionTreeLeafIndex: string | number | bigint;
|
|
188
|
-
artifactTreeSiblingPath: string[];
|
|
189
|
-
artifactTreeLeafIndex: string | number | bigint;
|
|
190
|
-
}>>, "many">;
|
|
191
|
-
utilityFunctions: z.ZodArray<z.ZodIntersection<z.ZodObject<{
|
|
192
|
-
selector: import("@aztec/foundation/schemas").ZodFor<FunctionSelector>;
|
|
193
|
-
bytecode: import("@aztec/foundation/schemas").ZodFor<Buffer<ArrayBufferLike>>;
|
|
194
|
-
}, "strip", z.ZodTypeAny, {
|
|
195
|
-
selector: FunctionSelector;
|
|
196
|
-
bytecode: Buffer<ArrayBufferLike>;
|
|
197
|
-
}, {
|
|
198
|
-
selector?: any;
|
|
199
|
-
bytecode?: any;
|
|
200
|
-
}>, z.ZodObject<{
|
|
201
|
-
artifactMetadataHash: z.ZodType<Fr, any, string>;
|
|
202
|
-
functionMetadataHash: z.ZodType<Fr, any, string>;
|
|
203
|
-
privateFunctionsArtifactTreeRoot: z.ZodType<Fr, any, string>;
|
|
204
|
-
artifactTreeSiblingPath: z.ZodArray<z.ZodType<Fr, any, string>, "many">;
|
|
205
|
-
artifactTreeLeafIndex: z.ZodPipeline<z.ZodUnion<[z.ZodBigInt, z.ZodNumber, z.ZodString]>, z.ZodNumber>;
|
|
206
|
-
}, "strip", z.ZodTypeAny, {
|
|
207
|
-
artifactMetadataHash: Fr;
|
|
208
|
-
functionMetadataHash: Fr;
|
|
209
|
-
privateFunctionsArtifactTreeRoot: Fr;
|
|
210
|
-
artifactTreeSiblingPath: Fr[];
|
|
211
|
-
artifactTreeLeafIndex: number;
|
|
212
|
-
}, {
|
|
213
|
-
artifactMetadataHash: string;
|
|
214
|
-
functionMetadataHash: string;
|
|
215
|
-
privateFunctionsArtifactTreeRoot: string;
|
|
216
|
-
artifactTreeSiblingPath: string[];
|
|
217
|
-
artifactTreeLeafIndex: string | number | bigint;
|
|
218
|
-
}>>, "many">;
|
|
219
114
|
}, "strip", z.ZodTypeAny, {
|
|
220
115
|
id: Fr;
|
|
221
116
|
privateFunctionsRoot: Fr;
|
|
222
|
-
privateFunctions: ({
|
|
223
|
-
selector: FunctionSelector;
|
|
224
|
-
vkHash: Fr;
|
|
225
|
-
} & {
|
|
226
|
-
bytecode: Buffer<ArrayBufferLike>;
|
|
227
|
-
} & {
|
|
228
|
-
artifactMetadataHash: Fr;
|
|
229
|
-
functionMetadataHash: Fr;
|
|
230
|
-
utilityFunctionsTreeRoot: Fr;
|
|
231
|
-
privateFunctionTreeSiblingPath: Fr[];
|
|
232
|
-
privateFunctionTreeLeafIndex: number;
|
|
233
|
-
artifactTreeSiblingPath: Fr[];
|
|
234
|
-
artifactTreeLeafIndex: number;
|
|
235
|
-
})[];
|
|
236
|
-
utilityFunctions: ({
|
|
237
|
-
selector: FunctionSelector;
|
|
238
|
-
bytecode: Buffer<ArrayBufferLike>;
|
|
239
|
-
} & {
|
|
240
|
-
artifactMetadataHash: Fr;
|
|
241
|
-
functionMetadataHash: Fr;
|
|
242
|
-
privateFunctionsArtifactTreeRoot: Fr;
|
|
243
|
-
artifactTreeSiblingPath: Fr[];
|
|
244
|
-
artifactTreeLeafIndex: number;
|
|
245
|
-
})[];
|
|
246
117
|
}, {
|
|
247
118
|
id: string;
|
|
248
119
|
privateFunctionsRoot: string;
|
|
249
|
-
privateFunctions: ({
|
|
250
|
-
selector?: any;
|
|
251
|
-
vkHash: string;
|
|
252
|
-
} & {
|
|
253
|
-
bytecode?: any;
|
|
254
|
-
} & {
|
|
255
|
-
artifactMetadataHash: string;
|
|
256
|
-
functionMetadataHash: string;
|
|
257
|
-
utilityFunctionsTreeRoot: string;
|
|
258
|
-
privateFunctionTreeSiblingPath: string[];
|
|
259
|
-
privateFunctionTreeLeafIndex: string | number | bigint;
|
|
260
|
-
artifactTreeSiblingPath: string[];
|
|
261
|
-
artifactTreeLeafIndex: string | number | bigint;
|
|
262
|
-
})[];
|
|
263
|
-
utilityFunctions: ({
|
|
264
|
-
selector?: any;
|
|
265
|
-
bytecode?: any;
|
|
266
|
-
} & {
|
|
267
|
-
artifactMetadataHash: string;
|
|
268
|
-
functionMetadataHash: string;
|
|
269
|
-
privateFunctionsArtifactTreeRoot: string;
|
|
270
|
-
artifactTreeSiblingPath: string[];
|
|
271
|
-
artifactTreeLeafIndex: string | number | bigint;
|
|
272
|
-
})[];
|
|
273
120
|
}>, z.ZodObject<Omit<{
|
|
274
121
|
version: z.ZodLiteral<1>;
|
|
275
122
|
artifactHash: z.ZodType<Fr, any, string>;
|
|
@@ -305,4 +152,4 @@ export type ContractClassPublicWithBlockNumber = {
|
|
|
305
152
|
*/
|
|
306
153
|
export declare function contractClassPublicFromPlainObject(obj: any): ContractClassPublic;
|
|
307
154
|
export {};
|
|
308
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
155
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29udHJhY3RfY2xhc3MuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9jb250cmFjdC9pbnRlcmZhY2VzL2NvbnRyYWN0X2NsYXNzLnRz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aAAa;IAC5B,qCAAqC;IACrC,OAAO,EAAE,OAAO,OAAO,CAAC;IACxB;;;;OAIG;IACH,YAAY,EAAE,EAAE,CAAC;IACjB,mEAAmE;IACnE,gBAAgB,EAAE,eAAe,EAAE,CAAC;IACpC,2DAA2D;IAC3D,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,2DAA2D;AAC3D,MAAM,WAAW,eAAe;IAC9B,qJAAqJ;IACrJ,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,wEAAwE;IACxE,MAAM,EAAE,EAAE,CAAC;CACZ;AASD,
|
|
1
|
+
{"version":3,"file":"contract_class.d.ts","sourceRoot":"","sources":["../../../src/contract/interfaces/contract_class.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AAGpD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,QAAA,MAAM,OAAO,GAAa,CAAC;AAE3B;;;;GAIG;AACH,MAAM,WAAW,aAAa;IAC5B,qCAAqC;IACrC,OAAO,EAAE,OAAO,OAAO,CAAC;IACxB;;;;OAIG;IACH,YAAY,EAAE,EAAE,CAAC;IACjB,mEAAmE;IACnE,gBAAgB,EAAE,eAAe,EAAE,CAAC;IACpC,2DAA2D;IAC3D,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,2DAA2D;AAC3D,MAAM,WAAW,eAAe;IAC9B,qJAAqJ;IACrJ,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,wEAAwE;IACxE,MAAM,EAAE,EAAE,CAAC;CACZ;AASD,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAO/B,CAAC;AAEF,iDAAiD;AACjD,UAAU,wBAAwB;IAChC,wCAAwC;IACxC,EAAE,EAAE,EAAE,CAAC;IACP,yCAAyC;IACzC,wBAAwB,EAAE,EAAE,CAAC;IAC7B,0CAA0C;IAC1C,oBAAoB,EAAE,EAAE,CAAC;CAC1B;AAED,gDAAgD;AAChD,MAAM,MAAM,mBAAmB,GAAG,aAAa,GAAG,IAAI,CAAC,wBAAwB,EAAE,IAAI,CAAC,CAAC;AAEvF,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAIrC,CAAC;AAEF,yDAAyD;AACzD,MAAM,MAAM,mBAAmB,GAAG,IAAI,CAAC,wBAAwB,EAAE,IAAI,GAAG,sBAAsB,CAAC,GAC7F,IAAI,CAAC,aAAa,EAAE,kBAAkB,CAAC,CAAC;AAE1C,MAAM,MAAM,iCAAiC,GAAG,mBAAmB,GACjE,IAAI,CAAC,wBAAwB,EAAE,0BAA0B,CAAC,CAAC;AAE7D,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAOrC,CAAC;AAEF,qEAAqE;AACrE,MAAM,MAAM,kCAAkC,GAAG;IAAE,aAAa,EAAE,MAAM,CAAA;CAAE,GAAG,mBAAmB,CAAC;AAEjG;;;;;GAKG;AACH,wBAAgB,kCAAkC,CAAC,GAAG,EAAE,GAAG,GAAG,mBAAmB,CAQhF"}
|
|
@@ -7,29 +7,6 @@ const PrivateFunctionSchema = zodFor()(z.object({
|
|
|
7
7
|
selector: FunctionSelector.schema,
|
|
8
8
|
vkHash: schemas.Fr
|
|
9
9
|
}));
|
|
10
|
-
const ExecutablePrivateFunctionSchema = zodFor()(PrivateFunctionSchema.and(z.object({
|
|
11
|
-
bytecode: schemas.Buffer
|
|
12
|
-
})));
|
|
13
|
-
const UtilityFunctionSchema = zodFor()(z.object({
|
|
14
|
-
selector: FunctionSelector.schema,
|
|
15
|
-
bytecode: schemas.Buffer
|
|
16
|
-
}));
|
|
17
|
-
const PrivateFunctionMembershipProofSchema = zodFor()(z.object({
|
|
18
|
-
artifactMetadataHash: schemas.Fr,
|
|
19
|
-
functionMetadataHash: schemas.Fr,
|
|
20
|
-
utilityFunctionsTreeRoot: schemas.Fr,
|
|
21
|
-
privateFunctionTreeSiblingPath: z.array(schemas.Fr),
|
|
22
|
-
privateFunctionTreeLeafIndex: schemas.Integer,
|
|
23
|
-
artifactTreeSiblingPath: z.array(schemas.Fr),
|
|
24
|
-
artifactTreeLeafIndex: schemas.Integer
|
|
25
|
-
}));
|
|
26
|
-
const UtilityFunctionMembershipProofSchema = zodFor()(z.object({
|
|
27
|
-
artifactMetadataHash: schemas.Fr,
|
|
28
|
-
functionMetadataHash: schemas.Fr,
|
|
29
|
-
privateFunctionsArtifactTreeRoot: schemas.Fr,
|
|
30
|
-
artifactTreeSiblingPath: z.array(schemas.Fr),
|
|
31
|
-
artifactTreeLeafIndex: schemas.Integer
|
|
32
|
-
}));
|
|
33
10
|
export const ContractClassSchema = zodFor()(z.object({
|
|
34
11
|
version: z.literal(VERSION),
|
|
35
12
|
artifactHash: schemas.Fr,
|
|
@@ -41,9 +18,7 @@ export const ContractClassWithIdSchema = zodFor()(ContractClassSchema.extend({
|
|
|
41
18
|
}));
|
|
42
19
|
export const ContractClassPublicSchema = zodFor()(z.object({
|
|
43
20
|
id: schemas.Fr,
|
|
44
|
-
privateFunctionsRoot: schemas.Fr
|
|
45
|
-
privateFunctions: z.array(ExecutablePrivateFunctionSchema.and(PrivateFunctionMembershipProofSchema)),
|
|
46
|
-
utilityFunctions: z.array(UtilityFunctionSchema.and(UtilityFunctionMembershipProofSchema))
|
|
21
|
+
privateFunctionsRoot: schemas.Fr
|
|
47
22
|
}).and(ContractClassSchema.omit({
|
|
48
23
|
privateFunctions: true
|
|
49
24
|
})));
|
|
@@ -58,8 +33,6 @@ export const ContractClassPublicSchema = zodFor()(z.object({
|
|
|
58
33
|
version: 1,
|
|
59
34
|
artifactHash: Fr.fromPlainObject(obj.artifactHash),
|
|
60
35
|
privateFunctionsRoot: Fr.fromPlainObject(obj.privateFunctionsRoot),
|
|
61
|
-
privateFunctions: [],
|
|
62
|
-
utilityFunctions: [],
|
|
63
36
|
packedBytecode: obj.packedBytecode instanceof Buffer ? obj.packedBytecode : Buffer.from(obj.packedBytecode)
|
|
64
37
|
};
|
|
65
38
|
}
|
|
@@ -8,6 +8,7 @@ export type L1RollupConstants = {
|
|
|
8
8
|
ethereumSlotDuration: number;
|
|
9
9
|
proofSubmissionEpochs: number;
|
|
10
10
|
targetCommitteeSize: number;
|
|
11
|
+
rollupManaLimit: number;
|
|
11
12
|
};
|
|
12
13
|
export declare const EmptyL1RollupConstants: L1RollupConstants;
|
|
13
14
|
export declare const L1RollupConstantsSchema: z.ZodObject<{
|
|
@@ -18,6 +19,7 @@ export declare const L1RollupConstantsSchema: z.ZodObject<{
|
|
|
18
19
|
ethereumSlotDuration: z.ZodNumber;
|
|
19
20
|
proofSubmissionEpochs: z.ZodNumber;
|
|
20
21
|
targetCommitteeSize: z.ZodNumber;
|
|
22
|
+
rollupManaLimit: z.ZodNumber;
|
|
21
23
|
}, "strip", z.ZodTypeAny, {
|
|
22
24
|
l1StartBlock: bigint;
|
|
23
25
|
l1GenesisTime: bigint;
|
|
@@ -26,6 +28,7 @@ export declare const L1RollupConstantsSchema: z.ZodObject<{
|
|
|
26
28
|
ethereumSlotDuration: number;
|
|
27
29
|
proofSubmissionEpochs: number;
|
|
28
30
|
targetCommitteeSize: number;
|
|
31
|
+
rollupManaLimit: number;
|
|
29
32
|
}, {
|
|
30
33
|
l1StartBlock: string | number | bigint;
|
|
31
34
|
l1GenesisTime: string | number | bigint;
|
|
@@ -34,11 +37,16 @@ export declare const L1RollupConstantsSchema: z.ZodObject<{
|
|
|
34
37
|
ethereumSlotDuration: number;
|
|
35
38
|
proofSubmissionEpochs: number;
|
|
36
39
|
targetCommitteeSize: number;
|
|
40
|
+
rollupManaLimit: number;
|
|
37
41
|
}>;
|
|
38
42
|
/** Returns the timestamp for a given L2 slot. */
|
|
39
43
|
export declare function getTimestampForSlot(slot: SlotNumber, constants: Pick<L1RollupConstants, 'l1GenesisTime' | 'slotDuration'>): bigint;
|
|
40
44
|
/** Returns the slot number for a given timestamp. */
|
|
41
45
|
export declare function getSlotAtTimestamp(ts: bigint, constants: Pick<L1RollupConstants, 'l1GenesisTime' | 'slotDuration'>): SlotNumber;
|
|
46
|
+
/** Returns the timestamp of the next L1 slot boundary after the given wall-clock time. */
|
|
47
|
+
export declare function getNextL1SlotTimestamp(nowInSeconds: number, constants: Pick<L1RollupConstants, 'l1GenesisTime' | 'ethereumSlotDuration'>): bigint;
|
|
48
|
+
/** Returns the timestamp of the last L1 slot within a given L2 slot. */
|
|
49
|
+
export declare function getLastL1SlotTimestampForL2Slot(slot: SlotNumber, constants: Pick<L1RollupConstants, 'l1GenesisTime' | 'slotDuration' | 'ethereumSlotDuration'>): bigint;
|
|
42
50
|
/** Returns the L2 slot number at the next L1 block based on the current timestamp. */
|
|
43
51
|
export declare function getSlotAtNextL1Block(currentL1Timestamp: bigint, constants: Pick<L1RollupConstants, 'l1GenesisTime' | 'slotDuration' | 'ethereumSlotDuration'>): SlotNumber;
|
|
44
52
|
/** Returns the epoch number for a given timestamp. */
|
|
@@ -66,6 +74,8 @@ export declare function getProofSubmissionDeadlineEpoch(epochNumber: EpochNumber
|
|
|
66
74
|
* Computed as the start of the given epoch plus the proof submission window.
|
|
67
75
|
*/
|
|
68
76
|
export declare function getProofSubmissionDeadlineTimestamp(epochNumber: EpochNumber, constants: Pick<L1RollupConstants, 'l1GenesisTime' | 'slotDuration' | 'epochDuration' | 'proofSubmissionEpochs'>): bigint;
|
|
77
|
+
/** Computes the quorum size required for a committee (⌊2n/3⌋ + 1). */
|
|
78
|
+
export declare function computeQuorum(committeeSize: number): number;
|
|
69
79
|
/** Returns the timestamp to start building a block for a given L2 slot. Computed as the start timestamp of the slot minus one L1 slot duration. */
|
|
70
80
|
export declare function getSlotStartBuildTimestamp(slotNumber: SlotNumber, constants: Pick<L1RollupConstants, 'l1GenesisTime' | 'slotDuration' | 'ethereumSlotDuration'>): number;
|
|
71
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
81
|
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BQUcsY0FBYyxHQUFHLHNCQUFzQixDQUFDLEdBQzVGLE1BQU0sQ0FFUiJ9
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/epoch-helpers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAE1E,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,MAAM,MAAM,iBAAiB,GAAG;IAC9B,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,qBAAqB,EAAE,MAAM,CAAC;IAC9B,mBAAmB,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/epoch-helpers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAE1E,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,MAAM,MAAM,iBAAiB,GAAG;IAC9B,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,qBAAqB,EAAE,MAAM,CAAC;IAC9B,mBAAmB,EAAE,MAAM,CAAC;IAC5B,eAAe,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,iBASpC,CAAC;AAEF,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;EAWnC,CAAC;AAEF,iDAAiD;AACjD,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,UAAU,EAChB,SAAS,EAAE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AiB,EAAE,eAAe,GAAG,cAAc,GAAG,eAAe,GAAG,sBAAsB,CAAC,GAC9G,CAAC,MAAM,EAAE,MAAM,CAAC,CASlB;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CACvC,WAAW,EAAE,WAAW,EACxB,SAAS,EAAE,IAAI,CAAC,iBAAiB,EAAE,eAAe,GAAG,cAAc,GAAG,eAAe,CAAC,UAIvF;AAED;;;GAGG;AACH,wBAAgB,+BAA+B,CAC7C,WAAW,EAAE,WAAW,EACxB,SAAS,EAAE,IAAI,CAAC,iBAAiB,EAAE,uBAAuB,CAAC,GAC1D,WAAW,CAEb;AAED;;;GAGG;AACH,wBAAgB,mCAAmC,CACjD,WAAW,EAAE,WAAW,EACxB,SAAS,EAAE,IAAI,CAAC,iBAAiB,EAAE,eAAe,GAAG,cAAc,GAAG,eAAe,GAAG,uBAAuB,CAAC,UAOjH;AAED,0EAAsE;AACtE,wBAAgB,aAAa,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,CAE3D;AAED,mJAAmJ;AACnJ,wBAAgB,0BAA0B,CACxC,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,IAAI,CAAC,iBAAiB,EAAE,eAAe,GAAG,cAAc,GAAG,sBAAsB,CAAC,GAC5F,MAAM,CAER"}
|
|
@@ -8,7 +8,8 @@ export const EmptyL1RollupConstants = {
|
|
|
8
8
|
slotDuration: 1,
|
|
9
9
|
ethereumSlotDuration: 1,
|
|
10
10
|
proofSubmissionEpochs: 1,
|
|
11
|
-
targetCommitteeSize: 48
|
|
11
|
+
targetCommitteeSize: 48,
|
|
12
|
+
rollupManaLimit: Number.MAX_SAFE_INTEGER
|
|
12
13
|
};
|
|
13
14
|
export const L1RollupConstantsSchema = zodFor()(z.object({
|
|
14
15
|
l1StartBlock: schemas.BigInt,
|
|
@@ -17,7 +18,8 @@ export const L1RollupConstantsSchema = zodFor()(z.object({
|
|
|
17
18
|
epochDuration: z.number(),
|
|
18
19
|
ethereumSlotDuration: z.number(),
|
|
19
20
|
proofSubmissionEpochs: z.number(),
|
|
20
|
-
targetCommitteeSize: z.number()
|
|
21
|
+
targetCommitteeSize: z.number(),
|
|
22
|
+
rollupManaLimit: z.number()
|
|
21
23
|
}));
|
|
22
24
|
/** Returns the timestamp for a given L2 slot. */ export function getTimestampForSlot(slot, constants) {
|
|
23
25
|
return constants.l1GenesisTime + BigInt(slot) * BigInt(constants.slotDuration);
|
|
@@ -25,6 +27,15 @@ export const L1RollupConstantsSchema = zodFor()(z.object({
|
|
|
25
27
|
/** Returns the slot number for a given timestamp. */ export function getSlotAtTimestamp(ts, constants) {
|
|
26
28
|
return ts < constants.l1GenesisTime ? SlotNumber.ZERO : SlotNumber.fromBigInt((ts - constants.l1GenesisTime) / BigInt(constants.slotDuration));
|
|
27
29
|
}
|
|
30
|
+
/** Returns the timestamp of the next L1 slot boundary after the given wall-clock time. */ export function getNextL1SlotTimestamp(nowInSeconds, constants) {
|
|
31
|
+
const now = BigInt(nowInSeconds);
|
|
32
|
+
const elapsed = now - constants.l1GenesisTime;
|
|
33
|
+
const currentL1Slot = elapsed / BigInt(constants.ethereumSlotDuration);
|
|
34
|
+
return constants.l1GenesisTime + (currentL1Slot + 1n) * BigInt(constants.ethereumSlotDuration);
|
|
35
|
+
}
|
|
36
|
+
/** Returns the timestamp of the last L1 slot within a given L2 slot. */ export function getLastL1SlotTimestampForL2Slot(slot, constants) {
|
|
37
|
+
return getTimestampForSlot(slot, constants) + BigInt(constants.slotDuration - constants.ethereumSlotDuration);
|
|
38
|
+
}
|
|
28
39
|
/** Returns the L2 slot number at the next L1 block based on the current timestamp. */ export function getSlotAtNextL1Block(currentL1Timestamp, constants) {
|
|
29
40
|
const nextL1BlockTimestamp = currentL1Timestamp + BigInt(constants.ethereumSlotDuration);
|
|
30
41
|
return getSlotAtTimestamp(nextL1BlockTimestamp, constants);
|
|
@@ -75,6 +86,9 @@ export const L1RollupConstantsSchema = zodFor()(z.object({
|
|
|
75
86
|
const [deadlineSlot] = getSlotRangeForEpoch(deadlineEpoch, constants);
|
|
76
87
|
return getTimestampForSlot(deadlineSlot, constants);
|
|
77
88
|
}
|
|
89
|
+
/** Computes the quorum size required for a committee (⌊2n/3⌋ + 1). */ export function computeQuorum(committeeSize) {
|
|
90
|
+
return Math.floor(committeeSize * 2 / 3) + 1;
|
|
91
|
+
}
|
|
78
92
|
/** Returns the timestamp to start building a block for a given L2 slot. Computed as the start timestamp of the slot minus one L1 slot duration. */ export function getSlotStartBuildTimestamp(slotNumber, constants) {
|
|
79
93
|
return Number(constants.l1GenesisTime) + slotNumber * constants.slotDuration - constants.ethereumSlotDuration;
|
|
80
94
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { type Logger } from '@aztec/foundation/log';
|
|
2
|
+
import { type HttpFileStoreOptions } from './http.js';
|
|
2
3
|
import type { FileStore, ReadOnlyFileStore } from './interface.js';
|
|
3
4
|
export declare function createFileStore(config: string, logger?: Logger): Promise<FileStore>;
|
|
4
5
|
export declare function createFileStore(config: undefined, logger?: Logger): Promise<undefined>;
|
|
5
|
-
export declare function createReadOnlyFileStore(config: string, logger?: Logger): Promise<ReadOnlyFileStore>;
|
|
6
|
-
export declare function createReadOnlyFileStore(config: undefined, logger?: Logger): Promise<undefined>;
|
|
7
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
6
|
+
export declare function createReadOnlyFileStore(config: string, logger?: Logger, options?: HttpFileStoreOptions): Promise<ReadOnlyFileStore>;
|
|
7
|
+
export declare function createReadOnlyFileStore(config: undefined, logger?: Logger, options?: HttpFileStoreOptions): Promise<undefined>;
|
|
8
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZmFjdG9yeS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2ZpbGUtc3RvcmUvZmFjdG9yeS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsS0FBSyxNQUFNLEVBQWdCLE1BQU0sdUJBQXVCLENBQUM7QUFHbEUsT0FBTyxFQUFpQixLQUFLLG9CQUFvQixFQUFFLE1BQU0sV0FBVyxDQUFDO0FBQ3JFLE9BQU8sS0FBSyxFQUFFLFNBQVMsRUFBRSxpQkFBaUIsRUFBRSxNQUFNLGdCQUFnQixDQUFDO0FBV25FLHdCQUFzQixlQUFlLENBQUMsTUFBTSxFQUFFLE1BQU0sRUFBRSxNQUFNLENBQUMsRUFBRSxNQUFNLEdBQUcsT0FBTyxDQUFDLFNBQVMsQ0FBQyxDQUFDO0FBQzNGLHdCQUFzQixlQUFlLENBQUMsTUFBTSxFQUFFLFNBQVMsRUFBRSxNQUFNLENBQUMsRUFBRSxNQUFNLEdBQUcsT0FBTyxDQUFDLFNBQVMsQ0FBQyxDQUFDO0FBNkM5Rix3QkFBc0IsdUJBQXVCLENBQzNDLE1BQU0sRUFBRSxNQUFNLEVBQ2QsTUFBTSxDQUFDLEVBQUUsTUFBTSxFQUNmLE9BQU8sQ0FBQyxFQUFFLG9CQUFvQixHQUM3QixPQUFPLENBQUMsaUJBQWlCLENBQUMsQ0FBQztBQUM5Qix3QkFBc0IsdUJBQXVCLENBQzNDLE1BQU0sRUFBRSxTQUFTLEVBQ2pCLE1BQU0sQ0FBQyxFQUFFLE1BQU0sRUFDZixPQUFPLENBQUMsRUFBRSxvQkFBb0IsR0FDN0IsT0FBTyxDQUFDLFNBQVMsQ0FBQyxDQUFDIn0=
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../src/file-store/factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAgB,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../src/file-store/factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAgB,MAAM,uBAAuB,CAAC;AAGlE,OAAO,EAAiB,KAAK,oBAAoB,EAAE,MAAM,WAAW,CAAC;AACrE,OAAO,KAAK,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAWnE,wBAAsB,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;AAC3F,wBAAsB,eAAe,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;AA6C9F,wBAAsB,uBAAuB,CAC3C,MAAM,EAAE,MAAM,EACd,MAAM,CAAC,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,oBAAoB,GAC7B,OAAO,CAAC,iBAAiB,CAAC,CAAC;AAC9B,wBAAsB,uBAAuB,CAC3C,MAAM,EAAE,SAAS,EACjB,MAAM,CAAC,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,oBAAoB,GAC7B,OAAO,CAAC,SAAS,CAAC,CAAC"}
|
|
@@ -52,12 +52,12 @@ export async function createFileStore(config, logger = createLogger('stdlib:file
|
|
|
52
52
|
throw new Error(`Unknown file store config: '${config}'. Supported values are ${supportedExamples.join(', ')}.`);
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
|
-
export async function createReadOnlyFileStore(config, logger = createLogger('stdlib:file-store')) {
|
|
55
|
+
export async function createReadOnlyFileStore(config, logger = createLogger('stdlib:file-store'), options) {
|
|
56
56
|
if (config === undefined) {
|
|
57
57
|
return undefined;
|
|
58
58
|
} else if (config.startsWith('http://') || config.startsWith('https://')) {
|
|
59
59
|
logger.info(`Creating read-only HTTP file store at ${config}`);
|
|
60
|
-
return new HttpFileStore(config, logger);
|
|
60
|
+
return new HttpFileStore(config, logger, options);
|
|
61
61
|
} else {
|
|
62
62
|
return await createFileStore(config, logger);
|
|
63
63
|
}
|
|
@@ -1,14 +1,21 @@
|
|
|
1
1
|
import { type Logger } from '@aztec/foundation/log';
|
|
2
2
|
import type { ReadOnlyFileStore } from './interface.js';
|
|
3
|
+
/** Options for configuring HttpFileStore behavior. */
|
|
4
|
+
export interface HttpFileStoreOptions {
|
|
5
|
+
/** Retry backoff intervals in seconds. Empty array disables retries. Default: [1, 1, 3]. */
|
|
6
|
+
retryBackoff?: number[];
|
|
7
|
+
/** Request timeout in milliseconds. Default: no timeout (axios default). */
|
|
8
|
+
timeoutMs?: number;
|
|
9
|
+
}
|
|
3
10
|
export declare class HttpFileStore implements ReadOnlyFileStore {
|
|
4
11
|
private readonly baseUrl;
|
|
5
12
|
private readonly log;
|
|
6
13
|
private readonly axiosInstance;
|
|
7
14
|
private readonly fetch;
|
|
8
|
-
constructor(baseUrl: string, log?: Logger);
|
|
15
|
+
constructor(baseUrl: string, log?: Logger, options?: HttpFileStoreOptions);
|
|
9
16
|
read(pathOrUrl: string): Promise<Buffer>;
|
|
10
17
|
download(pathOrUrl: string, destPath: string): Promise<void>;
|
|
11
18
|
exists(pathOrUrl: string): Promise<boolean>;
|
|
12
19
|
private getUrl;
|
|
13
20
|
}
|
|
14
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
21
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaHR0cC5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2ZpbGUtc3RvcmUvaHR0cC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsS0FBSyxNQUFNLEVBQWdCLE1BQU0sdUJBQXVCLENBQUM7QUFVbEUsT0FBTyxLQUFLLEVBQUUsaUJBQWlCLEVBQUUsTUFBTSxnQkFBZ0IsQ0FBQztBQUV4RCxzREFBc0Q7QUFDdEQsTUFBTSxXQUFXLG9CQUFvQjtJQUNuQyw0RkFBNEY7SUFDNUYsWUFBWSxDQUFDLEVBQUUsTUFBTSxFQUFFLENBQUM7SUFDeEIsNEVBQTRF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CAA+D;IAErF,YACmB,OAAO,EAAE,MAAM,EACf,GAAG,GAAE,MAA+C,
|
|
1
|
+
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../src/file-store/http.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAgB,MAAM,uBAAuB,CAAC;AAUlE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAExD,sDAAsD;AACtD,MAAM,WAAW,oBAAoB;IACnC,4FAA4F;IAC5F,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,4EAA4E;IAC5E,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,qBAAa,aAAc,YAAW,iBAAiB;IAKnD,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,GAAG;IALtB,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAgB;IAC9C,OAAO,CAAC,QAAQ,CAAC,KAAK,CAA+D;IAErF,YACmB,OAAO,EAAE,MAAM,EACf,GAAG,GAAE,MAA+C,EACrE,OAAO,CAAC,EAAE,oBAAoB,EAsB/B;IAEY,IAAI,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAQpD;IAEY,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAYxE;IAEY,MAAM,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAQvD;IAED,OAAO,CAAC,MAAM;CAGf"}
|
package/dest/file-store/http.js
CHANGED
|
@@ -10,17 +10,28 @@ export class HttpFileStore {
|
|
|
10
10
|
log;
|
|
11
11
|
axiosInstance;
|
|
12
12
|
fetch;
|
|
13
|
-
constructor(baseUrl, log = createLogger('stdlib:http-file-store')){
|
|
13
|
+
constructor(baseUrl, log = createLogger('stdlib:http-file-store'), options){
|
|
14
14
|
this.baseUrl = baseUrl;
|
|
15
15
|
this.log = log;
|
|
16
|
-
this.axiosInstance = axios.create(
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
16
|
+
this.axiosInstance = axios.create({
|
|
17
|
+
...options?.timeoutMs !== undefined && {
|
|
18
|
+
timeout: options.timeoutMs
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
const retryBackoff = options?.retryBackoff ?? [
|
|
22
|
+
1,
|
|
23
|
+
1,
|
|
24
|
+
3
|
|
25
|
+
];
|
|
26
|
+
if (retryBackoff.length > 0) {
|
|
27
|
+
this.fetch = async (config)=>{
|
|
28
|
+
return await retry(()=>this.axiosInstance.request(config), `Fetching ${config.url}`, makeBackoff(retryBackoff), this.log, /*failSilently=*/ true);
|
|
29
|
+
};
|
|
30
|
+
} else {
|
|
31
|
+
this.fetch = async (config)=>{
|
|
32
|
+
return await this.axiosInstance.request(config);
|
|
33
|
+
};
|
|
34
|
+
}
|
|
24
35
|
}
|
|
25
36
|
async read(pathOrUrl) {
|
|
26
37
|
const url = this.getUrl(pathOrUrl);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export * from './interface.js';
|
|
2
2
|
export * from './factory.js';
|
|
3
|
-
|
|
3
|
+
export { type HttpFileStoreOptions } from './http.js';
|
|
4
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9maWxlLXN0b3JlL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLGNBQWMsZ0JBQWdCLENBQUM7QUFDL0IsY0FBYyxjQUFjLENBQUM7QUFDN0IsT0FBTyxFQUFFLEtBQUssb0JBQW9CLEVBQUUsTUFBTSxXQUFXLENBQUMifQ==
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/file-store/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/file-store/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,OAAO,EAAE,KAAK,oBAAoB,EAAE,MAAM,WAAW,CAAC"}
|