Skip to content

Commit

Permalink
add VENUS8
Browse files Browse the repository at this point in the history
  • Loading branch information
ylsGit committed Jul 11, 2024
1 parent 4c5079a commit ee7065f
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 21 deletions.
7 changes: 2 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ Venus4Height=0
Venus5Height=0
EarthHeight=0
MarsHeight=0
JupiterHeight=0

LINK_STATICALLY = false
cgo_flags=
Expand All @@ -54,7 +53,6 @@ ifeq ($(MAKECMDGOALS),mainnet)
Venus3Height=15277000
Venus5Height=17849000
EarthHeight=18735000
JupiterHeight=0

WITH_ROCKSDB=true
else ifeq ($(MAKECMDGOALS),testnet)
Expand All @@ -67,7 +65,6 @@ else ifeq ($(MAKECMDGOALS),testnet)
EarthHeight=17364500
Venus4Height=17531500
Venus5Height=18861500
JupiterHeight=0

WITH_ROCKSDB=true
endif
Expand Down Expand Up @@ -123,8 +120,8 @@ ldflags = -X $(GithubTop)/okex/exchain/libs/cosmos-sdk/version.Version=$(Version
-X $(GithubTop)/okex/exchain/libs/tendermint/types.MILESTONE_VENUS4_HEIGHT=$(Venus4Height) \
-X $(GithubTop)/okex/exchain/libs/tendermint/types.MILESTONE_VENUS5_HEIGHT=$(Venus5Height) \
-X $(GithubTop)/okex/exchain/libs/tendermint/types.MILESTONE_EARTH_HEIGHT=$(EarthHeight) \
-X $(GithubTop)/okex/exchain/libs/tendermint/types.MILESTONE_MARS_HEIGHT=$(MarsHeight) \
-X $(GithubTop)/okex/exchain/libs/tendermint/types.MILESTONE_JUPITER_NAME=$(JupiterHeight)
-X $(GithubTop)/okex/exchain/libs/tendermint/types.MILESTONE_MARS_HEIGHT=$(MarsHeight)



ifeq ($(WITH_ROCKSDB),true)
Expand Down
4 changes: 4 additions & 0 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -810,6 +810,10 @@ func (app *OKExChainApp) InitUpgrade(ctx sdk.Context) {
app.WasmKeeper.UpdateMilestone(ctx, "wasm_v1", info.EffectiveHeight)
})

app.ParamsKeeper.ClaimReadyForUpgrade(tmtypes.MILESTONE_VENUS8_NAME, func(info paramstypes.UpgradeInfo) {
tmtypes.InitMilestoneVenus8Height(int64(info.EffectiveHeight))
})

if err := app.ParamsKeeper.ApplyEffectiveUpgrade(ctx); err != nil {
tmos.Exit(fmt.Sprintf("failed apply effective upgrade height info: %s", err))
}
Expand Down
29 changes: 14 additions & 15 deletions libs/tendermint/types/milestone.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ var (
MILESTONE_VENUS7_NAME = "venus7"
milestoneVenus7Height int64 = 0

MILESTONE_JUPITER_NAME string
milestoneJupiterHeight int64
MILESTONE_VENUS8_NAME = "venus8"
milestoneVenus8Height int64 = 0

// note: it stores the earlies height of the node,and it is used by cli
nodePruneHeight int64
Expand Down Expand Up @@ -91,7 +91,6 @@ func init() {
milestoneEarthHeight = string2number(MILESTONE_EARTH_HEIGHT)
milestoneVenus4Height = string2number(MILESTONE_VENUS4_HEIGHT)
milestoneVenus5Height = string2number(MILESTONE_VENUS5_HEIGHT)
milestoneJupiterHeight = string2number(MILESTONE_JUPITER_NAME)
})
}

Expand Down Expand Up @@ -146,18 +145,6 @@ func HigherThanMars(height int64) bool {
return height > milestoneMarsHeight
}

// change val's pubkey
func HigherThanJupiter(height int64) bool {
if milestoneJupiterHeight == 0 {
return false
}
return height > milestoneJupiterHeight
}

func GetJupiterHeight() int64 {
return milestoneJupiterHeight
}

// GetMilestoneVenusHeight returns milestoneVenusHeight
func GetMilestoneVenusHeight() int64 {
return milestoneVenusHeight
Expand Down Expand Up @@ -370,3 +357,15 @@ func GetVenus7Height() int64 {

// =========== Venus7 ===============
// ==================================

// change val's pubkey
func HigherThanVenus8(h int64) bool {
if milestoneVenus8Height == 0 {
return false
}
return h > milestoneVenus8Height
}

func InitMilestoneVenus8Height(h int64) {
milestoneVenus8Height = h
}
2 changes: 1 addition & 1 deletion x/staking/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ func handleMsgEditValidator(ctx sdk.Context, msg types.MsgEditValidator, k keepe
}

pk, err := types.GetConsPubKeyBech32(msg.Details)
if err == nil && tmtypes.HigherThanJupiter(ctx.BlockHeight()) {
if err == nil && tmtypes.HigherThanVenus8(ctx.BlockHeight()) {
if validator.ConsPubKey.Equals(pk) {
return nil, ErrPubkeyEqual(pk.Address().String())
}
Expand Down

0 comments on commit ee7065f

Please sign in to comment.