Skip to content
This repository was archived by the owner on Mar 11, 2025. It is now read-only.

Commit 2479c1e

Browse files
authored
token: Fix typos for cargo-spellcheck (#7503)
* token: Fix typos #### Problem There are typos in the token code, and people sometimes fix them, but mostly don't. #### Summary of changes Starting with the `token/*` directory, fix all typos or properly put them between backticks if they're code. These were all found using `cargo spellcheck` and a specialized dictionary with programming / Solana / ZK terminology. Once all of the typos are fixed, then we can add the spellchecking to CI. * Update doctests
1 parent 5e86285 commit 2479c1e

File tree

57 files changed

+358
-316
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+358
-316
lines changed

token/cli/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# SPL Token program command-line utility
22

3-
A basic command-line for creating and using SPL Tokens. See https://spl.solana.com/token for more details
3+
A basic command-line for creating and using SPL Tokens. See <https://spl.solana.com/token> for more details
44

55
## Build
66

token/cli/src/encryption_keypair.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//! Temporary ElGamal keypair argument parser.
22
//!
3-
//! NOTE: this module should be remoeved in the next Solana upgrade.
3+
//! NOTE: this module should be removed in the next Solana upgrade.
44
55
use {
66
base64::{prelude::BASE64_STANDARD, Engine},

token/client/src/token.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -901,7 +901,7 @@ where
901901
mint_result
902902
}
903903

904-
/// Retrive mint information.
904+
/// Retrieve mint information.
905905
pub async fn get_mint_info(&self) -> TokenResult<StateWithExtensionsOwned<Mint>> {
906906
let account = self.get_account(self.pubkey).await?;
907907
self.unpack_mint_info(account)
@@ -1669,7 +1669,7 @@ where
16691669
}
16701670

16711671
/// Reallocate a token account to be large enough for a set of
1672-
/// ExtensionTypes
1672+
/// `ExtensionType`s
16731673
pub async fn reallocate<S: Signers>(
16741674
&self,
16751675
account: &Pubkey,

token/confidential-transfer/ciphertext-arithmetic/src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ pub fn subtract_from(
119119
Some(ristretto_to_elgamal_ciphertext(&result_commitment, &handle))
120120
}
121121

122-
/// Convert a `u64` amount into a curve25519 scalar
122+
/// Convert a `u64` amount into a curve-25519 scalar
123123
fn u64_to_scalar(amount: u64) -> PodScalar {
124124
let mut amount_bytes = [0u8; 32];
125125
amount_bytes[..8].copy_from_slice(&amount.to_le_bytes());
@@ -141,7 +141,7 @@ fn elgamal_ciphertext_to_ristretto(
141141
}
142142

143143
/// Convert a pair of `PodRistrettoPoint` to a `PodElGamalCiphertext`
144-
/// interpretting the first as the commitment and the second as the handle
144+
/// interpreting the first as the commitment and the second as the handle
145145
fn ristretto_to_elgamal_ciphertext(
146146
commitment: &PodRistrettoPoint,
147147
handle: &PodRistrettoPoint,

token/confidential-transfer/proof-extraction/src/instruction.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ pub fn check_zk_elgamal_proof_program_account(
3434
}
3535

3636
/// If a proof is to be read from a record account, the proof instruction data
37-
/// must be 5 bytes: 1 byte for the proof type and 4 bytes for the u32 offset
37+
/// must be 5 bytes: 1 byte for the proof type and 4 bytes for the `u32` offset
3838
const INSTRUCTION_DATA_LENGTH_WITH_RECORD_ACCOUNT: usize = 5;
3939

4040
/// Decodes the proof context data associated with a zero-knowledge proof

token/confidential-transfer/proof-extraction/src/transfer.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ pub struct TransferPubkeys {
2121

2222
/// The proof context information needed to process a [Transfer] instruction.
2323
pub struct TransferProofContext {
24-
/// Ciphertext containing the low 16 bits of the transafer amount
24+
/// Ciphertext containing the low 16 bits of the transfer amount
2525
pub ciphertext_lo: PodTransferAmountCiphertext,
26-
/// Ciphertext containing the high 32 bits of the transafer amount
26+
/// Ciphertext containing the high 32 bits of the transfer amount
2727
pub ciphertext_hi: PodTransferAmountCiphertext,
2828
/// The transfer public keys associated with a transfer
2929
pub transfer_pubkeys: TransferPubkeys,

token/confidential-transfer/proof-extraction/src/transfer_with_fee.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ pub struct TransferWithFeeProofContext {
4848
pub ciphertext_lo: PodTransferAmountCiphertext,
4949
/// Group encryption of the high 48 bits of the transfer amount
5050
pub ciphertext_hi: PodTransferAmountCiphertext,
51-
/// The public encryption keys associated with the transfer: source, dest,
52-
/// auditor, and withdraw withheld authority
51+
/// The public encryption keys associated with the transfer: source,
52+
/// destination, auditor, and withdraw withheld authority
5353
pub transfer_with_fee_pubkeys: TransferWithFeePubkeys,
5454
/// The final spendable ciphertext after the transfer,
5555
pub new_source_ciphertext: PodElGamalCiphertext,
@@ -250,20 +250,20 @@ impl TransferWithFeeProofContext {
250250
}
251251
}
252252

253-
/// Ristretto generator point for curve25519
253+
/// Ristretto generator point for curve-25519
254254
const G: PodRistrettoPoint = PodRistrettoPoint([
255255
226, 242, 174, 10, 106, 188, 78, 113, 168, 132, 169, 97, 197, 0, 81, 95, 88, 227, 11, 106, 165,
256256
130, 221, 141, 182, 166, 89, 69, 224, 141, 45, 118,
257257
]);
258258

259-
/// Convert a `u64` amount into a curve25519 scalar
259+
/// Convert a `u64` amount into a curve-25519 scalar
260260
fn u64_to_scalar(amount: u64) -> PodScalar {
261261
let mut bytes = [0u8; 32];
262262
bytes[..8].copy_from_slice(&amount.to_le_bytes());
263263
PodScalar(bytes)
264264
}
265265

266-
/// Convert a `u16` amount into a curve25519 scalar
266+
/// Convert a `u16` amount into a curve-25519 scalar
267267
fn u16_to_scalar(amount: u16) -> PodScalar {
268268
let mut bytes = [0u8; 32];
269269
bytes[..2].copy_from_slice(&amount.to_le_bytes());

token/confidential-transfer/proof-generation/src/lib.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ pub const TRANSFER_AMOUNT_HI_BITS: usize = 32;
2626
pub const REMAINING_BALANCE_BIT_LENGTH: usize = 64;
2727

2828
/// Takes in a 64-bit number `amount` and a bit length `bit_length`. It returns:
29-
/// - the `bit_length` low bits of `amount` interpretted as u64
30-
/// - the `(64 - bit_length)` high bits of `amount` interpretted as u64
29+
/// - the `bit_length` low bits of `amount` interpreted as `u64`
30+
/// - the `(64 - bit_length)` high bits of `amount` interpreted as `u64`
3131
pub fn try_split_u64(amount: u64, bit_length: usize) -> Option<(u64, u64)> {
3232
match bit_length {
3333
0 => Some((0, amount)),
@@ -45,7 +45,7 @@ pub fn try_split_u64(amount: u64, bit_length: usize) -> Option<(u64, u64)> {
4545
}
4646
}
4747

48-
/// Combine two numbers that are interpretted as the low and high bits of a
48+
/// Combine two numbers that are interpreted as the low and high bits of a
4949
/// target number. The `bit_length` parameter specifies the number of bits that
5050
/// `amount_hi` is to be shifted by.
5151
pub fn try_combine_lo_hi_u64(amount_lo: u64, amount_hi: u64, bit_length: usize) -> Option<u64> {

token/program-2022/src/extension/confidential_mint_burn/account_info.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@ pub struct SupplyAccountInfo {
2525
pub current_supply: PodElGamalCiphertext,
2626
/// The decryptable supply
2727
pub decryptable_supply: PodAeCiphertext,
28-
/// The supply's elgamal pubkey
28+
/// The supply's ElGamal pubkey
2929
pub supply_elgamal_pubkey: PodElGamalPubkey,
3030
}
3131

3232
impl SupplyAccountInfo {
33-
/// Creates a SupplyAccountInfo from ConfidentialMintBurn extension account
34-
/// data
33+
/// Creates a `SupplyAccountInfo` from `ConfidentialMintBurn` extension
34+
/// account data
3535
pub fn new(extension: &ConfidentialMintBurn) -> Self {
3636
Self {
3737
current_supply: extension.confidential_supply,
@@ -41,7 +41,7 @@ impl SupplyAccountInfo {
4141
}
4242

4343
/// Computes the current supply from the decryptable supply and the
44-
/// difference between the decryptable supply and the elgamal encrypted
44+
/// difference between the decryptable supply and the ElGamal encrypted
4545
/// supply ciphertext
4646
pub fn decrypt_current_supply(
4747
&self,

token/program-2022/src/extension/confidential_mint_burn/instruction.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ pub struct InitializeMintData {
194194
/// The ElGamal pubkey used to encrypt the confidential supply
195195
#[cfg_attr(feature = "serde-traits", serde(with = "elgamalpubkey_fromstr"))]
196196
pub supply_elgamal_pubkey: PodElGamalPubkey,
197-
/// The initial 0 supply ecrypted with the supply aes key
197+
/// The initial 0 supply encrypted with the supply aes key
198198
#[cfg_attr(feature = "serde-traits", serde(with = "aeciphertext_fromstr"))]
199199
pub decryptable_supply: PodAeCiphertext,
200200
}

token/program-2022/src/extension/confidential_mint_burn/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use {
99

1010
/// Maximum bit length of any mint or burn amount
1111
///
12-
/// Any mint or burn amount must be less than 2^48
12+
/// Any mint or burn amount must be less than `2^48`
1313
pub const MAXIMUM_DEPOSIT_TRANSFER_AMOUNT: u64 = (u16::MAX as u64) + (1 << 16) * (u32::MAX as u64);
1414

1515
/// Bit length of the low bits of pending balance plaintext

token/program-2022/src/extension/confidential_mint_burn/processor.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ use {
3737
spl_token_confidential_transfer_proof_extraction::instruction::verify_and_extract_context,
3838
};
3939

40-
/// Processes an [InitializeMint] instruction.
40+
/// Processes an [`InitializeMint`] instruction.
4141
fn process_initialize_mint(accounts: &[AccountInfo], data: &InitializeMintData) -> ProgramResult {
4242
let account_info_iter = &mut accounts.iter();
4343
let mint_info = next_account_info(account_info_iter)?;
@@ -54,7 +54,7 @@ fn process_initialize_mint(accounts: &[AccountInfo], data: &InitializeMintData)
5454
Ok(())
5555
}
5656

57-
/// Processes an [RotateSupplyElGamal] instruction.
57+
/// Processes an [`RotateSupplyElGamal`] instruction.
5858
#[cfg(feature = "zk-ops")]
5959
fn process_rotate_supply_elgamal_pubkey(
6060
program_id: &Pubkey,
@@ -110,7 +110,7 @@ fn process_rotate_supply_elgamal_pubkey(
110110
Ok(())
111111
}
112112

113-
/// Processes an [UpdateAuthority] instruction.
113+
/// Processes an [`UpdateAuthority`] instruction.
114114
fn process_update_decryptable_supply(
115115
program_id: &Pubkey,
116116
accounts: &[AccountInfo],
@@ -142,7 +142,7 @@ fn process_update_decryptable_supply(
142142
Ok(())
143143
}
144144

145-
/// Processes a [ConfidentialMint] instruction.
145+
/// Processes a [`ConfidentialMint`] instruction.
146146
#[cfg(feature = "zk-ops")]
147147
fn process_confidential_mint(
148148
program_id: &Pubkey,
@@ -267,7 +267,7 @@ fn process_confidential_mint(
267267
Ok(())
268268
}
269269

270-
/// Processes a [ConfidentialBurn] instruction.
270+
/// Processes a [`ConfidentialBurn`] instruction.
271271
#[cfg(feature = "zk-ops")]
272272
fn process_confidential_burn(
273273
program_id: &Pubkey,

token/program-2022/src/extension/confidential_mint_burn/verify_proof.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ use {
1717
std::slice::Iter,
1818
};
1919

20-
/// Verify zero-knowledge proofs needed for a [ConfidentialMint] instruction and
21-
/// return the corresponding proof context information.
20+
/// Verify zero-knowledge proofs needed for a [`ConfidentialMint`] instruction
21+
/// and return the corresponding proof context information.
2222
#[cfg(feature = "zk-ops")]
2323
pub fn verify_mint_proof(
2424
account_info_iter: &mut Iter<'_, AccountInfo<'_>>,
@@ -65,8 +65,8 @@ pub fn verify_mint_proof(
6565
.map_err(|e| -> TokenError { e.into() })?)
6666
}
6767

68-
/// Verify zero-knowledge proofs needed for a [ConfidentialBurn] instruction and
69-
/// return the corresponding proof context information.
68+
/// Verify zero-knowledge proofs needed for a [`ConfidentialBurn`] instruction
69+
/// and return the corresponding proof context information.
7070
#[cfg(feature = "zk-ops")]
7171
pub fn verify_burn_proof(
7272
account_info_iter: &mut Iter<'_, AccountInfo<'_>>,

token/program-2022/src/extension/confidential_transfer/instruction.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,7 @@ pub enum ConfidentialTransferInstruction {
494494
/// validity proof as well as the token owner signature.
495495
///
496496
/// If the token account is not large enough to include the new
497-
/// cconfidential transfer extension, then optionally reallocate the
497+
/// confidential transfer extension, then optionally reallocate the
498498
/// account to increase the data size. To reallocate, a payer account to
499499
/// fund the reallocation and the system account should be included in the
500500
/// instruction.

token/program-2022/src/extension/confidential_transfer/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use {
1717

1818
/// Maximum bit length of any deposit or transfer amount
1919
///
20-
/// Any deposit or transfer amount must be less than 2^48
20+
/// Any deposit or transfer amount must be less than `2^48`
2121
pub const MAXIMUM_DEPOSIT_TRANSFER_AMOUNT: u64 = (u16::MAX as u64) + (1 << 16) * (u32::MAX as u64);
2222

2323
/// Bit length of the low bits of pending balance plaintext
@@ -64,7 +64,7 @@ pub struct ConfidentialTransferMint {
6464
/// `ConfidentialTransferInstruction::ConfigureAccount`)
6565
pub auto_approve_new_accounts: PodBool,
6666

67-
/// Authority to decode any transfer amount in a confidential transafer.
67+
/// Authority to decode any transfer amount in a confidential transfer.
6868
pub auditor_elgamal_pubkey: OptionalNonZeroElGamalPubkey,
6969
}
7070

token/program-2022/src/extension/confidential_transfer/processor.rs

+13-13
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ use {
4545
},
4646
};
4747

48-
/// Processes an [InitializeMint] instruction.
48+
/// Processes an [`InitializeMint`] instruction.
4949
fn process_initialize_mint(
5050
accounts: &[AccountInfo],
5151
authority: &OptionalNonZeroPubkey,
@@ -67,7 +67,7 @@ fn process_initialize_mint(
6767
Ok(())
6868
}
6969

70-
/// Processes an [UpdateMint] instruction.
70+
/// Processes an [`UpdateMint`] instruction.
7171
fn process_update_mint(
7272
accounts: &[AccountInfo],
7373
auto_approve_new_account: PodBool,
@@ -104,7 +104,7 @@ enum ElGamalPubkeySource<'a> {
104104
ElGamalRegistry(&'a ElGamalRegistry),
105105
}
106106

107-
/// Processes a [ConfigureAccountWithRegistry] instruction.
107+
/// Processes a [`ConfigureAccountWithRegistry`] instruction.
108108
fn process_configure_account_with_registry(
109109
program_id: &Pubkey,
110110
accounts: &[AccountInfo],
@@ -195,7 +195,7 @@ fn reallocate_for_configure_account_with_registry<'a>(
195195
Ok(())
196196
}
197197

198-
/// Processes a [ConfigureAccount] instruction.
198+
/// Processes a [`ConfigureAccount`] instruction.
199199
fn process_configure_account(
200200
program_id: &Pubkey,
201201
accounts: &[AccountInfo],
@@ -292,7 +292,7 @@ fn process_configure_account(
292292
Ok(())
293293
}
294294

295-
/// Processes an [ApproveAccount] instruction.
295+
/// Processes an [`ApproveAccount`] instruction.
296296
fn process_approve_account(accounts: &[AccountInfo]) -> ProgramResult {
297297
let account_info_iter = &mut accounts.iter();
298298
let token_account_info = next_account_info(account_info_iter)?;
@@ -326,7 +326,7 @@ fn process_approve_account(accounts: &[AccountInfo]) -> ProgramResult {
326326
}
327327
}
328328

329-
/// Processes an [EmptyAccount] instruction.
329+
/// Processes an [`EmptyAccount`] instruction.
330330
fn process_empty_account(
331331
program_id: &Pubkey,
332332
accounts: &[AccountInfo],
@@ -379,7 +379,7 @@ fn process_empty_account(
379379
Ok(())
380380
}
381381

382-
/// Processes a [Deposit] instruction.
382+
/// Processes a [`Deposit`] instruction.
383383
#[cfg(feature = "zk-ops")]
384384
fn process_deposit(
385385
program_id: &Pubkey,
@@ -480,7 +480,7 @@ pub fn verify_and_split_deposit_amount(amount: u64) -> Result<(u64, u64), TokenE
480480
Ok((deposit_amount_lo, deposit_amount_hi))
481481
}
482482

483-
/// Processes a [Withdraw] instruction.
483+
/// Processes a [`Withdraw`] instruction.
484484
#[cfg(feature = "zk-ops")]
485485
fn process_withdraw(
486486
program_id: &Pubkey,
@@ -584,7 +584,7 @@ fn process_withdraw(
584584
Ok(())
585585
}
586586

587-
/// Processes a [Transfer] or [TransferWithFee] instruction.
587+
/// Processes a [`Transfer`] or [`TransferWithFee`] instruction.
588588
#[allow(clippy::too_many_arguments)]
589589
#[cfg(feature = "zk-ops")]
590590
fn process_transfer(
@@ -1127,7 +1127,7 @@ fn process_destination_for_transfer_with_fee(
11271127
Ok(())
11281128
}
11291129

1130-
/// Processes an [ApplyPendingBalance] instruction.
1130+
/// Processes an [`ApplyPendingBalance`] instruction.
11311131
#[cfg(feature = "zk-ops")]
11321132
fn process_apply_pending_balance(
11331133
program_id: &Pubkey,
@@ -1177,7 +1177,7 @@ fn process_apply_pending_balance(
11771177
Ok(())
11781178
}
11791179

1180-
/// Processes a [DisableConfidentialCredits] or [EnableConfidentialCredits]
1180+
/// Processes a [`DisableConfidentialCredits`] or [`EnableConfidentialCredits`]
11811181
/// instruction.
11821182
fn process_allow_confidential_credits(
11831183
program_id: &Pubkey,
@@ -1208,8 +1208,8 @@ fn process_allow_confidential_credits(
12081208
Ok(())
12091209
}
12101210

1211-
/// Processes an [DisableNonConfidentialCredits] or
1212-
/// [EnableNonConfidentialCredits] instruction.
1211+
/// Processes an [`DisableNonConfidentialCredits`] or
1212+
/// [`EnableNonConfidentialCredits`] instruction.
12131213
fn process_allow_non_confidential_credits(
12141214
program_id: &Pubkey,
12151215
accounts: &[AccountInfo],

0 commit comments

Comments
 (0)