Commit 13d61468 authored by George C. Knee's avatar George C. Knee Committed by GitHub

Some Superchain L2 Genesis Fixes (#10231)

* add l2GenesisEcotoneTimeOffset to getting-started/config.sh

* set l2GenesisDeltaTimeOffset to 0

* remove unecessary line

* parse 4844 params in registry-data tool

* update overhead and scalar

* add 4844 fields to the other Genesis literal

* scalar: revert
Co-authored-by: default avatarGeorge C. Knee <georgeknee@googlemail.com>

---------
Co-authored-by: default avatarMark Tyneway <mark.tyneway@gmail.com>
parent 9fec999d
...@@ -91,17 +91,19 @@ type GenesisAccount struct { ...@@ -91,17 +91,19 @@ type GenesisAccount struct {
} }
type Genesis struct { type Genesis struct {
Nonce uint64 `json:"nonce"` Nonce uint64 `json:"nonce"`
Timestamp uint64 `json:"timestamp"` Timestamp uint64 `json:"timestamp"`
ExtraData []byte `json:"extraData"` ExtraData []byte `json:"extraData"`
GasLimit uint64 `json:"gasLimit"` GasLimit uint64 `json:"gasLimit"`
Difficulty *hexutil.Big `json:"difficulty"` Difficulty *hexutil.Big `json:"difficulty"`
Mixhash common.Hash `json:"mixHash"` Mixhash common.Hash `json:"mixHash"`
Coinbase common.Address `json:"coinbase"` Coinbase common.Address `json:"coinbase"`
Number uint64 `json:"number"` Number uint64 `json:"number"`
GasUsed uint64 `json:"gasUsed"` GasUsed uint64 `json:"gasUsed"`
ParentHash common.Hash `json:"parentHash"` ParentHash common.Hash `json:"parentHash"`
BaseFee *hexutil.Big `json:"baseFeePerGas"` BaseFee *hexutil.Big `json:"baseFeePerGas"`
ExcessBlobGas *uint64 `json:"excessBlobGas"` // EIP-4844
BlobGasUsed *uint64 `json:"blobGasUsed"` // EIP-4844
Alloc jsonutil.LazySortedJsonMap[common.Address, GenesisAccount] `json:"alloc"` Alloc jsonutil.LazySortedJsonMap[common.Address, GenesisAccount] `json:"alloc"`
// For genesis definitions without full state (OP-Mainnet, OP-Goerli) // For genesis definitions without full state (OP-Mainnet, OP-Goerli)
...@@ -168,19 +170,21 @@ func entrypoint(ctx *cli.Context) error { ...@@ -168,19 +170,21 @@ func entrypoint(ctx *cli.Context) error {
return errors.New("genesis-header based genesis must have no withdrawals") return errors.New("genesis-header based genesis must have no withdrawals")
} }
out := Genesis{ out := Genesis{
Nonce: genesisHeader.Nonce.Uint64(), Nonce: genesisHeader.Nonce.Uint64(),
Timestamp: genesisHeader.Time, Timestamp: genesisHeader.Time,
ExtraData: genesisHeader.Extra, ExtraData: genesisHeader.Extra,
GasLimit: genesisHeader.GasLimit, GasLimit: genesisHeader.GasLimit,
Difficulty: (*hexutil.Big)(genesisHeader.Difficulty), Difficulty: (*hexutil.Big)(genesisHeader.Difficulty),
Mixhash: genesisHeader.MixDigest, Mixhash: genesisHeader.MixDigest,
Coinbase: genesisHeader.Coinbase, Coinbase: genesisHeader.Coinbase,
Number: genesisHeader.Number.Uint64(), Number: genesisHeader.Number.Uint64(),
GasUsed: genesisHeader.GasUsed, GasUsed: genesisHeader.GasUsed,
ParentHash: genesisHeader.ParentHash, ParentHash: genesisHeader.ParentHash,
BaseFee: (*hexutil.Big)(genesisHeader.BaseFee), BaseFee: (*hexutil.Big)(genesisHeader.BaseFee),
Alloc: make(jsonutil.LazySortedJsonMap[common.Address, GenesisAccount]), ExcessBlobGas: genesisHeader.ExcessBlobGas, // EIP-4844
StateHash: &genesisHeader.Root, BlobGasUsed: genesisHeader.BlobGasUsed, // EIP-4844
Alloc: make(jsonutil.LazySortedJsonMap[common.Address, GenesisAccount]),
StateHash: &genesisHeader.Root,
} }
if err := writeGzipJSON(ctx.Path(OutputFlag.Name), out); err != nil { if err := writeGzipJSON(ctx.Path(OutputFlag.Name), out); err != nil {
return fmt.Errorf("failed to write output: %w", err) return fmt.Errorf("failed to write output: %w", err)
...@@ -209,18 +213,20 @@ func entrypoint(ctx *cli.Context) error { ...@@ -209,18 +213,20 @@ func entrypoint(ctx *cli.Context) error {
// convert into allocation data // convert into allocation data
out := Genesis{ out := Genesis{
Nonce: genesis.Nonce, Nonce: genesis.Nonce,
Timestamp: genesis.Timestamp, Timestamp: genesis.Timestamp,
ExtraData: genesis.ExtraData, ExtraData: genesis.ExtraData,
GasLimit: genesis.GasLimit, GasLimit: genesis.GasLimit,
Difficulty: (*hexutil.Big)(genesis.Difficulty), Difficulty: (*hexutil.Big)(genesis.Difficulty),
Mixhash: genesis.Mixhash, Mixhash: genesis.Mixhash,
Coinbase: genesis.Coinbase, Coinbase: genesis.Coinbase,
Number: genesis.Number, Number: genesis.Number,
GasUsed: genesis.GasUsed, GasUsed: genesis.GasUsed,
ParentHash: genesis.ParentHash, ParentHash: genesis.ParentHash,
BaseFee: (*hexutil.Big)(genesis.BaseFee), BaseFee: (*hexutil.Big)(genesis.BaseFee),
Alloc: make(jsonutil.LazySortedJsonMap[common.Address, GenesisAccount]), ExcessBlobGas: genesis.ExcessBlobGas, // EIP-4844
BlobGasUsed: genesis.BlobGasUsed, // EIP-4844
Alloc: make(jsonutil.LazySortedJsonMap[common.Address, GenesisAccount]),
} }
// write genesis, but only reference code by code-hash, and don't encode the L2 predeploys to save space. // write genesis, but only reference code by code-hash, and don't encode the L2 predeploys to save space.
......
...@@ -65,7 +65,7 @@ config=$(cat << EOL ...@@ -65,7 +65,7 @@ config=$(cat << EOL
"l1FeeVaultWithdrawalNetwork": 0, "l1FeeVaultWithdrawalNetwork": 0,
"sequencerFeeVaultWithdrawalNetwork": 0, "sequencerFeeVaultWithdrawalNetwork": 0,
"gasPriceOracleOverhead": 2100, "gasPriceOracleOverhead": 0,
"gasPriceOracleScalar": 1000000, "gasPriceOracleScalar": 1000000,
"enableGovernance": true, "enableGovernance": true,
...@@ -81,7 +81,8 @@ config=$(cat << EOL ...@@ -81,7 +81,8 @@ config=$(cat << EOL
"eip1559DenominatorCanyon": 250, "eip1559DenominatorCanyon": 250,
"eip1559Elasticity": 6, "eip1559Elasticity": 6,
"l2GenesisDeltaTimeOffset": null, "l2GenesisEcotoneTimeOffset": "0x0",
"l2GenesisDeltaTimeOffset": "0x0",
"l2GenesisCanyonTimeOffset": "0x0", "l2GenesisCanyonTimeOffset": "0x0",
"systemConfigStartBlock": 0, "systemConfigStartBlock": 0,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment