Skip to content

Commit

Permalink
fix: stabilize unknown block sync e2e test (ChainSafe#6364)
Browse files Browse the repository at this point in the history
fix: stabalize unknown block sync e2e test
  • Loading branch information
twoeths authored Jan 29, 2024
1 parent 54c2069 commit 3bbb3d9
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions packages/beacon-node/test/e2e/sync/unknownBlockSync.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {waitForEvent} from "../../utils/events/resolver.js";
import {getAndInitDevValidators} from "../../utils/node/validator.js";
import {ChainEvent} from "../../../src/chain/index.js";
import {NetworkEvent} from "../../../src/network/index.js";
import {connect} from "../../utils/network.js";
import {connect, onPeerConnect} from "../../utils/network.js";
import {testLogger, LogLevel, TestLoggerOpts} from "../../utils/logger.js";
import {BlockError, BlockErrorCode} from "../../../src/chain/errors/index.js";
import {BlockSource, getBlockInput} from "../../../src/chain/blocks/types.js";
Expand Down Expand Up @@ -48,7 +48,7 @@ describe("sync / unknown block sync", function () {
for (const {id, event} of testCases) {
it(id, async function () {
// the node needs time to transpile/initialize bls worker threads
const genesisSlotsDelay = 7;
const genesisSlotsDelay = 4;
const genesisTime = Math.floor(Date.now() / 1000) + genesisSlotsDelay * testParams.SECONDS_PER_SLOT;
const testLoggerOpts: TestLoggerOpts = {
level: LogLevel.info,
Expand All @@ -71,6 +71,7 @@ describe("sync / unknown block sync", function () {
chain: {blsVerifyAllMainThread: true},
},
validatorCount,
genesisTime,
logger: loggerNodeA,
});

Expand Down Expand Up @@ -100,7 +101,7 @@ describe("sync / unknown block sync", function () {
chain: {blsVerifyAllMainThread: true},
},
validatorCount,
genesisTime: bn.chain.getHeadState().genesisTime,
genesisTime,
logger: loggerNodeB,
});

Expand All @@ -116,7 +117,11 @@ describe("sync / unknown block sync", function () {
({block}) => block === headSummary.blockRoot
);

const connected = Promise.all([onPeerConnect(bn2.network), onPeerConnect(bn.network)]);
await connect(bn2.network, bn.network);
await connected;
loggerNodeA.info("Node A connected to Node B");

const headInput = getBlockInput.preDeneb(config, head, BlockSource.gossip, null);

switch (event) {
Expand Down Expand Up @@ -147,4 +152,4 @@ describe("sync / unknown block sync", function () {
await waitForSynced;
});
}
}, {timeout: 30_000});
}, {timeout: 40_000});

0 comments on commit 3bbb3d9

Please sign in to comment.