Skip to content

Commit

Permalink
fix types
Browse files Browse the repository at this point in the history
  • Loading branch information
g11tech committed Aug 15, 2024
1 parent e5f2e4d commit 39c9ffe
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 2 additions & 0 deletions packages/params/src/forkName.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ export function isForkBlobs(fork: ForkName): fork is ForkBlobs {

// TODO add electra type in ForkPreEpbs
export type ForkPreEpbs = ForkPreBlobs | ForkName.deneb;
export type ForkExecutionPreEpbs = Exclude<ForkPreEpbs, ForkPreExecution>;
export const forkExecutionPreEpbs = [ForkName.bellatrix, ForkName.capella, ForkName.deneb];
export type ForkEpbs = Exclude<ForkName, ForkPreBlobs>;
export const forkEpbs = exclude(forkAll, [
ForkName.phase0,
Expand Down
10 changes: 5 additions & 5 deletions packages/types/src/utils/typeguards.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {ForkBlobs, ForkExecution} from "@lodestar/params";
import {ForkBlobs, ForkExecution, ForkExecutionPreEpbs} from "@lodestar/params";
import {
BlockContents,
SignedBeaconBlock,
Expand All @@ -23,7 +23,7 @@ export function isExecutionPayload<F extends ForkExecution>(
return (payload as ExecutionPayload<F>).transactions !== undefined;
}

export function isExecutionPayloadHeader<F extends ForkExecution>(
export function isExecutionPayloadHeader<F extends ForkExecutionPreEpbs>(
payload: ExecutionPayload<F> | ExecutionPayloadHeader<F>
): payload is ExecutionPayloadHeader<F> {
// we just check transactionsRoot for determining as it the base field
Expand All @@ -43,16 +43,16 @@ export function isBlindedBeaconBlock<F extends ForkExecution>(
return (block as BeaconBlock).body !== null && isBlindedBeaconBlockBody((block as BeaconBlock).body);
}

export function isBlindedSignedBeaconBlock<F extends ForkExecution>(
export function isBlindedSignedBeaconBlock<F extends ForkExecutionPreEpbs>(
signedBlock: SignedBeaconBlock | SignedBeaconBlockOrContents
): signedBlock is SignedBlindedBeaconBlock<F> {
return (signedBlock as SignedBlindedBeaconBlock<F>).message.body.executionPayloadHeader !== undefined;
}

export function isBlindedBeaconBlockBody<F extends ForkExecution>(
export function isBlindedBeaconBlockBody<F extends ForkExecutionPreEpbs>(
body: BeaconBlockBody | BlindedBeaconBlockBody
): body is BlindedBeaconBlockBody<F> {
return (body as BlindedBeaconBlockBody).executionPayloadHeader !== undefined;
return (body as BlindedBeaconBlockBody<F>).executionPayloadHeader !== undefined;
}

export function isBlockContents<F extends ForkBlobs>(
Expand Down

0 comments on commit 39c9ffe

Please sign in to comment.