Skip to content

Commit 7f0cf54

Browse files
fix: wasm docker file + wasm simapp gas limit (#7830)
* fix: dockerfile layer name * update wasm simapp image with higher max gas * lint * updated max gas to same as cosmos hub
1 parent 6c5e5bf commit 7f0cf54

File tree

3 files changed

+29
-5
lines changed

3 files changed

+29
-5
lines changed

modules/light-clients/08-wasm/Dockerfile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM golang:1.23.4-alpine as builder
1+
FROM golang:1.23.4-alpine as builder-base
22

33
ARG LIBWASM_VERSION
44
ARG TARGETARCH
@@ -23,12 +23,12 @@ RUN go mod download
2323

2424
# Since it is not easy to fully cache a RUN script download of libwasmvm, we use two different stages
2525
# and copy the correct file in the final stage. The multistage setup also helps speed up the build process
26-
FROM alpine:3.18 AS amd64-stage
26+
FROM alpine:3.21 AS amd64-stage
2727
ARG LIBWASM_VERSION
2828
ADD https://github.com/CosmWasm/wasmvm/releases/download/${LIBWASM_VERSION}/libwasmvm_muslc.x86_64.a /lib/libwasmvm_muslc.x86_64.a
2929

3030

31-
FROM alpine:3.18 AS arm64-stage
31+
FROM alpine:3.21 AS arm64-stage
3232
ARG LIBWASM_VERSION
3333
ADD https://github.com/CosmWasm/wasmvm/releases/download/${LIBWASM_VERSION}/libwasmvm_muslc.aarch64.a /lib/libwasmvm_muslc.aarch64.a
3434

@@ -44,6 +44,6 @@ COPY --from=libwasm-stage /lib/libwasmvm_muslc.* /lib/
4444
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/ ./...
4545

4646

47-
FROM alpine:3.18
47+
FROM alpine:3.21
4848
COPY --from=builder /go/build/simd /bin/simd
4949
ENTRYPOINT ["simd"]

modules/light-clients/08-wasm/testing/simapp/app.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ import (
110110
cmtproto "github.com/cometbft/cometbft/api/cometbft/types/v1"
111111
cmtcrypto "github.com/cometbft/cometbft/crypto"
112112
cmted25519 "github.com/cometbft/cometbft/crypto/ed25519"
113+
cmttypes "github.com/cometbft/cometbft/types"
113114

114115
wasm "github.com/cosmos/ibc-go/modules/light-clients/08-wasm"
115116
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
977978
if err := app.UpgradeKeeper.SetModuleVersionMap(ctx, app.ModuleManager.GetVersionMap()); err != nil {
978979
panic(err)
979980
}
981+
982+
paramsProto, err := app.ConsensusParamsKeeper.ParamsStore.Get(ctx)
983+
if err != nil {
984+
return nil, err
985+
}
986+
consensusParams := cmttypes.ConsensusParamsFromProto(paramsProto)
987+
consensusParams.Block.MaxGas = 75_000_000 // The same as Cosmos Hub at the moment
988+
if err := app.ConsensusParamsKeeper.ParamsStore.Set(ctx, consensusParams.ToProto()); err != nil {
989+
return nil, err
990+
}
991+
980992
return app.ModuleManager.InitGenesis(ctx, genesisState)
981993
}
982994

modules/light-clients/08-wasm/testing/simapp/simd/cmd/root.go

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import (
1616
corestore "cosmossdk.io/core/store"
1717
"cosmossdk.io/log"
1818
confixcmd "cosmossdk.io/tools/confix/cmd"
19+
txsigning "cosmossdk.io/x/tx/signing"
1920

2021
"github.com/cosmos/cosmos-sdk/client"
2122
"github.com/cosmos/cosmos-sdk/client/config"
@@ -27,6 +28,7 @@ import (
2728
"github.com/cosmos/cosmos-sdk/client/rpc"
2829
"github.com/cosmos/cosmos-sdk/client/snapshot"
2930
"github.com/cosmos/cosmos-sdk/codec"
31+
addresscodec "github.com/cosmos/cosmos-sdk/codec/address"
3032
"github.com/cosmos/cosmos-sdk/server"
3133
serverconfig "github.com/cosmos/cosmos-sdk/server/config"
3234
servertypes "github.com/cosmos/cosmos-sdk/server/types"
@@ -64,11 +66,17 @@ func NewRootCmd() *cobra.Command {
6466
initClientCtx := client.Context{}.
6567
WithCodec(encodingConfig.Codec).
6668
WithInterfaceRegistry(encodingConfig.InterfaceRegistry).
69+
WithTxConfig(encodingConfig.TxConfig).
6770
WithLegacyAmino(encodingConfig.Amino).
6871
WithInput(os.Stdin).
6972
WithAccountRetriever(types.AccountRetriever{}).
73+
WithAddressCodec(addresscodec.NewBech32Codec(sdk.GetConfig().GetBech32AccountAddrPrefix())).
74+
WithValidatorAddressCodec(addresscodec.NewBech32Codec(sdk.GetConfig().GetBech32ValidatorAddrPrefix())).
75+
WithConsensusAddressCodec(addresscodec.NewBech32Codec(sdk.GetConfig().GetBech32ConsensusAddrPrefix())).
7076
WithHomeDir(simapp.DefaultNodeHome).
71-
WithViper("") // In simapp, we don't use any prefix for env variables.
77+
WithViper(""). // uses by default the binary name as prefix
78+
WithAddressPrefix(sdk.GetConfig().GetBech32AccountAddrPrefix()).
79+
WithValidatorPrefix(sdk.GetConfig().GetBech32ValidatorAddrPrefix())
7280

7381
rootCmd := &cobra.Command{
7482
Use: "simd",
@@ -96,6 +104,10 @@ func NewRootCmd() *cobra.Command {
96104
txConfigOpts := tx.ConfigOptions{
97105
EnabledSignModes: enabledSignModes,
98106
TextualCoinMetadataQueryFn: txmodule.NewGRPCCoinMetadataQueryFn(initClientCtx),
107+
SigningOptions: &txsigning.Options{
108+
AddressCodec: initClientCtx.InterfaceRegistry.SigningContext().AddressCodec(),
109+
ValidatorAddressCodec: initClientCtx.InterfaceRegistry.SigningContext().ValidatorAddressCodec(),
110+
},
99111
}
100112
txConfigWithTextual, err := tx.NewTxConfigWithOptions(
101113
codec.NewProtoCodec(encodingConfig.InterfaceRegistry),

0 commit comments

Comments
 (0)