Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions arbnode/parent/chain_config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[]
21 changes: 21 additions & 0 deletions arbnode/parent/parent.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ package parent

import (
"context"
_ "embed"
"encoding/json"
"fmt"
"math/big"

"github.com/ethereum/go-ethereum/consensus/misc/eip4844"
Expand All @@ -15,6 +18,10 @@ import (
"github.com/offchainlabs/nitro/util/headerreader"
)

// knownConfigs maps known Ethereum chain IDs to their chain configurations.
// Note that this is not exhaustive; users can add more configurations via
// chain_config.json files or can even override existing known configurations by providing
// the same chain ID.
var (
knownConfigs = map[uint64]*params.ChainConfig{
params.MainnetChainConfig.ChainID.Uint64(): params.MainnetChainConfig,
Expand All @@ -24,6 +31,20 @@ var (
}
)

//go:embed chain_config.json
var DefaultChainsConfigBytes []byte

func init() {
var chainsConfig []*params.ChainConfig
err := json.Unmarshal(DefaultChainsConfigBytes, &chainsConfig)
if err != nil {
panic(fmt.Errorf("error marshalling default chainsConfig: %w", err))
}
for _, chainConfig := range chainsConfig {
knownConfigs[chainConfig.ChainID.Uint64()] = chainConfig
}
}

type ParentChain struct {
ChainID *big.Int
L1Reader *headerreader.HeaderReader
Expand Down
Loading