Skip to content

Commit d4adbd3

Browse files
committed
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 00eadc6 commit d4adbd3

File tree

5 files changed

+69
-64
lines changed

5 files changed

+69
-64
lines changed

program/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ A token program on the Solana blockchain, usable for fungible and non-fungible t
55
This program provides an interface and implementation that third parties can
66
utilize to create and use their tokens.
77

8-
Full documentation is available at https://spl.solana.com/token
8+
Full documentation is available at the [SPL Token docs](https://spl.solana.com/token).
99

1010
## Audit
1111

program/src/instruction.rs

Lines changed: 38 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use {
1616
pub const MIN_SIGNERS: usize = 1;
1717
/// Maximum number of multisignature signers (max N)
1818
pub const MAX_SIGNERS: usize = 11;
19-
/// Serialized length of a u64, for unpacking
19+
/// Serialized length of a `u64`, for unpacking
2020
const U64_BYTES: usize = 8;
2121

2222
/// Instructions supported by the token program.
@@ -80,8 +80,8 @@ pub enum TokenInstruction<'a> {
8080
///
8181
/// 0. `[writable]` The multisignature account to initialize.
8282
/// 1. `[]` Rent sysvar
83-
/// 2. ..2+N. `[]` The signer accounts, must equal to N where 1 <= N <=
84-
/// 11.
83+
/// 2. ..`2+N`. `[]` The signer accounts, must equal to N where `1 <= N <=
84+
/// 11`.
8585
InitializeMultisig {
8686
/// The number of signers (M) required to validate this multisignature
8787
/// account.
@@ -103,7 +103,7 @@ pub enum TokenInstruction<'a> {
103103
/// 0. `[writable]` The source account.
104104
/// 1. `[writable]` The destination account.
105105
/// 2. `[]` The source account's multisignature owner/delegate.
106-
/// 3. ..3+M `[signer]` M signer accounts.
106+
/// 3. ..`3+M` `[signer]` M signer accounts.
107107
Transfer {
108108
/// The amount of tokens to transfer.
109109
amount: u64,
@@ -122,7 +122,7 @@ pub enum TokenInstruction<'a> {
122122
/// 0. `[writable]` The source account.
123123
/// 1. `[]` The delegate.
124124
/// 2. `[]` The source account's multisignature owner.
125-
/// 3. ..3+M `[signer]` M signer accounts
125+
/// 3. ..`3+M` `[signer]` M signer accounts
126126
Approve {
127127
/// The amount of tokens the delegate is approved for.
128128
amount: u64,
@@ -138,7 +138,7 @@ pub enum TokenInstruction<'a> {
138138
/// * Multisignature owner
139139
/// 0. `[writable]` The source account.
140140
/// 1. `[]` The source account's multisignature owner.
141-
/// 2. ..2+M `[signer]` M signer accounts
141+
/// 2. ..`2+M` `[signer]` M signer accounts
142142
Revoke,
143143
/// Sets a new authority of a mint or account.
144144
///
@@ -151,7 +151,7 @@ pub enum TokenInstruction<'a> {
151151
/// * Multisignature authority
152152
/// 0. `[writable]` The mint or account to change the authority of.
153153
/// 1. `[]` The mint's or account's current multisignature authority.
154-
/// 2. ..2+M `[signer]` M signer accounts
154+
/// 2. ..`2+M` `[signer]` M signer accounts
155155
SetAuthority {
156156
/// The type of authority to update.
157157
authority_type: AuthorityType,
@@ -172,7 +172,7 @@ pub enum TokenInstruction<'a> {
172172
/// 0. `[writable]` The mint.
173173
/// 1. `[writable]` The account to mint tokens to.
174174
/// 2. `[]` The mint's multisignature mint-tokens authority.
175-
/// 3. ..3+M `[signer]` M signer accounts.
175+
/// 3. ..`3+M` `[signer]` M signer accounts.
176176
MintTo {
177177
/// The amount of new tokens to mint.
178178
amount: u64,
@@ -191,7 +191,7 @@ pub enum TokenInstruction<'a> {
191191
/// 0. `[writable]` The account to burn from.
192192
/// 1. `[writable]` The token mint.
193193
/// 2. `[]` The account's multisignature owner/delegate.
194-
/// 3. ..3+M `[signer]` M signer accounts.
194+
/// 3. ..`3+M` `[signer]` M signer accounts.
195195
Burn {
196196
/// The amount of tokens to burn.
197197
amount: u64,
@@ -210,9 +210,9 @@ pub enum TokenInstruction<'a> {
210210
/// 0. `[writable]` The account to close.
211211
/// 1. `[writable]` The destination account.
212212
/// 2. `[]` The account's multisignature owner.
213-
/// 3. ..3+M `[signer]` M signer accounts.
213+
/// 3. ..`3+M` `[signer]` M signer accounts.
214214
CloseAccount,
215-
/// Freeze an Initialized account using the Mint's freeze_authority (if
215+
/// Freeze an Initialized account using the Mint's `freeze_authority` (if
216216
/// set).
217217
///
218218
/// Accounts expected by this instruction:
@@ -226,9 +226,9 @@ pub enum TokenInstruction<'a> {
226226
/// 0. `[writable]` The account to freeze.
227227
/// 1. `[]` The token mint.
228228
/// 2. `[]` The mint's multisignature freeze authority.
229-
/// 3. ..3+M `[signer]` M signer accounts.
229+
/// 3. ..`3+M` `[signer]` M signer accounts.
230230
FreezeAccount,
231-
/// Thaw a Frozen account using the Mint's freeze_authority (if set).
231+
/// Thaw a Frozen account using the Mint's `freeze_authority` (if set).
232232
///
233233
/// Accounts expected by this instruction:
234234
///
@@ -241,7 +241,7 @@ pub enum TokenInstruction<'a> {
241241
/// 0. `[writable]` The account to freeze.
242242
/// 1. `[]` The token mint.
243243
/// 2. `[]` The mint's multisignature freeze authority.
244-
/// 3. ..3+M `[signer]` M signer accounts.
244+
/// 3. ..`3+M` `[signer]` M signer accounts.
245245
ThawAccount,
246246

247247
/// Transfers tokens from one account to another either directly or via a
@@ -266,7 +266,7 @@ pub enum TokenInstruction<'a> {
266266
/// 1. `[]` The token mint.
267267
/// 2. `[writable]` The destination account.
268268
/// 3. `[]` The source account's multisignature owner/delegate.
269-
/// 4. ..4+M `[signer]` M signer accounts.
269+
/// 4. ..`4+M` `[signer]` M signer accounts.
270270
TransferChecked {
271271
/// The amount of tokens to transfer.
272272
amount: u64,
@@ -293,7 +293,7 @@ pub enum TokenInstruction<'a> {
293293
/// 1. `[]` The token mint.
294294
/// 2. `[]` The delegate.
295295
/// 3. `[]` The source account's multisignature owner.
296-
/// 4. ..4+M `[signer]` M signer accounts
296+
/// 4. ..`4+M` `[signer]` M signer accounts
297297
ApproveChecked {
298298
/// The amount of tokens the delegate is approved for.
299299
amount: u64,
@@ -303,8 +303,8 @@ pub enum TokenInstruction<'a> {
303303
/// Mints new tokens to an account. The native mint does not support
304304
/// minting.
305305
///
306-
/// This instruction differs from MintTo in that the decimals value is
307-
/// checked by the caller. This may be useful when creating transactions
306+
/// This instruction differs from `MintTo` in that the decimals value is
307+
/// checked by the caller. This may be useful when creating transactions
308308
/// offline or within a hardware wallet.
309309
///
310310
/// Accounts expected by this instruction:
@@ -318,7 +318,7 @@ pub enum TokenInstruction<'a> {
318318
/// 0. `[writable]` The mint.
319319
/// 1. `[writable]` The account to mint tokens to.
320320
/// 2. `[]` The mint's multisignature mint-tokens authority.
321-
/// 3. ..3+M `[signer]` M signer accounts.
321+
/// 3. ..`3+M` `[signer]` M signer accounts.
322322
MintToChecked {
323323
/// The amount of new tokens to mint.
324324
amount: u64,
@@ -344,17 +344,17 @@ pub enum TokenInstruction<'a> {
344344
/// 0. `[writable]` The account to burn from.
345345
/// 1. `[writable]` The token mint.
346346
/// 2. `[]` The account's multisignature owner/delegate.
347-
/// 3. ..3+M `[signer]` M signer accounts.
347+
/// 3. ..`3+M` `[signer]` M signer accounts.
348348
BurnChecked {
349349
/// The amount of tokens to burn.
350350
amount: u64,
351351
/// Expected number of base 10 digits to the right of the decimal place.
352352
decimals: u8,
353353
},
354-
/// Like InitializeAccount, but the owner pubkey is passed via instruction
355-
/// data rather than the accounts list. This variant may be preferable
356-
/// when using Cross Program Invocation from an instruction that does
357-
/// not need the owner's `AccountInfo` otherwise.
354+
/// Like [`InitializeAccount`], but the owner pubkey is passed via
355+
/// instruction data rather than the accounts list. This variant may be
356+
/// preferable when using Cross Program Invocation from an instruction
357+
/// that does not need the owner's `AccountInfo` otherwise.
358358
///
359359
/// Accounts expected by this instruction:
360360
///
@@ -376,7 +376,7 @@ pub enum TokenInstruction<'a> {
376376
/// 0. `[writable]` The native token account to sync with its underlying
377377
/// lamports.
378378
SyncNative,
379-
/// Like InitializeAccount2, but does not require the Rent sysvar to be
379+
/// Like [`InitializeAccount2`], but does not require the Rent sysvar to be
380380
/// provided
381381
///
382382
/// Accounts expected by this instruction:
@@ -387,14 +387,14 @@ pub enum TokenInstruction<'a> {
387387
/// The new account's owner/multisignature.
388388
owner: Pubkey,
389389
},
390-
/// Like InitializeMultisig, but does not require the Rent sysvar to be
390+
/// Like [`InitializeMultisig`], but does not require the Rent sysvar to be
391391
/// provided
392392
///
393393
/// Accounts expected by this instruction:
394394
///
395395
/// 0. `[writable]` The multisignature account to initialize.
396-
/// 1. ..1+N. `[]` The signer accounts, must equal to N where 1 <= N <=
397-
/// 11.
396+
/// 1. ..`1+N` `[]` The signer accounts, must equal to N where `1 <= N <=
397+
/// 11`.
398398
InitializeMultisig2 {
399399
/// The number of signers (M) required to validate this multisignature
400400
/// account.
@@ -439,7 +439,7 @@ pub enum TokenInstruction<'a> {
439439
/// Data expected by this instruction:
440440
/// None
441441
InitializeImmutableOwner,
442-
/// Convert an Amount of tokens to a UiAmount `string`, using the given
442+
/// Convert an Amount of tokens to a `UiAmount` string, using the given
443443
/// mint. In this version of the program, the mint can only specify the
444444
/// number of decimals.
445445
///
@@ -455,9 +455,9 @@ pub enum TokenInstruction<'a> {
455455
/// The amount of tokens to reformat.
456456
amount: u64,
457457
},
458-
/// Convert a UiAmount of tokens to a little-endian `u64` raw Amount, using
459-
/// the given mint. In this version of the program, the mint can only
460-
/// specify the number of decimals.
458+
/// Convert a `UiAmount` of tokens to a little-endian `u64` raw Amount,
459+
/// using the given mint. In this version of the program, the mint can
460+
/// only specify the number of decimals.
461461
///
462462
/// Return data can be fetched using `sol_get_return_data` and deserializing
463463
/// the return data as a little-endian `u64`.
@@ -466,7 +466,7 @@ pub enum TokenInstruction<'a> {
466466
///
467467
/// 0. `[]` The mint to calculate for
468468
UiAmountToAmount {
469-
/// The ui_amount of tokens to reformat.
469+
/// The `ui_amount` of tokens to reformat.
470470
ui_amount: &'a str,
471471
},
472472
// Any new variants also need to be added to program-2022 `TokenInstruction`, so that the
@@ -475,7 +475,7 @@ pub enum TokenInstruction<'a> {
475475
}
476476
impl<'a> TokenInstruction<'a> {
477477
/// Unpacks a byte buffer into a
478-
/// [TokenInstruction](enum.TokenInstruction.html).
478+
/// [`TokenInstruction`](enum.TokenInstruction.html).
479479
pub fn unpack(input: &'a [u8]) -> Result<Self, ProgramError> {
480480
use TokenError::InvalidInstruction;
481481

@@ -579,7 +579,7 @@ impl<'a> TokenInstruction<'a> {
579579
})
580580
}
581581

582-
/// Packs a [TokenInstruction](enum.TokenInstruction.html) into a byte
582+
/// Packs a [`TokenInstruction`](enum.TokenInstruction.html) into a byte
583583
/// buffer.
584584
pub fn pack(&self) -> Vec<u8> {
585585
let mut buf = Vec::with_capacity(size_of::<Self>());
@@ -738,7 +738,7 @@ impl<'a> TokenInstruction<'a> {
738738
}
739739
}
740740

741-
/// Specifies the authority type for SetAuthority instructions
741+
/// Specifies the authority type for `SetAuthority` instructions
742742
#[repr(u8)]
743743
#[derive(Clone, Debug, PartialEq)]
744744
pub enum AuthorityType {
@@ -1431,7 +1431,8 @@ pub fn ui_amount_to_amount(
14311431
})
14321432
}
14331433

1434-
/// Utility function that checks index is between MIN_SIGNERS and MAX_SIGNERS
1434+
/// Utility function that checks index is between `MIN_SIGNERS` and
1435+
/// `MAX_SIGNERS`
14351436
pub fn is_valid_signer_index(index: usize) -> bool {
14361437
(MIN_SIGNERS..=MAX_SIGNERS).contains(&index)
14371438
}

program/src/native_mint.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//! The Mint that represents the native token
22
3-
/// There are 10^9 lamports in one SOL
3+
/// There are `10^9` lamports in one SOL
44
pub const DECIMALS: u8 = 9;
55

66
// The Mint for native SOL Token accounts

0 commit comments

Comments
 (0)