Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Virus contract #1564

Merged
merged 3 commits into from
Jan 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ workflows:
- contract_queue
- contract_reflect
- contract_staking
- contract_virus
- fmt
- fmt_extra
- clippy:
Expand Down Expand Up @@ -138,6 +139,9 @@ jobs:
keys:
- v4-arm64-contracts-rust:1.60.0-{{ checksum "contracts/crypto-verify/Cargo.lock" }}-{{ checksum "contracts/hackatom/Cargo.lock" }}-{{ checksum "contracts/queue/Cargo.lock" }}-{{ checksum "contracts/reflect/Cargo.lock" }}-{{ checksum "contracts/staking/Cargo.lock" }}
- v4-arm64-contracts-rust:1.60.0-
# Test a few contracts that do something potentially interesting in the VM
# to test contract execution on ARM64.
# No need to add all contracts here.
- run:
name: "contracts/crypto-verify: integration-test"
working_directory: ~/project/contracts/crypto-verify
Expand Down Expand Up @@ -761,6 +765,33 @@ jobs:
- target/wasm32-unknown-unknown/release/deps
key: cargocache-v2-contract_staking-rust:1.60.0-{{ checksum "Cargo.lock" }}

contract_virus:
docker:
- image: rust:1.60.0
environment:
RUST_BACKTRACE: 1
working_directory: ~/cosmwasm/contracts/virus
steps:
- checkout:
path: ~/cosmwasm
- run:
name: Version information
command: rustc --version; cargo --version; rustup --version
- restore_cache:
keys:
- cargocache-v2-contract_virus-rust:1.60.0-{{ checksum "Cargo.lock" }}
- check_contract
- save_cache:
paths:
- /usr/local/cargo/registry
- target/debug/.fingerprint
- target/debug/build
- target/debug/deps
- target/wasm32-unknown-unknown/release/.fingerprint
- target/wasm32-unknown-unknown/release/build
- target/wasm32-unknown-unknown/release/deps
key: cargocache-v2-contract_virus-rust:1.60.0-{{ checksum "Cargo.lock" }}

fmt:
docker:
- image: rust:1.60.0
Expand Down
8 changes: 8 additions & 0 deletions contracts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ Introducing the development contracts in the order they were created.
9. **cyberpunk** is an attempt to cleanup hackatom and make writing runtime
tests (cosmwasm-vm/wamsmvm) easier by avoid the need for the escrow setup
that hackatom has.
10. **virus** is a contract that reproduces itself and does nothing useful
beyond that, showing how to use instantiate2 from a contract.

## Optimized builds

Expand Down Expand Up @@ -92,6 +94,11 @@ docker run --rm -v "$(pwd)":/code \
--mount type=volume,source="devcontract_cache_staking",target=/code/contracts/staking/target \
--mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \
cosmwasm/rust-optimizer:0.12.9 ./contracts/staking

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

## Entry points
Expand All @@ -107,3 +114,4 @@ points in order to demonstrate and test the flexibility we have.
| queue | yes | yes |
| reflect | yes | no |
| staking | yes | no |
| virus | no | no |
6 changes: 6 additions & 0 deletions contracts/virus/.cargo/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[alias]
wasm = "build --release --lib --target wasm32-unknown-unknown"
wasm-debug = "build --lib --target wasm32-unknown-unknown"
unit-test = "test --lib"
integration-test = "test --test integration"
schema = "run --bin schema"
Loading