Repository: solana-labs/solana-program-library
Pull request #6318 (2024-03-03 02:48:37)

fix some comments


Patch:
diff --git a/docs/src/transfer-hook-interface/examples.md b/docs/src/transfer-hook-interface/examples.md
index 9ac5672d4..7cc019430 100644
--- a/docs/src/transfer-hook-interface/examples.md
+++ b/docs/src/transfer-hook-interface/examples.md
@@ -136,7 +136,7 @@ instruction for some other program, which may not need them, if that program is
 going to CPI to your transfer hook program, it needs to have the proper
 accounts.
 
-Additionally, in order to perform a succesful dynamic account resolution, the
+Additionally, in order to perform a successful dynamic account resolution, the
 proper instruction needs to be provided to align with the instruction that was
 configured in the validation account - in this case the Transfer Hook
 interface's `ExecuteInstruction`. This is why we first create an
diff --git a/governance/program/src/state/legacy.rs b/governance/program/src/state/legacy.rs
index d2c659795..ee21d8fe0 100644
--- a/governance/program/src/state/legacy.rs
+++ b/governance/program/src/state/legacy.rs
@@ -212,7 +212,7 @@ pub struct ProposalV1 {
     /// The number of instructions included in the proposal
     pub instructions_count: u16,
 
-    /// The index of the the next instruction to be added
+    /// The index of the next instruction to be added
     pub instructions_next_index: u16,
 
     /// When the Proposal was created and entered Draft state
diff --git a/governance/program/src/state/proposal.rs b/governance/program/src/state/proposal.rs
index 8b28f88b7..05018b2bf 100644
--- a/governance/program/src/state/proposal.rs
+++ b/governance/program/src/state/proposal.rs
@@ -65,7 +65,7 @@ pub struct ProposalOption {
     /// The number of transactions included in the option
     pub transactions_count: u16,
 
-    /// The index of the the next transaction to be added
+    /// The index of the next transaction to be added
     pub transactions_next_index: u16,
 }
 
diff --git a/libraries/math/src/precise_number.rs b/libraries/math/src/precise_number.rs
index ac96401bc..6b16e2625 100644
--- a/libraries/math/src/precise_number.rs
+++ b/libraries/math/src/precise_number.rs
@@ -29,7 +29,7 @@ fn zero() -> InnerUint {
 
 impl PreciseNumber {
     /// Correction to apply to avoid truncation errors on division.  Since
-    /// integer operations will always floor the result, we artifically bump it
+    /// integer operations will always floor the result, we artificially bump it
     /// up by one half to get the expect result.
     fn rounding_correction() -> InnerUint {
         InnerUint::from(ONE / 2)
diff --git a/libraries/merkle-tree-reference/src/lib.rs b/libraries/merkle-tree-reference/src/lib.rs
index 81133b508..c6fb4adf5 100644
--- a/libraries/merkle-tree-reference/src/lib.rs
+++ b/libraries/merkle-tree-reference/src/lib.rs
@@ -31,7 +31,7 @@ pub fn recompute(mut leaf: Node, proof: &[Node], index: u32) -> Node {
     leaf
 }
 
-// Off-chain implentation to keep track of nodes
+// Off-chain implementation to keep track of nodes
 pub struct MerkleTree {
     pub leaf_nodes: Vec<Rc<RefCell<TreeNode>>>,
     pub root: Node,
diff --git a/libraries/tlv-account-resolution/src/account.rs b/libraries/tlv-account-resolution/src/account.rs
index 28413bdc3..38b8c5605 100644
--- a/libraries/tlv-account-resolution/src/account.rs
+++ b/libraries/tlv-account-resolution/src/account.rs
@@ -84,7 +84,7 @@ pub struct ExtraAccountMeta {
     /// Whether the account should be writable
     pub is_writable: PodBool,
 }
-/// Helper used to to know when the top bit is set, to interpret the
+/// Helper used to know when the top bit is set, to interpret the
 /// discriminator as an index rather than as a type
 const U8_TOP_BIT: u8 = 1 << 7;
 impl ExtraAccountMeta {
diff --git a/libraries/type-length-value/README.md b/libraries/type-length-value/README.md
index a10962ea4..24ccf8aff 100644
--- a/libraries/type-length-value/README.md
+++ b/libraries/type-length-value/README.md
@@ -95,7 +95,7 @@ let value2 = state.get_value_with_repetition::<MyOtherPodValue>(2).unwrap();
 
 The Solana blockchain exposes slabs of bytes to on-chain programs, allowing program
 writers to interpret these bytes and change them however they wish. Currently,
-programs interpet account bytes as being only of one type. For example, an token
+programs interpret account bytes as being only of one type. For example, an token
 mint account is only ever a token mint, an AMM pool account is only ever an AMM pool,
 a token metadata account can only hold token metadata, etc.
 
diff --git a/name-service/program/src/processor.rs b/name-service/program/src/processor.rs
index ca30578c0..8331f5d54 100644
--- a/name-service/program/src/processor.rs
+++ b/name-service/program/src/processor.rs
@@ -85,7 +85,7 @@ impl Processor {
             // Issue the name registry account
             // The creation is done in three steps: transfer, allocate and assign, because
             // one cannot `system_instruction::create` an account to which lamports have
-            // been transfered before.
+            // been transferred before.
             invoke(
                 &system_instruction::transfer(payer_account.key, &name_account_key, lamports),
                 &[
diff --git a/stake-pool/cli/scripts/withdraw.sh b/stake-pool/cli/scripts/withdraw.sh
index 733acec60..6ad2e327f 100755
--- a/stake-pool/cli/scripts/withdraw.sh
+++ b/stake-pool/cli/scripts/withdraw.sh
@@ -68,7 +68,7 @@ create_keypair $authority
 echo "Withdrawing stakes from stake pool"
 withdraw_stakes "$stake_pool_pubkey" "$validator_list" "$withdraw_sol_amount"
 
-echo "Withdrawing stakes from stake pool to recieve it in stake receiver account"
+echo "Withdrawing stakes from stake pool to receive it in stake receiver account"
 withdraw_stakes_to_stake_receiver "$stake_pool_pubkey" "$validator_list" "$withdraw_sol_amount"
 
 echo "Withdrawing SOL from stake pool to authority"
diff --git a/stake-pool/js/src/index.ts b/stake-pool/js/src/index.ts
index 702bbd187..307918423 100644
--- a/stake-pool/js/src/index.ts
+++ b/stake-pool/js/src/index.ts
@@ -394,7 +394,7 @@ export async function withdrawStake(
     });
   } else if (stakeReceiverAccount && stakeReceiverAccount?.type == 'delegated') {
     const voteAccount = stakeReceiverAccount.info?.stake?.delegation.voter;
-    if (!voteAccount) throw new Error(`Invalid stake reciever ${stakeReceiver} delegation`);
+    if (!voteAccount) throw new Error(`Invalid stake receiver ${stakeReceiver} delegation`);
     const validatorListAccount = await connection.getAccountInfo(
       stakePool.account.data.validatorList,
     );
diff --git a/token-swap/program/src/processor.rs b/token-swap/program/src/processor.rs
index bd60718c8..b46462ebf 100644
--- a/token-swap/program/src/processor.rs
+++ b/token-swap/program/src/processor.rs
@@ -3852,7 +3852,7 @@ mod tests {
             accounts.pool_mint_account = old_pool_account;
         }
 
-        // deposit 1 pool token fails beacuse it equates to 0 swap tokens
+        // deposit 1 pool token fails because it equates to 0 swap tokens
         {
             let (
                 token_a_key,
diff --git a/token/js/src/extensions/groupMemberPointer/state.ts b/token/js/src/extensions/groupMemberPointer/state.ts
index 57384f0fa..ceda20730 100644
--- a/token/js/src/extensions/groupMemberPointer/state.ts
+++ b/token/js/src/extensions/groupMemberPointer/state.ts
@@ -25,7 +25,7 @@ export function getGroupMemberPointerState(mint: Mint): Partial<GroupMemberPoint
     if (extensionData !== null) {
         const { authority, memberAddress } = GroupMemberPointerLayout.decode(extensionData);
 
-        // Explicity set None/Zero keys to null
+        // Explicitly set None/Zero keys to null
         return {
             authority: authority.equals(PublicKey.default) ? null : authority,
             memberAddress: memberAddress.equals(PublicKey.default) ? null : memberAddress,
diff --git a/token/js/src/extensions/groupPointer/state.ts b/token/js/src/extensions/groupPointer/state.ts
index 064c3c7dc..1f522612c 100644
--- a/token/js/src/extensions/groupPointer/state.ts
+++ b/token/js/src/extensions/groupPointer/state.ts
@@ -25,7 +25,7 @@ export function getGroupPointerState(mint: Mint): Partial<GroupPointer> | null {
     if (extensionData !== null) {
         const { authority, groupAddress } = GroupPointerLayout.decode(extensionData);
 
-        // Explicity set None/Zero keys to null
+        // Explicitly set None/Zero keys to null
         return {
             authority: authority.equals(PublicKey.default) ? null : authority,
             groupAddress: groupAddress.equals(PublicKey.default) ? null : groupAddress,
diff --git a/token/js/src/extensions/metadataPointer/state.ts b/token/js/src/extensions/metadataPointer/state.ts
index 5eb319818..75335fb14 100644
--- a/token/js/src/extensions/metadataPointer/state.ts
+++ b/token/js/src/extensions/metadataPointer/state.ts
@@ -25,7 +25,7 @@ export function getMetadataPointerState(mint: Mint): Partial<MetadataPointer> |
     if (extensionData !== null) {
         const { authority, metadataAddress } = MetadataPointerLayout.decode(extensionData);
 
-        // Explicity set None/Zero keys to null
+        // Explicitly set None/Zero keys to null
         return {
             authority: authority.equals(PublicKey.default) ? null : authority,
             metadataAddress: metadataAddress.equals(PublicKey.default) ? null : metadataAddress,
diff --git a/token/program-2022/src/extension/confidential_transfer/ciphertext_extraction.rs b/token/program-2022/src/extension/confidential_transfer/ciphertext_extraction.rs
index 527668e29..85f9fd0b0 100644
--- a/token/program-2022/src/extension/confidential_transfer/ciphertext_extraction.rs
+++ b/token/program-2022/src/extension/confidential_transfer/ciphertext_extraction.rs
@@ -598,7 +598,7 @@ impl TransferWithFeeProofContextInfo {
 /// of the transfer amount under the source public key of the transfer.
 ///
 /// The `TransferProofContext` contains decryption handles for the low and high
-/// bits of the transfer amount. Howver, these decryption handles were
+/// bits of the transfer amount. However, these decryption handles were
 /// (mistakenly) removed from the split proof contexts as a form of
 /// optimization. These components should be added back into these split proofs
 /// in `zk-token-sdk`. Until this modifications is made, include
diff --git a/token/program-2022/src/extension/mod.rs b/token/program-2022/src/extension/mod.rs
index c7113b105..e65aebbc4 100644
--- a/token/program-2022/src/extension/mod.rs
+++ b/token/program-2022/src/extension/mod.rs
@@ -927,7 +927,7 @@ pub enum ExtensionType {
     ImmutableOwner,
     /// Require inbound transfers to have memo
     MemoTransfer,
-    /// Indicates that the tokens from this mint can't be transfered
+    /// Indicates that the tokens from this mint can't be transferred
     NonTransferable,
     /// Tokens accrue interest over time,
     InterestBearingConfig,
diff --git a/token/program-2022/src/extension/non_transferable.rs b/token/program-2022/src/extension/non_transferable.rs
index ebcc9a8a1..f78b86142 100644
--- a/token/program-2022/src/extension/non_transferable.rs
+++ b/token/program-2022/src/extension/non_transferable.rs
@@ -5,7 +5,7 @@ use {
     bytemuck::{Pod, Zeroable},
 };
 
-/// Indicates that the tokens from this mint can't be transfered
+/// Indicates that the tokens from this mint can't be transferred
 #[cfg_attr(feature = "serde-traits", derive(Serialize, Deserialize))]
 #[cfg_attr(feature = "serde-traits", serde(rename_all = "camelCase"))]
 #[derive(Clone, Copy, Debug, Default, PartialEq, Pod, Zeroable)]
diff --git a/token/program-2022/src/processor.rs b/token/program-2022/src/processor.rs
index da53e1b92..8b5b5c92b 100644
--- a/token/program-2022/src/processor.rs
+++ b/token/program-2022/src/processor.rs
@@ -1432,7 +1432,7 @@ impl Processor {
         Ok(())
     }
 
-    /// Withdraw Excess Lamports is used to recover Lamports transfered to any
+    /// Withdraw Excess Lamports is used to recover Lamports transferred to any
     /// TokenProgram owned account by moving them to another account
     /// of the source account.
     pub fn process_withdraw_excess_lamports(


Test patch:
diff --git a/account-compression/sdk/tests/accountCompression.test.ts b/account-compression/sdk/tests/accountCompression.test.ts
index fa48ea0ac..3a6d996d0 100644
--- a/account-compression/sdk/tests/accountCompression.test.ts
+++ b/account-compression/sdk/tests/accountCompression.test.ts
@@ -196,7 +196,7 @@ describe('Account Compression', () => {
 
             assert(
                 splCMT.getAuthority().equals(randomSigner),
-                `Upon transfering authority, authority should be ${randomSigner.toString()}, but was instead updated to ${splCMT.getAuthority()}`
+                `Upon transferring authority, authority should be ${randomSigner.toString()}, but was instead updated to ${splCMT.getAuthority()}`
             );
 
             // Attempting to replace with new authority now works
@@ -342,7 +342,7 @@ describe('Account Compression', () => {
 
             try {
                 await execute(provider, [replaceIx], [payerKeypair]);
-                assert(false, 'Attacker was able to succesfully write fake existence of a leaf');
+                assert(false, 'Attacker was able to successfully write fake existence of a leaf');
             } catch (e) {}
 
             const splCMT = await ConcurrentMerkleTreeAccount.fromAccountAddress(connection, cmt);
diff --git a/token/program-2022-test/tests/cpi_guard.rs b/token/program-2022-test/tests/cpi_guard.rs
index 518303aca..74da17275 100644
--- a/token/program-2022-test/tests/cpi_guard.rs
+++ b/token/program-2022-test/tests/cpi_guard.rs
@@ -619,7 +619,7 @@ async fn test_cpi_guard_close_account() {
             .unwrap_err();
         assert_eq!(error, client_error(TokenError::CpiGuardCloseAccountBlocked));
 
-        // but close suceeds if lamports are returned to owner
+        // but close succeeds if lamports are returned to owner
         token
             .process_ixs(
                 &[mk_close(account, alice.pubkey(), authority.pubkey())],