Skip to content

Commit

Permalink
Isthmus activation updates
Browse files Browse the repository at this point in the history
  • Loading branch information
mdehoog committed Jan 2, 2025
1 parent a1df3e1 commit dcb376f
Show file tree
Hide file tree
Showing 9 changed files with 80 additions and 65 deletions.
20 changes: 13 additions & 7 deletions op-chain-ops/genesis/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -996,13 +996,8 @@ func (d *DeployConfig) RollupConfig(l1StartBlock *types.Header, l2GenesisBlockHa
Hash: l2GenesisBlockHash,
Number: l2GenesisBlockNumber,
},
L2Time: l1StartBlock.Time,
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),
},
L2Time: l1StartBlock.Time,
SystemConfig: d.GenesisSystemConfig(),
},
BlockTime: d.L2BlockTime,
MaxSequencerDrift: d.MaxSequencerDrift,
Expand All @@ -1027,6 +1022,17 @@ func (d *DeployConfig) RollupConfig(l1StartBlock *types.Header, l2GenesisBlockHa
}, nil
}

// GenesisSystemConfig converts a DeployConfig to a eth.SystemConfig. If Ecotone is active at genesis, the
// Overhead value is considered a noop.
func (d *DeployConfig) GenesisSystemConfig() eth.SystemConfig {
return eth.SystemConfig{
BatcherAddr: d.BatchSenderAddress,
Overhead: eth.Bytes32(common.BigToHash(new(big.Int).SetUint64(d.GasPriceOracleOverhead))),
Scalar: d.FeeScalar(),
GasLimit: uint64(d.L2GenesisBlockGasLimit),
}
}

// NewDeployConfig reads a config file given a path on the filesystem.
func NewDeployConfig(path string) (*DeployConfig, error) {
file, err := os.ReadFile(path)
Expand Down
1 change: 1 addition & 0 deletions op-chain-ops/interopgen/recipe.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ func InteropL2DevConfig(l1ChainID, l2ChainID uint64, addrs devkeys.Addresses) (*
L2GenesisFjordTimeOffset: new(hexutil.Uint64),
L2GenesisGraniteTimeOffset: new(hexutil.Uint64),
L2GenesisHoloceneTimeOffset: new(hexutil.Uint64),
L2GenesisIsthmusTimeOffset: new(hexutil.Uint64),
L2GenesisInteropTimeOffset: new(hexutil.Uint64),
L1CancunTimeOffset: new(hexutil.Uint64),
UseInterop: true,
Expand Down
15 changes: 7 additions & 8 deletions op-e2e/e2eutils/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"path"
"time"

"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/types"
Expand Down Expand Up @@ -205,6 +204,7 @@ func Setup(t require.TestingT, deployParams *DeployParams, alloc *AllocParams) *
FjordTime: deployConf.FjordTime(uint64(deployConf.L1GenesisBlockTimestamp)),
GraniteTime: deployConf.GraniteTime(uint64(deployConf.L1GenesisBlockTimestamp)),
HoloceneTime: deployConf.HoloceneTime(uint64(deployConf.L1GenesisBlockTimestamp)),
IsthmusTime: deployConf.IsthmusTime(uint64(deployConf.L1GenesisBlockTimestamp)),
InteropTime: deployConf.InteropTime(uint64(deployConf.L1GenesisBlockTimestamp)),
AltDAConfig: pcfg,
}
Expand All @@ -226,16 +226,12 @@ func Setup(t require.TestingT, deployParams *DeployParams, alloc *AllocParams) *
}

func SystemConfigFromDeployConfig(deployConfig *genesis.DeployConfig) eth.SystemConfig {
return eth.SystemConfig{
BatcherAddr: deployConfig.BatchSenderAddress,
Overhead: eth.Bytes32(common.BigToHash(new(big.Int).SetUint64(deployConfig.GasPriceOracleOverhead))),
Scalar: eth.Bytes32(deployConfig.FeeScalar()),
GasLimit: uint64(deployConfig.L2GenesisBlockGasLimit),
}
return deployConfig.GenesisSystemConfig()
}

func ApplyDeployConfigForks(deployConfig *genesis.DeployConfig) {
isHolocene := os.Getenv("OP_E2E_USE_HOLOCENE") == "true"
isIsthmus := os.Getenv("OP_E2E_USE_ISTHMUS") == "true"
isHolocene := isIsthmus || os.Getenv("OP_E2E_USE_HOLOCENE") == "true"
isGranite := isHolocene || os.Getenv("OP_E2E_USE_GRANITE") == "true"
isFjord := isGranite || os.Getenv("OP_E2E_USE_FJORD") == "true"
isEcotone := isFjord || os.Getenv("OP_E2E_USE_ECOTONE") == "true"
Expand All @@ -255,6 +251,9 @@ func ApplyDeployConfigForks(deployConfig *genesis.DeployConfig) {
if isHolocene {
deployConfig.L2GenesisHoloceneTimeOffset = new(hexutil.Uint64)
}
if isIsthmus {
deployConfig.L2GenesisIsthmusTimeOffset = new(hexutil.Uint64)
}
// Canyon and lower is activated by default
deployConfig.L2GenesisCanyonTimeOffset = new(hexutil.Uint64)
deployConfig.L2GenesisRegolithTimeOffset = new(hexutil.Uint64)
Expand Down
1 change: 1 addition & 0 deletions op-e2e/system/e2esys/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -638,6 +638,7 @@ func (cfg SystemConfig) Start(t *testing.T, startOpts ...StartOption) (*System,
FjordTime: cfg.DeployConfig.FjordTime(uint64(cfg.DeployConfig.L1GenesisBlockTimestamp)),
GraniteTime: cfg.DeployConfig.GraniteTime(uint64(cfg.DeployConfig.L1GenesisBlockTimestamp)),
HoloceneTime: cfg.DeployConfig.HoloceneTime(uint64(cfg.DeployConfig.L1GenesisBlockTimestamp)),
IsthmusTime: cfg.DeployConfig.IsthmusTime(uint64(cfg.DeployConfig.L1GenesisBlockTimestamp)),
InteropTime: cfg.DeployConfig.InteropTime(uint64(cfg.DeployConfig.L1GenesisBlockTimestamp)),
ProtocolVersionsAddress: cfg.L1Deployments.ProtocolVersionsProxy,
AltDAConfig: rollupAltDAConfig,
Expand Down
1 change: 1 addition & 0 deletions op-node/rollup/superchain.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ func LoadOPStackRollupConfig(chainID uint64) (*Config, error) {
FjordTime: chConfig.FjordTime,
GraniteTime: chConfig.GraniteTime,
HoloceneTime: chConfig.HoloceneTime,
IsthmusTime: chConfig.IsthmusTime,
BatchInboxAddress: common.Address(chConfig.BatchInboxAddr),
DepositContractAddress: common.Address(addrs.OptimismPortalProxy),
L1SystemConfigAddress: common.Address(addrs.SystemConfigProxy),
Expand Down
35 changes: 18 additions & 17 deletions op-program/client/l2/engineapi/l2_engine_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -486,23 +486,24 @@ func (ea *L2EngineAPI) newPayload(_ context.Context, payload *eth.ExecutionPaylo
txs[i] = tx
}
block, err := engine.ExecutableDataToBlock(engine.ExecutableData{
ParentHash: payload.ParentHash,
FeeRecipient: payload.FeeRecipient,
StateRoot: common.Hash(payload.StateRoot),
ReceiptsRoot: common.Hash(payload.ReceiptsRoot),
LogsBloom: payload.LogsBloom[:],
Random: common.Hash(payload.PrevRandao),
Number: uint64(payload.BlockNumber),
GasLimit: uint64(payload.GasLimit),
GasUsed: uint64(payload.GasUsed),
Timestamp: uint64(payload.Timestamp),
ExtraData: payload.ExtraData,
BaseFeePerGas: (*uint256.Int)(&payload.BaseFeePerGas).ToBig(),
BlockHash: payload.BlockHash,
Transactions: txs,
Withdrawals: toGethWithdrawals(payload),
ExcessBlobGas: (*uint64)(payload.ExcessBlobGas),
BlobGasUsed: (*uint64)(payload.BlobGasUsed),
ParentHash: payload.ParentHash,
FeeRecipient: payload.FeeRecipient,
StateRoot: common.Hash(payload.StateRoot),
ReceiptsRoot: common.Hash(payload.ReceiptsRoot),
LogsBloom: payload.LogsBloom[:],
Random: common.Hash(payload.PrevRandao),
Number: uint64(payload.BlockNumber),
GasLimit: uint64(payload.GasLimit),
GasUsed: uint64(payload.GasUsed),
Timestamp: uint64(payload.Timestamp),
ExtraData: payload.ExtraData,
BaseFeePerGas: (*uint256.Int)(&payload.BaseFeePerGas).ToBig(),
BlockHash: payload.BlockHash,
Transactions: txs,
Withdrawals: toGethWithdrawals(payload),
ExcessBlobGas: (*uint64)(payload.ExcessBlobGas),
BlobGasUsed: (*uint64)(payload.BlobGasUsed),
WithdrawalsRoot: payload.WithdrawalsRoot,
}, hashes, root, ea.backend.Config())
if err != nil {
log.Debug("Invalid NewPayload params", "params", payload, "error", err)
Expand Down
35 changes: 19 additions & 16 deletions op-service/eth/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,8 @@ type ExecutionPayload struct {
BlobGasUsed *Uint64Quantity `json:"blobGasUsed,omitempty"`
// Nil if not present (Bedrock, Canyon, Delta)
ExcessBlobGas *Uint64Quantity `json:"excessBlobGas,omitempty"`
// Nil if not present (Bedrock, Canyon, Delta, Ecotone, Fjord, Granite, Holocene)
WithdrawalsRoot *common.Hash `json:"withdrawalsRoot,omitempty"`
}

func (payload *ExecutionPayload) ID() BlockID {
Expand Down Expand Up @@ -307,22 +309,23 @@ func BlockAsPayload(bl *types.Block, shanghaiTime *uint64) (*ExecutionPayload, e
}

payload := &ExecutionPayload{
ParentHash: bl.ParentHash(),
FeeRecipient: bl.Coinbase(),
StateRoot: Bytes32(bl.Root()),
ReceiptsRoot: Bytes32(bl.ReceiptHash()),
LogsBloom: Bytes256(bl.Bloom()),
PrevRandao: Bytes32(bl.MixDigest()),
BlockNumber: Uint64Quantity(bl.NumberU64()),
GasLimit: Uint64Quantity(bl.GasLimit()),
GasUsed: Uint64Quantity(bl.GasUsed()),
Timestamp: Uint64Quantity(bl.Time()),
ExtraData: bl.Extra(),
BaseFeePerGas: Uint256Quantity(*baseFee),
BlockHash: bl.Hash(),
Transactions: opaqueTxs,
ExcessBlobGas: (*Uint64Quantity)(bl.ExcessBlobGas()),
BlobGasUsed: (*Uint64Quantity)(bl.BlobGasUsed()),
ParentHash: bl.ParentHash(),
FeeRecipient: bl.Coinbase(),
StateRoot: Bytes32(bl.Root()),
ReceiptsRoot: Bytes32(bl.ReceiptHash()),
LogsBloom: Bytes256(bl.Bloom()),
PrevRandao: Bytes32(bl.MixDigest()),
BlockNumber: Uint64Quantity(bl.NumberU64()),
GasLimit: Uint64Quantity(bl.GasLimit()),
GasUsed: Uint64Quantity(bl.GasUsed()),
Timestamp: Uint64Quantity(bl.Time()),
ExtraData: bl.Extra(),
BaseFeePerGas: Uint256Quantity(*baseFee),
BlockHash: bl.Hash(),
Transactions: opaqueTxs,
ExcessBlobGas: (*Uint64Quantity)(bl.ExcessBlobGas()),
BlobGasUsed: (*Uint64Quantity)(bl.BlobGasUsed()),
WithdrawalsRoot: bl.WithdrawalsRoot(),
}

if shanghaiTime != nil && uint64(payload.Timestamp) >= *shanghaiTime {
Expand Down
35 changes: 18 additions & 17 deletions op-service/sources/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -293,23 +293,24 @@ func (block *RPCBlock) ExecutionPayloadEnvelope(trustCache bool) (*eth.Execution
}

payload := &eth.ExecutionPayload{
ParentHash: block.ParentHash,
FeeRecipient: block.Coinbase,
StateRoot: eth.Bytes32(block.Root),
ReceiptsRoot: eth.Bytes32(block.ReceiptHash),
LogsBloom: block.Bloom,
PrevRandao: eth.Bytes32(block.MixDigest), // mix-digest field is used for prevRandao post-merge
BlockNumber: block.Number,
GasLimit: block.GasLimit,
GasUsed: block.GasUsed,
Timestamp: block.Time,
ExtraData: eth.BytesMax32(block.Extra),
BaseFeePerGas: eth.Uint256Quantity(baseFee),
BlockHash: block.Hash,
Transactions: opaqueTxs,
Withdrawals: block.Withdrawals,
BlobGasUsed: block.BlobGasUsed,
ExcessBlobGas: block.ExcessBlobGas,
ParentHash: block.ParentHash,
FeeRecipient: block.Coinbase,
StateRoot: eth.Bytes32(block.Root),
ReceiptsRoot: eth.Bytes32(block.ReceiptHash),
LogsBloom: block.Bloom,
PrevRandao: eth.Bytes32(block.MixDigest), // mix-digest field is used for prevRandao post-merge
BlockNumber: block.Number,
GasLimit: block.GasLimit,
GasUsed: block.GasUsed,
Timestamp: block.Time,
ExtraData: eth.BytesMax32(block.Extra),
BaseFeePerGas: eth.Uint256Quantity(baseFee),
BlockHash: block.Hash,
Transactions: opaqueTxs,
Withdrawals: block.Withdrawals,
BlobGasUsed: block.BlobGasUsed,
ExcessBlobGas: block.ExcessBlobGas,
WithdrawalsRoot: block.WithdrawalsRoot,
}

return &eth.ExecutionPayloadEnvelope{
Expand Down
2 changes: 2 additions & 0 deletions op-wheel/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,8 @@ func rollupFromGethConfig(cfg *params.ChainConfig) *rollup.Config {
CanyonTime: cfg.CanyonTime,
EcotoneTime: cfg.EcotoneTime,
GraniteTime: cfg.GraniteTime,
HoloceneTime: cfg.HoloceneTime,
IsthmusTime: cfg.IsthmusTime,
InteropTime: cfg.InteropTime,
}
}
Expand Down

0 comments on commit dcb376f

Please sign in to comment.