@aztec/stdlib 3.0.0-nightly.20251128 → 3.0.0-nightly.20251202
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/avm/avm.d.ts +17 -9
- package/dest/avm/avm.d.ts.map +1 -1
- package/dest/avm/avm_circuit_public_inputs.d.ts +5 -3
- package/dest/avm/avm_circuit_public_inputs.d.ts.map +1 -1
- package/dest/avm/avm_proving_request.d.ts +9 -5
- package/dest/avm/avm_proving_request.d.ts.map +1 -1
- package/dest/block/in_block.d.ts +7 -5
- package/dest/block/in_block.d.ts.map +1 -1
- package/dest/block/l2_block.d.ts +3 -2
- package/dest/block/l2_block.d.ts.map +1 -1
- package/dest/block/l2_block.js +2 -1
- package/dest/block/l2_block_code_to_purge.d.ts +1 -1
- package/dest/block/l2_block_code_to_purge.d.ts.map +1 -1
- package/dest/block/l2_block_code_to_purge.js +3 -2
- package/dest/block/l2_block_header.d.ts +4 -3
- package/dest/block/l2_block_header.d.ts.map +1 -1
- package/dest/block/l2_block_header.js +1 -1
- package/dest/block/l2_block_source.d.ts +4 -4
- package/dest/block/l2_block_source.d.ts.map +1 -1
- package/dest/checkpoint/checkpoint.d.ts +13 -10
- package/dest/checkpoint/checkpoint.d.ts.map +1 -1
- package/dest/checkpoint/checkpoint.js +4 -4
- package/dest/checkpoint/published_checkpoint.d.ts +5 -3
- package/dest/checkpoint/published_checkpoint.d.ts.map +1 -1
- package/dest/epoch-helpers/index.d.ts +7 -7
- package/dest/epoch-helpers/index.d.ts.map +1 -1
- package/dest/epoch-helpers/index.js +9 -9
- package/dest/interfaces/archiver.js +1 -1
- package/dest/interfaces/aztec-node.d.ts +10 -4
- package/dest/interfaces/aztec-node.d.ts.map +1 -1
- package/dest/interfaces/aztec-node.js +2 -1
- package/dest/interfaces/p2p.d.ts +3 -2
- package/dest/interfaces/p2p.d.ts.map +1 -1
- package/dest/interfaces/p2p.js +1 -1
- package/dest/interfaces/proving-job.d.ts +9 -5
- package/dest/interfaces/proving-job.d.ts.map +1 -1
- package/dest/interfaces/validator.d.ts +3 -3
- package/dest/interfaces/validator.d.ts.map +1 -1
- package/dest/kernel/private_call_data.d.ts +62 -5
- package/dest/kernel/private_call_data.d.ts.map +1 -1
- package/dest/kernel/private_call_data.js +105 -4
- package/dest/note/note_dao.d.ts +6 -3
- package/dest/note/note_dao.d.ts.map +1 -1
- package/dest/note/note_dao.js +10 -6
- package/dest/note/notes_filter.d.ts +3 -1
- package/dest/note/notes_filter.d.ts.map +1 -1
- package/dest/note/notes_filter.js +1 -0
- package/dest/p2p/block_attestation.d.ts +4 -9
- package/dest/p2p/block_attestation.d.ts.map +1 -1
- package/dest/p2p/block_proposal.d.ts +3 -2
- package/dest/p2p/block_proposal.d.ts.map +1 -1
- package/dest/p2p/block_proposal.js +1 -1
- package/dest/p2p/consensus_payload.d.ts +4 -182
- package/dest/p2p/consensus_payload.d.ts.map +1 -1
- package/dest/p2p/consensus_payload.js +14 -25
- package/dest/rollup/checkpoint_constant_data.d.ts +11 -5
- package/dest/rollup/checkpoint_constant_data.d.ts.map +1 -1
- package/dest/rollup/checkpoint_constant_data.js +11 -4
- package/dest/rollup/checkpoint_header.d.ts +11 -5
- package/dest/rollup/checkpoint_header.d.ts.map +1 -1
- package/dest/rollup/checkpoint_header.js +18 -11
- package/dest/schemas/schemas.d.ts +6 -1
- package/dest/schemas/schemas.d.ts.map +1 -1
- package/dest/schemas/schemas.js +2 -0
- package/dest/slashing/empire.js +2 -2
- package/dest/slashing/helpers.d.ts +5 -5
- package/dest/slashing/helpers.d.ts.map +1 -1
- package/dest/slashing/helpers.js +7 -6
- package/dest/slashing/interfaces.d.ts +3 -2
- package/dest/slashing/interfaces.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 +5 -4
- package/dest/tests/mocks.d.ts +2 -3
- package/dest/tests/mocks.d.ts.map +1 -1
- package/dest/tests/mocks.js +6 -12
- package/dest/trees/append_only_tree_snapshot.d.ts +1 -4
- package/dest/trees/append_only_tree_snapshot.d.ts.map +1 -1
- package/dest/trees/append_only_tree_snapshot.js +0 -9
- package/dest/tx/block_header.d.ts +4 -3
- package/dest/tx/block_header.d.ts.map +1 -1
- package/dest/tx/block_header.js +1 -1
- package/dest/tx/global_variable_builder.d.ts +3 -2
- package/dest/tx/global_variable_builder.d.ts.map +1 -1
- package/dest/tx/global_variables.d.ts +26 -8
- package/dest/tx/global_variables.d.ts.map +1 -1
- package/dest/tx/global_variables.js +27 -10
- package/dest/tx/indexed_tx_effect.d.ts +3 -3
- package/dest/tx/indexed_tx_effect.d.ts.map +1 -1
- package/dest/tx/partial_state_reference.d.ts +1 -4
- package/dest/tx/partial_state_reference.d.ts.map +1 -1
- package/dest/tx/partial_state_reference.js +0 -10
- package/dest/tx/state_reference.d.ts +1 -4
- package/dest/tx/state_reference.d.ts.map +1 -1
- package/dest/tx/state_reference.js +0 -9
- package/dest/tx/tx.d.ts +2 -2
- package/dest/tx/tx.d.ts.map +1 -1
- package/dest/tx/tx.js +1 -0
- package/dest/validators/errors.d.ts +6 -7
- package/dest/validators/errors.d.ts.map +1 -1
- package/dest/validators/errors.js +2 -4
- package/dest/validators/schemas.d.ts +102 -48
- package/dest/validators/schemas.d.ts.map +1 -1
- package/dest/validators/schemas.js +6 -6
- package/dest/validators/types.d.ts +9 -9
- package/dest/validators/types.d.ts.map +1 -1
- package/package.json +8 -8
- package/src/block/in_block.ts +8 -5
- package/src/block/l2_block.ts +8 -2
- package/src/block/l2_block_code_to_purge.ts +3 -2
- package/src/block/l2_block_header.ts +3 -2
- package/src/block/l2_block_source.ts +3 -3
- package/src/checkpoint/checkpoint.ts +5 -5
- package/src/epoch-helpers/index.ts +19 -14
- package/src/interfaces/archiver.ts +1 -1
- package/src/interfaces/aztec-node.ts +14 -5
- package/src/interfaces/p2p.ts +4 -2
- package/src/interfaces/validator.ts +1 -2
- package/src/kernel/private_call_data.ts +130 -3
- package/src/note/note_dao.ts +11 -2
- package/src/note/notes_filter.ts +3 -0
- package/src/p2p/block_attestation.ts +2 -1
- package/src/p2p/block_proposal.ts +3 -2
- package/src/p2p/consensus_payload.ts +12 -28
- package/src/rollup/checkpoint_constant_data.ts +24 -5
- package/src/rollup/checkpoint_header.ts +21 -12
- package/src/schemas/schemas.ts +7 -0
- package/src/slashing/empire.ts +2 -2
- package/src/slashing/helpers.ts +12 -9
- package/src/slashing/interfaces.ts +3 -1
- package/src/tests/factories.ts +5 -4
- package/src/tests/mocks.ts +2 -16
- package/src/trees/append_only_tree_snapshot.ts +0 -12
- package/src/tx/block_header.ts +3 -2
- package/src/tx/global_variable_builder.ts +2 -1
- package/src/tx/global_variables.ts +30 -11
- package/src/tx/indexed_tx_effect.ts +2 -2
- package/src/tx/partial_state_reference.ts +0 -17
- package/src/tx/state_reference.ts +0 -15
- package/src/tx/tx.ts +2 -1
- package/src/validators/errors.ts +3 -4
- package/src/validators/schemas.ts +6 -6
- package/src/validators/types.ts +8 -8
package/src/tx/block_header.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { BLOCK_HEADER_LENGTH, GeneratorIndex } from '@aztec/constants';
|
|
2
|
+
import { SlotNumber } from '@aztec/foundation/branded-types';
|
|
2
3
|
import { poseidon2HashWithSeparator, randomInt } from '@aztec/foundation/crypto';
|
|
3
4
|
import { Fr } from '@aztec/foundation/fields';
|
|
4
5
|
import { type ZodFor, schemas } from '@aztec/foundation/schemas';
|
|
@@ -61,8 +62,8 @@ export class BlockHeader {
|
|
|
61
62
|
return new BlockHeader(...BlockHeader.getFields(fields));
|
|
62
63
|
}
|
|
63
64
|
|
|
64
|
-
getSlot() {
|
|
65
|
-
return this.globalVariables.slotNumber
|
|
65
|
+
getSlot(): SlotNumber {
|
|
66
|
+
return this.globalVariables.slotNumber;
|
|
66
67
|
}
|
|
67
68
|
|
|
68
69
|
getBlockNumber() {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
2
|
+
import type { SlotNumber } from '@aztec/foundation/schemas';
|
|
2
3
|
|
|
3
4
|
import type { AztecAddress } from '../aztec-address/index.js';
|
|
4
5
|
import type { GasFees } from '../gas/gas_fees.js';
|
|
@@ -23,6 +24,6 @@ export interface GlobalVariableBuilder {
|
|
|
23
24
|
blockNumber: UInt32,
|
|
24
25
|
coinbase: EthAddress,
|
|
25
26
|
feeRecipient: AztecAddress,
|
|
26
|
-
slotNumber?:
|
|
27
|
+
slotNumber?: SlotNumber,
|
|
27
28
|
): Promise<GlobalVariables>;
|
|
28
29
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { GLOBAL_VARIABLES_LENGTH } from '@aztec/constants';
|
|
2
|
+
import { SlotNumber } from '@aztec/foundation/branded-types';
|
|
2
3
|
import { randomInt } from '@aztec/foundation/crypto';
|
|
3
4
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
4
5
|
import { Fr } from '@aztec/foundation/fields';
|
|
@@ -32,7 +33,7 @@ export class GlobalVariables {
|
|
|
32
33
|
/** Block number of the L2 block. */
|
|
33
34
|
public blockNumber: UInt32,
|
|
34
35
|
/** Slot number of the L2 block */
|
|
35
|
-
public slotNumber:
|
|
36
|
+
public slotNumber: SlotNumber,
|
|
36
37
|
/** Timestamp of the L2 block. */
|
|
37
38
|
public timestamp: UInt64,
|
|
38
39
|
/** Recipient of block reward. */
|
|
@@ -49,7 +50,7 @@ export class GlobalVariables {
|
|
|
49
50
|
chainId: schemas.Fr,
|
|
50
51
|
version: schemas.Fr,
|
|
51
52
|
blockNumber: schemas.UInt32,
|
|
52
|
-
slotNumber: schemas.
|
|
53
|
+
slotNumber: schemas.SlotNumber,
|
|
53
54
|
timestamp: schemas.BigInt,
|
|
54
55
|
coinbase: schemas.EthAddress,
|
|
55
56
|
feeRecipient: schemas.AztecAddress,
|
|
@@ -78,7 +79,7 @@ export class GlobalVariables {
|
|
|
78
79
|
Fr.fromPlainObject(obj.chainId),
|
|
79
80
|
Fr.fromPlainObject(obj.version),
|
|
80
81
|
obj.blockNumber,
|
|
81
|
-
Fr.fromPlainObject(obj.slotNumber),
|
|
82
|
+
SlotNumber(Fr.fromPlainObject(obj.slotNumber).toNumber()),
|
|
82
83
|
typeof obj.timestamp === 'bigint' ? obj.timestamp : BigInt(obj.timestamp),
|
|
83
84
|
EthAddress.fromPlainObject(obj.coinbase),
|
|
84
85
|
AztecAddress.fromPlainObject(obj.feeRecipient),
|
|
@@ -89,7 +90,7 @@ export class GlobalVariables {
|
|
|
89
90
|
static empty(fields: Partial<FieldsOf<GlobalVariables>> = {}): GlobalVariables {
|
|
90
91
|
return GlobalVariables.from({
|
|
91
92
|
blockNumber: 0,
|
|
92
|
-
slotNumber:
|
|
93
|
+
slotNumber: SlotNumber.ZERO,
|
|
93
94
|
timestamp: 0n,
|
|
94
95
|
chainId: Fr.ZERO,
|
|
95
96
|
version: Fr.ZERO,
|
|
@@ -106,7 +107,7 @@ export class GlobalVariables {
|
|
|
106
107
|
Fr.fromBuffer(reader),
|
|
107
108
|
Fr.fromBuffer(reader),
|
|
108
109
|
reader.readNumber(),
|
|
109
|
-
|
|
110
|
+
SlotNumber(reader.readNumber()),
|
|
110
111
|
reader.readUInt64(),
|
|
111
112
|
reader.readObject(EthAddress),
|
|
112
113
|
reader.readObject(AztecAddress),
|
|
@@ -121,7 +122,7 @@ export class GlobalVariables {
|
|
|
121
122
|
reader.readField(),
|
|
122
123
|
reader.readField(),
|
|
123
124
|
reader.readU32(),
|
|
124
|
-
reader.
|
|
125
|
+
SlotNumber(reader.readU32()),
|
|
125
126
|
reader.readField().toBigInt(),
|
|
126
127
|
EthAddress.fromField(reader.readField()),
|
|
127
128
|
AztecAddress.fromField(reader.readField()),
|
|
@@ -172,13 +173,31 @@ export class GlobalVariables {
|
|
|
172
173
|
toFriendlyJSON() {
|
|
173
174
|
return {
|
|
174
175
|
blockNumber: this.blockNumber,
|
|
175
|
-
slotNumber: this.slotNumber
|
|
176
|
+
slotNumber: this.slotNumber,
|
|
176
177
|
timestamp: this.timestamp.toString(),
|
|
177
178
|
coinbase: this.coinbase.toString(),
|
|
178
179
|
gasFees: jsonStringify(this.gasFees),
|
|
179
180
|
};
|
|
180
181
|
}
|
|
181
182
|
|
|
183
|
+
/**
|
|
184
|
+
* Converts GlobalVariables to a plain object suitable for MessagePack serialization.
|
|
185
|
+
* This method ensures that slotNumber is serialized as a Fr (Field element) to match
|
|
186
|
+
* the C++ struct definition which expects slot_number as FF.
|
|
187
|
+
*/
|
|
188
|
+
toJSON() {
|
|
189
|
+
return {
|
|
190
|
+
chainId: this.chainId,
|
|
191
|
+
version: this.version,
|
|
192
|
+
blockNumber: this.blockNumber,
|
|
193
|
+
slotNumber: new Fr(this.slotNumber), // Convert to Fr for C++ compatibility
|
|
194
|
+
timestamp: this.timestamp,
|
|
195
|
+
coinbase: this.coinbase,
|
|
196
|
+
feeRecipient: this.feeRecipient,
|
|
197
|
+
gasFees: this.gasFees,
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
|
|
182
201
|
clone(): GlobalVariables {
|
|
183
202
|
return GlobalVariables.fromBuffer(this.toBuffer());
|
|
184
203
|
}
|
|
@@ -188,7 +207,7 @@ export class GlobalVariables {
|
|
|
188
207
|
this.chainId.isZero() &&
|
|
189
208
|
this.version.isZero() &&
|
|
190
209
|
this.blockNumber === 0 &&
|
|
191
|
-
this.slotNumber
|
|
210
|
+
this.slotNumber === 0 &&
|
|
192
211
|
this.timestamp === 0n &&
|
|
193
212
|
this.coinbase.isZero() &&
|
|
194
213
|
this.feeRecipient.isZero() &&
|
|
@@ -201,7 +220,7 @@ export class GlobalVariables {
|
|
|
201
220
|
chainId: new Fr(randomInt(100_000)),
|
|
202
221
|
version: new Fr(randomInt(100_000)),
|
|
203
222
|
blockNumber: randomInt(100_000),
|
|
204
|
-
slotNumber:
|
|
223
|
+
slotNumber: SlotNumber(randomInt(100_000)),
|
|
205
224
|
coinbase: EthAddress.random(),
|
|
206
225
|
feeRecipient: AztecAddress.fromField(Fr.random()),
|
|
207
226
|
gasFees: GasFees.random(),
|
|
@@ -215,7 +234,7 @@ export class GlobalVariables {
|
|
|
215
234
|
chainId: this.chainId.toNumber(),
|
|
216
235
|
version: this.version.toNumber(),
|
|
217
236
|
blockNumber: this.blockNumber,
|
|
218
|
-
slotNumber: this.slotNumber
|
|
237
|
+
slotNumber: this.slotNumber,
|
|
219
238
|
timestamp: this.timestamp,
|
|
220
239
|
coinbase: this.coinbase.toString(),
|
|
221
240
|
feeRecipient: this.feeRecipient.toString(),
|
|
@@ -233,7 +252,7 @@ export class GlobalVariables {
|
|
|
233
252
|
this.chainId.equals(other.chainId) &&
|
|
234
253
|
this.version.equals(other.version) &&
|
|
235
254
|
this.blockNumber === other.blockNumber &&
|
|
236
|
-
this.slotNumber
|
|
255
|
+
this.slotNumber === other.slotNumber &&
|
|
237
256
|
this.timestamp === other.timestamp &&
|
|
238
257
|
this.coinbase.equals(other.coinbase) &&
|
|
239
258
|
this.feeRecipient.equals(other.feeRecipient) &&
|
|
@@ -2,10 +2,10 @@ import { schemas } from '@aztec/foundation/schemas';
|
|
|
2
2
|
import { BufferReader, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
3
3
|
|
|
4
4
|
import { L2BlockHash } from '../block/block_hash.js';
|
|
5
|
-
import { type
|
|
5
|
+
import { type DataInBlock, inBlockSchemaFor, randomInBlock } from '../block/in_block.js';
|
|
6
6
|
import { TxEffect } from './tx_effect.js';
|
|
7
7
|
|
|
8
|
-
export type IndexedTxEffect =
|
|
8
|
+
export type IndexedTxEffect = DataInBlock<TxEffect> & { txIndexInBlock: number };
|
|
9
9
|
|
|
10
10
|
export function indexedTxSchema() {
|
|
11
11
|
return inBlockSchemaFor(TxEffect.schema).extend({ txIndexInBlock: schemas.Integer });
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { PARTIAL_STATE_REFERENCE_LENGTH } from '@aztec/constants';
|
|
2
|
-
import type { ViemPartialStateReference } from '@aztec/ethereum';
|
|
3
2
|
import type { Fr } from '@aztec/foundation/fields';
|
|
4
3
|
import { BufferReader, FieldReader, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
5
4
|
import type { FieldsOf } from '@aztec/foundation/types';
|
|
@@ -65,14 +64,6 @@ export class PartialStateReference {
|
|
|
65
64
|
return new PartialStateReference(noteHashTree, nullifierTree, publicDataTree);
|
|
66
65
|
}
|
|
67
66
|
|
|
68
|
-
static fromViem(stateReference: ViemPartialStateReference) {
|
|
69
|
-
return new PartialStateReference(
|
|
70
|
-
AppendOnlyTreeSnapshot.fromViem(stateReference.noteHashTree),
|
|
71
|
-
AppendOnlyTreeSnapshot.fromViem(stateReference.nullifierTree),
|
|
72
|
-
AppendOnlyTreeSnapshot.fromViem(stateReference.publicDataTree),
|
|
73
|
-
);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
67
|
static random(): PartialStateReference {
|
|
77
68
|
return new PartialStateReference(
|
|
78
69
|
AppendOnlyTreeSnapshot.random(),
|
|
@@ -81,14 +72,6 @@ export class PartialStateReference {
|
|
|
81
72
|
);
|
|
82
73
|
}
|
|
83
74
|
|
|
84
|
-
toViem(): ViemPartialStateReference {
|
|
85
|
-
return {
|
|
86
|
-
noteHashTree: this.noteHashTree.toViem(),
|
|
87
|
-
nullifierTree: this.nullifierTree.toViem(),
|
|
88
|
-
publicDataTree: this.publicDataTree.toViem(),
|
|
89
|
-
};
|
|
90
|
-
}
|
|
91
|
-
|
|
92
75
|
toAbi(): [
|
|
93
76
|
ReturnType<AppendOnlyTreeSnapshot['toAbi']>,
|
|
94
77
|
ReturnType<AppendOnlyTreeSnapshot['toAbi']>,
|
|
@@ -4,7 +4,6 @@ import {
|
|
|
4
4
|
NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP,
|
|
5
5
|
STATE_REFERENCE_LENGTH,
|
|
6
6
|
} from '@aztec/constants';
|
|
7
|
-
import type { ViemStateReference } from '@aztec/ethereum';
|
|
8
7
|
import type { Fr } from '@aztec/foundation/fields';
|
|
9
8
|
import { BufferReader, FieldReader, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
10
9
|
import type { FieldsOf } from '@aztec/foundation/types';
|
|
@@ -76,13 +75,6 @@ export class StateReference {
|
|
|
76
75
|
return new StateReference(l1ToL2MessageTree, partial);
|
|
77
76
|
}
|
|
78
77
|
|
|
79
|
-
static fromViem(stateReference: ViemStateReference) {
|
|
80
|
-
return new StateReference(
|
|
81
|
-
AppendOnlyTreeSnapshot.fromViem(stateReference.l1ToL2MessageTree),
|
|
82
|
-
PartialStateReference.fromViem(stateReference.partialStateReference),
|
|
83
|
-
);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
78
|
static empty(): StateReference {
|
|
87
79
|
return new StateReference(AppendOnlyTreeSnapshot.empty(), PartialStateReference.empty());
|
|
88
80
|
}
|
|
@@ -91,13 +83,6 @@ export class StateReference {
|
|
|
91
83
|
return new StateReference(AppendOnlyTreeSnapshot.random(), PartialStateReference.random());
|
|
92
84
|
}
|
|
93
85
|
|
|
94
|
-
toViem(): ViemStateReference {
|
|
95
|
-
return {
|
|
96
|
-
l1ToL2MessageTree: this.l1ToL2MessageTree.toViem(),
|
|
97
|
-
partialStateReference: this.partial.toViem(),
|
|
98
|
-
};
|
|
99
|
-
}
|
|
100
|
-
|
|
101
86
|
toAbi(): [ReturnType<AppendOnlyTreeSnapshot['toAbi']>, ReturnType<PartialStateReference['toAbi']>] {
|
|
102
87
|
return [this.l1ToL2MessageTree.toAbi(), [...this.partial.toAbi()]];
|
|
103
88
|
}
|
package/src/tx/tx.ts
CHANGED
|
@@ -300,8 +300,9 @@ export class Tx extends Gossipable {
|
|
|
300
300
|
}
|
|
301
301
|
|
|
302
302
|
/** Recomputes the tx hash. Used for testing purposes only when a property of the tx was mutated. */
|
|
303
|
-
public async recomputeHash() {
|
|
303
|
+
public async recomputeHash(): Promise<TxHash> {
|
|
304
304
|
(this as any).txHash = await Tx.computeTxHash(this);
|
|
305
|
+
return this.txHash;
|
|
305
306
|
}
|
|
306
307
|
|
|
307
308
|
#combinePublicCallRequestWithCallData(request: PublicCallRequest) {
|
package/src/validators/errors.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import type { SlotNumber } from '@aztec/foundation/branded-types';
|
|
1
2
|
import type { Fr } from '@aztec/foundation/fields';
|
|
2
|
-
import type {
|
|
3
|
+
import type { TxHash } from '@aztec/stdlib/tx';
|
|
3
4
|
|
|
4
5
|
export class ValidatorError extends Error {
|
|
5
6
|
constructor(message: string) {
|
|
@@ -17,7 +18,7 @@ export class AttestationTimeoutError extends ValidatorError {
|
|
|
17
18
|
constructor(
|
|
18
19
|
public readonly collectedCount: number,
|
|
19
20
|
public readonly requiredCount: number,
|
|
20
|
-
public readonly slot:
|
|
21
|
+
public readonly slot: SlotNumber,
|
|
21
22
|
) {
|
|
22
23
|
super(`Timeout collecting attestations for slot ${slot}: ${collectedCount}/${requiredCount}`);
|
|
23
24
|
}
|
|
@@ -39,8 +40,6 @@ export class ReExStateMismatchError extends ValidatorError {
|
|
|
39
40
|
constructor(
|
|
40
41
|
public readonly expectedArchiveRoot: Fr,
|
|
41
42
|
public readonly actualArchiveRoot: Fr,
|
|
42
|
-
public readonly expectedStateReference?: StateReference,
|
|
43
|
-
public readonly actualStateReference?: StateReference,
|
|
44
43
|
) {
|
|
45
44
|
super('Re-execution state mismatch');
|
|
46
45
|
}
|
|
@@ -21,7 +21,7 @@ export const ValidatorStatusInSlotSchema = z.enum([
|
|
|
21
21
|
|
|
22
22
|
export const ValidatorStatusHistorySchema = z.array(
|
|
23
23
|
z.object({
|
|
24
|
-
slot: schemas.
|
|
24
|
+
slot: schemas.SlotNumber,
|
|
25
25
|
status: ValidatorStatusInSlotSchema,
|
|
26
26
|
}),
|
|
27
27
|
) satisfies ZodFor<ValidatorStatusHistory>;
|
|
@@ -32,7 +32,7 @@ export const ValidatorStatusHistorySchemaMap = z.record(ValidatorStatusHistorySc
|
|
|
32
32
|
|
|
33
33
|
const ValidatorTimeStatSchema = z.object({
|
|
34
34
|
timestamp: schemas.BigInt,
|
|
35
|
-
slot: schemas.
|
|
35
|
+
slot: schemas.SlotNumber,
|
|
36
36
|
date: z.string(),
|
|
37
37
|
});
|
|
38
38
|
|
|
@@ -55,8 +55,8 @@ export const ValidatorStatsSchema = z.object({
|
|
|
55
55
|
|
|
56
56
|
export const ValidatorsStatsSchema = z.object({
|
|
57
57
|
stats: z.record(ValidatorStatsSchema),
|
|
58
|
-
lastProcessedSlot: schemas.
|
|
59
|
-
initialSlot: schemas.
|
|
58
|
+
lastProcessedSlot: schemas.SlotNumber.optional(),
|
|
59
|
+
initialSlot: schemas.SlotNumber.optional(),
|
|
60
60
|
slotWindow: schemas.Integer,
|
|
61
61
|
}) satisfies ZodFor<ValidatorsStats>;
|
|
62
62
|
|
|
@@ -69,7 +69,7 @@ export const SingleValidatorStatsSchema = z.object({
|
|
|
69
69
|
epoch: schemas.EpochNumber,
|
|
70
70
|
}),
|
|
71
71
|
),
|
|
72
|
-
lastProcessedSlot: schemas.
|
|
73
|
-
initialSlot: schemas.
|
|
72
|
+
lastProcessedSlot: schemas.SlotNumber.optional(),
|
|
73
|
+
initialSlot: schemas.SlotNumber.optional(),
|
|
74
74
|
slotWindow: schemas.Integer,
|
|
75
75
|
}) satisfies ZodFor<SingleValidatorStats>;
|
package/src/validators/types.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { EpochNumber } from '@aztec/foundation/branded-types';
|
|
1
|
+
import type { EpochNumber, SlotNumber } from '@aztec/foundation/branded-types';
|
|
2
2
|
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
3
3
|
|
|
4
4
|
export type ValidatorStatusType = 'block' | 'attestation';
|
|
@@ -10,7 +10,7 @@ export type ValidatorStatusInSlot =
|
|
|
10
10
|
| 'attestation-sent'
|
|
11
11
|
| 'attestation-missed';
|
|
12
12
|
|
|
13
|
-
export type ValidatorStatusHistory = { slot:
|
|
13
|
+
export type ValidatorStatusHistory = { slot: SlotNumber; status: ValidatorStatusInSlot }[];
|
|
14
14
|
|
|
15
15
|
export type ValidatorMissedStats = {
|
|
16
16
|
currentStreak: number;
|
|
@@ -21,8 +21,8 @@ export type ValidatorMissedStats = {
|
|
|
21
21
|
|
|
22
22
|
export type ValidatorStats = {
|
|
23
23
|
address: EthAddress;
|
|
24
|
-
lastProposal?: { timestamp: bigint; slot:
|
|
25
|
-
lastAttestation?: { timestamp: bigint; slot:
|
|
24
|
+
lastProposal?: { timestamp: bigint; slot: SlotNumber; date: string };
|
|
25
|
+
lastAttestation?: { timestamp: bigint; slot: SlotNumber; date: string };
|
|
26
26
|
totalSlots: number;
|
|
27
27
|
missedProposals: ValidatorMissedStats;
|
|
28
28
|
missedAttestations: ValidatorMissedStats;
|
|
@@ -31,8 +31,8 @@ export type ValidatorStats = {
|
|
|
31
31
|
|
|
32
32
|
export type ValidatorsStats = {
|
|
33
33
|
stats: Record<string, ValidatorStats>;
|
|
34
|
-
lastProcessedSlot?:
|
|
35
|
-
initialSlot?:
|
|
34
|
+
lastProcessedSlot?: SlotNumber;
|
|
35
|
+
initialSlot?: SlotNumber;
|
|
36
36
|
slotWindow: number;
|
|
37
37
|
};
|
|
38
38
|
|
|
@@ -41,7 +41,7 @@ export type ValidatorsEpochPerformance = Record<`0x${string}`, { missed: number;
|
|
|
41
41
|
export type SingleValidatorStats = {
|
|
42
42
|
validator: ValidatorStats;
|
|
43
43
|
allTimeProvenPerformance: { missed: number; total: number; epoch: EpochNumber }[];
|
|
44
|
-
lastProcessedSlot?:
|
|
45
|
-
initialSlot?:
|
|
44
|
+
lastProcessedSlot?: SlotNumber;
|
|
45
|
+
initialSlot?: SlotNumber;
|
|
46
46
|
slotWindow: number;
|
|
47
47
|
};
|