Skip to content

Commit

Permalink
refactor: change hard fork name: LibplanetVn1 -> Libplanet
Browse files Browse the repository at this point in the history
  • Loading branch information
sircoon4 committed Sep 5, 2024
1 parent f4d721f commit 39c1be2
Show file tree
Hide file tree
Showing 10 changed files with 52 additions and 52 deletions.
6 changes: 3 additions & 3 deletions cmd/geth/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,9 @@ func makeFullNode(ctx *cli.Context) (*node.Node, ethapi.Backend) {
cfg.Eth.OverrideOptimismFjord = &v
}

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

if ctx.IsSet(utils.OverrideOptimismInterop.Name) {
Expand Down
2 changes: 1 addition & 1 deletion cmd/geth/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ var (
utils.OverrideOptimismCanyon,
utils.OverrideOptimismEcotone,
utils.OverrideOptimismFjord,
utils.OverrideOptimismLibplanetVn1,
utils.OverrideOptimismLibplanet,
utils.OverrideOptimismInterop,
utils.EnablePersonal,
utils.TxPoolLocalsFlag,
Expand Down
6 changes: 3 additions & 3 deletions cmd/utils/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -276,9 +276,9 @@ var (
Usage: "Manually specify the Optimism Fjord fork timestamp, overriding the bundled setting",
Category: flags.EthCategory,
}
OverrideOptimismLibplanetVn1 = &cli.Uint64Flag{
Name: "override.libplanetVn1",
Usage: "Manually specify the Optimism LibplanetVn1 fork timestamp, overriding the bundled setting",
OverrideOptimismLibplanet = &cli.Uint64Flag{
Name: "override.libplanet",
Usage: "Manually specify the Optimism Libplanet fork timestamp, overriding the bundled setting",
Category: flags.EthCategory,
}
OverrideOptimismInterop = &cli.Uint64Flag{
Expand Down
16 changes: 8 additions & 8 deletions core/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -222,12 +222,12 @@ type ChainOverrides struct {
OverrideCancun *uint64
OverrideVerkle *uint64
// optimism
OverrideOptimismCanyon *uint64
OverrideOptimismEcotone *uint64
OverrideOptimismFjord *uint64
OverrideOptimismLibplanetVn1 *uint64
ApplySuperchainUpgrades bool
OverrideOptimismInterop *uint64
OverrideOptimismCanyon *uint64
OverrideOptimismEcotone *uint64
OverrideOptimismFjord *uint64
OverrideOptimismLibplanet *uint64
ApplySuperchainUpgrades bool
OverrideOptimismInterop *uint64
}

// SetupGenesisBlock writes or updates the genesis block in db.
Expand Down Expand Up @@ -294,8 +294,8 @@ func SetupGenesisBlockWithOverride(db ethdb.Database, triedb *triedb.Database, g
if overrides != nil && overrides.OverrideOptimismFjord != nil {
config.FjordTime = overrides.OverrideOptimismFjord
}
if overrides != nil && overrides.OverrideOptimismLibplanetVn1 != nil {
config.LibplanetVn1Time = overrides.OverrideOptimismLibplanetVn1
if overrides != nil && overrides.OverrideOptimismLibplanet != nil {
config.LibplanetTime = overrides.OverrideOptimismLibplanet
}
if overrides != nil && overrides.OverrideOptimismInterop != nil {
config.InteropTime = overrides.OverrideOptimismInterop
Expand Down
28 changes: 14 additions & 14 deletions core/vm/contracts.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,9 @@ var PrecompiledContractsFjord = map[common.Address]PrecompiledContract{
common.BytesToAddress([]byte{0x01, 0x00}): &p256Verify{},
}

// PrecompiledContractsLibplanetVn1 contains the default set of pre-compiled Ethereum
// contracts used in the LibplanetVn1 release.
var PrecompiledContractsLibplanetVn1 = map[common.Address]PrecompiledContract{
// PrecompiledContractsLibplanet contains the default set of pre-compiled Ethereum
// contracts used in the Libplanet release.
var PrecompiledContractsLibplanet = map[common.Address]PrecompiledContract{
common.BytesToAddress([]byte{1}): &ecrecover{},
common.BytesToAddress([]byte{2}): &sha256hash{},
common.BytesToAddress([]byte{3}): &ripemd160hash{},
Expand Down Expand Up @@ -161,13 +161,13 @@ var PrecompiledContractsBLS = map[common.Address]PrecompiledContract{
}

var (
PrecompiledAddressesLibplanetVn1 []common.Address
PrecompiledAddressesFjord []common.Address
PrecompiledAddressesCancun []common.Address
PrecompiledAddressesBerlin []common.Address
PrecompiledAddressesIstanbul []common.Address
PrecompiledAddressesByzantium []common.Address
PrecompiledAddressesHomestead []common.Address
PrecompiledAddressesLibplanet []common.Address
PrecompiledAddressesFjord []common.Address
PrecompiledAddressesCancun []common.Address
PrecompiledAddressesBerlin []common.Address
PrecompiledAddressesIstanbul []common.Address
PrecompiledAddressesByzantium []common.Address
PrecompiledAddressesHomestead []common.Address
)

func init() {
Expand All @@ -189,16 +189,16 @@ func init() {
for k := range PrecompiledContractsFjord {
PrecompiledAddressesFjord = append(PrecompiledAddressesFjord, k)
}
for k := range PrecompiledContractsLibplanetVn1 {
PrecompiledAddressesLibplanetVn1 = append(PrecompiledAddressesLibplanetVn1, k)
for k := range PrecompiledContractsLibplanet {
PrecompiledAddressesLibplanet = append(PrecompiledAddressesLibplanet, k)
}
}

// ActivePrecompiles returns the precompiles enabled with the current configuration.
func ActivePrecompiles(rules params.Rules) []common.Address {
switch {
case rules.IsOptimismLibplanetVn1:
return PrecompiledAddressesLibplanetVn1
case rules.IsOptimismLibplanet:
return PrecompiledAddressesLibplanet
case rules.IsOptimismFjord:
return PrecompiledAddressesFjord
case rules.IsCancun:
Expand Down
4 changes: 2 additions & 2 deletions core/vm/evm.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ type (
func (evm *EVM) precompile(addr common.Address) (PrecompiledContract, bool) {
var precompiles map[common.Address]PrecompiledContract
switch {
case evm.chainRules.IsOptimismLibplanetVn1:
precompiles = PrecompiledContractsLibplanetVn1
case evm.chainRules.IsOptimismLibplanet:
precompiles = PrecompiledContractsLibplanet
case evm.chainRules.IsOptimismFjord:
precompiles = PrecompiledContractsFjord
case evm.chainRules.IsCancun:
Expand Down
4 changes: 2 additions & 2 deletions eth/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,8 @@ func New(stack *node.Node, config *ethconfig.Config) (*Ethereum, error) {
if config.OverrideOptimismFjord != nil {
overrides.OverrideOptimismFjord = config.OverrideOptimismFjord
}
if config.OverrideOptimismLibplanetVn1 != nil {
overrides.OverrideOptimismLibplanetVn1 = config.OverrideOptimismLibplanetVn1
if config.OverrideOptimismLibplanet != nil {
overrides.OverrideOptimismLibplanet = config.OverrideOptimismLibplanet
}
if config.OverrideOptimismInterop != nil {
overrides.OverrideOptimismInterop = config.OverrideOptimismInterop
Expand Down
2 changes: 1 addition & 1 deletion eth/ethconfig/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ type Config struct {

OverrideOptimismFjord *uint64 `toml:",omitempty"`

OverrideOptimismLibplanetVn1 *uint64 `toml:",omitempty"`
OverrideOptimismLibplanet *uint64 `toml:",omitempty"`

OverrideOptimismInterop *uint64 `toml:",omitempty"`

Expand Down
10 changes: 5 additions & 5 deletions eth/ethconfig/gen_config.go

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

26 changes: 13 additions & 13 deletions params/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ type ChainConfig struct {
EcotoneTime *uint64 `json:"ecotoneTime,omitempty"` // Ecotone switch time (nil = no fork, 0 = already on optimism ecotone)
FjordTime *uint64 `json:"fjordTime,omitempty"` // Fjord switch time (nil = no fork, 0 = already on Optimism Fjord)

LibplanetVn1Time *uint64 `json:"libplanetVn1Time,omitempty"` // Libplanet switch time (nil = no fork, 0 = already on libplanetVn1)
LibplanetTime *uint64 `json:"libplanetTime,omitempty"` // Libplanet switch time (nil = no fork, 0 = already on libplanet)

InteropTime *uint64 `json:"interopTime,omitempty"` // Interop switch time (nil = no fork, 0 = already on optimism interop)

Expand Down Expand Up @@ -551,8 +551,8 @@ func (c *ChainConfig) Description() string {
if c.FjordTime != nil {
banner += fmt.Sprintf(" - Fjord: @%-10v\n", *c.FjordTime)
}
if c.LibplanetVn1Time != nil {
banner += fmt.Sprintf(" - LibplanetVn1: @%-10v\n", *c.LibplanetVn1Time)
if c.LibplanetTime != nil {
banner += fmt.Sprintf(" - Libplanet: @%-10v\n", *c.LibplanetTime)
}
if c.InteropTime != nil {
banner += fmt.Sprintf(" - Interop: @%-10v\n", *c.InteropTime)
Expand Down Expand Up @@ -681,8 +681,8 @@ func (c *ChainConfig) IsFjord(time uint64) bool {
return isTimestampForked(c.FjordTime, time)
}

func (c *ChainConfig) IsLibplanetVn1(time uint64) bool {
return isTimestampForked(c.LibplanetVn1Time, time)
func (c *ChainConfig) IsLibplanet(time uint64) bool {
return isTimestampForked(c.LibplanetTime, time)
}

func (c *ChainConfig) IsInterop(time uint64) bool {
Expand Down Expand Up @@ -715,8 +715,8 @@ func (c *ChainConfig) IsOptimismFjord(time uint64) bool {
return c.IsOptimism() && c.IsFjord(time)
}

func (c *ChainConfig) IsOptimismLibplanetVn1(time uint64) bool {
return c.IsOptimism() && c.IsLibplanetVn1(time)
func (c *ChainConfig) IsOptimismLibplanet(time uint64) bool {
return c.IsOptimism() && c.IsLibplanet(time)
}

// IsOptimismPreBedrock returns true iff this is an optimism node & bedrock is not yet active
Expand Down Expand Up @@ -1060,7 +1060,7 @@ type Rules struct {
IsVerkle bool
IsOptimismBedrock, IsOptimismRegolith bool
IsOptimismCanyon, IsOptimismFjord bool
IsOptimismLibplanetVn1 bool
IsOptimismLibplanet bool
}

// Rules ensures c's ChainID is not nil.
Expand Down Expand Up @@ -1089,10 +1089,10 @@ func (c *ChainConfig) Rules(num *big.Int, isMerge bool, timestamp uint64) Rules
IsPrague: isMerge && c.IsPrague(num, timestamp),
IsVerkle: isMerge && c.IsVerkle(num, timestamp),
// Optimism
IsOptimismBedrock: isMerge && c.IsOptimismBedrock(num),
IsOptimismRegolith: isMerge && c.IsOptimismRegolith(timestamp),
IsOptimismCanyon: isMerge && c.IsOptimismCanyon(timestamp),
IsOptimismFjord: isMerge && c.IsOptimismFjord(timestamp),
IsOptimismLibplanetVn1: isMerge && c.IsOptimismLibplanetVn1(timestamp),
IsOptimismBedrock: isMerge && c.IsOptimismBedrock(num),
IsOptimismRegolith: isMerge && c.IsOptimismRegolith(timestamp),
IsOptimismCanyon: isMerge && c.IsOptimismCanyon(timestamp),
IsOptimismFjord: isMerge && c.IsOptimismFjord(timestamp),
IsOptimismLibplanet: isMerge && c.IsOptimismLibplanet(timestamp),
}
}

0 comments on commit 39c1be2

Please sign in to comment.