Skip to content

Commit

Permalink
Store Optimism Config in config toml files (#510)
Browse files Browse the repository at this point in the history
* capture optimism config when compressing genesis

* remove submodule

* move types down into superchain module

* lint

* pull in op-geth from ethereum-optimism/op-geth#371

* migrate existing genesis files to include default Optimism values

EIP1559Elasticity: 6, EIP1559Denominator: 50, EIP1559DenominatorCanyon: u64ptr(250)

special case for base sepolia, overrides elasticity paramter to be 10

Our diff bot should pick up any mistakes in this migration, we are aiming for a net zero overall diff to the effective genesis files

* zora sepolia: set EIP1559DenominatorCanyon: nil

We have the actual genesis of this chain on hand, so we know the correct value of this parameter

* update op-geth

* remove temporary workaround code

* break line for readability

* move Optimism config from genesis .json.gz to chain config toml files

* update op-geth

* fix add-chain e2e test

* update chain configs to include genesis.config.optimism field

* restore indentation

* fix value

* just codegen

* add genesis.config.optimism to devnets

* just codegen

* Update superchain/configs/sepolia/zora.toml

* fix: rust-bindings codegen

* un-nest Optimism config

* update op-geth

* update config files with new optimism structure

* just codegen

* remove duplicate data

* fixup op sepolia (missed it before)

* just codegen

---------

Co-authored-by: refcell <[email protected]>
  • Loading branch information
geoknee and refcell authored Aug 28, 2024
1 parent 1bace9f commit 4e6edcb
Show file tree
Hide file tree
Showing 36 changed files with 270 additions and 66 deletions.
9 changes: 0 additions & 9 deletions add-chain/cmd/check-genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,6 @@ var CheckGenesisCmd = cli.Command{
return fmt.Errorf("failed to load genesis via op-geth: ensure chainId has already been added to registry: %w", err)
}

// Exceptions for testing
if localGenesis.Config.Optimism != nil {
// this value is always hardcoded in op-geth to 250. Need to updated op-geth to
// conditionally set the value (if canyon is activated) to remove the exception
// https://github.com/ethereum-optimism/op-geth/issues/346
twofifty := uint64(250)
localGenesis.Config.Optimism.EIP1559DenominatorCanyon = &twofifty
}

opts := cmp.Options{cmpopts.IgnoreUnexported(big.Int{})}
if diff := cmp.Diff(localGenesis, gethGenesis, opts...); diff != "" {
return fmt.Errorf("local genesis.json (-) does not match config generated by op-geth (+): %s", diff)
Expand Down
21 changes: 3 additions & 18 deletions add-chain/cmd/compress-genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (

"github.com/ethereum-optimism/optimism/op-service/jsonutil"
"github.com/ethereum-optimism/superchain-registry/add-chain/flags"
"github.com/ethereum-optimism/superchain-registry/add-chain/utils"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/core"
Expand Down Expand Up @@ -55,7 +56,7 @@ var CompressGenesisCmd = cli.Command{
// Archive nodes that depend on this historical state should instantiate the chain from a full genesis dump
// with allocation data, or datadir.
genesisHeaderPath := ctx.Path(flags.L2GenesisHeaderFlag.Name)
genesisHeader, err := loadJSON[types.Header](genesisHeaderPath)
genesisHeader, err := utils.LoadJSON[types.Header](genesisHeaderPath)
if err != nil {
return fmt.Errorf("genesis-header %q failed to load: %w", genesisHeaderPath, err)
}
Expand Down Expand Up @@ -94,7 +95,7 @@ var CompressGenesisCmd = cli.Command{
return nil
}

genesis, err := loadJSON[core.Genesis](genesisPath)
genesis, err := utils.LoadJSON[core.Genesis](genesisPath)
if err != nil {
return fmt.Errorf("failed to load L2 genesis: %w", err)
}
Expand Down Expand Up @@ -219,22 +220,6 @@ type Genesis struct {
StateHash *common.Hash `json:"stateHash,omitempty"`
}

func loadJSON[X any](inputPath string) (*X, error) {
if inputPath == "" {
return nil, errors.New("no path specified")
}
f, err := os.OpenFile(inputPath, os.O_RDONLY, 0)
if err != nil {
return nil, fmt.Errorf("failed to open file %q: %w", inputPath, err)
}
defer f.Close()
var obj X
if err := json.NewDecoder(f).Decode(&obj); err != nil {
return nil, fmt.Errorf("failed to decode file %q: %w", inputPath, err)
}
return &obj, nil
}

func writeGzipJSON(outputPath string, value any) error {
fmt.Printf("using output gzip filepath: %s\n", outputPath)
f, err := os.OpenFile(outputPath, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0o755)
Expand Down
10 changes: 10 additions & 0 deletions add-chain/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,17 @@ import (
"time"

"github.com/BurntSushi/toml"
"github.com/ethereum/go-ethereum/core"

"github.com/ethereum-optimism/superchain-registry/add-chain/utils"
"github.com/ethereum-optimism/superchain-registry/superchain"
)

// ConstructChainConfig creates and populates a ChainConfig struct by reading from an input file and
// explicitly setting some additional fields to input argument values
func ConstructChainConfig(
inputFilePath,
genesisPath,
chainName,
publicRPC,
sequencerRPC,
Expand All @@ -41,6 +44,13 @@ func ConstructChainConfig(
return superchain.ChainConfig{}, fmt.Errorf("error with json altDA config: %w", err)
}

genesis, err := utils.LoadJSON[core.Genesis](genesisPath)
if err != nil {
return superchain.ChainConfig{}, fmt.Errorf("failed to load L2 genesis: %w", err)
}

chainConfig.Optimism = (*superchain.OptimismConfig)(genesis.Config.Optimism)

chainConfig.Name = chainName
chainConfig.PublicRPC = publicRPC
chainConfig.SequencerRPC = sequencerRPC
Expand Down
1 change: 1 addition & 0 deletions add-chain/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ func TestAddChain_Main(t *testing.T) {
"--chain-name=" + tt.chainName,
"--chain-short-name=" + tt.chainShortName,
"--rollup-config=" + tt.rollupConfigFile,
"--genesis=" + "./testdata/monorepo/op-node/genesis_zorasep.json",
"--deployments-dir=" + tt.deploymentsDir,
"--standard-chain-candidate=" + strconv.FormatBool(tt.standardChainCandidate),
}
Expand Down
14 changes: 7 additions & 7 deletions add-chain/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ go 1.21

replace github.com/ethereum-optimism/superchain-registry/superchain => ../superchain

replace github.com/ethereum/go-ethereum => github.com/ethereum-optimism/op-geth v1.101407.0-rc.1.0.20240812224053-8d99ca68bb1a
replace github.com/ethereum/go-ethereum => github.com/ethereum-optimism/op-geth v1.101408.0-rc.4.0.20240827194518-1071ac1284b8

require (
github.com/BurntSushi/toml v1.4.0
github.com/ethereum-optimism/optimism v1.9.1-0.20240814195148-0bb2ff57c813
github.com/ethereum-optimism/superchain-registry/superchain v0.0.0-20240814192743-ea7e768a02a6
github.com/ethereum-optimism/superchain-registry/superchain v0.0.0-20240827194108-65ec82d9a1b2
github.com/ethereum/go-ethereum v1.14.7
github.com/google/go-cmp v0.6.0
github.com/joho/godotenv v1.5.1
Expand All @@ -23,11 +23,12 @@ require (
github.com/VictoriaMetrics/fastcache v1.12.2 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/bits-and-blooms/bitset v1.10.0 // indirect
github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect
github.com/btcsuite/btcd/btcec/v2 v2.3.4 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/cockroachdb/errors v1.11.3 // indirect
github.com/cockroachdb/fifo v0.0.0-20240606204812-0bbfbd93a7ce // indirect
github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect
github.com/cockroachdb/pebble v0.0.0-20231018212520-f6cde3fc2fa4 // indirect
github.com/cockroachdb/pebble v1.1.2 // indirect
github.com/cockroachdb/redact v1.1.5 // indirect
github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect
github.com/consensys/bavard v0.1.13 // indirect
Expand All @@ -40,7 +41,6 @@ require (
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 // indirect
github.com/ethereum/c-kzg-4844 v1.0.0 // indirect
github.com/ethereum/go-verkle v0.1.1-0.20240306133620-7d920df305f0 // indirect
github.com/fjl/memsize v0.0.2 // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/getsentry/sentry-go v0.27.0 // indirect
github.com/go-ole/go-ole v1.3.0 // indirect
Expand Down Expand Up @@ -87,11 +87,11 @@ require (
golang.org/x/mod v0.20.0 // indirect
golang.org/x/net v0.27.0 // indirect
golang.org/x/sync v0.8.0 // indirect
golang.org/x/sys v0.23.0 // indirect
golang.org/x/sys v0.24.0 // indirect
golang.org/x/term v0.23.0 // indirect
golang.org/x/text v0.17.0 // indirect
golang.org/x/time v0.6.0 // indirect
google.golang.org/protobuf v1.34.1 // indirect
google.golang.org/protobuf v1.34.2 // indirect
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
rsc.io/tmplfunc v0.0.3 // indirect
Expand Down
24 changes: 12 additions & 12 deletions add-chain/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6r
github.com/bits-and-blooms/bitset v1.10.0 h1:ePXTeiPEazB5+opbv5fr8umg2R/1NlzgDsyepwsSr88=
github.com/bits-and-blooms/bitset v1.10.0/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8=
github.com/btcsuite/btcd v0.24.2 h1:aLmxPguqxza+4ag8R1I2nnJjSu2iFn/kqtHTIImswcY=
github.com/btcsuite/btcd/btcec/v2 v2.3.2 h1:5n0X6hX0Zk+6omWcihdYvdAlGf2DfasC0GMf7DClJ3U=
github.com/btcsuite/btcd/btcec/v2 v2.3.2/go.mod h1:zYzJ8etWJQIv1Ogk7OzpWjowwOdXY1W/17j2MW85J04=
github.com/btcsuite/btcd/btcec/v2 v2.3.4 h1:3EJjcN70HCu/mwqlUsGK8GcNVyLVxFDlWurTXGPFfiQ=
github.com/btcsuite/btcd/btcec/v2 v2.3.4/go.mod h1:zYzJ8etWJQIv1Ogk7OzpWjowwOdXY1W/17j2MW85J04=
github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0 h1:59Kx4K6lzOW5w6nFlA0v5+lk/6sjybR934QNHSJZPTQ=
github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc=
github.com/cespare/cp v0.1.0 h1:SE+dxFebS7Iik5LK0tsi1k9ZCxEaFX4AjQmoyA+1dJk=
Expand All @@ -30,10 +30,12 @@ github.com/cockroachdb/datadriven v1.0.3-0.20230413201302-be42291fc80f h1:otljaY
github.com/cockroachdb/datadriven v1.0.3-0.20230413201302-be42291fc80f/go.mod h1:a9RdTaap04u637JoCzcUoIcDmvwSUtcUFtT/C3kJlTU=
github.com/cockroachdb/errors v1.11.3 h1:5bA+k2Y6r+oz/6Z/RFlNeVCesGARKuC6YymtcDrbC/I=
github.com/cockroachdb/errors v1.11.3/go.mod h1:m4UIW4CDjx+R5cybPsNrRbreomiFqt8o1h1wUVazSd8=
github.com/cockroachdb/fifo v0.0.0-20240606204812-0bbfbd93a7ce h1:giXvy4KSc/6g/esnpM7Geqxka4WSqI1SZc7sMJFd3y4=
github.com/cockroachdb/fifo v0.0.0-20240606204812-0bbfbd93a7ce/go.mod h1:9/y3cnZ5GKakj/H4y9r9GTjCvAFta7KLgSHPJJYc52M=
github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b h1:r6VH0faHjZeQy818SGhaone5OnYfxFR/+AzdY3sf5aE=
github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b/go.mod h1:Vz9DsVWQQhf3vs21MhPMZpMGSht7O/2vFW2xusFUVOs=
github.com/cockroachdb/pebble v0.0.0-20231018212520-f6cde3fc2fa4 h1:PuHFhOUMnD62r80dN+Ik5qco2drekgsUSVdcHsvllec=
github.com/cockroachdb/pebble v0.0.0-20231018212520-f6cde3fc2fa4/go.mod h1:sEHm5NOXxyiAoKWhoFxT8xMgd/f3RA6qUqQ1BXKrh2E=
github.com/cockroachdb/pebble v1.1.2 h1:CUh2IPtR4swHlEj48Rhfzw6l/d0qA31fItcIszQVIsA=
github.com/cockroachdb/pebble v1.1.2/go.mod h1:4exszw1r40423ZsmkG/09AFEG83I0uDgfujJdbL6kYU=
github.com/cockroachdb/redact v1.1.5 h1:u1PMllDkdFfPWaNGMyLD1+so+aq3uUItthCFqzwPJ30=
github.com/cockroachdb/redact v1.1.5/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZZ2lK+dpvRg=
github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 h1:zuQyyAKVxetITBuuhv3BI9cMrmStnpT18zmgmTxunpo=
Expand All @@ -59,16 +61,14 @@ github.com/decred/dcrd/crypto/blake256 v1.0.1 h1:7PltbUIQB7u/FfZ39+DGa/ShuMyJ5il
github.com/decred/dcrd/crypto/blake256 v1.0.1/go.mod h1:2OfgNZ5wDpcsFmHmCK5gZTPcCXqlm2ArzUIkw9czNJo=
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 h1:rpfIENRNNilwHwZeG5+P150SMrnNEcHYvcCuK6dPZSg=
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0/go.mod h1:v57UDF4pDQJcEfFUCRop3lJL149eHGSe9Jvczhzjo/0=
github.com/ethereum-optimism/op-geth v1.101407.0-rc.1.0.20240812224053-8d99ca68bb1a h1:OK3wB7HbdhCneSowC1XZusHaLIVdXoRLuCWgXp5Tjuc=
github.com/ethereum-optimism/op-geth v1.101407.0-rc.1.0.20240812224053-8d99ca68bb1a/go.mod h1:9pT+bF20XwCBE7WkjfRSsCg6RN6Njdbr924DtQ3+geY=
github.com/ethereum-optimism/op-geth v1.101408.0-rc.4.0.20240827194518-1071ac1284b8 h1:herYQxIOCZzBNAIClH0BP/+1BAXIn5bz0vRYH9bdgug=
github.com/ethereum-optimism/op-geth v1.101408.0-rc.4.0.20240827194518-1071ac1284b8/go.mod h1:WBZxPjS4MTFLiFGEfBngof6KwdIU6zZ4t00B8zLJwDE=
github.com/ethereum-optimism/optimism v1.9.1-0.20240814195148-0bb2ff57c813 h1:g1eUt4iB+v+FGdO7WAI17SpVahsrC6S9HGO0ceAd8Ec=
github.com/ethereum-optimism/optimism v1.9.1-0.20240814195148-0bb2ff57c813/go.mod h1:LTZIluX+26O0GHlwnFdPIUX04OUqcVDdThjRDsALYUY=
github.com/ethereum/c-kzg-4844 v1.0.0 h1:0X1LBXxaEtYD9xsyj9B9ctQEZIpnvVDeoBx8aHEwTNA=
github.com/ethereum/c-kzg-4844 v1.0.0/go.mod h1:VewdlzQmpT5QSrVhbBuGoCdFJkpaJlO1aQputP83wc0=
github.com/ethereum/go-verkle v0.1.1-0.20240306133620-7d920df305f0 h1:KrE8I4reeVvf7C1tm8elRjj4BdscTYzz/WAbYyf/JI4=
github.com/ethereum/go-verkle v0.1.1-0.20240306133620-7d920df305f0/go.mod h1:D9AJLVXSyZQXJQVk8oh1EwjISE+sJTn2duYIZC0dy3w=
github.com/fjl/memsize v0.0.2 h1:27txuSD9or+NZlnOWdKUxeBzTAUkWCVh+4Gf2dWFOzA=
github.com/fjl/memsize v0.0.2/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0=
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
github.com/fsnotify/fsnotify v1.5.4/go.mod h1:OVB6XrOHzAwXMpEM7uPOzcehqUV2UqJxmVXmkdnm1bU=
Expand Down Expand Up @@ -286,8 +286,8 @@ golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.23.0 h1:YfKFowiIMvtgl1UERQoTPPToxltDeZfbj4H7dVUCwmM=
golang.org/x/sys v0.23.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg=
golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.23.0 h1:F6D4vR+EHoL9/sWAWgAR1H2DcHr4PareCbAaCo1RpuU=
Expand Down Expand Up @@ -318,8 +318,8 @@ google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzi
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
google.golang.org/protobuf v1.34.1 h1:9ddQBjfCyZPOHPUiPxpYESBLc+T8P3E+Vo4IbKZgFWg=
google.golang.org/protobuf v1.34.1/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg=
google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
Expand Down
5 changes: 4 additions & 1 deletion add-chain/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ var app = &cli.App{
flags.ChainNameFlag,
flags.ChainShortNameFlag,
flags.RollupConfigFlag,
flags.GenesisFlag,
flags.DeploymentsDirFlag,
flags.StandardChainCandidateFlag,
},
Expand Down Expand Up @@ -87,6 +88,7 @@ func entrypoint(ctx *cli.Context) error {

chainName := ctx.String(flags.ChainNameFlag.Name)
rollupConfigPath := ctx.String(flags.RollupConfigFlag.Name)
genesisPath := ctx.String(flags.GenesisFlag.Name)
deploymentsDir := ctx.String(flags.DeploymentsDirFlag.Name)
chainShortName := ctx.String(flags.ChainShortNameFlag.Name)
if chainShortName == "" {
Expand All @@ -107,6 +109,7 @@ func entrypoint(ctx *cli.Context) error {
fmt.Printf("Monorepo dir: %s\n", monorepoDir)
fmt.Printf("Deployments directory: %s\n", deploymentsDir)
fmt.Printf("Rollup config filepath: %s\n", rollupConfigPath)
fmt.Printf("Genesis filepath: %s\n", genesisPath)
fmt.Printf("Public RPC endpoint: %s\n", publicRPC)
fmt.Printf("Sequencer RPC endpoint: %s\n", sequencerRPC)
fmt.Printf("Block Explorer: %s\n", explorer)
Expand Down Expand Up @@ -134,7 +137,7 @@ func entrypoint(ctx *cli.Context) error {
return fmt.Errorf("failed to infer fault proofs status of chain: %w", err)
}

rollupConfig, err := config.ConstructChainConfig(rollupConfigPath, chainName, publicRPC, sequencerRPC, explorer, superchainLevel, standardChainCandidate)
rollupConfig, err := config.ConstructChainConfig(rollupConfigPath, genesisPath, chainName, publicRPC, sequencerRPC, explorer, superchainLevel, standardChainCandidate)
if err != nil {
return fmt.Errorf("failed to construct rollup config: %w", err)
}
Expand Down
1 change: 1 addition & 0 deletions add-chain/testdata/.env.test
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ SCR_SUPERCHAIN_TARGET=sepolia # L1 chain name
SCR_MONOREPO_DIR=./testdata/monorepo
SCR_DEPLOYMENTS_DIR=${SCR_MONOREPO_DIR}/deployments
SCR_ROLLUP_CONFIG=${SCR_MONOREPO_DIR}/op-node/rollup.json
SCR_GENESIS=${SCR_MONOREPO_DIR}/op-node/genesis.json
SCR_PUBLIC_RPC="http://awe.some.rpc" # L2 RPC URL
SCR_SEQUENCER_RPC="http://awe.some.seq.rpc"
SCR_EXPLORER="https://awesomescan.org" # L2 block explorer URL
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ seq_window_size = 3600
max_sequencer_drift = 600
data_availability_type = "alt-da"

[optimism]
eip1559_elasticity = 6
eip1559_denominator = 50

[alt_da]
da_challenge_contract_address = "0x3333333333333333333300000000000000000000"
da_challenge_window = 5555555
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ seq_window_size = 3600
max_sequencer_drift = 600
data_availability_type = "eth-da"

[optimism]
eip1559_elasticity = 6
eip1559_denominator = 50

[genesis]
l2_time = 1713792864
[genesis.l1]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ seq_window_size = 3600
max_sequencer_drift = 600
data_availability_type = "eth-da"

[optimism]
eip1559_elasticity = 6
eip1559_denominator = 50

[genesis]
l2_time = 1713792864
[genesis.l1]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ seq_window_size = 3600
max_sequencer_drift = 600
data_availability_type = "eth-da"

[optimism]
eip1559_elasticity = 6
eip1559_denominator = 50

[genesis]
l2_time = 1706484048
[genesis.l1]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ seq_window_size = 3600
max_sequencer_drift = 600
data_availability_type = "eth-da"

[optimism]
eip1559_elasticity = 6
eip1559_denominator = 50

[genesis]
l2_time = 1713792864
[genesis.l1]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ seq_window_size = 3600
max_sequencer_drift = 600
data_availability_type = "eth-da"

[optimism]
eip1559_elasticity = 6
eip1559_denominator = 50

[genesis]
l2_time = 1698080004
[genesis.l1]
Expand Down
24 changes: 24 additions & 0 deletions add-chain/utils/utils.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package utils

import (
"encoding/json"
"errors"
"fmt"
"os"
)

func LoadJSON[X any](inputPath string) (*X, error) {
if inputPath == "" {
return nil, errors.New("no path specified")
}
f, err := os.OpenFile(inputPath, os.O_RDONLY, 0)
if err != nil {
return nil, fmt.Errorf("failed to open file %q: %w", inputPath, err)
}
defer f.Close()
var obj X
if err := json.NewDecoder(f).Decode(&obj); err != nil {
return nil, fmt.Errorf("failed to decode file %q: %w", inputPath, err)
}
return &obj, nil
}
Loading

0 comments on commit 4e6edcb

Please sign in to comment.