strangelove-ventures / heighliner

Repository of docker images for the node software of Cosmos chains
Apache License 2.0
56 stars 46 forks source link

provenance and cosmwasm v2.1.0 #258

Open PFC-developer opened 2 months ago

PFC-developer commented 2 months ago

for the following chain data

# Provenance
- name: provenance
  github-organization: provenance-io
  github-repo: provenance
  dockerfile: cosmos
  build-target: make install
  binaries:
    - /go/bin/provenanced
  build-env:
    - WITH_LEDGER=false
    - WITH_CLEVELDB=false
    - BUILD_TAGS=muslc musl dynamic

and building via

./heighliner build --no-cache --no-build-cache --chain provenance --git-ref v1.19.0

it's go.mod contains

github.com/CosmWasm/wasmvm/v2 v2.1.0 which should generate a wget to https://github.com/CosmWasm/wasmvm/releases/download/v2.1.0/libwasmvm_muslc.x86_64.a but instead generates https://github.com/CosmWasm/wasmvm/v2/releases/download/v2.1.0/libwasmvm_muslc.x86_64.a

I'm not raising a PR here, as I don't think this is the correct thing to do (but it appears to work)

diff --git a/builder/builder.go b/builder/builder.go
index c6b66e9..e7aebaa 100644
--- a/builder/builder.go
+++ b/builder/builder.go
@@ -255,6 +255,10 @@ func getWasmvmVersion(modFile *modfile.File) string {
                        wasmvmVersion = item.Syntax.Token[len(item.Syntax.Token)-1]
                }
        }
+       if (wasmvmVersion == "v2.1.0") {
+               fmt.Printf("WasmVM from go.mod: 2.1 hack applied\n")
+               wasmvmRepo = defaultWasmvmRepo
+       }

        fmt.Printf("WasmVM from go.mod: repo: %s, version: %s\n", wasmvmRepo, wasmvmVersion)

allows it to pass the download stage

PFC-developer commented 2 months ago

for the 2nd part it needed the following modifications

diff --git a/dockerfile/cosmos/native.Dockerfile b/dockerfile/cosmos/native.Dockerfile
index 96c1f26..aa7f08e 100644
--- a/dockerfile/cosmos/native.Dockerfile
+++ b/dockerfile/cosmos/native.Dockerfile
@@ -42,6 +42,9 @@ RUN set -eux;\
       WASMVM_REPO=$(echo $WASMVM_VERSION | awk '{print $1}');\
       WASMVM_VERS=$(echo $WASMVM_VERSION | awk '{print $2}');\
       wget -O /lib/libwasmvm_muslc.a https://${WASMVM_REPO}/releases/download/${WASMVM_VERS}/libwasmvm_muslc.$(uname -m).a;\
+      wget -O /lib/libwasmvm.so https://${WASMVM_REPO}/releases/download/${WASMVM_VERS}/libwasmvm.$(uname -m).so;\
+      wget -O /lib/libwasmvm_muslc.$(uname -m).a https://${WASMVM_REPO}/releases/download/${WASMVM_VERS}/libwasmvm_muslc.$(uname -m).a;\
+      wget -O /lib/libwasmvm.$(uname -m).so https://${WASMVM_REPO}/releases/download/${WASMVM_VERS}/libwasmvm.$(uname -m).so;\
     fi;\
     export CGO_ENABLED=1 LDFLAGS='-linkmode external -extldflags "-static"';\
     if [ ! -z "$PRE_BUILD" ]; then sh -c "${PRE_BUILD}"; fi;\
ash-burnt commented 1 month ago

The v2 issue should be solved, with v1.6.3

PFC-developer commented 1 month ago

hi @ash-burnt .. this fix in #259 solves the first issue (which file to download). but what we have found is that it attempting to link to the x86_64.a file, not the generic 'a' one.

PFC-developer commented 1 month ago

I believe this also affects xion chain (as well as provenance) and can be reproduced quite easily by attempting to build either