Skip to content

Commit 1393055

Browse files
committed
Merge #30: ci: add typo checking
6968fbf ci: add typo checking (Jose Storopoli) Pull request description: Since this is a public-facing documentation/resource repository, we should be extra-careful and judicious with typos. [`typos`](https://github.com/crate-ci/typos) is a powerful source code spell checker. I've added a CI job that runs on every PR and push to `master` (but can also be run manually with `workflow_dispatch`) that checks for typos. I've also added a config file `.typos.toml` that deals with false positives and ignore some vendor related files and some filetypes that we don't want to check/correct for typos, e.g. lock files. Finally, I've also corrected a few typos that were in the codebase that typos flagged. If you want to run yourself you can do a cargo install (or binstall) the typos-cli: ```bash cargo install typos-cli ``` It is also available in several pkg managers, check the installation options at the [`typos` repo](https://github.com/crate-ci/typos?tab=readme-ov-file#install) ACKs for top commit: apoelstra: utACK 6968fbf tcharding: ACK 6968fbf Tree-SHA512: 442f0e16d528bf13ebe72024f6d6a061d4d10169ae822f8729890cb8cdc1d6cfdfd66f3732af3b1b931f2f9d5ca9596e869ec92b8f359c792c31edf4916dfa12
2 parents bd008ad + 6968fbf commit 1393055

File tree

4 files changed

+39
-7
lines changed

4 files changed

+39
-7
lines changed

.github/workflows/typos.yml

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: Check Typos
2+
on:
3+
push:
4+
branches:
5+
- master
6+
pull_request: {}
7+
workflow_dispatch: null
8+
9+
jobs:
10+
typos:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout Actions Repository
14+
uses: actions/checkout@v4
15+
16+
- name: Check spelling
17+
uses: crate-ci/typos@master

.typos.toml

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
[default]
2+
3+
[default.extend-words]
4+
# NOTE: use here for false-positives
5+
# EXAMPLE: PSBT = "PSBT"
6+
7+
[files]
8+
extend-exclude = ["site/themes/nightfall"]
9+
10+
[type.gitignore]
11+
extend-glob = [".gitignore"]
12+
check-file = false
13+
14+
[type.lock]
15+
extend-glob = ["*.lock"]
16+
check-file = false

cookbook/src/tx_segwit-v0.md

+2-3
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ This is the message that we will sign.
307307
The [Message::from](https://docs.rs/secp256k1/0.29.0/secp256k1/struct.Message.html#impl-From%3C%26%27_%20bitcoin%3A%3Ahashes%3A%3Asha256d%3A%3AHash%3E) method takes anything that implements the promises to be a thirty two byte hash i.e., 32 bytes that came from a cryptographically secure hashing algorithm.
308308

309309
We compute the signature `sig` by using the [`sign_ecdsa`](https://docs.rs/secp256k1/0.29.0/secp256k1/struct.Secp256k1.html#method.sign_ecdsa) method.
310-
It takes a refence to a [`Message`](https://docs.rs/secp256k1/0.29.0/secp256k1/struct.Message.html) and a reference to a [`SecretKey`](https://docs.rs/secp256k1/0.29.0/secp256k1/struct.SecretKey.html) as arguments,
310+
It takes a reference to a [`Message`](https://docs.rs/secp256k1/0.29.0/secp256k1/struct.Message.html) and a reference to a [`SecretKey`](https://docs.rs/secp256k1/0.29.0/secp256k1/struct.SecretKey.html) as arguments,
311311
and returns a [`Signature`](https://docs.rs/secp256k1/0.29.0/secp256k1/ecdsa/struct.Signature.html) type.
312312

313313
In the next step, we update the witness stack for the input we just signed by first converting the `sighash_cache` into a [`Transaction`](https://docs.rs/bitcoin/0.32.0/bitcoin/blockdata/transaction/struct.Transaction.html)
@@ -337,7 +337,7 @@ This transaction is now ready to be broadcast to the Bitcoin network.
337337
[^change]: Please note that the `CHANGE_AMOUNT` is not the same as the `DUMMY_UTXO_AMOUNT` minus the `SPEND_AMOUNT`.
338338
This is due to the fact that we need to pay a fee for the transaction.
339339

340-
[^expect]: We will be unwraping any [`Option<T>`](https://doc.rust-lang.org/std/option)/[`Result<T, E>`](https://doc.rust-lang.org/std/result)
340+
[^expect]: We will be unwrapping any [`Option<T>`](https://doc.rust-lang.org/std/option)/[`Result<T, E>`](https://doc.rust-lang.org/std/result)
341341
with the `expect` method.
342342

343343
[^secp]: Under the hood we are using the [`secp256k1`](https://github.com/rust-bitcoin/rust-secp256k1/) crate to generate the key pair.
@@ -346,4 +346,3 @@ This transaction is now ready to be broadcast to the Bitcoin network.
346346
[secp256k1](https://en.bitcoin.it/wiki/Secp256k1).
347347

348348
[^spend]: And also we are locking the output to an address that we control:
349-
the `wpkh` public key hash that we generated earlier.

cookbook/src/tx_taproot.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ fn senders_keys<C: Signing>(secp: &Secp256k1<C>) -> Keypair {
6262
This will be useful to mock a sender.
6363
In a real application these would be actual secrets[^secp].
6464
We use the `SecretKey::new` method to generate a random private key `sk`.
65-
We then use the [`Keypair::from_secret_key`](https://docs.rs/bitcoin/0.32.0/bitcoin/key/struct.Keypair.html#method.from_secret_key) method to instatiate a [`Keypair`](https://docs.rs/bitcoin/0.32.0/bitcoin/key/struct.Keypair.html) type,
65+
We then use the [`Keypair::from_secret_key`](https://docs.rs/bitcoin/0.32.0/bitcoin/key/struct.Keypair.html#method.from_secret_key) method to instantiate a [`Keypair`](https://docs.rs/bitcoin/0.32.0/bitcoin/key/struct.Keypair.html) type,
6666
which is a data structure that holds a keypair consisting of a secret and a public key.
6767
Note that `senders_keys` is generic over the [`Signing`](https://docs.rs/secp256k1/0.29.0/secp256k1/trait.Signing.html) trait.
6868
This is used to indicate that is an instance of `Secp256k1` and can be used for signing.
@@ -320,7 +320,7 @@ It takes the following arguments:
320320

321321
- `input_index` is the index of the input we are signing; it is a [`usize`](https://doc.rust-lang.org/std/primitive.usize.html) type.
322322
We are using `0` since we only have one input.
323-
- `&prevouts` is a refence to the [`Prevouts`](https://docs.rs/bitcoin/0.32.0/bitcoin/sighash/enum.Prevouts.html) enum that we defined earlier.
323+
- `&prevouts` is a reference to the [`Prevouts`](https://docs.rs/bitcoin/0.32.0/bitcoin/sighash/enum.Prevouts.html) enum that we defined earlier.
324324
This is used to reference the outputs of previous transactions and also used to calculate our transaction value.
325325
- `annex` is an optional argument that is used to pass the annex data.
326326
We are not using it, so we are passing `None`.
@@ -338,7 +338,7 @@ This is a the message that we will sign.
338338
The [Message::from](https://docs.rs/secp256k1/0.29.0/secp256k1/struct.Message.html#impl-From%3C%26%27_%20bitcoin%3A%3Ahashes%3A%3Asha256d%3A%3AHash%3E) method takes anything that implements the promises to be a thirty two byte hash i.e., 32 bytes that came from a cryptographically secure hashing algorithm.
339339

340340
We compute the signature `sig` by using the [`sign_schnorr`](https://docs.rs/secp256k1/0.29.0/secp256k1/struct.Secp256k1.html#method.sign_schnorr) method.
341-
It takes a refence to a [`Message`](https://docs.rs/secp256k1/0.29.0/secp256k1/struct.Message.html) and a reference to a [`Keypair`](https://docs.rs/secp256k1/0.29.0/secp256k1/struct.Keypair.html) as arguments,
341+
It takes a reference to a [`Message`](https://docs.rs/secp256k1/0.29.0/secp256k1/struct.Message.html) and a reference to a [`Keypair`](https://docs.rs/secp256k1/0.29.0/secp256k1/struct.Keypair.html) as arguments,
342342
and returns a [`Signature`](https://docs.rs/secp256k1/0.29.0/secp256k1/ecdsa/struct.Signature.html) type.
343343

344344
In the next step, we update the witness stack for the input we just signed by first converting the `sighash_cache` into a [`Transaction`](https://docs.rs/bitcoin/0.32.0/bitcoin/blockdata/transaction/struct.Transaction.html)
@@ -356,7 +356,7 @@ This transaction is now ready to be broadcast to the Bitcoin network.
356356
[^change]: Please note that the `CHANGE_AMOUNT` is not the same as the `DUMMY_UTXO_AMOUNT` minus the `SPEND_AMOUNT`.
357357
This is due to the fact that we need to pay a fee for the transaction.
358358

359-
[^expect]: We will be unwraping any [`Option<T>`](https://doc.rust-lang.org/std/option)/[`Result<T, E>`](https://doc.rust-lang.org/std/result)
359+
[^expect]: We will be unwrapping any [`Option<T>`](https://doc.rust-lang.org/std/option)/[`Result<T, E>`](https://doc.rust-lang.org/std/result)
360360
with the `expect` method.
361361

362362
[^secp]: Under the hood we are using the [`secp256k1`](https://github.com/rust-bitcoin/rust-secp256k1/) crate to generate the key pair.

0 commit comments

Comments
 (0)