Environment Setup
💡 Info
This tutorial is only relevant if you wish to contribute to Starknet Foundry. If you plan to only use it as a tool for your project, you can skip this part.
Prerequisites
Rust
Install the latest stable Rust version. If you already have Rust installed make sure to upgrade it by running:
$ rustup update
Scarb
You can read more about installing Scarb here. Please make sure you're using Scarb installed via asdf - otherwise some tests may fail.
To verify, run:
$ which scarb
the result of which should be:
$HOME/.asdf/shims/scarb
💡 Info
If you previously installed Scarb using official installer, you may need to remove that installation or modify your
PATH
to make sure the version installed by asdf is always used.
Starknet Devnet
Install it by running ./scripts/install_devnet.sh
Universal sierra compiler
Install the latest universal-sierra-compiler version.
Environmental variables
Set SEPOLIA_RPC_URL
environmental variable to a Sepolia testnet node URL:
- either manually in your shell
$ export SEPOLIA_RPC_URL="https://example.com/rpc/v0_7"
- or inside
.env
file (example found in.env.template
file)SEPOLIA_RPC_URL="https://example.com/rpc/v0_7"
Running Tests
After performing these steps, you can run tests with:
$ cargo test
❗️ Warning
If you haven't pushed your branch to the remote yet (you've been working only locally), two tests will fail:
e2e::running::init_new_project_test
e2e::running::simple_package_with_git_dependency
After pushing the branch to the remote, those tests should pass.
Formatting and Lints
Starknet Foundry uses rustfmt for formatting. You can run the formatter with:
$ cargo fmt
For linting, it uses clippy. You can run it with:
$ cargo clippy --all-targets --all-features -- --no-deps -W clippy::pedantic -A clippy::module_name_repetitions -A clippy::missing_errors_doc -A clippy::missing_panics_doc -A clippy::default_trait_access```
or using our defined alias:
```shell
$ cargo lint
Spelling
Starknet Foundry uses typos for spelling checks.
You can run the checker with:
$ typos
Some typos can be automatically fixed by running:
$ typos -w
Contributing
Read the general contribution guideline here