diff --git a/CHANGELOG.md b/CHANGELOG.md index a6cd34f..37d2bd7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## [Unreleased] +- Update to binaryen v114. +- Bump Rust to current stable v1.71.0. +- Add the `--signext-lowering` flag to `wasm-opt`. ([#127]) + ## [0.13.0] - 2023-06-20 ### Changed diff --git a/Dockerfile b/Dockerfile index 5a621ab..00e75f4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,10 @@ -FROM rust:1.69.0-alpine as targetarch +FROM rust:1.71.0-alpine as targetarch ARG BUILDPLATFORM ARG TARGETPLATFORM ARG TARGETARCH -ARG BINARYEN_VERSION="version_110" +ARG BINARYEN_VERSION="version_114" RUN echo "Running on $BUILDPLATFORM, building for $TARGETPLATFORM" @@ -88,7 +88,7 @@ RUN cd build_workspace && \ # # base-optimizer # -FROM rust:1.69.0-alpine as base-optimizer +FROM rust:1.71.0-alpine as base-optimizer # Download the crates.io index using the new sparse protocol to improve performance ENV CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse diff --git a/Makefile b/Makefile index 0530728..f95347d 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,7 @@ DOCKER_TAG := 0.13.0 # Native arch BUILDARCH := $(shell uname -m) -# Build multi-CPU architecture images and publish them. rust alpine images support the linux/amd64 and linux/arm64/v8 architectures. +# Build the native CPU arch images and publish them. Rust alpine images support the linux/amd64 and linux/arm64/v8 architectures. build: build-rust-optimizer build-workspace-optimizer build-rust-optimizer-x86_64: diff --git a/optimize.sh b/optimize.sh index f79d0ee..71f84be 100755 --- a/optimize.sh +++ b/optimize.sh @@ -20,7 +20,7 @@ mkdir -p artifacts rm -f artifacts/checksums_intermediate.txt # There are two cases here -# 1. All contracts (or one) are included in the root workspace (eg. `cosmwasm-template`, `cosmwasm-examples`, `cosmwasm-plus`) +# 1. All contracts (or one) are included in the root workspace (eg. `cosmwasm-template`, `cosmwasm-examples`, `cosmwasm-plus`) # In this case, we pass no argument, just mount the proper directory. # 2. Contracts are excluded from the root workspace, but import relative paths from other packages (only `cosmwasm`). # In this case, we mount root workspace and pass in a path `docker run ./contracts/hackatom` @@ -44,7 +44,8 @@ for CONTRACTDIR in "$@"; do echo "Creating intermediate hash for $NAME ..." sha256sum -- "$WASM" | tee -a artifacts/checksums_intermediate.txt echo "Optimizing $NAME ..." - wasm-opt -Os "$WASM" -o "artifacts/$NAME" + # --signext-lowering is needed to support blockchains runnning CosmWasm < 1.3. It can be removed eventually + wasm-opt -Os --signext-lowering "$WASM" -o "artifacts/$NAME" done done diff --git a/optimize_workspace.sh b/optimize_workspace.sh index 0b84b12..cc18426 100644 --- a/optimize_workspace.sh +++ b/optimize_workspace.sh @@ -65,7 +65,8 @@ TMPARTIFACTS=$(mktemp -p "$(pwd)" -d artifacts.XXXXXX) echo "$INTERMEDIATE_SHA" >>"$INTERMEDIATE_SHAS" echo "Optimizing ${BASENAME}..." - wasm-opt -Os "$WASM" -o "$OPTIMIZED_WASM" + # --signext-lowering is needed to support blockchains runnning CosmWasm < 1.3. It can be removed eventually + wasm-opt -Os --signext-lowering "$WASM" -o "$OPTIMIZED_WASM" echo "Moving ${OPTIMIZED_WASM}..." mv "$OPTIMIZED_WASM" ../artifacts fi