Skip to content

Commit

Permalink
Merge pull request #65 from kroma-network/chore/enable-canyon-testnets
Browse files Browse the repository at this point in the history
chore: enable canyon upgrade for kroma testnets
  • Loading branch information
Pangssu authored Feb 6, 2024
2 parents 04e8f66 + b1379d6 commit e944010
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 2 deletions.
12 changes: 10 additions & 2 deletions core/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -311,14 +311,20 @@ func SetupGenesisBlockWithOverride(db ethdb.Database, triedb *trie.Database, gen
// // Apply Base Goerli regolith time
// config.RegolithTime = &params.BaseGoerliRegolithTime
// }
// TODO(pangssu): need to hardcode overrides for each chain. (kroma mainnet, kroma sepolia, devnet)

// NOTE: kroma always post-regolith
// [Kroma: START]
zero := uint64(0)
if config.IsKroma() {
// NOTE: kroma always post-regolith
config.BedrockBlock = new(big.Int).SetUint64(zero)
config.RegolithTime = &zero
// Canyon upgrade
canyonTime := &params.UpgradeConfigs[config.ChainID.Uint64()].CanyonTime
config.CanyonTime = canyonTime
config.ShanghaiTime = canyonTime
config.Kroma.EIP1559DenominatorCanyon = 250
}
// [Kroma: END]
if overrides != nil && overrides.OverrideCancun != nil {
config.CancunTime = overrides.OverrideCancun
}
Expand All @@ -333,12 +339,14 @@ func SetupGenesisBlockWithOverride(db ethdb.Database, triedb *trie.Database, gen
}
}

// [Kroma: START]
if overrides != nil && overrides.CircuitParams != nil && overrides.CircuitParams.MaxTxs != nil {
config.MaxTxPerBlock = overrides.CircuitParams.MaxTxs
}
if overrides != nil && overrides.CircuitParams != nil && overrides.CircuitParams.MaxCalldata != nil {
config.MaxTxPayloadBytesPerBlock = overrides.CircuitParams.MaxCalldata
}
// [Kroma: END]
}
}
// Just commit the new block if there is no stored genesis block.
Expand Down
1 change: 1 addition & 0 deletions params/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ var (
const (
KromaMainnetChainID = 255
KromaSepoliaChainID = 2358
KromaDevnetChainID = 7791
)

func newUint64(val uint64) *uint64 { return &val }
Expand Down
25 changes: 25 additions & 0 deletions params/kroma.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package params

import (
"fmt"
)

func init() {
NetworkNames[fmt.Sprintf("%d", KromaMainnetChainID)] = "KromaMainnet"
NetworkNames[fmt.Sprintf("%d", KromaSepoliaChainID)] = "KromaSepolia"
NetworkNames[fmt.Sprintf("%d", KromaDevnetChainID)] = "KromaDevnet"
}

type UpgradeConfig struct {
CanyonTime uint64
}

var UpgradeConfigs = map[uint64]*UpgradeConfig{
KromaMainnetChainID: {},
KromaSepoliaChainID: {
CanyonTime: 1707897600,
},
KromaDevnetChainID: {
CanyonTime: 1707292800,
},
}

0 comments on commit e944010

Please sign in to comment.