@aztec/stdlib 3.0.0-nightly.20251128 → 3.0.0-nightly.20251201.2
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/l2_block.d.ts +3 -2
- package/dest/block/l2_block.d.ts.map +1 -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/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 +8 -2
- 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/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/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/l2_block.ts +2 -1
- 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/epoch-helpers/index.ts +19 -14
- package/src/interfaces/archiver.ts +1 -1
- package/src/interfaces/aztec-node.ts +12 -3
- 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/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/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
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ViemHeader } from '@aztec/ethereum';
|
|
2
|
+
import { SlotNumber } from '@aztec/foundation/branded-types';
|
|
2
3
|
import { sha256ToField } from '@aztec/foundation/crypto';
|
|
3
4
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
4
5
|
import { Fr } from '@aztec/foundation/fields';
|
|
@@ -25,7 +26,7 @@ export class CheckpointHeader {
|
|
|
25
26
|
/** Content commitment of the L2 block. */
|
|
26
27
|
public contentCommitment: ContentCommitment,
|
|
27
28
|
/** Slot number of the L2 block */
|
|
28
|
-
public slotNumber:
|
|
29
|
+
public slotNumber: SlotNumber,
|
|
29
30
|
/** Timestamp of the L2 block. */
|
|
30
31
|
public timestamp: UInt64,
|
|
31
32
|
/** Recipient of block reward. */
|
|
@@ -44,7 +45,7 @@ export class CheckpointHeader {
|
|
|
44
45
|
lastArchiveRoot: schemas.Fr,
|
|
45
46
|
blockHeadersHash: schemas.Fr,
|
|
46
47
|
contentCommitment: ContentCommitment.schema,
|
|
47
|
-
slotNumber: schemas.
|
|
48
|
+
slotNumber: schemas.SlotNumber,
|
|
48
49
|
timestamp: schemas.BigInt,
|
|
49
50
|
coinbase: schemas.EthAddress,
|
|
50
51
|
feeRecipient: schemas.AztecAddress,
|
|
@@ -79,7 +80,7 @@ export class CheckpointHeader {
|
|
|
79
80
|
reader.readObject(Fr),
|
|
80
81
|
reader.readObject(Fr),
|
|
81
82
|
reader.readObject(ContentCommitment),
|
|
82
|
-
Fr.fromBuffer(reader),
|
|
83
|
+
SlotNumber(Fr.fromBuffer(reader).toNumber()),
|
|
83
84
|
reader.readUInt64(),
|
|
84
85
|
reader.readObject(EthAddress),
|
|
85
86
|
reader.readObject(AztecAddress),
|
|
@@ -93,7 +94,7 @@ export class CheckpointHeader {
|
|
|
93
94
|
this.lastArchiveRoot.equals(other.lastArchiveRoot) &&
|
|
94
95
|
this.blockHeadersHash.equals(other.blockHeadersHash) &&
|
|
95
96
|
this.contentCommitment.equals(other.contentCommitment) &&
|
|
96
|
-
this.slotNumber
|
|
97
|
+
this.slotNumber === other.slotNumber &&
|
|
97
98
|
this.timestamp === other.timestamp &&
|
|
98
99
|
this.coinbase.equals(other.coinbase) &&
|
|
99
100
|
this.feeRecipient.equals(other.feeRecipient) &&
|
|
@@ -108,7 +109,7 @@ export class CheckpointHeader {
|
|
|
108
109
|
this.lastArchiveRoot,
|
|
109
110
|
this.blockHeadersHash,
|
|
110
111
|
this.contentCommitment,
|
|
111
|
-
this.slotNumber,
|
|
112
|
+
new Fr(this.slotNumber),
|
|
112
113
|
bigintToUInt64BE(this.timestamp),
|
|
113
114
|
this.coinbase,
|
|
114
115
|
this.feeRecipient,
|
|
@@ -126,7 +127,7 @@ export class CheckpointHeader {
|
|
|
126
127
|
lastArchiveRoot: Fr.ZERO,
|
|
127
128
|
blockHeadersHash: Fr.ZERO,
|
|
128
129
|
contentCommitment: ContentCommitment.empty(),
|
|
129
|
-
slotNumber:
|
|
130
|
+
slotNumber: SlotNumber.ZERO,
|
|
130
131
|
timestamp: 0n,
|
|
131
132
|
coinbase: EthAddress.ZERO,
|
|
132
133
|
feeRecipient: AztecAddress.ZERO,
|
|
@@ -141,7 +142,7 @@ export class CheckpointHeader {
|
|
|
141
142
|
lastArchiveRoot: Fr.random(),
|
|
142
143
|
blockHeadersHash: Fr.random(),
|
|
143
144
|
contentCommitment: ContentCommitment.random(),
|
|
144
|
-
slotNumber:
|
|
145
|
+
slotNumber: SlotNumber(Math.floor(Math.random() * 1000) + 1),
|
|
145
146
|
timestamp: BigInt(Math.floor(Date.now() / 1000)),
|
|
146
147
|
coinbase: EthAddress.random(),
|
|
147
148
|
feeRecipient: new AztecAddress(Fr.random()),
|
|
@@ -156,7 +157,7 @@ export class CheckpointHeader {
|
|
|
156
157
|
this.lastArchiveRoot.isZero() &&
|
|
157
158
|
this.blockHeadersHash.isZero() &&
|
|
158
159
|
this.contentCommitment.isEmpty() &&
|
|
159
|
-
this.slotNumber
|
|
160
|
+
this.slotNumber === 0 &&
|
|
160
161
|
this.timestamp === 0n &&
|
|
161
162
|
this.coinbase.isZero() &&
|
|
162
163
|
this.feeRecipient.isZero() &&
|
|
@@ -182,7 +183,7 @@ export class CheckpointHeader {
|
|
|
182
183
|
Fr.fromString(header.lastArchiveRoot),
|
|
183
184
|
Fr.fromString(header.blockHeadersHash),
|
|
184
185
|
ContentCommitment.fromViem(header.contentCommitment),
|
|
185
|
-
|
|
186
|
+
SlotNumber.fromBigInt(header.slotNumber),
|
|
186
187
|
header.timestamp,
|
|
187
188
|
new EthAddress(hexToBuffer(header.coinbase)),
|
|
188
189
|
new AztecAddress(hexToBuffer(header.feeRecipient)),
|
|
@@ -191,12 +192,20 @@ export class CheckpointHeader {
|
|
|
191
192
|
);
|
|
192
193
|
}
|
|
193
194
|
|
|
195
|
+
/**
|
|
196
|
+
* Returns the slot number as a SlotNumber branded type.
|
|
197
|
+
* @deprecated Use slotNumber directly instead.
|
|
198
|
+
*/
|
|
199
|
+
getSlotNumber(): SlotNumber {
|
|
200
|
+
return this.slotNumber;
|
|
201
|
+
}
|
|
202
|
+
|
|
194
203
|
toViem(): ViemHeader {
|
|
195
204
|
return {
|
|
196
205
|
lastArchiveRoot: this.lastArchiveRoot.toString(),
|
|
197
206
|
blockHeadersHash: this.blockHeadersHash.toString(),
|
|
198
207
|
contentCommitment: this.contentCommitment.toViem(),
|
|
199
|
-
slotNumber: this.slotNumber
|
|
208
|
+
slotNumber: BigInt(this.slotNumber),
|
|
200
209
|
timestamp: this.timestamp,
|
|
201
210
|
coinbase: this.coinbase.toString(),
|
|
202
211
|
feeRecipient: `0x${this.feeRecipient.toBuffer().toString('hex').padStart(64, '0')}`,
|
|
@@ -213,7 +222,7 @@ export class CheckpointHeader {
|
|
|
213
222
|
lastArchive: this.lastArchiveRoot.toString(),
|
|
214
223
|
blockHeadersHash: this.blockHeadersHash.toString(),
|
|
215
224
|
contentCommitment: this.contentCommitment.toInspect(),
|
|
216
|
-
slotNumber: this.slotNumber
|
|
225
|
+
slotNumber: this.slotNumber,
|
|
217
226
|
timestamp: this.timestamp,
|
|
218
227
|
coinbase: this.coinbase.toString(),
|
|
219
228
|
feeRecipient: this.feeRecipient.toString(),
|
|
@@ -228,7 +237,7 @@ export class CheckpointHeader {
|
|
|
228
237
|
lastArchiveRoot: ${this.lastArchiveRoot.toString()},
|
|
229
238
|
blockHeadersHash: ${this.blockHeadersHash.toString()},
|
|
230
239
|
contentCommitment: ${inspect(this.contentCommitment)},
|
|
231
|
-
slotNumber: ${this.slotNumber
|
|
240
|
+
slotNumber: ${this.slotNumber},
|
|
232
241
|
timestamp: ${this.timestamp},
|
|
233
242
|
coinbase: ${this.coinbase.toString()},
|
|
234
243
|
feeRecipient: ${this.feeRecipient.toString()},
|
package/src/schemas/schemas.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { EpochNumber, SlotNumber } from '@aztec/foundation/branded-types';
|
|
1
2
|
import type { Buffer32 } from '@aztec/foundation/buffer';
|
|
2
3
|
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
3
4
|
import type { Fq, Fr, Point } from '@aztec/foundation/fields';
|
|
@@ -65,6 +66,12 @@ export const schemas = {
|
|
|
65
66
|
/** Accepts a hex string. */
|
|
66
67
|
EventSelector: EventSelector.schema,
|
|
67
68
|
|
|
69
|
+
/** Accepts a number, bigint, or string and coerces to SlotNumber. */
|
|
70
|
+
SlotNumber: foundationSchemas.SlotNumber as ZodFor<SlotNumber>,
|
|
71
|
+
|
|
72
|
+
/** Accepts a number, bigint, or string and coerces to EpochNumber. */
|
|
73
|
+
EpochNumber: foundationSchemas.EpochNumber as ZodFor<EpochNumber>,
|
|
74
|
+
|
|
68
75
|
GasUsed: z.object({
|
|
69
76
|
totalGas: Gas.schema,
|
|
70
77
|
teardownGas: Gas.schema,
|
package/src/slashing/empire.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EpochNumber } from '@aztec/foundation/branded-types';
|
|
1
|
+
import { EpochNumber, SlotNumber } from '@aztec/foundation/branded-types';
|
|
2
2
|
|
|
3
3
|
import { getRoundForSlot, getRoundsForEpoch } from './helpers.js';
|
|
4
4
|
import type { Offense, OffenseIdentifier, SlashPayload, SlashPayloadRound, ValidatorSlash } from './types.js';
|
|
@@ -85,7 +85,7 @@ export function getFirstEligibleRoundForOffense(
|
|
|
85
85
|
case OffenseType.ATTESTED_DESCENDANT_OF_INVALID:
|
|
86
86
|
case OffenseType.BROADCASTED_INVALID_BLOCK_PROPOSAL: {
|
|
87
87
|
const slot = offense.epochOrSlot;
|
|
88
|
-
const detectedSlot = slot + 1n;
|
|
88
|
+
const detectedSlot = SlotNumber.fromBigInt(slot + 1n);
|
|
89
89
|
return getRoundForSlot(detectedSlot, constants).round + 1n;
|
|
90
90
|
}
|
|
91
91
|
// Assume these are epoch-based offenses, even though we should never have to process these
|
package/src/slashing/helpers.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EpochNumber } from '@aztec/foundation/branded-types';
|
|
1
|
+
import { EpochNumber, SlotNumber } from '@aztec/foundation/branded-types';
|
|
2
2
|
|
|
3
3
|
import { type L1RollupConstants, getEpochAtSlot, getSlotRangeForEpoch } from '../epoch-helpers/index.js';
|
|
4
4
|
import type { SlasherConfig } from '../interfaces/slasher.js';
|
|
@@ -6,12 +6,13 @@ import { type Offense, OffenseType } from './types.js';
|
|
|
6
6
|
|
|
7
7
|
/** Returns the voting round number and voting slot within the round for a given L2 slot. */
|
|
8
8
|
export function getRoundForSlot(
|
|
9
|
-
slot:
|
|
9
|
+
slot: SlotNumber,
|
|
10
10
|
constants: { slashingRoundSize: number },
|
|
11
|
-
): { round: bigint; votingSlot:
|
|
11
|
+
): { round: bigint; votingSlot: SlotNumber } {
|
|
12
12
|
const roundSize = BigInt(constants.slashingRoundSize);
|
|
13
|
-
const
|
|
14
|
-
const
|
|
13
|
+
const slotBigInt = BigInt(slot);
|
|
14
|
+
const round = slotBigInt / roundSize;
|
|
15
|
+
const votingSlot = SlotNumber.fromBigInt(slotBigInt % roundSize);
|
|
15
16
|
return { round, votingSlot };
|
|
16
17
|
}
|
|
17
18
|
|
|
@@ -32,8 +33,8 @@ export function getEpochsForRound(
|
|
|
32
33
|
constants: { slashingRoundSize: number; epochDuration: number },
|
|
33
34
|
): EpochNumber[] {
|
|
34
35
|
const epochs: EpochNumber[] = [];
|
|
35
|
-
const firstSlot = round * BigInt(constants.slashingRoundSize);
|
|
36
|
-
const lastSlot = firstSlot +
|
|
36
|
+
const firstSlot = SlotNumber.fromBigInt(round * BigInt(constants.slashingRoundSize));
|
|
37
|
+
const lastSlot = SlotNumber(firstSlot + constants.slashingRoundSize - 1);
|
|
37
38
|
const startEpoch = getEpochAtSlot(firstSlot, constants);
|
|
38
39
|
const endEpoch = getEpochAtSlot(lastSlot, constants);
|
|
39
40
|
for (let epoch = startEpoch; epoch <= endEpoch; epoch = EpochNumber(epoch + 1)) {
|
|
@@ -103,9 +104,11 @@ export function getTimeUnitForOffense(offense: OffenseType): 'epoch' | 'slot' {
|
|
|
103
104
|
export function getSlotForOffense(
|
|
104
105
|
offense: Pick<Offense, 'epochOrSlot' | 'offenseType'>,
|
|
105
106
|
constants: Pick<L1RollupConstants, 'epochDuration'>,
|
|
106
|
-
):
|
|
107
|
+
): SlotNumber {
|
|
107
108
|
const { epochOrSlot, offenseType } = offense;
|
|
108
|
-
return getTimeUnitForOffense(offenseType) === 'epoch'
|
|
109
|
+
return getTimeUnitForOffense(offenseType) === 'epoch'
|
|
110
|
+
? SlotNumber.fromBigInt(epochOrSlot * BigInt(constants.epochDuration))
|
|
111
|
+
: SlotNumber.fromBigInt(epochOrSlot);
|
|
109
112
|
}
|
|
110
113
|
|
|
111
114
|
/** Returns the epoch for a given offense. If the offense type or epoch is not defined, returns undefined. */
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { SlotNumber } from '@aztec/foundation/branded-types';
|
|
2
|
+
|
|
1
3
|
import type { ProposerSlashAction } from './types.js';
|
|
2
4
|
|
|
3
5
|
export interface ProposerSlashActionProvider {
|
|
@@ -7,5 +9,5 @@ export interface ProposerSlashActionProvider {
|
|
|
7
9
|
* @param slotNumber - The current slot number
|
|
8
10
|
* @returns The actions to take
|
|
9
11
|
*/
|
|
10
|
-
getProposerActions(slotNumber:
|
|
12
|
+
getProposerActions(slotNumber: SlotNumber): Promise<ProposerSlashAction[]>;
|
|
11
13
|
}
|
package/src/tests/factories.ts
CHANGED
|
@@ -43,6 +43,7 @@ import {
|
|
|
43
43
|
VK_TREE_HEIGHT,
|
|
44
44
|
} from '@aztec/constants';
|
|
45
45
|
import { type FieldsOf, makeTuple } from '@aztec/foundation/array';
|
|
46
|
+
import { SlotNumber } from '@aztec/foundation/branded-types';
|
|
46
47
|
import { compact } from '@aztec/foundation/collection';
|
|
47
48
|
import { Grumpkin, SchnorrSignature, poseidon2HashWithSeparator, sha256 } from '@aztec/foundation/crypto';
|
|
48
49
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
@@ -694,7 +695,7 @@ export function makeGlobalVariables(seed = 1, overrides: Partial<FieldsOf<Global
|
|
|
694
695
|
chainId: new Fr(seed),
|
|
695
696
|
version: new Fr(seed + 1),
|
|
696
697
|
blockNumber: seed + 2,
|
|
697
|
-
slotNumber:
|
|
698
|
+
slotNumber: SlotNumber(seed + 3),
|
|
698
699
|
timestamp: BigInt(seed + 4),
|
|
699
700
|
coinbase: EthAddress.fromField(new Fr(seed + 5)),
|
|
700
701
|
feeRecipient: AztecAddress.fromField(new Fr(seed + 6)),
|
|
@@ -775,7 +776,7 @@ function makeCheckpointConstantData(seed = 1) {
|
|
|
775
776
|
fr(seed + 2),
|
|
776
777
|
fr(seed + 3),
|
|
777
778
|
fr(seed + 4),
|
|
778
|
-
|
|
779
|
+
SlotNumber(seed + 5),
|
|
779
780
|
makeEthAddress(seed + 6),
|
|
780
781
|
makeAztecAddress(seed + 7),
|
|
781
782
|
makeGasFees(seed + 8),
|
|
@@ -916,7 +917,7 @@ export function makeL2BlockHeader(
|
|
|
916
917
|
overrides?.state ?? makeStateReference(seed + 0x600),
|
|
917
918
|
makeGlobalVariables((seed += 0x700), {
|
|
918
919
|
...(blockNumber ? { blockNumber } : {}),
|
|
919
|
-
...(slotNumber ? { slotNumber:
|
|
920
|
+
...(slotNumber ? { slotNumber: SlotNumber(slotNumber) } : {}),
|
|
920
921
|
}),
|
|
921
922
|
new Fr(seed + 0x800),
|
|
922
923
|
new Fr(seed + 0x900),
|
|
@@ -930,7 +931,7 @@ export function makeCheckpointHeader(seed = 0) {
|
|
|
930
931
|
lastArchiveRoot: fr(seed + 0x100),
|
|
931
932
|
blockHeadersHash: fr(seed + 0x150),
|
|
932
933
|
contentCommitment: makeContentCommitment(seed + 0x200),
|
|
933
|
-
slotNumber:
|
|
934
|
+
slotNumber: SlotNumber(seed + 0x300),
|
|
934
935
|
timestamp: BigInt(seed + 0x400),
|
|
935
936
|
coinbase: makeEthAddress(seed + 0x500),
|
|
936
937
|
feeRecipient: makeAztecAddress(seed + 0x600),
|
package/src/tests/mocks.ts
CHANGED
|
@@ -56,7 +56,6 @@ import {
|
|
|
56
56
|
PrivateCallExecutionResult,
|
|
57
57
|
PrivateExecutionResult,
|
|
58
58
|
ProtocolContracts,
|
|
59
|
-
StateReference,
|
|
60
59
|
Tx,
|
|
61
60
|
TxConstantData,
|
|
62
61
|
makeProcessedTxFromPrivateOnlyTx,
|
|
@@ -408,7 +407,6 @@ export interface MakeConsensusPayloadOptions {
|
|
|
408
407
|
proposerSigner?: Secp256k1Signer;
|
|
409
408
|
header?: L2BlockHeader;
|
|
410
409
|
archive?: Fr;
|
|
411
|
-
stateReference?: StateReference;
|
|
412
410
|
txHashes?: TxHash[];
|
|
413
411
|
txs?: Tx[];
|
|
414
412
|
}
|
|
@@ -418,12 +416,11 @@ const makeAndSignConsensusPayload = (
|
|
|
418
416
|
options?: MakeConsensusPayloadOptions,
|
|
419
417
|
) => {
|
|
420
418
|
const header = options?.header ?? makeL2BlockHeader(1);
|
|
421
|
-
const { signer = Secp256k1Signer.random(), archive = Fr.random()
|
|
419
|
+
const { signer = Secp256k1Signer.random(), archive = Fr.random() } = options ?? {};
|
|
422
420
|
|
|
423
421
|
const payload = ConsensusPayload.fromFields({
|
|
424
422
|
header: header.toCheckpointHeader(),
|
|
425
423
|
archive,
|
|
426
|
-
stateReference,
|
|
427
424
|
});
|
|
428
425
|
|
|
429
426
|
const hash = getHashedSignaturePayloadEthSignedMessage(payload, domainSeparator);
|
|
@@ -452,18 +449,11 @@ export const makeBlockProposal = (options?: MakeConsensusPayloadOptions): BlockP
|
|
|
452
449
|
// TODO(https://github.com/AztecProtocol/aztec-packages/issues/8028)
|
|
453
450
|
export const makeBlockAttestation = (options: MakeConsensusPayloadOptions = {}): BlockAttestation => {
|
|
454
451
|
const header = options.header ?? makeL2BlockHeader(1);
|
|
455
|
-
const {
|
|
456
|
-
signer,
|
|
457
|
-
attesterSigner = signer,
|
|
458
|
-
proposerSigner = signer,
|
|
459
|
-
archive = Fr.random(),
|
|
460
|
-
stateReference = header.state,
|
|
461
|
-
} = options;
|
|
452
|
+
const { signer, attesterSigner = signer, proposerSigner = signer, archive = Fr.random() } = options;
|
|
462
453
|
|
|
463
454
|
const payload = ConsensusPayload.fromFields({
|
|
464
455
|
header: header.toCheckpointHeader(),
|
|
465
456
|
archive,
|
|
466
|
-
stateReference,
|
|
467
457
|
});
|
|
468
458
|
|
|
469
459
|
return makeBlockAttestationFromPayload(payload, attesterSigner, proposerSigner);
|
|
@@ -476,12 +466,10 @@ export const makeAttestationFromCheckpoint = (
|
|
|
476
466
|
): BlockAttestation => {
|
|
477
467
|
const header = checkpoint.header;
|
|
478
468
|
const archive = checkpoint.archive.root;
|
|
479
|
-
const stateReference = checkpoint.blocks.at(-1)!.header.state;
|
|
480
469
|
|
|
481
470
|
const payload = ConsensusPayload.fromFields({
|
|
482
471
|
header,
|
|
483
472
|
archive,
|
|
484
|
-
stateReference,
|
|
485
473
|
});
|
|
486
474
|
|
|
487
475
|
return makeBlockAttestationFromPayload(payload, attesterSigner, proposerSigner);
|
|
@@ -494,12 +482,10 @@ export const makeBlockAttestationFromBlock = (
|
|
|
494
482
|
): BlockAttestation => {
|
|
495
483
|
const header = block.header;
|
|
496
484
|
const archive = block.archive.root;
|
|
497
|
-
const stateReference = block.header.state;
|
|
498
485
|
|
|
499
486
|
const payload = ConsensusPayload.fromFields({
|
|
500
487
|
header: header.toCheckpointHeader(),
|
|
501
488
|
archive,
|
|
502
|
-
stateReference,
|
|
503
489
|
});
|
|
504
490
|
|
|
505
491
|
return makeBlockAttestationFromPayload(payload, attesterSigner, proposerSigner);
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { ViemAppendOnlyTreeSnapshot } from '@aztec/ethereum';
|
|
2
1
|
import { Fr } from '@aztec/foundation/fields';
|
|
3
2
|
import { schemas } from '@aztec/foundation/schemas';
|
|
4
3
|
import { BufferReader, FieldReader, serializeToBuffer } from '@aztec/foundation/serialize';
|
|
@@ -72,17 +71,6 @@ export class AppendOnlyTreeSnapshot {
|
|
|
72
71
|
return new AppendOnlyTreeSnapshot(reader.readField(), Number(reader.readField().toBigInt()));
|
|
73
72
|
}
|
|
74
73
|
|
|
75
|
-
static fromViem(snapshot: ViemAppendOnlyTreeSnapshot) {
|
|
76
|
-
return new AppendOnlyTreeSnapshot(Fr.fromString(snapshot.root), snapshot.nextAvailableLeafIndex);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
toViem(): ViemAppendOnlyTreeSnapshot {
|
|
80
|
-
return {
|
|
81
|
-
root: this.root.toString(),
|
|
82
|
-
nextAvailableLeafIndex: this.nextAvailableLeafIndex,
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
|
|
86
74
|
toAbi(): [`0x${string}`, number] {
|
|
87
75
|
return [this.root.toString(), this.nextAvailableLeafIndex];
|
|
88
76
|
}
|
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) &&
|
|
@@ -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>;
|