Skip to content

Commit

Permalink
Fix some whitespacing
Browse files Browse the repository at this point in the history
  • Loading branch information
webmaster128 committed Dec 20, 2019
1 parent 0e0e6f8 commit e3568d8
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 12 deletions.
11 changes: 11 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
root = true

[*]
indent_style = space
indent_size = 2
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.rs]
indent_size = 4
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
/target
**/*.rs.bk
*.iml
*.iml
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# Cosmwasm Starter Pack

This is a template to build smart contracts in Rust to run inside a
This is a template to build smart contracts in Rust to run inside a
[Cosmos SDK](https://github.com/cosmos/cosmos-sdk) module on all chains that enable it.
To understand the framework better, please read the overview in the
[cosmwasm repo](https://github.com/confio/cosmwasm/blob/master/README.md).
This assumes you understand the theory and just want to get coding.

## Creating a new repo from template

Before starting, make sure you have [rustup](https://rustup.rs/) along with a recent `rustc` and `cargo`
version installed. Currently, we are testing on 1.37+.
Before starting, make sure you have [rustup](https://rustup.rs/) along with a recent `rustc` and `cargo`
version installed. Currently, we are testing on 1.37+.

And you need to have the `wasm32-unknown-unknown` target installed as well.

You can check that via:
Expand All @@ -23,7 +23,7 @@ rustup target list --installed
rustup target add wasm32-unknown-unknown
```

You will also need to have
You will also need to have
[cargo generate](https://github.com/ashleygwilliams/cargo-generate) installed.
Unless you did that before, run this line now:

Expand All @@ -44,7 +44,7 @@ containing a simple working contract and build system that you can customize.
## Compiling and running tests

Now that you created your custom contract, make sure you can compile and run it before
making any changes. Go into the
making any changes. Go into the

```shell script
# this will produce a wasm build in ./target/wasm32-unknown-unknown/release/YOUR_NAME_HERE.wasm
Expand All @@ -64,15 +64,15 @@ cargo test --no-default-features --features singlepass
cargo schema
```

The wasmer engine, embedded in `cosmwasm-vm` supports multiple backends:
The wasmer engine, embedded in `cosmwasm-vm` supports multiple backends:
singlepass and cranelift. Singlepass has fast compile times and slower run times,
and supportes gas metering. It also requires rust `nightly`. This is used as default
when embedding `cosmwasm-vm` in `go-cosmwasm` and is needed to use if you want to
check the gas usage.
check the gas usage.

However, when just building contacts, if you don't want to worry about installing
two rust toolchains, you can run all tests with cranelift. The integration tests
may take a small bit longer, but the results will be the same. The only difference
may take a small bit longer, but the results will be the same. The only difference
is that you can not check gas usage here, so if you wish to optimize gas, you must
switch to nightly and run with cranelift.

Expand All @@ -82,7 +82,7 @@ The main code is in `src/contract.rs` and the unit tests there run in pure rust,
which makes them very quick to execute and give nice output on failures, especially
if you do `RUST_BACKTRACE=1 cargo test`.

However, we don't just want to test the logic rust, but also the compiled wasm artifact
However, we don't just want to test the logic rust, but also the compiled wasm artifact
inside a vm. You can look in `tests/integration.rs` to see some examples there. They
load the wasm binary into the vm and call the contract externally. Effort has been
made that the syntax is very similar to the calls in the native rust contract and
Expand Down Expand Up @@ -129,4 +129,4 @@ compilation cache with your host system, in order to provide the most consistent

We also track the versions of cosmwasm that we aim for compatibility. The most important
aspect is the same version of wasm-pack and wasm-bindgen. For 0.4.1 we are tied to
wasm-pack 0.8.1, wasm-bindgen 0.2.53, and rust 1.38.
wasm-pack 0.8.1, wasm-bindgen 0.2.53, and rust 1.38.

0 comments on commit e3568d8

Please sign in to comment.