Check out the Stellar Contribution Guide that applies to all Stellar projects.
Please discuss issues to be solved and potential solutions on issues ahead of opening a pull request.
For more information about Soroban, see the Soroban documentation. For API documentation, see docs.rs.
This repository is a Cargo workspace containing multiple crates. The soroban-sdk
crate is the main SDK that everything revolves around. The other crates in the
workspace either support soroban-sdk or serve smaller specialized roles.
The tests/ directory contains small sample contracts called "test vectors" that
are used to test the SDK. Each subdirectory is a minimal contract that exercises
specific SDK features. These contracts are compiled to WASM and used in integration
tests. Binary stability is maintained by building test vectors with the minimum
supported Rust version (MSRV).
The tests-expanded/ directory contains expanded macro output from the test vector
contracts, generated by make expand-tests. This is useful for reviewing changes
to macro-generated code and helps surface breaking changes in code generation.
Install rustup:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
Install rust stable:
rustup install stable
rustup +stable target add wasm32v1-none
Install rust nightly:
rustup install nightly
rustup +nightly target add wasm32v1-none
Install cargo tools:
cargo install --locked cargo-hack
See the Makefile for all the common commands you might need.
Fmt code with:
make fmt
Open docs locally:
make doc
Build:
make build
Run tests:
make test
Clean build artifacts:
make clean
Print the minimum supported Rust version:
make msrv
Expand macros in test contracts to review generated code:
make expand-tests
Build fuzz tests (requires nightly):
make build-fuzz
Run tests with MIRI for memory safety checking (requires nightly):
make miri