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

introduce the wakeBlockHeight as next hardfork #4567

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
9 changes: 9 additions & 0 deletions blockchain/genesis/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ func defaultConfig() Genesis {
TsunamiBlockHeight: 29275561,
UpernavikBlockHeight: 31174201,
VanuatuBlockHeight: 33730921,
WakeBlockHeight: 43730921,
ToBeEnabledBlockHeight: math.MaxUint64,
},
Account: Account{
Expand Down Expand Up @@ -276,6 +277,9 @@ type (
// 1. enable Cancun EVM
// 2. enable dynamic fee tx
VanuatuBlockHeight uint64 `yaml:"vanuatuHeight"`
// WakeBlockHeight is the start height to
// 1. enable 3s block interval
WakeBlockHeight uint64 `yaml:"wakeHeight"`
// ToBeEnabledBlockHeight is a fake height that acts as a gating factor for WIP features
// upon next release, change IsToBeEnabled() to IsNextHeight() for features to be released
ToBeEnabledBlockHeight uint64 `yaml:"toBeEnabledHeight"`
Expand Down Expand Up @@ -641,6 +645,11 @@ func (g *Blockchain) IsVanuatu(height uint64) bool {
return g.isPost(g.VanuatuBlockHeight, height)
}

// IsWake checks whether height is equal to or larger than wake height
func (g *Blockchain) IsWake(height uint64) bool {
return g.isPost(g.WakeBlockHeight, height)
}

// IsToBeEnabled checks whether height is equal to or larger than toBeEnabled height
func (g *Blockchain) IsToBeEnabled(height uint64) bool {
return g.isPost(g.ToBeEnabledBlockHeight, height)
Expand Down
3 changes: 3 additions & 0 deletions blockchain/genesis/heightupgrade_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ func TestNewHeightChange(t *testing.T) {
require.True(cfg.IsUpernavik(uint64(31174201)))
require.False(cfg.IsVanuatu(uint64(33730920)))
require.True(cfg.IsVanuatu(uint64(33730921)))
require.False(cfg.IsWake(uint64(43730920)))
require.True(cfg.IsWake(uint64(43730921)))

require.Equal(cfg.PacificBlockHeight, uint64(432001))
require.Equal(cfg.AleutianBlockHeight, uint64(864001))
Expand All @@ -93,4 +95,5 @@ func TestNewHeightChange(t *testing.T) {
require.Equal(cfg.TsunamiBlockHeight, uint64(29275561))
require.Equal(cfg.UpernavikBlockHeight, uint64(31174201))
require.Equal(cfg.VanuatuBlockHeight, uint64(33730921))
require.Equal(cfg.WakeBlockHeight, uint64(43730921))
}
2 changes: 2 additions & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,8 @@ func ValidateForkHeights(cfg Config) error {
return errors.Wrap(ErrInvalidCfg, "Tsunami is heigher than Upernavik")
case hu.UpernavikBlockHeight > hu.VanuatuBlockHeight:
return errors.Wrap(ErrInvalidCfg, "Upernavik is heigher than Vanuatu")
case hu.VanuatuBlockHeight > hu.WakeBlockHeight:
return errors.Wrap(ErrInvalidCfg, "Vanuatu is heigher than Wake")
}
return nil
}
Expand Down
5 changes: 5 additions & 0 deletions config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,9 @@ func TestValidateForkHeights(t *testing.T) {
{
"Upernavik", ErrInvalidCfg, "Upernavik is heigher than Vanuatu",
},
{
"Vanuatu", ErrInvalidCfg, "Vanuatu is heigher than Wake",
},
{
"", nil, "",
},
Expand Down Expand Up @@ -459,6 +462,8 @@ func newTestCfg(fork string) Config {
cfg.Genesis.TsunamiBlockHeight = cfg.Genesis.UpernavikBlockHeight + 1
case "Upernavik":
cfg.Genesis.UpernavikBlockHeight = cfg.Genesis.VanuatuBlockHeight + 1
case "Vanuatu":
cfg.Genesis.VanuatuBlockHeight = cfg.Genesis.WakeBlockHeight + 1
}
return cfg
}
Expand Down