From 6968fbf178ef8a825afa32aa6501f8158bebe9df Mon Sep 17 00:00:00 2001 From: Jose Storopoli Date: Sat, 4 May 2024 09:07:29 +0000 Subject: [PATCH] ci: add typo checking --- .github/workflows/typos.yml | 17 +++++++++++++++++ .typos.toml | 16 ++++++++++++++++ cookbook/src/tx_segwit-v0.md | 5 ++--- cookbook/src/tx_taproot.md | 8 ++++---- 4 files changed, 39 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/typos.yml create mode 100644 .typos.toml diff --git a/.github/workflows/typos.yml b/.github/workflows/typos.yml new file mode 100644 index 0000000..f67d011 --- /dev/null +++ b/.github/workflows/typos.yml @@ -0,0 +1,17 @@ +name: Check Typos +on: + push: + branches: + - master + pull_request: {} + workflow_dispatch: null + +jobs: + typos: + runs-on: ubuntu-latest + steps: + - name: Checkout Actions Repository + uses: actions/checkout@v4 + + - name: Check spelling + uses: crate-ci/typos@master diff --git a/.typos.toml b/.typos.toml new file mode 100644 index 0000000..65d9564 --- /dev/null +++ b/.typos.toml @@ -0,0 +1,16 @@ +[default] + +[default.extend-words] +# NOTE: use here for false-positives +# EXAMPLE: PSBT = "PSBT" + +[files] +extend-exclude = ["site/themes/nightfall"] + +[type.gitignore] +extend-glob = [".gitignore"] +check-file = false + +[type.lock] +extend-glob = ["*.lock"] +check-file = false diff --git a/cookbook/src/tx_segwit-v0.md b/cookbook/src/tx_segwit-v0.md index eb788b7..5aa8392 100644 --- a/cookbook/src/tx_segwit-v0.md +++ b/cookbook/src/tx_segwit-v0.md @@ -307,7 +307,7 @@ This is the message that we will sign. 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. 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. -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, +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, and returns a [`Signature`](https://docs.rs/secp256k1/0.29.0/secp256k1/ecdsa/struct.Signature.html) type. 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. [^change]: Please note that the `CHANGE_AMOUNT` is not the same as the `DUMMY_UTXO_AMOUNT` minus the `SPEND_AMOUNT`. This is due to the fact that we need to pay a fee for the transaction. -[^expect]: We will be unwraping any [`Option`](https://doc.rust-lang.org/std/option)/[`Result`](https://doc.rust-lang.org/std/result) +[^expect]: We will be unwrapping any [`Option`](https://doc.rust-lang.org/std/option)/[`Result`](https://doc.rust-lang.org/std/result) with the `expect` method. [^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. [secp256k1](https://en.bitcoin.it/wiki/Secp256k1). [^spend]: And also we are locking the output to an address that we control: - the `wpkh` public key hash that we generated earlier. \ No newline at end of file diff --git a/cookbook/src/tx_taproot.md b/cookbook/src/tx_taproot.md index 54ec40d..f52e964 100644 --- a/cookbook/src/tx_taproot.md +++ b/cookbook/src/tx_taproot.md @@ -62,7 +62,7 @@ fn senders_keys(secp: &Secp256k1) -> Keypair { This will be useful to mock a sender. In a real application these would be actual secrets[^secp]. We use the `SecretKey::new` method to generate a random private key `sk`. -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, +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, which is a data structure that holds a keypair consisting of a secret and a public key. Note that `senders_keys` is generic over the [`Signing`](https://docs.rs/secp256k1/0.29.0/secp256k1/trait.Signing.html) trait. 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: - `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. We are using `0` since we only have one input. -- `&prevouts` is a refence to the [`Prevouts`](https://docs.rs/bitcoin/0.32.0/bitcoin/sighash/enum.Prevouts.html) enum that we defined earlier. +- `&prevouts` is a reference to the [`Prevouts`](https://docs.rs/bitcoin/0.32.0/bitcoin/sighash/enum.Prevouts.html) enum that we defined earlier. This is used to reference the outputs of previous transactions and also used to calculate our transaction value. - `annex` is an optional argument that is used to pass the annex data. We are not using it, so we are passing `None`. @@ -338,7 +338,7 @@ This is a the message that we will sign. 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. 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. -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, +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, and returns a [`Signature`](https://docs.rs/secp256k1/0.29.0/secp256k1/ecdsa/struct.Signature.html) type. 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. [^change]: Please note that the `CHANGE_AMOUNT` is not the same as the `DUMMY_UTXO_AMOUNT` minus the `SPEND_AMOUNT`. This is due to the fact that we need to pay a fee for the transaction. -[^expect]: We will be unwraping any [`Option`](https://doc.rust-lang.org/std/option)/[`Result`](https://doc.rust-lang.org/std/result) +[^expect]: We will be unwrapping any [`Option`](https://doc.rust-lang.org/std/option)/[`Result`](https://doc.rust-lang.org/std/result) with the `expect` method. [^secp]: Under the hood we are using the [`secp256k1`](https://github.com/rust-bitcoin/rust-secp256k1/) crate to generate the key pair.