Skip to content

Commit

Permalink
ebps -> epbs
Browse files Browse the repository at this point in the history
  • Loading branch information
ensi321 committed Sep 14, 2024
1 parent 5c1083a commit 8ac76d0
Show file tree
Hide file tree
Showing 23 changed files with 84 additions and 83 deletions.
2 changes: 1 addition & 1 deletion packages/beacon-node/test/spec/presets/fork.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const fork: TestRunnerFn<ForkStateCase, BeaconStateAllForks> = (forkNext) => {
return slotFns.upgradeStateToDeneb(preState as CachedBeaconStateCapella);
case ForkName.electra:
return slotFns.upgradeStateToElectra(preState as CachedBeaconStateDeneb);
case ForkName.ebps:
case ForkName.epbs:
throw Error("not Implemented");
}
},
Expand Down
4 changes: 2 additions & 2 deletions packages/beacon-node/test/spec/presets/transition.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,14 +110,14 @@ function getTransitionConfig(fork: ForkName, forkEpoch: number): Partial<ChainCo
DENEB_FORK_EPOCH: 0,
ELECTRA_FORK_EPOCH: forkEpoch,
};
case ForkName.ebps:
case ForkName.epbs:
return {
ALTAIR_FORK_EPOCH: 0,
BELLATRIX_FORK_EPOCH: 0,
CAPELLA_FORK_EPOCH: 0,
DENEB_FORK_EPOCH: 0,
ELECTRA_FORK_EPOCH: 0,
EBPS_FORK_EPOCH: forkEpoch,
EPBS_FORK_EPOCH: forkEpoch,
};
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ describe("UpgradeLightClientHeader", function () {
CAPELLA_FORK_EPOCH: 3,
DENEB_FORK_EPOCH: 4,
ELECTRA_FORK_EPOCH: 5,
EBPS_FORK_EPOCH: Infinity,
EPBS_FORK_EPOCH: Infinity,
});

const genesisValidatorsRoot = Buffer.alloc(32, 0xaa);
Expand All @@ -30,7 +30,7 @@ describe("UpgradeLightClientHeader", function () {
bellatrix: ssz.altair.LightClientHeader.defaultValue(),
deneb: ssz.deneb.LightClientHeader.defaultValue(),
electra: ssz.electra.LightClientHeader.defaultValue(),
ebps: ssz.ebps.LightClientHeader.defaultValue(),
epbs: ssz.epbs.LightClientHeader.defaultValue(),
};

testSlots = {
Expand All @@ -40,12 +40,12 @@ describe("UpgradeLightClientHeader", function () {
capella: 25,
deneb: 33,
electra: 41,
ebps: 0,
epbs: 0,
};
});

// Since ebps is not implemented for loop is till deneb (Object.values(ForkName).length-1)
// Once ebps is implemnted run for loop till Object.values(ForkName).length
// Since epbs is not implemented for loop is till deneb (Object.values(ForkName).length-1)
// Once epbs is implemnted run for loop till Object.values(ForkName).length

// for (let i = ForkSeq.altair; i < Object.values(ForkName).length; i++) {
// for (let j = i + 1; j < Object.values(ForkName).length; j++) {
Expand All @@ -65,10 +65,10 @@ describe("UpgradeLightClientHeader", function () {
}
}

// for ebps not implemented
// for epbs not implemented
for (let i = ForkSeq.altair; i < Object.values(ForkName).length; i++) {
const fromFork = ForkName[ForkSeq[i] as ForkName];
const toFork = ForkName["ebps"];
const toFork = ForkName["epbs"];

it(`Throw error ${fromFork}=>${toFork}`, function () {
lcHeaderByFork[fromFork].beacon.slot = testSlots[fromFork];
Expand All @@ -80,8 +80,8 @@ describe("UpgradeLightClientHeader", function () {
});
}

// Since ebps is not implemented for loop is till deneb (Object.values(ForkName).length-1)
// Once ebps is implemnted run for loop till Object.values(ForkName).length
// Since epbs is not implemented for loop is till deneb (Object.values(ForkName).length-1)
// Once epbs is implemnted run for loop till Object.values(ForkName).length

// for (let i = ForkSeq.altair; i < Object.values(ForkName).length; i++) {

Expand Down
16 changes: 8 additions & 8 deletions packages/beacon-node/test/unit/network/fork.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ function getForkConfig({
capella,
deneb,
electra,
ebps,
epbs,
}: {
phase0: number;
altair: number;
bellatrix: number;
capella: number;
deneb: number;
electra: number;
ebps: number;
epbs: number;
}): BeaconConfig {
const forks: Record<ForkName, ForkInfo> = {
phase0: {
Expand Down Expand Up @@ -69,10 +69,10 @@ function getForkConfig({
prevVersion: Buffer.from([0, 0, 0, 4]),
prevForkName: ForkName.deneb,
},
ebps: {
name: ForkName.ebps,
seq: ForkSeq.ebps,
epoch: ebps,
epbs: {
name: ForkName.epbs,
seq: ForkSeq.epbs,
epoch: epbs,
version: Buffer.from([0, 0, 0, 9]),
prevVersion: Buffer.from([0, 0, 0, 5]),
prevForkName: ForkName.electra,
Expand Down Expand Up @@ -154,10 +154,10 @@ for (const testScenario of testScenarios) {
const {phase0, altair, bellatrix, capella, testCases} = testScenario;
const deneb = Infinity;
const electra = Infinity;
const ebps = Infinity;
const epbs = Infinity;

describe(`network / fork: phase0: ${phase0}, altair: ${altair}, bellatrix: ${bellatrix} capella: ${capella}`, () => {
const forkConfig = getForkConfig({phase0, altair, bellatrix, capella, deneb, electra, ebps});
const forkConfig = getForkConfig({phase0, altair, bellatrix, capella, deneb, electra, epbs});
const forks = forkConfig.forks;
for (const testCase of testCases) {
const {epoch, currentFork, nextFork, activeForks} = testCase;
Expand Down
4 changes: 2 additions & 2 deletions packages/beacon-node/test/utils/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@ export function getConfig(fork: ForkName, forkEpoch = 0): ChainForkConfig {
DENEB_FORK_EPOCH: 0,
ELECTRA_FORK_EPOCH: forkEpoch,
});
case ForkName.ebps:
case ForkName.epbs:
return createChainForkConfig({
ALTAIR_FORK_EPOCH: 0,
BELLATRIX_FORK_EPOCH: 0,
CAPELLA_FORK_EPOCH: 0,
DENEB_FORK_EPOCH: 0,
ELECTRA_FORK_EPOCH: 0,
EBPS_FORK_EPOCH: forkEpoch,
EPBS_FORK_EPOCH: forkEpoch,
});
}
}
6 changes: 3 additions & 3 deletions packages/config/src/chainConfig/configs/mainnet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ export const chainConfig: ChainConfig = {
ELECTRA_FORK_VERSION: b("0x05000000"),
ELECTRA_FORK_EPOCH: Infinity,

// Ebps
EBPS_FORK_VERSION: b("0x09000000"),
EBPS_FORK_EPOCH: Infinity,
// epbs
EPBS_FORK_VERSION: b("0x09000000"),
EPBS_FORK_EPOCH: Infinity,

// Time parameters
// ---------------------------------------------------------------
Expand Down
6 changes: 3 additions & 3 deletions packages/config/src/chainConfig/configs/minimal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ export const chainConfig: ChainConfig = {
ELECTRA_FORK_VERSION: b("0x05000001"),
ELECTRA_FORK_EPOCH: Infinity,

// Ebps
EBPS_FORK_VERSION: b("0x05000001"),
EBPS_FORK_EPOCH: Infinity,
// epbs
EPBS_FORK_VERSION: b("0x05000001"),
EPBS_FORK_EPOCH: Infinity,

// Time parameters
// ---------------------------------------------------------------
Expand Down
12 changes: 6 additions & 6 deletions packages/config/src/chainConfig/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ export type ChainConfig = {
// ELECTRA
ELECTRA_FORK_VERSION: Uint8Array;
ELECTRA_FORK_EPOCH: number;
// EBPS
EBPS_FORK_VERSION: Uint8Array;
EBPS_FORK_EPOCH: number;
// EPBS
EPBS_FORK_VERSION: Uint8Array;
EPBS_FORK_EPOCH: number;

// Time parameters
SECONDS_PER_SLOT: number;
Expand Down Expand Up @@ -110,9 +110,9 @@ export const chainConfigTypes: SpecTypes<ChainConfig> = {
// ELECTRA
ELECTRA_FORK_VERSION: "bytes",
ELECTRA_FORK_EPOCH: "number",
// EBPS
EBPS_FORK_VERSION: "bytes",
EBPS_FORK_EPOCH: "number",
// epbs
EPBS_FORK_VERSION: "bytes",
EPBS_FORK_EPOCH: "number",

// Time parameters
SECONDS_PER_SLOT: "number",
Expand Down
12 changes: 6 additions & 6 deletions packages/config/src/forkConfig/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,18 +67,18 @@ export function createForkConfig(config: ChainConfig): ForkConfig {
prevVersion: config.DENEB_FORK_VERSION,
prevForkName: ForkName.deneb,
};
const ebps: ForkInfo = {
name: ForkName.ebps,
seq: ForkSeq.ebps,
epoch: config.EBPS_FORK_EPOCH,
version: config.EBPS_FORK_VERSION,
const epbs: ForkInfo = {
name: ForkName.epbs,
seq: ForkSeq.epbs,
epoch: config.EPBS_FORK_EPOCH,
version: config.EPBS_FORK_VERSION,
prevVersion: config.ELECTRA_FORK_VERSION,
prevForkName: ForkName.electra,
};

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

// Prevents allocating an array on every getForkInfo() call
const forksAscendingEpochOrder = Object.values(forks);
Expand Down
2 changes: 1 addition & 1 deletion packages/light-client/src/spec/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ export function upgradeLightClientHeader(
if (ForkSeq[targetFork] <= ForkSeq.electra) break;

// eslint-disable-next-line no-fallthrough
case ForkName.ebps:
case ForkName.epbs:
throw Error("Not Implemented");
}
return upgradedHeader;
Expand Down
4 changes: 2 additions & 2 deletions packages/params/src/forkName.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export enum ForkName {
capella = "capella",
deneb = "deneb",
electra = "electra",
ebps = "ebps",
epbs = "epbs",
}

/**
Expand All @@ -21,7 +21,7 @@ export enum ForkSeq {
capella = 3,
deneb = 4,
electra = 5,
ebps = 6,
epbs = 6,
}

function exclude<T extends ForkName, U extends T>(coll: T[], val: U[]): Exclude<T, U>[] {
Expand Down
2 changes: 1 addition & 1 deletion packages/params/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ export const NEXT_SYNC_COMMITTEE_DEPTH_ELECTRA = 6;
export const FINALIZED_ROOT_DEPTH_ELECTRA = 7;
export const FINALIZED_ROOT_INDEX_ELECTRA = 169;

// ebps
// epbs
export const PAYLOAD_ABSENT = 0;
export const PAYLOAD_PRESENT = 1;
export const PAYLOAD_WITHHELD = 2;
Expand Down
2 changes: 1 addition & 1 deletion packages/params/src/presets/mainnet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ export const mainnetPreset: BeaconPreset = {
MAX_CONSOLIDATION_REQUESTS_PER_PAYLOAD: 1,
WHISTLEBLOWER_REWARD_QUOTIENT_ELECTRA: 4096,

// ebps - EIP-7732
// epbs - EIP-7732
// uint64(2**9) = 512
PTC_SIZE: 512,
// 2**2 = 4
Expand Down
2 changes: 1 addition & 1 deletion packages/params/src/presets/minimal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ export const minimalPreset: BeaconPreset = {
MAX_CONSOLIDATION_REQUESTS_PER_PAYLOAD: 1,
WHISTLEBLOWER_REWARD_QUOTIENT_ELECTRA: 4096,

// ebps - EIP-7732
// epbs - EIP-7732
// uint64(2**9) = 512
PTC_SIZE: 512,
// 2**2 = 4
Expand Down
4 changes: 2 additions & 2 deletions packages/params/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export type BeaconPreset = {
MAX_CONSOLIDATION_REQUESTS_PER_PAYLOAD: number;
WHISTLEBLOWER_REWARD_QUOTIENT_ELECTRA: number;

// EBPS
// EPBS
PTC_SIZE: number;
MAX_PAYLOAD_ATTESTATIONS: number;
};
Expand Down Expand Up @@ -202,7 +202,7 @@ export const beaconPresetTypes: BeaconPresetTypes = {
MAX_CONSOLIDATION_REQUESTS_PER_PAYLOAD: "number",
WHISTLEBLOWER_REWARD_QUOTIENT_ELECTRA: "number",

// EBPS
// EPBS
PTC_SIZE: "number",
MAX_PAYLOAD_ATTESTATIONS: "number",
};
Expand Down
4 changes: 2 additions & 2 deletions packages/state-transition/test/unit/upgradeState.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,14 @@ function getConfig(fork: ForkName, forkEpoch = 0): ChainForkConfig {
DENEB_FORK_EPOCH: 0,
ELECTRA_FORK_EPOCH: forkEpoch,
});
case ForkName.ebps:
case ForkName.epbs:
return createChainForkConfig({
ALTAIR_FORK_EPOCH: 0,
BELLATRIX_FORK_EPOCH: 0,
CAPELLA_FORK_EPOCH: 0,
DENEB_FORK_EPOCH: 0,
ELECTRA_FORK_EPOCH: 0,
EBPS_FORK_EPOCH: forkEpoch,
EPBS_FORK_EPOCH: forkEpoch,
});
}
}
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {ssz as phase0Ssz} from "../phase0/index.js";
import {ssz as altairSsz} from "../altair/index.js";
import {ssz as capellaSsz} from "../capella/index.js";
import {ssz as denebSsz} from "../deneb/index.js";
import {ssz as electraSsz} from "../electra/index.js";

const {BLSSignature, Root, Slot, Uint8, ValidatorIndex, Gwei, Boolean, UintNum64} = primitiveSsz;

Expand Down Expand Up @@ -48,7 +49,7 @@ export const IndexedPayloadAttestation = new ContainerType(

export const ExecutionPayload = new ContainerType(
{
...denebSsz.ExecutionPayload.fields,
...electraSsz.ExecutionPayload.fields,
},
{typeName: "ExecutionPayload", jsonCase: "eth2"}
);
Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions packages/types/src/sszTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import {ssz as bellatrix} from "./bellatrix/index.js";
import {ssz as capella} from "./capella/index.js";
import {ssz as deneb} from "./deneb/index.js";
import {ssz as electra} from "./electra/index.js";
import {ssz as ebps} from "./ebps/index.js";
import {ssz as epbs} from "./epbs/index.js";

export * from "./primitive/sszTypes.js";
export {phase0, altair, bellatrix, capella, deneb, electra, ebps};
export {phase0, altair, bellatrix, capella, deneb, electra, epbs};

/**
* Index the ssz types that differ by fork
Expand All @@ -22,7 +22,7 @@ const typesByFork = {
[ForkName.capella]: {...phase0, ...altair, ...bellatrix, ...capella},
[ForkName.deneb]: {...phase0, ...altair, ...bellatrix, ...capella, ...deneb},
[ForkName.electra]: {...phase0, ...altair, ...bellatrix, ...capella, ...deneb, ...electra},
[ForkName.ebps]: {...phase0, ...altair, ...bellatrix, ...capella, ...deneb, ...electra, ...ebps},
[ForkName.epbs]: {...phase0, ...altair, ...bellatrix, ...capella, ...deneb, ...electra, ...epbs},
};

/**
Expand Down
Loading

0 comments on commit 8ac76d0

Please sign in to comment.