Commit Graph

63 Commits

Author SHA1 Message Date
costcould 083a33af85 chore: remove redundant words in CONTRIBUTING.md
Signed-off-by: costcould <fliter@myyahoo.com>
2025-02-26 00:13:07 +08:00
jeremiah 948647a9dd update documentation for changing lockfiles; change script to support mac nanaive cp function 2025-02-19 18:26:12 -05:00
Jose Storopoli ff67eadc7f
contributing: clarify API changes 2024-12-15 11:42:52 -03:00
Tobin C. Harding e126a24307
Add API script
Add a script to generate API files using `cargo public-api` for the
crates that we are trying to stabalise (the so called 'leaf crates').

- hashes
- io
- primitives
- units

We already ran the script and committed the files last patch. The fact
that this patch does not include any changes to the `api/` directory and
that CI passes is enough to convince us that last patch was valid.

Add a CI job that runs the script and checks there are no changes to
the committed text files thereby proving no API changes are made in a
PR without explicitly modifying the API text files.

Add documentation to `CONTRIBUTING.md` on what is expected of devs.
2024-12-06 15:42:22 +11:00
Steven Roose 10148adc31
contributing: Add section about release versions and deprecation
Picked up from a stale PR and corrected to state TBD.

Co-authored-by: Steven Roose @stevenroose
2024-10-15 22:16:15 +01:00
Jamil Lambert, PhD 2d32e74542
Add stricter rustdoc requirement
Example code in rustdocs should be error free and not produce warnings
when copy pasted.

The section on rustdocs has been expanded to clarify that example code
should compile without any errors or warnings with the stricter `lint`
that has been added to the justfile.
2024-10-03 10:10:34 +01:00
Tobin C. Harding 84df3438ca
Fix markdown list items
Fix list items to use capital letters because the list items are
sentences (have trailing full stop already).

Also, use a long single line because it is [subjectively] easier to read
the list.
2024-08-06 04:18:23 +10:00
Tobin C. Harding 0a45c68cf8
Introduce helper function name policy
As much as it hurts the C hacker inside me we have settled on using
`_internal` to mark private function names that clash with a public
function of the same name.

Introduce a policy section and rename one instance, I did not grep the
codebase looking for other violations.

This came up because I had to look at what `_inner` implied when reading
the function name somewhere else.
2024-08-06 04:17:28 +10:00
Jose Storopoli 0beefda7ea
CONTRIBUTING: error/expect messages
- adds an item that all error messages
  should be lower case, except for proper nouns and variable names.
- adds a section on expect messages,
  following discussion in #3019 and #3053.
2024-07-17 16:07:05 -03:00
Jose Storopoli 9933fa0dd5
contributing: fix instructions for the semver CI 2024-07-10 13:02:38 -03:00
Jose Storopoli eeae225cfc
ci: add cargo-semver-checks 2024-07-04 10:08:06 +00:00
Jose Storopoli d9567b097f
ci: remove check-api
Removes check-api workflow, helper scripts, documentation, and files.
2024-07-04 10:08:06 +00:00
Jose Storopoli 9ffa01f5ed
Contributing: add instructions on wildcards in import statements 2024-06-21 19:27:35 +00:00
Tobin C. Harding 0ae5be3e42
docs: Add more info to the update api files section
Done to try to further help new contributors and save maintainer time.

Add an example of using `just check-api` and an example `git` command
for devs to create the api patch now required for all changes to the
public API.
2024-06-01 05:08:32 +10:00
Andrew Poelstra df515ee1ad
Merge rust-bitcoin/rust-bitcoin#2773: reduce two-ACK requirement to one-ACK requirement
f3d364ef1d reduce two-ACK requirement to one-ACK requirement (Andrew Poelstra)

Pull request description:

  For the last few months it has only been myself and tcharding working on this project actively. Prior to that we had Kixunil as well, which allowed us to move forward requiring two ACKs on every PR (though it put a minimum 24-hour delay on everything since we are pairwise 8 hours separated from each other in timezones).

  The other listed maintainers, especially Sanket and Matt, are intermittently available, which is awesome but insufficient to get large refactors or long-term work through.

  We have increasingly depended on the "one-ACK carveout", an ever-increasing list of exceptions to our two-ACK rule. Most silly, one exception is that if something stays open for two weeks, we don't need the second ACK. So the result is a "one ACK plus 2 weeks" policy which is grating and demoralizing.

  Meanwhile, we are not finished our crate-smashing project or our API overhaul, and we want to continue moving at a fast rate. (Though of course, we will take breakage seriously; we do not want to make gratuitous changes or changes that replace previous changes, and the changes we *do* make we will do our damnedest to do via a year-long deprecation cycle. And we welcome suggestions to improve our policy or process on this front. But requiring extra maintainers/reviewers has not been helpful for us.)

  I'll let this PR sit open for 7 days (til Wed May 22) to accumulate ACKs or NACKs, and assuming no strong opposition, will merge it.

ACKs for top commit:
  sanket1729:
    ACK f3d364ef1d

Tree-SHA512: 6d1ea41ce79b038304c59d574b239fc855cc178dc61b4dd8e20dc9e0493278df339950a7604592dd20d7b25c8c56f6d4b5c13b103771a8b920ec10d4050578ae
2024-05-23 14:52:44 +00:00
Andrew Poelstra eb28c16d87
Merge rust-bitcoin/rust-bitcoin#2519: policy: Mention format of error variants
98d6ab3865 policy: Mention format of error variants (Tobin C. Harding)

Pull request description:

  An error enum type should not use an `Error` prefix for its variants, mention as such in the policy docs.

ACKs for top commit:
  apoelstra:
    ACK 98d6ab3865

Tree-SHA512: 16375ff031af24e7b1a5e8206c9660512b26da86df4168ac4a18e48f118c455460d0fee78e1e1ce972a32daba9aff7fcc9d0043bfd21bae223f95d9e944330ca
2024-05-21 13:14:43 +00:00
Andrew Poelstra dbf0ac8e18
Merge rust-bitcoin/rust-bitcoin#2520: policy: Introduce error type re-export policy
7de02da9f5 policy: Introduce error type re-export policy (Tobin C. Harding)

Pull request description:

  We have started introducing `error` sub-modules for modules that have a lot of error code. This is mainly a code organisation thing.

  When importing a function it is annoying to have to go to another module to get the returned error type. Furthermore it leaks our module structure and introduces a maintenance burden because for modules that do not [yet] have an `error` sub-module the error types are in a different place to modules that do have an `error` sub-module.

  Furthermore, if function users have to go to the `error` sub-module to read docs etc. they are bombarded with all the hider errors as well (see definitions below).

  We can solve both problems by re-exporting all regular errors, making the `error` sub-module public (for niche users), and not re-exporting hider errors.

  I believe the re-export should only be done in the module that holds `error` sub-module i.e., do not re-export `foo::error::SomeError` from `bar` module even if `bar::some_function` returns `SomeError`.

  Definitions:

  - hider error: An error type, often a struct, that is nested in another error just to hide the internals.
  - regular error: An error type that is returned from a public function, most often an enum.

  Please note that some times errors act as both hider errors and regular errors so the definitions are not perfect.

ACKs for top commit:
  apoelstra:
    ACK 7de02da9f5 LGTM

Tree-SHA512: 42b9d9b78c882d39553c3d72c188d80f5e305e1f7f1b9b9212760c75ff35ea71e868c93a17851ca0bf2104b01d5c6d316cd14c422c262ff39ad72922c562af4a
2024-05-20 13:17:10 +00:00
Tobin C. Harding 9e7cd97c25
Add a script to check the public API
We would like to check for API changes during development and in CI so
that such changes can be discussed separately from the code.

Add tooling and documentation for creating API listings for the public
crates within the workspace (i.e., not `internals`).

Add API text files from an initial run of the script.
2024-05-18 09:54:52 +10:00
Andrew Poelstra f3d364ef1d
reduce two-ACK requirement to one-ACK requirement 2024-05-15 21:35:27 +00:00
Tobin C. Harding 98d6ab3865
policy: Mention format of error variants
An error enum type should not use an `Error` prefix for its variants,
mention as such in the policy docs.
2024-05-05 07:46:35 +10:00
Tobin C. Harding b49e670772
Add backport section to contributing docs
Add a section on how we do backports and what the merge policy is.

Recently I backported a patch by pushing directly to the `0.32.x`
release branch but this is not an optimal process because it leaves no
history on github. Instead PR backports in like we do for patching
`master` but allow one-ACK merging if the backport is a straight cherry
pick of a patch from `master`.
2024-04-19 05:50:32 +10:00
Andrew Poelstra 6c4f5df355
Merge rust-bitcoin/rust-bitcoin#2627: Introduce new one ACK carve-out rule
9b70c65f5d Introduce new one-ack carve out rule (Tobin C. Harding)
42d02fbd66 Merge Refactor and One ACK carve outs (Tobin C. Harding)
ebf5b670d4 Update test script mention (Tobin C. Harding)

Pull request description:

  Update merge carve-out policy and introduce new rule.

  - Patch 1: Fix stale test script mention
  - Patch 2: Merge current carve-outs into a single carve-out with multiple rules
  - Patch 3: Introduce new carve-out rule

  From patch 3:
  ```
      Introduce new one-ack carve out rule

      Our merge process is being artificially slowed down because of a
      combination of:

      - Using merge-commit merging means PRs often have to be rebased with no
        changes but a different merge base (and force pushed).
      - Trivial changes, like fixing nits, are often force pushed also.
      - Force pushes invalidate ACKs
      - Our devs are spread around the world working at different times

      What this means is trivial force pushes often cause multi day delays in
      merging. To try and alleviate this problem introduce an additional rule
      to the One ACK carve-out so that Andrew can merge PRs that have
      previously been ack'ed by another dev and have only minimal changes.
      The definition of "trivial" is subjective which introduces a burden on
      Andrew to not merge stuff willy-nilly but also allows simple changes to
      the original PR (eg fixed nits that the original reviewer suggested).
  ```

ACKs for top commit:
  apoelstra:
    ACK 9b70c65f5d confirmed via range-diff that the commit everyone ACKed and this one differ only in `as` vs `has`

Tree-SHA512: 41898e71e013ac70e41bb4624ce5e5055dc3e7a405dd73d3988f5b02ece104d7fad746203ce8d26a6a33f98b745010fc39e9a4bddb9bcf22267c942a4dac2028
2024-04-01 13:25:49 +00:00
Tobin C. Harding 9b70c65f5d
Introduce new one-ack carve out rule
Our merge process is being artificially slowed down because of a
combination of:

- Using merge-commit merging means PRs often have to be rebased with no
  changes but a different merge base (and force pushed).
- Trivial changes, like fixing nits, are often force pushed also.
- Force pushes invalidate ACKs
- Our devs are spread around the world working at different times

What this means is trivial force pushes often cause multi day delays in
merging. To try and alleviate this problem introduce an additional rule
to the One ACK carve-out so that Andrew can merge PRs that have
previously been ack'ed by another dev and have only minimal changes.
The definition of "trivial" is subjective which introduces a burden on
Andrew to not merge stuff willy-nilly but also allows simple changes to
the original PR (eg fixed nits that the original reviewer suggested).
2024-03-31 11:12:17 +11:00
Tobin C. Harding 42d02fbd66
Merge Refactor and One ACK carve outs
The "One ACK carve-out" has 3 rules and then there is a separate
"Refactor carve-out" that covers things that are not only refactoring -
this makes it hard to reference the carve-outs in github because its a
bit confusing.

Merge the carve-outs into a single "one ACK carve-out" with multiple
rules. Use rule 0 for the original refactor carve-out stuff because it
makes the diff smaller and all good lists start with 0.

Also remove mention of the refactor carve-out from rule 3.
2024-03-23 07:20:49 +11:00
Tobin C. Harding ebf5b670d4
Update test script mention
In the One ACK carve out just say "test scripts" instead of `test.sh`
because we re-named the test scripts recently.
2024-03-23 07:12:06 +11:00
Tobin C. Harding 8bd0394b0a
Document how to write commits
Reviewers often find themselves linking to blog posts to encourage newer
devs to improve their commit logs, we can save everyones time by putting
the links in the contributing docs, then we can just point devs there.
2024-03-14 13:21:26 +11:00
Liam Aharon b9f7462958
Implement infallible for errors
Creates a new macro `impl_from_infallible`, and applies it to custom
error types in the codebase.

Closes #1222.
2024-03-08 16:48:34 +11:00
Tobin C. Harding 41f0a802af
Remove assigned docs
We don't assign issues, remove the incorrect section.
2024-03-06 08:53:29 +11:00
Tobin C. Harding 7ba63fec82
Fix typo 2024-03-06 08:53:14 +11:00
Tobin C. Harding 7de02da9f5
policy: Introduce error type re-export policy
We have started introducing `error` sub-modules for modules that have a
lot of error code. This is mainly a code organisation thing.

When importing a function it is annoying to have to go to another module
to get the returned error type. Furthermore it leaks our module
structure and introduces a maintenance burden because for modules that
do not [yet] have an `error` sub-module the error types are in a different
place to modules that do have an `error` sub-module.

Furthermore, if function users have to go to the `error` sub-module to
read docs etc. they are bombarded with all the hider errors as well (see
definitions below).

We can solve both problems by re-exporting all regular errors, making
the `error` sub-module public (for niche users), and not re-exporting
hider errors.

I believe the re-export should only be done in the module that holds
`error` sub-module i.e., do not re-export `foo::error::SomeError` from
`bar` module even if `bar::some_function` returns `SomeError`.

Definitions:

- hider error: An error type, often a struct, that is nested in another
error just to hide the internals.
- regular error: An error type that is returned from a public function,
most often an enum.

Please note that some times errors act as both hider errors and regular
errors so the definitions are not perfect.
2024-02-29 09:57:05 +11:00
Andrew Poelstra e386cbfadf
ci: delete *test.sh files
These are not run in CI since #2353 and are likely to go out of date. If
we want a script that users can run locally then we should create a new
script that wraps our current CI.
2024-02-28 20:45:56 +00:00
Andrew Poelstra eadc6a6c9e
Merge rust-bitcoin/rust-bitcoin#2207: policy: Add section on standard set of derives
cb42c74f58 policy: Add section on standard set of derives (Tobin C. Harding)
ec1a5a25c7 CONTRIBUTING: Remove stale links (Tobin C. Harding)

Pull request description:

  We can have a standard set of derives to make it easier for new devs to work out what to use and also to help us move towards a uniform set in preparation for crate stabilization.

  This is not me imposing my view but rather a place for the discussion to happen, could have been a discussions topic also? Using "open" instead of "draft" to aid visibility. Probably requires more than the usual amount of acks.

ACKs for top commit:
  apoelstra:
    ACK cb42c74f58
  Kixunil:
    ACK cb42c74f58

Tree-SHA512: b4c4094ea3652e92a5bea90e16f13971202710166524cc15abef5e8318ba5f59df084f5246331870fc641456b49d4e35d266c937375bdc5035f03699a7d4c1b9
2023-12-15 22:47:57 +00:00
Tobin C. Harding cb42c74f58
policy: Add section on standard set of derives
We can have a standard set of derives to make it easier for new devs to
work out what to use and also to help us move towards a uniform set in
preparation for crate stabilization. Mention the new `ordered` crate.
2023-12-15 12:06:37 +11:00
Tobin C. Harding ec1a5a25c7
CONTRIBUTING: Remove stale links
These sections have been removed but still have links in the index.
2023-12-15 12:06:36 +11:00
Tobin C. Harding 472da02c58
policy: Add section on returning Self
Returning `Self` instead of the actual type makes refactoring easier,
especially for error enums.
2023-12-15 10:44:34 +11:00
Andrew Poelstra 50fc63b171
Merge rust-bitcoin/rust-bitcoin#1127: Add policy section to docs
3bebecc7ea Add policy section to docs (Tobin C. Harding)

Pull request description:

  In an effort to consolidate knowledge spread out over time in various places on GitHub add a `Policy` section to `CONTRIBUTING.md`.

  Add initial sections on import statements, errors, rustdocs,attributes, and licensing.

ACKs for top commit:
  apoelstra:
    ACK 3bebecc7ea
  Kixunil:
    ACK 3bebecc7ea

Tree-SHA512: fb1afd220a0afae962cd9c7a01df7d440eaa1406b446765af209e3b7840b36aa8a1254d57f9ff0c3783479111470828da3c76b5858ce5969519c96cdba71c7f3
2023-11-16 13:40:10 +00:00
Vojtěch Toman e3f2c4fa43
Fix broken link in CONTRIBUTING.md 2023-11-15 21:03:56 +01:00
Tobin C. Harding 3bebecc7ea
Add policy section to docs
In an effort to consolidate knowledge spread out over time in various
places on GitHub add a `Policy` section to `CONTRIBUTING.md`.

Add initial sections on import statements, errors, rustdocs,attributes,
and licensing.
2023-10-31 08:03:28 +11:00
Einherjar d391ada5b8
ci: nightly rustfmt PR scheduled/manual 2023-10-22 05:34:16 -03:00
Andrew Poelstra fc52fd9ced
Merge rust-bitcoin/rust-bitcoin#2045: Use correct terminology: carve out
b229fd5555 Use correct form for noun: carve-out (Tobin C. Harding)

Pull request description:

  One "carves out" something, not "carve output" - woops.

ACKs for top commit:
  apoelstra:
    ACK b229fd5555

Tree-SHA512: 196c5c239da35a67b83eb96f2f9346af6518af51ff6bb4a9e40cddab8c8511f2e913278a9727bfe4e97d50c58cb87a4100e40c13c8313643b04a2d0fabaaa9e5
2023-09-21 16:55:44 +00:00
Tobin C. Harding 4222e4d817
Add one-ack carve outside
In an effort to reduce review burden add so strict rules defining 3
times where we think it is acceptable for code to be merged with a
single ACK. Feels a bit like we only just added the refactor carve out
and now we are adding more carve outs, so whats next? We should take
these rules seriously, if we are to be taken seriously.
2023-09-04 08:17:22 +10:00
Tobin C. Harding b229fd5555
Use correct form for noun: carve-out
One is said to "carve out" something, not "carve output" - woops.
However, when used as a noun its written "carve-out".
2023-09-04 08:10:24 +10:00
Tobin C. Harding 55be538dac
policy: Add refactor carve out
I have managed to burn out or bore our reviewers/maintainers. Getting
two acks is becoming increasingly difficult. I've pestered everyone to
the limit that I feel socially comfortable doing so am requesting a
carve out to the 2-ACK before merge rule.

The primary justification is that I feel we should have a bit more of
BDFL and a bit less total consensus if we are to push forwards.
2023-07-18 09:58:55 +10:00
Martin Habovstiak c4c64c0dc5
Test with minimal dependency versions
It could happen that we unknowingly depend on a new version of a crate
without updating `Cargo.toml`. This could cause resolution issues for
downstream users. It's also unclear for outsiders to see which
dependencies we tested the crate with.

This change commits two lock files: `minimal` and `recent`. `minimal`
contains minimal depdendency versions, while `recent` contains
dependency versions at the time of making the change.

Further, this adds CI jobs to test with both lock files, CI job for
`internals` crate, removes old `serde` pinning and prints a warning if
`recent` is no longer up to date. (We may have to override it somehow if
any crate breaks MSRV.)

The documentation is also updated accordingly.

Co-developed-by: Tobin C. Harding <me@tobin.cc>

Closes #1230
2023-05-03 08:06:46 +10:00
Tobin C. Harding fe83ee6061
Update testing section
The testing section in `CONTRIBUTING.md` is stale, update it to point
readers towards the readme.
2023-03-21 15:29:32 +11:00
Tobin C. Harding 55312f2972
Update contributing docs re cargo fmt
Now that we use `cargo fmt`, update the section in the contributing
documentation.
2023-03-07 08:58:13 +11:00
Andrew Poelstra 779668879d
Merge rust-bitcoin/rust-bitcoin#1125: Update docs on rustfmt
b7eea6cb26 Update docs on rustfmt (Tobin C. Harding)

Pull request description:

  We have introduced `rustfmt` but forgot to update the docs section about
  it. Since a large portion of the codebase is currently ignored by our
  `rustfmt` configuration, point out that `rusntfmt` is work in progress.

ACKs for top commit:
  apoelstra:
    ACK b7eea6cb26
  Kixunil:
    ACK b7eea6cb26

Tree-SHA512: c3a01e38e9787f7554847c657de8d2aeb512f237f68e97973ffa04e92decd282126abf16edb369c13dbeb9eed3587e20dbfb3ab77e06551a006a7aa2c70a71ad
2022-09-14 13:34:49 +00:00
Tobin C. Harding b7eea6cb26 Update docs on rustfmt
We have introduced `rustfmt` but forgot to update the docs section about
it. Since a large portion of the codebase is currently ignored by our
`rustfmt` configuration, point out that `rusntfmt` is work in progress.
2022-07-26 17:20:00 +10:00
Tobin C. Harding fe840f0b42 Fix stale toolchain docs
We have docs that use an env var `BITCOIN_MSRV` that no longer exists.
Point readers towards `RUSTUP_TOOLCHAIN`.

(Note that we still use `TOOLCHAIN` in the script but it is being phased
out, `RUSTUP_TOOLCHAIN` works today.)
2022-07-26 11:09:47 +10:00
Tobin C. Harding 73b506e149 Remove stale MSRV docs
We have stale docs referring to the old MSRV. We do not need MSRV docs
in `CONTRIBUTING` because we have them in the README already.

Fix stale docs by doing:
- Remove the MSRV docs from readme in favour of `CONTRIBUTING.md`.
- Add a sentence to the redame pointing readers towards `CONTRIBUTING.md`.
2022-07-26 11:04:45 +10:00