@aztec/stdlib 5.0.0-rc.2 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dest/block/attestation_info.d.ts +1 -1
- package/dest/block/attestation_info.d.ts.map +1 -1
- package/dest/block/attestation_info.js +7 -4
- package/dest/block/l2_block_source.d.ts +34 -3
- package/dest/block/l2_block_source.d.ts.map +1 -1
- package/dest/block/l2_block_source.js +15 -0
- package/dest/block/l2_block_stream/event_driven_l2_block_stream.d.ts +39 -0
- package/dest/block/l2_block_stream/event_driven_l2_block_stream.d.ts.map +1 -0
- package/dest/block/l2_block_stream/event_driven_l2_block_stream.js +165 -0
- package/dest/block/l2_block_stream/index.d.ts +2 -1
- package/dest/block/l2_block_stream/index.d.ts.map +1 -1
- package/dest/block/l2_block_stream/index.js +1 -0
- package/dest/block/l2_block_stream/interfaces.d.ts +16 -2
- package/dest/block/l2_block_stream/interfaces.d.ts.map +1 -1
- package/dest/block/l2_block_stream/interfaces.js +25 -1
- package/dest/block/l2_block_stream/l2_block_stream.d.ts +21 -35
- package/dest/block/l2_block_stream/l2_block_stream.d.ts.map +1 -1
- package/dest/block/l2_block_stream/l2_block_stream.js +5 -30
- package/dest/block/proposal/attestations_and_signers.d.ts +19 -1
- package/dest/block/proposal/attestations_and_signers.d.ts.map +1 -1
- package/dest/block/proposal/attestations_and_signers.js +47 -7
- package/dest/block/validate_block_result.d.ts +16 -1
- package/dest/block/validate_block_result.d.ts.map +1 -1
- package/dest/block/validate_block_result.js +18 -3
- package/dest/config/network-consensus-config.d.ts +1 -1
- package/dest/config/network-consensus-config.d.ts.map +1 -1
- package/dest/config/network-consensus-config.js +2 -10
- package/dest/contract/contract_address.d.ts +5 -4
- package/dest/contract/contract_address.d.ts.map +1 -1
- package/dest/contract/contract_instance.d.ts +16 -2
- package/dest/contract/contract_instance.d.ts.map +1 -1
- package/dest/contract/contract_instance.js +45 -0
- package/dest/contract/interfaces/contract_instance.d.ts +71 -10
- package/dest/contract/interfaces/contract_instance.d.ts.map +1 -1
- package/dest/contract/interfaces/contract_instance.js +7 -2
- package/dest/contract/partial_address.d.ts +9 -3
- package/dest/contract/partial_address.d.ts.map +1 -1
- package/dest/contract/partial_address.js +8 -2
- package/dest/database-version/version_manager.d.ts +18 -4
- package/dest/database-version/version_manager.d.ts.map +1 -1
- package/dest/database-version/version_manager.js +76 -6
- package/dest/ha-signing/config.d.ts +19 -5
- package/dest/ha-signing/config.d.ts.map +1 -1
- package/dest/ha-signing/config.js +9 -3
- package/dest/ha-signing/local_config.d.ts +10 -2
- package/dest/ha-signing/local_config.d.ts.map +1 -1
- package/dest/ha-signing/local_config.js +8 -2
- package/dest/hash/hash.d.ts +1 -2
- package/dest/hash/hash.d.ts.map +1 -1
- package/dest/hash/hash.js +0 -7
- package/dest/interfaces/archiver.d.ts +8 -1
- package/dest/interfaces/archiver.d.ts.map +1 -1
- package/dest/interfaces/archiver.js +2 -1
- package/dest/interfaces/aztec-node-admin.d.ts +5 -2
- package/dest/interfaces/aztec-node-admin.d.ts.map +1 -1
- package/dest/interfaces/configs.d.ts +4 -1
- package/dest/interfaces/configs.d.ts.map +1 -1
- package/dest/interfaces/configs.js +1 -0
- package/dest/interfaces/private_kernel_prover.d.ts +9 -11
- package/dest/interfaces/private_kernel_prover.d.ts.map +1 -1
- package/dest/interfaces/proving-job.d.ts +87 -74
- package/dest/interfaces/proving-job.d.ts.map +1 -1
- package/dest/interfaces/proving-job.js +13 -4
- package/dest/interfaces/server_circuit_prover.d.ts +3 -3
- package/dest/interfaces/server_circuit_prover.d.ts.map +1 -1
- package/dest/interfaces/validator.d.ts +7 -3
- package/dest/interfaces/validator.d.ts.map +1 -1
- package/dest/interfaces/world_state.d.ts +14 -1
- package/dest/interfaces/world_state.d.ts.map +1 -1
- package/dest/kernel/hints/find_private_kernel_reset_dimensions.d.ts +8 -2
- package/dest/kernel/hints/find_private_kernel_reset_dimensions.d.ts.map +1 -1
- package/dest/kernel/hints/find_private_kernel_reset_dimensions.js +12 -74
- package/dest/kernel/index.d.ts +2 -2
- package/dest/kernel/index.d.ts.map +1 -1
- package/dest/kernel/index.js +1 -1
- package/dest/kernel/private_circuit_public_inputs.d.ts +13 -3
- package/dest/kernel/private_circuit_public_inputs.d.ts.map +1 -1
- package/dest/kernel/private_circuit_public_inputs.js +14 -7
- package/dest/kernel/private_context_inputs.d.ts +4 -3
- package/dest/kernel/private_context_inputs.d.ts.map +1 -1
- package/dest/kernel/private_context_inputs.js +7 -3
- package/dest/kernel/private_kernel_circuit_public_inputs.d.ts +7 -1
- package/dest/kernel/private_kernel_circuit_public_inputs.d.ts.map +1 -1
- package/dest/kernel/private_kernel_circuit_public_inputs.js +7 -0
- package/dest/kernel/private_kernel_init_2_circuit_private_inputs.d.ts +2 -3
- package/dest/kernel/private_kernel_init_2_circuit_private_inputs.d.ts.map +1 -1
- package/dest/kernel/private_kernel_init_2_circuit_private_inputs.js +3 -5
- package/dest/kernel/private_kernel_init_3_circuit_private_inputs.d.ts +2 -3
- package/dest/kernel/private_kernel_init_3_circuit_private_inputs.d.ts.map +1 -1
- package/dest/kernel/private_kernel_init_3_circuit_private_inputs.js +3 -5
- package/dest/kernel/private_kernel_init_circuit_private_inputs.d.ts +1 -9
- package/dest/kernel/private_kernel_init_circuit_private_inputs.d.ts.map +1 -1
- package/dest/kernel/private_kernel_init_circuit_private_inputs.js +2 -6
- package/dest/kernel/private_kernel_reset_dimensions.d.ts +7 -8
- package/dest/kernel/private_kernel_reset_dimensions.d.ts.map +1 -1
- package/dest/kernel/private_kernel_reset_tail_circuit_private_inputs.d.ts +29 -0
- package/dest/kernel/private_kernel_reset_tail_circuit_private_inputs.d.ts.map +1 -0
- package/dest/kernel/private_kernel_reset_tail_circuit_private_inputs.js +36 -0
- package/dest/keys/derivation.d.ts +41 -6
- package/dest/keys/derivation.d.ts.map +1 -1
- package/dest/keys/derivation.js +49 -26
- package/dest/logs/app_tagging_secret.d.ts +16 -8
- package/dest/logs/app_tagging_secret.d.ts.map +1 -1
- package/dest/logs/app_tagging_secret.js +24 -27
- package/dest/logs/index.d.ts +1 -3
- package/dest/logs/index.d.ts.map +1 -1
- package/dest/logs/index.js +0 -2
- package/dest/logs/shared_secret_derivation.d.ts +19 -6
- package/dest/logs/shared_secret_derivation.d.ts.map +1 -1
- package/dest/logs/shared_secret_derivation.js +26 -11
- package/dest/messaging/l1_to_l2_message.d.ts +23 -2
- package/dest/messaging/l1_to_l2_message.d.ts.map +1 -1
- package/dest/messaging/l1_to_l2_message.js +36 -11
- package/dest/p2p/attestation_utils.d.ts +1 -1
- package/dest/p2p/attestation_utils.d.ts.map +1 -1
- package/dest/p2p/attestation_utils.js +8 -1
- package/dest/p2p/checkpoint_attestation.d.ts +9 -1
- package/dest/p2p/checkpoint_attestation.d.ts.map +1 -1
- package/dest/p2p/checkpoint_attestation.js +10 -0
- package/dest/p2p/signature_utils.d.ts +10 -1
- package/dest/p2p/signature_utils.d.ts.map +1 -1
- package/dest/p2p/signature_utils.js +9 -1
- package/dest/rollup/avm_proof_data.d.ts +3 -3
- package/dest/rollup/avm_proof_data.d.ts.map +1 -1
- package/dest/stats/stats.d.ts +2 -2
- package/dest/stats/stats.d.ts.map +1 -1
- package/dest/tests/factories.d.ts +1 -1
- package/dest/tests/factories.d.ts.map +1 -1
- package/dest/tests/factories.js +4 -3
- package/dest/tx/private_tx_constant_data.d.ts +18 -2
- package/dest/tx/private_tx_constant_data.d.ts.map +1 -1
- package/dest/tx/private_tx_constant_data.js +13 -4
- package/dest/tx/simulated_tx.d.ts +10 -6
- package/dest/tx/simulated_tx.d.ts.map +1 -1
- package/dest/world-state/genesis_data.d.ts +9 -1
- package/dest/world-state/genesis_data.d.ts.map +1 -1
- package/dest/world-state/genesis_data.js +1 -0
- package/package.json +8 -8
- package/src/block/attestation_info.ts +7 -2
- package/src/block/l2_block_source.ts +54 -2
- package/src/block/l2_block_stream/event_driven_l2_block_stream.ts +207 -0
- package/src/block/l2_block_stream/index.ts +1 -0
- package/src/block/l2_block_stream/interfaces.ts +35 -1
- package/src/block/l2_block_stream/l2_block_stream.ts +35 -62
- package/src/block/proposal/attestations_and_signers.ts +53 -7
- package/src/block/validate_block_result.ts +48 -2
- package/src/config/network-consensus-config.ts +2 -13
- package/src/contract/contract_address.ts +4 -3
- package/src/contract/contract_instance.ts +62 -1
- package/src/contract/interfaces/contract_instance.ts +26 -8
- package/src/contract/partial_address.ts +8 -2
- package/src/database-version/version_manager.ts +96 -6
- package/src/ha-signing/config.ts +23 -5
- package/src/ha-signing/local_config.ts +20 -1
- package/src/hash/hash.ts +0 -8
- package/src/interfaces/archiver.ts +8 -0
- package/src/interfaces/configs.ts +3 -0
- package/src/interfaces/private_kernel_prover.ts +10 -12
- package/src/interfaces/proving-job.ts +15 -3
- package/src/interfaces/server_circuit_prover.ts +2 -2
- package/src/interfaces/world_state.ts +14 -0
- package/src/kernel/hints/find_private_kernel_reset_dimensions.ts +22 -112
- package/src/kernel/index.ts +1 -1
- package/src/kernel/private_circuit_public_inputs.ts +12 -1
- package/src/kernel/private_context_inputs.ts +10 -3
- package/src/kernel/private_kernel_circuit_public_inputs.ts +9 -0
- package/src/kernel/private_kernel_init_2_circuit_private_inputs.ts +0 -3
- package/src/kernel/private_kernel_init_3_circuit_private_inputs.ts +0 -3
- package/src/kernel/private_kernel_init_circuit_private_inputs.ts +0 -6
- package/src/kernel/private_kernel_reset_dimensions.ts +15 -5
- package/src/kernel/private_kernel_reset_tail_circuit_private_inputs.ts +69 -0
- package/src/keys/derivation.ts +69 -24
- package/src/logs/app_tagging_secret.ts +34 -27
- package/src/logs/index.ts +0 -2
- package/src/logs/shared_secret_derivation.ts +31 -15
- package/src/messaging/l1_to_l2_message.ts +51 -13
- package/src/p2p/attestation_utils.ts +8 -1
- package/src/p2p/checkpoint_attestation.ts +12 -0
- package/src/p2p/signature_utils.ts +9 -0
- package/src/rollup/avm_proof_data.ts +2 -2
- package/src/stats/stats.ts +2 -2
- package/src/tests/factories.ts +3 -6
- package/src/tx/private_tx_constant_data.ts +25 -2
- package/src/world-state/genesis_data.ts +10 -0
- package/dest/kernel/private_kernel_tail_circuit_private_inputs.d.ts +0 -47
- package/dest/kernel/private_kernel_tail_circuit_private_inputs.d.ts.map +0 -1
- package/dest/kernel/private_kernel_tail_circuit_private_inputs.js +0 -38
- package/dest/logs/message_context.d.ts +0 -17
- package/dest/logs/message_context.d.ts.map +0 -1
- package/dest/logs/message_context.js +0 -9
- package/dest/logs/pending_tagged_log.d.ts +0 -11
- package/dest/logs/pending_tagged_log.d.ts.map +0 -1
- package/dest/logs/pending_tagged_log.js +0 -4
- package/src/kernel/private_kernel_tail_circuit_private_inputs.ts +0 -58
- package/src/logs/message_context.ts +0 -18
- package/src/logs/pending_tagged_log.ts +0 -12
|
@@ -18,7 +18,12 @@ import {
|
|
|
18
18
|
computeInitializationHash,
|
|
19
19
|
computeInitializationHashFromEncodedArgs,
|
|
20
20
|
} from './contract_address.js';
|
|
21
|
-
import type {
|
|
21
|
+
import type {
|
|
22
|
+
ContractInstance,
|
|
23
|
+
ContractInstancePreimage,
|
|
24
|
+
ContractInstancePreimageWithAddress,
|
|
25
|
+
ContractInstanceWithAddress,
|
|
26
|
+
} from './interfaces/contract_instance.js';
|
|
22
27
|
|
|
23
28
|
const VERSION = 2 as const;
|
|
24
29
|
|
|
@@ -115,6 +120,62 @@ export class SerializableContractInstance {
|
|
|
115
120
|
}
|
|
116
121
|
}
|
|
117
122
|
|
|
123
|
+
export class SerializableContractInstancePreimage {
|
|
124
|
+
public readonly version = VERSION;
|
|
125
|
+
public readonly salt: Fr;
|
|
126
|
+
public readonly deployer: AztecAddress;
|
|
127
|
+
public readonly originalContractClassId: Fr;
|
|
128
|
+
public readonly initializationHash: Fr;
|
|
129
|
+
public readonly immutablesHash: Fr;
|
|
130
|
+
public readonly publicKeys: PublicKeys;
|
|
131
|
+
|
|
132
|
+
constructor(instance: ContractInstancePreimage) {
|
|
133
|
+
if (instance.version !== VERSION) {
|
|
134
|
+
throw new Error(`Unexpected contract class version ${instance.version}`);
|
|
135
|
+
}
|
|
136
|
+
this.salt = instance.salt;
|
|
137
|
+
this.deployer = instance.deployer;
|
|
138
|
+
this.originalContractClassId = instance.originalContractClassId;
|
|
139
|
+
this.initializationHash = instance.initializationHash;
|
|
140
|
+
this.immutablesHash = instance.immutablesHash;
|
|
141
|
+
this.publicKeys = instance.publicKeys;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
public toBuffer() {
|
|
145
|
+
return serializeToBuffer(
|
|
146
|
+
numToUInt8(this.version),
|
|
147
|
+
this.salt,
|
|
148
|
+
this.deployer,
|
|
149
|
+
this.originalContractClassId,
|
|
150
|
+
this.initializationHash,
|
|
151
|
+
this.immutablesHash,
|
|
152
|
+
this.publicKeys,
|
|
153
|
+
);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/** Returns a copy of this object with its address included. */
|
|
157
|
+
withAddress(address: AztecAddress): ContractInstancePreimageWithAddress {
|
|
158
|
+
return { ...this, address };
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
static fromBuffer(bufferOrReader: Buffer | BufferReader): SerializableContractInstancePreimage {
|
|
162
|
+
const reader = BufferReader.asReader(bufferOrReader);
|
|
163
|
+
const version = reader.readUInt8();
|
|
164
|
+
if (version !== VERSION) {
|
|
165
|
+
throw new Error(`Unexpected contract instance preimage version ${version}`);
|
|
166
|
+
}
|
|
167
|
+
return new SerializableContractInstancePreimage({
|
|
168
|
+
version: VERSION,
|
|
169
|
+
salt: reader.readObject(Fr),
|
|
170
|
+
deployer: reader.readObject(AztecAddress),
|
|
171
|
+
originalContractClassId: reader.readObject(Fr),
|
|
172
|
+
initializationHash: reader.readObject(Fr),
|
|
173
|
+
immutablesHash: reader.readObject(Fr),
|
|
174
|
+
publicKeys: reader.readObject(PublicKeys),
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
118
179
|
/**
|
|
119
180
|
* Generates a Contract Instance from some instantiation params.
|
|
120
181
|
* @param artifact - The account contract build artifact.
|
|
@@ -9,19 +9,19 @@ import { schemas, zodFor } from '../../schemas/index.js';
|
|
|
9
9
|
const VERSION = 2 as const;
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
12
|
+
* The address preimage of a contract instance: the immutable data that hashes to its address, i.e. everything a
|
|
13
|
+
* contract deployment commits to.
|
|
14
|
+
*
|
|
15
|
+
* Note that `originaContractClassId` is not necessarily the instance's _current_ class id, in case of upgrades: that
|
|
16
|
+
* one is not part of the preimage and is instead derived from chain state.
|
|
15
17
|
*/
|
|
16
|
-
export interface
|
|
18
|
+
export interface ContractInstancePreimage {
|
|
17
19
|
/** Version identifier. Initially one, bumped for any changes to the contract instance struct. */
|
|
18
20
|
version: typeof VERSION;
|
|
19
21
|
/** User-generated pseudorandom value for uniqueness. */
|
|
20
22
|
salt: Fr;
|
|
21
23
|
/** Optional deployer address or zero if this was a universal deploy. */
|
|
22
24
|
deployer: AztecAddress;
|
|
23
|
-
/** Identifier of the contract class for this instance. */
|
|
24
|
-
currentContractClassId: Fr;
|
|
25
25
|
/** Identifier of the original (at deployment) contract class for this instance */
|
|
26
26
|
originalContractClassId: Fr;
|
|
27
27
|
/** Hash of the selector and arguments to the constructor. */
|
|
@@ -32,14 +32,24 @@ export interface ContractInstance {
|
|
|
32
32
|
publicKeys: PublicKeys;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
+
/**
|
|
36
|
+
* The address preimage plus the current contract class id, which is chain-tracked state derived from the
|
|
37
|
+
* ContractInstanceRegistry (it equals the original class id unless the contract has been upgraded).
|
|
38
|
+
*/
|
|
39
|
+
export interface ContractInstance extends ContractInstancePreimage {
|
|
40
|
+
/** Identifier of the contract class this instance currently runs (as of some block). */
|
|
41
|
+
currentContractClassId: Fr;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export type ContractInstancePreimageWithAddress = ContractInstancePreimage & { address: AztecAddress };
|
|
45
|
+
|
|
35
46
|
export type ContractInstanceWithAddress = ContractInstance & { address: AztecAddress };
|
|
36
47
|
|
|
37
|
-
export const
|
|
48
|
+
export const ContractInstancePreimageSchema = zodFor<ContractInstancePreimage>()(
|
|
38
49
|
z.object({
|
|
39
50
|
version: z.literal(VERSION),
|
|
40
51
|
salt: schemas.Fr,
|
|
41
52
|
deployer: schemas.AztecAddress,
|
|
42
|
-
currentContractClassId: schemas.Fr,
|
|
43
53
|
originalContractClassId: schemas.Fr,
|
|
44
54
|
initializationHash: schemas.Fr,
|
|
45
55
|
immutablesHash: schemas.Fr,
|
|
@@ -47,6 +57,14 @@ export const ContractInstanceSchema = zodFor<ContractInstance>()(
|
|
|
47
57
|
}),
|
|
48
58
|
);
|
|
49
59
|
|
|
60
|
+
export const ContractInstanceSchema = zodFor<ContractInstance>()(
|
|
61
|
+
ContractInstancePreimageSchema.and(z.object({ currentContractClassId: schemas.Fr })),
|
|
62
|
+
);
|
|
63
|
+
|
|
64
|
+
export const ContractInstancePreimageWithAddressSchema = zodFor<ContractInstancePreimageWithAddress>()(
|
|
65
|
+
ContractInstancePreimageSchema.and(z.object({ address: schemas.AztecAddress })),
|
|
66
|
+
);
|
|
67
|
+
|
|
50
68
|
export const ContractInstanceWithAddressSchema = zodFor<ContractInstanceWithAddress>()(
|
|
51
69
|
ContractInstanceSchema.and(z.object({ address: schemas.AztecAddress })),
|
|
52
70
|
);
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import type { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* The contract-side preimage of an Aztec address, i.e. the commitment to a specific contract instance.
|
|
5
|
+
*
|
|
6
|
+
* A partial address commits to a contract's code and initialization
|
|
7
|
+
* (`hash(contract_class_id, salted_initialization_hash)`) but not to its keys. Combined with an account's `PublicKeys`,
|
|
8
|
+
* it fully determines the address: `address = (hash(public_keys_hash, partial_address) * G + Ivpk_m).x`. Two accounts
|
|
9
|
+
* therefore share an address only if they share both their public keys and their partial address.
|
|
10
|
+
*
|
|
11
|
+
* See `computePartialAddress` for the derivation.
|
|
6
12
|
*/
|
|
7
13
|
export type PartialAddress = Fr;
|
|
@@ -6,11 +6,20 @@ import { join } from 'path';
|
|
|
6
6
|
|
|
7
7
|
import { DatabaseVersion } from './database_version.js';
|
|
8
8
|
|
|
9
|
-
export type DatabaseVersionManagerFs = Pick<typeof fs, 'readFile' | '
|
|
9
|
+
export type DatabaseVersionManagerFs = Pick<typeof fs, 'readFile' | 'rm' | 'mkdir' | 'rename' | 'open'>;
|
|
10
10
|
|
|
11
11
|
export const DATABASE_VERSION_FILE_NAME = 'db_version';
|
|
12
12
|
export type SchemaVersionMismatchPolicy = 'reset' | 'throw';
|
|
13
13
|
|
|
14
|
+
/**
|
|
15
|
+
* How to react when the version file exists but cannot be read (permissions, IO error, truncation).
|
|
16
|
+
* `'reset'` (default) treats the store as unversioned and lets the reset path run — safe for stores
|
|
17
|
+
* where an empty state is legitimate. `'throw'` refuses to open, leaving data untouched — required
|
|
18
|
+
* for protection stores (e.g. signing protection) that must never be silently wiped by a transient
|
|
19
|
+
* filesystem error. A genuinely missing file (ENOENT) is a first boot and is never affected by this.
|
|
20
|
+
*/
|
|
21
|
+
export type VersionFileReadFailurePolicy = 'reset' | 'throw';
|
|
22
|
+
|
|
14
23
|
export type DatabaseVersionManagerOptions<T> = {
|
|
15
24
|
schemaVersion: number;
|
|
16
25
|
rollupAddress: EthAddress;
|
|
@@ -18,6 +27,7 @@ export type DatabaseVersionManagerOptions<T> = {
|
|
|
18
27
|
onOpen: (dataDir: string) => Promise<T>;
|
|
19
28
|
onUpgrade?: (dataDir: string, currentVersion: number, latestVersion: number) => Promise<void>;
|
|
20
29
|
schemaVersionMismatchPolicy?: SchemaVersionMismatchPolicy;
|
|
30
|
+
versionFileReadFailurePolicy?: VersionFileReadFailurePolicy;
|
|
21
31
|
fileSystem?: DatabaseVersionManagerFs;
|
|
22
32
|
log?: Logger;
|
|
23
33
|
};
|
|
@@ -37,6 +47,7 @@ export class DatabaseVersionManager<T> {
|
|
|
37
47
|
private onOpen: (dataDir: string) => Promise<T>;
|
|
38
48
|
private onUpgrade?: (dataDir: string, currentVersion: number, latestVersion: number) => Promise<void>;
|
|
39
49
|
private schemaVersionMismatchPolicy: SchemaVersionMismatchPolicy;
|
|
50
|
+
private versionFileReadFailurePolicy: VersionFileReadFailurePolicy;
|
|
40
51
|
private fileSystem: DatabaseVersionManagerFs;
|
|
41
52
|
private log: Logger;
|
|
42
53
|
|
|
@@ -47,8 +58,11 @@ export class DatabaseVersionManager<T> {
|
|
|
47
58
|
* @param rollupAddress - The rollup contract address
|
|
48
59
|
* @param dataDirectory - The directory where version information will be stored
|
|
49
60
|
* @param onOpen - A callback to the open the database at the given location
|
|
50
|
-
* @param onUpgrade - An optional callback to upgrade the database before opening. If not provided it will reset the
|
|
61
|
+
* @param onUpgrade - An optional callback to upgrade the database before opening. If not provided it will reset the
|
|
62
|
+
* database. Must be idempotent: since the version marker is written only after a successful open, a crash after
|
|
63
|
+
* onUpgrade but before the marker is written re-runs onUpgrade on the next start.
|
|
51
64
|
* @param schemaVersionMismatchPolicy - Whether schema mismatches should reset data or throw
|
|
65
|
+
* @param versionFileReadFailurePolicy - Whether an unreadable (non-missing) version file should reset data or throw
|
|
52
66
|
* @param fileSystem - An interface to access the filesystem
|
|
53
67
|
* @param log - Optional custom logger
|
|
54
68
|
* @param options - Configuration options
|
|
@@ -60,6 +74,7 @@ export class DatabaseVersionManager<T> {
|
|
|
60
74
|
onOpen,
|
|
61
75
|
onUpgrade,
|
|
62
76
|
schemaVersionMismatchPolicy = 'reset',
|
|
77
|
+
versionFileReadFailurePolicy = 'reset',
|
|
63
78
|
fileSystem = fs,
|
|
64
79
|
log = createLogger(`foundation:version-manager`),
|
|
65
80
|
}: DatabaseVersionManagerOptions<T>) {
|
|
@@ -74,13 +89,40 @@ export class DatabaseVersionManager<T> {
|
|
|
74
89
|
this.onOpen = onOpen;
|
|
75
90
|
this.onUpgrade = onUpgrade;
|
|
76
91
|
this.schemaVersionMismatchPolicy = schemaVersionMismatchPolicy;
|
|
92
|
+
this.versionFileReadFailurePolicy = versionFileReadFailurePolicy;
|
|
77
93
|
this.fileSystem = fileSystem;
|
|
78
94
|
this.log = log;
|
|
79
95
|
}
|
|
80
96
|
|
|
81
97
|
static async writeVersion(version: DatabaseVersion, dataDir: string, fileSystem: DatabaseVersionManagerFs = fs) {
|
|
82
98
|
await fileSystem.mkdir(dataDir, { recursive: true });
|
|
83
|
-
|
|
99
|
+
const finalPath = join(dataDir, DatabaseVersionManager.VERSION_FILE);
|
|
100
|
+
const tmpPath = `${finalPath}.tmp`;
|
|
101
|
+
|
|
102
|
+
// Atomic durable write: fill a temp file, fsync it, then rename it into place. The marker only
|
|
103
|
+
// becomes visible under its final name once its bytes are durably on disk, so a crash mid-write
|
|
104
|
+
// can never leave a "valid" version file sitting over an empty or partially-populated data dir.
|
|
105
|
+
const handle = await fileSystem.open(tmpPath, 'w');
|
|
106
|
+
try {
|
|
107
|
+
await handle.writeFile(version.toBuffer());
|
|
108
|
+
await handle.sync();
|
|
109
|
+
} finally {
|
|
110
|
+
await handle.close();
|
|
111
|
+
}
|
|
112
|
+
await fileSystem.rename(tmpPath, finalPath);
|
|
113
|
+
|
|
114
|
+
// Best-effort fsync of the containing directory so the rename itself survives a crash. Not all
|
|
115
|
+
// filesystems support directory fsync, so a failure here is non-fatal.
|
|
116
|
+
try {
|
|
117
|
+
const dirHandle = await fileSystem.open(dataDir, 'r');
|
|
118
|
+
try {
|
|
119
|
+
await dirHandle.sync();
|
|
120
|
+
} finally {
|
|
121
|
+
await dirHandle.close();
|
|
122
|
+
}
|
|
123
|
+
} catch {
|
|
124
|
+
// directory fsync is best-effort
|
|
125
|
+
}
|
|
84
126
|
}
|
|
85
127
|
|
|
86
128
|
/**
|
|
@@ -105,6 +147,17 @@ export class DatabaseVersionManager<T> {
|
|
|
105
147
|
storedVersion = DatabaseVersion.empty();
|
|
106
148
|
// only turn off these logs if the data dir didn't exist before
|
|
107
149
|
shouldLogDataReset = false;
|
|
150
|
+
} else if (this.versionFileReadFailurePolicy === 'throw') {
|
|
151
|
+
// The version file exists but could not be read/parsed (permissions, IO error, truncation).
|
|
152
|
+
// Treating this as "unversioned" would reset the data directory, silently wiping a store that
|
|
153
|
+
// must fail closed. Refuse to open instead, leaving the data untouched for the operator.
|
|
154
|
+
const code = (err as Error & { code?: string })?.code;
|
|
155
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
156
|
+
throw new Error(
|
|
157
|
+
`Failed to read database version file at ${this.versionFile} (${code ?? 'unknown error'}: ${message}). ` +
|
|
158
|
+
`Refusing to open the database; data was NOT reset. Resolve the underlying filesystem error and retry.`,
|
|
159
|
+
{ cause: err },
|
|
160
|
+
);
|
|
108
161
|
} else {
|
|
109
162
|
this.log.warn(`Failed to read stored version information: ${err}. Defaulting to empty version`);
|
|
110
163
|
storedVersion = DatabaseVersion.empty();
|
|
@@ -159,10 +212,47 @@ export class DatabaseVersionManager<T> {
|
|
|
159
212
|
await this.resetDataDirectory();
|
|
160
213
|
}
|
|
161
214
|
|
|
162
|
-
//
|
|
163
|
-
|
|
215
|
+
// Open the database first, then record the version marker. Writing the marker only after a
|
|
216
|
+
// successful open makes it a post-commit record: if the process crashes between the reset and a
|
|
217
|
+
// durable open, no marker is left behind, so the next startup re-runs the reset instead of
|
|
218
|
+
// trusting a marker that sits over empty or partially-initialized data.
|
|
219
|
+
const instance = await this.onOpen(this.dataDirectory);
|
|
164
220
|
|
|
165
|
-
|
|
221
|
+
// Only (re)write the marker when it would actually change — first boot, reset, or upgrade. On a
|
|
222
|
+
// normal boot it already matches, so skipping avoids an unnecessary fsync (and the directory
|
|
223
|
+
// write permission the temp-file+rename needs) and, more importantly, any window where a
|
|
224
|
+
// marker-write failure would orphan the database we just opened.
|
|
225
|
+
if (!storedVersion.equals(this.currentVersion)) {
|
|
226
|
+
try {
|
|
227
|
+
await this.writeVersion();
|
|
228
|
+
} catch (err) {
|
|
229
|
+
// The database opened but recording the marker failed; close the freshly opened instance so
|
|
230
|
+
// we do not leak its file handles / locks before propagating the failure.
|
|
231
|
+
await this.closeQuietly(instance);
|
|
232
|
+
throw err;
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
return [instance, needsReset];
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* Best-effort close of a just-opened database instance, used to avoid leaking handles/locks when a
|
|
241
|
+
* post-open step fails. Swallows close errors so the original failure is the one that propagates.
|
|
242
|
+
*/
|
|
243
|
+
private async closeQuietly(instance: T): Promise<void> {
|
|
244
|
+
const closable = instance as
|
|
245
|
+
| { close?: () => Promise<void> | void; [Symbol.asyncDispose]?: () => Promise<void> }
|
|
246
|
+
| undefined;
|
|
247
|
+
const dispose = closable?.close ?? closable?.[Symbol.asyncDispose];
|
|
248
|
+
if (typeof dispose !== 'function') {
|
|
249
|
+
return;
|
|
250
|
+
}
|
|
251
|
+
try {
|
|
252
|
+
await dispose.call(closable);
|
|
253
|
+
} catch (err) {
|
|
254
|
+
this.log.warn(`Failed to close database after version-write failure: ${err}`);
|
|
255
|
+
}
|
|
166
256
|
}
|
|
167
257
|
|
|
168
258
|
/**
|
package/src/ha-signing/config.ts
CHANGED
|
@@ -25,8 +25,20 @@ export type BaseSignerConfig = {
|
|
|
25
25
|
nodeId: string;
|
|
26
26
|
/** How long to wait between polls when a duty is being signed (ms) */
|
|
27
27
|
pollingIntervalMs: number;
|
|
28
|
-
/**
|
|
29
|
-
|
|
28
|
+
/**
|
|
29
|
+
* How long (ms) to wait for a peer node's in-progress signing before giving up and treating the
|
|
30
|
+
* duty as already handled. This is the cross-node wait/poll timeout, distinct from
|
|
31
|
+
* signerCallTimeoutMs (the hard upper bound on this node's own signer call).
|
|
32
|
+
*/
|
|
33
|
+
peerSigningTimeoutMs: number;
|
|
34
|
+
/**
|
|
35
|
+
* Hard upper bound (ms) on a single signer call made by this node. If the (possibly remote)
|
|
36
|
+
* signer does not return within this time, the call is aborted, the duty lock is released, and
|
|
37
|
+
* signing fails so it can be safely retried. The effective value is clamped to
|
|
38
|
+
* maxStuckDutiesAgeMs / 2 at construction, so a slow signer's lock is always released before
|
|
39
|
+
* stuck-duty cleanup could reclaim it. Defaults to 30_000 when unset.
|
|
40
|
+
*/
|
|
41
|
+
signerCallTimeoutMs?: number;
|
|
30
42
|
/** Maximum age of a stuck duty in ms (defaults to 2x hardcoded Aztec slot duration if not set) */
|
|
31
43
|
maxStuckDutiesAgeMs?: number;
|
|
32
44
|
/** Optional: clean up old duties after this many hours (disabled if not set) */
|
|
@@ -44,11 +56,16 @@ export const baseSignerConfigMappings: ConfigMappingsType<BaseSignerConfig> = {
|
|
|
44
56
|
description: 'The number of ms to wait between polls when a duty is being signed',
|
|
45
57
|
...numberConfigHelper(100),
|
|
46
58
|
},
|
|
47
|
-
|
|
59
|
+
peerSigningTimeoutMs: {
|
|
48
60
|
env: 'VALIDATOR_HA_SIGNING_TIMEOUT_MS',
|
|
49
|
-
description:
|
|
61
|
+
description: "How long to wait for a peer node's in-progress signing before giving up",
|
|
50
62
|
...numberConfigHelper(3_000),
|
|
51
63
|
},
|
|
64
|
+
signerCallTimeoutMs: {
|
|
65
|
+
env: 'VALIDATOR_SIGNER_CALL_TIMEOUT_MS',
|
|
66
|
+
description: 'Hard upper bound in ms on a single signer call before it is aborted (default 30000)',
|
|
67
|
+
...numberConfigHelper(30_000),
|
|
68
|
+
},
|
|
52
69
|
maxStuckDutiesAgeMs: {
|
|
53
70
|
env: 'VALIDATOR_HA_MAX_STUCK_DUTIES_AGE_MS',
|
|
54
71
|
description: 'The maximum age of a stuck duty in ms (defaults to 2x Aztec slot duration)',
|
|
@@ -65,7 +82,8 @@ export const baseSignerConfigMappings: ConfigMappingsType<BaseSignerConfig> = {
|
|
|
65
82
|
export const BaseSignerConfigSchema = z.object({
|
|
66
83
|
nodeId: z.string(),
|
|
67
84
|
pollingIntervalMs: z.number().min(0),
|
|
68
|
-
|
|
85
|
+
peerSigningTimeoutMs: z.number().min(0),
|
|
86
|
+
signerCallTimeoutMs: z.number().min(0).optional(),
|
|
69
87
|
maxStuckDutiesAgeMs: z.number().min(0).optional(),
|
|
70
88
|
cleanupOldDutiesAfterHours: z.number().min(0).optional(),
|
|
71
89
|
...pickL1ContractAddressesSchema('rollupAddress'),
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
type ConfigMappingsType,
|
|
3
|
+
booleanConfigHelper,
|
|
4
|
+
getConfigFromMappings,
|
|
5
|
+
optionalNumberConfigHelper,
|
|
6
|
+
} from '@aztec/foundation/config';
|
|
2
7
|
import { zodFor } from '@aztec/foundation/schemas';
|
|
3
8
|
import { type DataStoreConfig, dataConfigMappings } from '@aztec/stdlib/kv-store';
|
|
4
9
|
|
|
@@ -17,6 +22,12 @@ export type LocalSignerConfig = BaseSignerConfig &
|
|
|
17
22
|
DataStoreConfig & {
|
|
18
23
|
/** Maximum size of the local signing-protection LMDB store in KB. Overwrites the general dataStoreMapSizeKb. */
|
|
19
24
|
signingProtectionMapSizeKb?: number;
|
|
25
|
+
/**
|
|
26
|
+
* Allow local signing protection to run against an ephemeral store when no data directory is set.
|
|
27
|
+
* Without this, a missing data directory fails startup, since ephemeral protection does not survive
|
|
28
|
+
* restarts. Intended for dev/test networks only; production validators must persist to disk.
|
|
29
|
+
*/
|
|
30
|
+
allowEphemeralSigningProtection?: boolean;
|
|
20
31
|
};
|
|
21
32
|
|
|
22
33
|
export const localSignerConfigMappings: ConfigMappingsType<LocalSignerConfig> = {
|
|
@@ -28,6 +39,13 @@ export const localSignerConfigMappings: ConfigMappingsType<LocalSignerConfig> =
|
|
|
28
39
|
'Maximum size of the local signing-protection LMDB store in KB. Overwrites the general dataStoreMapSizeKb.',
|
|
29
40
|
...optionalNumberConfigHelper(),
|
|
30
41
|
},
|
|
42
|
+
allowEphemeralSigningProtection: {
|
|
43
|
+
env: 'VALIDATOR_ALLOW_EPHEMERAL_SIGNING_PROTECTION',
|
|
44
|
+
description:
|
|
45
|
+
'Allow local signing protection to run against an ephemeral store when no data directory is set (dev/test only). ' +
|
|
46
|
+
'Ephemeral protection does not survive restarts, so this is unsafe for production validators.',
|
|
47
|
+
...booleanConfigHelper(false),
|
|
48
|
+
},
|
|
31
49
|
};
|
|
32
50
|
|
|
33
51
|
export const LocalSignerConfigSchema = zodFor<LocalSignerConfig>()(
|
|
@@ -35,6 +53,7 @@ export const LocalSignerConfigSchema = zodFor<LocalSignerConfig>()(
|
|
|
35
53
|
dataDirectory: z.string().optional(),
|
|
36
54
|
dataStoreMapSizeKb: z.number(),
|
|
37
55
|
signingProtectionMapSizeKb: z.number().optional(),
|
|
56
|
+
allowEphemeralSigningProtection: z.boolean().optional(),
|
|
38
57
|
}),
|
|
39
58
|
);
|
|
40
59
|
|
package/src/hash/hash.ts
CHANGED
|
@@ -188,14 +188,6 @@ export function computeSecretHash(secret: Fr): Promise<Fr> {
|
|
|
188
188
|
return poseidon2HashWithSeparator([secret], DomainSeparator.SECRET_HASH);
|
|
189
189
|
}
|
|
190
190
|
|
|
191
|
-
export async function computeL1ToL2MessageNullifier(contract: AztecAddress, messageHash: Fr, secret: Fr) {
|
|
192
|
-
const innerMessageNullifier = await poseidon2HashWithSeparator(
|
|
193
|
-
[messageHash, secret],
|
|
194
|
-
DomainSeparator.MESSAGE_NULLIFIER,
|
|
195
|
-
);
|
|
196
|
-
return siloNullifier(contract, innerMessageNullifier);
|
|
197
|
-
}
|
|
198
|
-
|
|
199
191
|
/**
|
|
200
192
|
* Calculates a siloed hash of a scoped l2 to l1 message.
|
|
201
193
|
* @returns Fr containing 248 bits of information of sha256 hash.
|
|
@@ -68,6 +68,13 @@ export type ArchiverSpecificConfig = {
|
|
|
68
68
|
|
|
69
69
|
/** Skip pruning orphan proposed blocks that have no matching proposed checkpoint. */
|
|
70
70
|
skipOrphanProposedBlockPruning?: boolean;
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Preload the standard contracts (AuthRegistry, PublicChecks, HandshakeRegistry) into the contract store at block 0.
|
|
74
|
+
* For test environments only: it must only be set when genesis also seeds the matching registration/deployment
|
|
75
|
+
* nullifiers, otherwise a later on-chain publish of a preloaded class would collide with the block-0 preload.
|
|
76
|
+
*/
|
|
77
|
+
testPreloadStandardContracts?: boolean;
|
|
71
78
|
};
|
|
72
79
|
|
|
73
80
|
export const ArchiverSpecificConfigSchema = z.object({
|
|
@@ -82,6 +89,7 @@ export const ArchiverSpecificConfigSchema = z.object({
|
|
|
82
89
|
skipPromoteProposedCheckpointDuringL1Sync: z.boolean().optional(),
|
|
83
90
|
orphanPruneNoProposalTolerance: schemas.Integer.optional(),
|
|
84
91
|
skipOrphanProposedBlockPruning: z.boolean().optional(),
|
|
92
|
+
testPreloadStandardContracts: z.boolean().optional(),
|
|
85
93
|
});
|
|
86
94
|
|
|
87
95
|
export type ArchiverApi = Omit<
|
|
@@ -96,6 +96,8 @@ export interface SequencerConfig {
|
|
|
96
96
|
injectHighSValueAttestation?: boolean;
|
|
97
97
|
/** Inject an attestation with an unrecoverable signature (for testing only) */
|
|
98
98
|
injectUnrecoverableSignatureAttestation?: boolean;
|
|
99
|
+
/** Inject a non-proposer attestation slot in yParity (v ∈ {0, 1}) form in the packed L1 tuple (for testing only) */
|
|
100
|
+
injectYParityAttestation?: boolean;
|
|
99
101
|
/** Whether to run in fisherman mode: builds blocks on every slot for validation without publishing */
|
|
100
102
|
fishermanMode?: boolean;
|
|
101
103
|
/** Shuffle attestation ordering to create invalid ordering (for testing only) */
|
|
@@ -165,6 +167,7 @@ export const SequencerConfigSchema = zodFor<SequencerConfig>()(
|
|
|
165
167
|
injectFakeAttestation: z.boolean().optional(),
|
|
166
168
|
injectHighSValueAttestation: z.boolean().optional(),
|
|
167
169
|
injectUnrecoverableSignatureAttestation: z.boolean().optional(),
|
|
170
|
+
injectYParityAttestation: z.boolean().optional(),
|
|
168
171
|
fishermanMode: z.boolean().optional(),
|
|
169
172
|
shuffleAttestationOrdering: z.boolean().optional(),
|
|
170
173
|
blockDurationMs: z.number().positive().optional(),
|
|
@@ -10,8 +10,8 @@ import type {
|
|
|
10
10
|
PrivateKernelInner3CircuitPrivateInputs,
|
|
11
11
|
PrivateKernelInnerCircuitPrivateInputs,
|
|
12
12
|
PrivateKernelResetCircuitPrivateInputs,
|
|
13
|
+
PrivateKernelResetTailCircuitPrivateInputs,
|
|
13
14
|
PrivateKernelSimulateOutput,
|
|
14
|
-
PrivateKernelTailCircuitPrivateInputs,
|
|
15
15
|
PrivateKernelTailCircuitPublicInputs,
|
|
16
16
|
} from '../kernel/index.js';
|
|
17
17
|
import type { ChonkProofWithPublicInputs } from '../proofs/chonk_proof.js';
|
|
@@ -166,23 +166,21 @@ export interface PrivateKernelProver {
|
|
|
166
166
|
): Promise<PrivateKernelSimulateOutput<PrivateKernelCircuitPublicInputs>>;
|
|
167
167
|
|
|
168
168
|
/**
|
|
169
|
-
* Creates a proof output
|
|
169
|
+
* Creates a proof output for the terminal reset+tail step. Dispatches to the rollup-bound or
|
|
170
|
+
* public-bound family based on `inputs.isForPublic()`.
|
|
170
171
|
*
|
|
171
|
-
* @param
|
|
172
|
-
* @returns A Promise resolving to a ProofOutput
|
|
172
|
+
* @param privateKernelInputs - Reset hints, dimensions, and tail params.
|
|
173
|
+
* @returns A Promise resolving to a ProofOutput containing the tail-shaped public inputs.
|
|
173
174
|
*/
|
|
174
|
-
|
|
175
|
-
|
|
175
|
+
generateResetTailOutput(
|
|
176
|
+
privateKernelInputs: PrivateKernelResetTailCircuitPrivateInputs,
|
|
176
177
|
): Promise<PrivateKernelSimulateOutput<PrivateKernelTailCircuitPublicInputs>>;
|
|
177
178
|
|
|
178
179
|
/**
|
|
179
|
-
*
|
|
180
|
-
*
|
|
181
|
-
* @param privateKernelInputsTail - The private input data structure for the final ordering iteration.
|
|
182
|
-
* @returns A Promise resolving to a ProofOutput object containing public inputs an empty kernel proof.
|
|
180
|
+
* Simulates the terminal reset+tail step without generating a proof.
|
|
183
181
|
*/
|
|
184
|
-
|
|
185
|
-
|
|
182
|
+
simulateResetTail(
|
|
183
|
+
privateKernelInputs: PrivateKernelResetTailCircuitPrivateInputs,
|
|
186
184
|
): Promise<PrivateKernelSimulateOutput<PrivateKernelTailCircuitPublicInputs>>;
|
|
187
185
|
|
|
188
186
|
generateHidingToRollupOutput(
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
2
|
+
AVM_V2_PROOF_LENGTH_IN_FIELDS,
|
|
3
3
|
NESTED_RECURSIVE_PROOF_LENGTH,
|
|
4
4
|
NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH,
|
|
5
5
|
RECURSIVE_PROOF_LENGTH,
|
|
@@ -204,7 +204,7 @@ export type ProvingJobInputsMap = {
|
|
|
204
204
|
export const ProvingJobResult = z.discriminatedUnion('type', [
|
|
205
205
|
z.object({
|
|
206
206
|
type: z.literal(ProvingRequestType.PUBLIC_VM),
|
|
207
|
-
result: RecursiveProof.schemaFor(
|
|
207
|
+
result: RecursiveProof.schemaFor(AVM_V2_PROOF_LENGTH_IN_FIELDS),
|
|
208
208
|
}),
|
|
209
209
|
z.object({
|
|
210
210
|
type: z.literal(ProvingRequestType.PUBLIC_CHONK_VERIFIER),
|
|
@@ -319,7 +319,7 @@ export const ProvingJobResult = z.discriminatedUnion('type', [
|
|
|
319
319
|
]);
|
|
320
320
|
export type ProvingJobResult = z.infer<typeof ProvingJobResult>;
|
|
321
321
|
export type ProvingJobResultsMap = {
|
|
322
|
-
[ProvingRequestType.PUBLIC_VM]: RecursiveProof<typeof
|
|
322
|
+
[ProvingRequestType.PUBLIC_VM]: RecursiveProof<typeof AVM_V2_PROOF_LENGTH_IN_FIELDS>;
|
|
323
323
|
[ProvingRequestType.PUBLIC_CHONK_VERIFIER]: PublicInputsAndRecursiveProof<
|
|
324
324
|
PublicChonkVerifierPublicInputs,
|
|
325
325
|
typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH
|
|
@@ -441,9 +441,20 @@ export const ProvingJobRejectedResult = z.object({
|
|
|
441
441
|
});
|
|
442
442
|
export type ProvingJobRejectedResult = z.infer<typeof ProvingJobRejectedResult>;
|
|
443
443
|
|
|
444
|
+
/**
|
|
445
|
+
* The result of a job that was cancelled by its producer. Unlike a fulfilled or rejected result it
|
|
446
|
+
* is not truly terminal: re-enqueuing the same job id revives it, so an abort never permanently
|
|
447
|
+
* blocks a proof from being produced.
|
|
448
|
+
*/
|
|
449
|
+
export const ProvingJobAbortedResult = z.object({
|
|
450
|
+
status: z.literal('aborted'),
|
|
451
|
+
});
|
|
452
|
+
export type ProvingJobAbortedResult = z.infer<typeof ProvingJobAbortedResult>;
|
|
453
|
+
|
|
444
454
|
export const ProvingJobSettledResult = z.discriminatedUnion('status', [
|
|
445
455
|
ProvingJobFulfilledResult,
|
|
446
456
|
ProvingJobRejectedResult,
|
|
457
|
+
ProvingJobAbortedResult,
|
|
447
458
|
]);
|
|
448
459
|
export type ProvingJobSettledResult = z.infer<typeof ProvingJobSettledResult>;
|
|
449
460
|
|
|
@@ -453,5 +464,6 @@ export const ProvingJobStatus = z.discriminatedUnion('status', [
|
|
|
453
464
|
z.object({ status: z.literal('not-found') }),
|
|
454
465
|
ProvingJobFulfilledResult,
|
|
455
466
|
ProvingJobRejectedResult,
|
|
467
|
+
ProvingJobAbortedResult,
|
|
456
468
|
]);
|
|
457
469
|
export type ProvingJobStatus = z.infer<typeof ProvingJobStatus>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type {
|
|
2
|
-
|
|
2
|
+
AVM_V2_PROOF_LENGTH_IN_FIELDS,
|
|
3
3
|
NESTED_RECURSIVE_PROOF_LENGTH,
|
|
4
4
|
NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH,
|
|
5
5
|
RECURSIVE_PROOF_LENGTH,
|
|
@@ -189,7 +189,7 @@ export interface ServerCircuitProver {
|
|
|
189
189
|
inputs: AvmCircuitInputs,
|
|
190
190
|
signal?: AbortSignal,
|
|
191
191
|
epochNumber?: number,
|
|
192
|
-
): Promise<RecursiveProof<typeof
|
|
192
|
+
): Promise<RecursiveProof<typeof AVM_V2_PROOF_LENGTH_IN_FIELDS>>;
|
|
193
193
|
}
|
|
194
194
|
|
|
195
195
|
export type IVCProofVerificationResult = {
|
|
@@ -65,6 +65,20 @@ export interface ReadonlyWorldStateAccess {
|
|
|
65
65
|
|
|
66
66
|
/** Defines the interface for a world state synchronizer. */
|
|
67
67
|
export interface WorldStateSynchronizer extends ReadonlyWorldStateAccess, ForkMerkleTreeOperations {
|
|
68
|
+
/**
|
|
69
|
+
* Returns a read handle to the world state at `blockNumber`, but only after verifying that the block at that
|
|
70
|
+
* height is on the fork identified by `blockHash`. This pins the returned view to a specific fork so a reorg
|
|
71
|
+
* that replaced the block at `blockNumber` cannot be served silently, closing the gap between resolving a query
|
|
72
|
+
* and reading its snapshot.
|
|
73
|
+
*
|
|
74
|
+
* Rejects if the block at `blockNumber` does not match `blockHash` (a reorg), or if the block's hash cannot be
|
|
75
|
+
* read from the requested view. Both are transient from a caller's perspective: re-resolving the query against
|
|
76
|
+
* the current chain and retrying may succeed or produce a more precise error. However, if the block's history
|
|
77
|
+
* has been pruned away (it predates the oldest historical block kept by world state), the rejection is terminal:
|
|
78
|
+
* retrying cannot bring the data back.
|
|
79
|
+
*/
|
|
80
|
+
getVerifiedSnapshot(blockNumber: BlockNumber, blockHash: BlockHash): Promise<MerkleTreeReadOperations>;
|
|
81
|
+
|
|
68
82
|
/** Starts the synchronizer. */
|
|
69
83
|
start(): Promise<void | PromiseWithResolvers<void>>;
|
|
70
84
|
|