Skip to content

Commit

Permalink
fix: rebase conflicts/updates
Browse files Browse the repository at this point in the history
matthewkeil committed Jun 14, 2024
1 parent 222a000 commit c36a0c9
Showing 6 changed files with 13 additions and 30 deletions.
1 change: 0 additions & 1 deletion packages/beacon-node/src/chain/chain.ts
Original file line number Diff line number Diff line change
@@ -34,7 +34,6 @@ import {ProcessShutdownCallback} from "@lodestar/validator";
import {Logger, gweiToWei, isErrorAborted, pruneSetToMax, sleep, toHex} from "@lodestar/utils";
import {ForkSeq, SLOTS_PER_EPOCH} from "@lodestar/params";

import {toHexString} from "@lodestar/utils";
import {GENESIS_EPOCH, ZERO_HASH} from "../constants/index.js";
import {IBeaconDb} from "../db/index.js";
import {Metrics} from "../metrics/index.js";
Original file line number Diff line number Diff line change
@@ -22,8 +22,8 @@ export async function* onBeaconBlocksByRange(
// Finalized range of blocks
if (startSlot <= finalizedSlot) {
// Chain of blobs won't change
for await (const {key, value} of db.finalized.binaryEntriesStream({gte: startSlot, lt: endSlot})) {
const {name, seq} = chain.config.getForkInfo(db.finalized.decodeKey(key));
for await (const {key, value} of finalized.binaryEntriesStream({gte: startSlot, lt: endSlot})) {
const {name, seq} = chain.config.getForkInfo(finalized.decodeKey(key));

yield {
data: await chain.blindedOrFullBlockToFullBytes(seq, value),
2 changes: 1 addition & 1 deletion packages/beacon-node/test/mocks/block.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import fs from "node:fs";
import {ssz, allForks} from "@lodestar/types";
import {ForkInfo, createChainForkConfig, defaultChainConfig} from "@lodestar/config";
import {mainnetChainConfig} from "@lodestar/config/presets";
import {mainnetChainConfig} from "@lodestar/config/configs";

const directory = "./__fixtures__/";

18 changes: 9 additions & 9 deletions packages/beacon-node/test/unit/util/fullOrBlindedBlock.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {expect} from "chai";
import {describe, it, expect} from "vitest";
import {ForkInfo} from "@lodestar/config";
import {allForks, capella} from "@lodestar/types";
import {isForkExecution} from "@lodestar/params";
@@ -9,7 +9,7 @@ import {
isBlindedBytes,
serializeFullOrBlindedSignedBeaconBlock,
} from "../../../src/util/fullOrBlindedBlock.js";
import {chainConfig, mockBlocks} from "../../utils/mocks/block.js";
import {chainConfig, mockBlocks} from "../../mocks/block.js";
import {byteArrayEquals} from "../../../src/util/bytes.js";

type FullOrBlind = "full" | "blinded";
@@ -28,7 +28,7 @@ const fullOrBlindedBlocks = Object.values(mockBlocks)
describe("isBlindedBytes", () => {
for (const [fullOrBlinded, {seq, name}, , block] of fullOrBlindedBlocks) {
it(`should return ${fullOrBlinded === "blinded"} for ${fullOrBlinded} ${name} blocks`, () => {
expect(isBlindedBytes(seq, block)).to.equal(isForkExecution(name) && fullOrBlinded === "blinded");
expect(isBlindedBytes(seq, block)).toEqual(isForkExecution(name) && fullOrBlinded === "blinded");
});
}
});
@@ -37,7 +37,7 @@ describe("serializeFullOrBlindedSignedBeaconBlock", () => {
for (const [fullOrBlinded, {name}, block, expected] of fullOrBlindedBlocks) {
it(`should serialize ${fullOrBlinded} ${name} block`, () => {
const serialized = serializeFullOrBlindedSignedBeaconBlock(chainConfig, block);
expect(byteArrayEquals(serialized, expected)).to.be.true;
expect(byteArrayEquals(serialized, expected)).toBeTruthy();
});
}
});
@@ -50,7 +50,7 @@ describe("deserializeFullOrBlindedSignedBeaconBlock", () => {
isForkExecution(name) && fullOrBlinded === "blinded"
? chainConfig.getBlindedForkTypes(block.message.slot).SignedBeaconBlock
: chainConfig.getForkTypes(block.message.slot).SignedBeaconBlock;
expect(type.equals(deserialized as any, block as any)).to.be.true;
expect(type.equals(deserialized as any, block as any)).toBeTruthy();
});
}
});
@@ -69,15 +69,15 @@ describe("blindedOrFullBlockToBlinded", function () {
chainConfig.getBlindedForkTypes(full.message.slot).SignedBeaconBlock.equals(result, blinded!)
: // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
chainConfig.getForkTypes(full.message.slot).SignedBeaconBlock.equals(result, isExecution ? blinded! : full);
expect(isEqual).to.be.true;
expect(isEqual).toBeTruthy();
});
if (!blinded) continue;
it(`should convert blinded ${name} to blinded block`, () => {
const result = blindedOrFullBlockToBlinded(chainConfig, blinded);
const isEqual = isForkExecution(name)
? chainConfig.getBlindedForkTypes(full.message.slot).SignedBeaconBlock.equals(result, blinded)
: chainConfig.getForkTypes(full.message.slot).SignedBeaconBlock.equals(result, blinded);
expect(isEqual).to.be.true;
expect(isEqual).toBeTruthy();
});
}
});
@@ -94,12 +94,12 @@ describe("blindedOrFullBlockToFull", function () {
};
it(`should convert full ${name} to full block`, () => {
const result = blindedOrFullBlockToFull(chainConfig, seq, full, transactionsAndWithdrawals);
expect(chainConfig.getForkTypes(full.message.slot).SignedBeaconBlock.equals(result, full)).to.be.true;
expect(chainConfig.getForkTypes(full.message.slot).SignedBeaconBlock.equals(result, full)).toBeTruthy();
});
if (!blinded) continue;
it(`should convert blinded ${name} to full block`, () => {
const result = blindedOrFullBlockToFull(chainConfig, seq, blinded, transactionsAndWithdrawals);
expect(chainConfig.getForkTypes(full.message.slot).SignedBeaconBlock.equals(result, full)).to.be.true;
expect(chainConfig.getForkTypes(full.message.slot).SignedBeaconBlock.equals(result, full)).toBeTruthy();
});
}
});
16 changes: 0 additions & 16 deletions packages/cli/test/sim/deneb.test.ts
Original file line number Diff line number Diff line change
@@ -7,13 +7,6 @@ import {connectAllNodes, waitForSlot} from "../utils/crucible/utils/network.js";
import {createBlobsAssertion} from "../utils/crucible/assertions/blobsAssertion.js";
import {assertCheckpointSync, assertRangeSync} from "../utils/crucible/utils/syncing.js";

const genesisDelaySeconds = 20 * SIM_TESTS_SECONDS_PER_SLOT;
const altairForkEpoch = 1;
const bellatrixForkEpoch = 2;
const capellaForkEpoch = 3;
const denebForkEpoch = 4;
// Make sure bellatrix started before TTD reach
const additionalSlotsForTTD = activePreset.SLOTS_PER_EPOCH - 2;
const runTillEpoch = 6;
const syncWaitEpoch = 2;

@@ -31,17 +24,8 @@ const env = await Simulation.initWithDefaults(
{
id: "deneb",
logsDir: path.join(logFilesDir, "deneb"),
// TODO: (@matthewkeil) this may be a merge conflict
forkConfig,
trustedSetup: true,
chainConfig: {
ALTAIR_FORK_EPOCH: altairForkEpoch,
BELLATRIX_FORK_EPOCH: bellatrixForkEpoch,
CAPELLA_FORK_EPOCH: capellaForkEpoch,
DENEB_FORK_EPOCH: denebForkEpoch,
GENESIS_DELAY: genesisDelaySeconds,
TERMINAL_TOTAL_DIFFICULTY: ttd,
},
},
[
{
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* eslint-disable @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-call */
/* eslint-disable @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-member-access */
import {expect, describe, it, vi} from "vitest";
import {Lightclient, LightclientEvent, utils, transport} from "../../dist/lightclient.min.mjs";

0 comments on commit c36a0c9

Please sign in to comment.