Skip to content
Draft
Show file tree
Hide file tree
Changes from 4 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
3 changes: 3 additions & 0 deletions packages/beacon-node/test/spec/presets/fork.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
CachedBeaconStateDeneb,
CachedBeaconStateElectra,
CachedBeaconStateFulu,
CachedBeaconStateGloas,
CachedBeaconStatePhase0,
} from "@lodestar/state-transition";
import * as slotFns from "@lodestar/state-transition/slot";
Expand Down Expand Up @@ -44,6 +45,8 @@ const fork: TestRunnerFn<ForkStateCase, BeaconStateAllForks> = (forkNext) => {
return slotFns.upgradeStateToFulu(preState as CachedBeaconStateElectra);
case ForkName.gloas:
return slotFns.upgradeStateToGloas(preState as CachedBeaconStateFulu);
case ForkName.heze:
return slotFns.upgradeStateToHeze(preState as CachedBeaconStateGloas);
}
},
options: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -735,7 +735,7 @@ const forkChoiceTest =
shouldSkip: (_testcase, name, _index) =>
name.includes("invalid_incorrect_proof") ||
// TODO GLOAS: These tests will be unskipped by https://github.com/ChainSafe/lodestar/pull/9233
(name.includes("gloas") &&
((name.includes("gloas") || name.includes("heze")) &&
(name.includes("simple_attempted_reorg_without_enough_ffg_votes") ||
name.includes("include_votes_another_empty_chain_with_enough_ffg_votes_current_epoch") ||
name.includes("include_votes_another_empty_chain_with_enough_ffg_votes_previous_epoch") ||
Expand Down
11 changes: 11 additions & 0 deletions packages/beacon-node/test/spec/presets/transition.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,17 @@ function getTransitionConfig(fork: ForkName, forkEpoch: number): Partial<ChainCo
FULU_FORK_EPOCH: 0,
GLOAS_FORK_EPOCH: forkEpoch,
};
case ForkName.heze:
return {
ALTAIR_FORK_EPOCH: 0,
BELLATRIX_FORK_EPOCH: 0,
CAPELLA_FORK_EPOCH: 0,
DENEB_FORK_EPOCH: 0,
ELECTRA_FORK_EPOCH: 0,
FULU_FORK_EPOCH: 0,
GLOAS_FORK_EPOCH: 0,
HEZE_FORK_EPOCH: forkEpoch,
};
}
}

Expand Down
6 changes: 5 additions & 1 deletion packages/beacon-node/test/spec/utils/specTestIterator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ const coveredTestRunners = [
// ],
// ```
export const defaultSkipOpts: SkipOpts = {
skippedForks: ["eip7805", "heze"],
skippedForks: [],
skippedTestSuites: [
// Merge transition tests are skipped because we no longer support performing the merge transition.
// All networks have already completed the merge, so this code path is no longer needed.
Expand All @@ -77,13 +77,17 @@ export const defaultSkipOpts: SkipOpts = {
// cell level DAS is ready
/^fulu\/ssz_static\/PartialDataColumn(Header|PartsMetadata|Sidecar)\/.*$/,
/^gloas\/ssz_static\/PartialDataColumn(GroupID|PartsMetadata|Sidecar)\/.*$/,
/^heze\/ssz_static\/PartialDataColumn(GroupID|PartsMetadata|Sidecar)\/.*$/,
// TODO-GLOAS: re-enable after Gloas light client is implemented
/^gloas\/light_client\/.*/,
/^gloas\/ssz_static\/LightClient(Bootstrap|FinalityUpdate|Header|OptimisticUpdate|Update)\/.*/,
/^heze\/light_client\/.*/,
/^heze\/ssz_static\/LightClient(Bootstrap|FinalityUpdate|Header|OptimisticUpdate|Update)\/.*/,
],
skippedTests: [
// TODO-GLOAS: re-enable after gloas light client is implemented
/\/gloas_fork$/,
/\/heze_fork$/,
],
// TODO GLOAS: Investigate why networking tests are failing since alpha.5
skippedRunners: ["fast_confirmation", "networking"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,15 @@ const DENEB_FORK_EPOCH = 1;
const ELECTRA_FORK_EPOCH = 2;
const FULU_FORK_EPOCH = 3;
const GLOAS_FORK_EPOCH = 4;
const HEZE_FORK_EPOCH = 5;
const config = createChainForkConfig({
...defaultChainConfig,
CAPELLA_FORK_EPOCH,
DENEB_FORK_EPOCH,
ELECTRA_FORK_EPOCH,
FULU_FORK_EPOCH,
GLOAS_FORK_EPOCH,
HEZE_FORK_EPOCH,
});

const slots: Record<ForkPostCapella, number> = {
Expand All @@ -33,6 +35,7 @@ const slots: Record<ForkPostCapella, number> = {
electra: computeStartSlotAtEpoch(ELECTRA_FORK_EPOCH),
fulu: computeStartSlotAtEpoch(FULU_FORK_EPOCH),
gloas: computeStartSlotAtEpoch(GLOAS_FORK_EPOCH),
heze: computeStartSlotAtEpoch(HEZE_FORK_EPOCH),
};

type BlockTestSet<F extends ForkPostCapella> = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ describe("UpgradeLightClientHeader", () => {
ELECTRA_FORK_EPOCH: 5,
FULU_FORK_EPOCH: 6,
GLOAS_FORK_EPOCH: 7,
HEZE_FORK_EPOCH: 8,
});

const genesisValidatorsRoot = Buffer.alloc(32, 0xaa);
Expand All @@ -32,6 +33,7 @@ describe("UpgradeLightClientHeader", () => {
electra: ssz.deneb.LightClientHeader.defaultValue(),
fulu: ssz.deneb.LightClientHeader.defaultValue(),
gloas: ssz.deneb.LightClientHeader.defaultValue(),
heze: ssz.deneb.LightClientHeader.defaultValue(),
};

testSlots = {
Expand All @@ -43,6 +45,7 @@ describe("UpgradeLightClientHeader", () => {
electra: 164,
fulu: 216,
gloas: 235,
heze: 260,
};
});

Expand Down
13 changes: 12 additions & 1 deletion packages/beacon-node/test/unit/network/fork.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ function getForkConfig({
electra,
fulu,
gloas,
heze,
}: {
phase0: number;
altair: number;
Expand All @@ -21,6 +22,7 @@ function getForkConfig({
electra: number;
fulu: number;
gloas: number;
heze: number;
}): BeaconConfig {
const forks: Record<ForkName, ForkInfo> = {
phase0: {
Expand Down Expand Up @@ -87,6 +89,14 @@ function getForkConfig({
prevVersion: Buffer.from([0, 0, 0, 6]),
prevForkName: ForkName.fulu,
},
heze: {
name: ForkName.heze,
seq: ForkSeq.heze,
epoch: heze,
version: Buffer.from([0, 0, 0, 8]),
prevVersion: Buffer.from([0, 0, 0, 7]),
prevForkName: ForkName.gloas,
},
};
const forksAscendingEpochOrder = Object.values(forks);
const forksDescendingEpochOrder = Object.values(forks).reverse();
Expand Down Expand Up @@ -171,9 +181,10 @@ for (const testScenario of testScenarios) {
const electra = Infinity;
const fulu = Infinity;
const gloas = Infinity;
const heze = Infinity;

describe(`network / fork: phase0: ${phase0}, altair: ${altair}, bellatrix: ${bellatrix} capella: ${capella}`, () => {
const forkConfig = getForkConfig({phase0, altair, bellatrix, capella, deneb, electra, fulu, gloas});
const forkConfig = getForkConfig({phase0, altair, bellatrix, capella, deneb, electra, fulu, gloas, heze});
const forks = forkConfig.forks;
for (const testCase of testCases) {
const {epoch, currentFork, nextFork, activeForks} = testCase;
Expand Down
3 changes: 3 additions & 0 deletions packages/beacon-node/test/utils/blocksAndData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,15 @@ export const DENEB_FORK_EPOCH = 10;
export const ELECTRA_FORK_EPOCH = 20;
export const FULU_FORK_EPOCH = 30;
export const GLOAS_FORK_EPOCH = 40;
export const HEZE_FORK_EPOCH = 50;
export const config = createChainForkConfig({
...defaultChainConfig,
CAPELLA_FORK_EPOCH,
DENEB_FORK_EPOCH,
ELECTRA_FORK_EPOCH,
FULU_FORK_EPOCH,
GLOAS_FORK_EPOCH,
HEZE_FORK_EPOCH,
});
export const clock = new Clock({
config,
Expand All @@ -60,6 +62,7 @@ export const slots: Record<ForkPostCapella, number> = {
electra: computeStartSlotAtEpoch(ELECTRA_FORK_EPOCH),
fulu: computeStartSlotAtEpoch(FULU_FORK_EPOCH),
gloas: computeStartSlotAtEpoch(GLOAS_FORK_EPOCH),
heze: computeStartSlotAtEpoch(HEZE_FORK_EPOCH),
};

/**
Expand Down
15 changes: 15 additions & 0 deletions packages/config/src/chainConfig/configs/mainnet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ export const chainConfig: ChainConfig = {
GLOAS_FORK_VERSION: b("0x07000000"),
GLOAS_FORK_EPOCH: Infinity,

// HEZE (EIP-7805)
Comment thread
ensi321 marked this conversation as resolved.
Outdated
HEZE_FORK_VERSION: b("0x08000000"),
HEZE_FORK_EPOCH: Infinity,

// Time parameters
// ---------------------------------------------------------------
// 12 seconds (DEPRECATED)
Expand All @@ -76,6 +80,9 @@ export const chainConfig: ChainConfig = {
SHARD_COMMITTEE_PERIOD: 256,
// 2**11 (= 2,048) Eth1 blocks ~8 hours
ETH1_FOLLOW_DISTANCE: 2048,

// 67% of `SLOT_DURATION_MS`
INCLUSION_LIST_DUE_BPS: 6667,
// 1667 basis points, ~17% of SLOT_DURATION_MS
PROPOSER_REORG_CUTOFF_BPS: 1667,
// 3333 basis points, ~33% of SLOT_DURATION_MS
Expand Down Expand Up @@ -190,6 +197,14 @@ export const chainConfig: ChainConfig = {
// `2**12` (= 4096 epochs, ~18 days)
MIN_EPOCHS_FOR_DATA_COLUMN_SIDECARS_REQUESTS: 4096,

// HEZE
// 2**4 (= 16)
MAX_REQUEST_INCLUSION_LIST: 16,
// 2**13 (=8192)
MAX_BYTES_PER_INCLUSION_LIST: 8192,
// 2**4 (= 16)
INCLUSION_LIST_COMMITTEE_SIZE: 16,

// Gloas
// 2**7 (= 128) payloads
MAX_REQUEST_PAYLOADS: 128,
Expand Down
13 changes: 13 additions & 0 deletions packages/config/src/chainConfig/configs/minimal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ export const chainConfig: ChainConfig = {
// GLOAS
GLOAS_FORK_VERSION: b("0x07000001"),
GLOAS_FORK_EPOCH: Infinity,
// HEZE (EIP-7805)
Comment thread
ensi321 marked this conversation as resolved.
Outdated
HEZE_FORK_VERSION: b("0x08000001"),
HEZE_FORK_EPOCH: Infinity,

// Time parameters
// ---------------------------------------------------------------
Expand All @@ -70,6 +73,8 @@ export const chainConfig: ChainConfig = {
SHARD_COMMITTEE_PERIOD: 64,
// [customized] process deposits more quickly, but insecure
ETH1_FOLLOW_DISTANCE: 16,
// 67% of `SLOT_DURATION_MS`
INCLUSION_LIST_DUE_BPS: 6667,
// 1667 basis points, ~17% of SLOT_DURATION_MS
PROPOSER_REORG_CUTOFF_BPS: 1667,
// 3333 basis points, ~33% of SLOT_DURATION_MS
Expand Down Expand Up @@ -193,6 +198,14 @@ export const chainConfig: ChainConfig = {
// ---------------------------------------------------------------
BLOB_SCHEDULE: [],

// HEZE
// 2**4 (= 16)
MAX_REQUEST_INCLUSION_LIST: 16,
// 2**13 (=8192)
MAX_BYTES_PER_INCLUSION_LIST: 8192,
// 2**4 (= 16)
INCLUSION_LIST_COMMITTEE_SIZE: 16,

// Fast Confirmation Rule
// ---------------------------------------------------------------
CONFIRMATION_BYZANTINE_THRESHOLD: 25,
Expand Down
20 changes: 20 additions & 0 deletions packages/config/src/chainConfig/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ export type ChainConfig = {
// GLOAS
GLOAS_FORK_VERSION: Uint8Array;
GLOAS_FORK_EPOCH: number;
// HEZE (EIP-7805)
Comment thread
ensi321 marked this conversation as resolved.
Outdated
HEZE_FORK_VERSION: Uint8Array;
HEZE_FORK_EPOCH: number;

// Time parameters
/** @deprecated Use `SLOT_DURATION_MS` instead. */
Expand All @@ -74,6 +77,8 @@ export type ChainConfig = {
PAYLOAD_ATTESTATION_DUE_BPS: number;
PAYLOAD_DUE_BPS: number;

INCLUSION_LIST_DUE_BPS: number;

// Validator cycle
INACTIVITY_SCORE_BIAS: number;
INACTIVITY_SCORE_RECOVERY_RATE: number;
Expand Down Expand Up @@ -133,6 +138,11 @@ export type ChainConfig = {
// Blob Scheduling
BLOB_SCHEDULE: BlobSchedule;

// HEZE
MAX_REQUEST_INCLUSION_LIST: number;
MAX_BYTES_PER_INCLUSION_LIST: number;
INCLUSION_LIST_COMMITTEE_SIZE: number;

// Fast Confirmation Rule
CONFIRMATION_BYZANTINE_THRESHOLD: number;
};
Expand Down Expand Up @@ -174,6 +184,9 @@ export const chainConfigTypes: SpecTypes<ChainConfig> = {
// GLOAS
GLOAS_FORK_VERSION: "bytes",
GLOAS_FORK_EPOCH: "number",
// HEZE (EIP-7805)
HEZE_FORK_VERSION: "bytes",
HEZE_FORK_EPOCH: "number",

// Time parameters
SECONDS_PER_SLOT: "number",
Expand All @@ -197,6 +210,8 @@ export const chainConfigTypes: SpecTypes<ChainConfig> = {
PAYLOAD_ATTESTATION_DUE_BPS: "number",
PAYLOAD_DUE_BPS: "number",

INCLUSION_LIST_DUE_BPS: "number",

// Validator cycle
INACTIVITY_SCORE_BIAS: "number",
INACTIVITY_SCORE_RECOVERY_RATE: "number",
Expand Down Expand Up @@ -250,6 +265,11 @@ export const chainConfigTypes: SpecTypes<ChainConfig> = {
VALIDATOR_CUSTODY_REQUIREMENT: "number",
BALANCE_PER_ADDITIONAL_CUSTODY_GROUP: "number",

// HEZE
MAX_REQUEST_INCLUSION_LIST: "number",
MAX_BYTES_PER_INCLUSION_LIST: "number",
INCLUSION_LIST_COMMITTEE_SIZE: "number",

// Gloas
MAX_REQUEST_PAYLOADS: "number",

Expand Down
10 changes: 9 additions & 1 deletion packages/config/src/forkConfig/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,18 @@ export function createForkConfig(config: ChainConfig): ForkConfig {
prevVersion: config.FULU_FORK_VERSION,
prevForkName: ForkName.fulu,
};
const heze: ForkInfo = {
name: ForkName.heze,
seq: ForkSeq.heze,
epoch: config.HEZE_FORK_EPOCH,
version: config.HEZE_FORK_VERSION,
prevVersion: config.GLOAS_FORK_VERSION,
prevForkName: ForkName.gloas,
};

/** Forks in order order of occurence, `phase0` first */
// Note: Downstream code relies on proper ordering.
const forks = {phase0, altair, bellatrix, capella, deneb, electra, fulu, gloas};
const forks = {phase0, altair, bellatrix, capella, deneb, electra, fulu, gloas, heze};

// Prevents allocating an array on every getForkInfo() call
const forksAscendingEpochOrder = Object.values(forks);
Expand Down
12 changes: 12 additions & 0 deletions packages/config/src/testUtils/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,17 @@ export function getConfig(fork: ForkName, forkEpoch = 0): ChainForkConfig {
GLOAS_FORK_EPOCH: forkEpoch,
BLOB_SCHEDULE: [],
});
case ForkName.heze:
return createChainForkConfig({
ALTAIR_FORK_EPOCH: 0,
BELLATRIX_FORK_EPOCH: 0,
CAPELLA_FORK_EPOCH: 0,
DENEB_FORK_EPOCH: 0,
ELECTRA_FORK_EPOCH: 0,
FULU_FORK_EPOCH: 0,
GLOAS_FORK_EPOCH: 0,
HEZE_FORK_EPOCH: forkEpoch,
BLOB_SCHEDULE: [],
});
}
}
10 changes: 1 addition & 9 deletions packages/config/test/e2e/ensure-config-is-synced.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,6 @@ import specTestsVersions from "../spec-tests-version.json" with {type: "json"};
const ignoredRemoteConfigFields: (keyof ChainConfig)[] = [
// BLOB_SCHEDULE is an array/JSON format that requires special parsing
"BLOB_SCHEDULE" as keyof ChainConfig,
// EIP-7805 (Inclusion Lists) - not yet implemented in Lodestar
"VIEW_FREEZE_CUTOFF_BPS" as keyof ChainConfig,
"INCLUSION_LIST_SUBMISSION_DUE_BPS" as keyof ChainConfig,
"INCLUSION_LIST_DUE_BPS" as keyof ChainConfig,
"PROPOSER_INCLUSION_LIST_CUTOFF_BPS" as keyof ChainConfig,
"MAX_REQUEST_INCLUSION_LIST" as keyof ChainConfig,
"MAX_BYTES_PER_INCLUSION_LIST" as keyof ChainConfig,
// Networking params that may be in presets instead of chainConfig
"ATTESTATION_SUBNET_COUNT" as keyof ChainConfig,
"ATTESTATION_SUBNET_EXTRA_BITS" as keyof ChainConfig,
Comment thread
ensi321 marked this conversation as resolved.
Expand All @@ -34,8 +27,6 @@ const ignoredRemoteConfigFields: (keyof ChainConfig)[] = [
"CONSOLIDATION_CHURN_LIMIT_QUOTIENT" as keyof ChainConfig,
"MAX_PER_EPOCH_ACTIVATION_CHURN_LIMIT_GLOAS" as keyof ChainConfig,
// Future forks not yet implemented in Lodestar
"HEZE_FORK_VERSION" as keyof ChainConfig,
"HEZE_FORK_EPOCH" as keyof ChainConfig,
"EIP7928_FORK_VERSION" as keyof ChainConfig,
"EIP7928_FORK_EPOCH" as keyof ChainConfig,
"EIP8025_FORK_VERSION" as keyof ChainConfig,
Expand All @@ -49,6 +40,7 @@ const ignoredRemoteConfigFields: (keyof ChainConfig)[] = [
"ELECTRA_FORK_EPOCH",
"FULU_FORK_EPOCH",
"GLOAS_FORK_EPOCH",
"HEZE_FORK_EPOCH",
// Terminal values are network-specific
"TERMINAL_TOTAL_DIFFICULTY",
"TERMINAL_BLOCK_HASH",
Expand Down
Loading
Loading