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

[genesis] add Upernavik block height #4206

Merged
merged 1 commit into from
Mar 29, 2024
Merged
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
6 changes: 3 additions & 3 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@

#Specific owners
/consensus/ @CoderZhi @dustinxie @Liuhaai @envestcc
/ioctl/ @CoderZhi @dustinxie @Liuhaai
/api/ @CoderZhi @dustinxie @Liuhaai @millken
/config/ @CoderZhi @dustinxie @Liuhaai @envestcc
/ioctl/ @CoderZhi @dustinxie @Liuhaai @envestcc @millken
/api/ @CoderZhi @dustinxie @Liuhaai @millken @envestcc
/config/ @CoderZhi @dustinxie @Liuhaai @envestcc @millken
/p2p/ @CoderZhi @dustinxie @Liuhaai @envestcc
/action/ @CoderZhi @dustinxie @Liuhaai @envestcc
/blockchain/ @CoderZhi @dustinxie @Liuhaai
Expand Down
9 changes: 9 additions & 0 deletions blockchain/genesis/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ func defaultConfig() Genesis {
RedseaBlockHeight: 26704441,
SumatraBlockHeight: 28516681,
TsunamiBlockHeight: 29275561,
UpernavikBlockHeight: 39275561,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the hardfork height will be reset later, right?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right, we set to a very far date, before release, will change to the planned date

ToBeEnabledBlockHeight: math.MaxUint64,
},
Account: Account{
Expand Down Expand Up @@ -258,6 +259,9 @@ type (
// 2. generate transaction log for Suicide() call in EVM
// 3. raise block gas limit to 50M
TsunamiBlockHeight uint64 `yaml:"tsunamiHeight"`
// UpernavikBlockHeight is the start height to
// 1. enable Cancun EVM
UpernavikBlockHeight uint64 `yaml:"upernavikHeight"`
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is an island/strait in Greenland

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A tsunami sent us to Upernavik 😄

// 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 @@ -609,6 +613,11 @@ func (g *Blockchain) IsTsunami(height uint64) bool {
return g.isPost(g.TsunamiBlockHeight, height)
}

// IsUpernavik checks whether height is equal to or larger than upernavik height
func (g *Blockchain) IsUpernavik(height uint64) bool {
return g.isPost(g.UpernavikBlockHeight, 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 @@ -63,6 +63,8 @@ func TestNewHeightChange(t *testing.T) {
require.True(cfg.IsSumatra(uint64(28516681)))
require.False(cfg.IsTsunami(uint64(29275560)))
require.True(cfg.IsTsunami(uint64(29275561)))
require.False(cfg.IsUpernavik(uint64(39275560)))
require.True(cfg.IsUpernavik(uint64(39275561)))

require.Equal(cfg.PacificBlockHeight, uint64(432001))
require.Equal(cfg.AleutianBlockHeight, uint64(864001))
Expand All @@ -87,4 +89,5 @@ func TestNewHeightChange(t *testing.T) {
require.Equal(cfg.RedseaBlockHeight, uint64(26704441))
require.Equal(cfg.SumatraBlockHeight, uint64(28516681))
require.Equal(cfg.TsunamiBlockHeight, uint64(29275561))
require.Equal(cfg.UpernavikBlockHeight, uint64(39275561))
}
2 changes: 2 additions & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,8 @@ func ValidateForkHeights(cfg Config) error {
return errors.Wrap(ErrInvalidCfg, "Redsea is heigher than Sumatra")
case hu.SumatraBlockHeight > hu.TsunamiBlockHeight:
return errors.Wrap(ErrInvalidCfg, "Sumatra is heigher than Tsunami")
case hu.TsunamiBlockHeight > hu.UpernavikBlockHeight:
return errors.Wrap(ErrInvalidCfg, "Tsunami is heigher than Upernavik")
}
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 @@ -380,6 +380,9 @@ func TestValidateForkHeights(t *testing.T) {
{
"Sumatra", ErrInvalidCfg, "Sumatra is heigher than Tsunami",
},
{
"Tsunami", ErrInvalidCfg, "Tsunami is heigher than Upernavik",
},
{
"", nil, "",
},
Expand Down Expand Up @@ -440,6 +443,8 @@ func newTestCfg(fork string) Config {
cfg.Genesis.RedseaBlockHeight = cfg.Genesis.SumatraBlockHeight + 1
case "Sumatra":
cfg.Genesis.SumatraBlockHeight = cfg.Genesis.TsunamiBlockHeight + 1
case "Tsunami":
cfg.Genesis.TsunamiBlockHeight = cfg.Genesis.UpernavikBlockHeight + 1
}
return cfg
}
Expand Down
Loading