Skip to content

Latest commit

 

History

History
159 lines (104 loc) · 6.6 KB

DEVELOPING.md

File metadata and controls

159 lines (104 loc) · 6.6 KB

Developing

Environment set up

  • Install rustup. Once installed, make sure you have the wasm32 target:

    rustup default stable
    rustup update stable
    rustup target add wasm32-unknown-unknown
  • Install wasm-opt: cargo install wasm-opt --locked, this produces a optimized version of the contract small enough to be uploaded to the chain.

  • Install sedad

Compiling

You can build a release version, but not optimized with cargo wasm which outputs target/wasm32-unknown-unknown/release/seda_contract.wasm.

If you want an optimized version of the wasm you can instead run cargo wasm-opt which outputs to target/seda_contract.wasm. This is the version you would want to upload to the chain.

Building Schema

You can build the json schema with cargo schema.

Linting

rustfmt is used to format any Rust source code, we do use nightly format features: cargo +nightly fmt.

Nightly can be installed with: rustup install nightly.

clippy is used as the linting tool: cargo clippy -- -D warnings

Testing

Unit

Unit testing can be done with: cargo test.

You could also install nextest, with cargo install cargo-nextest --locked, then run cargo nextest. Nextest is a faster test runner for Rust.

Fuzzing

Not yet set-up again.

xtask

We use cargo xtask to help automate lots of various actions. It doesn't require any additional installations to use xtask, its just a more rust-esque way of doing a Makefile.

You can read more about xtask and it's benefits at that link.