Skip to content

Commit

Permalink
Merge upstream (#4)
Browse files Browse the repository at this point in the history
* rename states: tokens -> nft_info, contract_info -> collection_info

* renamed structs and deprecate: TokenInfo -> NftInfo, ContractInfo -> CollectionInfo, ContractInfoResponse -> CollectionInfoResponse

* cargo schema

* change storage keys for collection info and nft info, consider in migration and keep legacy data for backward migration

* use PA repo for `cw-ownable`

* rename generics and make more readable

* CollectionInfoResponse -> CollectionInfo

* add CollectionInfoExtension with RoyaltyInfo

* cargo schema

* typo

* cleanup

* rename

* cargo schema

* cleanup

* creator and owner changes:
- new query GetMinterOwnership and GetCreatorOwnership, deprecated Ownership
- new execute UpdateMinterOwnership and UpdateCreatorOwnership, deprecate UpdateOwnership
- dedicated stores for minter and creator, where creator usess by default cw_ownable singleton!
- new migrate msg allowing to reset creator and minter
- cleanup migration and split legacy part to dedicated functions
- also make sure using decicated CREATOR and MINTER stores and NOT use cw_ownable::...

* refactor and move key logic to cw721 package:
- move logic from cw721-base to cw721
- merge cw721-base and cw721-metadata-onchain into one, distinction is: `extension: T` where T for base contract is `type DefaultMetadataExtension = Option<Metadata>`
- all logic now in default implementation for traits Cw721Execute and Cw721Query

* fix ci

* cargo fmt

* cargo fmt + clippy

* cargo fmt

* cargo schema

* cargo clippy

* undo: do not rename token keys

* fix unit test

* remove useless generic `TMetadataResponse`

* remove response structs to msg.rs

* cargo schema

* move to dedicated fn

* docs

* rename

* cargo clippy

* add build script

* undo collection info extension and royalty info additions, will be added in next pr

* cleanup

* generate schemas for entry points, cleanup

* update rustc 1.65 -> 1.71

* update cosmwasm version 1.2 -> 1.5, due to rustc compiler issues
see also: CosmWasm/cosmwasm#1727

* update optimizer

* update rustc 1.71 -> 1.78

* use optimizer

* formatting

* install rustup first

* set $HOME/.cargo/env

* install libgcc

* install build-base

* cleanup

* cleanup

* Sync cw1155 with upstream (#5)

* wip: sync up cw1155 with upstream improvements from cw-awesome

* fix build errors/tests

---------

Co-authored-by: mr-t <mr-t@arkprotocol.io>
  • Loading branch information
dirtyshab and taitruong authored Jul 8, 2024
1 parent 07105d8 commit 46136ba
Show file tree
Hide file tree
Showing 129 changed files with 10,640 additions and 11,379 deletions.
125 changes: 82 additions & 43 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ workflows:
- contract_cw1155_metadata_onchain
- contract_cw1155_royalties
- contract_cw721_base
- contract_cw721_metadata_onchain
- contract_cw721_expiration
- contract_cw721_fixed_price
- contract_cw721_receiver_tester
- package_cw721
- package_cw1155
- lint
Expand Down Expand Up @@ -133,7 +134,7 @@ jobs:

contract_cw721_base:
docker:
- image: rust:1.65.0
- image: rust:1.78.0
working_directory: ~/project/contracts/cw721-base
steps:
- checkout:
Expand All @@ -143,7 +144,31 @@ jobs:
command: rustc --version; cargo --version; rustup --version
- restore_cache:
keys:
- cargocache-cw721-base-rust:1.65.0-{{ checksum "~/project/Cargo.lock" }}
- cargocache-cw721-base-rust:1.78.0-{{ checksum "~/project/Cargo.lock" }}
- run:
name: Unit Tests
environment:
RUST_BACKTRACE: 1
command: cargo unit-test --locked
- save_cache:
paths:
- /usr/local/cargo/registry
- target
key: cargocache-cw721-base-rust:1.78.0-{{ checksum "~/project/Cargo.lock" }}

contract_cw721_expiration:
docker:
- image: rust:1.78.0
working_directory: ~/project/contracts/cw721-expiration
steps:
- checkout:
path: ~/project
- run:
name: Version information
command: rustc --version; cargo --version; rustup --version
- restore_cache:
keys:
- cargocache-cw721-expiration-rust:1.78.0-{{ checksum "~/project/Cargo.lock" }}
- run:
name: Unit Tests
environment:
Expand All @@ -165,12 +190,12 @@ jobs:
paths:
- /usr/local/cargo/registry
- target
key: cargocache-cw721-base-rust:1.65.0-{{ checksum "~/project/Cargo.lock" }}
key: cargocache-cw721-expiration-rust:1.78.0-{{ checksum "~/project/Cargo.lock" }}

contract_cw721_metadata_onchain:
contract_cw721_fixed_price:
docker:
- image: rust:1.65.0
working_directory: ~/project/contracts/cw721-metadata-onchain
- image: rust:1.78.0
working_directory: ~/project/contracts/cw721-fixed-price
steps:
- checkout:
path: ~/project
Expand All @@ -179,7 +204,7 @@ jobs:
command: rustc --version; cargo --version; rustup --version
- restore_cache:
keys:
- cargocache-cw721-metadata-onchain-rust:1.65.0-{{ checksum "~/project/Cargo.lock" }}
- cargocache-cw721-fixed-price-rust:1.78.0-{{ checksum "~/project/Cargo.lock" }}
- run:
name: Unit Tests
environment:
Expand All @@ -201,12 +226,12 @@ jobs:
paths:
- /usr/local/cargo/registry
- target
key: cargocache-cw721-metadata-onchain-rust:1.65.0-{{ checksum "~/project/Cargo.lock" }}
key: cargocache-cw721-fixed-price-rust:1.78.0-{{ checksum "~/project/Cargo.lock" }}

contract_cw721_fixed_price:
contract_cw721_receiver_tester:
docker:
- image: rust:1.65.0
working_directory: ~/project/contracts/cw721-fixed-price
- image: rust:1.78.0
working_directory: ~/project/contracts/cw721-receiver-tester
steps:
- checkout:
path: ~/project
Expand All @@ -215,7 +240,7 @@ jobs:
command: rustc --version; cargo --version; rustup --version
- restore_cache:
keys:
- cargocache-cw721-fixed-price-rust:1.65.0-{{ checksum "~/project/Cargo.lock" }}
- cargocache-cw721-receiver-tester-rust:1.78.0-{{ checksum "~/project/Cargo.lock" }}
- run:
name: Unit Tests
environment:
Expand All @@ -237,11 +262,11 @@ jobs:
paths:
- /usr/local/cargo/registry
- target
key: cargocache-cw721-fixed-price-rust:1.65.0-{{ checksum "~/project/Cargo.lock" }}
key: cargocache-cw721-receiver-tester-rust:1.78.0-{{ checksum "~/project/Cargo.lock" }}

package_cw721:
docker:
- image: rust:1.65.0
- image: rust:1.78.0
working_directory: ~/project/packages/cw721
steps:
- checkout:
Expand Down Expand Up @@ -315,15 +340,15 @@ jobs:

lint:
docker:
- image: rust:1.65.0
- image: rust:1.78.0
steps:
- checkout
- run:
name: Version information
command: rustc --version; cargo --version; rustup --version; rustup target list --installed
- restore_cache:
keys:
- cargocache-v2-lint-rust:1.65.0-{{ checksum "Cargo.lock" }}
- cargocache-v2-lint-rust:1.78.0-{{ checksum "Cargo.lock" }}
- run:
name: Add rustfmt component
command: rustup component add rustfmt
Expand All @@ -342,47 +367,61 @@ jobs:
- target/debug/.fingerprint
- target/debug/build
- target/debug/deps
key: cargocache-v2-lint-rust:1.65.0-{{ checksum "Cargo.lock" }}
key: cargocache-v2-lint-rust:1.78.0-{{ checksum "Cargo.lock" }}

# This runs one time on the top level to ensure all contracts compile properly into wasm.
# We don't run the wasm build per contract build, and then reuse a lot of the same dependencies, so this speeds up CI time
# for all the other tests.
# We also sanity-check the resultant wasm files.
wasm-build:
docker:
- image: rust:1.65.0
# Image from https://github.com/cibuilds/github, based on alpine
- image: cibuilds/github:0.13
steps:
- checkout:
path: ~/project
- run:
name: Version information
command: rustc --version; cargo --version; rustup --version
- restore_cache:
keys:
- cargocache-wasm-rust:1.65.0-{{ checksum "~/project/Cargo.lock" }}
name: Install Docker client, rust/cargo libs (build-base)
command: apk add docker-cli build-base
- setup_remote_docker
- checkout
- run:
name: Add wasm32 target
command: rustup target add wasm32-unknown-unknown
# We cannot mount local folders, see https://circleci.com/docs/2.0/building-docker-images/#mounting-folders
name: Prepare volume with source code
command: |
# create a dummy container which will hold a volume with config
docker create -v /code --name with_code alpine /bin/true
# copy a config file into this volume
docker cp Cargo.toml with_code:/code
docker cp Cargo.lock with_code:/code
# copy code into this volume
docker cp ./contracts with_code:/code
docker cp ./packages with_code:/code
- run:
name: Build and optimize contracts
command: |
docker run --volumes-from with_code cosmwasm/workspace-optimizer:0.16.0
docker cp with_code:/code/artifacts ./artifacts
- run:
name: Build Wasm Release
name: List artifacts and checksums
command: |
for C in ./contracts/*/
do
echo "Compiling `basename $C`..."
(cd $C && cargo build --release --target wasm32-unknown-unknown --lib --locked)
done
ls -l artifacts
cat artifacts/checksums.txt
- run:
name: Install check_contract
name: Install Rust and Cargo
command: |
curl https://sh.rustup.rs -sSf | sh -s -- -y
source $HOME/.cargo/env
rustup target add wasm32-unknown-unknown
- run:
name: Install cosmwasm-check
# Uses --debug for compilation speed
command: cargo install --debug --version 1.1.0 --locked -- cosmwasm-check
- save_cache:
paths:
- /usr/local/cargo/registry
- target
key: cargocache-wasm-rust:1.65.0-{{ checksum "~/project/Cargo.lock" }}
command: |
source $HOME/.cargo/env
cargo install --debug --version 1.1.0 --locked cosmwasm-check
- run:
name: Check wasm contracts
command: cosmwasm-check ./target/wasm32-unknown-unknown/release/*.wasm
command: |
source $HOME/.cargo/env
cosmwasm-check ./artifacts/*.wasm
# This job roughly follows the instructions from https://circleci.com/blog/publishing-to-github-releases-via-circleci/
build_and_upload_contracts:
Expand Down Expand Up @@ -410,7 +449,7 @@ jobs:
- run:
name: Build development contracts
command: |
docker run --volumes-from with_code cosmwasm/workspace-optimizer:0.12.13
docker run --volumes-from with_code cosmwasm/workspace-optimizer:0.16.0
docker cp with_code:/code/artifacts ./artifacts
- run:
name: Show data
Expand Down
Loading

0 comments on commit 46136ba

Please sign in to comment.