Skip to content

Commit f5ed5a9

Browse files
committed
Merge pull request #34 from 'docs/add-CONTRIBUTING-file'
2 parents 6029a2a + ea6ce30 commit f5ed5a9

1 file changed

Lines changed: 93 additions & 0 deletions

File tree

CONTRIBUTING.md

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
# Contributing to `bdk-sp`
2+
3+
This project welcomes contributions from anyone via peer review, documentation, testing, and patches, regardless of experience, age, or other factors. Cryptocurrency protocol development requires rigor, adversarial thinking, thorough testing, and risk minimization, as bugs can cost users money.
4+
5+
## Communications Channels
6+
7+
Communication occurs in the `#silent-payments` channel on the [BDK Discord server](https://discord.gg/dstn4dQ) and on GitHub via [issues](https://github.com/bitcoindevkit/bdk-sp/issues) and [pull requests](https://github.com/bitcoindevkit/bdk-sp/pulls).
8+
9+
## Useful Knowledge
10+
11+
No requirements to contribute, but familiarity with BIPs 352[^1], 375[^2], 374[^3], and the light client specification[^4] helps, as they drive this repository's content.
12+
13+
## Contribution Workflow
14+
15+
The codebase uses the contributor workflow, where everyone submits patch proposals via pull requests. This facilitates social contribution, easy testing, and peer review.
16+
17+
To contribute a patch:
18+
19+
1. Fork the repository.
20+
2. Create a topic branch.
21+
3. Commit patches.
22+
23+
Commits should be atomic with easy-to-read diffs. Do not mix formatting fixes or code moves with actual changes. Each commit should compile and pass tests to ensure tools like git bisect work properly.
24+
25+
When adding features, consider long-term technical debt. Cover new features with functional tests where possible.
26+
27+
For refactoring, structure PRs for easy review and split into multiple small, focused PRs if needed.
28+
29+
The minimal supported Rust version is **1.63.0** (enforced by CI).
30+
31+
Commits should describe the issue fixed and the solution's rationale.
32+
33+
Consider [cbeams guidelines](https://chris.beams.io/posts/git-commit/) to write commit messages. Apply ["Conventional Commits 1.0.0"](https://www.conventionalcommits.org/en/v1.0.0/) for readable commit histories for humans, tools and LLMs.
34+
35+
Sign commits with GPG, SSH, or S/MIME; GitHub enforces this when merging pull requests.
36+
Read more about [signing commits](https://docs.github.com/en/authentication/managing-commit-signature-verification/signing-commits).
37+
38+
To communicate with contributors, use GitHub's assignee field. Check if assigned, then comment that you're working on it. If assigned, ask if they're still active if it's been awhile.
39+
40+
## Coding Conventions
41+
42+
Use `just` for the preferred workflow. If not installed, [installation page](https://just.systems/man/en/packages.html).
43+
44+
Run `just fmt` to format code.
45+
Run `just check` to apply linters and ensure signed commits.
46+
Run `just pre-push` or `just p` before PRs to verify formatting, no linter warnings, passing tests, and signed commits.
47+
48+
Document all public items. Adhere to [Rust API Guidelines](https://rust-lang.github.io/api-guidelines/about.html) for documentation.
49+
50+
Carefully consider using `clone`, `unwrap`, or `expect`.
51+
52+
The library uses safe Rust. Avoid `unsafe` blocks.
53+
54+
Add dependencies only if strictly necessary and impossible otherwise.
55+
56+
## Deprecation policy
57+
58+
Avoid breaking existing APIs where possible. Add new APIs and use [`#[deprecated]`](https://GitHub.com/rust-lang/rfcs/blob/master/text/1270-deprecation.md) to discourage old ones.
59+
60+
Maintain deprecated APIs for one release cycle. For example, an API deprecated in 0.10 may be removed in 0.11. This enables smooth upgrades without excessive technical debt.
61+
62+
If you deprecate an API, own it and submit a follow-up PR to remove it in the next cycle.
63+
64+
## Peer review
65+
66+
Anyone can participate in peer review via pull request comments. Reviewers check for obvious errors, test patches, and assess technical merits. Review PRs conceptually first, before code style or grammar fixes.
67+
68+
## Security
69+
70+
Security is a high priority for `bdk-sp` to prevent user fund loss. Since not production-ready, report vulnerabilities via GitHub issues.
71+
72+
## Testing
73+
74+
`bdk-sp` developers prioritize testing seriously. The modular structure makes writing functional tests easy, with good codebase coverage as a key goal.
75+
76+
Test all new features. Make tests unique and self-describing. If ignoring a test, provide a reason with the `#[ignore]` attribute.
77+
78+
Namespace unit tests in an inner module named after the function under test, without `test_` prefix or the function name. The test name should explicitly state the case.
79+
80+
As in [Coding Conventions](#coding-conventions), use `just` to run unit tests, functional tests, integration tests, and doctests:
81+
82+
```bash
83+
just test
84+
```
85+
86+
## Going further
87+
88+
Consider Jon Atack's guides on [How to review Bitcoin Core PRs](https://github.com/jonatack/bitcoin-development/blob/master/how-to-review-bitcoin-core-prs.md) and [How to make Bitcoin Core PRs](https://github.com/jonatack/bitcoin-development/blob/master/how-to-make-bitcoin-core-prs.md). Despite project differences in context and maturity, many suggestions apply here.
89+
90+
[^1]: https://github.com/bitcoin/bips/blob/master/bip-0352.mediawiki
91+
[^2]: https://github.com/bitcoin/bips/blob/master/bip-0375.mediawiki
92+
[^3]: https://github.com/bitcoin/bips/blob/master/bip-0374.mediawiki
93+
[^4]: https://github.com/setavenger/BIP0352-light-client-specification

0 commit comments

Comments
 (0)