reth
reth copied to clipboard
op-reth:How to set the is-optimism flag to true in the genesis.json file when running an L2 private chain with op reth?
Describe the change
I generated the genesis. json file for L2 according to the aspects in this document, and then started op reth using the following command.
export OP_SRC_PATH= ~/Source/work/op/optimism;
export OP_RETH_SRC_PATH= ~/Source/work/reth;
export VERBOSITY=${GETH_VERBOSITY:-3};
export GETH_DATA_DIR=~/test/op/l2/db;
export GETH_CHAINDATA_DIR="$GETH_DATA_DIR/geth/chaindata";
export GENESIS_FILE_PATH=$OP_SRC_PATH/.devnet/genesis-l2.json;
export CHAIN_ID=$(cat "$GENESIS_FILE_PATH" | jq -r .config.chainId);
export JWT_SECRET_FILE_PATH=$OP_SRC_PATH/ops-bedrock/test-jwt-secret.txt
export RPC_PORT="${RPC_PORT:-9545}";
export WS_PORT="${WS_PORT:-9546}";
$OP_RETH_SRC_PATH/target/debug/op-reth init \
--datadir="$GETH_DATA_DIR" \
--chain="$GENESIS_FILE_PATH";
$OP_RETH_SRC_PATH/target/debug/op-reth node \
--chain="$GENESIS_FILE_PATH" \
--datadir="$GETH_DATA_DIR" \
--http \
--http.corsdomain="*" \
--http.addr=0.0.0.0 \
--http.port="$RPC_PORT" \
--http.api=web3,debug,eth,txpool,net \
--ws \
--ws.addr=0.0.0.0 \
--ws.port="$WS_PORT" \
--ws.origins="*" \
--ws.api=debug,eth,txpool,net \
--disable-discovery \
--authrpc.addr="0.0.0.0" \
--authrpc.port="9551" \
--authrpc.jwtsecret="$JWT_SECRET_FILE_PATH" \
--metrics=0.0.0.0:8060 \
--port "40303"
However, I found that the is-optimism flag for op reth was not set to true. How to set is_optimism to true?
Additional context
I generated the genesis.json file for L2 according to the aspects in this document: https://docs.optimism.io/builders/chain-operators/tutorials/create-l2-rollup#generate-the-l2-config-files
No response
This is currently determined by chain ID. The Optimism chains are defined here:
https://github.com/alloy-rs/chains/blob/4d3f5ff635225fdd731634203da9535197ccab62/src/chain.rs#L401-L424
And their chain IDs are here:
https://github.com/alloy-rs/chains/blob/4d3f5ff635225fdd731634203da9535197ccab62/src/named.rs#L41
ref #7702
This is currently determined by chain ID. The Optimism chains are defined here:
https://github.com/alloy-rs/chains/blob/4d3f5ff635225fdd731634203da9535197ccab62/src/chain.rs#L401-L424
And their chain IDs are here:
https://github.com/alloy-rs/chains/blob/4d3f5ff635225fdd731634203da9535197ccab62/src/named.rs#L41
@onbjerg Since there is an optimization feature during compilation, why do we still need to distinguish whether it is an optimization chain based on the chain ID?
This issue is stale because it has been open for 21 days with no activity.
@anonymousGiga makes sense
--chain="$GENESIS_FILE_PATH" should be --chain=<chain-name>, as mentioned by @onbjerg. only optimism chain we have support for currently is optimism-sepolia, and base mainnet and testnets. did this solve your issue @anonymousGiga ?
closed by https://github.com/paradigmxyz/reth/pull/10764