From 46485b1805e31983071741dcdd9b54e6c932d56d Mon Sep 17 00:00:00 2001 From: lyh169 Date: Tue, 22 Aug 2023 14:07:13 +0800 Subject: [PATCH 1/4] add venus7 for wasm upgrade --- app/app.go | 9 +++++---- go.mod | 2 +- go.sum | 4 ++-- libs/tendermint/types/milestone.go | 23 +++++++++++++++++++++++ x/wasm/module.go | 3 +-- 5 files changed, 32 insertions(+), 9 deletions(-) diff --git a/app/app.go b/app/app.go index 2b5a5d20dd..bc94fb6d98 100644 --- a/app/app.go +++ b/app/app.go @@ -782,8 +782,7 @@ func NewOKExChainApp( } app.InitUpgrade(ctx) app.WasmKeeper.UpdateGasRegister(ctx) - // TODO - // app.WasmKeeper.UpdateCurBlockNum(ctx) + app.WasmKeeper.UpdateCurBlockNum(ctx) } app.ScopedIBCKeeper = scopedIBCKeeper @@ -805,8 +804,10 @@ func (app *OKExChainApp) InitUpgrade(ctx sdk.Context) { tmtypes.InitMilestoneVenus6Height(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)) diff --git a/go.mod b/go.mod index 1c66af0752..d25d0ae341 100644 --- a/go.mod +++ b/go.mod @@ -176,7 +176,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.20230821101451-392756e63da4 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/okex/grocksdb v1.6.45-okc2 diff --git a/go.sum b/go.sum index 30f72e6e98..1fa5e6bc35 100644 --- a/go.sum +++ b/go.sum @@ -605,8 +605,8 @@ github.com/okex/go-ethereum v1.10.8-okc2/go.mod h1:pJNuIUYfX5+JKzSD/BTdNsvJSZ1TJ github.com/okex/grocksdb v1.6.45-okc2 h1:JuUg2NcAFHZn78+xANcEKn9bcuF0tX8Jx3iMFfPnAEQ= github.com/okex/grocksdb v1.6.45-okc2/go.mod h1:+/BHUY+mT0tbaVXwO2wTtD9eytazyw1W5n2O7AGyXZA= github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= -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.20230821101451-392756e63da4 h1:MTLioIDyuMP0r1Xe1CSnYbR1qHwD41oBrwJ3TpxLJXM= +github.com/okx/wasmvm v1.3.3-0.20230821101451-392756e63da4/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= diff --git a/libs/tendermint/types/milestone.go b/libs/tendermint/types/milestone.go index 85e7f78195..9daabf89e5 100644 --- a/libs/tendermint/types/milestone.go +++ b/libs/tendermint/types/milestone.go @@ -45,6 +45,9 @@ var ( MILESTONE_VENUS6_NAME = "venus6" milestoneVenus6Height int64 = 0 + MILESTONE_VENUS7_NAME = "venus7" + milestoneVenus7Height int64 = 0 + // note: it stores the earlies height of the node,and it is used by cli nodePruneHeight int64 @@ -331,3 +334,23 @@ func GetVenus6Height() int64 { // =========== Venus6 =============== // ================================== + +// ================================== +// =========== 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 =============== +// ================================== diff --git a/x/wasm/module.go b/x/wasm/module.go index 52a5bb6429..098ea8ca33 100644 --- a/x/wasm/module.go +++ b/x/wasm/module.go @@ -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 From 994ef56da8d657f81eb28c99543fe76b6bdd64e9 Mon Sep 17 00:00:00 2001 From: lyh169 Date: Tue, 22 Aug 2023 17:04:49 +0800 Subject: [PATCH 2/4] upgrade go mod --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index d25d0ae341..0ff316eb51 100644 --- a/go.mod +++ b/go.mod @@ -176,7 +176,7 @@ require ( ) replace ( - github.com/CosmWasm/wasmvm => github.com/okx/wasmvm v1.3.3-0.20230821101451-392756e63da4 + 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/okex/grocksdb v1.6.45-okc2 diff --git a/go.sum b/go.sum index 1fa5e6bc35..2152315619 100644 --- a/go.sum +++ b/go.sum @@ -605,8 +605,8 @@ github.com/okex/go-ethereum v1.10.8-okc2/go.mod h1:pJNuIUYfX5+JKzSD/BTdNsvJSZ1TJ github.com/okex/grocksdb v1.6.45-okc2 h1:JuUg2NcAFHZn78+xANcEKn9bcuF0tX8Jx3iMFfPnAEQ= github.com/okex/grocksdb v1.6.45-okc2/go.mod h1:+/BHUY+mT0tbaVXwO2wTtD9eytazyw1W5n2O7AGyXZA= github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= -github.com/okx/wasmvm v1.3.3-0.20230821101451-392756e63da4 h1:MTLioIDyuMP0r1Xe1CSnYbR1qHwD41oBrwJ3TpxLJXM= -github.com/okx/wasmvm v1.3.3-0.20230821101451-392756e63da4/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= From bfb9a805dafa7b2b49dbb09819615338b1472b95 Mon Sep 17 00:00:00 2001 From: lyh169 Date: Thu, 24 Aug 2023 19:02:17 +0800 Subject: [PATCH 3/4] upgrade go mod --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 0ff316eb51..d432a968d3 100644 --- a/go.mod +++ b/go.mod @@ -176,7 +176,7 @@ require ( ) replace ( - github.com/CosmWasm/wasmvm => github.com/okx/wasmvm v1.3.3-0.20230822083506-a7f577e8b87d + github.com/CosmWasm/wasmvm => github.com/okx/wasmvm v1.3.0-1 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/okex/grocksdb v1.6.45-okc2 diff --git a/go.sum b/go.sum index 2152315619..670c7350ef 100644 --- a/go.sum +++ b/go.sum @@ -605,8 +605,8 @@ github.com/okex/go-ethereum v1.10.8-okc2/go.mod h1:pJNuIUYfX5+JKzSD/BTdNsvJSZ1TJ github.com/okex/grocksdb v1.6.45-okc2 h1:JuUg2NcAFHZn78+xANcEKn9bcuF0tX8Jx3iMFfPnAEQ= github.com/okex/grocksdb v1.6.45-okc2/go.mod h1:+/BHUY+mT0tbaVXwO2wTtD9eytazyw1W5n2O7AGyXZA= github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= -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/okx/wasmvm v1.3.0-1 h1:ZWSgG3niahvxR+2ORkJK9qr+r0PU0nPfLTrwVzrLpgo= +github.com/okx/wasmvm v1.3.0-1/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= From afd319680b89d3e5d4dd5584002ed679cee13a9b Mon Sep 17 00:00:00 2001 From: lyh169 Date: Fri, 25 Aug 2023 17:49:42 +0800 Subject: [PATCH 4/4] upgrade go mod wasmvm version --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index d432a968d3..a6636da38b 100644 --- a/go.mod +++ b/go.mod @@ -176,7 +176,7 @@ require ( ) replace ( - github.com/CosmWasm/wasmvm => github.com/okx/wasmvm v1.3.0-1 + github.com/CosmWasm/wasmvm => github.com/okx/wasmvm v1.3.5 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/okex/grocksdb v1.6.45-okc2 diff --git a/go.sum b/go.sum index 670c7350ef..ea40f8af02 100644 --- a/go.sum +++ b/go.sum @@ -605,8 +605,8 @@ github.com/okex/go-ethereum v1.10.8-okc2/go.mod h1:pJNuIUYfX5+JKzSD/BTdNsvJSZ1TJ github.com/okex/grocksdb v1.6.45-okc2 h1:JuUg2NcAFHZn78+xANcEKn9bcuF0tX8Jx3iMFfPnAEQ= github.com/okex/grocksdb v1.6.45-okc2/go.mod h1:+/BHUY+mT0tbaVXwO2wTtD9eytazyw1W5n2O7AGyXZA= github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= -github.com/okx/wasmvm v1.3.0-1 h1:ZWSgG3niahvxR+2ORkJK9qr+r0PU0nPfLTrwVzrLpgo= -github.com/okx/wasmvm v1.3.0-1/go.mod h1:vW/E3h8j9xBQs9bCoijDuawKo9kCtxOaS8N8J7KFtkc= +github.com/okx/wasmvm v1.3.5 h1:2eCD8Niy4Bdwssj3ztE5dZy+mz27dZJB5XdG+oaT4lU= +github.com/okx/wasmvm v1.3.5/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=