diff --git a/go.mod b/go.mod index e9edbab2..7c05ab11 100644 --- a/go.mod +++ b/go.mod @@ -222,7 +222,7 @@ require ( github.com/segmentio/ksuid v1.0.4 // indirect github.com/sourcegraph/conc v0.3.0 // indirect github.com/spf13/afero v1.11.0 // indirect - github.com/spf13/cast v1.6.0 // indirect + github.com/spf13/cast v1.7.0 // indirect github.com/spf13/viper v1.19.0 // indirect github.com/subosito/gotenv v1.6.0 // indirect github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d // indirect diff --git a/go.sum b/go.sum index bb802fe7..b28c9c10 100644 --- a/go.sum +++ b/go.sum @@ -1213,8 +1213,8 @@ github.com/spf13/afero v1.11.0 h1:WJQKhtpdm3v2IzqG8VMqrr6Rf3UYpEF239Jy9wNepM8= github.com/spf13/afero v1.11.0/go.mod h1:GH9Y3pIexgf1MTIWtNGyogA5MwRIDXGUr+hbWNoBjkY= github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= github.com/spf13/cast v1.5.0/go.mod h1:SpXXQ5YoyJw6s3/6cMTQuxvgRl3PCJiyaX9p6b155UU= -github.com/spf13/cast v1.6.0 h1:GEiTHELF+vaR5dhz3VqZfFSzZjYbgeKDpBxQVS4GYJ0= -github.com/spf13/cast v1.6.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo= +github.com/spf13/cast v1.7.0 h1:ntdiHjuueXFgm5nzDRdOS4yfT43P5Fnud6DH50rz/7w= +github.com/spf13/cast v1.7.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo= github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= github.com/spf13/cobra v1.0.0/go.mod h1:/6GTrnGXV9HjY+aR4k0oJ5tcvakLuG6EuKReYlHNrgE= github.com/spf13/cobra v1.6.1/go.mod h1:IOw/AERYS7UzyrGinqmz6HLUo219MORXGxhbaJUqzrY= diff --git a/simapp/Dockerfile b/simapp/Dockerfile index 32462582..b3a2be90 100644 --- a/simapp/Dockerfile +++ b/simapp/Dockerfile @@ -2,19 +2,48 @@ FROM golang:1.22-alpine AS go-builder SHELL ["/bin/sh", "-ecuxo", "pipefail"] -RUN apk add --no-cache ca-certificates build-base git +RUN apk add --no-cache ca-certificates build-base git musl-dev WORKDIR /code +ARG TARGETARCH=amd64 +ARG BUILDARCH=amd64 +RUN if [ "${TARGETARCH}" = "arm64" ] && [ "${BUILDARCH}" != "arm64" ]; then\ + wget -c https://musl.cc/aarch64-linux-musl-cross.tgz -O - | tar -xzvv --strip-components 1 -C /usr;\ + elif [ "${TARGETARCH}" = "amd64" ] && [ "${BUILDARCH}" != "amd64" ]; then\ + wget -c https://musl.cc/x86_64-linux-musl-cross.tgz -O - | tar -xzvv --strip-components 1 -C /usr;\ + fi + ADD go.mod go.sum ./ RUN set -eux; \ export ARCH=$(uname -m); \ - WASM_VERSION=$(go list -m all | grep github.com/CosmWasm/wasmvm || true); \ + LIBDIR=/lib;\ + if [ "${TARGETARCH}" = "arm64" ]; then\ + export ARCH=aarch64;\ + if [ "${BUILDARCH}" != "arm64" ]; then\ + LIBDIR=/usr/aarch64-linux-musl/lib;\ + mkdir -p $LIBDIR;\ + export CC=aarch64-linux-musl-gcc CXX=aarch64-linux-musl-g++;\ + fi;\ + elif [ "${TARGETARCH}" = "amd64" ]; then\ + export ARCH=x86_64;\ + if [ "${BUILDARCH}" != "amd64" ]; then\ + LIBDIR=/usr/x86_64-linux-musl/lib;\ + mkdir -p $LIBDIR;\ + export CC=x86_64-linux-musl-gcc CXX=x86_64-linux-musl-g++;\ + fi;\ + fi;\ + WASM_VERSION=$(go list -m all | grep github.com/CosmWasm/wasmvm/v2 || true); \ if [ ! -z "${WASM_VERSION}" ]; then \ WASMVM_REPO=$(echo $WASM_VERSION | awk '{print $1}');\ + WASMVM_REPO=${WASMVM_REPO%/v2};\ WASMVM_VERS=$(echo $WASM_VERSION | awk '{print $2}');\ - wget -O /lib/libwasmvm_muslc.a https://${WASMVM_REPO}/releases/download/${WASMVM_VERS}/libwasmvm_muslc.$(uname -m).a;\ - fi; \ + wget -O $LIBDIR/libwasmvm_muslc.a https://${WASMVM_REPO}/releases/download/${WASMVM_VERS}/libwasmvm_muslc.${ARCH}.a;\ + ln $LIBDIR/libwasmvm_muslc.a $LIBDIR/libwasmvm.x86_64.a;\ + ln $LIBDIR/libwasmvm_muslc.a $LIBDIR/libwasmvm_muslc.x86_64.a;\ + ln $LIBDIR/libwasmvm_muslc.a $LIBDIR/libwasmvm.aarch64.a;\ + ln $LIBDIR/libwasmvm_muslc.a $LIBDIR/libwasmvm_muslc.aarch64.a;\ + fi;\ go mod download; # Copy over code diff --git a/simapp/app/app.go b/simapp/app/app.go index 16bbbcb7..e5efd88c 100644 --- a/simapp/app/app.go +++ b/simapp/app/app.go @@ -135,7 +135,7 @@ import ( "github.com/CosmWasm/wasmd/x/wasm" wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" - wasmvm "github.com/CosmWasm/wasmvm" + wasmvm2 "github.com/CosmWasm/wasmvm/v2" wasmlc "github.com/cosmos/ibc-go/modules/light-clients/08-wasm" wasmlckeeper "github.com/cosmos/ibc-go/modules/light-clients/08-wasm/keeper" @@ -188,6 +188,14 @@ var ( }, ",") ) +// AllCapabilities returns all capabilities available with the current wasmvm +// See https://github.com/CosmWasm/cosmwasm/blob/main/docs/CAPABILITIES-BUILT-IN.md +func WasmCapabilities() []string { + d := wasmkeeper.BuiltInCapabilities() + d = append(d, "token_factory") // spawntag:tokenfactory + return d +} + // These constants are derived from the above variables. // These are the ones we will want to use in the code, based on // any overrides above @@ -810,7 +818,7 @@ func NewChainApp( authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) - wasmDir := filepath.Join(homePath, "wasm") + wasmDir := filepath.Join(homePath, "data") wasmConfig, err := wasm.ReadWasmConfig(appOpts) //