diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 926c9814d..508c08d55 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -103,7 +103,7 @@ jobs: - uses: actions/checkout@v4 with: submodules: recursive - - uses: actions/setup-go@v4 + - uses: actions/setup-go@v5 with: go-version: 1.21 # The Go version to download (if necessary) and use. - name: Install Intel's SGX SDK @@ -234,7 +234,7 @@ jobs: - uses: actions/checkout@v4 with: submodules: recursive - - uses: actions/setup-go@v4 + - uses: actions/setup-go@v5 with: go-version: 1.21 # The Go version to download (if necessary) and use. - name: Install xgo diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 1e6fc76b3..a77657c16 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -32,12 +32,12 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v4 - - uses: actions/setup-go@v4 + - uses: actions/setup-go@v5 with: go-version: 1.18 # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@v2 + uses: github/codeql-action/init@v3 with: languages: "go" queries: crypto-com/cosmos-sdk-codeql@main,security-and-quality @@ -49,7 +49,7 @@ jobs: # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). # If this step fails, then you should remove it and run the build manually (see below) - name: Autobuild - uses: github/codeql-action/autobuild@v2 + uses: github/codeql-action/autobuild@v3 # ℹī¸ Command-line programs to run using the OS shell. # 📚 https://git.io/JvXDl @@ -63,4 +63,4 @@ jobs: # make release - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 + uses: github/codeql-action/analyze@v3 diff --git a/.github/workflows/go-lint.yml b/.github/workflows/go-lint.yml index 8521a6187..d1da45e2e 100644 --- a/.github/workflows/go-lint.yml +++ b/.github/workflows/go-lint.yml @@ -14,7 +14,7 @@ jobs: name: lint runs-on: ubuntu-latest steps: - - uses: actions/setup-go@v4 + - uses: actions/setup-go@v5 with: go-version: 1.21 - uses: actions/checkout@v4 diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 39600ff5c..4170b77d3 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -150,7 +150,7 @@ jobs: os: [ubuntu-20.04, windows-latest, macos-latest] steps: - uses: actions/checkout@v4 - - uses: actions/setup-go@v4 + - uses: actions/setup-go@v5 with: go-version: 1.21 # The Go version to download (if necessary) and use. - name: Build CLI @@ -167,7 +167,7 @@ jobs: runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v4 - - uses: actions/setup-go@v4 + - uses: actions/setup-go@v5 with: go-version: 1.21 # The Go version to download (if necessary) and use. - name: Install xgo diff --git a/CHANGELOG.md b/CHANGELOG.md index 000092049..ac640fc28 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # CHANGELOG -# 1.12.0 (WIP) +# 1.12.0 - Fix the hardcoded admins feature - Add hardcoded admins according to proposals [269](https://dev.mintscan.io/secret/proposals/269) (Shillables) & [270](https://dev.mintscan.io/secret/proposals/270) (Sienna). diff --git a/Makefile b/Makefile index 81ad8d0a6..3e693a2ab 100644 --- a/Makefile +++ b/Makefile @@ -1,12 +1,13 @@ -PACKAGES=$(shell go list ./... | grep -v '/simulation') VERSION ?= $(shell echo $(shell git describe --tags) | sed 's/^v//') COMMIT := $(shell git log -1 --format='%H') DOCKER := $(shell which docker) DOCKER_BUF := $(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace bufbuild/buf +# SPID and API_KEY are used for Intel SGX attestation SPID ?= 00000000000000000000000000000000 API_KEY ?= FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +# Environment variables and build tags setup LEDGER_ENABLED ?= true BINDIR ?= $(GOPATH)/bin BUILD_PROFILE ?= release @@ -22,24 +23,23 @@ DOCKER_TAG ?= latest TM_SGX ?= true +# Paths for contracts and modules CW_CONTRACTS_V010_PATH = ./cosmwasm/contracts/v010/ CW_CONTRACTS_V1_PATH = ./cosmwasm/contracts/v1/ - TEST_CONTRACT_V010_PATH = ./cosmwasm/contracts/v010/compute-tests TEST_CONTRACT_V1_PATH = ./cosmwasm/contracts/v1/compute-tests - TEST_COMPUTE_MODULE_PATH = ./x/compute/internal/keeper/testdata/ - ENCLAVE_PATH = cosmwasm/enclaves/ EXECUTE_ENCLAVE_PATH = $(ENCLAVE_PATH)/execute/ -DOCKER_BUILD_ARGS ?= +# Determine if Docker Buildx is available for multi-platform builds +DOCKER_BUILD_ARGS ?= DOCKER_BUILDX_CHECK = $(@shell docker build --load test) - ifeq (Building,$(findstring Building,$(DOCKER_BUILDX_CHECK))) DOCKER_BUILD_ARGS += "--load" endif +# Check and set the SGX_MODE to either HW or SW, error if not set ifeq ($(SGX_MODE), HW) ext := hw else ifeq ($(SGX_MODE), SW) @@ -48,6 +48,7 @@ else $(error SGX_MODE must be either HW or SW) endif +# Set CGO flags based on the selected database backend (unused - currently only cleveldb is supported) ifeq ($(DB_BACKEND), rocksdb) DB_BACKEND = rocksdb DOCKER_CGO_LDFLAGS = "-L/usr/lib/x86_64-linux-gnu/ -lrocksdb -lstdc++ -llz4 -lm -lz -lbz2 -lsnappy" @@ -63,6 +64,7 @@ endif CUR_DIR:=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST)))) +# Build tags setup for various configurations like ledger, database, etc. build_tags = netgo ifeq ($(LEDGER_ENABLED),true) ifeq ($(OS),Windows_NT) @@ -120,6 +122,7 @@ whitespace += $(whitespace) comma := , build_tags_comma_sep := $(subst $(whitespace),$(comma),$(build_tags)) +# Linker flags to embed version information and other metadata into the binaries ldflags = -X github.com/cosmos/cosmos-sdk/version.Name=SecretNetwork \ -X github.com/cosmos/cosmos-sdk/version.AppName=secretd \ -X github.com/scrtlabs/SecretNetwork/cmd/secretcli/version.ClientName=secretcli \ @@ -151,6 +154,7 @@ go.sum: go.mod @echo "--> Ensure dependencies have not been modified" GO111MODULE=on go mod verify +# Build the CLI tool build_cli: go build -o secretcli -mod=readonly -tags "$(filter-out sgx, $(GO_TAGS)) secretcli" -ldflags '$(LD_FLAGS)' ./cmd/secretd @@ -173,6 +177,7 @@ build-tm-secret-enclave: rustup component add rust-src SGX_MODE=$(SGX_MODE) $(MAKE) -C /tmp/tm-secret-enclave build +# Targets for building the cli on various platforms like Windows, macOS, Linux build_windows_cli: $(MAKE) xgo_build_secretcli XGO_TARGET=windows/amd64 sudo mv github.com/scrtlabs/SecretNetwork-windows-* secretcli-windows-amd64.exe @@ -195,6 +200,7 @@ build_linux_arm64_cli: build_all: build-linux build_windows_cli build_macos_cli build_linux_arm64_cli +# Build Debian package deb: build-linux deb-no-compile deb-no-compile: @@ -226,6 +232,7 @@ deb-no-compile: dpkg-deb --build /tmp/SecretNetwork/deb/ . -rm -rf /tmp/SecretNetwork +# Clean up generated files and reset the environment clean: -rm -rf /tmp/SecretNetwork -rm -f ./secretcli* @@ -247,6 +254,11 @@ clean: $(MAKE) -C $(TEST_CONTRACT_V1_PATH)/test-compute-contract clean $(MAKE) -C $(TEST_CONTRACT_V1_PATH)/test-compute-contract-v2 clean +############################################################################### +### Dockerized Build Targets ### +############################################################################### + +# Build localsecret - dockerized local chain for development and testing. In this version SGX is ran in software/simulation mode localsecret: DOCKER_BUILDKIT=1 docker build \ --build-arg FEATURES="${FEATURES},debug-print,random,light-client-validation" \ @@ -309,6 +321,7 @@ build-testnet: --target build-deb . docker run -e VERSION=${VERSION} -v $(CUR_DIR)/build:/build deb_build +# special targets for building a deb package that compiles a new secretd but takes the enclaves from the latest package - used for upgrades when we don't want to replace the enclave build-mainnet-upgrade: @mkdir build 2>&3 || true DOCKER_BUILDKIT=1 docker build --build-arg FEATURES="verify-validator-whitelist,light-client-validation,production, ${FEATURES}" \ @@ -336,6 +349,8 @@ build-mainnet-upgrade: -t deb_build \ --target build-deb-mainnet . docker run -e VERSION=${VERSION} -v $(CUR_DIR)/build:/build deb_build + +# full mainnet build - will end up with a .deb package in the ./build folder build-mainnet: @mkdir build 2>&3 || true DOCKER_BUILDKIT=1 docker build --build-arg FEATURES="verify-validator-whitelist,light-client-validation,production,random, ${FEATURES}" \ @@ -367,6 +382,7 @@ build-mainnet: --target build-deb . docker run -e VERSION=${VERSION} -v $(CUR_DIR)/build:/build deb_build +# Build the hardware compatability checker - this is a binary that just runs attestation and provides details on the result build-check-hw-tool: @mkdir build 2>&3 || true DOCKER_BUILDKIT=1 docker build --build-arg FEATURES="${FEATURES}" \ @@ -383,23 +399,22 @@ build-check-hw-tool: -t compile-check-hw-tool \ --target compile-check-hw-tool . -# while developing: +############################################################################### +### Local Build Targets ### +############################################################################### + build-enclave: $(MAKE) -C $(EXECUTE_ENCLAVE_PATH) enclave -# while developing: check-enclave: $(MAKE) -C $(EXECUTE_ENCLAVE_PATH) check -# while developing: clippy-enclave: $(MAKE) -C $(EXECUTE_ENCLAVE_PATH) clippy -# while developing: clean-enclave: $(MAKE) -C $(EXECUTE_ENCLAVE_PATH) clean -# while developing: clippy: clippy-enclave $(MAKE) -C check-hw clippy diff --git a/README.md b/README.md index 513425643..bffb27535 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,8 @@
-[![version](https://img.shields.io/badge/version-1.3.1-blue)](https://github.com/scrtlabs/SecretNetwork/releases/tag/v1.3.1) -[![License: AGPL v3](https://img.shields.io/badge/License-AGPL%20v3-blue.svg)](https://www.gnu.org/licenses/agpl-3.0) [![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-v2.0%20adopted-ff69b4.svg)](CODE_OF_CONDUCT.md) +[![version](https://img.shields.io/badge/version-1.12.1-blue)](https://github.com/scrtlabs/SecretNetwork/releases/tag/v1.12.1) +[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-v2.0%20adopted-ff69b4.svg)](CODE_OF_CONDUCT.md) Follow @@ -42,7 +42,16 @@ Click the button below to start a new development environment: ### Install prerequisite packages ``` -apt-get install -y --no-install-recommends g++ libtool autoconf clang +apt-get install -y --no-install-recommends g++ libtool automake autoconf clang +``` + +#### Ubuntu 22+ + +The build depends on libssl1.1. Install using: + +```bash +wget https://debian.mirror.ac.za/debian/pool/main/o/openssl/libssl1.1_1.1.1w-0%2Bdeb11u1_amd64.deb +dpkg -i libssl1.1_1.1.1w-0%2Bdeb11u1_amd64.deb ``` ### Clone Repo @@ -111,15 +120,11 @@ Use `make build-linux` to build the entire codebase. This will build both the Ru To build just the rust code, you can use `make build-linux`, while to build just the Go code, there is the aptly named `make build_local_no_rust`. - Tip: -```text For a production build the enclave must be copied from the most recent release. - This is due to non-reproducible builds, and the fact that enclaves must be signed with a specific key to be accepted on mainnet. - Still, the non-enclave code can be modified and ran on mainnet as long as there are no consensus-breaking changes -``` + # Running Something @@ -145,7 +150,3 @@ For the latest documentation, check out [https://docs.scrt.network](https://docs - Twitter: [https://twitter.com/SecretNetwork](https://twitter.com/SecretNetwork) - Community Telegram Channel: [https://t.me/SCRTnetwork](https://t.me/SCRTnetwork) - Community Secret Nodes Telegram: [https://t.me/secretnodes](https://t.me/secretnodes) - -# License - -SecretNetwork is free software: you can redistribute it and/or modify it under the terms of the [GNU Affero General Public License](LICENSE) as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. The GNU Affero General Public License is based on the GNU GPL, but has an additional term to allow users who interact with the licensed software over a network to receive the source for that program. diff --git a/client/docs/yarn.lock b/client/docs/yarn.lock index 303c05ede..750312c10 100644 --- a/client/docs/yarn.lock +++ b/client/docs/yarn.lock @@ -34,20 +34,22 @@ call-me-maybe "^1.0.1" z-schema "^5.0.1" -"@babel/code-frame@^7.16.7": - version "7.16.7" - resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.16.7.tgz#44416b6bd7624b998f5b1af5d470856c40138789" - integrity sha512-iAXqUn8IIeBTNd72xsFlgaXHkMBMt6y4HJp1tIaK465CWLT/fG1aqB7ykr95gHHmlBdGbFeWWfyB4NJJ0nmeIg== - dependencies: - "@babel/highlight" "^7.16.7" - -"@babel/generator@^7.18.0": - version "7.18.0" - resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.18.0.tgz#46d28e8a18fc737b028efb25ab105d74473af43f" - integrity sha512-81YO9gGx6voPXlvYdZBliFXAZU8vZ9AZ6z+CjlmcnaeOcYSFbMTpdeDUO9xD9dh/68Vq03I8ZspfUTPfitcDHg== - dependencies: - "@babel/types" "^7.18.0" - "@jridgewell/gen-mapping" "^0.3.0" +"@babel/code-frame@^7.22.13": + version "7.22.13" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.22.13.tgz#e3c1c099402598483b7a8c46a721d1038803755e" + integrity sha512-XktuhWlJ5g+3TJXc5upd9Ks1HutSArik6jf2eAjYFyIOf4ej3RN+184cZbzDvbPnuTJIUhPKKJE3cIsYTiAT3w== + dependencies: + "@babel/highlight" "^7.22.13" + chalk "^2.4.2" + +"@babel/generator@^7.23.0": + version "7.23.0" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.23.0.tgz#df5c386e2218be505b34837acbcb874d7a983420" + integrity sha512-lN85QRR+5IbYrMWM6Y4pE/noaQtg4pNiqeNGX60eqOfo6gtEj6uw/JagelB8vVztSd7R6M5n1+PQkDbHbBRU4g== + dependencies: + "@babel/types" "^7.23.0" + "@jridgewell/gen-mapping" "^0.3.2" + "@jridgewell/trace-mapping" "^0.3.17" jsesc "^2.5.1" "@babel/helper-annotate-as-pure@^7.16.0": @@ -57,27 +59,25 @@ dependencies: "@babel/types" "^7.16.7" -"@babel/helper-environment-visitor@^7.16.7": - version "7.16.7" - resolved "https://registry.yarnpkg.com/@babel/helper-environment-visitor/-/helper-environment-visitor-7.16.7.tgz#ff484094a839bde9d89cd63cba017d7aae80ecd7" - integrity sha512-SLLb0AAn6PkUeAfKJCCOl9e1R53pQlGAfc4y4XuMRZfqeMYLE0dM1LMhqbGAlGQY0lfw5/ohoYWAe9V1yibRag== - dependencies: - "@babel/types" "^7.16.7" +"@babel/helper-environment-visitor@^7.22.20": + version "7.22.20" + resolved "https://registry.yarnpkg.com/@babel/helper-environment-visitor/-/helper-environment-visitor-7.22.20.tgz#96159db61d34a29dba454c959f5ae4a649ba9167" + integrity sha512-zfedSIzFhat/gFhWfHtgWvlec0nqB9YEIVrpuwjruLlXfUSnA8cJB0miHKwqDnQ7d32aKo2xt88/xZptwxbfhA== -"@babel/helper-function-name@^7.17.9": - version "7.17.9" - resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.17.9.tgz#136fcd54bc1da82fcb47565cf16fd8e444b1ff12" - integrity sha512-7cRisGlVtiVqZ0MW0/yFB4atgpGLWEHUVYnb448hZK4x+vih0YO5UoS11XIYtZYqHd0dIPMdUSv8q5K4LdMnIg== +"@babel/helper-function-name@^7.23.0": + version "7.23.0" + resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.23.0.tgz#1f9a3cdbd5b2698a670c30d2735f9af95ed52759" + integrity sha512-OErEqsrxjZTJciZ4Oo+eoZqeW9UIiOcuYKRJA4ZAgV9myA+pOXhhmpfNCKjEH/auVfEYVFJ6y1Tc4r0eIApqiw== dependencies: - "@babel/template" "^7.16.7" - "@babel/types" "^7.17.0" + "@babel/template" "^7.22.15" + "@babel/types" "^7.23.0" -"@babel/helper-hoist-variables@^7.16.7": - version "7.16.7" - resolved "https://registry.yarnpkg.com/@babel/helper-hoist-variables/-/helper-hoist-variables-7.16.7.tgz#86bcb19a77a509c7b77d0e22323ef588fa58c246" - integrity sha512-m04d/0Op34H5v7pbZw6pSKP7weA6lsMvfiIAMeIvkY/R4xQtBSMFEigu9QTZ2qB/9l22vsxtM8a+Q8CzD255fg== +"@babel/helper-hoist-variables@^7.22.5": + version "7.22.5" + resolved "https://registry.yarnpkg.com/@babel/helper-hoist-variables/-/helper-hoist-variables-7.22.5.tgz#c01a007dac05c085914e8fb652b339db50d823bb" + integrity sha512-wGjk9QZVzvknA6yKIUURb8zY3grXCcOZt+/7Wcy8O2uctxhplmUPkOdlgoNhmdVee2c92JXbf1xpMtVNbfoxRw== dependencies: - "@babel/types" "^7.16.7" + "@babel/types" "^7.22.5" "@babel/helper-module-imports@^7.0.0", "@babel/helper-module-imports@^7.16.0": version "7.16.7" @@ -86,31 +86,41 @@ dependencies: "@babel/types" "^7.16.7" -"@babel/helper-split-export-declaration@^7.16.7": - version "7.16.7" - resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.16.7.tgz#0b648c0c42da9d3920d85ad585f2778620b8726b" - integrity sha512-xbWoy/PFoxSWazIToT9Sif+jJTlrMcndIsaOKvTA6u7QEo7ilkRZpjew18/W3c7nm8fXdUDXh02VXTbZ0pGDNw== +"@babel/helper-split-export-declaration@^7.22.6": + version "7.22.6" + resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.22.6.tgz#322c61b7310c0997fe4c323955667f18fcefb91c" + integrity sha512-AsUnxuLhRYsisFiaJwvp1QF+I3KjD5FOxut14q/GzovUe6orHLesW2C7d754kRm53h5gqrz6sFl6sxc4BVtE/g== dependencies: - "@babel/types" "^7.16.7" + "@babel/types" "^7.22.5" + +"@babel/helper-string-parser@^7.22.5": + version "7.22.5" + resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.22.5.tgz#533f36457a25814cf1df6488523ad547d784a99f" + integrity sha512-mM4COjgZox8U+JcXQwPijIZLElkgEpO5rsERVDJTc2qfCDfERyob6k5WegS14SX18IIjv+XD+GrqNumY5JRCDw== "@babel/helper-validator-identifier@^7.16.7": version "7.16.7" resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.16.7.tgz#e8c602438c4a8195751243da9031d1607d247cad" integrity sha512-hsEnFemeiW4D08A5gUAZxLBTXpZ39P+a+DGDsHw1yxqyQ/jzFEnxf5uTEGp+3bzAbNOxU1paTgYS4ECU/IgfDw== -"@babel/highlight@^7.16.7": - version "7.17.12" - resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.17.12.tgz#257de56ee5afbd20451ac0a75686b6b404257351" - integrity sha512-7yykMVF3hfZY2jsHZEEgLc+3x4o1O+fYyULu11GynEUQNwB6lua+IIQn1FiJxNucd5UlyJryrwsOh8PL9Sn8Qg== +"@babel/helper-validator-identifier@^7.22.20": + version "7.22.20" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.20.tgz#c4ae002c61d2879e724581d96665583dbc1dc0e0" + integrity sha512-Y4OZ+ytlatR8AI+8KZfKuL5urKp7qey08ha31L8b3BwewJAoJamTzyvxPR/5D+KkdJCGPq/+8TukHBlY10FX9A== + +"@babel/highlight@^7.22.13": + version "7.22.20" + resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.22.20.tgz#4ca92b71d80554b01427815e06f2df965b9c1f54" + integrity sha512-dkdMCN3py0+ksCgYmGG8jKeGA/8Tk+gJwSYYlFGxG5lmhfKNoAy004YpLxpS1W2J8m/EK2Ew+yOs9pVRwO89mg== dependencies: - "@babel/helper-validator-identifier" "^7.16.7" - chalk "^2.0.0" + "@babel/helper-validator-identifier" "^7.22.20" + chalk "^2.4.2" js-tokens "^4.0.0" -"@babel/parser@^7.16.7", "@babel/parser@^7.18.0": - version "7.18.0" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.18.0.tgz#10a8d4e656bc01128d299a787aa006ce1a91e112" - integrity sha512-AqDccGC+m5O/iUStSJy3DGRIUFu7WbY/CppZYwrEUB4N0tZlnI8CSTsgL7v5fHVFmUbRv2sd+yy27o8Ydt4MGg== +"@babel/parser@^7.22.15", "@babel/parser@^7.23.0": + version "7.23.0" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.23.0.tgz#da950e622420bf96ca0d0f2909cdddac3acd8719" + integrity sha512-vvPKKdMemU85V9WE/l5wZEmImpCtLqbnTvqDS2U1fJ96KrxoW7KrXhNsNCblQlg8Ck4b85yxdTyelsMUgFUXiw== "@babel/runtime@^7.17.8": version "7.18.0" @@ -119,32 +129,32 @@ dependencies: regenerator-runtime "^0.13.4" -"@babel/template@^7.16.7": - version "7.16.7" - resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.16.7.tgz#8d126c8701fde4d66b264b3eba3d96f07666d155" - integrity sha512-I8j/x8kHUrbYRTUxXrrMbfCa7jxkE7tZre39x3kjr9hvI82cK1FfqLygotcWN5kdPGWcLdWMHpSBavse5tWw3w== +"@babel/template@^7.22.15": + version "7.22.15" + resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.22.15.tgz#09576efc3830f0430f4548ef971dde1350ef2f38" + integrity sha512-QPErUVm4uyJa60rkI73qneDacvdvzxshT3kksGqlGWYdOTIUOwJ7RDUL8sGqslY1uXWSL6xMFKEXDS3ox2uF0w== dependencies: - "@babel/code-frame" "^7.16.7" - "@babel/parser" "^7.16.7" - "@babel/types" "^7.16.7" + "@babel/code-frame" "^7.22.13" + "@babel/parser" "^7.22.15" + "@babel/types" "^7.22.15" "@babel/traverse@^7.4.5": - version "7.18.0" - resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.18.0.tgz#0e5ec6db098660b2372dd63d096bf484e32d27ba" - integrity sha512-oNOO4vaoIQoGjDQ84LgtF/IAlxlyqL4TUuoQ7xLkQETFaHkY1F7yazhB4Kt3VcZGL0ZF/jhrEpnXqUb0M7V3sw== - dependencies: - "@babel/code-frame" "^7.16.7" - "@babel/generator" "^7.18.0" - "@babel/helper-environment-visitor" "^7.16.7" - "@babel/helper-function-name" "^7.17.9" - "@babel/helper-hoist-variables" "^7.16.7" - "@babel/helper-split-export-declaration" "^7.16.7" - "@babel/parser" "^7.18.0" - "@babel/types" "^7.18.0" + version "7.23.2" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.23.2.tgz#329c7a06735e144a506bdb2cad0268b7f46f4ad8" + integrity sha512-azpe59SQ48qG6nu2CzcMLbxUudtN+dOM9kDbUqGq3HXUJRlo7i8fvPoxQUzYgLZ4cMVmuZgm8vvBpNeRhd6XSw== + dependencies: + "@babel/code-frame" "^7.22.13" + "@babel/generator" "^7.23.0" + "@babel/helper-environment-visitor" "^7.22.20" + "@babel/helper-function-name" "^7.23.0" + "@babel/helper-hoist-variables" "^7.22.5" + "@babel/helper-split-export-declaration" "^7.22.6" + "@babel/parser" "^7.23.0" + "@babel/types" "^7.23.0" debug "^4.1.0" globals "^11.1.0" -"@babel/types@^7.16.7", "@babel/types@^7.17.0", "@babel/types@^7.18.0": +"@babel/types@^7.16.7": version "7.18.0" resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.18.0.tgz#ef523ea349722849cb4bf806e9342ede4d071553" integrity sha512-vhAmLPAiC8j9K2GnsnLPCIH5wCrPpYIVBCWRBFDCB7Y/BXLqi/O+1RSTTM2bsmg6U/551+FCf9PNPxjABmxHTw== @@ -152,6 +162,15 @@ "@babel/helper-validator-identifier" "^7.16.7" to-fast-properties "^2.0.0" +"@babel/types@^7.22.15", "@babel/types@^7.22.5", "@babel/types@^7.23.0": + version "7.23.0" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.23.0.tgz#8c1f020c9df0e737e4e247c0619f58c68458aaeb" + integrity sha512-0oIyUfKoI3mSqMvsxBdclDwxXKXAUA8v/apZbc+iSyARYou1o8ZGDxbUYyLFoW2arqS2jDGqJuZvv1d/io1axg== + dependencies: + "@babel/helper-string-parser" "^7.22.5" + "@babel/helper-validator-identifier" "^7.22.20" + to-fast-properties "^2.0.0" + "@emotion/is-prop-valid@^1.1.0": version "1.1.2" resolved "https://registry.yarnpkg.com/@emotion/is-prop-valid/-/is-prop-valid-1.1.2.tgz#34ad6e98e871aa6f7a20469b602911b8b11b3a95" @@ -179,12 +198,12 @@ resolved "https://registry.yarnpkg.com/@exodus/schemasafe/-/schemasafe-1.0.0-rc.6.tgz#7985f681564cff4ffaebb5896eb4be20af3aae7a" integrity sha512-dDnQizD94EdBwEj/fh3zPRa/HWCS9O5au2PuHhZBbuM3xWHxuaKzPBOEWze7Nn0xW68MIpZ7Xdyn1CoCpjKCuQ== -"@jridgewell/gen-mapping@^0.3.0": - version "0.3.1" - resolved "https://registry.yarnpkg.com/@jridgewell/gen-mapping/-/gen-mapping-0.3.1.tgz#cf92a983c83466b8c0ce9124fadeaf09f7c66ea9" - integrity sha512-GcHwniMlA2z+WFPWuY8lp3fsza0I8xPFMWL5+n8LYyP6PSvPrXf4+n8stDHZY2DM0zy9sVkRDy1jDI4XGzYVqg== +"@jridgewell/gen-mapping@^0.3.2": + version "0.3.3" + resolved "https://registry.yarnpkg.com/@jridgewell/gen-mapping/-/gen-mapping-0.3.3.tgz#7e02e6eb5df901aaedb08514203b096614024098" + integrity sha512-HLhSWOLRi875zjjMG/r+Nv0oCW8umGb0BgEhyX3dDX3egwZtB8PqLnjz3yedt8R5StBrzcg4aBpnh8UA9D1BoQ== dependencies: - "@jridgewell/set-array" "^1.0.0" + "@jridgewell/set-array" "^1.0.1" "@jridgewell/sourcemap-codec" "^1.4.10" "@jridgewell/trace-mapping" "^0.3.9" @@ -193,16 +212,34 @@ resolved "https://registry.yarnpkg.com/@jridgewell/resolve-uri/-/resolve-uri-3.0.7.tgz#30cd49820a962aff48c8fffc5cd760151fca61fe" integrity sha512-8cXDaBBHOr2pQ7j77Y6Vp5VDT2sIqWyWQ56TjEq4ih/a4iST3dItRe8Q9fp0rrIl9DoKhWQtUQz/YpOxLkXbNA== -"@jridgewell/set-array@^1.0.0": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@jridgewell/set-array/-/set-array-1.1.1.tgz#36a6acc93987adcf0ba50c66908bd0b70de8afea" - integrity sha512-Ct5MqZkLGEXTVmQYbGtx9SVqD2fqwvdubdps5D3djjAkgkKwT918VNOz65pEHFaYTeWcukmJmH5SwsA9Tn2ObQ== +"@jridgewell/resolve-uri@^3.1.0": + version "3.1.1" + resolved "https://registry.yarnpkg.com/@jridgewell/resolve-uri/-/resolve-uri-3.1.1.tgz#c08679063f279615a3326583ba3a90d1d82cc721" + integrity sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA== + +"@jridgewell/set-array@^1.0.1": + version "1.1.2" + resolved "https://registry.yarnpkg.com/@jridgewell/set-array/-/set-array-1.1.2.tgz#7c6cf998d6d20b914c0a55a91ae928ff25965e72" + integrity sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw== "@jridgewell/sourcemap-codec@^1.4.10": version "1.4.13" resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.13.tgz#b6461fb0c2964356c469e115f504c95ad97ab88c" integrity sha512-GryiOJmNcWbovBxTfZSF71V/mXbgcV3MewDe3kIMCLyIh5e7SKAeUZs+rMnJ8jkMolZ/4/VsdBmMrw3l+VdZ3w== +"@jridgewell/sourcemap-codec@^1.4.14": + version "1.4.15" + resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz#d7c6e6755c78567a951e04ab52ef0fd26de59f32" + integrity sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg== + +"@jridgewell/trace-mapping@^0.3.17": + version "0.3.20" + resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.20.tgz#72e45707cf240fa6b081d0366f8265b0cd10197f" + integrity sha512-R8LcPeWZol2zR8mmH3JeKQ6QRCFb7XgUhV9ZlGhHLGyg4wpPiPZNQOOWhFZhxKw8u//yTbNGI42Bx/3paXEQ+Q== + dependencies: + "@jridgewell/resolve-uri" "^3.1.0" + "@jridgewell/sourcemap-codec" "^1.4.14" + "@jridgewell/trace-mapping@^0.3.9": version "0.3.13" resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.13.tgz#dcfe3e95f224c8fe97a87a5235defec999aa92ea" @@ -338,7 +375,7 @@ bn.js@^4.0.0, bn.js@^4.1.0, bn.js@^4.11.9: resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.12.0.tgz#775b3f278efbb9718eec7361f483fb36fbbfea88" integrity sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA== -bn.js@^5.0.0, bn.js@^5.1.1: +bn.js@^5.0.0, bn.js@^5.2.1: version "5.2.1" resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-5.2.1.tgz#0bc527a6a0d18d0aa8d5b0538ce4a77dccfa7b70" integrity sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ== @@ -393,7 +430,7 @@ browserify-des@^1.0.0: inherits "^2.0.1" safe-buffer "^5.1.2" -browserify-rsa@^4.0.0, browserify-rsa@^4.0.1: +browserify-rsa@^4.0.0, browserify-rsa@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/browserify-rsa/-/browserify-rsa-4.1.0.tgz#b2fd06b5b75ae297f7ce2dc651f918f5be158c8d" integrity sha512-AdEER0Hkspgno2aR97SAf6vi0y0k8NuOpGnVH3O99rcA5Q6sh8QxcngtHuJ6uXwnfAXNM4Gn1Gb7/MV1+Ymbog== @@ -402,19 +439,19 @@ browserify-rsa@^4.0.0, browserify-rsa@^4.0.1: randombytes "^2.0.1" browserify-sign@^4.0.0: - version "4.2.1" - resolved "https://registry.yarnpkg.com/browserify-sign/-/browserify-sign-4.2.1.tgz#eaf4add46dd54be3bb3b36c0cf15abbeba7956c3" - integrity sha512-/vrA5fguVAKKAVTNJjgSm1tRQDHUU6DbwO9IROu/0WAzC8PKhucDSh18J0RMvVeHAn5puMd+QHC2erPRNf8lmg== + version "4.2.2" + resolved "https://registry.yarnpkg.com/browserify-sign/-/browserify-sign-4.2.2.tgz#e78d4b69816d6e3dd1c747e64e9947f9ad79bc7e" + integrity sha512-1rudGyeYY42Dk6texmv7c4VcQ0EsvVbLwZkA+AQB7SxvXxmcD93jcHie8bzecJ+ChDlmAm2Qyu0+Ccg5uhZXCg== dependencies: - bn.js "^5.1.1" - browserify-rsa "^4.0.1" + bn.js "^5.2.1" + browserify-rsa "^4.1.0" create-hash "^1.2.0" create-hmac "^1.1.7" - elliptic "^6.5.3" + elliptic "^6.5.4" inherits "^2.0.4" - parse-asn1 "^5.1.5" - readable-stream "^3.6.0" - safe-buffer "^5.2.0" + parse-asn1 "^5.1.6" + readable-stream "^3.6.2" + safe-buffer "^5.2.1" browserify-zlib@^0.2.0: version "0.2.0" @@ -452,7 +489,7 @@ camelize@^1.0.0: resolved "https://registry.yarnpkg.com/camelize/-/camelize-1.0.0.tgz#164a5483e630fa4321e5af07020e531831b2609b" integrity sha512-W2lPwkBkMZwFlPCXhIlYgxu+7gC/NUlCtdK652DAJ1JdgV0sTrvuPFshNPrFa1TY2JOkLhgdeEBplB4ezEa+xg== -chalk@^2.0.0: +chalk@^2.4.2: version "2.4.2" resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424" integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ== @@ -653,7 +690,7 @@ dompurify@^2.2.8: resolved "https://registry.yarnpkg.com/dompurify/-/dompurify-2.3.8.tgz#224fe9ae57d7ebd9a1ae1ac18c1c1ca3f532226f" integrity sha512-eVhaWoVibIzqdGYjwsBWodIQIaXFSB+cKDf4cfxLMsK0xiud6SE+/WCVx/Xw/UwQsa4cS3T2eITcdtmTg2UKcw== -elliptic@^6.5.3: +elliptic@^6.5.3, elliptic@^6.5.4: version "6.5.4" resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.5.4.tgz#da37cebd31e79a1367e941b592ed1fbebd58abbb" integrity sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ== @@ -1140,7 +1177,7 @@ pako@~1.0.5: resolved "https://registry.yarnpkg.com/pako/-/pako-1.0.11.tgz#6c9599d340d54dfd3946380252a35705a6b992bf" integrity sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw== -parse-asn1@^5.0.0, parse-asn1@^5.1.5: +parse-asn1@^5.0.0, parse-asn1@^5.1.6: version "5.1.6" resolved "https://registry.yarnpkg.com/parse-asn1/-/parse-asn1-5.1.6.tgz#385080a3ec13cb62a62d39409cb3e88844cdaed4" integrity sha512-RnZRo1EPU6JBnra2vGHj0yhp6ebyjBZpmUCLHWiFhxlzvBCCpAuZ7elsBp1PVAbQN0/04VD/19rfzlBSwLstMw== @@ -1327,6 +1364,15 @@ readable-stream@^3.6.0: string_decoder "^1.1.1" util-deprecate "^1.0.1" +readable-stream@^3.6.2: + version "3.6.2" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.6.2.tgz#56a9b36ea965c00c5a93ef31eb111a0f11056967" + integrity sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA== + dependencies: + inherits "^2.0.3" + string_decoder "^1.1.1" + util-deprecate "^1.0.1" + readdirp@~3.6.0: version "3.6.0" resolved "https://registry.yarnpkg.com/readdirp/-/readdirp-3.6.0.tgz#74a370bd857116e245b29cc97340cd431a02a6c7" @@ -1407,7 +1453,7 @@ ripemd160@^2.0.0, ripemd160@^2.0.1: hash-base "^3.0.0" inherits "^2.0.1" -safe-buffer@^5.0.1, safe-buffer@^5.1.0, safe-buffer@^5.1.1, safe-buffer@^5.1.2, safe-buffer@^5.2.0, safe-buffer@~5.2.0: +safe-buffer@^5.0.1, safe-buffer@^5.1.0, safe-buffer@^5.1.1, safe-buffer@^5.1.2, safe-buffer@^5.2.0, safe-buffer@^5.2.1, safe-buffer@~5.2.0: version "5.2.1" resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== diff --git a/cosmwasm/Cargo.lock b/cosmwasm/Cargo.lock index 0c47adec8..84a3994e5 100644 --- a/cosmwasm/Cargo.lock +++ b/cosmwasm/Cargo.lock @@ -66,9 +66,9 @@ checksum = "b41b7ea54a0c9d92199de89e20e58d49f02f8e699814ef3fdf266f6f748d15c7" [[package]] name = "base64" -version = "0.21.3" +version = "0.21.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "414dcefbc63d77c526a76b3afcf6fbb9b5e2791c19c3aa2297733208750c6e53" +checksum = "c79fed4cdb43e993fcdadc7e58a09fd0e3e649c4436fa11da71c9f1f3ee7feb9" [[package]] name = "bitflags" @@ -78,9 +78,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.3.3" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "630be753d4e58660abd17930c71b647fe46c27ea6b63cc59e1e3851406972e42" +checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" [[package]] name = "block-buffer" @@ -154,7 +154,7 @@ checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" name = "cosmwasm-sgx-vm" version = "0.10.0" dependencies = [ - "base64 0.21.3", + "base64 0.21.6", "enclave-ffi-types", "hex", "lazy_static", @@ -324,15 +324,15 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.147" +version = "0.2.149" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3" +checksum = "a08173bc88b7955d1b3145aa561539096c421ac8debde8cbc3612ec635fee29b" [[package]] name = "linux-raw-sys" -version = "0.4.3" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09fc20d2ca12cb9f044c93e3bd6d32d523e6e2ec3db4f7b2939cd99026ecd3f0" +checksum = "da2479e8c062e40bf0066ffa0bc823de0a9368974af99c9f6df941d2c231e03f" [[package]] name = "lock_api" @@ -478,11 +478,11 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.4" +version = "0.38.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a962918ea88d644592894bc6dc55acc6c0956488adcebbfb6e273506b7fd6e5" +checksum = "745ecfa778e66b2b63c88a61cb36e0eea109e803b0b86bf9879fbc77c70e86ed" dependencies = [ - "bitflags 2.3.3", + "bitflags 2.4.1", "errno", "libc", "linux-raw-sys", @@ -585,9 +585,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.105" +version = "1.0.108" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "693151e1ac27563d6dbcec9dee9fbd5da8539b20fa14ad3752b2e6d363ace360" +checksum = "3d1c7e3eac408d115102c4c24ad393e0821bb3a5df4d506a80f85f7a742a526b" dependencies = [ "itoa", "ryu", diff --git a/cosmwasm/contracts/v1/compute-tests/migration/contract-v2/Cargo.lock b/cosmwasm/contracts/v1/compute-tests/migration/contract-v2/Cargo.lock index 44d43a38c..b3e1b7012 100644 --- a/cosmwasm/contracts/v1/compute-tests/migration/contract-v2/Cargo.lock +++ b/cosmwasm/contracts/v1/compute-tests/migration/contract-v2/Cargo.lock @@ -124,7 +124,7 @@ dependencies = [ "hex", "schemars", "serde", - "serde-json-wasm", + "serde-json-wasm 0.4.1", "thiserror", "uint", ] @@ -387,6 +387,7 @@ dependencies = [ "cosmwasm-storage", "schemars", "serde", + "serde-json-wasm 0.2.3", ] [[package]] @@ -508,6 +509,15 @@ dependencies = [ "serde_derive", ] +[[package]] +name = "serde-json-wasm" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "120bad73306616e91acd7ceed522ba96032a51cffeef3cc813de7f367df71e37" +dependencies = [ + "serde", +] + [[package]] name = "serde-json-wasm" version = "0.4.1" diff --git a/cosmwasm/contracts/v1/compute-tests/migration/contract-v2/Cargo.toml b/cosmwasm/contracts/v1/compute-tests/migration/contract-v2/Cargo.toml index 75f64b4b9..64b034a27 100644 --- a/cosmwasm/contracts/v1/compute-tests/migration/contract-v2/Cargo.toml +++ b/cosmwasm/contracts/v1/compute-tests/migration/contract-v2/Cargo.toml @@ -42,6 +42,8 @@ cosmwasm-storage = { version = "1.0.0" } # Used only for schema generation cosmwasm-schema = { version = "1.1.0", optional = true } +serde-json-wasm = "0.2.1" + # Uncomment these for some common extra tools # secret-toolkit = "0.7.0" # cw-storage-plus = { version = "0.14.0", default-features = false } @@ -52,4 +54,3 @@ cosmwasm-schema = { version = "1.1.0", optional = true } cosmwasm-std = { git = "https://github.com/scrtlabs/cosmwasm", rev = "97122ddc6e1b2a57e2b966f6b0663df95ed5d82b" } cosmwasm-storage = { git = "https://github.com/scrtlabs/cosmwasm", rev = "97122ddc6e1b2a57e2b966f6b0663df95ed5d82b" } - diff --git a/cosmwasm/contracts/v1/compute-tests/migration/contract-v2/migrate_contract_v2.wasm b/cosmwasm/contracts/v1/compute-tests/migration/contract-v2/migrate_contract_v2.wasm index 0eaeef10c..067ed0aa0 100755 Binary files a/cosmwasm/contracts/v1/compute-tests/migration/contract-v2/migrate_contract_v2.wasm and b/cosmwasm/contracts/v1/compute-tests/migration/contract-v2/migrate_contract_v2.wasm differ diff --git a/cosmwasm/contracts/v1/compute-tests/migration/contract-v2/src/contract.rs b/cosmwasm/contracts/v1/compute-tests/migration/contract-v2/src/contract.rs index 1d8875066..c315f5306 100644 --- a/cosmwasm/contracts/v1/compute-tests/migration/contract-v2/src/contract.rs +++ b/cosmwasm/contracts/v1/compute-tests/migration/contract-v2/src/contract.rs @@ -1,5 +1,5 @@ -use crate::msg::{ExecuteMsg, InstantiateMsg, MigrateMsg}; -use cosmwasm_std::{entry_point, DepsMut, Env, MessageInfo, Response, StdError, StdResult}; +use crate::msg::{ExecuteMsg, InstantiateMsg, MigrateMsg, QueryMsg}; +use cosmwasm_std::{entry_point, DepsMut, Env, MessageInfo, Response, StdError, StdResult, Deps, Binary, to_binary}; #[entry_point] pub fn instantiate( @@ -21,8 +21,9 @@ pub fn execute( match msg { ExecuteMsg::NewFunction {} => Ok(Response::default()), + ExecuteMsg::Increment {} | ExecuteMsg::NewFunctionWithStorage {} => { - let mut x = read_storage(&deps)?; + let mut x = read_storage(&deps.as_ref())?; // let mut resp = Response::new(); // @@ -42,7 +43,7 @@ pub fn migrate(_deps: DepsMut, _env: Env, msg: MigrateMsg) -> StdResult StdResult { +pub fn read_storage(deps: &Deps) -> StdResult { let x = deps.storage.get(b"test.key").unwrap_or(vec![]); let mut y = [0u8; 8]; @@ -56,3 +57,17 @@ pub fn write_to_storage(deps: DepsMut, value: u64) -> StdResult<()> { Ok(()) } + +#[entry_point] +pub fn query(deps: Deps, env: Env, msg: QueryMsg) -> StdResult { + match msg { + QueryMsg::GetCounter {} => to_binary(&read_storage(&deps)?), + QueryMsg::Simple {} => to_binary(&42), + QueryMsg::GetEnv {} => Ok(Binary::from( + serde_json_wasm::to_string(&env) + .unwrap() + .as_bytes() + .to_vec(), + )), + } +} diff --git a/cosmwasm/contracts/v1/compute-tests/migration/contract-v2/src/msg.rs b/cosmwasm/contracts/v1/compute-tests/migration/contract-v2/src/msg.rs index 40e3ed018..045e503f9 100644 --- a/cosmwasm/contracts/v1/compute-tests/migration/contract-v2/src/msg.rs +++ b/cosmwasm/contracts/v1/compute-tests/migration/contract-v2/src/msg.rs @@ -11,6 +11,7 @@ pub enum InstantiateMsg { pub enum ExecuteMsg { NewFunction {}, NewFunctionWithStorage {}, + Increment {}, } #[derive(Serialize, Deserialize, Clone, Debug, Eq, PartialEq, JsonSchema)] @@ -19,3 +20,12 @@ pub enum MigrateMsg { Migrate {}, StdError {}, } + + +#[derive(Serialize, Deserialize, Clone, Debug, Eq, PartialEq, JsonSchema)] +#[serde(rename_all = "snake_case")] +pub enum QueryMsg { + GetCounter {}, + Simple {}, + GetEnv {}, +} diff --git a/cosmwasm/contracts/v1/compute-tests/test-compute-contract/src/contract.rs b/cosmwasm/contracts/v1/compute-tests/test-compute-contract/src/contract.rs index 72ed8c44a..5b128b3e9 100644 --- a/cosmwasm/contracts/v1/compute-tests/test-compute-contract/src/contract.rs +++ b/cosmwasm/contracts/v1/compute-tests/test-compute-contract/src/contract.rs @@ -3,7 +3,7 @@ use std::{thread, vec}; use cosmwasm_std::{ attr, coins, entry_point, from_binary, to_binary, BankMsg, Binary, CanonicalAddr, CosmosMsg, - Deps, DepsMut, Empty, Env, Event, MessageInfo, QueryRequest, Reply, ReplyOn, Response, + Coin, Deps, DepsMut, Empty, Env, Event, MessageInfo, QueryRequest, Reply, ReplyOn, Response, StdError, StdResult, Storage, SubMsg, SubMsgResponse, SubMsgResult, WasmMsg, WasmQuery, }; use cosmwasm_storage::PrefixedStorage; @@ -636,7 +636,7 @@ pub fn execute(deps: DepsMut, env: Env, info: MessageInfo, msg: ExecuteMsg) -> S ExecuteMsg::MultipleSubMessagesNoReply {} => send_multiple_sub_messages_no_reply(env, deps), ExecuteMsg::QuickError {} => { count(deps.storage).save(&123456)?; - Err(StdError::generic_err("error in execute")) + Err(StdError::generic_err("quick error in execute")) } ExecuteMsg::MultipleSubMessagesNoReplyWithError {} => { send_multiple_sub_messages_no_reply_with_error(env, deps) @@ -650,6 +650,46 @@ pub fn execute(deps: DepsMut, env: Env, info: MessageInfo, msg: ExecuteMsg) -> S ExecuteMsg::MultipleSubMessagesWithReplyWithPanic {} => { send_multiple_sub_messages_with_reply_with_panic(env, deps) } + ExecuteMsg::IncrementAndSendFailingSubmessage { reply_on } => { + increment_simple(deps)?; + let response = send_failing_submsg(env, reply_on)?; + + Ok(response) + }, + ExecuteMsg::IncrementAndSendSubmessageWithBankFail { reply_on } => { + increment_simple(deps)?; + let response = send_failing_submsg_with_bank_fail(env, reply_on)?; + + Ok(response) + }, + ExecuteMsg::SendSucceedingSubmessageThenFailingMessageOnReply {} => { + increment_simple(deps)?; + + let mut response = Response::default(); + add_succeeding_submsg(env, &mut response, ReplyOn::Always, 9201); + + // failing message is created on reply + Ok(response) + }, + ExecuteMsg::SendSucceedingSubmessageAndFailingMessage {} => { + increment_simple(deps)?; + + let mut response = Response::default(); + + add_succeeding_submsg(env, &mut response, ReplyOn::Always, 9201); + + response = response.add_message( + CosmosMsg::Bank(BankMsg::Send { + to_address: "non-existent".to_string(), + amount: vec![Coin::new(100, "non-existent")], + }) + ); + + // NOTE that if the submsg is added after the message, then it is processed in THAT order, + // which is different from what is stated in cosmwasm's docs here: https://github.com/CosmWasm/cosmwasm/blob/main/SEMANTICS.md#order-and-rollback + + Ok(response) + } ExecuteMsg::InitV10 { counter, code_id, @@ -1245,6 +1285,13 @@ pub fn execute(deps: DepsMut, env: Env, info: MessageInfo, msg: ExecuteMsg) -> S return res; } + ExecuteMsg::IncrementAndBankMsgSend { to, amount } => { + increment_simple(deps)?; + Ok(Response::new().add_message(CosmosMsg::Bank(BankMsg::Send { + to_address: to, + amount, + }))) + } ExecuteMsg::BankMsgSend { to, amount } => { Ok(Response::new().add_message(CosmosMsg::Bank(BankMsg::Send { to_address: to, @@ -1448,6 +1495,13 @@ pub fn increment(env: Env, deps: DepsMut, c: u64) -> StdResult { Ok(resp) } +pub fn increment_simple(deps: DepsMut) -> StdResult { + let new_count = count_read(deps.storage).load()? + 1; + count(deps.storage).save(&new_count)?; + + Ok(new_count) +} + pub fn transfer_money(_deps: DepsMut, amount: u64) -> StdResult { let mut resp = Response::default(); resp.messages.push(SubMsg { @@ -1755,6 +1809,87 @@ pub fn send_multiple_sub_messages_with_reply_with_error( Ok(resp) } +pub fn add_succeeding_submsg( + env: Env, + resp: &mut Response, + reply_on: ReplyOn, + id: u64, +) { + let message = ExecuteMsg::Increment { addition: 3 }; + + let message = Binary::from( + serde_json_wasm::to_string(&message) + .unwrap() + .as_bytes() + .to_vec() + ); + + resp.messages.push(SubMsg { + id: id, + msg: CosmosMsg::Wasm(WasmMsg::Execute { + contract_addr: env.contract.address.clone().into_string(), + code_hash: env.contract.code_hash.clone(), + msg: message, + funds: vec![], + }), + gas_limit: Some(10000000_u64), + reply_on, + }); +} + +pub fn send_failing_submsg_with_bank_fail( + env: Env, + reply_on: ReplyOn, +) -> StdResult { + let failing_bank_msg = ExecuteMsg::IncrementAndBankMsgSend { + amount: vec![ Coin::new(100, "non-existent")], + to: "non-existent".to_string() + }; + + let bank_binary_msg = Binary::from( + serde_json_wasm::to_string(&failing_bank_msg) + .unwrap() + .as_bytes() + .to_vec() + ); + + let mut resp = Response::default(); + resp.messages.push(SubMsg { + id: 9202, + msg: CosmosMsg::Wasm(WasmMsg::Execute { + contract_addr: env.contract.address.clone().into_string(), + code_hash: env.contract.code_hash.clone(), + msg: bank_binary_msg, + funds: vec![], + }), + gas_limit: Some(10000000_u64), + reply_on, + }); + + Ok(resp) +} + +pub fn send_failing_submsg( + env: Env, + reply_on: ReplyOn, +) -> StdResult { + let mut resp = Response::default(); + + resp.messages.push(SubMsg { + id: 9200, + msg: CosmosMsg::Wasm(WasmMsg::Execute { + contract_addr: env.contract.address.clone().into_string(), + code_hash: env.contract.code_hash.clone(), + msg: Binary::from(r#"{"quick_error":{}}"#.as_bytes().to_vec()), + funds: vec![], + }), + gas_limit: Some(10000000_u64), + reply_on, + }); + + Ok(resp) +} + pub fn send_multiple_sub_messages_with_reply_with_panic( env: Env, deps: DepsMut, @@ -2269,6 +2404,31 @@ pub fn reply(deps: DepsMut, env: Env, reply: Reply) -> StdResult { (8451, SubMsgResult::Ok(_)) => Ok(Response::new() .add_attribute_plaintext("attr_reply", "đŸĻ„") .set_data(to_binary("reply")?)), + //(9000, SubMsgResult::Err(_)) => Err(StdError::generic_err("err")), + (9200, SubMsgResult::Err(_)) => Ok(Response::default().set_data( + (count_read(deps.storage).load()? as u32).to_be_bytes() + )), + (9201, _) => { + // check that the submessage worked + if count_read(deps.storage).load()? != 14 { + return Ok(Response::default()); // test expects error, so this will fail the test + } + + increment_simple(deps)?; + + let response = Response::default().add_message( + CosmosMsg::Bank(BankMsg::Send { + to_address: "non-existent".to_string(), + amount: vec![Coin::new(100, "non-existent")], + }) + ); + + Ok(response) + }, + (9202, _) => { + increment_simple(deps)?; + Ok(Response::default()) + }, (11337, SubMsgResult::Ok(SubMsgResponse { data, .. })) => { let (contract_addr, new_code_id, callback_code_hash, msg) = match from_binary(&data.unwrap()) { diff --git a/cosmwasm/contracts/v1/compute-tests/test-compute-contract/src/msg.rs b/cosmwasm/contracts/v1/compute-tests/test-compute-contract/src/msg.rs index 1695a1891..a6ab6483c 100644 --- a/cosmwasm/contracts/v1/compute-tests/test-compute-contract/src/msg.rs +++ b/cosmwasm/contracts/v1/compute-tests/test-compute-contract/src/msg.rs @@ -1,4 +1,4 @@ -use cosmwasm_std::{Binary, Coin, Uint64}; +use cosmwasm_std::{Binary, Coin, Uint64, ReplyOn}; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; @@ -176,6 +176,14 @@ pub enum ExecuteMsg { MultipleSubMessagesNoReplyWithPanic {}, MultipleSubMessagesWithReplyWithError {}, MultipleSubMessagesWithReplyWithPanic {}, + IncrementAndSendFailingSubmessage { + reply_on: ReplyOn, + }, + IncrementAndSendSubmessageWithBankFail { + reply_on: ReplyOn, + }, + SendSucceedingSubmessageThenFailingMessageOnReply {}, + SendSucceedingSubmessageAndFailingMessage {}, InitV10 { code_id: u64, code_hash: String, @@ -412,6 +420,10 @@ pub enum ExecuteMsg { privkey: Binary, iterations: u32, }, + IncrementAndBankMsgSend { + amount: Vec, + to: String, + }, BankMsgSend { amount: Vec, to: String, diff --git a/cosmwasm/enclaves/execute/Makefile b/cosmwasm/enclaves/execute/Makefile index 4b0d4fbdb..ece315a55 100644 --- a/cosmwasm/enclaves/execute/Makefile +++ b/cosmwasm/enclaves/execute/Makefile @@ -129,7 +129,7 @@ librust_cosmwasm_enclave.so: $(CUSTOM_LIBRARY_PATH)/libenclave.a Enclave_t.o $(CXX) Enclave_t.o -o $@ $(RustEnclave_Link_Flags) $(CUSTOM_LIBRARY_PATH)/libenclave.a: $(CUSTOM_LIBRARY_PATH) $(Rust_Crate_Source) - RUST_TARGET_PATH=$(Rust_Target_Path) RUSTFLAGS=$(Rust_Flags) xargo build --features "$(FEATURES)" --target x86_64-unknown-linux-sgx -Z unstable-options --profile $(BUILD_PROFILE) --locked + RUST_TARGET_PATH=$(Rust_Target_Path) RUSTFLAGS=$(Rust_Flags) xargo build --features "$(FEATURES)" --target x86_64-unknown-linux-sgx -Z unstable-options --profile $(BUILD_PROFILE) cp ../target/x86_64-unknown-linux-sgx/$(BUILD_PROFILE)/libsecret_enclave.a $(CUSTOM_LIBRARY_PATH)/libenclave.a $(CUSTOM_LIBRARY_PATH): diff --git a/cosmwasm/packages/sgx-vm/Cargo.toml b/cosmwasm/packages/sgx-vm/Cargo.toml index 0e241885c..16d8e059e 100644 --- a/cosmwasm/packages/sgx-vm/Cargo.toml +++ b/cosmwasm/packages/sgx-vm/Cargo.toml @@ -61,7 +61,7 @@ enclave-ffi-types = { path = "../../enclaves/ffi-types", features = [ sgx_types = { path = "../../../third_party/incubator-teaclave-sgx-sdk/sgx_types" } sgx_urts = { path = "../../../third_party/incubator-teaclave-sgx-sdk/sgx_urts" } log = "0.4.20" -base64 = "0.21.3" +base64 = "0.21.6" parking_lot = "0.11" num_cpus = "1.16.0" diff --git a/deployment/dockerfiles/README.md b/deployment/dockerfiles/README.md new file mode 100644 index 000000000..bee280b21 --- /dev/null +++ b/deployment/dockerfiles/README.md @@ -0,0 +1,46 @@ +The build process for SN is a bit complex, and can include some unexpected parts for those that have not been baptised in the waters of TEEs. + +### Build Targets Overview +1. **`release-image`**: Creates a full node Docker image. +2. **`build-deb`**: Generates a Debian (.deb) package +3. **`build-deb-mainnet`**: Similar to `build-deb`, but specifically for generating a Debian package for mainnet. +4. **`compile-secretd`**: Produces an image with the compiled enclave and `secretd`, a core component of the Secret Network - sometimes you don't need the whole image, just secretd. + +### Build Process Description + +#### 1. **Base Images and Environment Setup** +- Defines two base images: + * `SCRT_BASE_IMAGE_ENCLAVE` - Used as the base for building the enclave components, which are crucial for the secure execution of code in an SGX (Software Guard Extensions) environment. + * `SCRT_RELEASE_BASE_IMAGE` - Serves as the base for the final release image that contains all the necessary components to run a full node. +- Sets up the environment for subsequent stages, including installing dependencies like `clang-10`, setting `WORKDIR`, and other environment variables. + +#### 2. **Compilation of Enclaves** +- **`prepare-compile-enclave` & `compile-enclave`**: Prepares the environment and compiles the enclaves. +- **`compile-tendermint-enclave`**: Compiles the Tendermint enclave, which is a part of the blockchain consensus mechanism. + +#### 3. **Compilation of `secretd`** +- Sets up the Go environment and downloads specific Go packages. +- Copies source files and prepares the environment for building `secretd`. +- Uses the compiled enclaves from previous steps. + +#### 4. **Release Image Creation (`release-image`)** +- Creates the final node image with all necessary binaries and libraries. +- Installs additional dependencies like `jq`, `openssl`, and Node.js - these are used for the faucet and for debugging tools. +- Sets up environment variables and links libraries. + +#### 5. **Mainnet Upgrade (`mainnet-release`)** +- Upgrades the `release-image` with specific binaries and libraries for the mainnet. + +#### 6. **Debian Package Creation (`build-deb` and `build-deb-mainnet`)** +- Prepares an environment for building Debian packages. +- Copies necessary binaries and libraries from previous stages. +- Executes a script to build the Debian package. + +#### 7. **Compilation of `check-hw` Tool (`compile-check-hw-tool`)** +- Compiles a hardware check tool, necessary for validating the hardware running the Secret Network nodes - this is unrelated to the release image or the network node directly. + +#### 8. **LocalSecret Setup (`build-localsecret`)** +- A specialized setup for a local version of the Secret Network, including a faucet server and a health check mechanism for local development. + +### Summary +Each target in this Dockerfile serves a distinct purpose in the build and deployment pipeline of the Secret Network. From compiling essential components like `secretd` and the Tendermint enclave, to packaging these components for deployment in various environments (development, mainnet), the Dockerfile covers a comprehensive range of tasks necessary for maintaining and deploying a blockchain network. The use of multi-stage builds optimizes the process by reusing stages and minimizing the final image size. diff --git a/docs/migrate_contract_v2.wasm b/docs/migrate_contract_v2.wasm new file mode 100755 index 000000000..067ed0aa0 Binary files /dev/null and b/docs/migrate_contract_v2.wasm differ diff --git a/docs/proposals/hardcode-admins-on-v1.10.md b/docs/proposals/hardcode-admins-on-v1.10.md index 456600f96..8751e238e 100644 --- a/docs/proposals/hardcode-admins-on-v1.10.md +++ b/docs/proposals/hardcode-admins-on-v1.10.md @@ -47,32 +47,32 @@ If this proposal passes, the list of contracts that will be hardcoded into the v | secret1tqmms5awftpuhalcv5h5mg76fa0tkdz4jv9ex4 | cw20-icw20 - The IBC contract that allows SNIP-20 tokens to be sent over IBC | $3,460 | 752 | [https://github.com/scrtlabs/cw-plus/tree/84384d2045905ce11590b28750a02a0475cfca3a/contracts/cw20-ics20](https://github.com/scrtlabs/cw-plus/tree/84384d2045905ce11590b28750a02a0475cfca3a/contracts/cw20-ics20) | Add memo support, which will allow sending SNIP-20 over IBC while using ibc-hooks to e.g. send stkd-SCRT to Osmosis, swap to SCRT and send back to Secret using just the one tx on Secret. | secret1lrnpnp6ltfxwuhjeaz97htnajh096q7y72rp5d | SCRT Labs Ledger | | secret1yxjmepvyl2c25vnt53cr2dpn8amknwausxee83 | ICS-20 contract for auto warpping Axelar tokens coming into Secret | $0 | 872 | [https://github.com/scrtlabs/ics20-for-axelar/tree/0546744edd1b90c5ad635713cbcc047a84f0551c](https://github.com/scrtlabs/ics20-for-axelar/tree/0546744edd1b90c5ad635713cbcc047a84f0551c) | Add memo support, which will allow sending Axelar tokens over IBC while using PFM to route to other chains, potentiaaly also using ibc-hooks and getting back to Secret. | secret1lrnpnp6ltfxwuhjeaz97htnajh096q7y72rp5d | SCRT Labs Ledger | | secret1hvg7am0cwfu6hfnjhere35kne23f3z6z80rlty | Mystic Skulls SNIP-721 | $0 | 218 | [https://github.com/baedrik/mystic-skulls/tree/97654409db23bd73aeedad38bac3aa98f3cd6e76/snip-721](https://github.com/baedrik/mystic-skulls/tree/97654409db23bd73aeedad38bac3aa98f3cd6e76/snip-721) | permit gameplay updates for alchemy, potions, etc... | secret1nnt3t7ms82vf86jwq88zvwvzvm2mkhxxtevzut | Individual (baedrik) | -| secret1tejwnma86amug6mfy74qhwclsx92zutd9rfquy | Rewards contracts for Blizzard Finance | $30,000 total | 941 | | Rescue community funds | secret1j7tmjrh5wkxf4yx0kas0ja4an6wktss7mvqenm | Individual (Ian) | -| secret1k5kn0a9gqap7uex0l2xj96sw6lxwqwsghewlvn | Rewards contracts for Blizzard Finance | ... | 942 | | Rescue community funds | secret1j7tmjrh5wkxf4yx0kas0ja4an6wktss7mvqenm | Individual (Ian) | -| secret139gyx9n6ahk7lnq0kt0nczt3tmruzmfx0fgk4h | Rewards contracts for Blizzard Finance | ... | 942 | | Rescue community funds | secret1j7tmjrh5wkxf4yx0kas0ja4an6wktss7mvqenm | Individual (Ian) | -| secret1kl86lu8v3mwkjhvvfrz3p60qvmsrtyxre6d7mj | Rewards contracts for Blizzard Finance | ... | 942 | | Rescue community funds | secret1j7tmjrh5wkxf4yx0kas0ja4an6wktss7mvqenm | Individual (Ian) | -| secret19qyld7sfp9xnh9qt8efllttdnxu5pt9vrmvulr | Rewards contracts for Blizzard Finance | ... | 942 | | Rescue community funds | secret1j7tmjrh5wkxf4yx0kas0ja4an6wktss7mvqenm | Individual (Ian) | -| secret1q08savjzkejanz2s7n56yn8ccekaj0h8d4xk7h | Rewards contracts for Blizzard Finance | ... | 942 | | Rescue community funds | secret1j7tmjrh5wkxf4yx0kas0ja4an6wktss7mvqenm | Individual (Ian) | -| secret1gt6g8dhdr4v7lhtkpxmvr8us9k9cd4zga7cnz9 | Rewards contracts for Blizzard Finance | ... | 942 | | Rescue community funds | secret1j7tmjrh5wkxf4yx0kas0ja4an6wktss7mvqenm | Individual (Ian) | -| secret19qyld7sfp9xnh9qt8efllttdnxu5pt9vrmvulr | Rewards contracts for Blizzard Finance | ... | 942 | | Rescue community funds | secret1j7tmjrh5wkxf4yx0kas0ja4an6wktss7mvqenm | Individual (Ian) | -| secret1v3uvahkhtzxnq0m767ekkmknlflh4y5nrvdy7l | Rewards contracts for Blizzard Finance | ... | 942 | | Rescue community funds | secret1j7tmjrh5wkxf4yx0kas0ja4an6wktss7mvqenm | Individual (Ian) | -| secret1fhh6fjy0wk25qcn6fd977cfwr0mzumkus33e75 | Rewards contracts for Blizzard Finance | ... | 942 | | Rescue community funds | secret1j7tmjrh5wkxf4yx0kas0ja4an6wktss7mvqenm | Individual (Ian) | -| secret1gel0l6qwjzwnhmu9egr4alzagg7h9g3a06pk9l | Rewards contracts for Blizzard Finance | ... | 963 | | Rescue community funds | secret1j7tmjrh5wkxf4yx0kas0ja4an6wktss7mvqenm | Individual (Ian) | -| secret1s6eugslqmwmpkd2gt29r02tr4v2sspcmf8rflw | Rewards contracts for Blizzard Finance | ... | 963 | | Rescue community funds | secret1j7tmjrh5wkxf4yx0kas0ja4an6wktss7mvqenm | Individual (Ian) | -| secret1l0nmjc3kv6s57pctm84g4w7nvsdkfsk9g84ewr | Rewards contracts for Blizzard Finance | ... | 963 | | Rescue community funds | secret1j7tmjrh5wkxf4yx0kas0ja4an6wktss7mvqenm | Individual (Ian) | -| secret1j9mv67qjrlcmlq7d5tdeau5s4zqm22p3880e8g | Rewards contracts for Blizzard Finance | ... | 963 | | Rescue community funds | secret1j7tmjrh5wkxf4yx0kas0ja4an6wktss7mvqenm | Individual (Ian) | -| secret1s06m6mjmvxnrpsr8dwkndeec40u65p4ll8cs72 | Rewards contracts for Blizzard Finance | ... | 963 | | Rescue community funds | secret1j7tmjrh5wkxf4yx0kas0ja4an6wktss7mvqenm | Individual (Ian) | -| secret1d3pjs4fh7ssjdlganmt55sm4j3gqml706ntedw | Rewards contracts for Blizzard Finance | ... | 963 | | Rescue community funds | secret1j7tmjrh5wkxf4yx0kas0ja4an6wktss7mvqenm | Individual (Ian) | -| secret1kd5jaxvz946scme034nrfnvp03dhct7r9tl52c | Rewards contracts for Blizzard Finance | ... | 963 | | Rescue community funds | secret1j7tmjrh5wkxf4yx0kas0ja4an6wktss7mvqenm | Individual (Ian) | -| secret1wjxyyklxerp00wqmc52hjxskjja5mwrm0pqy69 | Rewards contracts for Blizzard Finance | ... | 963 | | Rescue community funds | secret1j7tmjrh5wkxf4yx0kas0ja4an6wktss7mvqenm | Individual (Ian) | -| secret16tz5uwmv47v3jlln56fq5h2f6frl3a944ys3qk | Rewards contracts for Blizzard Finance | ... | 963 | | Rescue community funds | secret1j7tmjrh5wkxf4yx0kas0ja4an6wktss7mvqenm | Individual (Ian) | -| secret1h6g03h0uf9e59kmc40p7fc4kggjd4umw8u9tc6 | Rewards contracts for Blizzard Finance | ... | 963 | | Rescue community funds | secret1j7tmjrh5wkxf4yx0kas0ja4an6wktss7mvqenm | Individual (Ian) | -| secret13c7gglkw6hh6fl2gejswsz3pkcu00044zczrx9 | Rewards contracts for Blizzard Finance | ... | 963 | | Rescue community funds | secret1j7tmjrh5wkxf4yx0kas0ja4an6wktss7mvqenm | Individual (Ian) | -| secret1duqnqrsnzu53z6dpvegeqjfnrzfm7c3sq09hzr | Rewards contracts for Blizzard Finance | ... | 963 | | Rescue community funds | secret1j7tmjrh5wkxf4yx0kas0ja4an6wktss7mvqenm | Individual (Ian) | -| secret1d3ksc0tmq2352nj4ke64emxxtvlpp24spxklkf | Rewards contracts for Blizzard Finance | ... | 963 | | Rescue community funds | secret1j7tmjrh5wkxf4yx0kas0ja4an6wktss7mvqenm | Individual (Ian) | -| secret1krpyrk6r83fveu5w7ukp4v6833gf79kw9tm0mu | Rewards contracts for Blizzard Finance | ... | 963 | | Rescue community funds | secret1j7tmjrh5wkxf4yx0kas0ja4an6wktss7mvqenm | Individual (Ian) | -| secret1jzcxa66yw4vha92202pmzwwjanljh3mm6qte6m | Rewards contracts for Blizzard Finance | ... | 963 | | Rescue community funds | secret1j7tmjrh5wkxf4yx0kas0ja4an6wktss7mvqenm | Individual (Ian) | -| secret1fp4p5htcs9cpqw0n8mhm9zvjsu7mn2sdx5fqxt | Rewards contracts for Blizzard Finance | ... | 963 | | Rescue community funds | secret1j7tmjrh5wkxf4yx0kas0ja4an6wktss7mvqenm | Individual (Ian) | +| secret1tejwnma86amug6mfy74qhwclsx92zutd9rfquy | Rewards contracts for Blizzard Finance | $30,000 total | 941 | | Rescue community funds | secret1j7tmjrh5wkxf4yx0kas0ja4an6wktss7mvqenm | Corporation (Blizzard) | +| secret1k5kn0a9gqap7uex0l2xj96sw6lxwqwsghewlvn | Rewards contracts for Blizzard Finance | ... | 942 | | Rescue community funds | secret1j7tmjrh5wkxf4yx0kas0ja4an6wktss7mvqenm | Corporation (Blizzard) | +| secret139gyx9n6ahk7lnq0kt0nczt3tmruzmfx0fgk4h | Rewards contracts for Blizzard Finance | ... | 942 | | Rescue community funds | secret1j7tmjrh5wkxf4yx0kas0ja4an6wktss7mvqenm | Corporation (Blizzard) | +| secret1kl86lu8v3mwkjhvvfrz3p60qvmsrtyxre6d7mj | Rewards contracts for Blizzard Finance | ... | 942 | | Rescue community funds | secret1j7tmjrh5wkxf4yx0kas0ja4an6wktss7mvqenm | Corporation (Blizzard) | +| secret19qyld7sfp9xnh9qt8efllttdnxu5pt9vrmvulr | Rewards contracts for Blizzard Finance | ... | 942 | | Rescue community funds | secret1j7tmjrh5wkxf4yx0kas0ja4an6wktss7mvqenm | Corporation (Blizzard) | +| secret1q08savjzkejanz2s7n56yn8ccekaj0h8d4xk7h | Rewards contracts for Blizzard Finance | ... | 942 | | Rescue community funds | secret1j7tmjrh5wkxf4yx0kas0ja4an6wktss7mvqenm | Corporation (Blizzard) | +| secret1gt6g8dhdr4v7lhtkpxmvr8us9k9cd4zga7cnz9 | Rewards contracts for Blizzard Finance | ... | 942 | | Rescue community funds | secret1j7tmjrh5wkxf4yx0kas0ja4an6wktss7mvqenm | Corporation (Blizzard) | +| secret19qyld7sfp9xnh9qt8efllttdnxu5pt9vrmvulr | Rewards contracts for Blizzard Finance | ... | 942 | | Rescue community funds | secret1j7tmjrh5wkxf4yx0kas0ja4an6wktss7mvqenm | Corporation (Blizzard) | +| secret1v3uvahkhtzxnq0m767ekkmknlflh4y5nrvdy7l | Rewards contracts for Blizzard Finance | ... | 942 | | Rescue community funds | secret1j7tmjrh5wkxf4yx0kas0ja4an6wktss7mvqenm | Corporation (Blizzard) | +| secret1fhh6fjy0wk25qcn6fd977cfwr0mzumkus33e75 | Rewards contracts for Blizzard Finance | ... | 942 | | Rescue community funds | secret1j7tmjrh5wkxf4yx0kas0ja4an6wktss7mvqenm | Corporation (Blizzard) | +| secret1gel0l6qwjzwnhmu9egr4alzagg7h9g3a06pk9l | Rewards contracts for Blizzard Finance | ... | 963 | | Rescue community funds | secret1j7tmjrh5wkxf4yx0kas0ja4an6wktss7mvqenm | Corporation (Blizzard) | +| secret1s6eugslqmwmpkd2gt29r02tr4v2sspcmf8rflw | Rewards contracts for Blizzard Finance | ... | 963 | | Rescue community funds | secret1j7tmjrh5wkxf4yx0kas0ja4an6wktss7mvqenm | Corporation (Blizzard) | +| secret1l0nmjc3kv6s57pctm84g4w7nvsdkfsk9g84ewr | Rewards contracts for Blizzard Finance | ... | 963 | | Rescue community funds | secret1j7tmjrh5wkxf4yx0kas0ja4an6wktss7mvqenm | Corporation (Blizzard) | +| secret1j9mv67qjrlcmlq7d5tdeau5s4zqm22p3880e8g | Rewards contracts for Blizzard Finance | ... | 963 | | Rescue community funds | secret1j7tmjrh5wkxf4yx0kas0ja4an6wktss7mvqenm | Corporation (Blizzard) | +| secret1s06m6mjmvxnrpsr8dwkndeec40u65p4ll8cs72 | Rewards contracts for Blizzard Finance | ... | 963 | | Rescue community funds | secret1j7tmjrh5wkxf4yx0kas0ja4an6wktss7mvqenm | Corporation (Blizzard) | +| secret1d3pjs4fh7ssjdlganmt55sm4j3gqml706ntedw | Rewards contracts for Blizzard Finance | ... | 963 | | Rescue community funds | secret1j7tmjrh5wkxf4yx0kas0ja4an6wktss7mvqenm | Corporation (Blizzard) | +| secret1kd5jaxvz946scme034nrfnvp03dhct7r9tl52c | Rewards contracts for Blizzard Finance | ... | 963 | | Rescue community funds | secret1j7tmjrh5wkxf4yx0kas0ja4an6wktss7mvqenm | Corporation (Blizzard) | +| secret1wjxyyklxerp00wqmc52hjxskjja5mwrm0pqy69 | Rewards contracts for Blizzard Finance | ... | 963 | | Rescue community funds | secret1j7tmjrh5wkxf4yx0kas0ja4an6wktss7mvqenm | Corporation (Blizzard) | +| secret16tz5uwmv47v3jlln56fq5h2f6frl3a944ys3qk | Rewards contracts for Blizzard Finance | ... | 963 | | Rescue community funds | secret1j7tmjrh5wkxf4yx0kas0ja4an6wktss7mvqenm | Corporation (Blizzard) | +| secret1h6g03h0uf9e59kmc40p7fc4kggjd4umw8u9tc6 | Rewards contracts for Blizzard Finance | ... | 963 | | Rescue community funds | secret1j7tmjrh5wkxf4yx0kas0ja4an6wktss7mvqenm | Corporation (Blizzard) | +| secret13c7gglkw6hh6fl2gejswsz3pkcu00044zczrx9 | Rewards contracts for Blizzard Finance | ... | 963 | | Rescue community funds | secret1j7tmjrh5wkxf4yx0kas0ja4an6wktss7mvqenm | Corporation (Blizzard) | +| secret1duqnqrsnzu53z6dpvegeqjfnrzfm7c3sq09hzr | Rewards contracts for Blizzard Finance | ... | 963 | | Rescue community funds | secret1j7tmjrh5wkxf4yx0kas0ja4an6wktss7mvqenm | Corporation (Blizzard) | +| secret1d3ksc0tmq2352nj4ke64emxxtvlpp24spxklkf | Rewards contracts for Blizzard Finance | ... | 963 | | Rescue community funds | secret1j7tmjrh5wkxf4yx0kas0ja4an6wktss7mvqenm | Corporation (Blizzard) | +| secret1krpyrk6r83fveu5w7ukp4v6833gf79kw9tm0mu | Rewards contracts for Blizzard Finance | ... | 963 | | Rescue community funds | secret1j7tmjrh5wkxf4yx0kas0ja4an6wktss7mvqenm | Corporation (Blizzard) | +| secret1jzcxa66yw4vha92202pmzwwjanljh3mm6qte6m | Rewards contracts for Blizzard Finance | ... | 963 | | Rescue community funds | secret1j7tmjrh5wkxf4yx0kas0ja4an6wktss7mvqenm | Corporation (Blizzard) | +| secret1fp4p5htcs9cpqw0n8mhm9zvjsu7mn2sdx5fqxt | Rewards contracts for Blizzard Finance | ... | 963 | | Rescue community funds | secret1j7tmjrh5wkxf4yx0kas0ja4an6wktss7mvqenm | Corporation (Blizzard) | | secret1s09x2xvfd2lp2skgzm29w2xtena7s8fq98v852 | AMBER | 8888 AMBER | 563 | [https://github.com/scrtlabs/snip20-reference-impl/tree/66947912e69baf9ce879c9d37d60350bd164e9e9](https://github.com/scrtlabs/snip20-reference-impl/tree/66947912e69baf9ce879c9d37d60350bd164e9e9) | Add MetaMask permits & decoys | secret1jj30ulmuxem55awzhfnr802ml7rddufe0jadf7 | Individual (Kent) | | secret167wxv45r2m3r5krlwyjskrk4g5tvmksktvqe6t | ShadeLend Overseer | $6,000,000 | 920 | | Logic upgrade without impacting collateral / users | secret1y277c499f44nxe7geeaqw8t6gpge68rcpla9lf | ShadeDAO Multisig | | secret1qxk2scacpgj2mmm0af60674afl9e6qneg7yuny | Shade Single Vault Registry | $6,000,000 | 929 | | Logic upgrade without impacting collateral / users | secret1y277c499f44nxe7geeaqw8t6gpge68rcpla9lf | ShadeDAO Multisig | diff --git a/docs/proposals/v1.12.md b/docs/proposals/v1.12.md new file mode 100644 index 000000000..0e181f0c0 --- /dev/null +++ b/docs/proposals/v1.12.md @@ -0,0 +1,22 @@ +# Secret Network v1.12 Upgrade + +This proposal recommends that the chain undergo a software upgrade to version v1.12 of the Secret Network codebase on secret-4 block 11,136,666. The estimated time for the upgrade is **Tuesday, October 17, 2023, at ~2pm UTC**. + +Since block times can vary significantly, we advise monitoring the chain for a more precise upgrade time. ETA monitor: [mintscan.io](https://dev.mintscan.io/secret/blocks/11136666) or [ping.pub](https://ping.pub/secret/block/11136666). + +## Upgrade Highlights + +- Fix the hardcoded admins feature +- Add hardcoded admins according to proposals [269](https://dev.mintscan.io/secret/proposals/269) (Shillables) & [270](https://dev.mintscan.io/secret/proposals/270) (Sienna). +- Fix PFM to stop dropping packets of IBC contracts. + - This has always been a bug in PFM. It was introduced in v1.9 and was missed because of a bug in our CI system. + - Fixed the bug in PFM and updated the dependency. + - For more info see https://github.com/cosmos/ibc-apps/pull/105. +- Add `admin` to `WasmMsg::Instantiate` in cosmwasm-std (Thanks [@luca992](https://github.com/luca992)!). + - This allows contracts to specify an admin address when instantiating other contracts. + - See usage example [here](https://github.com/scrtlabs/SecretNetwork/blob/eedfac881/cosmwasm/contracts/v1/compute-tests/test-compute-contract/src/contract.rs#L245-L259). +- Update IBC to v4.5.0 + +## Upgrade Instructions + +See [docs.scrt.network](https://docs.scrt.network/secret-network-documentation/infrastructure/upgrade-instructions/v1.12) for upgrade instructions. diff --git a/docs/test-v1.12-upgrade-handler-premigrated-contract.md b/docs/test-v1.12-upgrade-handler-premigrated-contract.md new file mode 100644 index 000000000..7999df44a --- /dev/null +++ b/docs/test-v1.12-upgrade-handler-premigrated-contract.md @@ -0,0 +1,244 @@ +# How to test the v1.12 upgrade with LocalSecret + +## Step 1 + +### Start a v1.11 chain + +```bash +docker run -p 1316:1317 -it --name localsecret ghcr.io/scrtlabs/localsecret:v1.11.0-beta.19 +``` + +## Step 2 + +### Copy the supplied contract to the docker + +```bash +docker cp ./contract.wasm localsecret:/root/ +``` + +### Instantiate a contract with admin and get its address + +```bash +docker exec localsecret bash -c 'secretcli tx wasm store contract.wasm --from a --gas 5000000 -y -b block' +docker exec localsecret bash -c 'secretcli tx wasm init 1 "{\"nop\":{}}" --from a --label "xyz" -y -b block --admin secret1ap26qrlp8mcq2pg6r47w43l0y8zkqm8a450s03' +docker exec localsecret bash -c 'secretcli q wasm list-contract-by-code 1 | jq -r ".[0].contract_address"' +``` +Expected result should be: `secret1mfk7n6mc2cg6lznujmeckdh4x0a5ezf6hx6y8q` + +### Instantiate a second contract and get its address + +```bash +docker exec localsecret bash -c 'secretcli tx wasm init 1 "{\"nop\":{}}" --from a --label "premigrated" -y -b block --admin secret1ap26qrlp8mcq2pg6r47w43l0y8zkqm8a450s03' +docker exec localsecret bash -c 'secretcli q wasm list-contract-by-code 1 | jq -r ".[1].contract_address"' +``` +Expected result should be: `secret18wy2w4rzg9xxsm2ru8jq8tdq053h39epxvd4rl` + + +### Check that you're the admin + +On the first contract: +```bash +docker exec localsecret bash -c 'secretcli q wasm contract secret1mfk7n6mc2cg6lznujmeckdh4x0a5ezf6hx6y8q | jq -r .admin' +``` +Expected result should be: `secret1ap26qrlp8mcq2pg6r47w43l0y8zkqm8a450s03` + +On the second contract: +```bash +docker exec localsecret bash -c 'secretcli q wasm contract secret18wy2w4rzg9xxsm2ru8jq8tdq053h39epxvd4rl | jq -r .admin' +``` +Expected result should be: `secret1ap26qrlp8mcq2pg6r47w43l0y8zkqm8a450s03` + +## Step 3 +### Migrate the first contract on the v11 chain +```bash +docker cp ./migrate_contract_v2.wasm localsecret:/root/ +docker exec localsecret bash -c 'secretcli tx wasm store migrate_contract_v2.wasm --from a --gas 5000000 -y -b block' +docker exec localsecret bash -c 'secretcli tx wasm migrate secret1mfk7n6mc2cg6lznujmeckdh4x0a5ezf6hx6y8q 2 "{\"migrate\":{}}" --from a -y -b block' | jq -r .code +``` + +Expected result should be: `0` + +### Check that you can query and execute the contract +Query: +```bash +docker exec localsecret bash -c 'secretcli q wasm query secret1mfk7n6mc2cg6lznujmeckdh4x0a5ezf6hx6y8q "{\"get_env\":{}}"' +``` + +You should see something like this: +``` +{"block":{"height":104,"time":"1697457031504624271","chain_id":"secretdev-1"},"transaction":null,"contract":{"address":"secret1mfk7n6mc2cg6lznujmeckdh4x0a5ezf6hx6y8q","code_hash":"03974c32f672da9b34a9698b3f3e1e21366dac1bc611ba743ee72c9d16b6d1a8"}} +``` + +Execute: +```bash +docker exec localsecret bash -c 'secretcli tx wasm execute secret1mfk7n6mc2cg6lznujmeckdh4x0a5ezf6hx6y8q {\"new_function\":{}} --from a -y -b block' +``` + +The transaction should succeed (code 0) + +## Step 4 +### Compile a docker with version 12 of the network +Compile a v1.12 LocalSecret +```bash +DOCKER_TAG=v1.12-local make localsecret +``` +Alternatively, to save compilation, you can use this one: `http://ghcr.io/scrtlabs/localsecret:v1.12.0-eshel.1` + +## Step 5 +Copy binaries from the v1.12 LocalSecret to the running v1.11 LocalSecret. + +```bash +# Start a v1.12 chain and wait a bit for it to setup +docker run -it -d --name localsecret-1.12 ghcr.io/scrtlabs/localsecret:v1.12 +# or: docker run -it -d --name localsecret-1.12 ghcr.io/scrtlabs/localsecret:v1.12.0-eshel.1 +sleep 5 + +# Copy binaries from v1.12 chain to host (a limitation of `docker cp`) +rm -rf /tmp/upgrade-bin && mkdir -p /tmp/upgrade-bin +docker cp localsecret-1.12:/usr/bin/secretcli /tmp/upgrade-bin +docker cp localsecret-1.12:/usr/bin/secretd /tmp/upgrade-bin +docker cp localsecret-1.12:/usr/lib/librust_cosmwasm_enclave.signed.so /tmp/upgrade-bin +docker cp localsecret-1.12:/usr/lib/libgo_cosmwasm.so /tmp/upgrade-bin + +# Can kill localsecret-1.12 at this point +docker rm -f localsecret-1.12 + +# Copy binaries from host to current v1.11 chain +docker exec localsecret bash -c 'rm -rf /tmp/upgrade-bin && mkdir -p /tmp/upgrade-bin' + +docker cp /tmp/upgrade-bin/secretcli localsecret:/tmp/upgrade-bin +docker cp /tmp/upgrade-bin/secretd localsecret:/tmp/upgrade-bin +docker cp /tmp/upgrade-bin/librust_cosmwasm_enclave.signed.so localsecret:/tmp/upgrade-bin +docker cp /tmp/upgrade-bin/libgo_cosmwasm.so localsecret:/tmp/upgrade-bin + +# Overwrite v1.11 binaries with v1.12 binaries without affecting file permissions +# v1.11 chain is still running at this point +# we assume v1.11 binaries are loaded to RAM +# so overwriting them with v1.12 binaries won't take effect until a process restart + +docker exec localsecret bash -c 'cat /tmp/upgrade-bin/secretcli > /usr/bin/secretcli' +docker exec localsecret bash -c 'cat /tmp/upgrade-bin/librust_cosmwasm_enclave.signed.so > /usr/lib/librust_cosmwasm_enclave.signed.so' +docker exec localsecret bash -c 'cat /tmp/upgrade-bin/libgo_cosmwasm.so > /usr/lib/libgo_cosmwasm.so' + +# We cannot overwrite secretd because it's being used ("Text file busy") +# so instead we're going to point the init script to the new binary + +# don't setup secretcli +docker exec localsecret bash -c $'perl -i -pe \'s/^.*?secretcli.*$//\' bootstrap_init.sh' + +# point script to the v1.12 secretd file +docker exec localsecret bash -c $'perl -i -pe \'s;secretd start;/tmp/upgrade-bin/secretd start;\' bootstrap_init.sh' +``` + +## Step 6 + +Propose a software upgrade on the v1.11 chain. + +```bash +# 20 blocks (2 minutes) until upgrade block +UPGRADE_BLOCK="$(docker exec localsecret bash -c 'secretcli status | jq "(.SyncInfo.latest_block_height | tonumber) + 20"')" + +# Propose upgrade +PROPOSAL_ID="$(docker exec localsecret bash -c "secretcli tx gov submit-proposal software-upgrade v1.12 --upgrade-height $UPGRADE_BLOCK --title blabla --description yolo --deposit 100000000uscrt --from a -y -b block | jq '.logs[0].events[] | select(.type == \"submit_proposal\") | .attributes[] | select(.key == \"proposal_id\") | .value | tonumber'")" + +# Vote yes (voting period is 90 seconds) +docker exec localsecret bash -c "secretcli tx gov vote ${PROPOSAL_ID} yes --from a -y -b block" + +echo "PROPOSAL_ID = ${PROPOSAL_ID}" +echo "UPGRADE_BLOCK = ${UPGRADE_BLOCK}" +``` + +## Step 7 + +Apply the upgrade. + +Wait until you see `ERR CONSENSUS FAILURE!!! err="UPGRADE \"v1.12\" NEEDED at height` in the logs, then run: + +```bash +docker stop localsecret +docker start localsecret -a +``` + +You should see `INF applying upgrade "v1.12" at height` in the logs, followed by blocks continuing to stream. + +## Step 8 + +### Check that you can still query/execute the migrated contract + +Query: +```bash +docker exec localsecret bash -c 'secretcli q wasm query secret1mfk7n6mc2cg6lznujmeckdh4x0a5ezf6hx6y8q "{\"get_env\":{}}"' +``` + +You should see something like this: +``` +{"block":{"height":104,"time":"1697457031504624271","chain_id":"secretdev-1"},"transaction":null,"contract":{"address":"secret1mfk7n6mc2cg6lznujmeckdh4x0a5ezf6hx6y8q","code_hash":"03974c32f672da9b34a9698b3f3e1e21366dac1bc611ba743ee72c9d16b6d1a8"}} +``` + +Execute: +```bash +docker exec localsecret bash -c 'secretcli tx wasm execute secret1mfk7n6mc2cg6lznujmeckdh4x0a5ezf6hx6y8q {\"new_function\":{}} --from a -y -b block' +``` + +The transaction should succeed (code 0) + +### Upgrade the second contract + +```bash +docker exec localsecret bash -c 'secretcli tx wasm migrate secret18wy2w4rzg9xxsm2ru8jq8tdq053h39epxvd4rl 2 "{\"migrate\":{}}" --from a -y -b block' | jq -r .code +``` + +Expected result should be: `0` + +### Check that you can query/execute the contract which was migrated on v1.12 + +Query: +```bash +docker exec localsecret bash -c 'secretcli q wasm query secret18wy2w4rzg9xxsm2ru8jq8tdq053h39epxvd4rl "{\"get_env\":{}}"' +``` + +You should see something like this: +``` +{"block":{"height":104,"time":"1697457031504624271","chain_id":"secretdev-1"},"transaction":null,"contract":{"address":"secret18wy2w4rzg9xxsm2ru8jq8tdq053h39epxvd4rl","code_hash":"03974c32f672da9b34a9698b3f3e1e21366dac1bc611ba743ee72c9d16b6d1a8"}} +``` + +Execute: +```bash +docker exec localsecret bash -c 'secretcli tx wasm execute secret18wy2w4rzg9xxsm2ru8jq8tdq053h39epxvd4rl {\"new_function\":{}} --from a -y -b block' +``` + +The transaction should succeed (code 0) + +### Check the contract history + +```bash +docker exec localsecret bash -c 'secretcli q wasm contract-history secret1mfk7n6mc2cg6lznujmeckdh4x0a5ezf6hx6y8q' | jq +docker exec localsecret bash -c 'secretcli q wasm contract-history secret18wy2w4rzg9xxsm2ru8jq8tdq053h39epxvd4rl' | jq +``` + +Expected result should look like this: + +```json +{ + "entries": [ + { + "operation": "CONTRACT_CODE_HISTORY_OPERATION_TYPE_INIT", + "code_id": "1", + "updated": { + "block_height": "6", + "tx_index": "0" + }, + "msg": "/307FYU9h9g96KS4Mz9jEarU+2a71zcm3WMgx+0Gmm6gCbZNrWqp6+IIdiaiZzzhNkC9C7jFAMewHrtCcYfCY5XlqRJku7TPYYlr5K2rHctP7QLXMk1VMeh5zXR9S2rrX5DJxIb1uTElFHhqBnfPQl004eHxmvFblWmtGJVIpoRzjqU7yokrCYEJK6d1i876QHhilFRPAIW/3A==" + }, + { + "operation": "CONTRACT_CODE_HISTORY_OPERATION_TYPE_MIGRATE", + "code_id": "2", + "updated": { + "block_height": "243", + "tx_index": "0" + }, + "msg": "0eoOpwuUcXE6u05CVy7o5CPln5L/c/uyh1qEOKkYyoigCbZNrWqp6+IIdiaiZzzhNkC9C7jFAMewHrtCcYfCY+PsNVSw+7DTG9zXdU2ZINEW+EN4IjDXPqnZF5shanRnFJ6oRLt7K6Jel8nB36/fyAdkZfeQK+6PT6eOT40Gp6HRYi7jh85Yh0CJVUL2kO6fVBP1dpg6QAJAtw==" + } + ] +} +``` diff --git a/go-cosmwasm/types/systemerror.go b/go-cosmwasm/types/systemerror.go index 064c9ae18..65aaf886e 100644 --- a/go-cosmwasm/types/systemerror.go +++ b/go-cosmwasm/types/systemerror.go @@ -90,8 +90,8 @@ func (e ExceededRecursionLimit) Error() string { return "unknown system error" } -// ToSystemError will try to convert the given error to an SystemError. -// This is important to returning any Go error back to Rust. +// ToSystemError will try to convert the given error to a SystemError. +// This is important for returning any Go error back to Rust. // // If it is already StdError, return self. // If it is an error, which could be a sub-field of StdError, embed it. diff --git a/go.mod b/go.mod index 3ed581e70..12eb16fce 100644 --- a/go.mod +++ b/go.mod @@ -18,12 +18,12 @@ require ( github.com/cosmos/cosmos-sdk v0.45.16 github.com/cosmos/go-bip39 v1.0.0 // PFM: v4.1.0 + this fix https://github.com/cosmos/ibc-apps/pull/105 - github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v4 v4.1.1-0.20230928173532-c135aff96b70 - github.com/cosmos/ibc-go/v4 v4.5.0 + github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v4 v4.1.1 + github.com/cosmos/ibc-go/v4 v4.5.1 github.com/gogo/protobuf v1.3.3 github.com/golang/protobuf v1.5.3 github.com/google/gofuzz v1.2.0 - github.com/gorilla/mux v1.8.0 + github.com/gorilla/mux v1.8.1 github.com/grpc-ecosystem/grpc-gateway v1.16.0 github.com/miscreant/miscreant.go v0.0.0-20200214223636-26d376326b75 github.com/pkg/errors v0.9.1 @@ -38,7 +38,7 @@ require ( github.com/stretchr/testify v1.8.4 github.com/tendermint/tendermint v0.34.27 github.com/tendermint/tm-db v0.6.7 - golang.org/x/crypto v0.14.0 + golang.org/x/crypto v0.16.0 golang.org/x/exp v0.0.0-20230905200255-921286631fa9 gonum.org/v1/gonum v0.14.0 google.golang.org/genproto v0.0.0-20230913181813-007df8e322eb // indirect @@ -47,7 +47,7 @@ require ( ) require ( - golang.org/x/text v0.13.0 + golang.org/x/text v0.14.0 google.golang.org/genproto/googleapis/api v0.0.0-20230913181813-007df8e322eb ) @@ -155,9 +155,9 @@ require ( go.etcd.io/bbolt v1.3.6 // indirect go.uber.org/atomic v1.10.0 // indirect go.uber.org/multierr v1.9.0 // indirect - golang.org/x/net v0.15.0 // indirect - golang.org/x/sys v0.13.0 // indirect - golang.org/x/term v0.13.0 // indirect + golang.org/x/net v0.17.0 // indirect + golang.org/x/sys v0.15.0 // indirect + golang.org/x/term v0.15.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20230920204549-e6e6cdab5c13 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect diff --git a/go.sum b/go.sum index 3ce070836..1c352e884 100644 --- a/go.sum +++ b/go.sum @@ -241,10 +241,10 @@ github.com/cosmos/gorocksdb v1.2.0 h1:d0l3jJG8M4hBouIZq0mDUHZ+zjOx044J3nGRskwTb4 github.com/cosmos/gorocksdb v1.2.0/go.mod h1:aaKvKItm514hKfNJpUJXnnOWeBnk2GL4+Qw9NHizILw= github.com/cosmos/iavl v0.19.6 h1:XY78yEeNPrEYyNCKlqr9chrwoeSDJ0bV2VjocTk//OU= github.com/cosmos/iavl v0.19.6/go.mod h1:X9PKD3J0iFxdmgNLa7b2LYWdsGd90ToV5cAONApkEPw= -github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v4 v4.1.1-0.20230928173532-c135aff96b70 h1:7e4y8TtiTGj2lIGVZZ6Gjp1DhK+CtOtf/Y3AxKmniZw= -github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v4 v4.1.1-0.20230928173532-c135aff96b70/go.mod h1:mFk2qfXAm7ndXQQuXUGm9tlC2OM9jxPQb5PRKEHNU5I= -github.com/cosmos/ibc-go/v4 v4.5.0 h1:pjYO0/PbqbRxcRyptwjA6M4hUSnzxEoGp5G56/VVQoQ= -github.com/cosmos/ibc-go/v4 v4.5.0/go.mod h1:2EOi40Bx/j6rJrtP1ui8k8yUAMpGybmL1EjakYqYv5U= +github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v4 v4.1.1 h1:TeiMKG56Kg+lqw/+08dfusInebjVagr9v75sP2GJo6w= +github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v4 v4.1.1/go.mod h1:mFk2qfXAm7ndXQQuXUGm9tlC2OM9jxPQb5PRKEHNU5I= +github.com/cosmos/ibc-go/v4 v4.5.1 h1:+P73X7aIikGAXBUJ9vP9rEbvdSuekt3KGXmAWCSYets= +github.com/cosmos/ibc-go/v4 v4.5.1/go.mod h1:2EOi40Bx/j6rJrtP1ui8k8yUAMpGybmL1EjakYqYv5U= github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= @@ -508,8 +508,9 @@ github.com/gorilla/handlers v1.5.1 h1:9lRY6j8DEeeBT10CvO9hGW0gmky0BprnvDI5vfhUHH github.com/gorilla/handlers v1.5.1/go.mod h1:t8XrUpc4KVXb7HGyJ4/cEnwQiaxrX/hz1Zv/4g96P1Q= github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= -github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI= github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= +github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY= +github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ= github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= @@ -1115,8 +1116,8 @@ golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc= -golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= +golang.org/x/crypto v0.16.0 h1:mMMrFzRSCF0GvB7Ne27XVtVAaXLrPmgPC7/v0tkwHaY= +golang.org/x/crypto v0.16.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -1217,8 +1218,8 @@ golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qx golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/net v0.15.0 h1:ugBLEUaxABaB5AJqW9enI0ACdci2RUd4eP51NTBvuJ8= -golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk= +golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= +golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -1326,13 +1327,13 @@ golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220209214540-3681064d5158/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= -golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= +golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.13.0 h1:bb+I9cTfFazGW51MZqBVmZy7+JEJMouUHTUSKVQLBek= -golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U= +golang.org/x/term v0.15.0 h1:y/Oo/a/q3IXu26lQgl04j/gjuBDOBlx7X6Om1j2CPW4= +golang.org/x/term v0.15.0/go.mod h1:BDl952bC7+uMoWR75FIrCDx79TPU9oHkTZ9yRbYOrX0= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -1342,8 +1343,8 @@ golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= -golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= diff --git a/scripts/install-sgx.sh b/scripts/install-sgx.sh index 5876c4127..d08342a66 100755 --- a/scripts/install-sgx.sh +++ b/scripts/install-sgx.sh @@ -6,123 +6,108 @@ INSTALL_DEPS=${1:-"true"} INSTALL_SDK=${2:-"true"} INSTALL_PSW=${3:-"true"} INSTALL_DRIVER=${4:-"true"} -UBUNTUVERSION=$(lsb_release -r -s | cut -d '.' -f 1) +UBUNTUVERSION=$(grep 'VERSION_ID' /etc/os-release | cut -d '"' -f 2 | cut -d '.' -f 1) +# Check for root privileges if [ "$(id -u)" -ne 0 ]; then echo -e 'Script must be run as root. Use sudo, su, or add "USER root" to your Dockerfile before running this script.' exit 1 fi +# Check if the Ubuntu version is supported if (($UBUNTUVERSION < 16)); then - echo "Your version of Ubuntu is not supported. Must have Ubuntu 16.04 and up. Aborting installation script..." - exit 1 + echo "Your version of Ubuntu is not supported. Must have Ubuntu 16.04 and up. Aborting installation script..." + exit 1 elif (($UBUNTUVERSION < 18)); then - DISTRO='xenial' + DISTRO='xenial' elif (($UBUNTUVERSION < 20)); then - DISTRO='bionic' - OS='ubuntu18.04-server' + DISTRO='bionic' + OS='ubuntu18.04-server' elif (($UBUNTUVERSION < 22)); then - DISTRO='focal' - OS='ubuntu20.04-server' + DISTRO='focal' + OS='ubuntu20.04-server' else - DISTRO='jammy' - OS='ubuntu22.04-server' + DISTRO='jammy' + OS='ubuntu22.04-server' fi +# Function to install missing packages deps() { echo "\n\n#######################################" echo "##### Installing missing packages #####" echo "#######################################\n\n" - # Install needed packages for script - sudo apt install -y make wget + apt-get update + apt-get install -y make wget } +# Function to install the SDK install_sdk(){ - # Create a working directory to download and install the SDK inside - mkdir -p "$HOME/.sgxsdk" - - # In a new sub-shell cd into our working directory so to no pollute the - # original shell's working directory - cd "$HOME/.sgxsdk" - - wget -O sgx_linux_x64_sdk_2.13.100.4.bin https://download.01.org/intel-sgx/sgx-linux/2.17.1/distro/ubuntu20.04-server/sgx_linux_x64_sdk_2.17.101.1.bin + echo "\n\n############################################" + echo "##### Installing Intel SGX SDK #####" + echo "############################################\n\n" - # Make the driver and SDK installers executable - chmod +x ./sgx_linux_*.bin + mkdir -p "$HOME/.sgxsdk" + cd "$HOME/.sgxsdk" - # Install the SDK in /opt/intel/sgxsdk - (echo no; echo /opt/intel/) | ./sgx_linux_x64_sdk_2.13.100.4.bin - - # Setup the environment variables for every new shell - echo "source '/opt/intel/.sgxsdk/sgxsdk/environment'" | - tee -a "$HOME/.bashrc" "$HOME/.zshrc" > /dev/null + wget -O sgx_linux_x64_sdk_2.17.101.1.bin "https://download.01.org/intel-sgx/sgx-linux/2.17.1/distro/ubuntu20.04-server/sgx_linux_x64_sdk_2.17.101.1.bin" + chmod +x ./sgx_linux_x64_sdk_*.bin + (echo no; echo /opt/intel/) | ./sgx_linux_x64_sdk_2.13.100.4.bin + echo "source '/opt/intel/sgxsdk/environment'" | tee -a "$HOME/.bashrc" "$HOME/.zshrc" > /dev/null } +# Function to install the SGX driver install_sgx_driver(){ - echo "\n\n###############################################" - echo "##### Installing Intel SGX driver #####" - echo "###############################################\n\n" - - wget -O sgx_linux_x64_driver_2.11.0_0373e2e.bin https://download.01.org/intel-sgx/sgx-linux/2.13/distro/ubuntu20.04-server/sgx_linux_x64_driver_2.11.0_0373e2e.bin - - # Install the driver - sudo ./sgx_linux_x64_driver_*.bin - - # Remount /dev as exec, also at system startup - sudo tee /etc/systemd/system/remount-dev-exec.service >/dev/null < /etc/systemd/system/remount-dev-exec.service <