From 6bc666c1c02801b7f23845a14e45041c061fd0eb Mon Sep 17 00:00:00 2001 From: Gjermund Garaba Date: Wed, 8 Jan 2025 00:12:26 +0100 Subject: [PATCH 1/4] fix: dockerfile layer name --- modules/light-clients/08-wasm/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/light-clients/08-wasm/Dockerfile b/modules/light-clients/08-wasm/Dockerfile index 2877f026ef3..73e8c10034f 100644 --- a/modules/light-clients/08-wasm/Dockerfile +++ b/modules/light-clients/08-wasm/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.23.4-alpine as builder +FROM golang:1.23.4-alpine as builder-base ARG LIBWASM_VERSION ARG TARGETARCH From 3b0a74eb901c0ebeaa216be60f47b5d0fca37e74 Mon Sep 17 00:00:00 2001 From: Gjermund Garaba Date: Wed, 8 Jan 2025 23:23:36 +0100 Subject: [PATCH 2/4] update wasm simapp image with higher max gas --- modules/light-clients/08-wasm/Dockerfile | 6 +++--- .../light-clients/08-wasm/testing/simapp/app.go | 12 ++++++++++++ .../08-wasm/testing/simapp/simd/cmd/root.go | 14 +++++++++++++- 3 files changed, 28 insertions(+), 4 deletions(-) diff --git a/modules/light-clients/08-wasm/Dockerfile b/modules/light-clients/08-wasm/Dockerfile index 73e8c10034f..4c6055eb20c 100644 --- a/modules/light-clients/08-wasm/Dockerfile +++ b/modules/light-clients/08-wasm/Dockerfile @@ -23,12 +23,12 @@ RUN go mod download # Since it is not easy to fully cache a RUN script download of libwasmvm, we use two different stages # and copy the correct file in the final stage. The multistage setup also helps speed up the build process -FROM alpine:3.18 AS amd64-stage +FROM alpine:3.21 AS amd64-stage ARG LIBWASM_VERSION ADD https://github.com/CosmWasm/wasmvm/releases/download/${LIBWASM_VERSION}/libwasmvm_muslc.x86_64.a /lib/libwasmvm_muslc.x86_64.a -FROM alpine:3.18 AS arm64-stage +FROM alpine:3.21 AS arm64-stage ARG LIBWASM_VERSION ADD https://github.com/CosmWasm/wasmvm/releases/download/${LIBWASM_VERSION}/libwasmvm_muslc.aarch64.a /lib/libwasmvm_muslc.aarch64.a @@ -44,6 +44,6 @@ COPY --from=libwasm-stage /lib/libwasmvm_muslc.* /lib/ RUN go build -mod=readonly -tags "netgo ledger muslc" -ldflags '-X github.com/cosmos/cosmos-sdk/version.Name=sim -X github.com/cosmos/cosmos-sdk/version.AppName=simd -X github.com/cosmos/cosmos-sdk/version.Version= -X github.com/cosmos/cosmos-sdk/version.Commit= -X "github.com/cosmos/cosmos-sdk/version.BuildTags=netgo ledger muslc," -w -s -linkmode=external -extldflags "-Wl,-z,muldefs -static"' -trimpath -o /go/build/ ./... -FROM alpine:3.18 +FROM alpine:3.21 COPY --from=builder /go/build/simd /bin/simd ENTRYPOINT ["simd"] diff --git a/modules/light-clients/08-wasm/testing/simapp/app.go b/modules/light-clients/08-wasm/testing/simapp/app.go index f8d27ad0ce9..9aa6827a833 100644 --- a/modules/light-clients/08-wasm/testing/simapp/app.go +++ b/modules/light-clients/08-wasm/testing/simapp/app.go @@ -110,6 +110,7 @@ import ( cmtproto "github.com/cometbft/cometbft/api/cometbft/types/v1" cmtcrypto "github.com/cometbft/cometbft/crypto" cmted25519 "github.com/cometbft/cometbft/crypto/ed25519" + cmttypes "github.com/cometbft/cometbft/types" wasm "github.com/cosmos/ibc-go/modules/light-clients/08-wasm" wasmkeeper "github.com/cosmos/ibc-go/modules/light-clients/08-wasm/keeper" @@ -977,6 +978,17 @@ func (app *SimApp) InitChainer(ctx sdk.Context, req *abci.InitChainRequest) (*ab if err := app.UpgradeKeeper.SetModuleVersionMap(ctx, app.ModuleManager.GetVersionMap()); err != nil { panic(err) } + + paramsProto, err := app.ConsensusParamsKeeper.ParamsStore.Get(ctx) + if err != nil { + return nil, err + } + params := cmttypes.ConsensusParamsFromProto(paramsProto) + params.Block.MaxGas = 100_000_000 + if err := app.ConsensusParamsKeeper.ParamsStore.Set(ctx, params.ToProto()); err != nil { + return nil, err + } + return app.ModuleManager.InitGenesis(ctx, genesisState) } diff --git a/modules/light-clients/08-wasm/testing/simapp/simd/cmd/root.go b/modules/light-clients/08-wasm/testing/simapp/simd/cmd/root.go index ba5303918c0..05f070929ed 100644 --- a/modules/light-clients/08-wasm/testing/simapp/simd/cmd/root.go +++ b/modules/light-clients/08-wasm/testing/simapp/simd/cmd/root.go @@ -16,6 +16,7 @@ import ( corestore "cosmossdk.io/core/store" "cosmossdk.io/log" confixcmd "cosmossdk.io/tools/confix/cmd" + txsigning "cosmossdk.io/x/tx/signing" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/config" @@ -27,6 +28,7 @@ import ( "github.com/cosmos/cosmos-sdk/client/rpc" "github.com/cosmos/cosmos-sdk/client/snapshot" "github.com/cosmos/cosmos-sdk/codec" + addresscodec "github.com/cosmos/cosmos-sdk/codec/address" "github.com/cosmos/cosmos-sdk/server" serverconfig "github.com/cosmos/cosmos-sdk/server/config" servertypes "github.com/cosmos/cosmos-sdk/server/types" @@ -64,11 +66,17 @@ func NewRootCmd() *cobra.Command { initClientCtx := client.Context{}. WithCodec(encodingConfig.Codec). WithInterfaceRegistry(encodingConfig.InterfaceRegistry). + WithTxConfig(encodingConfig.TxConfig). WithLegacyAmino(encodingConfig.Amino). WithInput(os.Stdin). WithAccountRetriever(types.AccountRetriever{}). + WithAddressCodec(addresscodec.NewBech32Codec(sdk.GetConfig().GetBech32AccountAddrPrefix())). + WithValidatorAddressCodec(addresscodec.NewBech32Codec(sdk.GetConfig().GetBech32ValidatorAddrPrefix())). + WithConsensusAddressCodec(addresscodec.NewBech32Codec(sdk.GetConfig().GetBech32ConsensusAddrPrefix())). WithHomeDir(simapp.DefaultNodeHome). - WithViper("") // In simapp, we don't use any prefix for env variables. + WithViper(""). // uses by default the binary name as prefix + WithAddressPrefix(sdk.GetConfig().GetBech32AccountAddrPrefix()). + WithValidatorPrefix(sdk.GetConfig().GetBech32ValidatorAddrPrefix()) rootCmd := &cobra.Command{ Use: "simd", @@ -96,6 +104,10 @@ func NewRootCmd() *cobra.Command { txConfigOpts := tx.ConfigOptions{ EnabledSignModes: enabledSignModes, TextualCoinMetadataQueryFn: txmodule.NewGRPCCoinMetadataQueryFn(initClientCtx), + SigningOptions: &txsigning.Options{ + AddressCodec: initClientCtx.InterfaceRegistry.SigningContext().AddressCodec(), + ValidatorAddressCodec: initClientCtx.InterfaceRegistry.SigningContext().ValidatorAddressCodec(), + }, } txConfigWithTextual, err := tx.NewTxConfigWithOptions( codec.NewProtoCodec(encodingConfig.InterfaceRegistry), From 6c039106d1ad93ba71204ed7007afe0abb7012f5 Mon Sep 17 00:00:00 2001 From: Gjermund Garaba Date: Thu, 9 Jan 2025 02:03:26 +0100 Subject: [PATCH 3/4] lint --- modules/light-clients/08-wasm/testing/simapp/app.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/light-clients/08-wasm/testing/simapp/app.go b/modules/light-clients/08-wasm/testing/simapp/app.go index 9aa6827a833..e8ca476a9c2 100644 --- a/modules/light-clients/08-wasm/testing/simapp/app.go +++ b/modules/light-clients/08-wasm/testing/simapp/app.go @@ -983,9 +983,9 @@ func (app *SimApp) InitChainer(ctx sdk.Context, req *abci.InitChainRequest) (*ab if err != nil { return nil, err } - params := cmttypes.ConsensusParamsFromProto(paramsProto) - params.Block.MaxGas = 100_000_000 - if err := app.ConsensusParamsKeeper.ParamsStore.Set(ctx, params.ToProto()); err != nil { + consensusParams := cmttypes.ConsensusParamsFromProto(paramsProto) + consensusParams.Block.MaxGas = 100_000_000 + if err := app.ConsensusParamsKeeper.ParamsStore.Set(ctx, consensusParams.ToProto()); err != nil { return nil, err } From dfe5fec4cc2bcaaf5923a8e3bac89ac063346a57 Mon Sep 17 00:00:00 2001 From: Gjermund Garaba Date: Fri, 10 Jan 2025 14:34:32 +0100 Subject: [PATCH 4/4] updated max gas to same as cosmos hub --- modules/light-clients/08-wasm/testing/simapp/app.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/light-clients/08-wasm/testing/simapp/app.go b/modules/light-clients/08-wasm/testing/simapp/app.go index e8ca476a9c2..6b025bea332 100644 --- a/modules/light-clients/08-wasm/testing/simapp/app.go +++ b/modules/light-clients/08-wasm/testing/simapp/app.go @@ -984,7 +984,7 @@ func (app *SimApp) InitChainer(ctx sdk.Context, req *abci.InitChainRequest) (*ab return nil, err } consensusParams := cmttypes.ConsensusParamsFromProto(paramsProto) - consensusParams.Block.MaxGas = 100_000_000 + consensusParams.Block.MaxGas = 75_000_000 // The same as Cosmos Hub at the moment if err := app.ConsensusParamsKeeper.ParamsStore.Set(ctx, consensusParams.ToProto()); err != nil { return nil, err }