From d11a70c90ce0a3fc47c21daa127d4040b215bc36 Mon Sep 17 00:00:00 2001 From: yihau Date: Tue, 6 Aug 2024 23:36:45 +0800 Subject: [PATCH 1/8] fix docs format --- core/src/banking_stage/leader_slot_metrics.rs | 6 +-- .../transaction_state_container.rs | 6 +-- core/src/repair/duplicate_repair_status.rs | 8 +-- dos/src/main.rs | 52 +++++++++---------- gossip/src/crds.rs | 4 +- ledger/src/blockstore.rs | 17 +++--- ledger/src/blockstore_cleanup_service.rs | 4 +- ledger/src/blockstore_db.rs | 6 +-- local-cluster/src/integration_tests.rs | 4 +- programs/stake/src/rewards.rs | 2 +- runtime/src/bank.rs | 2 +- sdk/gen-headers/src/main.rs | 8 +-- storage-bigtable/proto/google.bigtable.v2.rs | 24 ++++----- turbine/src/broadcast_stage.rs | 1 + zk-sdk/src/encryption/elgamal.rs | 6 +-- zk-sdk/src/encryption/grouped_elgamal.rs | 6 +-- zk-sdk/src/encryption/mod.rs | 8 +-- zk-sdk/src/range_proof/mod.rs | 6 +-- .../ciphertext_ciphertext_equality.rs | 2 +- .../src/sigma_proofs/percentage_with_cap.rs | 2 +- zk-sdk/src/sigma_proofs/pubkey_validity.rs | 2 +- .../zk_elgamal_proof_program/instruction.rs | 4 +- zk-token-sdk/src/encryption/elgamal.rs | 6 +-- .../src/encryption/grouped_elgamal.rs | 6 +-- zk-token-sdk/src/encryption/mod.rs | 8 +-- zk-token-sdk/src/range_proof/mod.rs | 6 +-- .../ciphertext_ciphertext_equality_proof.rs | 2 +- zk-token-sdk/src/sigma_proofs/fee_proof.rs | 10 ++-- .../handles_2.rs | 4 +- zk-token-sdk/src/sigma_proofs/pubkey_proof.rs | 2 +- .../src/zk_token_proof_instruction.rs | 4 +- 31 files changed, 114 insertions(+), 114 deletions(-) diff --git a/core/src/banking_stage/leader_slot_metrics.rs b/core/src/banking_stage/leader_slot_metrics.rs index 98cf4d72f92c91..e305ded2d468e3 100644 --- a/core/src/banking_stage/leader_slot_metrics.rs +++ b/core/src/banking_stage/leader_slot_metrics.rs @@ -16,10 +16,10 @@ use { /// A summary of what happened to transactions passed to the processing pipeline. /// Transactions can /// 1) Did not even make it to processing due to being filtered out by things like AccountInUse -/// lock conflicts or CostModel compute limits. These types of errors are retryable and -/// counted in `Self::retryable_transaction_indexes`. +/// lock conflicts or CostModel compute limits. These types of errors are retryable and +/// counted in `Self::retryable_transaction_indexes`. /// 2) Did not process due to some fatal error like too old, or duplicate signature. These -/// will be dropped from the transactions queue and not counted in `Self::retryable_transaction_indexes` +/// will be dropped from the transactions queue and not counted in `Self::retryable_transaction_indexes` /// 3) Were processed and committed, captured by `transaction_counts` below. /// 4) Were processed and failed commit, captured by `transaction_counts` below. pub(crate) struct ProcessTransactionsSummary { diff --git a/core/src/banking_stage/transaction_scheduler/transaction_state_container.rs b/core/src/banking_stage/transaction_scheduler/transaction_state_container.rs index 3f804f662652ab..ed78b41983fa2a 100644 --- a/core/src/banking_stage/transaction_scheduler/transaction_state_container.rs +++ b/core/src/banking_stage/transaction_scheduler/transaction_state_container.rs @@ -20,9 +20,9 @@ use { /// 2. Inserted into `TransactionStateContainer` by `BankingStage` /// 3. Popped in priority-order by scheduler, and transitioned to `Pending` state /// 4. Processed by `ConsumeWorker` -/// a. If consumed, remove `Pending` state from the `TransactionStateContainer` -/// b. If retryable, transition back to `Unprocessed` state. -/// Re-insert to the queue, and return to step 3. +/// a. If consumed, remove `Pending` state from the `TransactionStateContainer` +/// b. If retryable, transition back to `Unprocessed` state. +/// Re-insert to the queue, and return to step 3. /// /// The structure is composed of two main components: /// 1. A priority queue of wrapped `TransactionId`s, which are used to diff --git a/core/src/repair/duplicate_repair_status.rs b/core/src/repair/duplicate_repair_status.rs index 53c2bd64761858..75956a64d6e58f 100644 --- a/core/src/repair/duplicate_repair_status.rs +++ b/core/src/repair/duplicate_repair_status.rs @@ -193,10 +193,10 @@ impl AncestorRequestStatus { /// Record the response from `from_addr`. Returns Some(DuplicateAncestorDecision) /// if we have finalized a decision based on the responses. We can finalize a decision when /// one of the following conditions is met: - /// 1) We have heard from all the validators, OR - /// 2) >= MINIMUM_ANCESTOR_AGREEMENT_SIZE have agreed that we have the correct versions - /// of nth ancestor, for some `n>0`, AND >= MINIMUM_ANCESTOR_AGREEMENT_SIZE have - /// agreed we have the wrong version of the `n-1` ancestor. + /// 1. We have heard from all the validators + /// 2. Or >= MINIMUM_ANCESTOR_AGREEMENT_SIZE have agreed that we have the correct versions + /// of nth ancestor, for some `n>0`, AND >= MINIMUM_ANCESTOR_AGREEMENT_SIZE have + /// agreed we have the wrong version of the `n-1` ancestor. pub fn add_response( &mut self, from_addr: &SocketAddr, diff --git a/dos/src/main.rs b/dos/src/main.rs index 0b299718467134..38adf32ee986c8 100644 --- a/dos/src/main.rs +++ b/dos/src/main.rs @@ -5,8 +5,8 @@ //! //! * `mode` argument defines interface to use (e.g. rpc, tvu, tpu) //! * `data-type` argument specifies the type of the request. -//! Some request types might be used only with particular `mode` value. -//! For example, `get-account-info` is valid only with `mode=rpc`. +//! Some request types might be used only with particular `mode` value. +//! For example, `get-account-info` is valid only with `mode=rpc`. //! //! Most options are provided for `data-type = transaction`. //! These options allow to compose transaction which fails at @@ -16,27 +16,27 @@ //! The following configurations are suggested: //! Let `COMMON="--mode tpu --data-type transaction --unique-transactions"` //! 1. Without blockhash or payer: -//! 1.1 With invalid signatures -//! ```bash -//! solana-dos $COMMON --num-signatures 8 -//! ``` -//! 1.2 With valid signatures -//! ```bash -//! solana-dos $COMMON --valid-signatures --num-signatures 8 -//! ``` +//! 1.1 With invalid signatures +//! ```bash +//! solana-dos $COMMON --num-signatures 8 +//! ``` +//! 1.2 With valid signatures +//! ```bash +//! solana-dos $COMMON --valid-signatures --num-signatures 8 +//! ``` //! 2. With blockhash and payer: -//! 2.1 Single-instruction transaction -//! ```bash -//! solana-dos $COMMON --valid-blockhash --transaction-type transfer --num-instructions 1 -//! ``` -//! 2.2 Multi-instruction transaction -//! ```bash -//! solana-dos $COMMON --valid-blockhash --transaction-type transfer --num-instructions 8 -//! ``` -//! 2.3 Account-creation transaction -//! ```bash -//! solana-dos $COMMON --valid-blockhash --transaction-type account-creation -//! ``` +//! 2.1 Single-instruction transaction +//! ```bash +//! solana-dos $COMMON --valid-blockhash --transaction-type transfer --num-instructions 1 +//! ``` +//! 2.2 Multi-instruction transaction +//! ```bash +//! solana-dos $COMMON --valid-blockhash --transaction-type transfer --num-instructions 8 +//! ``` +//! 2.3 Account-creation transaction +//! ```bash +//! solana-dos $COMMON --valid-blockhash --transaction-type account-creation +//! ``` //! #![allow(clippy::arithmetic_side_effects)] #![allow(deprecated)] @@ -89,12 +89,12 @@ fn compute_rate_per_second(count: usize) -> usize { /// Provide functionality to generate several types of transactions: /// /// 1. Without blockhash -/// 1.1 With valid signatures (number of signatures is configurable) -/// 1.2 With invalid signatures (number of signatures is configurable) +/// 1.1 With valid signatures (number of signatures is configurable) +/// 1.2 With invalid signatures (number of signatures is configurable) /// /// 2. With blockhash (but still deliberately invalid): -/// 2.1 Transfer from 1 payer to multiple destinations (many instructions per transaction) -/// 2.2 Create an account +/// 2.1 Transfer from 1 payer to multiple destinations (many instructions per transaction) +/// 2.2 Create an account /// #[derive(Clone)] struct TransactionGenerator { diff --git a/gossip/src/crds.rs b/gossip/src/crds.rs index 73d2dd0d1c9f26..d5b0733bad1b58 100644 --- a/gossip/src/crds.rs +++ b/gossip/src/crds.rs @@ -6,8 +6,8 @@ //! that is identified by a Pubkey. //! * 1 Pubkey maps many CrdsValueLabels //! * 1 CrdsValueLabel maps to 1 CrdsValue -//! The Label, the record Pubkey, and all the record labels can be derived -//! from a single CrdsValue. +//! The Label, the record Pubkey, and all the record labels can be derived +//! from a single CrdsValue. //! //! The actual data is stored in a single map of //! `CrdsValueLabel(Pubkey) -> CrdsValue` This allows for partial record diff --git a/ledger/src/blockstore.rs b/ledger/src/blockstore.rs index 569b2bdd8b7cfe..55377cb31557eb 100644 --- a/ledger/src/blockstore.rs +++ b/ledger/src/blockstore.rs @@ -912,8 +912,8 @@ impl Blockstore { /// but N.index() is less than the current slot_meta.received /// for slot S. /// - The slot is not currently full - /// It means there's an alternate version of this slot. See - /// `check_insert_data_shred` for more details. + /// It means there's an alternate version of this slot. See + /// `check_insert_data_shred` for more details. /// - [`cf::ShredData`]: stores data shreds (in check_insert_data_shreds). /// - [`cf::ShredCode`]: stores coding shreds (in check_insert_coding_shreds). /// - [`cf::SlotMeta`]: the SlotMeta of the input `shreds` and their related @@ -935,8 +935,7 @@ impl Blockstore { /// shreds inside `shreds` will be updated and committed to /// `cf::MerkleRootMeta`. /// - [`cf::Index`]: stores (slot id, index to the index_working_set_entry) - /// pair to the `cf::Index` column family for each index_working_set_entry - /// which insert did occur in this function call. + /// pair to the `cf::Index` column family for each index_working_set_entry which insert did occur in this function call. /// /// Arguments: /// - `shreds`: the shreds to be inserted. @@ -4301,17 +4300,17 @@ impl Blockstore { /// it handles the following two things: /// /// 1. based on the `SlotMetaWorkingSetEntry` for `slot`, check if `slot` - /// did not previously have a parent slot but does now. If `slot` satisfies - /// this condition, update the Orphan property of both `slot` and its parent - /// slot based on their current orphan status. Specifically: + /// did not previously have a parent slot but does now. If `slot` satisfies + /// this condition, update the Orphan property of both `slot` and its parent + /// slot based on their current orphan status. Specifically: /// - updates the orphan property of slot to no longer be an orphan because /// it has a parent. /// - adds the parent to the orphan column family if the parent's parent is /// currently unknown. /// /// 2. if the `SlotMetaWorkingSetEntry` for `slot` indicates this slot - /// is newly connected to a parent slot, then this function will update - /// the is_connected property of all its direct and indirect children slots. + /// is newly connected to a parent slot, then this function will update + /// the is_connected property of all its direct and indirect children slots. /// /// This function may update column family [`cf::Orphans`] and indirectly /// update SlotMeta from its output parameter `new_chained_slots`. diff --git a/ledger/src/blockstore_cleanup_service.rs b/ledger/src/blockstore_cleanup_service.rs index 4c6068236e7269..728ca217c94350 100644 --- a/ledger/src/blockstore_cleanup_service.rs +++ b/ledger/src/blockstore_cleanup_service.rs @@ -93,8 +93,8 @@ impl BlockstoreCleanupService { /// /// Return value (bool, Slot, u64): /// - `slots_to_clean` (bool): a boolean value indicating whether there - /// are any slots to clean. If true, then `cleanup_ledger` function - /// will then proceed with the ledger cleanup. + /// are any slots to clean. If true, then `cleanup_ledger` function + /// will then proceed with the ledger cleanup. /// - `lowest_slot_to_purge` (Slot): the lowest slot to purge. Any /// slot which is older or equal to `lowest_slot_to_purge` will be /// cleaned up. diff --git a/ledger/src/blockstore_db.rs b/ledger/src/blockstore_db.rs index 00eea6f811ebcb..8c96403f20e9da 100644 --- a/ledger/src/blockstore_db.rs +++ b/ledger/src/blockstore_db.rs @@ -2109,9 +2109,9 @@ fn new_cf_descriptor_fifo( /// instead. /// /// - [`max_cf_size`]: the maximum allowed column family size. Note that -/// rocksdb will start deleting the oldest SST file when the column family -/// size reaches `max_cf_size` - `FIFO_WRITE_BUFFER_SIZE` to strictly -/// maintain the size limit. +/// rocksdb will start deleting the oldest SST file when the column family +/// size reaches `max_cf_size` - `FIFO_WRITE_BUFFER_SIZE` to strictly +/// maintain the size limit. fn get_cf_options_fifo( max_cf_size: &u64, column_options: &LedgerColumnOptions, diff --git a/local-cluster/src/integration_tests.rs b/local-cluster/src/integration_tests.rs index db394cd394adbd..719005cd27df49 100644 --- a/local-cluster/src/integration_tests.rs +++ b/local-cluster/src/integration_tests.rs @@ -298,9 +298,9 @@ pub fn create_custom_leader_schedule_with_random_keys( /// continues to achieve consensus /// # Arguments /// * `partitions` - A slice of partition configurations, where each partition -/// configuration is a usize representing a node's stake +/// configuration is a usize representing a node's stake /// * `leader_schedule` - An option that specifies whether the cluster should -/// run with a fixed, predetermined leader schedule +/// run with a fixed, predetermined leader schedule #[allow(clippy::cognitive_complexity)] pub fn run_cluster_partition( partitions: &[usize], diff --git a/programs/stake/src/rewards.rs b/programs/stake/src/rewards.rs index 9895bd525ac96e..62aa8cad2008ea 100644 --- a/programs/stake/src/rewards.rs +++ b/programs/stake/src/rewards.rs @@ -123,7 +123,7 @@ fn redeem_stake_rewards( /// * staker_rewards to be distributed /// * voter_rewards to be distributed /// * new value for credits_observed in the stake -/// returns None if there's no payout or if any deserved payout is < 1 lamport +/// returns None if there's no payout or if any deserved payout is < 1 lamport fn calculate_stake_rewards( rewarded_epoch: Epoch, stake: &Stake, diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index 6b93ec643ee031..e269272e787b21 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -1433,7 +1433,7 @@ impl Bank { /// Like `new_from_parent` but additionally: /// * Doesn't assume that the parent is anywhere near `slot`, parent could be millions of slots - /// in the past + /// in the past /// * Adjusts the new bank's tick height to avoid having to run PoH for millions of slots /// * Freezes the new bank, assuming that the user will `Bank::new_from_parent` from this bank /// * Calculates and sets the epoch accounts hash from the parent diff --git a/sdk/gen-headers/src/main.rs b/sdk/gen-headers/src/main.rs index a0a90a4355c820..80e8e5d3bf00c9 100644 --- a/sdk/gen-headers/src/main.rs +++ b/sdk/gen-headers/src/main.rs @@ -16,10 +16,10 @@ use { * 1. process every inc file in syscalls header file * * 2. in every such file replace the syscall declaration by a new - * declaration with a new extended name, and a static function - * definition that computes a hash of the original name and uses the - * hash to initialize a function pointer, the function pointer then is - * used the call the syscall function. + * declaration with a new extended name, and a static function + * definition that computes a hash of the original name and uses the + * hash to initialize a function pointer, the function pointer then is + * used the call the syscall function. */ fn main() { let syscalls_inc_path = PathBuf::from("sdk/sbf/c/inc/sol/inc"); diff --git a/storage-bigtable/proto/google.bigtable.v2.rs b/storage-bigtable/proto/google.bigtable.v2.rs index 5df837a60f9ec1..c7b9f59e021fac 100644 --- a/storage-bigtable/proto/google.bigtable.v2.rs +++ b/storage-bigtable/proto/google.bigtable.v2.rs @@ -213,22 +213,22 @@ pub mod value_range { /// (chains and interleaves). They work as follows: /// /// * True filters alter the input row by excluding some of its cells wholesale -/// from the output row. An example of a true filter is the `value_regex_filter`, -/// which excludes cells whose values don't match the specified pattern. All -/// regex true filters use RE2 syntax () -/// in raw byte mode (RE2::Latin1), and are evaluated as full matches. An -/// important point to keep in mind is that `RE2(.)` is equivalent by default to -/// `RE2(\[^\n\])`, meaning that it does not match newlines. When attempting to -/// match an arbitrary byte, you should therefore use the escape sequence `\C`, -/// which may need to be further escaped as `\\C` in your client language. +/// from the output row. An example of a true filter is the `value_regex_filter`, +/// which excludes cells whose values don't match the specified pattern. All +/// regex true filters use RE2 syntax () +/// in raw byte mode (RE2::Latin1), and are evaluated as full matches. An +/// important point to keep in mind is that `RE2(.)` is equivalent by default to +/// `RE2(\[^\n\])`, meaning that it does not match newlines. When attempting to +/// match an arbitrary byte, you should therefore use the escape sequence `\C`, +/// which may need to be further escaped as `\\C` in your client language. /// /// * Transformers alter the input row by changing the values of some of its -/// cells in the output, without excluding them completely. Currently, the only -/// supported transformer is the `strip_value_transformer`, which replaces every -/// cell's value with the empty string. +/// cells in the output, without excluding them completely. Currently, the only +/// supported transformer is the `strip_value_transformer`, which replaces every +/// cell's value with the empty string. /// /// * Chains and interleaves are described in more detail in the -/// RowFilter.Chain and RowFilter.Interleave documentation. +/// RowFilter.Chain and RowFilter.Interleave documentation. /// /// The total serialized size of a RowFilter message must not /// exceed 20480 bytes, and RowFilters may not be nested within each other diff --git a/turbine/src/broadcast_stage.rs b/turbine/src/broadcast_stage.rs index cce43f4fa5aabd..2f9d21980372e3 100644 --- a/turbine/src/broadcast_stage.rs +++ b/turbine/src/broadcast_stage.rs @@ -265,6 +265,7 @@ impl BroadcastStage { /// * `window` - Cache of Shreds that we have broadcast /// * `receiver` - Receive channel for Shreds to be retransmitted to all the layer 1 nodes. /// * `exit_sender` - Set to true when this service exits, allows rest of Tpu to exit cleanly. + /// /// Otherwise, when a Tpu closes, it only closes the stages that come after it. The stages /// that come before could be blocked on a receive, and never notice that they need to /// exit. Now, if any stage of the Tpu closes, it will lead to closing the WriteStage (b/c diff --git a/zk-sdk/src/encryption/elgamal.rs b/zk-sdk/src/encryption/elgamal.rs index 3d950f75f6cc1b..6626bd9bd70326 100644 --- a/zk-sdk/src/encryption/elgamal.rs +++ b/zk-sdk/src/encryption/elgamal.rs @@ -6,9 +6,9 @@ //! A twisted ElGamal ciphertext consists of two components: //! - A Pedersen commitment that encodes a message to be encrypted //! - A "decryption handle" that binds the Pedersen opening to a specific public key -//! In contrast to the traditional ElGamal encryption scheme, the twisted ElGamal encodes messages -//! directly as a Pedersen commitment. Therefore, proof systems that are designed specifically for -//! Pedersen commitments can be used on the twisted ElGamal ciphertexts. +//! In contrast to the traditional ElGamal encryption scheme, the twisted ElGamal encodes messages +//! directly as a Pedersen commitment. Therefore, proof systems that are designed specifically for +//! Pedersen commitments can be used on the twisted ElGamal ciphertexts. //! //! As the messages are encrypted as scalar elements (a.k.a. in the "exponent"), one must solve the //! discrete log to recover the originally encrypted value. diff --git a/zk-sdk/src/encryption/grouped_elgamal.rs b/zk-sdk/src/encryption/grouped_elgamal.rs index 920a91f4293943..8e53b458590595 100644 --- a/zk-sdk/src/encryption/grouped_elgamal.rs +++ b/zk-sdk/src/encryption/grouped_elgamal.rs @@ -6,9 +6,9 @@ //! A regular twisted ElGamal ciphertext consists of two components: //! - A Pedersen commitment that encodes a message to be encrypted //! - A "decryption handle" that binds the Pedersen opening to a specific public key -//! The ciphertext can be generalized to hold not a single decryption handle, but multiple handles -//! pertaining to multiple ElGamal public keys. These ciphertexts are referred to as a "grouped" -//! ElGamal ciphertext. +//! The ciphertext can be generalized to hold not a single decryption handle, but multiple handles +//! pertaining to multiple ElGamal public keys. These ciphertexts are referred to as a "grouped" +//! ElGamal ciphertext. //! use { diff --git a/zk-sdk/src/encryption/mod.rs b/zk-sdk/src/encryption/mod.rs index 55eda670576712..8cad6217fc4c68 100644 --- a/zk-sdk/src/encryption/mod.rs +++ b/zk-sdk/src/encryption/mod.rs @@ -3,12 +3,12 @@ //! //! The module contains implementations of the following cryptographic objects: //! - Pedersen commitments that uses the prime-order Ristretto representation of Curve25519. -//! [curve25519-dalek](https://docs.rs/curve25519-dalek/latest/curve25519_dalek/ristretto/index.html) -//! is used for the Ristretto group implementation. +//! [curve25519-dalek](https://docs.rs/curve25519-dalek/latest/curve25519_dalek/ristretto/index.html) +//! is used for the Ristretto group implementation. //! - The twisted ElGamal scheme, which converts Pedersen commitments into a public-key encryption -//! scheme. +//! scheme. //! - Basic type-wrapper around the AES-GCM-SIV symmetric authenticated encryption scheme -//! implemented by [aes-gcm-siv](https://docs.rs/aes-gcm-siv/latest/aes_gcm_siv/) crate. +//! implemented by [aes-gcm-siv](https://docs.rs/aes-gcm-siv/latest/aes_gcm_siv/) crate. use crate::{RISTRETTO_POINT_LEN, SCALAR_LEN}; diff --git a/zk-sdk/src/range_proof/mod.rs b/zk-sdk/src/range_proof/mod.rs index 9a4939845ae847..3cae18a8bb0f3c 100644 --- a/zk-sdk/src/range_proof/mod.rs +++ b/zk-sdk/src/range_proof/mod.rs @@ -4,10 +4,10 @@ //! [implementation](https://github.com/dalek-cryptography/bulletproofs). Compared to the original //! implementation by dalek-cryptography: //! - This implementation focuses on the range proof implementation, while the dalek-cryptography -//! crate additionally implements the general bulletproofs implementation for languages that can be -//! represented by arithmetic circuits as well as MPC. +//! crate additionally implements the general bulletproofs implementation for languages that can be +//! represented by arithmetic circuits as well as MPC. //! - This implementation implements a non-interactive range proof aggregation that is specified in -//! the original Bulletproofs [paper](https://eprint.iacr.org/2017/1066) (Section 4.3). +//! the original Bulletproofs [paper](https://eprint.iacr.org/2017/1066) (Section 4.3). //! #![allow(dead_code)] diff --git a/zk-sdk/src/sigma_proofs/ciphertext_ciphertext_equality.rs b/zk-sdk/src/sigma_proofs/ciphertext_ciphertext_equality.rs index 9ff9529e4a52e8..910d0a9a3ea556 100644 --- a/zk-sdk/src/sigma_proofs/ciphertext_ciphertext_equality.rs +++ b/zk-sdk/src/sigma_proofs/ciphertext_ciphertext_equality.rs @@ -62,7 +62,7 @@ impl CiphertextCiphertextEqualityProof { /// * `first_keypair` - The ElGamal keypair associated with the first ciphertext to be proved /// * `second_pubkey` - The ElGamal pubkey associated with the second ElGamal ciphertext /// * `first_ciphertext` - The first ElGamal ciphertext for which the prover knows a - /// decryption key for + /// decryption key for /// * `second_opening` - The opening (randomness) associated with the second ElGamal ciphertext /// * `amount` - The message associated with the ElGamal ciphertext and Pedersen commitment /// * `transcript` - The transcript that does the bookkeeping for the Fiat-Shamir heuristic diff --git a/zk-sdk/src/sigma_proofs/percentage_with_cap.rs b/zk-sdk/src/sigma_proofs/percentage_with_cap.rs index d53c118c858e53..18a8e1efe5cadb 100644 --- a/zk-sdk/src/sigma_proofs/percentage_with_cap.rs +++ b/zk-sdk/src/sigma_proofs/percentage_with_cap.rs @@ -69,7 +69,7 @@ impl PercentageWithCapProof { /// A typical percentage-with-cap application is defined with respect to the following values: /// - a commitment encoding a `base_amount` and a commitment encoding a `percentage_amount` /// - two constants `percentage_rate_basis_point`, which defines the percentage rate in units - /// of 0.01% and `max_value`, which defines the max cap amount. + /// of 0.01% and `max_value`, which defines the max cap amount. /// /// This setting requires that the `percentage_amount` is either a certain percentage of the /// `base_amount` (determined by the `percentage_rate_basis_point`) or is equal to the max cap diff --git a/zk-sdk/src/sigma_proofs/pubkey_validity.rs b/zk-sdk/src/sigma_proofs/pubkey_validity.rs index 97e6281e913d92..4166a543b77e76 100644 --- a/zk-sdk/src/sigma_proofs/pubkey_validity.rs +++ b/zk-sdk/src/sigma_proofs/pubkey_validity.rs @@ -57,7 +57,7 @@ impl PubkeyValidityProof { /// invertible). /// /// * `elgamal_keypair` = The ElGamal keypair that pertains to the ElGamal public key to be - /// proved + /// proved /// * `transcript` - The transcript that does the bookkeeping for the Fiat-Shamir heuristic pub fn new(elgamal_keypair: &ElGamalKeypair, transcript: &mut Transcript) -> Self { transcript.pubkey_proof_domain_separator(); diff --git a/zk-sdk/src/zk_elgamal_proof_program/instruction.rs b/zk-sdk/src/zk_elgamal_proof_program/instruction.rs index 2723bf1d6c07b7..ecfd207f30f7c5 100644 --- a/zk-sdk/src/zk_elgamal_proof_program/instruction.rs +++ b/zk-sdk/src/zk_elgamal_proof_program/instruction.rs @@ -253,7 +253,7 @@ pub enum ProofInstruction { /// 2. `[]` The proof context account owner /// /// * Otherwise - /// None + /// None /// /// The instruction expects either: /// i. `GroupedCiphertext3HandlesValidityProofData` if proof is provided as instruction data @@ -276,7 +276,7 @@ pub enum ProofInstruction { /// 2. `[]` The proof context account owner /// /// * Otherwise - /// None + /// None /// /// The instruction expects either: /// i. `BatchedGroupedCiphertext3HandlesValidityProofData` if proof is provided as instruction data diff --git a/zk-token-sdk/src/encryption/elgamal.rs b/zk-token-sdk/src/encryption/elgamal.rs index 130aacef669545..61ccf2c5a9689d 100644 --- a/zk-token-sdk/src/encryption/elgamal.rs +++ b/zk-token-sdk/src/encryption/elgamal.rs @@ -6,9 +6,9 @@ //! A twisted ElGamal ciphertext consists of two components: //! - A Pedersen commitment that encodes a message to be encrypted //! - A "decryption handle" that binds the Pedersen opening to a specific public key -//! In contrast to the traditional ElGamal encryption scheme, the twisted ElGamal encodes messages -//! directly as a Pedersen commitment. Therefore, proof systems that are designed specifically for -//! Pedersen commitments can be used on the twisted ElGamal ciphertexts. +//! In contrast to the traditional ElGamal encryption scheme, the twisted ElGamal encodes messages +//! directly as a Pedersen commitment. Therefore, proof systems that are designed specifically for +//! Pedersen commitments can be used on the twisted ElGamal ciphertexts. //! //! As the messages are encrypted as scalar elements (a.k.a. in the "exponent"), one must solve the //! discrete log to recover the originally encrypted value. diff --git a/zk-token-sdk/src/encryption/grouped_elgamal.rs b/zk-token-sdk/src/encryption/grouped_elgamal.rs index c73e7bf2772ddb..0d894b9f4655fb 100644 --- a/zk-token-sdk/src/encryption/grouped_elgamal.rs +++ b/zk-token-sdk/src/encryption/grouped_elgamal.rs @@ -6,9 +6,9 @@ //! A regular twisted ElGamal ciphertext consists of two components: //! - A Pedersen commitment that encodes a message to be encrypted //! - A "decryption handle" that binds the Pedersen opening to a specific public key -//! The ciphertext can be generalized to hold not a single decryption handle, but multiple handles -//! pertaining to multiple ElGamal public keys. These ciphertexts are referred to as a "grouped" -//! ElGamal ciphertext. +//! The ciphertext can be generalized to hold not a single decryption handle, but multiple handles +//! pertaining to multiple ElGamal public keys. These ciphertexts are referred to as a "grouped" +//! ElGamal ciphertext. //! use { diff --git a/zk-token-sdk/src/encryption/mod.rs b/zk-token-sdk/src/encryption/mod.rs index 7cf53dd0f06167..2eeb6e1c544709 100644 --- a/zk-token-sdk/src/encryption/mod.rs +++ b/zk-token-sdk/src/encryption/mod.rs @@ -3,12 +3,12 @@ //! //! The module contains implementations of the following cryptographic objects: //! - Pedersen commitments that uses the prime-order Ristretto representation of Curve25519. -//! [curve25519-dalek](https://docs.rs/curve25519-dalek/latest/curve25519_dalek/ristretto/index.html) -//! is used for the Ristretto group implementation. +//! [curve25519-dalek](https://docs.rs/curve25519-dalek/latest/curve25519_dalek/ristretto/index.html) +//! is used for the Ristretto group implementation. //! - The twisted ElGamal scheme, which converts Pedersen commitments into a public-key encryption -//! scheme. +//! scheme. //! - Basic type-wrapper around the AES-GCM-SIV symmetric authenticated encryption scheme -//! implemented by [aes-gcm-siv](https://docs.rs/aes-gcm-siv/latest/aes_gcm_siv/) crate. +//! implemented by [aes-gcm-siv](https://docs.rs/aes-gcm-siv/latest/aes_gcm_siv/) crate. pub mod auth_encryption; pub mod discrete_log; diff --git a/zk-token-sdk/src/range_proof/mod.rs b/zk-token-sdk/src/range_proof/mod.rs index d7c7774d469baf..32dac961f507df 100644 --- a/zk-token-sdk/src/range_proof/mod.rs +++ b/zk-token-sdk/src/range_proof/mod.rs @@ -4,10 +4,10 @@ //! [implementation](https://github.com/dalek-cryptography/bulletproofs). Compared to the original //! implementation by dalek-cryptography: //! - This implementation focuses on the range proof implementation, while the dalek-cryptography -//! crate additionally implements the general bulletproofs implementation for languages that can be -//! represented by arithmetic circuits as well as MPC. +//! crate additionally implements the general bulletproofs implementation for languages that can be +//! represented by arithmetic circuits as well as MPC. //! - This implementation implements a non-interactive range proof aggregation that is specified in -//! the original Bulletproofs [paper](https://eprint.iacr.org/2017/1066) (Section 4.3). +//! the original Bulletproofs [paper](https://eprint.iacr.org/2017/1066) (Section 4.3). //! #[cfg(not(target_os = "solana"))] diff --git a/zk-token-sdk/src/sigma_proofs/ciphertext_ciphertext_equality_proof.rs b/zk-token-sdk/src/sigma_proofs/ciphertext_ciphertext_equality_proof.rs index 70a5de9c4c5efb..565ba9b4360920 100644 --- a/zk-token-sdk/src/sigma_proofs/ciphertext_ciphertext_equality_proof.rs +++ b/zk-token-sdk/src/sigma_proofs/ciphertext_ciphertext_equality_proof.rs @@ -62,7 +62,7 @@ impl CiphertextCiphertextEqualityProof { /// * `source_keypair` - The ElGamal keypair associated with the first ciphertext to be proved /// * `destination_pubkey` - The ElGamal pubkey associated with the second ElGamal ciphertext /// * `source_ciphertext` - The first ElGamal ciphertext for which the prover knows a - /// decryption key for + /// decryption key for /// * `destination_opening` - The opening (randomness) associated with the second ElGamal ciphertext /// * `amount` - The message associated with the ElGamal ciphertext and Pedersen commitment /// * `transcript` - The transcript that does the bookkeeping for the Fiat-Shamir heuristic diff --git a/zk-token-sdk/src/sigma_proofs/fee_proof.rs b/zk-token-sdk/src/sigma_proofs/fee_proof.rs index c3a431768f1226..5cb67553e26276 100644 --- a/zk-token-sdk/src/sigma_proofs/fee_proof.rs +++ b/zk-token-sdk/src/sigma_proofs/fee_proof.rs @@ -68,7 +68,7 @@ impl FeeSigmaProof { /// `fee_amount` must satisfy the relation `transfer_amount * (fee_rate_basis_point / /// 10_000) = fee_amount` or equivalently, `(transfer_amount * fee_rate_basis_point) - (10_000 /// * fee_amount) = 0`. More generally, let `delta_fee = (transfer_amount * - /// fee_rate_basis_point) - (10_000 * fee_amount)`. Then assuming that a division rounding + /// fee_rate_basis_point) - (10_000 * fee_amount)`. Then assuming that a division rounding /// could occur, the `delta_fee` must satisfy the bound `0 <= delta_fee < 10_000`. /// /// If `fee_amount >= max_fee`, then `fee_amount = max_fee` and therefore, the prover can @@ -89,11 +89,11 @@ impl FeeSigmaProof { /// and `create_proof_fee_below_max` to enforce that the function executes in constant time. /// /// * `(fee_amount, fee_commitment, fee_opening)` - The amount, Pedersen commitment, and - /// opening of the transfer fee + /// opening of the transfer fee /// * `(delta_fee, delta_commitment, delta_opening)` - The amount, Pedersen commitment, and - /// opening of the "real" delta amount + /// opening of the "real" delta amount /// * `(claimed_commitment, claimed_opening)` - The Pedersen commitment and opening of the - /// "claimed" delta amount + /// "claimed" delta amount /// * `max_fee` - The maximum fee bound /// * `transcript` - The transcript that does the bookkeeping for the Fiat-Shamir heuristic pub fn new( @@ -226,7 +226,7 @@ impl FeeSigmaProof { /// /// * `fee_commitment` - The Pedersen commitment of the transfer fee /// * `(delta_fee, delta_opening)` - The Pedersen commitment and opening of the "real" delta - /// value + /// value /// * `claimed_opening` - The opening of the Pedersen commitment of the "claimed" delta value /// * `max_fee` - The maximum fee bound /// * `transcript` - The transcript that does the bookkeeping for the Fiat-Shamir heuristic diff --git a/zk-token-sdk/src/sigma_proofs/grouped_ciphertext_validity_proof/handles_2.rs b/zk-token-sdk/src/sigma_proofs/grouped_ciphertext_validity_proof/handles_2.rs index 1c1a57997e4740..be45e969cf1257 100644 --- a/zk-token-sdk/src/sigma_proofs/grouped_ciphertext_validity_proof/handles_2.rs +++ b/zk-token-sdk/src/sigma_proofs/grouped_ciphertext_validity_proof/handles_2.rs @@ -66,7 +66,7 @@ impl GroupedCiphertext2HandlesValidityProof { /// handles as input; it only takes the associated Pedersen opening instead. /// /// * `(destination_pubkey, auditor_pubkey)` - The ElGamal public keys associated with the decryption - /// handles + /// handles /// * `amount` - The committed message in the commitment /// * `opening` - The opening associated with the Pedersen commitment /// * `transcript` - The transcript that does the bookkeeping for the Fiat-Shamir heuristic @@ -121,7 +121,7 @@ impl GroupedCiphertext2HandlesValidityProof { /// /// * `commitment` - The Pedersen commitment /// * `(destination_pubkey, auditor_pubkey)` - The ElGamal pubkeys associated with the decryption - /// handles + /// handles /// * `(destination_handle, auditor_handle)` - The decryption handles /// * `transcript` - The transcript that does the bookkeeping for the Fiat-Shamir heuristic pub fn verify( diff --git a/zk-token-sdk/src/sigma_proofs/pubkey_proof.rs b/zk-token-sdk/src/sigma_proofs/pubkey_proof.rs index e0d80f2a528ef8..16f6c3b25d81ef 100644 --- a/zk-token-sdk/src/sigma_proofs/pubkey_proof.rs +++ b/zk-token-sdk/src/sigma_proofs/pubkey_proof.rs @@ -57,7 +57,7 @@ impl PubkeyValidityProof { /// invertible). /// /// * `elgamal_keypair` = The ElGamal keypair that pertains to the ElGamal public key to be - /// proved + /// proved /// * `transcript` - The transcript that does the bookkeeping for the Fiat-Shamir heuristic pub fn new(elgamal_keypair: &ElGamalKeypair, transcript: &mut Transcript) -> Self { transcript.pubkey_proof_domain_separator(); diff --git a/zk-token-sdk/src/zk_token_proof_instruction.rs b/zk-token-sdk/src/zk_token_proof_instruction.rs index 48b6ec39c19bf4..afcf4f36a3e211 100644 --- a/zk-token-sdk/src/zk_token_proof_instruction.rs +++ b/zk-token-sdk/src/zk_token_proof_instruction.rs @@ -321,7 +321,7 @@ pub enum ProofInstruction { /// 2. `[]` The proof context account owner /// /// * Otherwise - /// None + /// None /// /// The instruction expects either: /// i. `GroupedCiphertext3HandlesValidityProofData` if proof is provided as instruction data @@ -344,7 +344,7 @@ pub enum ProofInstruction { /// 2. `[]` The proof context account owner /// /// * Otherwise - /// None + /// None /// /// The instruction expects either: /// i. `BatchedGroupedCiphertext3HandlesValidityProofData` if proof is provided as instruction data From 08a2f574ad5be0f3c430e455d53b72e5dc057149 Mon Sep 17 00:00:00 2001 From: yihau Date: Fri, 9 Aug 2024 16:05:14 +0800 Subject: [PATCH 2/8] fix wrong indent --- zk-sdk/src/encryption/elgamal.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/zk-sdk/src/encryption/elgamal.rs b/zk-sdk/src/encryption/elgamal.rs index 6626bd9bd70326..c0d90fb148d26c 100644 --- a/zk-sdk/src/encryption/elgamal.rs +++ b/zk-sdk/src/encryption/elgamal.rs @@ -6,9 +6,10 @@ //! A twisted ElGamal ciphertext consists of two components: //! - A Pedersen commitment that encodes a message to be encrypted //! - A "decryption handle" that binds the Pedersen opening to a specific public key -//! In contrast to the traditional ElGamal encryption scheme, the twisted ElGamal encodes messages -//! directly as a Pedersen commitment. Therefore, proof systems that are designed specifically for -//! Pedersen commitments can be used on the twisted ElGamal ciphertexts. +//! +//! In contrast to the traditional ElGamal encryption scheme, the twisted ElGamal encodes messages +//! directly as a Pedersen commitment. Therefore, proof systems that are designed specifically for +//! Pedersen commitments can be used on the twisted ElGamal ciphertexts. //! //! As the messages are encrypted as scalar elements (a.k.a. in the "exponent"), one must solve the //! discrete log to recover the originally encrypted value. From 2fad4102da435e3b4f8ed65e1b17b3bddac9c547 Mon Sep 17 00:00:00 2001 From: yihau Date: Fri, 9 Aug 2024 16:05:34 +0800 Subject: [PATCH 3/8] fix wrong indent --- zk-sdk/src/encryption/grouped_elgamal.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/zk-sdk/src/encryption/grouped_elgamal.rs b/zk-sdk/src/encryption/grouped_elgamal.rs index 8e53b458590595..b786d251973c38 100644 --- a/zk-sdk/src/encryption/grouped_elgamal.rs +++ b/zk-sdk/src/encryption/grouped_elgamal.rs @@ -6,9 +6,10 @@ //! A regular twisted ElGamal ciphertext consists of two components: //! - A Pedersen commitment that encodes a message to be encrypted //! - A "decryption handle" that binds the Pedersen opening to a specific public key -//! The ciphertext can be generalized to hold not a single decryption handle, but multiple handles -//! pertaining to multiple ElGamal public keys. These ciphertexts are referred to as a "grouped" -//! ElGamal ciphertext. +//! +//! The ciphertext can be generalized to hold not a single decryption handle, but multiple handles +//! pertaining to multiple ElGamal public keys. These ciphertexts are referred to as a "grouped" +//! ElGamal ciphertext. //! use { From 28c913b5be92d6ebcb3666d82da53a6ea1dd986d Mon Sep 17 00:00:00 2001 From: yihau Date: Fri, 9 Aug 2024 16:07:18 +0800 Subject: [PATCH 4/8] fix wrong indent --- dos/src/main.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/dos/src/main.rs b/dos/src/main.rs index 38adf32ee986c8..2d06c9d6632195 100644 --- a/dos/src/main.rs +++ b/dos/src/main.rs @@ -5,8 +5,9 @@ //! //! * `mode` argument defines interface to use (e.g. rpc, tvu, tpu) //! * `data-type` argument specifies the type of the request. -//! Some request types might be used only with particular `mode` value. -//! For example, `get-account-info` is valid only with `mode=rpc`. +//! +//! Some request types might be used only with particular `mode` value. +//! For example, `get-account-info` is valid only with `mode=rpc`. //! //! Most options are provided for `data-type = transaction`. //! These options allow to compose transaction which fails at From 4e364ce728fe651a3c89039a545136f8a591fa6e Mon Sep 17 00:00:00 2001 From: yihau Date: Fri, 9 Aug 2024 16:09:17 +0800 Subject: [PATCH 5/8] fix wrong indent --- gossip/src/crds.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gossip/src/crds.rs b/gossip/src/crds.rs index d5b0733bad1b58..e0205e14e62988 100644 --- a/gossip/src/crds.rs +++ b/gossip/src/crds.rs @@ -6,8 +6,9 @@ //! that is identified by a Pubkey. //! * 1 Pubkey maps many CrdsValueLabels //! * 1 CrdsValueLabel maps to 1 CrdsValue -//! The Label, the record Pubkey, and all the record labels can be derived -//! from a single CrdsValue. +//! +//! The Label, the record Pubkey, and all the record labels can be derived +//! from a single CrdsValue. //! //! The actual data is stored in a single map of //! `CrdsValueLabel(Pubkey) -> CrdsValue` This allows for partial record From 41f46c85905060ab8797847a4d986595024bf5ed Mon Sep 17 00:00:00 2001 From: yihau Date: Fri, 9 Aug 2024 16:14:01 +0800 Subject: [PATCH 6/8] fix wrong indent --- programs/stake/src/rewards.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/programs/stake/src/rewards.rs b/programs/stake/src/rewards.rs index 62aa8cad2008ea..34bfd0dcc12564 100644 --- a/programs/stake/src/rewards.rs +++ b/programs/stake/src/rewards.rs @@ -123,7 +123,8 @@ fn redeem_stake_rewards( /// * staker_rewards to be distributed /// * voter_rewards to be distributed /// * new value for credits_observed in the stake -/// returns None if there's no payout or if any deserved payout is < 1 lamport +/// +/// returns None if there's no payout or if any deserved payout is < 1 lamport fn calculate_stake_rewards( rewarded_epoch: Epoch, stake: &Stake, From c5ae470f348f13b715ed59636bd151bd77479f01 Mon Sep 17 00:00:00 2001 From: yihau Date: Fri, 9 Aug 2024 16:16:21 +0800 Subject: [PATCH 7/8] fix wrong indent --- zk-token-sdk/src/encryption/elgamal.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/zk-token-sdk/src/encryption/elgamal.rs b/zk-token-sdk/src/encryption/elgamal.rs index 61ccf2c5a9689d..e90b98920abfd4 100644 --- a/zk-token-sdk/src/encryption/elgamal.rs +++ b/zk-token-sdk/src/encryption/elgamal.rs @@ -6,9 +6,10 @@ //! A twisted ElGamal ciphertext consists of two components: //! - A Pedersen commitment that encodes a message to be encrypted //! - A "decryption handle" that binds the Pedersen opening to a specific public key -//! In contrast to the traditional ElGamal encryption scheme, the twisted ElGamal encodes messages -//! directly as a Pedersen commitment. Therefore, proof systems that are designed specifically for -//! Pedersen commitments can be used on the twisted ElGamal ciphertexts. +//! +//! In contrast to the traditional ElGamal encryption scheme, the twisted ElGamal encodes messages +//! directly as a Pedersen commitment. Therefore, proof systems that are designed specifically for +//! Pedersen commitments can be used on the twisted ElGamal ciphertexts. //! //! As the messages are encrypted as scalar elements (a.k.a. in the "exponent"), one must solve the //! discrete log to recover the originally encrypted value. From f88e614b14541d6b95a6391f56df1616e5e4d7ad Mon Sep 17 00:00:00 2001 From: yihau Date: Fri, 9 Aug 2024 16:20:28 +0800 Subject: [PATCH 8/8] revert bigtable docs update --- storage-bigtable/proto/google.bigtable.v2.rs | 24 ++++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/storage-bigtable/proto/google.bigtable.v2.rs b/storage-bigtable/proto/google.bigtable.v2.rs index c7b9f59e021fac..5df837a60f9ec1 100644 --- a/storage-bigtable/proto/google.bigtable.v2.rs +++ b/storage-bigtable/proto/google.bigtable.v2.rs @@ -213,22 +213,22 @@ pub mod value_range { /// (chains and interleaves). They work as follows: /// /// * True filters alter the input row by excluding some of its cells wholesale -/// from the output row. An example of a true filter is the `value_regex_filter`, -/// which excludes cells whose values don't match the specified pattern. All -/// regex true filters use RE2 syntax () -/// in raw byte mode (RE2::Latin1), and are evaluated as full matches. An -/// important point to keep in mind is that `RE2(.)` is equivalent by default to -/// `RE2(\[^\n\])`, meaning that it does not match newlines. When attempting to -/// match an arbitrary byte, you should therefore use the escape sequence `\C`, -/// which may need to be further escaped as `\\C` in your client language. +/// from the output row. An example of a true filter is the `value_regex_filter`, +/// which excludes cells whose values don't match the specified pattern. All +/// regex true filters use RE2 syntax () +/// in raw byte mode (RE2::Latin1), and are evaluated as full matches. An +/// important point to keep in mind is that `RE2(.)` is equivalent by default to +/// `RE2(\[^\n\])`, meaning that it does not match newlines. When attempting to +/// match an arbitrary byte, you should therefore use the escape sequence `\C`, +/// which may need to be further escaped as `\\C` in your client language. /// /// * Transformers alter the input row by changing the values of some of its -/// cells in the output, without excluding them completely. Currently, the only -/// supported transformer is the `strip_value_transformer`, which replaces every -/// cell's value with the empty string. +/// cells in the output, without excluding them completely. Currently, the only +/// supported transformer is the `strip_value_transformer`, which replaces every +/// cell's value with the empty string. /// /// * Chains and interleaves are described in more detail in the -/// RowFilter.Chain and RowFilter.Interleave documentation. +/// RowFilter.Chain and RowFilter.Interleave documentation. /// /// The total serialized size of a RowFilter message must not /// exceed 20480 bytes, and RowFilters may not be nested within each other