Skip to content

Commit

Permalink
Init
Browse files Browse the repository at this point in the history
  • Loading branch information
ensi321 committed Dec 17, 2024
1 parent 031214e commit 13d6448
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 5 deletions.
6 changes: 5 additions & 1 deletion packages/config/src/chainConfig/configs/mainnet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@ export const chainConfig: ChainConfig = {
// Electra
// 2**8 * 10**9 (= 256,000,000,000)
MAX_PER_EPOCH_ACTIVATION_EXIT_CHURN_LIMIT: 256000000000,
// 2*7 * 10**9 (= 128,000,000,000)
// 2**7 * 10**9 (= 128,000,000,000)
MIN_PER_EPOCH_CHURN_LIMIT_ELECTRA: 128000000000,
BLOB_SIDECAR_SUBNET_COUNT_ELECTRA: 9,
MAX_BLOBS_PER_BLOCK_ELECTRA: 9,
// MAX_REQUEST_BLOCKS_DENEB * MAX_BLOBS_PER_BLOCK_ELECTRA
MAX_REQUEST_BLOB_SIDECARS_ELECTRA: 1152,
};
4 changes: 4 additions & 0 deletions packages/config/src/chainConfig/configs/minimal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,4 +108,8 @@ export const chainConfig: ChainConfig = {
MAX_PER_EPOCH_ACTIVATION_EXIT_CHURN_LIMIT: 128000000000,
// 2**6 * 10**9 (= 64,000,000,000)
MIN_PER_EPOCH_CHURN_LIMIT_ELECTRA: 64000000000,
BLOB_SIDECAR_SUBNET_COUNT_ELECTRA: 9,
MAX_BLOBS_PER_BLOCK_ELECTRA: 9,
// MAX_REQUEST_BLOCKS_DENEB * MAX_BLOBS_PER_BLOCK_ELECTRA
MAX_REQUEST_BLOB_SIDECARS_ELECTRA: 1152,
};
6 changes: 6 additions & 0 deletions packages/config/src/chainConfig/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ export type ChainConfig = {
BLOB_SIDECAR_SUBNET_COUNT: number;
MAX_BLOBS_PER_BLOCK: number;
MAX_REQUEST_BLOB_SIDECARS: number;
BLOB_SIDECAR_SUBNET_COUNT_ELECTRA: number;
MAX_BLOBS_PER_BLOCK_ELECTRA: number;
MAX_REQUEST_BLOB_SIDECARS_ELECTRA: number;
};

export const chainConfigTypes: SpecTypes<ChainConfig> = {
Expand Down Expand Up @@ -142,6 +145,9 @@ export const chainConfigTypes: SpecTypes<ChainConfig> = {
BLOB_SIDECAR_SUBNET_COUNT: "number",
MAX_BLOBS_PER_BLOCK: "number",
MAX_REQUEST_BLOB_SIDECARS: "number",
BLOB_SIDECAR_SUBNET_COUNT_ELECTRA: "number",
MAX_BLOBS_PER_BLOCK_ELECTRA: "number",
MAX_REQUEST_BLOB_SIDECARS_ELECTRA: "number",
};

/** Allows values in a Spec file */
Expand Down
4 changes: 2 additions & 2 deletions packages/params/src/presets/minimal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ export const minimalPreset: BeaconPreset = {
// DENEB
///////////
FIELD_ELEMENTS_PER_BLOB: 4096,
MAX_BLOB_COMMITMENTS_PER_BLOCK: 16,
KZG_COMMITMENT_INCLUSION_PROOF_DEPTH: 9,
MAX_BLOB_COMMITMENTS_PER_BLOCK: 32,
KZG_COMMITMENT_INCLUSION_PROOF_DEPTH: 10,

// ELECTRA
MAX_DEPOSIT_REQUESTS_PER_PAYLOAD: 4,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,11 @@ export function processExecutionPayload(
}

if (fork >= ForkSeq.deneb) {
const maxBlobsPerBlock =
fork >= ForkSeq.electra ? state.config.MAX_BLOBS_PER_BLOCK_ELECTRA : state.config.MAX_BLOBS_PER_BLOCK;
const blobKzgCommitmentsLen = (body as deneb.BeaconBlockBody).blobKzgCommitments?.length ?? 0;
if (blobKzgCommitmentsLen > state.config.MAX_BLOBS_PER_BLOCK) {
throw Error(`blobKzgCommitmentsLen exceeds limit=${state.config.MAX_BLOBS_PER_BLOCK}`);
if (blobKzgCommitmentsLen > maxBlobsPerBlock) {
throw Error(`blobKzgCommitmentsLen exceeds limit=${maxBlobsPerBlock}`);
}
}

Expand Down
3 changes: 3 additions & 0 deletions packages/validator/src/util/params.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ function getSpecCriticalParams(localConfig: ChainConfig): Record<keyof ConfigWit
MIN_EPOCHS_FOR_BLOB_SIDECARS_REQUESTS: false,
BLOB_SIDECAR_SUBNET_COUNT: false,
MAX_REQUEST_BLOB_SIDECARS: false,
MAX_REQUEST_BLOB_SIDECARS_ELECTRA: false,

// # Phase0Preset
/////////////////
Expand Down Expand Up @@ -239,5 +240,7 @@ function getSpecCriticalParams(localConfig: ChainConfig): Record<keyof ConfigWit
WHISTLEBLOWER_REWARD_QUOTIENT_ELECTRA: electraForkRelevant,
MAX_PER_EPOCH_ACTIVATION_EXIT_CHURN_LIMIT: electraForkRelevant,
MIN_PER_EPOCH_CHURN_LIMIT_ELECTRA: electraForkRelevant,
BLOB_SIDECAR_SUBNET_COUNT_ELECTRA: electraForkRelevant,
MAX_BLOBS_PER_BLOCK_ELECTRA: electraForkRelevant,
};
}

0 comments on commit 13d6448

Please sign in to comment.