Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
export SIMPLEX_DIR="$HOME/.simplex"
curl -L https://raw.githubusercontent.com/BlockstreamResearch/smplx/master/simplexup/install | bash
echo "$SIMPLEX_DIR/bin" >> "$GITHUB_PATH"
"$SIMPLEX_DIR/bin/simplexup" --install v0.0.6 --platform linux --arch amd64
"$SIMPLEX_DIR/bin/simplexup" --install v0.0.8 --platform linux --arch amd64

- name: Cache cargo
uses: Swatinem/rust-cache@v2
Expand All @@ -41,6 +41,11 @@ jobs:
working-directory: crates/contracts
run: simplex build

- name: Check committed artifacts are up to date
run: |
git add -N crates/contracts/src/artifacts
git diff --exit-code -- crates/contracts/src/artifacts

- name: Format check
run: cargo fmt --all --check

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
export SIMPLEX_DIR="$HOME/.simplex"
curl -L https://raw.githubusercontent.com/BlockstreamResearch/smplx/master/simplexup/install | bash
echo "$SIMPLEX_DIR/bin" >> "$GITHUB_PATH"
"$SIMPLEX_DIR/bin/simplexup" --install v0.0.6 --platform linux --arch amd64
"$SIMPLEX_DIR/bin/simplexup" --install v0.0.8 --platform linux --arch amd64

- name: Cache cargo
uses: Swatinem/rust-cache@v2
Expand Down Expand Up @@ -68,7 +68,7 @@ jobs:
export SIMPLEX_DIR="$HOME/.simplex"
curl -L https://raw.githubusercontent.com/BlockstreamResearch/smplx/master/simplexup/install | bash
echo "$SIMPLEX_DIR/bin" >> "$GITHUB_PATH"
"$SIMPLEX_DIR/bin/simplexup" --install v0.0.6 --platform linux --arch amd64
"$SIMPLEX_DIR/bin/simplexup" --install v0.0.8 --platform linux --arch amd64

- name: Cache cargo
uses: Swatinem/rust-cache@v2
Expand Down
79 changes: 79 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,82 @@
# Contributing

## Development Setup

### Prerequisites

- Rust 1.91.0 or later (CI tests 1.91.0 and stable).
- The [Simplex](https://github.com/BlockstreamResearch/smplx) CLI, pinned to
the same version as CI (see `.github/workflows/tests.yml`):

```sh
curl -L https://raw.githubusercontent.com/BlockstreamResearch/smplx/master/simplexup/install | bash
simplexup --install v0.0.8
```

### Building

```sh
cargo build --workspace --all-features
```

Contract artifacts (`crates/contracts/src/artifacts`) are generated from the
SimplicityHL sources in `crates/contracts/simf` and are checked in, so a plain
`cargo build` works out of the box. Whenever you change a `.simf` source (or
bump the Simplex toolchain), regenerate and commit them:

```sh
cd crates/contracts
simplex build
```

CI regenerates the artifacts and fails if the committed ones are stale.

### Testing

Unit tests need no external services:

```sh
cargo test --workspace --all-features --lib
```

The regtest suite (`crates/contracts/tests`) runs against local `elementsd`
and `electrs` instances and is driven by Simplex:

```sh
export ELEMENTSD_EXEC=/path/to/elementsd
export ELECTRS_LIQUID_EXEC=/path/to/electrs
simplex test
```

See the "Setup regtest binaries" step in `.github/workflows/tests.yml` for
the exact binaries CI downloads.

### Linting

CI enforces formatting and a strict clippy profile:

```sh
cargo fmt --all --check
cargo clippy --workspace --all-targets --all-features -- \
-D warnings -D clippy::all -D clippy::pedantic -D clippy::nursery \
-D clippy::cargo -A clippy::multiple_crate_versions
```

## Repository Layout

- `crates/contracts/simf/`: SimplicityHL sources for the finance contracts;
`simplex build` compiles them into the generated (and committed)
`crates/contracts/src/artifacts`.
- `crates/contracts/src/programs/`: Rust wrappers around the generated
finance contract artifacts (options, option offer).
- `crates/contracts/src/state_management/`: standalone storage contract
examples; each embeds its own source from a `source_simf/` directory and is
gated behind a feature flag.
- `crates/contracts/src/simplicityhl_core/`: shared compile/execute/taproot
helpers.
- `crates/contracts/tests/`: regtest scenarios (`regtest/`), transaction
builders (`program_builder/`), and shared test utilities (`common/`).

# PR Structure

All changes must be submitted in the form of pull requests. Direct pushes
Expand Down
Loading
Loading