Skip to content

Commit

Permalink
fix: modify minimal preset's field elements per blob to mainnet for d…
Browse files Browse the repository at this point in the history
…ev runs (#5484)

refactor: Modify minimal preset's field elements per blob to mainnet value for dev runs
  • Loading branch information
g11tech committed May 16, 2023
1 parent c2e96c8 commit f417c35
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
8 changes: 8 additions & 0 deletions packages/beacon-node/test/setupPreset.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
import {setActivePreset, PresetName} from "@lodestar/params/setPreset";
// Set minimal
if (process.env.LODESTAR_PRESET === undefined) {
process.env.LODESTAR_PRESET = "minimal";
}

// Override FIELD_ELEMENTS_PER_BLOB if its a dev run, mostly to distinguish from
// spec runs
if (process.env.LODESTAR_PRESET === "minimal" && process.env.DEV_RUN) {
// eslint-disable-next-line @typescript-eslint/naming-convention
setActivePreset(PresetName.minimal, {FIELD_ELEMENTS_PER_BLOB: 4096});
}
8 changes: 7 additions & 1 deletion packages/cli/src/applyPreset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// set LODESTAR_PRESET manually every time.

// IMPORTANT: only import Lodestar code here which does not import any other Lodestar libraries
import {setActivePreset, presetFromJson} from "@lodestar/params/setPreset";
import {setActivePreset, presetFromJson, PresetName} from "@lodestar/params/setPreset";
import {readFile} from "./util/file.js";

const network = valueOfArg("network");
Expand All @@ -35,6 +35,9 @@ else if (process.env.LODESTAR_PRESET) {
else if (network) {
if (network === "dev") {
process.env.LODESTAR_PRESET = "minimal";
// "c-kzg" has hardcoded the mainnet value, do not use presets
// eslint-disable-next-line @typescript-eslint/naming-convention
setActivePreset(PresetName.minimal, {FIELD_ELEMENTS_PER_BLOB: 4096});
} else if (network === "gnosis" || network === "chiado") {
process.env.LODESTAR_PRESET = "gnosis";
}
Expand All @@ -44,6 +47,9 @@ else if (network) {
else if (process.argv[2] === "dev") {
process.env.LODESTAR_PRESET = "minimal";
process.env.LODESTAR_NETWORK = "dev";
// "c-kzg" has hardcoded the mainnet value, do not use presets
// eslint-disable-next-line @typescript-eslint/naming-convention
setActivePreset(PresetName.minimal, {FIELD_ELEMENTS_PER_BLOB: 4096});
}

if (presetFile) {
Expand Down

0 comments on commit f417c35

Please sign in to comment.