Skip to content

Commit 7d1b489

Browse files
authored
Merge pull request #83 from KiFoundation/dev/v5-t12
Dev/v5 t12
2 parents d362ebd + 1d7ed76 commit 7d1b489

File tree

10 files changed

+230
-246
lines changed

10 files changed

+230
-246
lines changed

.github/workflows/lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
- uses: golangci/golangci-lint-action@v2
1919
with:
2020
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
21-
version: v1.45
21+
version: v1.51.2
2222
args: --timeout 10m
2323
github-token: ${{ secrets.github_token }}
2424
if: "env.GIT_DIFF != ''"

Dockerfile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ ARG IMG_TAG=latest
22
ARG PLATFORM="linux/amd64"
33

44
# Compile the kid binary
5-
FROM --platform=${PLATFORM} golang:1.18.0-alpine3.15 AS kid-builder
5+
FROM --platform=${PLATFORM} golang:1.19-alpine3.16 AS kid-builder
66
WORKDIR /src/app/
77
COPY go.mod go.sum* ./
88
RUN go mod download
@@ -11,10 +11,10 @@ COPY . .
1111
# From https://github.com/CosmWasm/wasmd/blob/master/Dockerfile
1212
# For more details see https://github.com/CosmWasm/wasmvm#builds-of-libwasmvm
1313
ARG ARCH=x86_64
14-
ADD https://github.com/CosmWasm/wasmvm/releases/download/v1.0.0/libwasmvm_muslc.aarch64.a /lib/libwasmvm_muslc.aarch64.a
15-
ADD https://github.com/CosmWasm/wasmvm/releases/download/v1.0.0/libwasmvm_muslc.x86_64.a /lib/libwasmvm_muslc.x86_64.a
16-
RUN sha256sum /lib/libwasmvm_muslc.aarch64.a | grep 7d2239e9f25e96d0d4daba982ce92367aacf0cbd95d2facb8442268f2b1cc1fc
17-
RUN sha256sum /lib/libwasmvm_muslc.x86_64.a | grep f6282df732a13dec836cda1f399dd874b1e3163504dbd9607c6af915b2740479
14+
ADD https://github.com/CosmWasm/wasmvm/releases/download/v1.1.1/libwasmvm_muslc.aarch64.a /lib/libwasmvm_muslc.aarch64.a
15+
ADD https://github.com/CosmWasm/wasmvm/releases/download/v1.1.1/libwasmvm_muslc.x86_64.a /lib/libwasmvm_muslc.x86_64.a
16+
RUN sha256sum /lib/libwasmvm_muslc.aarch64.a | grep 9ecb037336bd56076573dc18c26631a9d2099a7f2b40dc04b6cae31ffb4c8f9a
17+
RUN sha256sum /lib/libwasmvm_muslc.x86_64.a | grep 6e4de7ba9bad4ae9679c7f9ecf7e283dd0160e71567c6a7be6ae47c81ebe7f32
1818
RUN cp /lib/libwasmvm_muslc.${ARCH}.a /lib/libwasmvm_muslc.a
1919

2020
ENV PACKAGES curl make git libc-dev bash gcc linux-headers eudev-dev python3

Makefile

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ TM_VERSION := $(shell go list -m github.com/tendermint/tendermint | sed 's:.* ::
2222
DOCKER := $(shell which docker)
2323
BUILDDIR ?= $(CURDIR)/build
2424

25+
GO_MINOR_VERSION = $(shell go version | cut -c 14- | cut -d' ' -f1 | cut -d'.' -f2)
26+
2527
export GO111MODULE = on
2628

2729
# process build tags
@@ -96,14 +98,19 @@ endif
9698
###############################################################################
9799
### Documentation ###
98100
###############################################################################
101+
check_version:
102+
ifneq ($(GO_MINOR_VERSION),19)
103+
@echo "ERROR: Go version 1.19 is required for this version of Ki-tools."
104+
exit 1
105+
endif
99106

100107
all: install lint test
101108

102109
BUILD_TARGETS := build install
103110

104111
build: BUILD_ARGS=-o $(BUILDDIR)/
105112

106-
$(BUILD_TARGETS): go.sum $(BUILDDIR)/
113+
$(BUILD_TARGETS): check_version go.sum $(BUILDDIR)/
107114
go $@ -mod=readonly $(BUILD_FLAGS) $(BUILD_ARGS) ./...
108115

109116
$(BUILDDIR)/:

app/app.go

Lines changed: 15 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,9 @@ import (
103103

104104
"github.com/CosmWasm/wasmd/x/wasm"
105105
wasmclient "github.com/CosmWasm/wasmd/x/wasm/client"
106+
wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types"
106107

107108
ica "github.com/cosmos/ibc-go/v3/modules/apps/27-interchain-accounts"
108-
icacontrollertypes "github.com/cosmos/ibc-go/v3/modules/apps/27-interchain-accounts/controller/types"
109109
icahost "github.com/cosmos/ibc-go/v3/modules/apps/27-interchain-accounts/host"
110110
icahostkeeper "github.com/cosmos/ibc-go/v3/modules/apps/27-interchain-accounts/host/keeper"
111111
icahosttypes "github.com/cosmos/ibc-go/v3/modules/apps/27-interchain-accounts/host/types"
@@ -207,7 +207,7 @@ var (
207207
// KitoolsApp extends an ABCI application, but with most of its parameters exported.
208208
// They are exported for convenience in creating helper functions, as object
209209
// capabilities aren't needed for testing.
210-
type KitoolsApp struct { // nolint: golint
210+
type KitoolsApp struct { //nolint: golint
211211
*baseapp.BaseApp
212212
legacyAmino *codec.LegacyAmino
213213
appCodec codec.Codec
@@ -697,47 +697,22 @@ func NewKitoolsApp(
697697
app.UpgradeKeeper.SetUpgradeHandler(
698698
upgradeName,
699699
func(ctx sdk.Context, _ upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) {
700+
ctx.Logger().Info("start to run module migrations...")
701+
702+
params := app.WasmKeeper.GetParams(ctx)
703+
704+
uploadAddresses := []string{"ki12u4jtcczpg2m3nt50muh3srte7zed77qsfyng4", "ki12qmzh8ewtp90qxtsrvrgl52qydauerhkl8f6u2"}
700705

701-
ctx.Logger().Info("Initialize ICA")
702-
fromVM[icatypes.ModuleName] = icaModule.ConsensusVersion()
703-
704-
// create ICS27 Controller submodule params
705-
controllerParams := icacontrollertypes.Params{}
706-
707-
// create ICS27 Host submodule params
708-
hostParams := icahosttypes.Params{
709-
HostEnabled: true,
710-
AllowMessages: []string{
711-
authzMsgExec,
712-
authzMsgGrant,
713-
authzMsgRevoke,
714-
bankMsgSend,
715-
bankMsgMultiSend,
716-
distrMsgSetWithdrawAddr,
717-
distrMsgWithdrawValidatorCommission,
718-
distrMsgFundCommunityPool,
719-
distrMsgWithdrawDelegatorReward,
720-
feegrantMsgGrantAllowance,
721-
feegrantMsgRevokeAllowance,
722-
govMsgVoteWeighted,
723-
govMsgSubmitProposal,
724-
govMsgDeposit,
725-
govMsgVote,
726-
stakingMsgEditValidator,
727-
stakingMsgDelegate,
728-
stakingMsgUndelegate,
729-
stakingMsgBeginRedelegate,
730-
stakingMsgCreateValidator,
731-
vestingMsgCreateVestingAccount,
732-
transferMsgTransfer,
733-
wasmMsgExecuteContract,
734-
},
706+
if address.Bech32MainPrefix == "tki" {
707+
uploadAddresses = []string{"tki1vexd57shjr2rax74ym5g8nqwq7ve04n5gz0kaj", "tki1mxag493xqx5rwqug950n0uer3kayjnw3ctxpxu"}
735708
}
736709

737-
// initialize ICS27 module
738-
icaModule.InitModule(ctx, controllerParams, hostParams)
710+
params.CodeUploadAccess = wasmtypes.AccessConfig{
711+
Permission: wasmtypes.AccessTypeAnyOfAddresses,
712+
Addresses: uploadAddresses,
713+
}
739714

740-
ctx.Logger().Info("start to run module migrations...")
715+
app.WasmKeeper.SetParams(ctx, params)
741716

742717
return app.mm.RunMigrations(ctx, app.configurator, fromVM)
743718
},
@@ -749,9 +724,7 @@ func NewKitoolsApp(
749724
}
750725

751726
if upgradeInfo.Name == upgradeName && !app.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height) {
752-
storeUpgrades := store.StoreUpgrades{
753-
Added: []string{icahosttypes.StoreKey},
754-
}
727+
storeUpgrades := store.StoreUpgrades{}
755728

756729
// configure store loader that checks if version == upgradeHeight and applies store upgrades
757730
app.SetStoreLoader(upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, &storeUpgrades))

app/const.go

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3,29 +3,5 @@ package kitools
33
/* #nosec */
44
const (
55
appName = "KitoolsApp"
6-
upgradeName = "v4"
7-
8-
authzMsgExec = "/cosmos.authz.v1beta1.MsgExec"
9-
authzMsgGrant = "/cosmos.authz.v1beta1.MsgGrant"
10-
authzMsgRevoke = "/cosmos.authz.v1beta1.MsgRevoke"
11-
bankMsgSend = "/cosmos.bank.v1beta1.MsgSend"
12-
bankMsgMultiSend = "/cosmos.bank.v1beta1.MsgMultiSend"
13-
distrMsgSetWithdrawAddr = "/cosmos.distribution.v1beta1.MsgSetWithdrawAddress"
14-
distrMsgWithdrawValidatorCommission = "/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission"
15-
distrMsgFundCommunityPool = "/cosmos.distribution.v1beta1.MsgFundCommunityPool"
16-
distrMsgWithdrawDelegatorReward = "/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward"
17-
feegrantMsgGrantAllowance = "/cosmos.feegrant.v1beta1.MsgGrantAllowance"
18-
feegrantMsgRevokeAllowance = "/cosmos.feegrant.v1beta1.MsgRevokeAllowance"
19-
govMsgVoteWeighted = "/cosmos.gov.v1beta1.MsgVoteWeighted"
20-
govMsgSubmitProposal = "/cosmos.gov.v1beta1.MsgSubmitProposal"
21-
govMsgDeposit = "/cosmos.gov.v1beta1.MsgDeposit"
22-
govMsgVote = "/cosmos.gov.v1beta1.MsgVote"
23-
stakingMsgEditValidator = "/cosmos.staking.v1beta1.MsgEditValidator"
24-
stakingMsgDelegate = "/cosmos.staking.v1beta1.MsgDelegate"
25-
stakingMsgUndelegate = "/cosmos.staking.v1beta1.MsgUndelegate"
26-
stakingMsgBeginRedelegate = "/cosmos.staking.v1beta1.MsgBeginRedelegate"
27-
stakingMsgCreateValidator = "/cosmos.staking.v1beta1.MsgCreateValidator"
28-
vestingMsgCreateVestingAccount = "/cosmos.vesting.v1beta1.MsgCreateVestingAccount"
29-
transferMsgTransfer = "/ibc.applications.transfer.v1.MsgTransfer"
30-
wasmMsgExecuteContract = "/cosmwasm.wasm.v1.MsgExecuteContract"
6+
upgradeName = "v5"
317
)

app/export.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ func (app *KitoolsApp) ExportAppStateAndValidators(
4646

4747
// prepare for fresh start at zero height
4848
// NOTE zero height genesis is a temporary feature which will be deprecated
49-
// in favour of export at a block height
49+
//
50+
// in favour of export at a block height
5051
func (app *KitoolsApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []string) {
5152
applyAllowedAddrs := false
5253

app/sim_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@ func interBlockCacheOpt() func(*baseapp.BaseApp) {
7676
return baseapp.SetInterBlockCache(store.NewCommitKVStoreCacheManager())
7777
}
7878

79-
//// TODO: Make another test for the fuzzer itself, which just has noOp txs
80-
//// and doesn't depend on the application.
79+
// // TODO: Make another test for the fuzzer itself, which just has noOp txs
80+
// // and doesn't depend on the application.
8181
func TestAppStateDeterminism(t *testing.T) {
8282
if !simapp.FlagEnabledValue {
8383
t.Skip("skipping application simulation")

cmd/kid/cmd/root.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,8 @@ func (ac appCreator) newApp(
247247
baseapp.SetSnapshotStore(snapshotStore),
248248
baseapp.SetSnapshotInterval(cast.ToUint64(appOpts.Get(server.FlagStateSyncSnapshotInterval))),
249249
baseapp.SetSnapshotKeepRecent(cast.ToUint32(appOpts.Get(server.FlagStateSyncSnapshotKeepRecent))),
250+
baseapp.SetIAVLCacheSize(cast.ToInt(appOpts.Get(server.FlagIAVLCacheSize))),
251+
baseapp.SetIAVLDisableFastNode(cast.ToBool(appOpts.Get(server.FlagDisableIAVLFastNode))),
250252
)
251253
}
252254

0 commit comments

Comments
 (0)