@aztec/stdlib 0.0.1-commit.f295ac2 → 0.0.1-commit.f8ca9b2f3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dest/abi/function_call.d.ts +39 -9
- package/dest/abi/function_call.d.ts.map +1 -1
- package/dest/abi/function_call.js +20 -3
- package/dest/block/block_hash.d.ts +16 -18
- package/dest/block/block_hash.d.ts.map +1 -1
- package/dest/block/block_hash.js +21 -31
- package/dest/block/block_parameter.d.ts +4 -4
- package/dest/block/block_parameter.d.ts.map +1 -1
- package/dest/block/block_parameter.js +2 -2
- package/dest/block/checkpointed_l2_block.d.ts +6 -6
- package/dest/block/checkpointed_l2_block.d.ts.map +1 -1
- package/dest/block/checkpointed_l2_block.js +3 -3
- package/dest/block/in_block.d.ts +11 -11
- package/dest/block/in_block.d.ts.map +1 -1
- package/dest/block/in_block.js +5 -5
- package/dest/block/index.d.ts +2 -2
- package/dest/block/index.d.ts.map +1 -1
- package/dest/block/index.js +1 -1
- package/dest/block/{l2_block_new.d.ts → l2_block.d.ts} +8 -7
- package/dest/block/l2_block.d.ts.map +1 -0
- package/dest/block/{l2_block_new.js → l2_block.js} +5 -9
- package/dest/block/l2_block_source.d.ts +39 -30
- package/dest/block/l2_block_source.d.ts.map +1 -1
- package/dest/block/l2_block_stream/interfaces.d.ts +3 -3
- package/dest/block/l2_block_stream/interfaces.d.ts.map +1 -1
- package/dest/block/l2_block_stream/l2_block_stream.d.ts +6 -3
- package/dest/block/l2_block_stream/l2_block_stream.d.ts.map +1 -1
- package/dest/block/l2_block_stream/l2_block_stream.js +37 -25
- package/dest/block/l2_block_stream/l2_tips_store_base.d.ts +3 -3
- package/dest/block/l2_block_stream/l2_tips_store_base.d.ts.map +1 -1
- package/dest/block/test/l2_tips_store_test_suite.js +2 -2
- package/dest/checkpoint/checkpoint.d.ts +8 -8
- package/dest/checkpoint/checkpoint.d.ts.map +1 -1
- package/dest/checkpoint/checkpoint.js +4 -4
- package/dest/checkpoint/published_checkpoint.d.ts +2 -2
- package/dest/config/index.d.ts +2 -1
- package/dest/config/index.d.ts.map +1 -1
- package/dest/config/index.js +1 -0
- package/dest/config/node-rpc-config.js +1 -1
- package/dest/config/sequencer-config.d.ts +10 -0
- package/dest/config/sequencer-config.d.ts.map +1 -0
- package/dest/config/sequencer-config.js +12 -0
- package/dest/contract/contract_address.js +1 -1
- package/dest/contract/contract_class_id.d.ts +1 -1
- package/dest/contract/contract_class_id.js +1 -1
- package/dest/contract/interfaces/node-info.d.ts +3 -1
- package/dest/contract/interfaces/node-info.d.ts.map +1 -1
- package/dest/contract/interfaces/node-info.js +2 -1
- package/dest/contract/private_function.d.ts +1 -1
- package/dest/contract/private_function.d.ts.map +1 -1
- package/dest/contract/private_function.js +2 -3
- package/dest/contract/private_function_membership_proof.d.ts +1 -1
- package/dest/contract/private_function_membership_proof.js +1 -1
- package/dest/database-version/database_version.d.ts +58 -0
- package/dest/database-version/database_version.d.ts.map +1 -0
- package/dest/database-version/database_version.js +69 -0
- package/dest/database-version/version_manager.d.ts +2 -50
- package/dest/database-version/version_manager.d.ts.map +1 -1
- package/dest/database-version/version_manager.js +1 -66
- package/dest/delayed_public_mutable/delayed_public_mutable_values.d.ts +2 -2
- package/dest/delayed_public_mutable/delayed_public_mutable_values.d.ts.map +1 -1
- package/dest/delayed_public_mutable/delayed_public_mutable_values.js +7 -10
- package/dest/epoch-helpers/index.d.ts +7 -1
- package/dest/epoch-helpers/index.d.ts.map +1 -1
- package/dest/epoch-helpers/index.js +9 -3
- package/dest/hash/hash.js +2 -2
- package/dest/hash/map_slot.d.ts +1 -1
- package/dest/hash/map_slot.d.ts.map +1 -1
- package/dest/hash/map_slot.js +4 -3
- package/dest/interfaces/api_limit.d.ts +2 -1
- package/dest/interfaces/api_limit.d.ts.map +1 -1
- package/dest/interfaces/api_limit.js +1 -0
- package/dest/interfaces/archiver.d.ts +1 -1
- package/dest/interfaces/archiver.d.ts.map +1 -1
- package/dest/interfaces/archiver.js +19 -18
- package/dest/interfaces/aztec-node-admin.d.ts +20 -2
- package/dest/interfaces/aztec-node-admin.d.ts.map +1 -1
- package/dest/interfaces/aztec-node-admin.js +3 -1
- package/dest/interfaces/aztec-node.d.ts +64 -62
- package/dest/interfaces/aztec-node.d.ts.map +1 -1
- package/dest/interfaces/aztec-node.js +13 -17
- package/dest/interfaces/block-builder.d.ts +13 -7
- package/dest/interfaces/block-builder.d.ts.map +1 -1
- package/dest/interfaces/block-builder.js +7 -0
- package/dest/interfaces/configs.d.ts +2 -2
- package/dest/interfaces/configs.d.ts.map +1 -1
- package/dest/interfaces/get_logs_response.d.ts +15 -8
- package/dest/interfaces/get_logs_response.d.ts.map +1 -1
- package/dest/interfaces/l2_logs_source.d.ts +14 -5
- package/dest/interfaces/l2_logs_source.d.ts.map +1 -1
- package/dest/interfaces/p2p.d.ts +2 -2
- package/dest/interfaces/p2p.d.ts.map +1 -1
- package/dest/interfaces/prover-broker.d.ts +16 -1
- package/dest/interfaces/prover-broker.d.ts.map +1 -1
- package/dest/interfaces/prover-broker.js +4 -1
- package/dest/interfaces/prover-client.d.ts +15 -1
- package/dest/interfaces/prover-client.d.ts.map +1 -1
- package/dest/interfaces/prover-client.js +12 -1
- package/dest/interfaces/proving-job.d.ts +200 -200
- package/dest/interfaces/slasher.d.ts +9 -1
- package/dest/interfaces/slasher.d.ts.map +1 -1
- package/dest/interfaces/slasher.js +2 -0
- package/dest/interfaces/tx_provider.d.ts +3 -3
- package/dest/interfaces/tx_provider.d.ts.map +1 -1
- package/dest/interfaces/validator.d.ts +50 -4
- package/dest/interfaces/validator.d.ts.map +1 -1
- package/dest/interfaces/validator.js +4 -1
- package/dest/kernel/hints/build_nullifier_read_request_hints.d.ts +3 -3
- package/dest/kernel/hints/build_nullifier_read_request_hints.d.ts.map +1 -1
- package/dest/kernel/hints/build_nullifier_read_request_hints.js +4 -6
- package/dest/keys/derivation.d.ts +3 -3
- package/dest/keys/derivation.js +8 -8
- package/dest/keys/key_types.d.ts +1 -1
- package/dest/keys/utils.d.ts +1 -1
- package/dest/keys/utils.d.ts.map +1 -1
- package/dest/keys/utils.js +7 -3
- package/dest/l1-contracts/slash_factory.d.ts +1 -1
- package/dest/l1-contracts/slash_factory.d.ts.map +1 -1
- package/dest/l1-contracts/slash_factory.js +1 -0
- package/dest/logs/extended_public_log.d.ts +13 -7
- package/dest/logs/extended_public_log.d.ts.map +1 -1
- package/dest/logs/log_id.d.ts +17 -14
- package/dest/logs/log_id.d.ts.map +1 -1
- package/dest/logs/log_id.js +20 -17
- package/dest/logs/siloed_tag.d.ts +1 -1
- package/dest/logs/siloed_tag.d.ts.map +1 -1
- package/dest/logs/siloed_tag.js +4 -3
- package/dest/messaging/l2_to_l1_membership.d.ts +2 -2
- package/dest/messaging/l2_to_l1_membership.js +3 -3
- package/dest/p2p/block_proposal.d.ts +13 -6
- package/dest/p2p/block_proposal.d.ts.map +1 -1
- package/dest/p2p/block_proposal.js +1 -1
- package/dest/p2p/checkpoint_proposal.d.ts +17 -3
- package/dest/p2p/checkpoint_proposal.d.ts.map +1 -1
- package/dest/p2p/checkpoint_proposal.js +9 -0
- package/dest/p2p/constants.d.ts +5 -0
- package/dest/p2p/constants.d.ts.map +1 -0
- package/dest/p2p/constants.js +3 -0
- package/dest/p2p/index.d.ts +2 -1
- package/dest/p2p/index.d.ts.map +1 -1
- package/dest/p2p/index.js +1 -0
- package/dest/p2p/message_validator.d.ts +18 -3
- package/dest/p2p/message_validator.d.ts.map +1 -1
- package/dest/p2p/message_validator.js +2 -1
- package/dest/rollup/checkpoint_rollup_public_inputs.d.ts +6 -6
- package/dest/rollup/checkpoint_rollup_public_inputs.d.ts.map +1 -1
- package/dest/rollup/checkpoint_rollup_public_inputs.js +2 -2
- package/dest/rollup/checkpoint_root_rollup_private_inputs.d.ts +2 -2
- package/dest/rollup/checkpoint_root_rollup_private_inputs.d.ts.map +1 -1
- package/dest/rollup/root_rollup_public_inputs.d.ts +6 -6
- package/dest/rollup/root_rollup_public_inputs.d.ts.map +1 -1
- package/dest/rollup/root_rollup_public_inputs.js +3 -3
- package/dest/slashing/empire.d.ts +1 -1
- package/dest/slashing/empire.d.ts.map +1 -1
- package/dest/slashing/empire.js +2 -0
- package/dest/slashing/helpers.d.ts +2 -2
- package/dest/slashing/helpers.d.ts.map +1 -1
- package/dest/slashing/helpers.js +6 -0
- package/dest/slashing/tally.d.ts +2 -1
- package/dest/slashing/tally.d.ts.map +1 -1
- package/dest/slashing/tally.js +6 -2
- package/dest/slashing/types.d.ts +7 -3
- package/dest/slashing/types.d.ts.map +1 -1
- package/dest/slashing/types.js +13 -1
- package/dest/stats/stats.d.ts +1 -3
- package/dest/stats/stats.d.ts.map +1 -1
- package/dest/tests/factories.js +4 -4
- package/dest/tests/jest.d.ts +4 -4
- package/dest/tests/jest.js +9 -9
- package/dest/tests/mocks.d.ts +15 -10
- package/dest/tests/mocks.d.ts.map +1 -1
- package/dest/tests/mocks.js +19 -13
- package/dest/timetable/index.d.ts +37 -0
- package/dest/timetable/index.d.ts.map +1 -0
- package/dest/timetable/index.js +39 -0
- package/dest/trees/public_data_leaf.d.ts +2 -1
- package/dest/trees/public_data_leaf.d.ts.map +1 -1
- package/dest/trees/public_data_leaf.js +7 -6
- package/dest/tx/block_header.d.ts +3 -2
- package/dest/tx/block_header.d.ts.map +1 -1
- package/dest/tx/block_header.js +3 -2
- package/dest/tx/in_tx.d.ts +3 -3
- package/dest/tx/indexed_tx_effect.d.ts +5 -5
- package/dest/tx/indexed_tx_effect.d.ts.map +1 -1
- package/dest/tx/indexed_tx_effect.js +3 -2
- package/dest/tx/tx.d.ts +2 -1
- package/dest/tx/tx.d.ts.map +1 -1
- package/dest/tx/tx.js +6 -3
- package/dest/tx/tx_receipt.d.ts +42 -14
- package/dest/tx/tx_receipt.d.ts.map +1 -1
- package/dest/tx/tx_receipt.js +46 -15
- package/dest/tx/validator/empty_validator.d.ts +2 -2
- package/dest/tx/validator/empty_validator.d.ts.map +1 -1
- package/dest/tx/validator/error_texts.d.ts +2 -1
- package/dest/tx/validator/error_texts.d.ts.map +1 -1
- package/dest/tx/validator/error_texts.js +2 -0
- package/dest/tx/validator/tx_validator.d.ts +2 -2
- package/dest/tx/validator/tx_validator.d.ts.map +1 -1
- package/package.json +24 -12
- package/src/abi/function_call.ts +25 -3
- package/src/block/block_hash.ts +26 -47
- package/src/block/block_parameter.ts +3 -3
- package/src/block/checkpointed_l2_block.ts +4 -4
- package/src/block/in_block.ts +8 -8
- package/src/block/index.ts +1 -1
- package/src/block/{l2_block_new.ts → l2_block.ts} +8 -12
- package/src/block/l2_block_source.ts +40 -31
- package/src/block/l2_block_stream/interfaces.ts +2 -2
- package/src/block/l2_block_stream/l2_block_stream.ts +44 -27
- package/src/block/l2_block_stream/l2_tips_store_base.ts +2 -2
- package/src/block/test/l2_tips_store_test_suite.ts +4 -4
- package/src/checkpoint/checkpoint.ts +7 -7
- package/src/config/index.ts +1 -0
- package/src/config/node-rpc-config.ts +1 -1
- package/src/config/sequencer-config.ts +19 -0
- package/src/contract/contract_address.ts +1 -1
- package/src/contract/contract_class_id.ts +1 -1
- package/src/contract/interfaces/node-info.ts +3 -0
- package/src/contract/private_function.ts +2 -3
- package/src/contract/private_function_membership_proof.ts +1 -1
- package/src/database-version/database_version.ts +87 -0
- package/src/database-version/version_manager.ts +1 -77
- package/src/delayed_public_mutable/delayed_public_mutable_values.ts +9 -10
- package/src/epoch-helpers/index.ts +13 -1
- package/src/hash/hash.ts +2 -2
- package/src/hash/map_slot.ts +3 -2
- package/src/interfaces/api_limit.ts +1 -0
- package/src/interfaces/archiver.ts +19 -27
- package/src/interfaces/aztec-node-admin.ts +3 -2
- package/src/interfaces/aztec-node.ts +89 -120
- package/src/interfaces/block-builder.ts +15 -5
- package/src/interfaces/configs.ts +1 -3
- package/src/interfaces/l2_logs_source.ts +17 -4
- package/src/interfaces/p2p.ts +1 -1
- package/src/interfaces/prover-broker.ts +22 -0
- package/src/interfaces/prover-client.ts +22 -0
- package/src/interfaces/slasher.ts +4 -0
- package/src/interfaces/tx_provider.ts +2 -2
- package/src/interfaces/validator.ts +12 -5
- package/src/kernel/hints/build_nullifier_read_request_hints.ts +1 -10
- package/src/keys/derivation.ts +8 -8
- package/src/keys/key_types.ts +1 -1
- package/src/keys/utils.ts +7 -3
- package/src/l1-contracts/slash_factory.ts +1 -0
- package/src/logs/log_id.ts +22 -18
- package/src/logs/siloed_tag.ts +3 -2
- package/src/messaging/l2_to_l1_membership.ts +3 -3
- package/src/p2p/block_proposal.ts +12 -5
- package/src/p2p/checkpoint_proposal.ts +19 -2
- package/src/p2p/constants.ts +6 -0
- package/src/p2p/index.ts +1 -0
- package/src/p2p/message_validator.ts +14 -2
- package/src/rollup/checkpoint_rollup_public_inputs.ts +5 -5
- package/src/rollup/root_rollup_public_inputs.ts +7 -7
- package/src/slashing/empire.ts +3 -1
- package/src/slashing/helpers.ts +8 -0
- package/src/slashing/tally.ts +8 -2
- package/src/slashing/types.ts +14 -0
- package/src/stats/stats.ts +0 -2
- package/src/tests/factories.ts +6 -6
- package/src/tests/jest.ts +9 -9
- package/src/tests/mocks.ts +26 -17
- package/src/timetable/index.ts +66 -0
- package/src/trees/public_data_leaf.ts +11 -5
- package/src/tx/block_header.ts +7 -4
- package/src/tx/indexed_tx_effect.ts +3 -2
- package/src/tx/tx.ts +8 -9
- package/src/tx/tx_receipt.ts +75 -18
- package/src/tx/validator/empty_validator.ts +1 -1
- package/src/tx/validator/error_texts.ts +3 -0
- package/src/tx/validator/tx_validator.ts +1 -1
- package/dest/block/l2_block_new.d.ts.map +0 -1
- package/dest/database-version/index.d.ts +0 -2
- package/dest/database-version/index.d.ts.map +0 -1
- package/dest/database-version/index.js +0 -1
- package/src/database-version/index.ts +0 -1
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
2
|
+
import { jsonParseWithSchema, jsonStringify } from '@aztec/foundation/json-rpc';
|
|
3
|
+
|
|
4
|
+
import { z } from 'zod';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Symbol for Node.js custom inspect. Using Symbol.for() is the documented way to
|
|
8
|
+
* reference this without importing node:util. In browsers, objects with this symbol
|
|
9
|
+
* simply won't have custom inspect behavior (which is fine).
|
|
10
|
+
* @see https://nodejs.org/api/util.html#utilinspectcustom
|
|
11
|
+
*/
|
|
12
|
+
const inspectCustomSymbol = Symbol.for('nodejs.util.inspect.custom');
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Represents a version record for storing in a version file.
|
|
16
|
+
*/
|
|
17
|
+
export class DatabaseVersion {
|
|
18
|
+
constructor(
|
|
19
|
+
/** The version of the data on disk. Used to perform upgrades */
|
|
20
|
+
public readonly schemaVersion: number,
|
|
21
|
+
/** The rollup the data pertains to */
|
|
22
|
+
public readonly rollupAddress: EthAddress,
|
|
23
|
+
) {}
|
|
24
|
+
|
|
25
|
+
public toBuffer(): Buffer {
|
|
26
|
+
return Buffer.from(jsonStringify(this));
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
public static fromBuffer(buf: Buffer): DatabaseVersion {
|
|
30
|
+
try {
|
|
31
|
+
return jsonParseWithSchema(buf.toString('utf-8'), DatabaseVersion.schema);
|
|
32
|
+
} catch (err) {
|
|
33
|
+
throw new Error(`Failed to deserialize version information: ${err}`, { cause: err });
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Compares two versions. If the rollups addresses are different then it returns undefined
|
|
39
|
+
*/
|
|
40
|
+
public cmp(other: DatabaseVersion): undefined | -1 | 0 | 1 {
|
|
41
|
+
if (this.rollupAddress.equals(other.rollupAddress)) {
|
|
42
|
+
if (this.schemaVersion < other.schemaVersion) {
|
|
43
|
+
return -1;
|
|
44
|
+
} else if (this.schemaVersion > other.schemaVersion) {
|
|
45
|
+
return 1;
|
|
46
|
+
} else {
|
|
47
|
+
return 0;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return undefined;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Checks if two versions exactly match
|
|
55
|
+
*/
|
|
56
|
+
public equals(other: DatabaseVersion): boolean {
|
|
57
|
+
return this.cmp(other) === 0;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Returns the schema for this class
|
|
62
|
+
*/
|
|
63
|
+
static get schema() {
|
|
64
|
+
return z
|
|
65
|
+
.object({
|
|
66
|
+
schemaVersion: z.number(),
|
|
67
|
+
rollupAddress: EthAddress.schema,
|
|
68
|
+
})
|
|
69
|
+
.transform(({ schemaVersion, rollupAddress }) => new DatabaseVersion(schemaVersion, rollupAddress));
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/** Allows for better introspection in Node.js console. Ignored in browser envs. */
|
|
73
|
+
public [inspectCustomSymbol](): string {
|
|
74
|
+
return this.toString();
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
public toString(): string {
|
|
78
|
+
return `DatabaseVersion{schemaVersion=${this.schemaVersion},rollupAddress=${this.rollupAddress}"}`;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Returns an empty instance
|
|
83
|
+
*/
|
|
84
|
+
static empty() {
|
|
85
|
+
return new DatabaseVersion(0, EthAddress.ZERO);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
@@ -1,86 +1,10 @@
|
|
|
1
1
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
2
|
-
import { jsonParseWithSchema, jsonStringify } from '@aztec/foundation/json-rpc';
|
|
3
2
|
import { type Logger, createLogger } from '@aztec/foundation/log';
|
|
4
3
|
|
|
5
4
|
import fs from 'fs/promises';
|
|
6
|
-
import { inspect } from 'node:util';
|
|
7
5
|
import { join } from 'path';
|
|
8
|
-
import { z } from 'zod';
|
|
9
6
|
|
|
10
|
-
|
|
11
|
-
* Represents a version record for storing in a version file.
|
|
12
|
-
*/
|
|
13
|
-
export class DatabaseVersion {
|
|
14
|
-
constructor(
|
|
15
|
-
/** The version of the data on disk. Used to perform upgrades */
|
|
16
|
-
public readonly schemaVersion: number,
|
|
17
|
-
/** The rollup the data pertains to */
|
|
18
|
-
public readonly rollupAddress: EthAddress,
|
|
19
|
-
) {}
|
|
20
|
-
|
|
21
|
-
public toBuffer(): Buffer {
|
|
22
|
-
return Buffer.from(jsonStringify(this));
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
public static fromBuffer(buf: Buffer): DatabaseVersion {
|
|
26
|
-
try {
|
|
27
|
-
return jsonParseWithSchema(buf.toString('utf-8'), DatabaseVersion.schema);
|
|
28
|
-
} catch (err) {
|
|
29
|
-
throw new Error(`Failed to deserialize version information: ${err}`, { cause: err });
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Compares two versions. If the rollups addresses are different then it returns undefined
|
|
35
|
-
*/
|
|
36
|
-
public cmp(other: DatabaseVersion): undefined | -1 | 0 | 1 {
|
|
37
|
-
if (this.rollupAddress.equals(other.rollupAddress)) {
|
|
38
|
-
if (this.schemaVersion < other.schemaVersion) {
|
|
39
|
-
return -1;
|
|
40
|
-
} else if (this.schemaVersion > other.schemaVersion) {
|
|
41
|
-
return 1;
|
|
42
|
-
} else {
|
|
43
|
-
return 0;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
return undefined;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Checks if two versions exactly match
|
|
51
|
-
*/
|
|
52
|
-
public equals(other: DatabaseVersion): boolean {
|
|
53
|
-
return this.cmp(other) === 0;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* Returns the schema for this class
|
|
58
|
-
*/
|
|
59
|
-
static get schema() {
|
|
60
|
-
return z
|
|
61
|
-
.object({
|
|
62
|
-
schemaVersion: z.number(),
|
|
63
|
-
rollupAddress: EthAddress.schema,
|
|
64
|
-
})
|
|
65
|
-
.transform(({ schemaVersion, rollupAddress }) => new DatabaseVersion(schemaVersion, rollupAddress));
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
/** Allows for better introspection. */
|
|
69
|
-
public [inspect.custom](): string {
|
|
70
|
-
return this.toString();
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
public toString(): string {
|
|
74
|
-
return `DatabaseVersion{schemaVersion=${this.schemaVersion},rollupAddress=${this.rollupAddress}"}`;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* Returns an empty instance
|
|
79
|
-
*/
|
|
80
|
-
static empty() {
|
|
81
|
-
return new DatabaseVersion(0, EthAddress.ZERO);
|
|
82
|
-
}
|
|
83
|
-
}
|
|
7
|
+
import { DatabaseVersion } from './database_version.js';
|
|
84
8
|
|
|
85
9
|
export type DatabaseVersionManagerFs = Pick<typeof fs, 'readFile' | 'writeFile' | 'rm' | 'mkdir'>;
|
|
86
10
|
|
|
@@ -68,23 +68,22 @@ export class DelayedPublicMutableValues {
|
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
static async readFromTree(delayedPublicMutableSlot: Fr, readStorage: (storageSlot: Fr) => Promise<Fr>) {
|
|
71
|
-
const
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
return DelayedPublicMutableValues.fromFields(fields);
|
|
71
|
+
const fieldPromises = Array.from({ length: DELAYED_PUBLIC_MUTABLE_VALUES_LEN }).map((_, i) =>
|
|
72
|
+
readStorage(delayedPublicMutableSlot.add(new Fr(i))),
|
|
73
|
+
);
|
|
74
|
+
return DelayedPublicMutableValues.fromFields(await Promise.all(fieldPromises));
|
|
76
75
|
}
|
|
77
76
|
|
|
78
77
|
isEmpty(): boolean {
|
|
79
78
|
return this.svc.isEmpty() && this.sdc.isEmpty();
|
|
80
79
|
}
|
|
81
80
|
|
|
82
|
-
|
|
83
|
-
const
|
|
81
|
+
writeToTree(delayedPublicMutableSlot: Fr, storageWrite: (storageSlot: Fr, value: Fr) => Promise<void>) {
|
|
82
|
+
const fieldPromises = this.toFields().map((field, i) =>
|
|
83
|
+
storageWrite(delayedPublicMutableSlot.add(new Fr(i)), field),
|
|
84
|
+
);
|
|
84
85
|
|
|
85
|
-
|
|
86
|
-
await storageWrite(delayedPublicMutableSlot.add(new Fr(i)), fields[i]);
|
|
87
|
-
}
|
|
86
|
+
return Promise.all(fieldPromises);
|
|
88
87
|
}
|
|
89
88
|
|
|
90
89
|
async hash(): Promise<Fr> {
|
|
@@ -11,6 +11,7 @@ export type L1RollupConstants = {
|
|
|
11
11
|
epochDuration: number;
|
|
12
12
|
ethereumSlotDuration: number;
|
|
13
13
|
proofSubmissionEpochs: number;
|
|
14
|
+
targetCommitteeSize: number;
|
|
14
15
|
};
|
|
15
16
|
|
|
16
17
|
export const EmptyL1RollupConstants: L1RollupConstants = {
|
|
@@ -20,6 +21,7 @@ export const EmptyL1RollupConstants: L1RollupConstants = {
|
|
|
20
21
|
slotDuration: 1,
|
|
21
22
|
ethereumSlotDuration: 1,
|
|
22
23
|
proofSubmissionEpochs: 1,
|
|
24
|
+
targetCommitteeSize: 48,
|
|
23
25
|
};
|
|
24
26
|
|
|
25
27
|
export const L1RollupConstantsSchema = zodFor<L1RollupConstants>()(
|
|
@@ -30,6 +32,7 @@ export const L1RollupConstantsSchema = zodFor<L1RollupConstants>()(
|
|
|
30
32
|
epochDuration: z.number(),
|
|
31
33
|
ethereumSlotDuration: z.number(),
|
|
32
34
|
proofSubmissionEpochs: z.number(),
|
|
35
|
+
targetCommitteeSize: z.number(),
|
|
33
36
|
}),
|
|
34
37
|
);
|
|
35
38
|
|
|
@@ -51,6 +54,15 @@ export function getSlotAtTimestamp(
|
|
|
51
54
|
: SlotNumber.fromBigInt((ts - constants.l1GenesisTime) / BigInt(constants.slotDuration));
|
|
52
55
|
}
|
|
53
56
|
|
|
57
|
+
/** Returns the L2 slot number at the next L1 block based on the current timestamp. */
|
|
58
|
+
export function getSlotAtNextL1Block(
|
|
59
|
+
currentL1Timestamp: bigint,
|
|
60
|
+
constants: Pick<L1RollupConstants, 'l1GenesisTime' | 'slotDuration' | 'ethereumSlotDuration'>,
|
|
61
|
+
): SlotNumber {
|
|
62
|
+
const nextL1BlockTimestamp = currentL1Timestamp + BigInt(constants.ethereumSlotDuration);
|
|
63
|
+
return getSlotAtTimestamp(nextL1BlockTimestamp, constants);
|
|
64
|
+
}
|
|
65
|
+
|
|
54
66
|
/** Returns the epoch number for a given timestamp. */
|
|
55
67
|
export function getEpochNumberAtTimestamp(
|
|
56
68
|
ts: bigint,
|
|
@@ -69,7 +81,7 @@ export function getSlotRangeForEpoch(
|
|
|
69
81
|
epochNumber: EpochNumber,
|
|
70
82
|
constants: Pick<L1RollupConstants, 'epochDuration'>,
|
|
71
83
|
): [SlotNumber, SlotNumber] {
|
|
72
|
-
const startSlot = SlotNumber(epochNumber * constants.epochDuration);
|
|
84
|
+
const startSlot = SlotNumber(Number(epochNumber) * constants.epochDuration);
|
|
73
85
|
return [startSlot, SlotNumber(startSlot + constants.epochDuration - 1)];
|
|
74
86
|
}
|
|
75
87
|
|
package/src/hash/hash.ts
CHANGED
|
@@ -55,7 +55,7 @@ export function computeUniqueNoteHash(noteNonce: Fr, siloedNoteHash: Fr): Promis
|
|
|
55
55
|
* @returns A siloed nullifier.
|
|
56
56
|
*/
|
|
57
57
|
export function siloNullifier(contract: AztecAddress, innerNullifier: Fr): Promise<Fr> {
|
|
58
|
-
return poseidon2HashWithSeparator([contract, innerNullifier], GeneratorIndex.
|
|
58
|
+
return poseidon2HashWithSeparator([contract, innerNullifier], GeneratorIndex.SILOED_NULLIFIER);
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
/**
|
|
@@ -87,7 +87,7 @@ export function computePublicDataTreeValue(value: Fr): Fr {
|
|
|
87
87
|
|
|
88
88
|
*/
|
|
89
89
|
export function computePublicDataTreeLeafSlot(contractAddress: AztecAddress, storageSlot: Fr): Promise<Fr> {
|
|
90
|
-
return poseidon2HashWithSeparator([contractAddress, storageSlot], GeneratorIndex.
|
|
90
|
+
return poseidon2HashWithSeparator([contractAddress, storageSlot], GeneratorIndex.PUBLIC_LEAF_SLOT);
|
|
91
91
|
}
|
|
92
92
|
|
|
93
93
|
/**
|
package/src/hash/map_slot.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { GeneratorIndex } from '@aztec/constants';
|
|
2
|
+
import { poseidon2HashWithSeparator } from '@aztec/foundation/crypto/poseidon';
|
|
2
3
|
import type { Fr } from '@aztec/foundation/curves/bn254';
|
|
3
4
|
|
|
4
5
|
/**
|
|
@@ -14,5 +15,5 @@ export function deriveStorageSlotInMap(
|
|
|
14
15
|
toField: () => Fr;
|
|
15
16
|
},
|
|
16
17
|
): Promise<Fr> {
|
|
17
|
-
return
|
|
18
|
+
return poseidon2HashWithSeparator([mapSlot, key.toField()], GeneratorIndex.PUBLIC_STORAGE_MAP_SLOT);
|
|
18
19
|
}
|
|
@@ -4,8 +4,9 @@ import type { ApiSchemaFor } from '@aztec/foundation/schemas';
|
|
|
4
4
|
|
|
5
5
|
import { z } from 'zod';
|
|
6
6
|
|
|
7
|
+
import { BlockHash } from '../block/block_hash.js';
|
|
7
8
|
import { CheckpointedL2Block } from '../block/checkpointed_l2_block.js';
|
|
8
|
-
import {
|
|
9
|
+
import { L2Block } from '../block/l2_block.js';
|
|
9
10
|
import { type L2BlockSource, L2TipsSchema } from '../block/l2_block_source.js';
|
|
10
11
|
import { ValidateCheckpointResultSchema } from '../block/validate_block_result.js';
|
|
11
12
|
import { Checkpoint } from '../checkpoint/checkpoint.js';
|
|
@@ -82,7 +83,9 @@ export const ArchiverApiSchema: ApiSchemaFor<ArchiverApi> = {
|
|
|
82
83
|
getRegistryAddress: z.function().args().returns(schemas.EthAddress),
|
|
83
84
|
getBlockNumber: z.function().args().returns(BlockNumberSchema),
|
|
84
85
|
getProvenBlockNumber: z.function().args().returns(BlockNumberSchema),
|
|
85
|
-
|
|
86
|
+
getCheckpointedL2BlockNumber: z.function().args().returns(BlockNumberSchema),
|
|
87
|
+
getFinalizedL2BlockNumber: z.function().args().returns(BlockNumberSchema),
|
|
88
|
+
getBlock: z.function().args(BlockNumberSchema).returns(L2Block.schema.optional()),
|
|
86
89
|
getBlockHeader: z
|
|
87
90
|
.function()
|
|
88
91
|
.args(z.union([BlockNumberSchema, z.literal('latest')]))
|
|
@@ -90,48 +93,37 @@ export const ArchiverApiSchema: ApiSchemaFor<ArchiverApi> = {
|
|
|
90
93
|
getCheckpointedBlock: z.function().args(BlockNumberSchema).returns(CheckpointedL2Block.schema.optional()),
|
|
91
94
|
getCheckpointedBlocks: z
|
|
92
95
|
.function()
|
|
93
|
-
.args(BlockNumberSchema, schemas.Integer
|
|
96
|
+
.args(BlockNumberSchema, schemas.Integer)
|
|
94
97
|
.returns(z.array(CheckpointedL2Block.schema)),
|
|
95
|
-
getBlocks: z
|
|
96
|
-
|
|
97
|
-
.args(BlockNumberSchema, schemas.Integer, optional(z.boolean()))
|
|
98
|
-
.returns(z.array(L2BlockNew.schema)),
|
|
99
|
-
getPublishedCheckpoints: z
|
|
98
|
+
getBlocks: z.function().args(BlockNumberSchema, schemas.Integer).returns(z.array(L2Block.schema)),
|
|
99
|
+
getCheckpoints: z
|
|
100
100
|
.function()
|
|
101
101
|
.args(CheckpointNumberSchema, schemas.Integer)
|
|
102
102
|
.returns(z.array(PublishedCheckpoint.schema)),
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
.returns(z.array(CheckpointedL2Block.schema)),
|
|
107
|
-
getL2BlocksNew: z
|
|
108
|
-
.function()
|
|
109
|
-
.args(BlockNumberSchema, schemas.Integer, optional(z.boolean()))
|
|
110
|
-
.returns(z.array(L2BlockNew.schema)),
|
|
111
|
-
getPublishedBlockByHash: z.function().args(schemas.Fr).returns(CheckpointedL2Block.schema.optional()),
|
|
112
|
-
getPublishedBlockByArchive: z.function().args(schemas.Fr).returns(CheckpointedL2Block.schema.optional()),
|
|
113
|
-
getBlockHeaderByHash: z.function().args(schemas.Fr).returns(BlockHeader.schema.optional()),
|
|
103
|
+
getCheckpointedBlockByHash: z.function().args(BlockHash.schema).returns(CheckpointedL2Block.schema.optional()),
|
|
104
|
+
getCheckpointedBlockByArchive: z.function().args(schemas.Fr).returns(CheckpointedL2Block.schema.optional()),
|
|
105
|
+
getBlockHeaderByHash: z.function().args(BlockHash.schema).returns(BlockHeader.schema.optional()),
|
|
114
106
|
getBlockHeaderByArchive: z.function().args(schemas.Fr).returns(BlockHeader.schema.optional()),
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
107
|
+
getL2Block: z.function().args(BlockNumberSchema).returns(L2Block.schema.optional()),
|
|
108
|
+
getL2BlockByHash: z.function().args(BlockHash.schema).returns(L2Block.schema.optional()),
|
|
109
|
+
getL2BlockByArchive: z.function().args(schemas.Fr).returns(L2Block.schema.optional()),
|
|
118
110
|
getTxEffect: z.function().args(TxHash.schema).returns(indexedTxSchema().optional()),
|
|
119
111
|
getSettledTxReceipt: z.function().args(TxHash.schema).returns(TxReceipt.schema.optional()),
|
|
120
112
|
getL2SlotNumber: z.function().args().returns(schemas.SlotNumber.optional()),
|
|
121
113
|
getL2EpochNumber: z.function().args().returns(EpochNumberSchema.optional()),
|
|
122
114
|
getCheckpointsForEpoch: z.function().args(EpochNumberSchema).returns(z.array(Checkpoint.schema)),
|
|
123
|
-
|
|
124
|
-
getBlocksForSlot: z.function().args(schemas.SlotNumber).returns(z.array(
|
|
125
|
-
|
|
115
|
+
getCheckpointedBlocksForEpoch: z.function().args(EpochNumberSchema).returns(z.array(CheckpointedL2Block.schema)),
|
|
116
|
+
getBlocksForSlot: z.function().args(schemas.SlotNumber).returns(z.array(L2Block.schema)),
|
|
117
|
+
getCheckpointedBlockHeadersForEpoch: z.function().args(EpochNumberSchema).returns(z.array(BlockHeader.schema)),
|
|
126
118
|
isEpochComplete: z.function().args(EpochNumberSchema).returns(z.boolean()),
|
|
127
119
|
getL2Tips: z.function().args().returns(L2TipsSchema),
|
|
128
120
|
getPrivateLogsByTags: z
|
|
129
121
|
.function()
|
|
130
|
-
.args(z.array(SiloedTag.schema))
|
|
122
|
+
.args(z.array(SiloedTag.schema), optional(z.number().gte(0)))
|
|
131
123
|
.returns(z.array(z.array(TxScopedL2Log.schema))),
|
|
132
124
|
getPublicLogsByTagsFromContract: z
|
|
133
125
|
.function()
|
|
134
|
-
.args(schemas.AztecAddress, z.array(Tag.schema))
|
|
126
|
+
.args(schemas.AztecAddress, z.array(Tag.schema), optional(z.number().gte(0)))
|
|
135
127
|
.returns(z.array(z.array(TxScopedL2Log.schema))),
|
|
136
128
|
getPublicLogs: z.function().args(LogFilterSchema).returns(GetPublicLogsResponseSchema),
|
|
137
129
|
getContractClassLogs: z.function().args(LogFilterSchema).returns(GetContractClassLogsResponseSchema),
|
|
@@ -52,7 +52,8 @@ export interface AztecNodeAdmin {
|
|
|
52
52
|
getSlashOffenses(round: bigint | 'all' | 'current'): Promise<Offense[]>;
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
|
|
55
|
+
// L1 contracts are not mutable via admin updates.
|
|
56
|
+
export type AztecNodeAdminConfig = Omit<ValidatorClientFullConfig, 'l1Contracts'> &
|
|
56
57
|
SequencerConfig &
|
|
57
58
|
ProverConfig &
|
|
58
59
|
SlasherConfig &
|
|
@@ -65,7 +66,7 @@ export type AztecNodeAdminConfig = ValidatorClientFullConfig &
|
|
|
65
66
|
|
|
66
67
|
export const AztecNodeAdminConfigSchema = SequencerConfigSchema.merge(ProverConfigSchema)
|
|
67
68
|
.merge(SlasherConfigSchema)
|
|
68
|
-
.merge(ValidatorClientFullConfigSchema)
|
|
69
|
+
.merge(ValidatorClientFullConfigSchema.omit({ l1Contracts: true }))
|
|
69
70
|
.merge(
|
|
70
71
|
ArchiverSpecificConfigSchema.pick({
|
|
71
72
|
archiverPollingIntervalMS: true,
|