Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix docs format #2497

Merged
merged 8 commits into from
Aug 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions core/src/banking_stage/leader_slot_metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions core/src/repair/duplicate_repair_status.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
49 changes: 25 additions & 24 deletions dos/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
//!
//! * `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`.
//!
Expand All @@ -16,27 +17,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)]
Expand Down Expand Up @@ -89,12 +90,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 {
Expand Down
1 change: 1 addition & 0 deletions gossip/src/crds.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
//! 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.
//!
Expand Down
17 changes: 8 additions & 9 deletions ledger/src/blockstore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
Expand Down Expand Up @@ -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`.
Expand Down
4 changes: 2 additions & 2 deletions ledger/src/blockstore_cleanup_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
6 changes: 3 additions & 3 deletions ledger/src/blockstore_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2109,9 +2109,9 @@ fn new_cf_descriptor_fifo<C: 'static + Column + ColumnName>(
/// 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<C: 'static + Column + ColumnName>(
max_cf_size: &u64,
column_options: &LedgerColumnOptions,
Expand Down
4 changes: 2 additions & 2 deletions local-cluster/src/integration_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<C>(
partitions: &[usize],
Expand Down
1 change: 1 addition & 0 deletions programs/stake/src/rewards.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +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
fn calculate_stake_rewards(
rewarded_epoch: Epoch,
Expand Down
2 changes: 1 addition & 1 deletion runtime/src/bank.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions sdk/gen-headers/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
1 change: 1 addition & 0 deletions turbine/src/broadcast_stage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions zk-sdk/src/encryption/elgamal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
//! 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.
Expand Down
1 change: 1 addition & 0 deletions zk-sdk/src/encryption/grouped_elgamal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
//! 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.
Expand Down
8 changes: 4 additions & 4 deletions zk-sdk/src/encryption/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};

Expand Down
6 changes: 3 additions & 3 deletions zk-sdk/src/range_proof/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
2 changes: 1 addition & 1 deletion zk-sdk/src/sigma_proofs/ciphertext_ciphertext_equality.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion zk-sdk/src/sigma_proofs/percentage_with_cap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion zk-sdk/src/sigma_proofs/pubkey_validity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
4 changes: 2 additions & 2 deletions zk-sdk/src/zk_elgamal_proof_program/instruction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions zk-token-sdk/src/encryption/elgamal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
//! 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.
Expand Down
6 changes: 3 additions & 3 deletions zk-token-sdk/src/encryption/grouped_elgamal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
8 changes: 4 additions & 4 deletions zk-token-sdk/src/encryption/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Loading