Skip to content
Merged
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
78 changes: 42 additions & 36 deletions op-chain-ops/cmd/registry-data/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,17 +91,19 @@ type GenesisAccount struct {
}

type Genesis struct {
Comment thread
geoknee marked this conversation as resolved.
Nonce uint64 `json:"nonce"`
Timestamp uint64 `json:"timestamp"`
ExtraData []byte `json:"extraData"`
GasLimit uint64 `json:"gasLimit"`
Difficulty *hexutil.Big `json:"difficulty"`
Mixhash common.Hash `json:"mixHash"`
Coinbase common.Address `json:"coinbase"`
Number uint64 `json:"number"`
GasUsed uint64 `json:"gasUsed"`
ParentHash common.Hash `json:"parentHash"`
BaseFee *hexutil.Big `json:"baseFeePerGas"`
Nonce uint64 `json:"nonce"`
Timestamp uint64 `json:"timestamp"`
ExtraData []byte `json:"extraData"`
GasLimit uint64 `json:"gasLimit"`
Difficulty *hexutil.Big `json:"difficulty"`
Mixhash common.Hash `json:"mixHash"`
Coinbase common.Address `json:"coinbase"`
Number uint64 `json:"number"`
GasUsed uint64 `json:"gasUsed"`
ParentHash common.Hash `json:"parentHash"`
BaseFee *hexutil.Big `json:"baseFeePerGas"`
ExcessBlobGas *uint64 `json:"excessBlobGas"` // EIP-4844
BlobGasUsed *uint64 `json:"blobGasUsed"` // EIP-4844
Comment thread
sebastianst marked this conversation as resolved.

Alloc jsonutil.LazySortedJsonMap[common.Address, GenesisAccount] `json:"alloc"`
// For genesis definitions without full state (OP-Mainnet, OP-Goerli)
Expand Down Expand Up @@ -168,19 +170,21 @@ func entrypoint(ctx *cli.Context) error {
return errors.New("genesis-header based genesis must have no withdrawals")
}
out := Genesis{
Nonce: genesisHeader.Nonce.Uint64(),
Timestamp: genesisHeader.Time,
ExtraData: genesisHeader.Extra,
GasLimit: genesisHeader.GasLimit,
Difficulty: (*hexutil.Big)(genesisHeader.Difficulty),
Mixhash: genesisHeader.MixDigest,
Coinbase: genesisHeader.Coinbase,
Number: genesisHeader.Number.Uint64(),
GasUsed: genesisHeader.GasUsed,
ParentHash: genesisHeader.ParentHash,
BaseFee: (*hexutil.Big)(genesisHeader.BaseFee),
Alloc: make(jsonutil.LazySortedJsonMap[common.Address, GenesisAccount]),
StateHash: &genesisHeader.Root,
Nonce: genesisHeader.Nonce.Uint64(),
Timestamp: genesisHeader.Time,
ExtraData: genesisHeader.Extra,
GasLimit: genesisHeader.GasLimit,
Difficulty: (*hexutil.Big)(genesisHeader.Difficulty),
Mixhash: genesisHeader.MixDigest,
Coinbase: genesisHeader.Coinbase,
Number: genesisHeader.Number.Uint64(),
GasUsed: genesisHeader.GasUsed,
ParentHash: genesisHeader.ParentHash,
BaseFee: (*hexutil.Big)(genesisHeader.BaseFee),
ExcessBlobGas: genesisHeader.ExcessBlobGas, // EIP-4844
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 {
return fmt.Errorf("failed to write output: %w", err)
Expand Down Expand Up @@ -209,18 +213,20 @@ func entrypoint(ctx *cli.Context) error {

// convert into allocation data
out := Genesis{
Nonce: genesis.Nonce,
Timestamp: genesis.Timestamp,
ExtraData: genesis.ExtraData,
GasLimit: genesis.GasLimit,
Difficulty: (*hexutil.Big)(genesis.Difficulty),
Mixhash: genesis.Mixhash,
Coinbase: genesis.Coinbase,
Number: genesis.Number,
GasUsed: genesis.GasUsed,
ParentHash: genesis.ParentHash,
BaseFee: (*hexutil.Big)(genesis.BaseFee),
Alloc: make(jsonutil.LazySortedJsonMap[common.Address, GenesisAccount]),
Nonce: genesis.Nonce,
Timestamp: genesis.Timestamp,
ExtraData: genesis.ExtraData,
GasLimit: genesis.GasLimit,
Difficulty: (*hexutil.Big)(genesis.Difficulty),
Mixhash: genesis.Mixhash,
Coinbase: genesis.Coinbase,
Number: genesis.Number,
GasUsed: genesis.GasUsed,
ParentHash: genesis.ParentHash,
BaseFee: (*hexutil.Big)(genesis.BaseFee),
ExcessBlobGas: genesis.ExcessBlobGas, // EIP-4844
BlobGasUsed: genesis.BlobGasUsed, // EIP-4844
Comment thread
sebastianst marked this conversation as resolved.
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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ config=$(cat << EOL
"l1FeeVaultWithdrawalNetwork": 0,
"sequencerFeeVaultWithdrawalNetwork": 0,

"gasPriceOracleOverhead": 2100,
"gasPriceOracleOverhead": 0,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wouldn't this break?

if cfg.Genesis.SystemConfig.Overhead == (eth.Bytes32{}) {
return ErrMissingOverhead
}
if cfg.Genesis.SystemConfig.Scalar == (eth.Bytes32{}) {
return ErrMissingScalar
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overhead: eth.Bytes32(common.BigToHash(new(big.Int).SetUint64(d.GasPriceOracleOverhead))),

a 0 Overhead will turn into:

SystemConfig: eth.SystemConfig{
				BatcherAddr: d.BatchSenderAddress,
				Overhead:    eth.Bytes32(common.BigToHash(new(big.Int).SetUint64(d.GasPriceOracleOverhead))),
				Scalar:      eth.Bytes32(d.FeeScalar()),
				GasLimit:    uint64(d.L2GenesisBlockGasLimit),
			},

empty 32 bytes.

After which op-node validation fails:

if cfg.Genesis.SystemConfig.Overhead == (eth.Bytes32{}) {
return ErrMissingOverhead
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for highlighting. This will be addressed here #10226

"gasPriceOracleScalar": 1000000,

"enableGovernance": true,
Expand All @@ -81,7 +81,8 @@ config=$(cat << EOL
"eip1559DenominatorCanyon": 250,
"eip1559Elasticity": 6,

"l2GenesisDeltaTimeOffset": null,
"l2GenesisEcotoneTimeOffset": "0x0",
"l2GenesisDeltaTimeOffset": "0x0",
Comment thread
sebastianst marked this conversation as resolved.
"l2GenesisCanyonTimeOffset": "0x0",

"systemConfigStartBlock": 0,
Expand Down