reth icon indicating copy to clipboard operation
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?

Open anonymousGiga opened this issue 1 year ago • 6 comments

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

anonymousGiga avatar Apr 19 '24 06:04 anonymousGiga

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 avatar Apr 20 '24 10:04 onbjerg

ref #7702

mattsse avatar Apr 20 '24 10:04 mattsse

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?

anonymousGiga avatar Apr 23 '24 07:04 anonymousGiga

This issue is stale because it has been open for 21 days with no activity.

github-actions[bot] avatar May 15 '24 01:05 github-actions[bot]

@anonymousGiga makes sense

onbjerg avatar May 15 '24 07:05 onbjerg

--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 ?

emhane avatar May 17 '24 14:05 emhane

closed by https://github.com/paradigmxyz/reth/pull/10764

emhane avatar Sep 17 '24 09:09 emhane