Skip to content

Commit

Permalink
Merge pull request #1398 from CosmWasm/rename-cosmwasm-check
Browse files Browse the repository at this point in the history
Rename `cw-check-contract -> cosmwasm-check`
  • Loading branch information
uint authored Aug 22, 2022
2 parents effe787 + 66f37fc commit 06d7223
Show file tree
Hide file tree
Showing 11 changed files with 76 additions and 33 deletions.
14 changes: 7 additions & 7 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ workflows:
jobs:
- arm64
- package_crypto
- package_cw_check_contract
- package_check
- package_schema
- package_schema_derive
- package_std
Expand Down Expand Up @@ -161,7 +161,7 @@ jobs:
- target/debug/deps
key: cargocache-v2-package_crypto-rust:1.59.0-{{ checksum "Cargo.lock" }}

package_cw_check_contract:
package_check:
docker:
- image: rust:1.59.0
steps:
Expand All @@ -171,22 +171,22 @@ jobs:
command: rustc --version; cargo --version; rustup --version; rustup target list --installed
- restore_cache:
keys:
- cargocache-v2-package_cw_check_contract-rust:1.59.0-{{ checksum "Cargo.lock" }}
- cargocache-v2-package_check-rust:1.59.0-{{ checksum "Cargo.lock" }}
- run:
name: Build
working_directory: ~/project/packages/cw-check-contract
working_directory: ~/project/packages/check
command: cargo build --locked
- run:
name: Run tests
working_directory: ~/project/packages/cw-check-contract
working_directory: ~/project/packages/check
command: cargo test --locked
- save_cache:
paths:
- /usr/local/cargo/registry
- target/debug/.fingerprint
- target/debug/build
- target/debug/deps
key: cargocache-v2-package_cw_check_contract-rust:1.59.0-{{ checksum "Cargo.lock" }}
key: cargocache-v2-package_check-rust:1.59.0-{{ checksum "Cargo.lock" }}

package_schema:
docker:
Expand Down Expand Up @@ -1216,7 +1216,7 @@ jobs:
command: |
echo "Checking all contracts under ./artifacts"
docker run --volumes-from with_code rust:1.59.0 \
/bin/bash -e -c 'export GLOBIGNORE="artifacts/floaty.wasm"; cd ./code; cargo run --bin cw-check-contract artifacts/*.wasm'
/bin/bash -e -c 'export GLOBIGNORE="artifacts/floaty.wasm"; cd ./code; cargo run --bin cosmwasm-check artifacts/*.wasm'
docker cp with_code:/code/artifacts .
- run:
name: Publish artifacts on GitHub
Expand Down
22 changes: 11 additions & 11 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ The following packages are maintained here:
| cosmwasm-std | Contract development | [![cosmwasm-std on crates.io](https://img.shields.io/crates/v/cosmwasm-std.svg)](https://crates.io/crates/cosmwasm-std) | [![Docs](https://docs.rs/cosmwasm-std/badge.svg)](https://docs.rs/cosmwasm-std) | [![Coverage][cov-badge-std]][cov-link-std] |
| cosmwasm-storage | Contract development | [![cosmwasm-storage on crates.io](https://img.shields.io/crates/v/cosmwasm-storage.svg)](https://crates.io/crates/cosmwasm-storage) | [![Docs](https://docs.rs/cosmwasm-storage/badge.svg)](https://docs.rs/cosmwasm-storage) | [![Coverage][cov-badge-storage]][cov-link-storage] |
| cosmwasm-vm | Host environments | [![cosmwasm-vm on crates.io](https://img.shields.io/crates/v/cosmwasm-vm.svg)](https://crates.io/crates/cosmwasm-vm) | [![Docs](https://docs.rs/cosmwasm-vm/badge.svg)](https://docs.rs/cosmwasm-vm) | ([#1151]) |
| cosmwasm-check | Contract development | [![cosmwasm-check on crates.io](https://img.shields.io/crates/v/cosmwasm-check.svg)](https://crates.io/crates/cosmwasm-check) | `cosmwasm-check -h` | N/A |

[cov-badge-crypto]:
https://codecov.io/gh/CosmWasm/cosmwasm/branch/main/graph/badge.svg?flag=cosmwasm-crypto
Expand Down Expand Up @@ -96,6 +97,10 @@ This code is compiled into Wasm bytecode as part of the smart contract.
WebAssembly smart contracts. It can be run as is, or you can import the
`x/wasm` module from it and use it in your blockchain. It is designed to be
imported and customized for other blockchains, rather than forked.
- [cosmwasm-check](https://github.com/CosmWasm/cosmwasm/tree/main/packages/check) -
A CLI tool and a crate in this workspace. Used to verify a Wasm binary is a
CosmWasm smart contract suitable for uploading to a blockchain with a given
set of capabilities.

## Creating a Smart Contract

Expand Down
1 change: 1 addition & 0 deletions devtools/check_workspace.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ cargo fmt
(cd packages/schema && cargo build && cargo clippy --all-targets -- -D warnings)
(cd packages/schema-derive && cargo build && cargo clippy --all-targets -- -D warnings)
(cd packages/vm && cargo build --features iterator,stargate && cargo clippy --all-targets --features iterator,stargate -- -D warnings)
(cd packages/check && cargo build && cargo clippy --all-targets -- -D warnings)
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[package]
name = "cw-check-contract"
name = "cosmwasm-check"
version = "1.0.0"
authors = ["Ethan Frey <ethanfrey@users.noreply.github.com>"]
authors = ["Mauro Lacy <mauro@lacy.com.es>"]
edition = "2021"
description = "VM bindings to run verify cosmos contracts."
repository = "https://github.com/CosmWasm/cosmwasm/tree/main/packages/cw-check-contract"
description = "A CLI tool for verifying CosmWasm smart contracts"
repository = "https://github.com/CosmWasm/cosmwasm/tree/main/packages/check"
license = "Apache-2.0"

[dependencies]
Expand Down
43 changes: 43 additions & 0 deletions packages/check/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# cosmwasm-check

It allows checking if the Wasm binary is a proper smart contract that's ready to
be uploaded to the blockchain.

## Installation

```sh
cargo install cosmwasm-check
```

## Usage

Get help and info:

```sh
cosmwasm-check -h
```

Check some contracts:

```sh
cosmwasm-check artifacts/hackatom.wasm artifacts/burner.wasm
```

Check an entire directory of contracts (shell dependent):

```sh
cosmwasm-check artifacts/*.wasm
```

Check if a contract would ran on a blockchain with a specific set of
capabilities:

```sh
cosmwasm-check --available-capabilities iterator,osmosis,friendship artifacts/hackatom.wasm
```

## License

This package is part of the cosmwasm repository, licensed under the Apache
License 2.0 (see [NOTICE](https://github.com/CosmWasm/cosmwasm/blob/main/NOTICE)
and [LICENSE](https://github.com/CosmWasm/cosmwasm/blob/main/LICENSE)).
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const DEFAULT_AVAILABLE_CAPABILITIES: &str = "iterator,staking,stargate";

pub fn main() {
let matches = App::new("Contract checking")
.version("0.1.0")
.version(env!("CARGO_PKG_VERSION"))
.long_about("Checks the given wasm file (memories, exports, imports, available capabilities, and non-determinism).")
.author("Mauro Lacy <mauro@lacy.com.es>")
.arg(
Expand Down
6 changes: 0 additions & 6 deletions packages/cw-check-contract/README.md

This file was deleted.

2 changes: 1 addition & 1 deletion packages/profiler/src/instrumentation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ impl FunctionMiddleware for FunctionProfiling {
Operator::Call{ function_index: self.indexes.start_measurement.as_u32() },
]);
}
self.accumulated_ops.push((&operator).into());
self.accumulated_ops.push(OperatorSymbol::from(&operator));
}
}

Expand Down
4 changes: 2 additions & 2 deletions packages/vm/examples/check_contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ use cosmwasm_vm::internals::{check_wasm, compile};
const DEFAULT_AVAILABLE_CAPABILITIES: &str = "iterator,staking,stargate";

pub fn main() {
eprintln!("`check_contract` will be removed from the next version of `cosmwasm-vm` - please use `cw-check-contract` instead.");
eprintln!("> cargo install cw-check-contract");
eprintln!("`check_contract` will be removed from the next version of `cosmwasm-vm` - please use `cosmwasm-check` instead.");
eprintln!("> cargo install cosmwasm-check");

let matches = App::new("Contract checking")
.version("0.1.0")
Expand Down
2 changes: 1 addition & 1 deletion packages/vm/src/modules/versioning.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ pub fn current_wasmer_module_version() -> u32 {
}

let metadata = &header[header.len() - METADATA_HEADER_LEN..];
u32::from_le_bytes((&metadata[8..12]).try_into().unwrap())
u32::from_le_bytes((metadata[8..12]).try_into().unwrap())
}

#[cfg(test)]
Expand Down

0 comments on commit 06d7223

Please sign in to comment.