![Create React App Officially Deprecated Amid React 19 Compatibility Issues](https://cdn.sanity.io/images/cgdhsj6q/production/04fa08cf844d798abc0e1a6391c129363cc7e2ab-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Create React App Officially Deprecated Amid React 19 Compatibility Issues
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
@chainsafe/lodestar-config
Advanced tools
This package is part of ChainSafe's Lodestar project
Lodestar defines all network configuration variables defined in the Ethereum Consensus spec. This tooling may be used to configure testnets, ingest mainnet/testnet config variables, or be used in downstream Lodestar libraries.
npm install @chainsafe/lodestar-config
The Lodestar config package contains several interfaces used in downstream Lodestar libraries:
IChainConfig
- Typescript interface, Default (mainnet) values, and matching SSZ helper type objectIForkConfig
- A fork helper object that's structured around the fork scheduleIChainForkConfig
A wrapper object that implements IChainConfig
and IForkConfig
ICachedGenesis
- A helper object for caching domains (which relies on the genesis validators root)IBeaconConfig
- A wrapper object that implements all above interfacesThe Ethereum consensus spec defines a bunch of variables that may be easily configured per testnet. These include the GENESIS_TIME
, SECONDS_PER_SLOT
, and various *_FORK_EPOCH
s, *_FORK_VERSION
s, etc. The Lodestar config package exports the IChainConfig
interface and matching ChainConfig
SSZ type, which include all of these variables, named verbatim from the spec.
import {IChainConfig} from "@chainsafe/lodestar-config";
import {chainConfig} from "@chainsafe/lodestar-config/default";
let config: IChainConfig = chainConfig;
const x: number = config.SECONDS_PER_SLOT;
Mainnet default values are available as a singleton IChainConfig
under the default
import path.
import {chainConfig} from "@chainsafe/lodestar-config/default";
chainConfig.SECONDS_PER_SLOT === 12;
There are also utility functions to help create a IChainConfig
from unknown input and partial configs.
import {createIChainConfig, IChainConfig, chainConfigFromJson} from "@chainsafe/lodestar-config";
// example config
let chainConfigObj: Record<string, unknown> = {
// phase0
MIN_PER_EPOCH_CHURN_LIMIT: 4,
CHURN_LIMIT_QUOTIENT: 65536,
MIN_GENESIS_ACTIVE_VALIDATOR_COUNT: 128,
MIN_GENESIS_TIME: 1621504614,
ETH1_FOLLOW_DISTANCE: 2048,
SECONDS_PER_ETH1_BLOCK: 14,
DEPOSIT_CHAIN_ID: 5,
DEPOSIT_NETWORK_ID: 5,
DEPOSIT_CONTRACT_ADDRESS: "0x2cc88381fe23027743c1f85512bffb383acca7c7",
EJECTION_BALANCE: 16000000000,
GENESIS_FORK_VERSION: "0x00004811",
GENESIS_DELAY: 1100642,
SECONDS_PER_SLOT: 12,
MIN_VALIDATOR_WITHDRAWABILITY_DELAY: 256,
SHARD_COMMITTEE_PERIOD: 256,
// altair
INACTIVITY_SCORE_BIAS: 4,
INACTIVITY_SCORE_RECOVERY_RATE: 16,
ALTAIR_FORK_VERSION: "0x01004811",
ALTAIR_FORK_EPOCH: 10,
};
const partialChainConfig: Partial<IChainConfig> = chainConfigFromJson(chainConfigObj);
// Fill in the missing values with mainnet default values
const chainConfig: IChainConfig = createIChainConfig(partialChainConfig);
The variables described in the spec can be used to assemble a more structured 'fork schedule'. This info is organized as IForkConfig
in the Lodestar config package. In practice, the IChainConfig
and IForkConfig
are usually combined as a IChainForkConfig
.
A IForkConfig
provides methods to select the fork info, fork name, fork version, or fork ssz types given a slot.
import {GENESIS_SLOT} from "@chainsafe/lodestar-params";
import {createIChainForkConfig, IChainForkConfig} from "@chainsafe/lodestar-config";
import {config as chainConfig} from "@chainsafe/lodestar-config/default";
const config: IChainForkConfig = createIChainForkConfig(chainConfig);
const version = config.getForkVersion(GENESIS_SLOT);
For signing Ethereum consensus objects, a cryptographic "domain" is computed and mixed into the signed message. This domain separates signatures made for the Ethereum mainnet from testnets or other instances of the chain. The ICachedGenesis
interface is used to provide a cache for this purpose. Practically, the domain rarely changes, only per-fork, and so the value can be easily cached. Since the genesis validators root is part of the domain, it is required input to instantiate an ICachedGenesis
. In practice, the IChainForkConfig
and ICachedGenesis
are usually combined as a IBeaconConfig
. This is the 'highest level' object exported by the Lodestar config library.
import {DOMAIN_DEPOSIT, GENESIS_SLOT} from "@chainsafe/lodestar-params";
import {createIBeaconConfig, IBeaconConfig} from "@chainsafe/lodestar-config";
import {config as chainConfig} from "@chainsafe/lodestar-config/default";
// dummy test root
let genesisValidatorsRoot: Uint8Array = new Uint8Array();
const config: IBeaconConfig = createIBeaconConfig(chainConfig, genesisValidatorsRoot);
const domain = config.getDomain(DOMAIN_DEPOSIT, GENESIS_SLOT);
Apache-2.0 ChainSafe Systems
FAQs
Chain configuration required for lodestar
The npm package @chainsafe/lodestar-config receives a total of 0 weekly downloads. As such, @chainsafe/lodestar-config popularity was classified as not popular.
We found that @chainsafe/lodestar-config demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 5 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.