Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: enable skipped e2e worker tests #7195

Merged
merged 1 commit into from
Oct 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ import {EventDirection} from "../../../../src/util/workerEvents.js";
import {CommitteeSubscription} from "../../../../src/network/subnets/interface.js";
import {EchoWorker, getEchoWorker} from "./workerEchoHandler.js";

// TODO: Need to find the way to load the echoWorker in the test environment
describe.skip("data serialization through worker boundary", () => {
describe("data serialization through worker boundary", () => {
let echoWorker: EchoWorker;

beforeAll(async () => {
Expand All @@ -45,7 +44,7 @@ describe.skip("data serialization through worker boundary", () => {
const peerId = validPeerIdStr;
const peer = validPeerIdStr;
const method = ReqRespMethod.BeaconBlocksByRange;
const bytes = ZERO_HASH;
const bytes = Uint8Array.from(ZERO_HASH);
const statusZero = ssz.phase0.Status.defaultValue();

// Defining tests in this notation ensures that any event data is tested and probably safe to send
Expand Down Expand Up @@ -90,7 +89,7 @@ describe.skip("data serialization through worker boundary", () => {
type: BlockInputType.preData,
block: ssz.capella.SignedBeaconBlock.defaultValue(),
source: BlockSource.gossip,
blockBytes: ZERO_HASH,
blockBytes: Uint8Array.from(ZERO_HASH),
},
peer,
},
Expand Down Expand Up @@ -252,21 +251,21 @@ describe.skip("data serialization through worker boundary", () => {
type Resolves<T extends Promise<unknown>> = T extends Promise<infer U> ? (U extends void ? null : U) : never;

function getEmptyBlockInput(): BlockInput {
let resolveAvailability: ((blobs: BlockInputDataBlobs) => void) | null = null;
const availabilityPromise = new Promise<BlockInputDataBlobs>((resolveCB) => {
resolveAvailability = resolveCB;
});
if (resolveAvailability === null) {
throw Error("Promise Constructor was not executed immediately");
}
const blobsCache = new Map();

const cachedData = {fork: ForkName.deneb, blobsCache, availabilityPromise, resolveAvailability} as CachedData;
const cachedData = {
fork: ForkName.deneb,
blobsCache: new Map(),
// Actual promise raise this error when used in `worker.postMessage`
// DataCloneError: #<Promise> could not be cloned.
availabilityPromise: null,
// Actual function raise this error when used in `worker.postMessage`
// DataCloneError: function () { [native code] } could not be cloned
resolveAvailability: null,
} as unknown as CachedData;
return {
type: BlockInputType.dataPromise,
block: ssz.deneb.SignedBeaconBlock.defaultValue(),
source: BlockSource.gossip,
blockBytes: ZERO_HASH,
blockBytes: Uint8Array.from(ZERO_HASH),
cachedData,
};
}
Loading