Skip to content

Commit

Permalink
fix: add missing types
Browse files Browse the repository at this point in the history
  • Loading branch information
twoeths committed Sep 13, 2023
1 parent 1c7de81 commit 01cd60c
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 3 deletions.
13 changes: 12 additions & 1 deletion packages/ssz/test/unit/eth2/allForks.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,17 @@ describe("Eth2 allForks BeaconState, non-cached and cached", () => {
type BeaconStatePhase0 = CompositeViewDU<typeof ssz.phase0.BeaconState>;
type BeaconStateAltair = CompositeViewDU<typeof ssz.altair.BeaconState>;
type BeaconStateBellatrix = CompositeViewDU<typeof ssz.bellatrix.BeaconState>;
type BeaconStateCapella = CompositeViewDU<typeof ssz.capella.BeaconState>;
type BeaconStateDeneb = CompositeViewDU<typeof ssz.deneb.BeaconState>;

// Union at the TreeViewDU level
// Equivalent to CompositeViewDU<allForks.AllForksSSZTypes["BeaconState"]>
type BeaconStateAllForks = BeaconStatePhase0 | BeaconStateAltair | BeaconStateBellatrix;
type BeaconStateAllForks =
| BeaconStatePhase0
| BeaconStateAltair
| BeaconStateBellatrix
| BeaconStateCapella
| BeaconStateDeneb;

// Union at the fields level
// NOTE: using this type for CachedBeaconStateAllForks makes single fork BeaconState types incompatible to it
Expand Down Expand Up @@ -378,6 +385,8 @@ describe("Eth2 allForks BeaconState, non-cached and cached", () => {
| CompositeView<typeof ssz.phase0.BeaconState>
| CompositeView<typeof ssz.altair.BeaconState>
| CompositeView<typeof ssz.bellatrix.BeaconState>
| CompositeView<typeof ssz.capella.BeaconState>
| CompositeView<typeof ssz.deneb.BeaconState>
): void {
state;
}
Expand All @@ -386,6 +395,8 @@ describe("Eth2 allForks BeaconState, non-cached and cached", () => {
| CompositeViewDU<typeof ssz.phase0.BeaconState>
| CompositeViewDU<typeof ssz.altair.BeaconState>
| CompositeViewDU<typeof ssz.bellatrix.BeaconState>
| CompositeViewDU<typeof ssz.capella.BeaconState>
| CompositeViewDU<typeof ssz.deneb.BeaconState>
): void {
state;
}
Expand Down
26 changes: 24 additions & 2 deletions packages/ssz/test/unit/eth2/minMaxSize.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,11 @@ describe("Get minSize and maxSize of eth2 data structures", () => {
phase0: {
AttestationSubnets: {minSize: 8, maxSize: 8},
BeaconBlockHeader: {minSize: 112, maxSize: 112},
BeaconBlockHeaderBigint: {minSize: 112, maxSize: 112},
SignedBeaconBlockHeader: {minSize: 208, maxSize: 208},
SignedBeaconBlockHeaderBigint: {minSize: 208, maxSize: 208},
Checkpoint: {minSize: 40, maxSize: 40},
CheckpointBigint: {minSize: 40, maxSize: 40},
CommitteeBits: {minSize: 1, maxSize: 257},
CommitteeIndices: {minSize: 0, maxSize: 16384},
DepositMessage: {minSize: 88, maxSize: 88},
Expand All @@ -40,7 +43,9 @@ describe("Get minSize and maxSize of eth2 data structures", () => {
Slashings: {minSize: 512, maxSize: 512},
JustificationBits: {minSize: 1, maxSize: 1},
AttestationData: {minSize: 128, maxSize: 128},
AttestationDataBigint: {minSize: 128, maxSize: 128},
IndexedAttestation: {minSize: 228, maxSize: 16612},
IndexedAttestationBigint: {minSize: 228, maxSize: 16612},
PendingAttestation: {minSize: 149, maxSize: 405},
SigningData: {minSize: 64, maxSize: 64},
Attestation: {minSize: 229, maxSize: 485},
Expand All @@ -64,6 +69,7 @@ describe("Get minSize and maxSize of eth2 data structures", () => {
BeaconBlocksByRangeRequest: {minSize: 24, maxSize: 24},
BeaconBlocksByRootRequest: {minSize: 0, maxSize: 32768},
Genesis: {minSize: 44, maxSize: 44},
HistoricalBatchRoots: {minSize: 64, maxSize: 64},
},
altair: {
SyncSubnets: {minSize: 1, maxSize: 1},
Expand All @@ -86,8 +92,13 @@ describe("Get minSize and maxSize of eth2 data structures", () => {
InactivityScores: {minSize: 0, maxSize: 8796093022208},
BeaconState: {minSize: 10229, maxSize: 152832653144309},
LightClientSnapshot: {minSize: 3280, maxSize: 3280},
LightClientUpdate: {minSize: 2264, maxSize: 2264},
LightClientStore: {minSize: 3284, maxSize: 148180},
LightClientUpdate: {minSize: 2268, maxSize: 2268},
LightClientStore: {minSize: 1860, maxSize: 147012},
LightClientHeader: {minSize: 112, maxSize: 112},
LightClientBootstrap: {minSize: 1856, maxSize: 1856},
LightClientFinalityUpdate: {minSize: 524, maxSize: 524},
LightClientOptimisticUpdate: {minSize: 220, maxSize: 220},
LightClientUpdatesByRange: {minSize: 16, maxSize: 16},
},
bellatrix: {
Transaction: {minSize: 0, maxSize: 1073741824},
Expand All @@ -102,6 +113,17 @@ describe("Get minSize and maxSize of eth2 data structures", () => {
HistoricalStateRoots: {minSize: 2048, maxSize: 2048},
HistoricalBatch: {minSize: 4096, maxSize: 4096},
BeaconState: {minSize: 10769, maxSize: 152832653144881},
CommonExecutionPayloadType: {minSize: 504, maxSize: 536},
BlindedBeaconBlockBody: {minSize: 860, maxSize: 158244},
BlindedBeaconBlock: {minSize: 944, maxSize: 158328},
SignedBlindedBeaconBlock: {minSize: 1044, maxSize: 158428},
ValidatorRegistrationV1: {minSize: 84, maxSize: 84},
SignedValidatorRegistrationV1: {minSize: 180, maxSize: 180},
BuilderBid: {minSize: 620, maxSize: 652},
SignedBuilderBid: {minSize: 720, maxSize: 752},
PayloadAttributes: {minSize: 40, maxSize: 40},
SSEPayloadAttributesCommon: {minSize: 88, maxSize: 88},
SSEPayloadAttributes: {minSize: 128, maxSize: 128},
},
};

Expand Down

0 comments on commit 01cd60c

Please sign in to comment.