Skip to content

Commit

Permalink
some fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
g11tech committed Apr 26, 2024
1 parent 4bd7189 commit d11034b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,6 @@ export class SeenGossipBlockInput {
if (blobKzgCommitments.length === blobsCache.size) {
const allBlobs = getBlockInputBlobs(blobsCache, BlobsSource.gossip);
metrics?.syncUnknownBlock.resolveAvailabilitySource.inc({source: BlockInputAvailabilitySource.GOSSIP});
const {blobs} = allBlobs;
const blockData = {fork: cachedData.fork, ...allBlobs} as BlockInputDataBlobs;
const blockInput = getBlockInput.availableData(
config,
Expand All @@ -150,7 +149,7 @@ export class SeenGossipBlockInput {
resolveBlockInput(blockInput);
return {
blockInput,
blockInputMeta: {pending: null, haveBlobs: blobs.length, expectedBlobs: blobKzgCommitments.length},
blockInputMeta: {pending: null, haveBlobs: allBlobs.blobs.length, expectedBlobs: blobKzgCommitments.length},
};
} else {
const blockInput = getBlockInput.dataPromise(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ import {ssz} from "@lodestar/types";
import {SLOTS_PER_EPOCH} from "@lodestar/params";
import {routes} from "@lodestar/api";
import {createBeaconConfig, createChainForkConfig, defaultChainConfig} from "@lodestar/config";
import {ProtoBlock} from "@lodestar/fork-choice";
import {ProtoBlock, DataAvailabilityStatus} from "@lodestar/fork-choice";
import {ApiTestModules, getApiTestModules} from "../../../../utils/api.js";
import {SyncState} from "../../../../../src/sync/interface.js";
import {getValidatorApi} from "../../../../../src/api/impl/validator/index.js";
import {CommonBlockBody} from "../../../../../src/chain/interface.js";
import {zeroProtoBlock} from "../../../../utils/state.js";

/* eslint-disable @typescript-eslint/naming-convention */
describe("api/validator - produceBlockV3", function () {
Expand Down Expand Up @@ -87,6 +88,7 @@ describe("api/validator - produceBlockV3", function () {
modules.chain.recomputeForkChoiceHead.mockReturnValue({
blockRoot: toHexString(fullBlock.parentRoot),
} as ProtoBlock);
modules.chain.forkChoice.getBlock.mockReturnValue(zeroProtoBlock as ProtoBlock);

if (enginePayloadValue !== null) {
const commonBlockBody: CommonBlockBody = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import {describe, it, expect, beforeAll} from "vitest";
import {ssz, deneb} from "@lodestar/types";
import {ForkName} from "@lodestar/params";
import {createBeaconConfig, createChainForkConfig, defaultChainConfig} from "@lodestar/config";

import {beaconBlocksMaybeBlobsByRange} from "../../../src/network/reqresp/index.js";
import {BlockInputType, BlockSource, BlobsSource} from "../../../src/chain/blocks/types.js";
import {BlockInputType, BlockSource, BlobsSource, getBlockInput} from "../../../src/chain/blocks/types.js";
import {initCKZG, loadEthereumTrustedSetup} from "../../../src/util/kzg.js";
import {INetwork} from "../../../src/network/interface.js";
import {ZERO_HASH} from "../../../src/constants/constants.js";
Expand Down Expand Up @@ -99,15 +100,7 @@ describe("beaconBlocksMaybeBlobsByRange", () => {

const expectedResponse = blocksWithBlobs.map(([block, blobSidecars]) => {
const blobs = blobSidecars !== undefined ? blobSidecars : [];
return {
type: BlockInputType.availableData,
block,
source: BlockSource.byRange,
blobs,
blobsSource: BlobsSource.byRange,
blockBytes: null,
blobsBytes: blobs.map(() => null),
};
return getBlockInput.availableData(config, block, BlockSource.byRange, null, {fork:ForkName.deneb, blobs,blobsSource: BlobsSource.byRange, blobsBytes: blobs.map(() => null)})
});

const network = {
Expand Down

0 comments on commit d11034b

Please sign in to comment.