mirror of
https://github.com/ChainSafe/lodestar.git
synced 2026-01-09 15:48:08 -05:00
feat: fulu types (#7774)
**Motivation** - prep for block input refactor - **Description** - pull fulu types out of `peerDAS` branch --------- Co-authored-by: Nico Flaig <nflaig@protonmail.com> Co-authored-by: Matthew Keil <me@matthewkeil.com>
This commit is contained in:
@@ -96,6 +96,20 @@ export function isForkPostElectra(fork: ForkName): fork is ForkPostElectra {
|
||||
return isForkPostDeneb(fork) && fork !== ForkName.deneb;
|
||||
}
|
||||
|
||||
export type ForkPreFulu = ForkPreElectra | ForkName.electra;
|
||||
export type ForkPostFulu = Exclude<ForkName, ForkPreFulu>;
|
||||
export const forkPostFulu = exclude(forkAll, [
|
||||
ForkName.phase0,
|
||||
ForkName.altair,
|
||||
ForkName.bellatrix,
|
||||
ForkName.capella,
|
||||
ForkName.deneb,
|
||||
ForkName.electra,
|
||||
]);
|
||||
export function isForkPostFulu(fork: ForkName): fork is ForkPostFulu {
|
||||
return isForkPostElectra(fork) && fork !== ForkName.electra;
|
||||
}
|
||||
|
||||
/*
|
||||
* Aliases only exported for backwards compatibility. This will be removed in
|
||||
* lodestar v2.0. The types and guards above should be used in all places as
|
||||
|
||||
@@ -108,6 +108,10 @@ export const {
|
||||
MAX_PENDING_PARTIALS_PER_WITHDRAWALS_SWEEP,
|
||||
MAX_PENDING_DEPOSITS_PER_EPOCH,
|
||||
WHISTLEBLOWER_REWARD_QUOTIENT_ELECTRA,
|
||||
|
||||
FIELD_ELEMENTS_PER_CELL,
|
||||
FIELD_ELEMENTS_PER_EXT_BLOB,
|
||||
KZG_COMMITMENTS_INCLUSION_PROOF_DEPTH,
|
||||
} = activePreset;
|
||||
|
||||
////////////
|
||||
@@ -273,3 +277,16 @@ export const NEXT_SYNC_COMMITTEE_INDEX_ELECTRA = 23;
|
||||
export const DEPOSIT_REQUEST_TYPE = 0x00;
|
||||
export const WITHDRAWAL_REQUEST_TYPE = 0x01;
|
||||
export const CONSOLIDATION_REQUEST_TYPE = 0x02;
|
||||
|
||||
// 128
|
||||
export const NUMBER_OF_COLUMNS = (FIELD_ELEMENTS_PER_BLOB * 2) / FIELD_ELEMENTS_PER_CELL;
|
||||
export const BYTES_PER_CELL = FIELD_ELEMENTS_PER_CELL * BYTES_PER_FIELD_ELEMENT;
|
||||
export const CELLS_PER_EXT_BLOB = FIELD_ELEMENTS_PER_EXT_BLOB / FIELD_ELEMENTS_PER_CELL;
|
||||
|
||||
// ssz.fulu.BeaconBlockBody.getPathInfo(['blobKzgCommitments']).gindex
|
||||
export const KZG_COMMITMENTS_GINDEX = 27;
|
||||
export const KZG_COMMITMENTS_SUBTREE_INDEX = KZG_COMMITMENTS_GINDEX - 2 ** KZG_COMMITMENTS_INCLUSION_PROOF_DEPTH;
|
||||
|
||||
export const MAX_REQUEST_DATA_COLUMN_SIDECARS = MAX_REQUEST_BLOCKS_DENEB * NUMBER_OF_COLUMNS; // 16384
|
||||
export const DATA_COLUMN_SIDECAR_SUBNET_COUNT = 128;
|
||||
export const NUMBER_OF_CUSTODY_GROUPS = 128;
|
||||
|
||||
@@ -133,4 +133,10 @@ export const mainnetPreset: BeaconPreset = {
|
||||
PENDING_CONSOLIDATIONS_LIMIT: 262144,
|
||||
MAX_CONSOLIDATION_REQUESTS_PER_PAYLOAD: 2,
|
||||
WHISTLEBLOWER_REWARD_QUOTIENT_ELECTRA: 4096,
|
||||
|
||||
// FULU
|
||||
///////////
|
||||
FIELD_ELEMENTS_PER_CELL: 64,
|
||||
FIELD_ELEMENTS_PER_EXT_BLOB: 8192,
|
||||
KZG_COMMITMENTS_INCLUSION_PROOF_DEPTH: 4,
|
||||
};
|
||||
|
||||
@@ -115,8 +115,6 @@ export const minimalPreset: BeaconPreset = {
|
||||
// DENEB
|
||||
///////////
|
||||
FIELD_ELEMENTS_PER_BLOB: 4096,
|
||||
MAX_BLOB_COMMITMENTS_PER_BLOCK: 32,
|
||||
KZG_COMMITMENT_INCLUSION_PROOF_DEPTH: 10,
|
||||
|
||||
// ELECTRA
|
||||
MAX_DEPOSIT_REQUESTS_PER_PAYLOAD: 4,
|
||||
@@ -134,4 +132,12 @@ export const minimalPreset: BeaconPreset = {
|
||||
PENDING_CONSOLIDATIONS_LIMIT: 64,
|
||||
MAX_CONSOLIDATION_REQUESTS_PER_PAYLOAD: 2,
|
||||
WHISTLEBLOWER_REWARD_QUOTIENT_ELECTRA: 4096,
|
||||
MAX_BLOB_COMMITMENTS_PER_BLOCK: 32,
|
||||
KZG_COMMITMENT_INCLUSION_PROOF_DEPTH: 10,
|
||||
|
||||
// FULU
|
||||
///////////
|
||||
FIELD_ELEMENTS_PER_CELL: 64,
|
||||
FIELD_ELEMENTS_PER_EXT_BLOB: 8192,
|
||||
KZG_COMMITMENTS_INCLUSION_PROOF_DEPTH: 4,
|
||||
};
|
||||
|
||||
@@ -95,6 +95,12 @@ export type BeaconPreset = {
|
||||
PENDING_CONSOLIDATIONS_LIMIT: number;
|
||||
MAX_CONSOLIDATION_REQUESTS_PER_PAYLOAD: number;
|
||||
WHISTLEBLOWER_REWARD_QUOTIENT_ELECTRA: number;
|
||||
|
||||
// FULU
|
||||
///////////
|
||||
FIELD_ELEMENTS_PER_CELL: number;
|
||||
FIELD_ELEMENTS_PER_EXT_BLOB: number;
|
||||
KZG_COMMITMENTS_INCLUSION_PROOF_DEPTH: number;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -195,6 +201,12 @@ export const beaconPresetTypes: BeaconPresetTypes = {
|
||||
PENDING_CONSOLIDATIONS_LIMIT: "number",
|
||||
MAX_CONSOLIDATION_REQUESTS_PER_PAYLOAD: "number",
|
||||
WHISTLEBLOWER_REWARD_QUOTIENT_ELECTRA: "number",
|
||||
|
||||
// FULU
|
||||
///////////
|
||||
FIELD_ELEMENTS_PER_CELL: "number",
|
||||
FIELD_ELEMENTS_PER_EXT_BLOB: "number",
|
||||
KZG_COMMITMENTS_INCLUSION_PROOF_DEPTH: "number",
|
||||
};
|
||||
|
||||
type BeaconPresetTypes = {
|
||||
|
||||
@@ -53,15 +53,12 @@ function assertCorrectPreset(localPreset: BeaconPreset, remotePreset: BeaconPres
|
||||
|
||||
async function downloadRemoteConfig(preset: "mainnet" | "minimal", commit: string): Promise<BeaconPreset> {
|
||||
const downloadedParams = await Promise.all(
|
||||
Object.values(ForkName)
|
||||
// TODO Fulu: check against remote presets
|
||||
.filter((forkName) => forkName !== ForkName.fulu)
|
||||
.map((forkName) =>
|
||||
axios({
|
||||
url: `https://raw.githubusercontent.com/ethereum/consensus-specs/${commit}/presets/${preset}/${forkName}.yaml`,
|
||||
timeout: 30 * 1000,
|
||||
}).then((response) => loadConfigYaml(response.data))
|
||||
)
|
||||
Object.values(ForkName).map((forkName) =>
|
||||
axios({
|
||||
url: `https://raw.githubusercontent.com/ethereum/consensus-specs/${commit}/presets/${preset}/${forkName}.yaml`,
|
||||
timeout: 30 * 1000,
|
||||
}).then((response) => loadConfigYaml(response.data))
|
||||
)
|
||||
);
|
||||
|
||||
// Merge all the fetched yamls for the different forks
|
||||
|
||||
@@ -15,14 +15,14 @@ describe("forkName", () => {
|
||||
expect(forkAll).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it("should have valid post-bellatrix forks", () => {
|
||||
expect(forkPostBellatrix).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it("should have valid post-altair forks", () => {
|
||||
expect(forkPostAltair).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it("should have valid post-bellatrix forks", () => {
|
||||
expect(forkPostBellatrix).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it("should have valid post-capella forks", () => {
|
||||
expect(forkPostCapella).toMatchSnapshot();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user