Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to Isthmus #2

Merged
merged 3 commits into from
Dec 9, 2024
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
5 changes: 5 additions & 0 deletions cmd/geth/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,11 @@ func makeFullNode(ctx *cli.Context) *node.Node {
cfg.Eth.OverrideOptimismHolocene = &v
}

if ctx.IsSet(utils.OverrideOptimismIsthmus.Name) {
v := ctx.Uint64(utils.OverrideOptimismIsthmus.Name)
cfg.Eth.OverrideOptimismIsthmus = &v
}

if ctx.IsSet(utils.OverrideOptimismInterop.Name) {
v := ctx.Uint64(utils.OverrideOptimismInterop.Name)
cfg.Eth.OverrideOptimismInterop = &v
Expand Down
1 change: 1 addition & 0 deletions cmd/geth/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ var (
utils.OverrideOptimismFjord,
utils.OverrideOptimismGranite,
utils.OverrideOptimismHolocene,
utils.OverrideOptimismIsthmus,
utils.OverrideOptimismInterop,
utils.EnablePersonal,
utils.TxPoolLocalsFlag,
Expand Down
5 changes: 5 additions & 0 deletions cmd/utils/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,11 @@ var (
Usage: "Manually specify the Optimism Holocene fork timestamp, overriding the bundled setting",
Category: flags.EthCategory,
}
OverrideOptimismIsthmus = &cli.Uint64Flag{
Name: "override.isthmus",
Usage: "Manually specify the Optimism Isthmus fork timestamp, overriding the bundled setting",
Category: flags.EthCategory,
}
OverrideOptimismInterop = &cli.Uint64Flag{
Name: "override.interop",
Usage: "Manually specify the Optimsim Interop feature-set fork timestamp, overriding the bundled setting",
Expand Down
4 changes: 4 additions & 0 deletions core/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,7 @@ type ChainOverrides struct {
OverrideOptimismFjord *uint64
OverrideOptimismGranite *uint64
OverrideOptimismHolocene *uint64
OverrideOptimismIsthmus *uint64
OverrideOptimismInterop *uint64
ApplySuperchainUpgrades bool
}
Expand Down Expand Up @@ -322,6 +323,9 @@ func SetupGenesisBlockWithOverride(db ethdb.Database, triedb *triedb.Database, g
if overrides != nil && overrides.OverrideOptimismHolocene != nil {
config.HoloceneTime = overrides.OverrideOptimismHolocene
}
if overrides != nil && overrides.OverrideOptimismIsthmus != nil {
config.IsthmusTime = overrides.OverrideOptimismIsthmus
}
if overrides != nil && overrides.OverrideOptimismInterop != nil {
config.InteropTime = overrides.OverrideOptimismInterop
}
Expand Down
4 changes: 2 additions & 2 deletions core/types/receipt.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ type Receipt struct {
FeeScalar *big.Float `json:"l1FeeScalar,omitempty"` // Present from pre-bedrock to Ecotone. Nil after Ecotone
L1BaseFeeScalar *uint64 `json:"l1BaseFeeScalar,omitempty"` // Always nil prior to the Ecotone hardfork
L1BlobBaseFeeScalar *uint64 `json:"l1BlobBaseFeeScalar,omitempty"` // Always nil prior to the Ecotone hardfork
OperatorFeeScalar *uint64 `json:"operatorFeeScalar,omitempty"` // Always nil prior to the Holocene hardfork
OperatorFeeConstant *uint64 `json:"operatorFeeConstant,omitempty"` // Always nil prior to the Holocene hardfork
OperatorFeeScalar *uint64 `json:"operatorFeeScalar,omitempty"` // Always nil prior to the Isthmus hardfork
OperatorFeeConstant *uint64 `json:"operatorFeeConstant,omitempty"` // Always nil prior to the Isthmus hardfork
}

type receiptMarshaling struct {
Expand Down
20 changes: 10 additions & 10 deletions core/types/receipt_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ var (
conf.EcotoneTime = &time
return &conf
}()
holoceneTestConfig = func() *params.ChainConfig {
isthmusTestConfig = func() *params.ChainConfig {
conf := *bedrockGenesisTestConfig // copy the config
time := uint64(0)
conf.HoloceneTime = &time
conf.IsthmusTime = &time
return &conf
}()

Expand Down Expand Up @@ -774,7 +774,7 @@ func getOptimismEcotoneTxReceipts(l1AttributesPayload []byte, l1GasPrice, l1Blob
return txs, receipts
}

func getOptimismHoloceneTxReceipts(l1AttributesPayload []byte, l1GasPrice, l1BlobGasPrice, l1GasUsed, l1Fee *big.Int, baseFeeScalar, blobBaseFeeScalar, operatorFeeScalar, operatorFeeConstant *uint64) ([]*Transaction, []*Receipt) {
func getOptimismIsthmusTxReceipts(l1AttributesPayload []byte, l1GasPrice, l1BlobGasPrice, l1GasUsed, l1Fee *big.Int, baseFeeScalar, blobBaseFeeScalar, operatorFeeScalar, operatorFeeConstant *uint64) ([]*Transaction, []*Receipt) {
// Create a few transactions to have receipts for
txs := Transactions{
NewTx(&DepositTx{
Expand Down Expand Up @@ -966,26 +966,26 @@ func TestDeriveOptimismEcotoneTxReceipts(t *testing.T) {
diffReceipts(t, receipts, derivedReceipts)
}

func TestDeriveOptimismHoloceneTxReceipts(t *testing.T) {
// Holocene style l1 attributes with baseFeeScalar=2, blobBaseFeeScalar=3, baseFee=1000*1e6, blobBaseFee=10*1e6, operatorFeeScalar=7, operatorFeeConstant=9
payload := common.Hex2Bytes("d1fbe15b000000020000000300000000000004d200000000000004d200000000000004d2000000000000000000000000000000000000000000000000000000003b9aca00000000000000000000000000000000000000000000000000000000000098968000000000000000000000000000000000000000000000000000000000000004d200000000000000000000000000000000000000000000000000000000000004d2000000070000000000000009")
func TestDeriveOptimismIsthmusTxReceipts(t *testing.T) {
// Isthmus style l1 attributes with baseFeeScalar=2, blobBaseFeeScalar=3, baseFee=1000*1e6, blobBaseFee=10*1e6, operatorFeeScalar=7, operatorFeeConstant=9
payload := common.Hex2Bytes("098999be000000020000000300000000000004d200000000000004d200000000000004d2000000000000000000000000000000000000000000000000000000003b9aca00000000000000000000000000000000000000000000000000000000000098968000000000000000000000000000000000000000000000000000000000000004d200000000000000000000000000000000000000000000000000000000000004d2000000070000000000000009")
// the parameters we use below are defined in rollup_test.go
baseFeeScalarUint64 := baseFeeScalar.Uint64()
blobBaseFeeScalarUint64 := blobBaseFeeScalar.Uint64()
operatorFeeScalarUint64 := operatorFeeScalar.Uint64()
operatorFeeConstantUint64 := operatorFeeConstant.Uint64()
txs, receipts := getOptimismHoloceneTxReceipts(payload, baseFee, blobBaseFee, minimumFjordGas, fjordFee, &baseFeeScalarUint64, &blobBaseFeeScalarUint64, &operatorFeeScalarUint64, &operatorFeeConstantUint64)
txs, receipts := getOptimismIsthmusTxReceipts(payload, baseFee, blobBaseFee, minimumFjordGas, fjordFee, &baseFeeScalarUint64, &blobBaseFeeScalarUint64, &operatorFeeScalarUint64, &operatorFeeConstantUint64)

// Re-derive receipts.
baseFee := big.NewInt(1000)
derivedReceipts := clearComputedFieldsOnReceipts(receipts)
// Should error out if we try to process this with a pre-Holocene config
// Should error out if we try to process this with a pre-Isthmus config
err := Receipts(derivedReceipts).DeriveFields(bedrockGenesisTestConfig, blockHash, blockNumber.Uint64(), 0, baseFee, nil, txs)
if err == nil {
t.Fatalf("expected error from deriving holocene receipts with pre-holocene config, got none")
t.Fatalf("expected error from deriving isthmus receipts with pre-isthmus config, got none")
}

err = Receipts(derivedReceipts).DeriveFields(holoceneTestConfig, blockHash, blockNumber.Uint64(), 0, baseFee, nil, txs)
err = Receipts(derivedReceipts).DeriveFields(isthmusTestConfig, blockHash, blockNumber.Uint64(), 0, baseFee, nil, txs)
if err != nil {
t.Fatalf("DeriveFields(...) = %v, want <nil>", err)
}
Expand Down
3 changes: 3 additions & 0 deletions eth/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,9 @@ func New(stack *node.Node, config *ethconfig.Config) (*Ethereum, error) {
if config.OverrideOptimismHolocene != nil {
overrides.OverrideOptimismHolocene = config.OverrideOptimismHolocene
}
if config.OverrideOptimismIsthmus != nil {
overrides.OverrideOptimismIsthmus = config.OverrideOptimismIsthmus
}
if config.OverrideOptimismInterop != nil {
overrides.OverrideOptimismInterop = config.OverrideOptimismInterop
}
Expand Down
2 changes: 2 additions & 0 deletions eth/ethconfig/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,8 @@ type Config struct {

OverrideOptimismHolocene *uint64 `toml:",omitempty"`

OverrideOptimismIsthmus *uint64 `toml:",omitempty"`

OverrideOptimismInterop *uint64 `toml:",omitempty"`

// ApplySuperchainUpgrades requests the node to load chain-configuration from the superchain-registry.
Expand Down
6 changes: 6 additions & 0 deletions eth/ethconfig/gen_config.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.