@lodestar/types 1.45.0-dev.f535421f29 → 1.45.0-dev.f6c521a123

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.
@@ -1,28 +1,30 @@
1
1
  import {
2
2
  BitVectorType,
3
- ByteListType,
4
3
  ContainerType,
5
4
  ListBasicType,
6
5
  ListCompositeType,
6
+ ProgressiveBitListType,
7
+ ProgressiveByteListType,
8
+ ProgressiveContainerType,
9
+ ProgressiveListBasicType,
10
+ ProgressiveListCompositeType,
7
11
  VectorBasicType,
8
12
  VectorCompositeType,
9
13
  } from "@chainsafe/ssz";
10
14
  import {
11
- BUILDER_PENDING_WITHDRAWALS_LIMIT,
12
- BUILDER_REGISTRY_LIMIT,
15
+ CURRENT_SYNC_COMMITTEE_DEPTH_GLOAS,
16
+ EPOCHS_PER_SYNC_COMMITTEE_PERIOD,
17
+ EXECUTION_BLOCK_HASH_DEPTH_GLOAS,
18
+ FINALIZED_ROOT_DEPTH_GLOAS,
13
19
  HISTORICAL_ROOTS_LIMIT,
14
- MAX_BUILDER_DEPOSIT_REQUESTS_PER_PAYLOAD,
15
- MAX_BUILDER_EXIT_REQUESTS_PER_PAYLOAD,
16
- MAX_BYTES_PER_TRANSACTION,
17
- MAX_PAYLOAD_ATTESTATIONS,
18
20
  MIN_SEED_LOOKAHEAD,
21
+ NEXT_SYNC_COMMITTEE_DEPTH_GLOAS,
19
22
  NUMBER_OF_COLUMNS,
20
23
  PTC_SIZE,
21
24
  SLOTS_PER_EPOCH,
22
25
  SLOTS_PER_HISTORICAL_ROOT,
23
26
  } from "@lodestar/params";
24
27
  import {ssz as altairSsz} from "../altair/index.js";
25
- import {ssz as bellatrixSsz} from "../bellatrix/index.js";
26
28
  import {ssz as capellaSsz} from "../capella/index.js";
27
29
  import {ssz as denebSsz} from "../deneb/index.js";
28
30
  import {ssz as electraSsz} from "../electra/index.js";
@@ -48,38 +50,101 @@ const {
48
50
  Uint8,
49
51
  BuilderIndex,
50
52
  EpochInf,
53
+ ParticipationFlags,
51
54
  } = primitiveSsz;
52
55
 
53
- export const Builder = new ContainerType(
56
+ function activeFields(count: number): boolean[] {
57
+ return Array.from({length: count}, () => true);
58
+ }
59
+
60
+ export const ExecutionBranch = new VectorCompositeType(Bytes32, EXECUTION_BLOCK_HASH_DEPTH_GLOAS);
61
+
62
+ export const CurrentSyncCommitteeBranch = new VectorCompositeType(Bytes32, CURRENT_SYNC_COMMITTEE_DEPTH_GLOAS);
63
+
64
+ export const FinalityBranch = new VectorCompositeType(Bytes32, FINALIZED_ROOT_DEPTH_GLOAS);
65
+
66
+ export const NextSyncCommitteeBranch = new VectorCompositeType(Bytes32, NEXT_SYNC_COMMITTEE_DEPTH_GLOAS);
67
+
68
+ export const AggregationBits = new ProgressiveBitListType({typeName: "AggregationBits"});
69
+ export const AttestingIndices = new ProgressiveListBasicType(ValidatorIndex, {typeName: "AttestingIndices"});
70
+ export const Transaction = new ProgressiveByteListType({typeName: "Transaction"});
71
+ export const Transactions = new ProgressiveListCompositeType(Transaction, {typeName: "Transactions"});
72
+ export const Withdrawals = new ProgressiveListCompositeType(capellaSsz.Withdrawal, {typeName: "Withdrawals"});
73
+ export const BlobKzgCommitments = new ProgressiveListCompositeType(denebSsz.KZGCommitment, {
74
+ typeName: "BlobKzgCommitments",
75
+ });
76
+ export const KZGProofs = new ProgressiveListCompositeType(denebSsz.KZGProof, {typeName: "KZGProofs"});
77
+ export const DataColumn = new ProgressiveListCompositeType(fuluSsz.Cell, {typeName: "DataColumn"});
78
+
79
+ export const Attestation = new ProgressiveContainerType(
54
80
  {
55
- pubkey: BLSPubkey,
56
- version: Uint8,
57
- executionAddress: ExecutionAddress,
58
- balance: UintNum64,
59
- depositEpoch: EpochInf,
60
- withdrawableEpoch: EpochInf,
81
+ aggregationBits: AggregationBits,
82
+ data: phase0Ssz.AttestationData,
83
+ signature: BLSSignature,
84
+ committeeBits: electraSsz.CommitteeBits,
61
85
  },
62
- {typeName: "Builder", jsonCase: "eth2"}
86
+ activeFields(4),
87
+ {typeName: "Attestation", jsonCase: "eth2"}
63
88
  );
64
89
 
65
- export const BuilderPendingWithdrawal = new ContainerType(
90
+ export const IndexedAttestation = new ProgressiveContainerType(
66
91
  {
67
- feeRecipient: ExecutionAddress,
68
- amount: UintNum64,
69
- builderIndex: BuilderIndex,
92
+ attestingIndices: AttestingIndices,
93
+ data: phase0Ssz.AttestationData,
94
+ signature: BLSSignature,
70
95
  },
71
- {typeName: "BuilderPendingWithdrawal", jsonCase: "eth2"}
96
+ activeFields(3),
97
+ {typeName: "IndexedAttestation", jsonCase: "eth2"}
72
98
  );
73
99
 
74
- export const BuilderPendingPayment = new ContainerType(
100
+ /** Same as `IndexedAttestation` but epoch, slot and index are not bounded and must be a bigint */
101
+ export const IndexedAttestationBigint = new ProgressiveContainerType(
75
102
  {
76
- weight: UintNum64,
77
- withdrawal: BuilderPendingWithdrawal,
78
- proposerIndex: ValidatorIndex,
103
+ attestingIndices: AttestingIndices,
104
+ data: phase0Ssz.AttestationDataBigint,
105
+ signature: BLSSignature,
79
106
  },
80
- {typeName: "BuilderPendingPayment", jsonCase: "eth2"}
107
+ activeFields(3),
108
+ {typeName: "IndexedAttestation", jsonCase: "eth2"}
109
+ );
110
+
111
+ export const AttesterSlashing = new ContainerType(
112
+ {
113
+ attestation1: IndexedAttestationBigint,
114
+ attestation2: IndexedAttestationBigint,
115
+ },
116
+ {typeName: "AttesterSlashing", jsonCase: "eth2"}
117
+ );
118
+
119
+ export const AggregateAndProof = new ContainerType(
120
+ {
121
+ aggregatorIndex: ValidatorIndex,
122
+ aggregate: Attestation,
123
+ selectionProof: BLSSignature,
124
+ },
125
+ {typeName: "AggregateAndProof", jsonCase: "eth2", cachePermanentRootStruct: true}
126
+ );
127
+
128
+ export const SignedAggregateAndProof = new ContainerType(
129
+ {
130
+ message: AggregateAndProof,
131
+ signature: BLSSignature,
132
+ },
133
+ {typeName: "SignedAggregateAndProof", jsonCase: "eth2"}
81
134
  );
82
135
 
136
+ export const DepositRequest = electraSsz.DepositRequest;
137
+ export const DepositRequests = new ProgressiveListCompositeType(DepositRequest, {typeName: "DepositRequests"});
138
+ export const WithdrawalRequest = electraSsz.WithdrawalRequest;
139
+ export const WithdrawalRequests = new ProgressiveListCompositeType(WithdrawalRequest, {
140
+ typeName: "WithdrawalRequests",
141
+ });
142
+ export const ConsolidationRequest = electraSsz.ConsolidationRequest;
143
+ export const ConsolidationRequests = new ProgressiveListCompositeType(ConsolidationRequest, {
144
+ typeName: "ConsolidationRequests",
145
+ });
146
+
147
+ // New in GLOAS:EIP8282
83
148
  export const BuilderDepositRequest = new ContainerType(
84
149
  {
85
150
  pubkey: BLSPubkey,
@@ -89,12 +154,11 @@ export const BuilderDepositRequest = new ContainerType(
89
154
  },
90
155
  {typeName: "BuilderDepositRequest", jsonCase: "eth2"}
91
156
  );
157
+ export const BuilderDepositRequests = new ProgressiveListCompositeType(BuilderDepositRequest, {
158
+ typeName: "BuilderDepositRequests",
159
+ });
92
160
 
93
- export const BuilderDepositRequests = new ListCompositeType(
94
- BuilderDepositRequest,
95
- MAX_BUILDER_DEPOSIT_REQUESTS_PER_PAYLOAD
96
- );
97
-
161
+ // New in GLOAS:EIP8282
98
162
  export const BuilderExitRequest = new ContainerType(
99
163
  {
100
164
  sourceAddress: ExecutionAddress,
@@ -102,21 +166,88 @@ export const BuilderExitRequest = new ContainerType(
102
166
  },
103
167
  {typeName: "BuilderExitRequest", jsonCase: "eth2"}
104
168
  );
169
+ export const BuilderExitRequests = new ProgressiveListCompositeType(BuilderExitRequest, {
170
+ typeName: "BuilderExitRequests",
171
+ });
105
172
 
106
- export const BuilderExitRequests = new ListCompositeType(BuilderExitRequest, MAX_BUILDER_EXIT_REQUESTS_PER_PAYLOAD);
107
-
108
- // New in GLOAS:EIP8282 — extends electra ExecutionRequests with builder deposits and exits
109
- export const ExecutionRequests = new ContainerType(
173
+ export const ExecutionRequests = new ProgressiveContainerType(
110
174
  {
111
- deposits: electraSsz.DepositRequests,
112
- withdrawals: electraSsz.WithdrawalRequests,
113
- consolidations: electraSsz.ConsolidationRequests,
114
- builderDeposits: BuilderDepositRequests,
115
- builderExits: BuilderExitRequests,
175
+ deposits: DepositRequests,
176
+ withdrawals: WithdrawalRequests,
177
+ consolidations: ConsolidationRequests,
178
+ builderDeposits: BuilderDepositRequests, // New in GLOAS:EIP8282
179
+ builderExits: BuilderExitRequests, // New in GLOAS:EIP8282
116
180
  },
181
+ activeFields(5),
117
182
  {typeName: "ExecutionRequests", jsonCase: "eth2"}
118
183
  );
119
184
 
185
+ export const ProposerSlashings = new ProgressiveListCompositeType(phase0Ssz.ProposerSlashing, {
186
+ typeName: "ProposerSlashings",
187
+ });
188
+ export const AttesterSlashings = new ProgressiveListCompositeType(AttesterSlashing, {
189
+ typeName: "AttesterSlashings",
190
+ });
191
+ export const Attestations = new ProgressiveListCompositeType(Attestation, {typeName: "Attestations"});
192
+ export const Deposits = new ProgressiveListCompositeType(phase0Ssz.Deposit, {typeName: "Deposits"});
193
+ export const VoluntaryExits = new ProgressiveListCompositeType(phase0Ssz.SignedVoluntaryExit, {
194
+ typeName: "VoluntaryExits",
195
+ });
196
+ export const BlsToExecutionChanges = new ProgressiveListCompositeType(capellaSsz.SignedBLSToExecutionChange, {
197
+ typeName: "BLSToExecutionChanges",
198
+ });
199
+
200
+ export const Validators = new ProgressiveListCompositeType(phase0Ssz.Validator, {typeName: "Validators"});
201
+ export const Balances = new ProgressiveListBasicType(UintNum64, {typeName: "Balances"});
202
+ export const EpochParticipation = new ProgressiveListBasicType(ParticipationFlags, {
203
+ typeName: "EpochParticipation",
204
+ });
205
+ export const InactivityScores = new ProgressiveListBasicType(UintNum64, {typeName: "InactivityScores"});
206
+ export const PendingDeposits = new ProgressiveListCompositeType(electraSsz.PendingDeposit, {
207
+ typeName: "PendingDeposits",
208
+ });
209
+ export const PendingPartialWithdrawals = new ProgressiveListCompositeType(electraSsz.PendingPartialWithdrawal, {
210
+ typeName: "PendingPartialWithdrawals",
211
+ });
212
+ export const PendingConsolidations = new ProgressiveListCompositeType(electraSsz.PendingConsolidation, {
213
+ typeName: "PendingConsolidations",
214
+ });
215
+
216
+ export const Builder = new ContainerType(
217
+ {
218
+ pubkey: BLSPubkey,
219
+ version: Uint8,
220
+ executionAddress: ExecutionAddress,
221
+ balance: UintNum64,
222
+ depositEpoch: EpochInf,
223
+ withdrawableEpoch: EpochInf,
224
+ },
225
+ {typeName: "Builder", jsonCase: "eth2"}
226
+ );
227
+
228
+ export const BuilderPendingWithdrawal = new ContainerType(
229
+ {
230
+ feeRecipient: ExecutionAddress,
231
+ amount: UintNum64,
232
+ builderIndex: BuilderIndex,
233
+ },
234
+ {typeName: "BuilderPendingWithdrawal", jsonCase: "eth2"}
235
+ );
236
+
237
+ export const BuilderPendingPayment = new ContainerType(
238
+ {
239
+ weight: UintNum64,
240
+ withdrawal: BuilderPendingWithdrawal,
241
+ proposerIndex: ValidatorIndex,
242
+ },
243
+ {typeName: "BuilderPendingPayment", jsonCase: "eth2"}
244
+ );
245
+
246
+ export const Builders = new ProgressiveListCompositeType(Builder, {typeName: "Builders"});
247
+ export const BuilderPendingWithdrawals = new ProgressiveListCompositeType(BuilderPendingWithdrawal, {
248
+ typeName: "BuilderPendingWithdrawals",
249
+ });
250
+
120
251
  export const PayloadTimelinessCommittee = new VectorBasicType(ValidatorIndex, PTC_SIZE);
121
252
  export const PtcWindow = new VectorCompositeType(
122
253
  PayloadTimelinessCommittee,
@@ -133,15 +264,20 @@ export const PayloadAttestationData = new ContainerType(
133
264
  {typeName: "PayloadAttestationData", jsonCase: "eth2"}
134
265
  );
135
266
 
136
- export const PayloadAttestation = new ContainerType(
267
+ export const PayloadAttestation = new ProgressiveContainerType(
137
268
  {
138
269
  aggregationBits: new BitVectorType(PTC_SIZE),
139
270
  data: PayloadAttestationData,
140
271
  signature: BLSSignature,
141
272
  },
273
+ activeFields(3),
142
274
  {typeName: "PayloadAttestation", jsonCase: "eth2"}
143
275
  );
144
276
 
277
+ export const PayloadAttestations = new ProgressiveListCompositeType(PayloadAttestation, {
278
+ typeName: "PayloadAttestations",
279
+ });
280
+
145
281
  export const PayloadAttestationMessage = new ContainerType(
146
282
  {
147
283
  validatorIndex: ValidatorIndex,
@@ -151,12 +287,13 @@ export const PayloadAttestationMessage = new ContainerType(
151
287
  {typeName: "PayloadAttestationMessage", jsonCase: "eth2"}
152
288
  );
153
289
 
154
- export const IndexedPayloadAttestation = new ContainerType(
290
+ export const IndexedPayloadAttestation = new ProgressiveContainerType(
155
291
  {
156
292
  attestingIndices: new ListBasicType(ValidatorIndex, PTC_SIZE),
157
293
  data: PayloadAttestationData,
158
294
  signature: BLSSignature,
159
295
  },
296
+ activeFields(3),
160
297
  {typeName: "IndexedPayloadAttestation", jsonCase: "eth2"}
161
298
  );
162
299
 
@@ -179,7 +316,7 @@ export const SignedProposerPreferences = new ContainerType(
179
316
  {typeName: "SignedProposerPreferences", jsonCase: "eth2"}
180
317
  );
181
318
 
182
- export const ExecutionPayloadBid = new ContainerType(
319
+ export const ExecutionPayloadBid = new ProgressiveContainerType(
183
320
  {
184
321
  parentBlockHash: Bytes32,
185
322
  parentBlockRoot: Root,
@@ -191,9 +328,10 @@ export const ExecutionPayloadBid = new ContainerType(
191
328
  slot: Slot,
192
329
  value: UintNum64,
193
330
  executionPayment: UintNum64,
194
- blobKzgCommitments: denebSsz.BlobKzgCommitments,
331
+ blobKzgCommitments: BlobKzgCommitments,
195
332
  executionRequestsRoot: Root,
196
333
  },
334
+ activeFields(12),
197
335
  {typeName: "ExecutionPayloadBid", jsonCase: "eth2"}
198
336
  );
199
337
 
@@ -205,18 +343,21 @@ export const SignedExecutionPayloadBid = new ContainerType(
205
343
  {typeName: "SignedExecutionPayloadBid", jsonCase: "eth2"}
206
344
  );
207
345
 
208
- export const BlockAccessList = new ByteListType(MAX_BYTES_PER_TRANSACTION);
346
+ export const BlockAccessList = new ProgressiveByteListType({typeName: "BlockAccessList"});
209
347
 
210
- export const ExecutionPayload = new ContainerType(
348
+ export const ExecutionPayload = new ProgressiveContainerType(
211
349
  {
212
350
  ...electraSsz.ExecutionPayload.fields,
351
+ transactions: Transactions,
352
+ withdrawals: Withdrawals,
213
353
  blockAccessList: BlockAccessList, // New in GLOAS:EIP-7928
214
354
  slotNumber: Slot, // New in GLOAS:EIP-7843
215
355
  },
356
+ activeFields(19),
216
357
  {typeName: "ExecutionPayload", jsonCase: "eth2"}
217
358
  );
218
359
 
219
- export const ExecutionPayloadEnvelope = new ContainerType(
360
+ export const ExecutionPayloadEnvelope = new ProgressiveContainerType(
220
361
  {
221
362
  payload: ExecutionPayload,
222
363
  executionRequests: ExecutionRequests,
@@ -224,6 +365,7 @@ export const ExecutionPayloadEnvelope = new ContainerType(
224
365
  beaconBlockRoot: Root,
225
366
  parentBeaconBlockRoot: Root,
226
367
  },
368
+ activeFields(5),
227
369
  {typeName: "ExecutionPayloadEnvelope", jsonCase: "eth2"}
228
370
  );
229
371
 
@@ -235,25 +377,26 @@ export const SignedExecutionPayloadEnvelope = new ContainerType(
235
377
  {typeName: "SignedExecutionPayloadEnvelope", jsonCase: "eth2"}
236
378
  );
237
379
 
238
- export const BeaconBlockBody = new ContainerType(
380
+ export const BeaconBlockBody = new ProgressiveContainerType(
239
381
  {
240
382
  randaoReveal: phase0Ssz.BeaconBlockBody.fields.randaoReveal,
241
383
  eth1Data: phase0Ssz.BeaconBlockBody.fields.eth1Data,
242
384
  graffiti: phase0Ssz.BeaconBlockBody.fields.graffiti,
243
- proposerSlashings: phase0Ssz.BeaconBlockBody.fields.proposerSlashings,
244
- attesterSlashings: electraSsz.BeaconBlockBody.fields.attesterSlashings,
245
- attestations: electraSsz.BeaconBlockBody.fields.attestations,
246
- deposits: phase0Ssz.BeaconBlockBody.fields.deposits,
247
- voluntaryExits: phase0Ssz.BeaconBlockBody.fields.voluntaryExits,
385
+ proposerSlashings: ProposerSlashings,
386
+ attesterSlashings: AttesterSlashings,
387
+ attestations: Attestations,
388
+ deposits: Deposits,
389
+ voluntaryExits: VoluntaryExits,
248
390
  syncAggregate: altairSsz.BeaconBlockBody.fields.syncAggregate,
249
391
  // executionPayload: ExecutionPayload, // Removed in GLOAS:EIP7732
250
- blsToExecutionChanges: capellaSsz.BeaconBlockBody.fields.blsToExecutionChanges,
392
+ blsToExecutionChanges: BlsToExecutionChanges,
251
393
  // blobKzgCommitments: denebSsz.BeaconBlockBody.fields.blobKzgCommitments, // Removed in GLOAS:EIP7732
252
394
  // executionRequests: ExecutionRequests, // Removed in GLOAS:EIP7732
253
395
  signedExecutionPayloadBid: SignedExecutionPayloadBid, // New in GLOAS:EIP7732
254
- payloadAttestations: new ListCompositeType(PayloadAttestation, MAX_PAYLOAD_ATTESTATIONS), // New in GLOAS:EIP7732
396
+ payloadAttestations: PayloadAttestations, // New in GLOAS:EIP7732
255
397
  parentExecutionRequests: ExecutionRequests, // New in GLOAS:EIP7732
256
398
  },
399
+ activeFields(13),
257
400
  {typeName: "BeaconBlockBody", jsonCase: "eth2", cachePermanentRootStruct: true}
258
401
  );
259
402
 
@@ -273,7 +416,66 @@ export const SignedBeaconBlock = new ContainerType(
273
416
  {typeName: "SignedBeaconBlock", jsonCase: "eth2"}
274
417
  );
275
418
 
276
- export const BeaconState = new ContainerType(
419
+ export const LightClientHeader = new ContainerType(
420
+ {
421
+ beacon: phase0Ssz.BeaconBlockHeader,
422
+ executionBlockHash: Bytes32,
423
+ executionBranch: ExecutionBranch,
424
+ },
425
+ {typeName: "LightClientHeader", jsonCase: "eth2"}
426
+ );
427
+
428
+ export const LightClientBootstrap = new ContainerType(
429
+ {
430
+ header: LightClientHeader,
431
+ currentSyncCommittee: altairSsz.SyncCommittee,
432
+ currentSyncCommitteeBranch: CurrentSyncCommitteeBranch,
433
+ },
434
+ {typeName: "LightClientBootstrap", jsonCase: "eth2"}
435
+ );
436
+
437
+ export const LightClientUpdate = new ContainerType(
438
+ {
439
+ attestedHeader: LightClientHeader,
440
+ nextSyncCommittee: altairSsz.SyncCommittee,
441
+ nextSyncCommitteeBranch: NextSyncCommitteeBranch,
442
+ finalizedHeader: LightClientHeader,
443
+ finalityBranch: FinalityBranch,
444
+ syncAggregate: altairSsz.SyncAggregate,
445
+ signatureSlot: Slot,
446
+ },
447
+ {typeName: "LightClientUpdate", jsonCase: "eth2"}
448
+ );
449
+
450
+ export const LightClientFinalityUpdate = new ContainerType(
451
+ {
452
+ attestedHeader: LightClientHeader,
453
+ finalizedHeader: LightClientHeader,
454
+ finalityBranch: FinalityBranch,
455
+ syncAggregate: altairSsz.SyncAggregate,
456
+ signatureSlot: Slot,
457
+ },
458
+ {typeName: "LightClientFinalityUpdate", jsonCase: "eth2"}
459
+ );
460
+
461
+ export const LightClientOptimisticUpdate = new ContainerType(
462
+ {
463
+ attestedHeader: LightClientHeader,
464
+ syncAggregate: altairSsz.SyncAggregate,
465
+ signatureSlot: Slot,
466
+ },
467
+ {typeName: "LightClientOptimisticUpdate", jsonCase: "eth2"}
468
+ );
469
+
470
+ export const LightClientStore = new ContainerType(
471
+ {
472
+ snapshot: LightClientBootstrap,
473
+ validUpdates: new ListCompositeType(LightClientUpdate, EPOCHS_PER_SYNC_COMMITTEE_PERIOD * SLOTS_PER_EPOCH),
474
+ },
475
+ {typeName: "LightClientStore", jsonCase: "eth2"}
476
+ );
477
+
478
+ export const BeaconState = new ProgressiveContainerType(
277
479
  {
278
480
  genesisTime: UintNum64,
279
481
  genesisValidatorsRoot: Root,
@@ -290,21 +492,21 @@ export const BeaconState = new ContainerType(
290
492
  eth1DataVotes: phase0Ssz.Eth1DataVotes,
291
493
  eth1DepositIndex: UintNum64,
292
494
  // Registry
293
- validators: phase0Ssz.Validators,
294
- balances: phase0Ssz.Balances,
495
+ validators: Validators,
496
+ balances: Balances,
295
497
  randaoMixes: phase0Ssz.RandaoMixes,
296
498
  // Slashings
297
499
  slashings: phase0Ssz.Slashings,
298
500
  // Participation
299
- previousEpochParticipation: altairSsz.EpochParticipation,
300
- currentEpochParticipation: altairSsz.EpochParticipation,
501
+ previousEpochParticipation: EpochParticipation,
502
+ currentEpochParticipation: EpochParticipation,
301
503
  // Finality
302
504
  justificationBits: phase0Ssz.JustificationBits,
303
505
  previousJustifiedCheckpoint: phase0Ssz.Checkpoint,
304
506
  currentJustifiedCheckpoint: phase0Ssz.Checkpoint,
305
507
  finalizedCheckpoint: phase0Ssz.Checkpoint,
306
508
  // Inactivity
307
- inactivityScores: altairSsz.InactivityScores,
509
+ inactivityScores: InactivityScores,
308
510
  // Sync
309
511
  currentSyncCommittee: altairSsz.SyncCommittee,
310
512
  nextSyncCommittee: altairSsz.SyncCommittee,
@@ -322,28 +524,29 @@ export const BeaconState = new ContainerType(
322
524
  earliestExitEpoch: Epoch,
323
525
  consolidationBalanceToConsume: Gwei,
324
526
  earliestConsolidationEpoch: Epoch,
325
- pendingDeposits: electraSsz.BeaconState.fields.pendingDeposits,
326
- pendingPartialWithdrawals: electraSsz.BeaconState.fields.pendingPartialWithdrawals,
327
- pendingConsolidations: electraSsz.BeaconState.fields.pendingConsolidations,
527
+ pendingDeposits: PendingDeposits,
528
+ pendingPartialWithdrawals: PendingPartialWithdrawals,
529
+ pendingConsolidations: PendingConsolidations,
328
530
  proposerLookahead: fuluSsz.BeaconState.fields.proposerLookahead,
329
- builders: new ListCompositeType(Builder, BUILDER_REGISTRY_LIMIT), // New in GLOAS:EIP7732
531
+ builders: Builders, // New in GLOAS:EIP7732
330
532
  nextWithdrawalBuilderIndex: BuilderIndex, // New in GLOAS:EIP7732
331
533
  executionPayloadAvailability: new BitVectorType(SLOTS_PER_HISTORICAL_ROOT), // New in GLOAS:EIP7732
332
534
  builderPendingPayments: new VectorCompositeType(BuilderPendingPayment, 2 * SLOTS_PER_EPOCH), // New in GLOAS:EIP7732
333
- builderPendingWithdrawals: new ListCompositeType(BuilderPendingWithdrawal, BUILDER_PENDING_WITHDRAWALS_LIMIT), // New in GLOAS:EIP7732
535
+ builderPendingWithdrawals: BuilderPendingWithdrawals, // New in GLOAS:EIP7732
334
536
  latestExecutionPayloadBid: ExecutionPayloadBid, // New in GLOAS:EIP7732
335
- payloadExpectedWithdrawals: capellaSsz.Withdrawals, // New in GLOAS:EIP7732
537
+ payloadExpectedWithdrawals: Withdrawals, // New in GLOAS:EIP7732
336
538
  ptcWindow: PtcWindow, // New in GLOAS:EIP7732
337
539
  },
540
+ activeFields(46),
338
541
  {typeName: "BeaconState", jsonCase: "eth2"}
339
542
  );
340
543
 
341
544
  export const DataColumnSidecar = new ContainerType(
342
545
  {
343
546
  index: fuluSsz.DataColumnSidecar.fields.index,
344
- column: fuluSsz.DataColumnSidecar.fields.column,
547
+ column: DataColumn,
345
548
  // kzgCommitments: denebSsz.BlobKzgCommitments, // Removed in GLOAS:EIP7732
346
- kzgProofs: fuluSsz.DataColumnSidecar.fields.kzgProofs,
549
+ kzgProofs: KZGProofs,
347
550
  // signedBlockHeader: phase0Ssz.SignedBeaconBlockHeader, // Removed in GLOAS:EIP7732
348
551
  // kzgCommitmentsInclusionProof: KzgCommitmentsInclusionProof, // Removed in GLOAS:EIP7732
349
552
  slot: Slot, // New in GLOAS:EIP7732
@@ -371,7 +574,11 @@ export const PayloadAttributes = new ContainerType(
371
574
 
372
575
  export const SSEPayloadAttributes = new ContainerType(
373
576
  {
374
- ...bellatrixSsz.SSEPayloadAttributesCommon.fields,
577
+ proposerIndex: UintNum64,
578
+ proposalSlot: Slot,
579
+ // parentBlockNumber: UintNum64, // Removed in GLOAS:EIP7732
580
+ parentBlockRoot: Root,
581
+ parentBlockHash: Root,
375
582
  payloadAttributes: PayloadAttributes,
376
583
  },
377
584
  {typeName: "SSEPayloadAttributes", jsonCase: "eth2"}
@@ -1,6 +1,31 @@
1
1
  import {ValueOf} from "@chainsafe/ssz";
2
2
  import * as ssz from "./sszTypes.js";
3
3
 
4
+ export type AggregationBits = ValueOf<typeof ssz.AggregationBits>;
5
+ export type AttestingIndices = ValueOf<typeof ssz.AttestingIndices>;
6
+ export type Transaction = ValueOf<typeof ssz.Transaction>;
7
+ export type Transactions = ValueOf<typeof ssz.Transactions>;
8
+ export type Withdrawals = ValueOf<typeof ssz.Withdrawals>;
9
+ export type BlobKzgCommitments = ValueOf<typeof ssz.BlobKzgCommitments>;
10
+ export type KZGProofs = ValueOf<typeof ssz.KZGProofs>;
11
+ export type DataColumn = ValueOf<typeof ssz.DataColumn>;
12
+
13
+ export type Attestation = ValueOf<typeof ssz.Attestation>;
14
+ export type IndexedAttestation = ValueOf<typeof ssz.IndexedAttestation>;
15
+ export type IndexedAttestationBigint = ValueOf<typeof ssz.IndexedAttestationBigint>;
16
+ export type AttesterSlashing = ValueOf<typeof ssz.AttesterSlashing>;
17
+
18
+ export type AggregateAndProof = ValueOf<typeof ssz.AggregateAndProof>;
19
+ export type SignedAggregateAndProof = ValueOf<typeof ssz.SignedAggregateAndProof>;
20
+
21
+ export type DepositRequest = ValueOf<typeof ssz.DepositRequest>;
22
+ export type DepositRequests = ValueOf<typeof ssz.DepositRequests>;
23
+ export type WithdrawalRequest = ValueOf<typeof ssz.WithdrawalRequest>;
24
+ export type WithdrawalRequests = ValueOf<typeof ssz.WithdrawalRequests>;
25
+ export type ConsolidationRequest = ValueOf<typeof ssz.ConsolidationRequest>;
26
+ export type ConsolidationRequests = ValueOf<typeof ssz.ConsolidationRequests>;
27
+ export type ExecutionRequests = ValueOf<typeof ssz.ExecutionRequests>;
28
+
4
29
  export type Builder = ValueOf<typeof ssz.Builder>;
5
30
  export type BuilderPendingWithdrawal = ValueOf<typeof ssz.BuilderPendingWithdrawal>;
6
31
  export type BuilderPendingPayment = ValueOf<typeof ssz.BuilderPendingPayment>;
@@ -8,7 +33,6 @@ export type BuilderDepositRequest = ValueOf<typeof ssz.BuilderDepositRequest>;
8
33
  export type BuilderDepositRequests = ValueOf<typeof ssz.BuilderDepositRequests>;
9
34
  export type BuilderExitRequest = ValueOf<typeof ssz.BuilderExitRequest>;
10
35
  export type BuilderExitRequests = ValueOf<typeof ssz.BuilderExitRequests>;
11
- export type ExecutionRequests = ValueOf<typeof ssz.ExecutionRequests>;
12
36
  export type PayloadTimelinessCommittee = ValueOf<typeof ssz.PayloadTimelinessCommittee>;
13
37
  export type PtcWindow = ValueOf<typeof ssz.PtcWindow>;
14
38
  export type PayloadAttestationData = ValueOf<typeof ssz.PayloadAttestationData>;
@@ -26,6 +50,12 @@ export type SignedExecutionPayloadEnvelope = ValueOf<typeof ssz.SignedExecutionP
26
50
  export type BeaconBlockBody = ValueOf<typeof ssz.BeaconBlockBody>;
27
51
  export type BeaconBlock = ValueOf<typeof ssz.BeaconBlock>;
28
52
  export type SignedBeaconBlock = ValueOf<typeof ssz.SignedBeaconBlock>;
53
+ export type LightClientHeader = ValueOf<typeof ssz.LightClientHeader>;
54
+ export type LightClientBootstrap = ValueOf<typeof ssz.LightClientBootstrap>;
55
+ export type LightClientUpdate = ValueOf<typeof ssz.LightClientUpdate>;
56
+ export type LightClientFinalityUpdate = ValueOf<typeof ssz.LightClientFinalityUpdate>;
57
+ export type LightClientOptimisticUpdate = ValueOf<typeof ssz.LightClientOptimisticUpdate>;
58
+ export type LightClientStore = ValueOf<typeof ssz.LightClientStore>;
29
59
  export type BeaconState = ValueOf<typeof ssz.BeaconState>;
30
60
 
31
61
  export type DataColumnSidecar = ValueOf<typeof ssz.DataColumnSidecar>;
package/src/types.ts CHANGED
@@ -294,12 +294,12 @@ type TypesByFork = {
294
294
  SignedBeaconBlock: gloas.SignedBeaconBlock;
295
295
  Metadata: fulu.Metadata;
296
296
  Status: fulu.Status;
297
- LightClientHeader: deneb.LightClientHeader;
298
- LightClientBootstrap: electra.LightClientBootstrap;
299
- LightClientUpdate: electra.LightClientUpdate;
300
- LightClientFinalityUpdate: electra.LightClientFinalityUpdate;
301
- LightClientOptimisticUpdate: electra.LightClientOptimisticUpdate;
302
- LightClientStore: electra.LightClientStore;
297
+ LightClientHeader: gloas.LightClientHeader;
298
+ LightClientBootstrap: gloas.LightClientBootstrap;
299
+ LightClientUpdate: gloas.LightClientUpdate;
300
+ LightClientFinalityUpdate: gloas.LightClientFinalityUpdate;
301
+ LightClientOptimisticUpdate: gloas.LightClientOptimisticUpdate;
302
+ LightClientStore: gloas.LightClientStore;
303
303
  BlindedBeaconBlock: electra.BlindedBeaconBlock;
304
304
  BlindedBeaconBlockBody: electra.BlindedBeaconBlockBody;
305
305
  SignedBlindedBeaconBlock: electra.SignedBlindedBeaconBlock;
@@ -315,12 +315,12 @@ type TypesByFork = {
315
315
  SyncCommittee: altair.SyncCommittee;
316
316
  SyncAggregate: altair.SyncAggregate;
317
317
  SingleAttestation: electra.SingleAttestation;
318
- Attestation: electra.Attestation;
319
- IndexedAttestation: electra.IndexedAttestation;
320
- IndexedAttestationBigint: electra.IndexedAttestationBigint;
321
- AttesterSlashing: electra.AttesterSlashing;
322
- AggregateAndProof: electra.AggregateAndProof;
323
- SignedAggregateAndProof: electra.SignedAggregateAndProof;
318
+ Attestation: gloas.Attestation;
319
+ IndexedAttestation: gloas.IndexedAttestation;
320
+ IndexedAttestationBigint: gloas.IndexedAttestationBigint;
321
+ AttesterSlashing: gloas.AttesterSlashing;
322
+ AggregateAndProof: gloas.AggregateAndProof;
323
+ SignedAggregateAndProof: gloas.SignedAggregateAndProof;
324
324
  ExecutionRequests: gloas.ExecutionRequests;
325
325
  ExecutionPayloadBid: gloas.ExecutionPayloadBid;
326
326
  DataColumnSidecar: gloas.DataColumnSidecar;
@@ -1,5 +1,6 @@
1
1
  import {
2
2
  FINALIZED_ROOT_DEPTH_ELECTRA,
3
+ FINALIZED_ROOT_DEPTH_GLOAS,
3
4
  ForkPostBellatrix,
4
5
  ForkPostDeneb,
5
6
  ForkPostElectra,
@@ -90,7 +91,8 @@ export function isElectraLightClientUpdate(update: LightClientUpdate): update is
90
91
  const updatePostElectra = update as LightClientUpdate<ForkPostElectra>;
91
92
  return (
92
93
  updatePostElectra.finalityBranch !== undefined &&
93
- updatePostElectra.finalityBranch.length === FINALIZED_ROOT_DEPTH_ELECTRA
94
+ (updatePostElectra.finalityBranch.length === FINALIZED_ROOT_DEPTH_ELECTRA ||
95
+ updatePostElectra.finalityBranch.length === FINALIZED_ROOT_DEPTH_GLOAS)
94
96
  );
95
97
  }
96
98
 
@@ -100,7 +102,8 @@ export function isELectraLightClientFinalityUpdate(
100
102
  const updatePostElectra = update as LightClientUpdate<ForkPostElectra>;
101
103
  return (
102
104
  updatePostElectra.finalityBranch !== undefined &&
103
- updatePostElectra.finalityBranch.length === FINALIZED_ROOT_DEPTH_ELECTRA
105
+ (updatePostElectra.finalityBranch.length === FINALIZED_ROOT_DEPTH_ELECTRA ||
106
+ updatePostElectra.finalityBranch.length === FINALIZED_ROOT_DEPTH_GLOAS)
104
107
  );
105
108
  }
106
109