Skip to content

Commit

Permalink
Merge pull request #1947 from CosmWasm/optimizer-0.15.0
Browse files Browse the repository at this point in the history
Use cosmwasm/optimizer:0.15.0
  • Loading branch information
webmaster128 authored Nov 23, 2023
2 parents 1fbcf14 + 45c14b5 commit 2149138
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 36 deletions.
24 changes: 22 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1020,18 +1020,38 @@ jobs:
name: Build development contracts
command: |
echo "Building all contracts under ./contracts"
export GLOBIGNORE="./contracts/floaty/"
docker run --volumes-from with_code cosmwasm/rust-optimizer:0.12.13 ./contracts/*/
export GLOBIGNORE="contracts/floaty"
for contract_dir in contracts/*; do
if [ -d "$contract_dir" ]; then
echo "Building '$contract_dir' ..."
docker run --volumes-from with_code cosmwasm/optimizer:0.15.0 "$contract_dir"
fi
done
- run:
name: Check development contracts
command: |
echo "Checking all contracts under ./artifacts"
docker run --volumes-from with_code rust:1.70.0 \
/bin/bash -e -c 'cd ./code; cargo run --bin cosmwasm-check artifacts/*.wasm'
- run:
name: Export development contracts
command: |
# copy into host
docker cp with_code:/code/artifacts .
cd ./artifacts
ls -lA .
# Check checksums
cat checksums.txt
sha256sum -c checksums.txt
- run:
name: Publish artifacts on GitHub
command: |
# This safety measure allows us to run the job until here for testing.
if [ -z "$CIRCLE_TAG" ]; then
echo "Not a tag build"
exit 1
fi
TAG="$CIRCLE_TAG"
TITLE="$TAG"
BODY="The release notes are available in [CHANGELOG.md](https://github.com/CosmWasm/cosmwasm/blob/$TAG/CHANGELOG.md). For upgrading contracts also consult [MIGRATING.md](https://github.com/CosmWasm/cosmwasm/blob/$TAG/MIGRATING.md).\n\nAttached there are some build artifacts generated at this tag. Those are for development purposes only! Please use crates.io to find the packages of this release."
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -397,16 +397,16 @@ from the published rust code.

For that, we have a separate repo,
[rust-optimizer](https://github.com/CosmWasm/rust-optimizer) that provides a
[docker image](https://hub.docker.com/r/CosmWasm/rust-optimizer/tags) for
building. For more info, look at
[docker image](https://hub.docker.com/r/CosmWasm/optimizer/tags) for building.
For more info, look at
[rust-optimizer README](https://github.com/CosmWasm/rust-optimizer/blob/master/README.md#usage),
but the quickstart guide is:

```sh
docker run --rm -v "$(pwd)":/code \
--mount type=volume,source="$(basename "$(pwd)")_cache",target=/code/target \
--mount type=volume,source="$(basename "$(pwd)")_cache",target=/target \
--mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \
cosmwasm/rust-optimizer:0.12.13
cosmwasm/optimizer:0.15.0
```

It will output a highly size-optimized build as `contract.wasm` in `$CODE`. With
Expand Down
46 changes: 24 additions & 22 deletions contracts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,60 +52,62 @@ the CI for every release tag. In case you need to build them manually for some
reason, use the following commands:

```sh
# cd to the repo root first

docker run --rm -v "$(pwd)":/code \
--mount type=volume,source="devcontract_cache_burner",target=/code/contracts/burner/target \
--mount type=volume,source="devcontract_cache_burner",target=/target \
--mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \
cosmwasm/rust-optimizer:0.12.13 ./contracts/burner
cosmwasm/optimizer:0.15.0 ./contracts/burner

docker run --rm -v "$(pwd)":/code \
--mount type=volume,source="devcontract_cache_crypto_verify",target=/code/contracts/crypto-verify/target \
--mount type=volume,source="devcontract_cache_crypto_verify",target=/target \
--mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \
cosmwasm/rust-optimizer:0.12.13 ./contracts/crypto-verify
cosmwasm/optimizer:0.15.0 ./contracts/crypto-verify

docker run --rm -v "$(pwd)":/code \
--mount type=volume,source="devcontract_cache_floaty",target=/code/contracts/floaty/target \
--mount type=volume,source="devcontract_cache_floaty",target=/target \
--mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \
cosmwasm/rust-optimizer:0.12.13 ./contracts/floaty
cosmwasm/optimizer:0.15.0 ./contracts/floaty

docker run --rm -v "$(pwd)":/code \
--mount type=volume,source="devcontract_cache_hackatom",target=/code/contracts/hackatom/target \
--mount type=volume,source="devcontract_cache_hackatom",target=/target \
--mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \
cosmwasm/rust-optimizer:0.12.13 ./contracts/hackatom
cosmwasm/optimizer:0.15.0 ./contracts/hackatom

docker run --rm -v "$(pwd)":/code \
--mount type=volume,source="devcontract_cache_ibc_reflect",target=/code/contracts/ibc-reflect/target \
--mount type=volume,source="devcontract_cache_ibc_reflect",target=/target \
--mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \
cosmwasm/rust-optimizer:0.12.13 ./contracts/ibc-reflect
cosmwasm/optimizer:0.15.0 ./contracts/ibc-reflect

docker run --rm -v "$(pwd)":/code \
--mount type=volume,source="devcontract_cache_ibc_reflect_send",target=/code/contracts/ibc-reflect-send/target \
--mount type=volume,source="devcontract_cache_ibc_reflect_send",target=/target \
--mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \
cosmwasm/rust-optimizer:0.12.13 ./contracts/ibc-reflect-send
cosmwasm/optimizer:0.15.0 ./contracts/ibc-reflect-send

docker run --rm -v "$(pwd)":/code \
--mount type=volume,source="devcontract_cache_queue",target=/code/contracts/queue/target \
--mount type=volume,source="devcontract_cache_queue",target=/target \
--mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \
cosmwasm/rust-optimizer:0.12.13 ./contracts/queue
cosmwasm/optimizer:0.15.0 ./contracts/queue

docker run --rm -v "$(pwd)":/code \
--mount type=volume,source="devcontract_cache_reflect",target=/code/contracts/reflect/target \
--mount type=volume,source="devcontract_cache_reflect",target=/target \
--mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \
cosmwasm/rust-optimizer:0.12.13 ./contracts/reflect
cosmwasm/optimizer:0.15.0 ./contracts/reflect

docker run --rm -v "$(pwd)":/code \
--mount type=volume,source="devcontract_cache_staking",target=/code/contracts/staking/target \
--mount type=volume,source="devcontract_cache_staking",target=/target \
--mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \
cosmwasm/rust-optimizer:0.12.13 ./contracts/staking
cosmwasm/optimizer:0.15.0 ./contracts/staking

docker run --rm -v "$(pwd)":/code \
--mount type=volume,source="devcontract_cache_virus",target=/code/contracts/virus/target \
--mount type=volume,source="devcontract_cache_virus",target=/target \
--mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \
cosmwasm/rust-optimizer:0.12.13 ./contracts/virus
cosmwasm/optimizer:0.15.0 ./contracts/virus

docker run --rm -v "$(pwd)":/code \
--mount type=volume,source="devcontract_cache_empty",target=/code/contracts/empty/target \
--mount type=volume,source="devcontract_cache_empty",target=/target \
--mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \
cosmwasm/rust-optimizer:0.12.13 ./contracts/empty
cosmwasm/optimizer:0.15.0 ./contracts/empty
```

## Entry points
Expand Down
16 changes: 8 additions & 8 deletions packages/vm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,27 +51,27 @@ To rebuild the test contracts, go to the repo root and do

```sh
docker run --rm -v "$(pwd)":/code \
--mount type=volume,source="devcontract_cache_cyberpunk",target=/code/contracts/cyberpunk/target \
--mount type=volume,source="devcontract_cache_cyberpunk",target=/target \
--mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \
cosmwasm/rust-optimizer:0.12.13 ./contracts/cyberpunk \
cosmwasm/optimizer:0.15.0 ./contracts/cyberpunk \
&& cp artifacts/cyberpunk.wasm packages/vm/testdata/cyberpunk.wasm

docker run --rm -v "$(pwd)":/code \
--mount type=volume,source="devcontract_cache_hackatom",target=/code/contracts/hackatom/target \
--mount type=volume,source="devcontract_cache_hackatom",target=/target \
--mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \
cosmwasm/rust-optimizer:0.12.13 ./contracts/hackatom \
cosmwasm/optimizer:0.15.0 ./contracts/hackatom \
&& cp artifacts/hackatom.wasm packages/vm/testdata/hackatom_1.2.wasm

docker run --rm -v "$(pwd)":/code \
--mount type=volume,source="devcontract_cache_ibc_reflect",target=/code/contracts/ibc-reflect/target \
--mount type=volume,source="devcontract_cache_ibc_reflect",target=/target \
--mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \
cosmwasm/rust-optimizer:0.12.13 ./contracts/ibc-reflect \
cosmwasm/optimizer:0.15.0 ./contracts/ibc-reflect \
&& cp artifacts/ibc_reflect.wasm packages/vm/testdata/ibc_reflect_1.2.wasm

docker run --rm -v "$(pwd)":/code \
--mount type=volume,source="devcontract_cache_empty",target=/code/contracts/empty/target \
--mount type=volume,source="devcontract_cache_empty",target=/target \
--mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \
cosmwasm/rust-optimizer:0.12.13 ./contracts/empty \
cosmwasm/optimizer:0.15.0 ./contracts/empty \
&& cp artifacts/empty.wasm packages/vm/testdata/empty.wasm
```

Expand Down

0 comments on commit 2149138

Please sign in to comment.