@aztec/stdlib 3.0.0-rc.5 → 4.0.0-nightly.20260107
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 +602 -4
- package/dest/abi/abi.d.ts.map +1 -1
- package/dest/abi/abi.js +7 -7
- package/dest/abi/function_selector.d.ts +2 -1
- package/dest/abi/function_selector.d.ts.map +1 -1
- package/dest/abi/function_selector.js +7 -0
- package/dest/abi/selector.js +3 -1
- package/dest/avm/avm.js +1 -1
- package/dest/avm/avm_accumulated_data.js +5 -2
- package/dest/avm/avm_circuit_public_inputs.js +3 -1
- package/dest/avm/public_data_update_request.js +3 -1
- package/dest/avm/public_inner_call_request.js +3 -1
- package/dest/avm/revert_code.js +3 -1
- package/dest/aztec-address/index.js +4 -2
- package/dest/block/body.js +3 -1
- package/dest/block/checkpointed_l2_block.d.ts +267 -0
- package/dest/block/checkpointed_l2_block.d.ts.map +1 -0
- package/dest/block/{published_l2_block.js → checkpointed_l2_block.js} +40 -4
- 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_header.js +3 -1
- package/dest/block/l2_block_new.d.ts +8 -3
- package/dest/block/l2_block_new.d.ts.map +1 -1
- package/dest/block/l2_block_new.js +10 -9
- package/dest/block/l2_block_source.d.ts +69 -45
- package/dest/block/l2_block_source.d.ts.map +1 -1
- package/dest/block/l2_block_stream/interfaces.d.ts +2 -2
- package/dest/block/l2_block_stream/interfaces.d.ts.map +1 -1
- package/dest/block/l2_block_stream/l2_block_stream.d.ts +6 -1
- package/dest/block/l2_block_stream/l2_block_stream.d.ts.map +1 -1
- package/dest/block/l2_block_stream/l2_block_stream.js +9 -1
- 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 +2 -5
- package/dest/checkpoint/checkpoint.d.ts +17 -2
- package/dest/checkpoint/checkpoint.d.ts.map +1 -1
- package/dest/checkpoint/checkpoint.js +42 -4
- package/dest/checkpoint/checkpoint_info.d.ts +9 -0
- package/dest/checkpoint/checkpoint_info.d.ts.map +1 -0
- package/dest/checkpoint/checkpoint_info.js +1 -0
- package/dest/checkpoint/published_checkpoint.d.ts +14 -8
- package/dest/checkpoint/published_checkpoint.d.ts.map +1 -1
- package/dest/checkpoint/published_checkpoint.js +11 -1
- package/dest/contract/contract_class_id.js +1 -1
- package/dest/contract/interfaces/contract_class.d.ts +11 -13
- package/dest/contract/interfaces/contract_class.d.ts.map +1 -1
- package/dest/contract/interfaces/contract_class.js +18 -18
- package/dest/contract/interfaces/contract_instance.d.ts +12 -13
- package/dest/contract/interfaces/contract_instance.d.ts.map +1 -1
- package/dest/contract/interfaces/contract_instance.js +5 -5
- package/dest/contract/interfaces/contract_instance_update.d.ts +6 -7
- package/dest/contract/interfaces/contract_instance_update.d.ts.map +1 -1
- package/dest/contract/interfaces/contract_instance_update.js +5 -5
- package/dest/database-version/version_manager.js +3 -1
- package/dest/epoch-helpers/index.d.ts +1 -1
- package/dest/epoch-helpers/index.d.ts.map +1 -1
- package/dest/epoch-helpers/index.js +3 -3
- package/dest/gas/gas.js +3 -1
- package/dest/gas/gas_fees.js +3 -1
- package/dest/hash/hash.d.ts +1 -9
- package/dest/hash/hash.d.ts.map +1 -1
- package/dest/hash/hash.js +0 -12
- package/dest/interfaces/allowed_element.d.ts +7 -8
- package/dest/interfaces/allowed_element.d.ts.map +1 -1
- package/dest/interfaces/allowed_element.js +3 -3
- package/dest/interfaces/archiver.d.ts +1 -1
- package/dest/interfaces/archiver.d.ts.map +1 -1
- package/dest/interfaces/archiver.js +8 -3
- package/dest/interfaces/aztec-node-admin.d.ts +29 -11
- package/dest/interfaces/aztec-node-admin.d.ts.map +1 -1
- package/dest/interfaces/aztec-node-admin.js +1 -1
- package/dest/interfaces/aztec-node.d.ts +10 -10
- package/dest/interfaces/aztec-node.d.ts.map +1 -1
- package/dest/interfaces/aztec-node.js +4 -4
- package/dest/interfaces/block-builder.d.ts +3 -2
- package/dest/interfaces/block-builder.d.ts.map +1 -1
- package/dest/interfaces/block-builder.js +9 -1
- package/dest/interfaces/configs.d.ts +47 -23
- package/dest/interfaces/configs.d.ts.map +1 -1
- package/dest/interfaces/configs.js +11 -6
- package/dest/interfaces/get_logs_response.d.ts +19 -4
- package/dest/interfaces/get_logs_response.d.ts.map +1 -1
- package/dest/interfaces/get_logs_response.js +5 -4
- package/dest/interfaces/l2_logs_source.d.ts +12 -8
- package/dest/interfaces/l2_logs_source.d.ts.map +1 -1
- package/dest/interfaces/merkle_tree_operations.d.ts +2 -2
- package/dest/interfaces/merkle_tree_operations.d.ts.map +1 -1
- package/dest/interfaces/prover-client.d.ts +5 -3
- package/dest/interfaces/prover-client.d.ts.map +1 -1
- package/dest/interfaces/prover-client.js +5 -4
- package/dest/interfaces/proving-job.d.ts +168 -168
- package/dest/interfaces/server_circuit_prover.d.ts +2 -2
- package/dest/interfaces/server_circuit_prover.d.ts.map +1 -1
- package/dest/interfaces/slasher.d.ts +1 -1
- package/dest/interfaces/slasher.d.ts.map +1 -1
- package/dest/interfaces/slasher.js +3 -3
- package/dest/interfaces/validator.d.ts +7 -8
- package/dest/interfaces/validator.d.ts.map +1 -1
- package/dest/interfaces/validator.js +5 -5
- package/dest/interfaces/world_state.d.ts +17 -8
- package/dest/interfaces/world_state.d.ts.map +1 -1
- package/dest/kernel/claimed_length_array.js +3 -1
- package/dest/kernel/hints/find_private_kernel_reset_dimensions.d.ts +1 -1
- package/dest/kernel/hints/find_private_kernel_reset_dimensions.d.ts.map +1 -1
- package/dest/kernel/hints/find_private_kernel_reset_dimensions.js +1 -3
- package/dest/kernel/hints/transient_data_squashing_hint.js +3 -1
- package/dest/kernel/log_hash.js +3 -1
- package/dest/kernel/private_circuit_public_inputs.d.ts +47 -47
- package/dest/kernel/private_circuit_public_inputs.d.ts.map +1 -1
- package/dest/kernel/private_circuit_public_inputs.js +59 -59
- package/dest/kernel/private_log_data.js +5 -2
- package/dest/kernel/private_to_avm_accumulated_data.js +5 -2
- package/dest/kernel/private_to_public_accumulated_data.js +3 -1
- package/dest/kernel/private_to_rollup_accumulated_data.js +3 -1
- package/dest/kernel/private_validation_requests.js +3 -1
- package/dest/kernel/public_call_request.js +5 -2
- package/dest/logs/contract_class_log.js +3 -1
- package/dest/logs/extended_public_log.d.ts +7 -1
- package/dest/logs/extended_public_log.d.ts.map +1 -1
- package/dest/logs/index.d.ts +3 -2
- package/dest/logs/index.d.ts.map +1 -1
- package/dest/logs/index.js +2 -1
- package/dest/logs/log_id.d.ts +9 -1
- package/dest/logs/log_id.d.ts.map +1 -1
- package/dest/logs/log_id.js +15 -8
- package/dest/logs/private_log.d.ts +1 -1
- package/dest/logs/private_log.d.ts.map +1 -1
- package/dest/logs/private_log.js +5 -2
- package/dest/logs/public_log.js +3 -1
- package/dest/logs/siloed_tag.d.ts +23 -0
- package/dest/logs/siloed_tag.d.ts.map +1 -0
- package/dest/logs/siloed_tag.js +30 -0
- package/dest/logs/tag.d.ts +21 -0
- package/dest/logs/tag.d.ts.map +1 -0
- package/dest/logs/tag.js +30 -0
- package/dest/logs/tx_scoped_l2_log.d.ts +24 -33
- package/dest/logs/tx_scoped_l2_log.d.ts.map +1 -1
- package/dest/logs/tx_scoped_l2_log.js +37 -43
- package/dest/messaging/l1_to_l2_message.d.ts +1 -1
- package/dest/messaging/l1_to_l2_message.d.ts.map +1 -1
- package/dest/rollup/avm_proof_data.d.ts +1 -3
- package/dest/rollup/avm_proof_data.d.ts.map +1 -1
- package/dest/rollup/avm_proof_data.js +1 -9
- package/dest/rollup/block_rollup_public_inputs.d.ts +4 -9
- package/dest/rollup/block_rollup_public_inputs.d.ts.map +1 -1
- package/dest/rollup/block_rollup_public_inputs.js +6 -10
- package/dest/rollup/checkpoint_constant_data.d.ts +2 -1
- package/dest/rollup/checkpoint_constant_data.d.ts.map +1 -1
- package/dest/rollup/checkpoint_constant_data.js +4 -1
- package/dest/rollup/checkpoint_header.d.ts +5 -1
- package/dest/rollup/checkpoint_header.d.ts.map +1 -1
- package/dest/rollup/checkpoint_header.js +7 -2
- package/dest/schemas/schemas.d.ts +4 -2
- package/dest/schemas/schemas.d.ts.map +1 -1
- package/dest/schemas/schemas.js +2 -1
- package/dest/slashing/types.d.ts +4 -5
- package/dest/slashing/types.d.ts.map +1 -1
- package/dest/slashing/types.js +5 -5
- package/dest/snapshots/types.d.ts +1 -1
- package/dest/snapshots/types.d.ts.map +1 -1
- package/dest/snapshots/types.js +5 -5
- package/dest/stats/stats.d.ts +10 -6
- package/dest/stats/stats.d.ts.map +1 -1
- package/dest/tests/factories.d.ts +24 -1
- package/dest/tests/factories.d.ts.map +1 -1
- package/dest/tests/factories.js +21 -1
- package/dest/tests/mocks.d.ts +5 -4
- package/dest/tests/mocks.d.ts.map +1 -1
- package/dest/tests/mocks.js +18 -5
- package/dest/trees/append_only_tree_snapshot.js +3 -1
- package/dest/tx/block_header.d.ts +8 -7
- package/dest/tx/block_header.d.ts.map +1 -1
- package/dest/tx/block_header.js +8 -2
- package/dest/tx/call_context.js +3 -1
- package/dest/tx/global_variable_builder.d.ts +4 -2
- package/dest/tx/global_variable_builder.d.ts.map +1 -1
- package/dest/tx/global_variables.d.ts +6 -1
- package/dest/tx/global_variables.d.ts.map +1 -1
- package/dest/tx/global_variables.js +3 -1
- package/dest/tx/private_execution_result.d.ts +1 -1
- package/dest/tx/private_execution_result.js +1 -1
- package/dest/tx/public_call_request_with_calldata.js +3 -1
- package/dest/tx/simulated_tx.d.ts +1031 -7
- package/dest/tx/simulated_tx.d.ts.map +1 -1
- package/dest/tx/state_reference.js +3 -1
- package/dest/tx/tree_snapshots.js +3 -1
- package/dest/tx/tx.d.ts +10 -3
- package/dest/tx/tx.d.ts.map +1 -1
- package/dest/tx/tx.js +9 -2
- package/dest/tx/tx_effect.d.ts +1 -1
- package/dest/tx/tx_effect.d.ts.map +1 -1
- package/dest/tx/tx_effect.js +6 -2
- package/dest/tx/tx_execution_request.js +3 -1
- package/dest/tx/validator/tx_validator.d.ts +1 -4
- package/dest/tx/validator/tx_validator.d.ts.map +1 -1
- package/dest/tx/validator/tx_validator.js +4 -4
- package/dest/validators/schemas.d.ts +1 -1
- package/dest/validators/schemas.d.ts.map +1 -1
- package/dest/validators/schemas.js +13 -13
- package/package.json +8 -8
- package/src/abi/abi.ts +39 -33
- package/src/abi/function_selector.ts +8 -0
- package/src/avm/avm.ts +1 -1
- package/src/block/{published_l2_block.ts → checkpointed_l2_block.ts} +58 -3
- package/src/block/index.ts +1 -1
- package/src/block/l2_block_new.ts +17 -7
- package/src/block/l2_block_source.ts +78 -50
- package/src/block/l2_block_stream/interfaces.ts +1 -1
- package/src/block/l2_block_stream/l2_block_stream.ts +9 -0
- package/src/block/test/l2_tips_store_test_suite.ts +2 -1
- package/src/checkpoint/checkpoint.ts +51 -4
- package/src/checkpoint/checkpoint_info.ts +9 -0
- package/src/checkpoint/published_checkpoint.ts +19 -5
- package/src/contract/contract_class_id.ts +1 -1
- package/src/contract/interfaces/contract_class.ts +59 -46
- package/src/contract/interfaces/contract_instance.ts +15 -13
- package/src/contract/interfaces/contract_instance_update.ts +11 -9
- package/src/epoch-helpers/index.ts +11 -9
- package/src/hash/hash.ts +0 -11
- package/src/interfaces/allowed_element.ts +9 -7
- package/src/interfaces/archiver.ts +12 -4
- package/src/interfaces/aztec-node-admin.ts +2 -2
- package/src/interfaces/aztec-node.ts +18 -15
- package/src/interfaces/block-builder.ts +11 -1
- package/src/interfaces/configs.ts +64 -33
- package/src/interfaces/get_logs_response.ts +13 -9
- package/src/interfaces/l2_logs_source.ts +12 -7
- package/src/interfaces/merkle_tree_operations.ts +4 -1
- package/src/interfaces/prover-client.ts +13 -10
- package/src/interfaces/server_circuit_prover.ts +0 -1
- package/src/interfaces/slasher.ts +24 -22
- package/src/interfaces/validator.ts +22 -18
- package/src/interfaces/world_state.ts +16 -9
- package/src/kernel/hints/find_private_kernel_reset_dimensions.ts +2 -4
- package/src/kernel/private_circuit_public_inputs.ts +85 -85
- package/src/logs/index.ts +2 -1
- package/src/logs/log_id.ts +16 -6
- package/src/logs/private_log.ts +2 -1
- package/src/logs/siloed_tag.ts +44 -0
- package/src/logs/tag.ts +42 -0
- package/src/logs/tx_scoped_l2_log.ts +45 -43
- package/src/messaging/l1_to_l2_message.ts +1 -0
- package/src/rollup/avm_proof_data.ts +0 -7
- package/src/rollup/block_rollup_public_inputs.ts +3 -9
- package/src/rollup/checkpoint_constant_data.ts +1 -0
- package/src/rollup/checkpoint_header.ts +4 -0
- package/src/schemas/schemas.ts +4 -0
- package/src/slashing/types.ts +24 -20
- package/src/snapshots/types.ts +33 -29
- package/src/stats/stats.ts +10 -5
- package/src/tests/factories.ts +45 -1
- package/src/tests/mocks.ts +15 -3
- package/src/tx/block_header.ts +12 -7
- package/src/tx/global_variable_builder.ts +8 -1
- package/src/tx/global_variables.ts +6 -0
- package/src/tx/private_execution_result.ts +1 -1
- package/src/tx/tx.ts +9 -2
- package/src/tx/tx_effect.ts +3 -1
- package/src/tx/validator/tx_validator.ts +8 -6
- package/src/validators/schemas.ts +54 -48
- package/dest/block/published_l2_block.d.ts +0 -130
- package/dest/block/published_l2_block.d.ts.map +0 -1
- package/dest/logs/log_with_tx_data.d.ts +0 -19
- package/dest/logs/log_with_tx_data.d.ts.map +0 -1
- package/dest/logs/log_with_tx_data.js +0 -49
- package/src/logs/log_with_tx_data.ts +0 -46
package/src/tx/tx.ts
CHANGED
|
@@ -30,7 +30,11 @@ export class Tx extends Gossipable {
|
|
|
30
30
|
private calldataMap: Map<string, Fr[]> | undefined;
|
|
31
31
|
|
|
32
32
|
constructor(
|
|
33
|
-
/**
|
|
33
|
+
/**
|
|
34
|
+
* Identifier of the tx.
|
|
35
|
+
* It's a hash of the public inputs of the tx's proof.
|
|
36
|
+
* This claimed hash is reconciled against the tx's public inputs (`this.data`) in data_validator.ts.
|
|
37
|
+
*/
|
|
34
38
|
public readonly txHash: TxHash,
|
|
35
39
|
/**
|
|
36
40
|
* Output of the private kernel circuit for this tx.
|
|
@@ -43,11 +47,14 @@ export class Tx extends Gossipable {
|
|
|
43
47
|
/**
|
|
44
48
|
* Contract class log fields emitted from the tx.
|
|
45
49
|
* Their order should match the order of the log hashes returned from `this.data.getNonEmptyContractClassLogsHashes`.
|
|
46
|
-
*
|
|
50
|
+
* This claimed data is reconciled against a hash of this data (that is contained within
|
|
51
|
+
* the tx's public inputs (`this.data`)), in data_validator.ts.
|
|
47
52
|
*/
|
|
48
53
|
public readonly contractClassLogFields: ContractClassLogFields[],
|
|
49
54
|
/**
|
|
50
55
|
* An array of calldata for the enqueued public function calls and the teardown function call.
|
|
56
|
+
* This claimed data is reconciled against hashes of this data (that are contained within
|
|
57
|
+
* the tx's public inputs (`this.data`)), in data_validator.ts.
|
|
51
58
|
*/
|
|
52
59
|
public readonly publicFunctionCalldata: HashedValues[],
|
|
53
60
|
) {
|
package/src/tx/tx_effect.ts
CHANGED
|
@@ -214,12 +214,14 @@ export class TxEffect {
|
|
|
214
214
|
maxEffects?: number;
|
|
215
215
|
} = {}): Promise<TxEffect> {
|
|
216
216
|
const count = (max: number, num?: number) => num ?? Math.min(maxEffects ?? randomInt(max), max);
|
|
217
|
+
// Every tx effect must have at least 1 nullifier (the first nullifier is used for log indexing)
|
|
218
|
+
const countNullifiers = (max: number, num?: number) => Math.max(1, count(max, num));
|
|
217
219
|
return new TxEffect(
|
|
218
220
|
RevertCode.random(),
|
|
219
221
|
TxHash.random(),
|
|
220
222
|
new Fr(Math.floor(Math.random() * 100_000)),
|
|
221
223
|
makeTuple(count(MAX_NOTE_HASHES_PER_TX, numNoteHashes), Fr.random),
|
|
222
|
-
makeTuple(
|
|
224
|
+
makeTuple(countNullifiers(MAX_NULLIFIERS_PER_TX, numNullifiers), Fr.random),
|
|
223
225
|
makeTuple(count(MAX_L2_TO_L1_MSGS_PER_TX, numL2ToL1Msgs), Fr.random),
|
|
224
226
|
makeTuple(count(MAX_TOTAL_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX, numPublicDataWrites), PublicDataWrite.random),
|
|
225
227
|
makeTuple(count(MAX_PRIVATE_LOGS_PER_TX, numPrivateLogs), () => PrivateLog.random()),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import { zodFor } from '../../schemas/schemas.js';
|
|
4
4
|
import type { ProcessedTx } from '../processed_tx.js';
|
|
5
5
|
import type { Tx } from '../tx.js';
|
|
6
6
|
import type { TxHash } from '../tx_hash.js';
|
|
@@ -24,8 +24,10 @@ export interface TxValidator<T extends AnyTx = AnyTx> {
|
|
|
24
24
|
validateTx(tx: T): Promise<TxValidationResult>;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
export const TxValidationResultSchema =
|
|
28
|
-
z.
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
export const TxValidationResultSchema = zodFor<TxValidationResult>()(
|
|
28
|
+
z.discriminatedUnion('result', [
|
|
29
|
+
z.object({ result: z.literal('valid') }),
|
|
30
|
+
z.object({ result: z.literal('invalid'), reason: z.array(z.string()) }),
|
|
31
|
+
z.object({ result: z.literal('skipped'), reason: z.array(z.string()) }),
|
|
32
|
+
]),
|
|
33
|
+
);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { schemas, zodFor } from '@aztec/foundation/schemas';
|
|
2
2
|
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
|
|
@@ -11,20 +11,18 @@ import type {
|
|
|
11
11
|
ValidatorsStats,
|
|
12
12
|
} from './types.js';
|
|
13
13
|
|
|
14
|
-
export const ValidatorStatusInSlotSchema =
|
|
15
|
-
'block-mined',
|
|
16
|
-
|
|
17
|
-
'block-missed',
|
|
18
|
-
'attestation-sent',
|
|
19
|
-
'attestation-missed',
|
|
20
|
-
]) satisfies ZodFor<ValidatorStatusInSlot>;
|
|
14
|
+
export const ValidatorStatusInSlotSchema = zodFor<ValidatorStatusInSlot>()(
|
|
15
|
+
z.enum(['block-mined', 'block-proposed', 'block-missed', 'attestation-sent', 'attestation-missed']),
|
|
16
|
+
);
|
|
21
17
|
|
|
22
|
-
export const ValidatorStatusHistorySchema =
|
|
23
|
-
z.
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
)
|
|
18
|
+
export const ValidatorStatusHistorySchema = zodFor<ValidatorStatusHistory>()(
|
|
19
|
+
z.array(
|
|
20
|
+
z.object({
|
|
21
|
+
slot: schemas.SlotNumber,
|
|
22
|
+
status: ValidatorStatusInSlotSchema,
|
|
23
|
+
}),
|
|
24
|
+
),
|
|
25
|
+
);
|
|
28
26
|
|
|
29
27
|
export const ValidatorStatusHistorySchemaArray = z.array(ValidatorStatusHistorySchema);
|
|
30
28
|
|
|
@@ -36,40 +34,48 @@ const ValidatorTimeStatSchema = z.object({
|
|
|
36
34
|
date: z.string(),
|
|
37
35
|
});
|
|
38
36
|
|
|
39
|
-
const ValidatorMissedStatsSchema =
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
37
|
+
const ValidatorMissedStatsSchema = zodFor<ValidatorMissedStats>()(
|
|
38
|
+
z.object({
|
|
39
|
+
currentStreak: schemas.Integer,
|
|
40
|
+
rate: z.number().optional(),
|
|
41
|
+
count: schemas.Integer,
|
|
42
|
+
total: schemas.Integer,
|
|
43
|
+
}),
|
|
44
|
+
);
|
|
45
45
|
|
|
46
|
-
export const ValidatorStatsSchema =
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
46
|
+
export const ValidatorStatsSchema = zodFor<ValidatorStats>()(
|
|
47
|
+
z.object({
|
|
48
|
+
address: schemas.EthAddress,
|
|
49
|
+
lastProposal: ValidatorTimeStatSchema.optional(),
|
|
50
|
+
lastAttestation: ValidatorTimeStatSchema.optional(),
|
|
51
|
+
totalSlots: schemas.Integer,
|
|
52
|
+
missedProposals: ValidatorMissedStatsSchema,
|
|
53
|
+
missedAttestations: ValidatorMissedStatsSchema,
|
|
54
|
+
history: ValidatorStatusHistorySchema,
|
|
55
|
+
}),
|
|
56
|
+
);
|
|
55
57
|
|
|
56
|
-
export const ValidatorsStatsSchema =
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
58
|
+
export const ValidatorsStatsSchema = zodFor<ValidatorsStats>()(
|
|
59
|
+
z.object({
|
|
60
|
+
stats: z.record(ValidatorStatsSchema),
|
|
61
|
+
lastProcessedSlot: schemas.SlotNumber.optional(),
|
|
62
|
+
initialSlot: schemas.SlotNumber.optional(),
|
|
63
|
+
slotWindow: schemas.Integer,
|
|
64
|
+
}),
|
|
65
|
+
);
|
|
62
66
|
|
|
63
|
-
export const SingleValidatorStatsSchema =
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
z.
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
67
|
+
export const SingleValidatorStatsSchema = zodFor<SingleValidatorStats>()(
|
|
68
|
+
z.object({
|
|
69
|
+
validator: ValidatorStatsSchema,
|
|
70
|
+
allTimeProvenPerformance: z.array(
|
|
71
|
+
z.object({
|
|
72
|
+
missed: schemas.Integer,
|
|
73
|
+
total: schemas.Integer,
|
|
74
|
+
epoch: schemas.EpochNumber,
|
|
75
|
+
}),
|
|
76
|
+
),
|
|
77
|
+
lastProcessedSlot: schemas.SlotNumber.optional(),
|
|
78
|
+
initialSlot: schemas.SlotNumber.optional(),
|
|
79
|
+
slotWindow: schemas.Integer,
|
|
80
|
+
}),
|
|
81
|
+
);
|
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
import { BufferReader } from '@aztec/foundation/serialize';
|
|
2
|
-
import type { FieldsOf } from '@aztec/foundation/types';
|
|
3
|
-
import { z } from 'zod';
|
|
4
|
-
import { L1PublishedData, PublishedCheckpoint } from '../checkpoint/published_checkpoint.js';
|
|
5
|
-
import { L2Block } from './l2_block.js';
|
|
6
|
-
import { CommitteeAttestation } from './proposal/committee_attestation.js';
|
|
7
|
-
/**
|
|
8
|
-
* @deprecated `PublishedCheckpoint` is what will be retrieved from L1.
|
|
9
|
-
* L2 blocks do not need to link to L1PublishedData directly.
|
|
10
|
-
* TODO: Create another type (AttestedL2Block?) for an L2 block and its attestations.
|
|
11
|
-
*/
|
|
12
|
-
export declare class PublishedL2Block {
|
|
13
|
-
block: L2Block;
|
|
14
|
-
l1: L1PublishedData;
|
|
15
|
-
attestations: CommitteeAttestation[];
|
|
16
|
-
constructor(block: L2Block, l1: L1PublishedData, attestations: CommitteeAttestation[]);
|
|
17
|
-
static get schema(): z.ZodEffects<z.ZodObject<{
|
|
18
|
-
block: z.ZodEffects<z.ZodObject<{
|
|
19
|
-
archive: z.ZodEffects<z.ZodObject<{
|
|
20
|
-
root: z.ZodType<import("../../../foundation/dest/schemas/schemas.js").Fr, any, string>;
|
|
21
|
-
nextAvailableLeafIndex: z.ZodPipeline<z.ZodUnion<[z.ZodBigInt, z.ZodNumber, z.ZodString]>, z.ZodNumber>;
|
|
22
|
-
}, "strip", z.ZodTypeAny, {
|
|
23
|
-
root: import("../../../foundation/dest/schemas/schemas.js").Fr;
|
|
24
|
-
nextAvailableLeafIndex: number;
|
|
25
|
-
}, {
|
|
26
|
-
root: string;
|
|
27
|
-
nextAvailableLeafIndex: string | number | bigint;
|
|
28
|
-
}>, import("../trees/append_only_tree_snapshot.js").AppendOnlyTreeSnapshot, {
|
|
29
|
-
root: string;
|
|
30
|
-
nextAvailableLeafIndex: string | number | bigint;
|
|
31
|
-
}>;
|
|
32
|
-
header: import("../schemas/schemas.js").ZodFor<import("./l2_block_header.js").L2BlockHeader>;
|
|
33
|
-
body: import("../schemas/schemas.js").ZodFor<import("./body.js").Body>;
|
|
34
|
-
}, "strip", z.ZodTypeAny, {
|
|
35
|
-
archive: import("../trees/append_only_tree_snapshot.js").AppendOnlyTreeSnapshot;
|
|
36
|
-
header: import("./l2_block_header.js").L2BlockHeader;
|
|
37
|
-
body: import("./body.js").Body;
|
|
38
|
-
}, {
|
|
39
|
-
archive: {
|
|
40
|
-
root: string;
|
|
41
|
-
nextAvailableLeafIndex: string | number | bigint;
|
|
42
|
-
};
|
|
43
|
-
header?: any;
|
|
44
|
-
body?: any;
|
|
45
|
-
}>, L2Block, {
|
|
46
|
-
archive: {
|
|
47
|
-
root: string;
|
|
48
|
-
nextAvailableLeafIndex: string | number | bigint;
|
|
49
|
-
};
|
|
50
|
-
header?: any;
|
|
51
|
-
body?: any;
|
|
52
|
-
}>;
|
|
53
|
-
l1: z.ZodObject<{
|
|
54
|
-
blockNumber: z.ZodPipeline<z.ZodUnion<[z.ZodBigInt, z.ZodNumber, z.ZodString]>, z.ZodBigInt>;
|
|
55
|
-
timestamp: z.ZodPipeline<z.ZodUnion<[z.ZodBigInt, z.ZodNumber, z.ZodString]>, z.ZodBigInt>;
|
|
56
|
-
blockHash: z.ZodString;
|
|
57
|
-
}, "strip", z.ZodTypeAny, {
|
|
58
|
-
blockNumber: bigint;
|
|
59
|
-
timestamp: bigint;
|
|
60
|
-
blockHash: string;
|
|
61
|
-
}, {
|
|
62
|
-
blockNumber: string | number | bigint;
|
|
63
|
-
timestamp: string | number | bigint;
|
|
64
|
-
blockHash: string;
|
|
65
|
-
}>;
|
|
66
|
-
attestations: z.ZodArray<z.ZodEffects<z.ZodObject<{
|
|
67
|
-
address: z.ZodType<import("./proposal/committee_attestation.js").EthAddress, any, string>;
|
|
68
|
-
signature: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodString, `0x${string}`, string>, `0x${string}`, string>, import("./proposal/committee_attestation.js").Signature, string>;
|
|
69
|
-
}, "strip", z.ZodTypeAny, {
|
|
70
|
-
address: import("./proposal/committee_attestation.js").EthAddress;
|
|
71
|
-
signature: import("./proposal/committee_attestation.js").Signature;
|
|
72
|
-
}, {
|
|
73
|
-
address: string;
|
|
74
|
-
signature: string;
|
|
75
|
-
}>, CommitteeAttestation, {
|
|
76
|
-
address: string;
|
|
77
|
-
signature: string;
|
|
78
|
-
}>, "many">;
|
|
79
|
-
}, "strip", z.ZodTypeAny, {
|
|
80
|
-
block: L2Block;
|
|
81
|
-
l1: {
|
|
82
|
-
blockNumber: bigint;
|
|
83
|
-
timestamp: bigint;
|
|
84
|
-
blockHash: string;
|
|
85
|
-
};
|
|
86
|
-
attestations: CommitteeAttestation[];
|
|
87
|
-
}, {
|
|
88
|
-
block: {
|
|
89
|
-
archive: {
|
|
90
|
-
root: string;
|
|
91
|
-
nextAvailableLeafIndex: string | number | bigint;
|
|
92
|
-
};
|
|
93
|
-
header?: any;
|
|
94
|
-
body?: any;
|
|
95
|
-
};
|
|
96
|
-
l1: {
|
|
97
|
-
blockNumber: string | number | bigint;
|
|
98
|
-
timestamp: string | number | bigint;
|
|
99
|
-
blockHash: string;
|
|
100
|
-
};
|
|
101
|
-
attestations: {
|
|
102
|
-
address: string;
|
|
103
|
-
signature: string;
|
|
104
|
-
}[];
|
|
105
|
-
}>, PublishedL2Block, {
|
|
106
|
-
block: {
|
|
107
|
-
archive: {
|
|
108
|
-
root: string;
|
|
109
|
-
nextAvailableLeafIndex: string | number | bigint;
|
|
110
|
-
};
|
|
111
|
-
header?: any;
|
|
112
|
-
body?: any;
|
|
113
|
-
};
|
|
114
|
-
l1: {
|
|
115
|
-
blockNumber: string | number | bigint;
|
|
116
|
-
timestamp: string | number | bigint;
|
|
117
|
-
blockHash: string;
|
|
118
|
-
};
|
|
119
|
-
attestations: {
|
|
120
|
-
address: string;
|
|
121
|
-
signature: string;
|
|
122
|
-
}[];
|
|
123
|
-
}>;
|
|
124
|
-
static fromBuffer(bufferOrReader: Buffer | BufferReader): PublishedL2Block;
|
|
125
|
-
static fromFields(fields: FieldsOf<PublishedL2Block>): PublishedL2Block;
|
|
126
|
-
toBuffer(): Buffer;
|
|
127
|
-
toPublishedCheckpoint(): PublishedCheckpoint;
|
|
128
|
-
static fromPublishedCheckpoint(checkpoint: PublishedCheckpoint): PublishedL2Block;
|
|
129
|
-
}
|
|
130
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHVibGlzaGVkX2wyX2Jsb2NrLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvYmxvY2svcHVibGlzaGVkX2wyX2Jsb2NrLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUNBLE9BQU8sRUFBRSxZQUFZLEVBQXFCLE1BQU0sNkJBQTZCLENBQUM7QUFDOUUsT0FBTyxLQUFLLEVBQUUsUUFBUSxFQUFFLE1BQU0seUJBQXlCLENBQUM7QUFFeEQsT0FBTyxFQUFFLENBQUMsRUFBRSxNQUFNLEtBQUssQ0FBQztBQUV4QixPQUFPLEVBQUUsZUFBZSxFQUFFLG1CQUFtQixFQUFFLE1BQU0sdUNBQXVDLENBQUM7QUFDN0YsT0FBTyxFQUFFLE9BQU8sRUFBRSxNQUFNLGVBQWUsQ0FBQztBQUN4QyxPQUFPLEVBQUUsb0JBQW9CLEVBQUUsTUFBTSxxQ0FBcUMsQ0FBQztBQUUzRTs7OztHQUlHO0FBQ0gscUJBQWEsZ0JBQWdCO0lBRWxCLEtBQUssRUFBRSxPQUFPO0lBQ2QsRUFBRSxFQUFFLGVBQWU7SUFDbkIsWUFBWSxFQUFFLG9CQUFvQixFQUFFO0lBSDdDLFlBQ1MsS0FBSyxFQUFFLE9BQU8sRUFDZCxFQUFFLEVBQUUsZUFBZSxFQUNuQixZQUFZLEVBQUUsb0JBQW9CLEVBQUUsRUFDekM7SUFFSixNQUFNLEtBQUssTUFBTTs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OztPQVFoQjtJQUVELE1BQU0sQ0FBQyxVQUFVLENBQUMsY0FBYyxFQUFFLE1BQU0sR0FBRyxZQUFZLEdBQUcsZ0JBQWdCLENBUXpFO0lBRUQsTUFBTSxDQUFDLFVBQVUsQ0FBQyxNQUFNLEVBQUUsUUFBUSxDQUFDLGdCQUFnQixDQUFDLG9CQUVuRDtJQUVNLFFBQVEsSUFBSSxNQUFNLENBU3hCO0lBRU0scUJBQXFCLHdCQUUzQjtJQUVELE1BQU0sQ0FBQyx1QkFBdUIsQ0FBQyxVQUFVLEVBQUUsbUJBQW1CLG9CQUU3RDtDQUNGIn0=
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"published_l2_block.d.ts","sourceRoot":"","sources":["../../src/block/published_l2_block.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAqB,MAAM,6BAA6B,CAAC;AAC9E,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAExD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAC;AAC7F,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAE3E;;;;GAIG;AACH,qBAAa,gBAAgB;IAElB,KAAK,EAAE,OAAO;IACd,EAAE,EAAE,eAAe;IACnB,YAAY,EAAE,oBAAoB,EAAE;IAH7C,YACS,KAAK,EAAE,OAAO,EACd,EAAE,EAAE,eAAe,EACnB,YAAY,EAAE,oBAAoB,EAAE,EACzC;IAEJ,MAAM,KAAK,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAQhB;IAED,MAAM,CAAC,UAAU,CAAC,cAAc,EAAE,MAAM,GAAG,YAAY,GAAG,gBAAgB,CAQzE;IAED,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,QAAQ,CAAC,gBAAgB,CAAC,oBAEnD;IAEM,QAAQ,IAAI,MAAM,CASxB;IAEM,qBAAqB,wBAE3B;IAED,MAAM,CAAC,uBAAuB,CAAC,UAAU,EAAE,mBAAmB,oBAE7D;CACF"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
2
|
-
import { TxHash } from '@aztec/stdlib/tx';
|
|
3
|
-
export declare class PublicLogWithTxData {
|
|
4
|
-
logPayload: Fr[];
|
|
5
|
-
txHash: TxHash;
|
|
6
|
-
uniqueNoteHashesInTx: Fr[];
|
|
7
|
-
firstNullifierInTx: Fr;
|
|
8
|
-
constructor(logPayload: Fr[], txHash: TxHash, uniqueNoteHashesInTx: Fr[], firstNullifierInTx: Fr);
|
|
9
|
-
}
|
|
10
|
-
export declare class PrivateLogWithTxData {
|
|
11
|
-
logPayload: Fr[];
|
|
12
|
-
txHash: TxHash;
|
|
13
|
-
uniqueNoteHashesInTx: Fr[];
|
|
14
|
-
firstNullifierInTx: Fr;
|
|
15
|
-
constructor(logPayload: Fr[], txHash: TxHash, uniqueNoteHashesInTx: Fr[], firstNullifierInTx: Fr);
|
|
16
|
-
toNoirSerialization(): (Fr | Fr[])[];
|
|
17
|
-
static noirSerializationOfEmpty(): (Fr | Fr[])[];
|
|
18
|
-
}
|
|
19
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibG9nX3dpdGhfdHhfZGF0YS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2xvZ3MvbG9nX3dpdGhfdHhfZGF0YS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFDQSxPQUFPLEVBQUUsRUFBRSxFQUFFLE1BQU0sZ0NBQWdDLENBQUM7QUFDcEQsT0FBTyxFQUFFLE1BQU0sRUFBRSxNQUFNLGtCQUFrQixDQUFDO0FBRzFDLHFCQUFhLG1CQUFtQjtJQUVyQixVQUFVLEVBQUUsRUFBRSxFQUFFO0lBQ2hCLE1BQU0sRUFBRSxNQUFNO0lBQ2Qsb0JBQW9CLEVBQUUsRUFBRSxFQUFFO0lBQzFCLGtCQUFrQixFQUFFLEVBQUU7SUFKL0IsWUFDUyxVQUFVLEVBQUUsRUFBRSxFQUFFLEVBQ2hCLE1BQU0sRUFBRSxNQUFNLEVBQ2Qsb0JBQW9CLEVBQUUsRUFBRSxFQUFFLEVBQzFCLGtCQUFrQixFQUFFLEVBQUUsRUFDM0I7Q0FDTDtBQUdELHFCQUFhLG9CQUFvQjtJQUV0QixVQUFVLEVBQUUsRUFBRSxFQUFFO0lBQ2hCLE1BQU0sRUFBRSxNQUFNO0lBQ2Qsb0JBQW9CLEVBQUUsRUFBRSxFQUFFO0lBQzFCLGtCQUFrQixFQUFFLEVBQUU7SUFKL0IsWUFDUyxVQUFVLEVBQUUsRUFBRSxFQUFFLEVBQ2hCLE1BQU0sRUFBRSxNQUFNLEVBQ2Qsb0JBQW9CLEVBQUUsRUFBRSxFQUFFLEVBQzFCLGtCQUFrQixFQUFFLEVBQUUsRUFDM0I7SUFFSixtQkFBbUIsSUFBSSxDQUFDLEVBQUUsR0FBRyxFQUFFLEVBQUUsQ0FBQyxFQUFFLENBT25DO0lBRUQsTUFBTSxDQUFDLHdCQUF3QixJQUFJLENBQUMsRUFBRSxHQUFHLEVBQUUsRUFBRSxDQUFDLEVBQUUsQ0FFL0M7Q0FDRiJ9
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"log_with_tx_data.d.ts","sourceRoot":"","sources":["../../src/logs/log_with_tx_data.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAG1C,qBAAa,mBAAmB;IAErB,UAAU,EAAE,EAAE,EAAE;IAChB,MAAM,EAAE,MAAM;IACd,oBAAoB,EAAE,EAAE,EAAE;IAC1B,kBAAkB,EAAE,EAAE;IAJ/B,YACS,UAAU,EAAE,EAAE,EAAE,EAChB,MAAM,EAAE,MAAM,EACd,oBAAoB,EAAE,EAAE,EAAE,EAC1B,kBAAkB,EAAE,EAAE,EAC3B;CACL;AAGD,qBAAa,oBAAoB;IAEtB,UAAU,EAAE,EAAE,EAAE;IAChB,MAAM,EAAE,MAAM;IACd,oBAAoB,EAAE,EAAE,EAAE;IAC1B,kBAAkB,EAAE,EAAE;IAJ/B,YACS,UAAU,EAAE,EAAE,EAAE,EAChB,MAAM,EAAE,MAAM,EACd,oBAAoB,EAAE,EAAE,EAAE,EAC1B,kBAAkB,EAAE,EAAE,EAC3B;IAEJ,mBAAmB,IAAI,CAAC,EAAE,GAAG,EAAE,EAAE,CAAC,EAAE,CAOnC;IAED,MAAM,CAAC,wBAAwB,IAAI,CAAC,EAAE,GAAG,EAAE,EAAE,CAAC,EAAE,CAE/C;CACF"}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { MAX_NOTE_HASHES_PER_TX, PRIVATE_LOG_CIPHERTEXT_LEN } from '@aztec/constants';
|
|
2
|
-
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
3
|
-
import { TxHash } from '@aztec/stdlib/tx';
|
|
4
|
-
// This is used as a response for PXE's custom getPublicLogByTag oracle.
|
|
5
|
-
export class PublicLogWithTxData {
|
|
6
|
-
logPayload;
|
|
7
|
-
txHash;
|
|
8
|
-
uniqueNoteHashesInTx;
|
|
9
|
-
firstNullifierInTx;
|
|
10
|
-
constructor(logPayload, txHash, uniqueNoteHashesInTx, firstNullifierInTx){
|
|
11
|
-
this.logPayload = logPayload;
|
|
12
|
-
this.txHash = txHash;
|
|
13
|
-
this.uniqueNoteHashesInTx = uniqueNoteHashesInTx;
|
|
14
|
-
this.firstNullifierInTx = firstNullifierInTx;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
// This is used as a response for PXE's custom getPrivateLogByTag oracle.
|
|
18
|
-
export class PrivateLogWithTxData {
|
|
19
|
-
logPayload;
|
|
20
|
-
txHash;
|
|
21
|
-
uniqueNoteHashesInTx;
|
|
22
|
-
firstNullifierInTx;
|
|
23
|
-
constructor(logPayload, txHash, uniqueNoteHashesInTx, firstNullifierInTx){
|
|
24
|
-
this.logPayload = logPayload;
|
|
25
|
-
this.txHash = txHash;
|
|
26
|
-
this.uniqueNoteHashesInTx = uniqueNoteHashesInTx;
|
|
27
|
-
this.firstNullifierInTx = firstNullifierInTx;
|
|
28
|
-
}
|
|
29
|
-
toNoirSerialization() {
|
|
30
|
-
return [
|
|
31
|
-
...toBoundedVecSerialization(this.logPayload, PRIVATE_LOG_CIPHERTEXT_LEN),
|
|
32
|
-
this.txHash.hash,
|
|
33
|
-
...toBoundedVecSerialization(this.uniqueNoteHashesInTx, MAX_NOTE_HASHES_PER_TX),
|
|
34
|
-
this.firstNullifierInTx
|
|
35
|
-
];
|
|
36
|
-
}
|
|
37
|
-
static noirSerializationOfEmpty() {
|
|
38
|
-
return new PrivateLogWithTxData([], TxHash.zero(), [], new Fr(0)).toNoirSerialization();
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
function toBoundedVecSerialization(array, maxLength) {
|
|
42
|
-
if (array.length > maxLength) {
|
|
43
|
-
throw new Error(`An array of length ${array.length} cannot be converted to a BoundedVec of max length ${maxLength}`);
|
|
44
|
-
}
|
|
45
|
-
return [
|
|
46
|
-
array.concat(Array(maxLength - array.length).fill(new Fr(0))),
|
|
47
|
-
new Fr(array.length)
|
|
48
|
-
];
|
|
49
|
-
}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { MAX_NOTE_HASHES_PER_TX, PRIVATE_LOG_CIPHERTEXT_LEN } from '@aztec/constants';
|
|
2
|
-
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
3
|
-
import { TxHash } from '@aztec/stdlib/tx';
|
|
4
|
-
|
|
5
|
-
// This is used as a response for PXE's custom getPublicLogByTag oracle.
|
|
6
|
-
export class PublicLogWithTxData {
|
|
7
|
-
constructor(
|
|
8
|
-
public logPayload: Fr[],
|
|
9
|
-
public txHash: TxHash,
|
|
10
|
-
public uniqueNoteHashesInTx: Fr[],
|
|
11
|
-
public firstNullifierInTx: Fr,
|
|
12
|
-
) {}
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
// This is used as a response for PXE's custom getPrivateLogByTag oracle.
|
|
16
|
-
export class PrivateLogWithTxData {
|
|
17
|
-
constructor(
|
|
18
|
-
public logPayload: Fr[],
|
|
19
|
-
public txHash: TxHash,
|
|
20
|
-
public uniqueNoteHashesInTx: Fr[],
|
|
21
|
-
public firstNullifierInTx: Fr,
|
|
22
|
-
) {}
|
|
23
|
-
|
|
24
|
-
toNoirSerialization(): (Fr | Fr[])[] {
|
|
25
|
-
return [
|
|
26
|
-
...toBoundedVecSerialization(this.logPayload, PRIVATE_LOG_CIPHERTEXT_LEN),
|
|
27
|
-
this.txHash.hash,
|
|
28
|
-
...toBoundedVecSerialization(this.uniqueNoteHashesInTx, MAX_NOTE_HASHES_PER_TX),
|
|
29
|
-
this.firstNullifierInTx,
|
|
30
|
-
];
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
static noirSerializationOfEmpty(): (Fr | Fr[])[] {
|
|
34
|
-
return new PrivateLogWithTxData([], TxHash.zero(), [], new Fr(0)).toNoirSerialization();
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
function toBoundedVecSerialization(array: Fr[], maxLength: number) {
|
|
39
|
-
if (array.length > maxLength) {
|
|
40
|
-
throw new Error(
|
|
41
|
-
`An array of length ${array.length} cannot be converted to a BoundedVec of max length ${maxLength}`,
|
|
42
|
-
);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
return [array.concat(Array(maxLength - array.length).fill(new Fr(0))), new Fr(array.length)];
|
|
46
|
-
}
|