Skip to content

Commit

Permalink
feat: rename next upgrade to Darwin (#863)
Browse files Browse the repository at this point in the history
  • Loading branch information
Thegaram committed Jun 26, 2024
1 parent 574ebf8 commit 418bc6f
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 25 deletions.
2 changes: 1 addition & 1 deletion core/blockchain_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3722,7 +3722,7 @@ func TestCurieTransition(t *testing.T) {
b, _ := json.Marshal(params.AllEthashProtocolChanges)
json.Unmarshal(b, &config)
config.CurieBlock = big.NewInt(2)
config.DescartesTime = nil
config.DarwinTime = nil

var (
db = rawdb.NewMemoryDatabase()
Expand Down
2 changes: 1 addition & 1 deletion core/state_processor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func TestStateProcessorErrors(t *testing.T) {
ShanghaiBlock: big.NewInt(0),
BernoulliBlock: big.NewInt(0),
CurieBlock: big.NewInt(0),
DescartesTime: new(uint64),
DarwinTime: new(uint64),
Ethash: new(params.EthashConfig),
}
signer = types.LatestSigner(config)
Expand Down
4 changes: 2 additions & 2 deletions core/vm/interpreter.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ func NewEVMInterpreter(evm *EVM, cfg Config) *EVMInterpreter {
if cfg.JumpTable[STOP] == nil {
var jt JumpTable
switch {
case evm.chainRules.IsDescartes:
jt = descartesInstructionSet
case evm.chainRules.IsDarwin:
jt = darwinInstructionSet
case evm.chainRules.IsCurie:
jt = curieInstructionSet
case evm.chainRules.IsShanghai:
Expand Down
8 changes: 4 additions & 4 deletions core/vm/jump_table.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,15 @@ var (
londonInstructionSet = newLondonInstructionSet()
shanghaiInstructionSet = newShanghaiInstructionSet()
curieInstructionSet = newCurieInstructionSet()
descartesInstructionSet = newDescartesInstructionSet()
darwinInstructionSet = newDarwinInstructionSet()
)

// JumpTable contains the EVM opcodes supported at a given fork.
type JumpTable [256]*operation

// newDescartesInstructionSet returns the frontier, homestead, byzantium,
// contantinople, istanbul, petersburg, berlin, london, shanghai, curie, and descartes instructions.
func newDescartesInstructionSet() JumpTable {
// newDarwinInstructionSet returns the frontier, homestead, byzantium,
// contantinople, istanbul, petersburg, berlin, london, shanghai, curie, and darwin instructions.
func newDarwinInstructionSet() JumpTable {
instructionSet := newCurieInstructionSet()
return instructionSet
}
Expand Down
2 changes: 1 addition & 1 deletion core/vm/runtime/runtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func setDefaults(cfg *Config) {
ShanghaiBlock: new(big.Int),
BernoulliBlock: new(big.Int),
CurieBlock: new(big.Int),
DescartesTime: new(uint64),
DarwinTime: new(uint64),
}
}

Expand Down
2 changes: 1 addition & 1 deletion eth/gasprice/gasprice_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ func newTestBackend(t *testing.T, londonBlock *big.Int, pending bool, pendingTxC
config.ShanghaiBlock = londonBlock
config.BernoulliBlock = londonBlock
config.CurieBlock = londonBlock
config.DescartesTime = nil
config.DarwinTime = nil
engine := ethash.NewFaker()
db := rawdb.NewMemoryDatabase()
genesis, err := gspec.Commit(db)
Expand Down
30 changes: 15 additions & 15 deletions params/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ var (
ShanghaiBlock: nil,
BernoulliBlock: nil,
CurieBlock: nil,
DescartesTime: nil,
DarwinTime: nil,
Clique: &CliqueConfig{
Period: 3,
Epoch: 30000,
Expand Down Expand Up @@ -320,7 +320,7 @@ var (
ShanghaiBlock: big.NewInt(0),
BernoulliBlock: big.NewInt(3747132),
CurieBlock: big.NewInt(4740239),
DescartesTime: nil,
DarwinTime: nil,
Clique: &CliqueConfig{
Period: 3,
Epoch: 30000,
Expand Down Expand Up @@ -359,7 +359,7 @@ var (
ShanghaiBlock: big.NewInt(0),
BernoulliBlock: big.NewInt(5220340),
CurieBlock: big.NewInt(7096836),
DescartesTime: nil,
DarwinTime: nil,
Clique: &CliqueConfig{
Period: 3,
Epoch: 30000,
Expand Down Expand Up @@ -404,7 +404,7 @@ var (
ShanghaiBlock: big.NewInt(0),
BernoulliBlock: big.NewInt(0),
CurieBlock: big.NewInt(0),
DescartesTime: new(uint64),
DarwinTime: new(uint64),
TerminalTotalDifficulty: nil,
Ethash: new(EthashConfig),
Clique: nil,
Expand Down Expand Up @@ -447,7 +447,7 @@ var (
ShanghaiBlock: big.NewInt(0),
BernoulliBlock: big.NewInt(0),
CurieBlock: big.NewInt(0),
DescartesTime: new(uint64),
DarwinTime: new(uint64),
TerminalTotalDifficulty: nil,
Ethash: nil,
Clique: &CliqueConfig{Period: 0, Epoch: 30000},
Expand Down Expand Up @@ -485,7 +485,7 @@ var (
ShanghaiBlock: big.NewInt(0),
BernoulliBlock: big.NewInt(0),
CurieBlock: big.NewInt(0),
DescartesTime: new(uint64),
DarwinTime: new(uint64),
TerminalTotalDifficulty: nil,
Ethash: new(EthashConfig),
Clique: nil,
Expand Down Expand Up @@ -524,7 +524,7 @@ var (
ShanghaiBlock: big.NewInt(0),
BernoulliBlock: big.NewInt(0),
CurieBlock: big.NewInt(0),
DescartesTime: new(uint64),
DarwinTime: new(uint64),
TerminalTotalDifficulty: nil,
Ethash: new(EthashConfig),
Clique: nil,
Expand Down Expand Up @@ -622,7 +622,7 @@ type ChainConfig struct {
ShanghaiBlock *big.Int `json:"shanghaiBlock,omitempty"` // Shanghai switch block (nil = no fork, 0 = already on shanghai)
BernoulliBlock *big.Int `json:"bernoulliBlock,omitempty"` // Bernoulli switch block (nil = no fork, 0 = already on bernoulli)
CurieBlock *big.Int `json:"curieBlock,omitempty"` // Curie switch block (nil = no fork, 0 = already on curie)
DescartesTime *uint64 `json:"descartesTime,omitempty"` // Descartes switch time (nil = no fork, 0 = already on descartes)
DarwinTime *uint64 `json:"darwinTime,omitempty"` // Darwin switch time (nil = no fork, 0 = already on darwin)

// TerminalTotalDifficulty is the amount of total difficulty reached by
// the network that triggers the consensus upgrade.
Expand Down Expand Up @@ -739,7 +739,7 @@ func (c *ChainConfig) String() string {
default:
engine = "unknown"
}
return fmt.Sprintf("{ChainID: %v Homestead: %v DAO: %v DAOSupport: %v EIP150: %v EIP155: %v EIP158: %v Byzantium: %v Constantinople: %v Petersburg: %v Istanbul: %v, Muir Glacier: %v, Berlin: %v, London: %v, Arrow Glacier: %v, Archimedes: %v, Shanghai: %v, Bernoulli: %v, Curie: %v, Descartes: %v, Engine: %v, Scroll config: %v}",
return fmt.Sprintf("{ChainID: %v Homestead: %v DAO: %v DAOSupport: %v EIP150: %v EIP155: %v EIP158: %v Byzantium: %v Constantinople: %v Petersburg: %v Istanbul: %v, Muir Glacier: %v, Berlin: %v, London: %v, Arrow Glacier: %v, Archimedes: %v, Shanghai: %v, Bernoulli: %v, Curie: %v, Darwin: %v, Engine: %v, Scroll config: %v}",
c.ChainID,
c.HomesteadBlock,
c.DAOForkBlock,
Expand All @@ -759,7 +759,7 @@ func (c *ChainConfig) String() string {
c.ShanghaiBlock,
c.BernoulliBlock,
c.CurieBlock,
c.DescartesTime,
c.DarwinTime,
engine,
c.Scroll,
)
Expand Down Expand Up @@ -852,9 +852,9 @@ func (c *ChainConfig) IsCurie(num *big.Int) bool {
return isForked(c.CurieBlock, num)
}

// IsDescartes returns whether num is either equal to the Descartes fork block or greater.
func (c *ChainConfig) IsDescartes(now uint64) bool {
return isForkedTime(now, c.DescartesTime)
// IsDarwin returns whether num is either equal to the Darwin fork block or greater.
func (c *ChainConfig) IsDarwin(now uint64) bool {
return isForkedTime(now, c.DarwinTime)
}

// IsTerminalPoWBlock returns whether the given block is the last block of PoW stage.
Expand Down Expand Up @@ -1069,7 +1069,7 @@ type Rules struct {
IsHomestead, IsEIP150, IsEIP155, IsEIP158 bool
IsByzantium, IsConstantinople, IsPetersburg, IsIstanbul bool
IsBerlin, IsLondon, IsArchimedes, IsShanghai bool
IsBernoulli, IsCurie, IsDescartes bool
IsBernoulli, IsCurie, IsDarwin bool
}

// Rules ensures c's ChainID is not nil.
Expand All @@ -1094,6 +1094,6 @@ func (c *ChainConfig) Rules(num *big.Int, time uint64) Rules {
IsShanghai: c.IsShanghai(num),
IsBernoulli: c.IsBernoulli(num),
IsCurie: c.IsCurie(num),
IsDescartes: c.IsDescartes(time),
IsDarwin: c.IsDarwin(time),
}
}

0 comments on commit 418bc6f

Please sign in to comment.