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

add venus7 for wasm upgrade #210

Merged
merged 4 commits into from
Aug 28, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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: 5 additions & 4 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -721,8 +721,7 @@ func NewOKBChainApp(
}
app.InitUpgrade(ctx)
app.WasmKeeper.UpdateGasRegister(ctx)
// TODO
// app.WasmKeeper.UpdateCurBlockNum(ctx)
app.WasmKeeper.UpdateCurBlockNum(ctx)
}

app.ScopedIBCKeeper = scopedIBCKeeper
Expand All @@ -745,8 +744,10 @@ func (app *OKBChainApp) InitUpgrade(ctx sdk.Context) {
})
app.ParamsKeeper.ClaimReadyForUpgrade(tmtypes.MILESTONE_MERCURY, func(info paramstypes.UpgradeInfo) {
tmtypes.InitMilestoneMercuryHeight(int64(info.EffectiveHeight))
// TODO
// app.WasmKeeper.UpdateMilestone(ctx, "wasm_v1", info.EffectiveHeight)
})
app.ParamsKeeper.ClaimReadyForUpgrade(tmtypes.MILESTONE_VENUS7_NAME, func(info paramstypes.UpgradeInfo) {
tmtypes.InitMilestoneVenus7Height(int64(info.EffectiveHeight))
app.WasmKeeper.UpdateMilestone(ctx, "wasm_v1", info.EffectiveHeight)
})
if err := app.ParamsKeeper.ApplyEffectiveUpgrade(ctx); err != nil {
tmos.Exit(fmt.Sprintf("failed apply effective upgrade height info: %s", err))
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ require (
)

replace (
github.com/CosmWasm/wasmvm => github.com/okx/wasmvm v1.3.3-0.20230802074406-d0ce412e3e0c
github.com/CosmWasm/wasmvm => github.com/okx/wasmvm v1.3.3-0.20230822083506-a7f577e8b87d
github.com/buger/jsonparser => github.com/buger/jsonparser v1.0.0 // imported by nacos-go-sdk, upgraded to v1.0.0 in case of a known vulnerable bug
github.com/confio/ics23/go => github.com/cosmos/cosmos-sdk/ics23/go v0.8.0
github.com/cosmos/gorocksdb => github.com/okx/grocksdb v1.6.45-okc2
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -615,8 +615,8 @@ github.com/okx/go-ethereum v1.10.26-0.20230605041300-9db59c1d91e6 h1:pXsdHnWHejH
github.com/okx/go-ethereum v1.10.26-0.20230605041300-9db59c1d91e6/go.mod h1:f9/CleoGkiU7NWF9tdpWGfEYmFbN7zUi17jGick31KM=
github.com/okx/grocksdb v1.6.45-okc2 h1:Dbmax+uY71YuGTkJftpF55dbGW7hfIVOfNz2mnFqXl0=
github.com/okx/grocksdb v1.6.45-okc2/go.mod h1:+/BHUY+mT0tbaVXwO2wTtD9eytazyw1W5n2O7AGyXZA=
github.com/okx/wasmvm v1.3.3-0.20230802074406-d0ce412e3e0c h1:P/iVsWWUAH0gDn3liTum9DzggVUpHs+dCasturoJU/0=
github.com/okx/wasmvm v1.3.3-0.20230802074406-d0ce412e3e0c/go.mod h1:vW/E3h8j9xBQs9bCoijDuawKo9kCtxOaS8N8J7KFtkc=
github.com/okx/wasmvm v1.3.3-0.20230822083506-a7f577e8b87d h1:7Bc5R2e6/45gOBhko9fbOKXOp8h8cVmvwORpwO9Bw/o=
github.com/okx/wasmvm v1.3.3-0.20230822083506-a7f577e8b87d/go.mod h1:vW/E3h8j9xBQs9bCoijDuawKo9kCtxOaS8N8J7KFtkc=
github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec=
github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY=
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
Expand Down
23 changes: 23 additions & 0 deletions libs/tendermint/types/milestone.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ var (
milestoneEarthHeight int64
milestoneVenus4Height int64
milestoneMercuryHeight int64
milestoneVenus7Height int64

// note: it stores the earlies height of the node,and it is used by cli
nodePruneHeight int64
Expand All @@ -26,6 +27,8 @@ const (
MILESTONE_EARTH = "earth"
MILESTONE_Venus4 = "venus4"
MILESTONE_MERCURY = "mercury"

MILESTONE_VENUS7_NAME = "venus7"
)

func SetupMainNetEnvironment(pruneH int64) {
Expand Down Expand Up @@ -139,3 +142,23 @@ func InitMilestoneMercuryHeight(h int64) {

// =========== Mercury ===============
// ==================================

// ==================================
// =========== Venus7 ===============
func HigherThanVenus7(h int64) bool {
if milestoneVenus7Height == 0 {
return false
}
return h > milestoneVenus7Height
}

func InitMilestoneVenus7Height(h int64) {
milestoneVenus7Height = h
}

func GetVenus7Height() int64 {
return milestoneVenus7Height
}

// =========== Venus7 ===============
// ==================================
3 changes: 1 addition & 2 deletions x/wasm/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,7 @@ func (am AppModule) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) {
keeper.GetWasmParamsCache().SetNeedBlockedUpdate()
}
am.keeper.UpdateGasRegister(ctx)
// TODO
// am.keeper.UpdateCurBlockNum(ctx)
am.keeper.UpdateCurBlockNum(ctx)
}

// EndBlock returns the end blocker for the wasm module. It returns no validator
Expand Down