mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 10:22:23 +00:00
ChainConfig: update DescartesBlock to DarwinTime (#900)
update chainconfig: DescartesBlock -> DarwinTime
This commit is contained in:
parent
2ec2bc6b2c
commit
fc5763e4bf
7 changed files with 29 additions and 29 deletions
|
|
@ -4727,7 +4727,7 @@ func TestCurieTransition(t *testing.T) {
|
||||||
b, _ := json.Marshal(params.AllEthashProtocolChanges)
|
b, _ := json.Marshal(params.AllEthashProtocolChanges)
|
||||||
json.Unmarshal(b, &config)
|
json.Unmarshal(b, &config)
|
||||||
config.CurieBlock = big.NewInt(2)
|
config.CurieBlock = big.NewInt(2)
|
||||||
config.DescartesBlock = nil
|
config.DarwinTime = nil
|
||||||
|
|
||||||
var (
|
var (
|
||||||
db = rawdb.NewMemoryDatabase()
|
db = rawdb.NewMemoryDatabase()
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,7 @@ func TestStateProcessorErrors(t *testing.T) {
|
||||||
CancunTime: new(uint64),
|
CancunTime: new(uint64),
|
||||||
BernoulliBlock: big.NewInt(0),
|
BernoulliBlock: big.NewInt(0),
|
||||||
CurieBlock: big.NewInt(0),
|
CurieBlock: big.NewInt(0),
|
||||||
DescartesBlock: big.NewInt(0),
|
DarwinTime: new(uint64),
|
||||||
}
|
}
|
||||||
signer = types.LatestSigner(config)
|
signer = types.LatestSigner(config)
|
||||||
key1, _ = crypto.HexToECDSA("b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291")
|
key1, _ = crypto.HexToECDSA("b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291")
|
||||||
|
|
|
||||||
|
|
@ -56,8 +56,8 @@ func NewEVMInterpreter(evm *EVM) *EVMInterpreter {
|
||||||
// If jump table was not initialised we set the default one.
|
// If jump table was not initialised we set the default one.
|
||||||
var table *JumpTable
|
var table *JumpTable
|
||||||
switch {
|
switch {
|
||||||
case evm.chainRules.IsDescartes:
|
case evm.chainRules.IsDarwin:
|
||||||
table = &descartesInstructionSet
|
table = &darwinInstructionSet
|
||||||
case evm.chainRules.IsCurie:
|
case evm.chainRules.IsCurie:
|
||||||
table = &curieInstructionSet
|
table = &curieInstructionSet
|
||||||
case evm.chainRules.IsCancun:
|
case evm.chainRules.IsCancun:
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@ var (
|
||||||
shanghaiInstructionSet = newShanghaiInstructionSet()
|
shanghaiInstructionSet = newShanghaiInstructionSet()
|
||||||
cancunInstructionSet = newCancunInstructionSet()
|
cancunInstructionSet = newCancunInstructionSet()
|
||||||
curieInstructionSet = newCurieInstructionSet()
|
curieInstructionSet = newCurieInstructionSet()
|
||||||
descartesInstructionSet = newDescartesInstructionSet()
|
darwinInstructionSet = newDarwinInstructionSet()
|
||||||
)
|
)
|
||||||
|
|
||||||
// JumpTable contains the EVM opcodes supported at a given fork.
|
// JumpTable contains the EVM opcodes supported at a given fork.
|
||||||
|
|
@ -82,9 +82,9 @@ func validate(jt JumpTable) JumpTable {
|
||||||
return jt
|
return jt
|
||||||
}
|
}
|
||||||
|
|
||||||
// newDescartesInstructionSet returns the frontier, homestead, byzantium,
|
// newDarwinInstructionSet returns the frontier, homestead, byzantium,
|
||||||
// contantinople, istanbul, petersburg, berlin, london, shanghai, curie, and descartes instructions.
|
// contantinople, istanbul, petersburg, berlin, london, shanghai, curie, and darwin instructions.
|
||||||
func newDescartesInstructionSet() JumpTable {
|
func newDarwinInstructionSet() JumpTable {
|
||||||
instructionSet := newCurieInstructionSet()
|
instructionSet := newCurieInstructionSet()
|
||||||
return instructionSet
|
return instructionSet
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,7 @@ func setDefaults(cfg *Config) {
|
||||||
ShanghaiTime: new(uint64),
|
ShanghaiTime: new(uint64),
|
||||||
BernoulliBlock: new(big.Int),
|
BernoulliBlock: new(big.Int),
|
||||||
CurieBlock: new(big.Int),
|
CurieBlock: new(big.Int),
|
||||||
DescartesBlock: new(big.Int),
|
DarwinTime: new(uint64),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -142,11 +142,11 @@ func newTestBackend(t *testing.T, londonBlock *big.Int, pending bool) *testBacke
|
||||||
config.ArchimedesBlock = londonBlock
|
config.ArchimedesBlock = londonBlock
|
||||||
config.BernoulliBlock = londonBlock
|
config.BernoulliBlock = londonBlock
|
||||||
config.CurieBlock = londonBlock
|
config.CurieBlock = londonBlock
|
||||||
config.DescartesBlock = londonBlock
|
|
||||||
config.ShanghaiTime = nil
|
config.ShanghaiTime = nil
|
||||||
if londonBlock != nil {
|
if londonBlock != nil {
|
||||||
shanghaiTime := londonBlock.Uint64() * 12
|
shanghaiTime := londonBlock.Uint64() * 12
|
||||||
config.ShanghaiTime = &shanghaiTime
|
config.ShanghaiTime = &shanghaiTime
|
||||||
|
config.DarwinTime = &shanghaiTime
|
||||||
}
|
}
|
||||||
|
|
||||||
config.TerminalTotalDifficulty = common.Big0
|
config.TerminalTotalDifficulty = common.Big0
|
||||||
|
|
|
||||||
|
|
@ -168,7 +168,7 @@ var (
|
||||||
ArchimedesBlock: big.NewInt(0),
|
ArchimedesBlock: big.NewInt(0),
|
||||||
BernoulliBlock: big.NewInt(0),
|
BernoulliBlock: big.NewInt(0),
|
||||||
CurieBlock: big.NewInt(0),
|
CurieBlock: big.NewInt(0),
|
||||||
DescartesBlock: big.NewInt(0),
|
DarwinTime: newUint64(0),
|
||||||
Scroll: ScrollConfig{
|
Scroll: ScrollConfig{
|
||||||
UseZktrie: false,
|
UseZktrie: false,
|
||||||
FeeVaultAddress: nil,
|
FeeVaultAddress: nil,
|
||||||
|
|
@ -204,7 +204,7 @@ var (
|
||||||
ArchimedesBlock: big.NewInt(2646311),
|
ArchimedesBlock: big.NewInt(2646311),
|
||||||
BernoulliBlock: nil,
|
BernoulliBlock: nil,
|
||||||
CurieBlock: nil,
|
CurieBlock: nil,
|
||||||
DescartesBlock: nil,
|
DarwinTime: nil,
|
||||||
Clique: &CliqueConfig{
|
Clique: &CliqueConfig{
|
||||||
Period: 3,
|
Period: 3,
|
||||||
Epoch: 30000,
|
Epoch: 30000,
|
||||||
|
|
@ -242,7 +242,7 @@ var (
|
||||||
ArchimedesBlock: big.NewInt(0),
|
ArchimedesBlock: big.NewInt(0),
|
||||||
BernoulliBlock: big.NewInt(3747132),
|
BernoulliBlock: big.NewInt(3747132),
|
||||||
CurieBlock: big.NewInt(4740239),
|
CurieBlock: big.NewInt(4740239),
|
||||||
DescartesBlock: nil,
|
DarwinTime: nil,
|
||||||
Clique: &CliqueConfig{
|
Clique: &CliqueConfig{
|
||||||
Period: 3,
|
Period: 3,
|
||||||
Epoch: 30000,
|
Epoch: 30000,
|
||||||
|
|
@ -280,7 +280,7 @@ var (
|
||||||
ArchimedesBlock: big.NewInt(0),
|
ArchimedesBlock: big.NewInt(0),
|
||||||
BernoulliBlock: big.NewInt(5220340),
|
BernoulliBlock: big.NewInt(5220340),
|
||||||
CurieBlock: big.NewInt(7096836),
|
CurieBlock: big.NewInt(7096836),
|
||||||
DescartesBlock: nil,
|
DarwinTime: nil,
|
||||||
Clique: &CliqueConfig{
|
Clique: &CliqueConfig{
|
||||||
Period: 3,
|
Period: 3,
|
||||||
Epoch: 30000,
|
Epoch: 30000,
|
||||||
|
|
@ -351,7 +351,7 @@ var (
|
||||||
ArchimedesBlock: big.NewInt(0),
|
ArchimedesBlock: big.NewInt(0),
|
||||||
BernoulliBlock: big.NewInt(0),
|
BernoulliBlock: big.NewInt(0),
|
||||||
CurieBlock: big.NewInt(0),
|
CurieBlock: big.NewInt(0),
|
||||||
DescartesBlock: big.NewInt(0),
|
DarwinTime: newUint64(0),
|
||||||
Scroll: ScrollConfig{
|
Scroll: ScrollConfig{
|
||||||
UseZktrie: false,
|
UseZktrie: false,
|
||||||
FeeVaultAddress: nil,
|
FeeVaultAddress: nil,
|
||||||
|
|
@ -397,7 +397,7 @@ var (
|
||||||
ArchimedesBlock: big.NewInt(0),
|
ArchimedesBlock: big.NewInt(0),
|
||||||
BernoulliBlock: big.NewInt(0),
|
BernoulliBlock: big.NewInt(0),
|
||||||
CurieBlock: big.NewInt(0),
|
CurieBlock: big.NewInt(0),
|
||||||
DescartesBlock: big.NewInt(0),
|
DarwinTime: newUint64(0),
|
||||||
Scroll: ScrollConfig{
|
Scroll: ScrollConfig{
|
||||||
UseZktrie: false,
|
UseZktrie: false,
|
||||||
FeeVaultAddress: &common.Address{123},
|
FeeVaultAddress: &common.Address{123},
|
||||||
|
|
@ -441,7 +441,7 @@ var (
|
||||||
ArchimedesBlock: big.NewInt(0),
|
ArchimedesBlock: big.NewInt(0),
|
||||||
BernoulliBlock: big.NewInt(0),
|
BernoulliBlock: big.NewInt(0),
|
||||||
CurieBlock: big.NewInt(0),
|
CurieBlock: big.NewInt(0),
|
||||||
DescartesBlock: big.NewInt(0),
|
DarwinTime: newUint64(0),
|
||||||
Scroll: ScrollConfig{
|
Scroll: ScrollConfig{
|
||||||
UseZktrie: false,
|
UseZktrie: false,
|
||||||
FeeVaultAddress: nil,
|
FeeVaultAddress: nil,
|
||||||
|
|
@ -532,7 +532,6 @@ type ChainConfig struct {
|
||||||
ArchimedesBlock *big.Int `json:"archimedesBlock,omitempty"` // Archimedes switch block (nil = no fork, 0 = already on archimedes)
|
ArchimedesBlock *big.Int `json:"archimedesBlock,omitempty"` // Archimedes switch block (nil = no fork, 0 = already on archimedes)
|
||||||
BernoulliBlock *big.Int `json:"bernoulliBlock,omitempty"` // Bernoulli switch block (nil = no fork, 0 = already on bernoulli)
|
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)
|
CurieBlock *big.Int `json:"curieBlock,omitempty"` // Curie switch block (nil = no fork, 0 = already on curie)
|
||||||
DescartesBlock *big.Int `json:"descartesBlock,omitempty"` // Descartes switch block (nil = no fork, 0 = already on descartes)
|
|
||||||
|
|
||||||
// Fork scheduling was switched from blocks to timestamps here
|
// Fork scheduling was switched from blocks to timestamps here
|
||||||
|
|
||||||
|
|
@ -540,6 +539,7 @@ type ChainConfig struct {
|
||||||
CancunTime *uint64 `json:"cancunTime,omitempty"` // Cancun switch time (nil = no fork, 0 = already on cancun)
|
CancunTime *uint64 `json:"cancunTime,omitempty"` // Cancun switch time (nil = no fork, 0 = already on cancun)
|
||||||
PragueTime *uint64 `json:"pragueTime,omitempty"` // Prague switch time (nil = no fork, 0 = already on prague)
|
PragueTime *uint64 `json:"pragueTime,omitempty"` // Prague switch time (nil = no fork, 0 = already on prague)
|
||||||
VerkleTime *uint64 `json:"verkleTime,omitempty"` // Verkle switch time (nil = no fork, 0 = already on verkle)
|
VerkleTime *uint64 `json:"verkleTime,omitempty"` // Verkle switch time (nil = no fork, 0 = already on verkle)
|
||||||
|
DarwinTime *uint64 `json:"darwinTime,omitempty"` // Darwin switch time (nil = no fork, 0 = already on darwin)
|
||||||
|
|
||||||
// TerminalTotalDifficulty is the amount of total difficulty reached by
|
// TerminalTotalDifficulty is the amount of total difficulty reached by
|
||||||
// the network that triggers the consensus upgrade.
|
// the network that triggers the consensus upgrade.
|
||||||
|
|
@ -717,9 +717,6 @@ func (c *ChainConfig) Description() string {
|
||||||
if c.CurieBlock != nil {
|
if c.CurieBlock != nil {
|
||||||
banner += fmt.Sprintf(" - Curie: #%-8v\n", c.CurieBlock) // TODO: add Curie execution-specs
|
banner += fmt.Sprintf(" - Curie: #%-8v\n", c.CurieBlock) // TODO: add Curie execution-specs
|
||||||
}
|
}
|
||||||
if c.DescartesBlock != nil {
|
|
||||||
banner += fmt.Sprintf(" - Descartes: #%-8v\n", c.DescartesBlock) // TODO: add Descartes execution-specs
|
|
||||||
}
|
|
||||||
banner += "\n"
|
banner += "\n"
|
||||||
|
|
||||||
// Add a special section for the merge as it's non-obvious
|
// Add a special section for the merge as it's non-obvious
|
||||||
|
|
@ -751,6 +748,9 @@ func (c *ChainConfig) Description() string {
|
||||||
if c.VerkleTime != nil {
|
if c.VerkleTime != nil {
|
||||||
banner += fmt.Sprintf(" - Verkle: @%-10v\n", *c.VerkleTime)
|
banner += fmt.Sprintf(" - Verkle: @%-10v\n", *c.VerkleTime)
|
||||||
}
|
}
|
||||||
|
if c.DarwinTime != nil {
|
||||||
|
banner += fmt.Sprintf(" - Darwin: @%-10v\n", *c.DarwinTime)
|
||||||
|
}
|
||||||
banner += "\n"
|
banner += "\n"
|
||||||
|
|
||||||
banner += "Scroll Config:\n"
|
banner += "Scroll Config:\n"
|
||||||
|
|
@ -875,9 +875,9 @@ func (c *ChainConfig) IsCurie(num *big.Int) bool {
|
||||||
return isBlockForked(c.CurieBlock, num)
|
return isBlockForked(c.CurieBlock, num)
|
||||||
}
|
}
|
||||||
|
|
||||||
// IsDescartes returns whether num is either equal to the Descartes fork block or greater.
|
// IsDarwin returns whether num is either equal to the Darwin fork block or greater.
|
||||||
func (c *ChainConfig) IsDescartes(num *big.Int) bool {
|
func (c *ChainConfig) IsDarwin(num *big.Int, time uint64) bool {
|
||||||
return isBlockForked(c.DescartesBlock, num)
|
return c.IsLondon(num) && isTimestampForked(c.DarwinTime, time)
|
||||||
}
|
}
|
||||||
|
|
||||||
// CheckCompatible checks whether scheduled fork transitions have been imported
|
// CheckCompatible checks whether scheduled fork transitions have been imported
|
||||||
|
|
@ -939,7 +939,7 @@ func (c *ChainConfig) CheckConfigForkOrder() error {
|
||||||
{name: "bernoulliBlock", block: c.BernoulliBlock, optional: true},
|
{name: "bernoulliBlock", block: c.BernoulliBlock, optional: true},
|
||||||
{name: "shanghaiTime", timestamp: c.ShanghaiTime},
|
{name: "shanghaiTime", timestamp: c.ShanghaiTime},
|
||||||
{name: "curieBlock", block: c.CurieBlock, optional: true},
|
{name: "curieBlock", block: c.CurieBlock, optional: true},
|
||||||
{name: "descartesBlock", block: c.DescartesBlock, optional: true},
|
{name: "darwinTime", timestamp: c.DarwinTime, optional: true},
|
||||||
} {
|
} {
|
||||||
if lastFork.name != "" {
|
if lastFork.name != "" {
|
||||||
switch {
|
switch {
|
||||||
|
|
@ -1058,8 +1058,8 @@ func (c *ChainConfig) checkCompatible(newcfg *ChainConfig, headNumber *big.Int,
|
||||||
if isForkBlockIncompatible(c.CurieBlock, newcfg.CurieBlock, headNumber) {
|
if isForkBlockIncompatible(c.CurieBlock, newcfg.CurieBlock, headNumber) {
|
||||||
return newBlockCompatError("Curie fork block", c.CurieBlock, newcfg.CurieBlock)
|
return newBlockCompatError("Curie fork block", c.CurieBlock, newcfg.CurieBlock)
|
||||||
}
|
}
|
||||||
if isForkBlockIncompatible(c.DescartesBlock, newcfg.DescartesBlock, headNumber) {
|
if isForkTimestampIncompatible(c.DarwinTime, newcfg.DarwinTime, headTimestamp) {
|
||||||
return newBlockCompatError("Descartes fork block", c.DescartesBlock, newcfg.DescartesBlock)
|
return newTimestampCompatError("Darwin fork timestamp", c.DarwinTime, newcfg.DarwinTime)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
@ -1207,7 +1207,7 @@ type Rules struct {
|
||||||
IsBerlin, IsLondon bool
|
IsBerlin, IsLondon bool
|
||||||
IsMerge, IsShanghai, IsCancun, IsPrague bool
|
IsMerge, IsShanghai, IsCancun, IsPrague bool
|
||||||
IsVerkle bool
|
IsVerkle bool
|
||||||
IsArchimedes, IsBernoulli, IsCurie, IsDescartes bool
|
IsArchimedes, IsBernoulli, IsCurie, IsDarwin bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// Rules ensures c's ChainID is not nil.
|
// Rules ensures c's ChainID is not nil.
|
||||||
|
|
@ -1236,6 +1236,6 @@ func (c *ChainConfig) Rules(num *big.Int, isMerge bool, timestamp uint64) Rules
|
||||||
IsArchimedes: c.IsArchimedes(num),
|
IsArchimedes: c.IsArchimedes(num),
|
||||||
IsBernoulli: c.IsBernoulli(num),
|
IsBernoulli: c.IsBernoulli(num),
|
||||||
IsCurie: c.IsCurie(num),
|
IsCurie: c.IsCurie(num),
|
||||||
IsDescartes: c.IsDescartes(num),
|
IsDarwin: c.IsDarwin(num, timestamp),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue