Skip to main content

setup_engine_with_chain_import

Function setup_engine_with_chain_import 

Source
pub async fn setup_engine_with_chain_import(
    num_nodes: usize,
    chain_spec: Arc<ChainSpec>,
    is_dev: bool,
    storage_v2: bool,
    tree_config: TreeConfig,
    rlp_path: &Path,
) -> Result<ChainImportResult>
Expand description

Creates a test setup with Ethereum nodes that have pre-imported chain data from RLP files.

This function:

  1. Creates a temporary datadir for each node
  2. Imports the specified RLP chain data into the datadir
  3. Starts the nodes with the pre-populated database
  4. Returns the running nodes ready for testing

The import and all nodes share a single Runtime::test runtime, and the nodes build payloads with eth_payload_attributes for the given chain spec. storage_v2 selects the storage layout (--storage.v2) for both the imported database and the launched nodes.

Note: This function is currently specific to EthereumNode because the import process uses Ethereum-specific consensus and block format. It can be made generic in the future by abstracting the import process. It uses NoopConsensus during import to bypass validation checks like gas limit constraints, which allows importing test chains that may not strictly conform to mainnet consensus rules. The nodes themselves still run with proper consensus when started.