Skip to content

Commit 74ee737

Browse files
committed
satisfy hunspell
1 parent 2a17311 commit 74ee737

File tree

4 files changed

+21
-18
lines changed

4 files changed

+21
-18
lines changed

scripts/setup/solana.dic

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,4 +66,6 @@ performant
6666
syscall/S
6767
bitmask
6868
pinocchio
69-
mainnet
69+
mainnet
70+
getter/S
71+
PRNG

sdk/pinocchio/src/sysvars/slot_hashes/mod.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,21 +23,21 @@ use core::{mem, ops::Deref, slice::from_raw_parts};
2323
#[cfg(feature = "std")]
2424
use std::boxed::Box;
2525

26-
/// SysvarS1otHashes111111111111111111111111111
26+
/// `SysvarS1otHashes111111111111111111111111111`
2727
pub const SLOTHASHES_ID: Pubkey = [
2828
6, 167, 213, 23, 25, 47, 10, 175, 198, 242, 101, 227, 251, 119, 204, 122, 218, 130, 197, 41,
2929
208, 190, 59, 19, 110, 45, 0, 85, 32, 0, 0, 0,
3030
];
3131
/// Number of bytes in a hash.
3232
pub const HASH_BYTES: usize = 32;
3333
/// Sysvar data is:
34-
/// len (8 bytes): little-endian entry count (≤ 512)
35-
/// entries(len × 40 bytes): consecutive `(u64 slot, [u8;32] hash)` pairs
34+
/// `len` (8 bytes): little-endian entry count (`≤ 512`)
35+
/// `entries`(`len × 40 bytes`): consecutive `(u64 slot, [u8;32] hash)` pairs
3636
/// Size of the entry count field at the beginning of sysvar data.
3737
pub const NUM_ENTRIES_SIZE: usize = mem::size_of::<u64>();
3838
/// Size of a slot number in bytes.
3939
pub const SLOT_SIZE: usize = mem::size_of::<Slot>();
40-
/// Size of a single slot hash entry (slot + hash).
40+
/// Size of a single slot hash entry.
4141
pub const ENTRY_SIZE: usize = SLOT_SIZE + HASH_BYTES;
4242
/// Maximum number of slot hash entries that can be stored in the sysvar.
4343
pub const MAX_ENTRIES: usize = 512;
@@ -87,7 +87,7 @@ pub(crate) fn read_entry_count_from_bytes(data: &[u8]) -> Option<usize> {
8787
/// Reads the entry count from the first 8 bytes of data.
8888
///
8989
/// # Safety
90-
/// Caller must ensure data has at least NUM_ENTRIES_SIZE bytes.
90+
/// Caller must ensure data has at least `NUM_ENTRIES_SIZE` bytes.
9191
#[inline(always)]
9292
pub(crate) unsafe fn read_entry_count_from_bytes_unchecked(data: &[u8]) -> usize {
9393
u64::from_le_bytes(*(data.as_ptr() as *const [u8; NUM_ENTRIES_SIZE])) as usize
@@ -119,7 +119,7 @@ fn parse_and_validate_data(data: &[u8]) -> Result<(), ProgramError> {
119119
}
120120

121121
impl SlotHashEntry {
122-
/// Returns the slot number as a u64.
122+
/// Returns the slot number as a `u64`.
123123
#[inline(always)]
124124
pub fn slot(&self) -> Slot {
125125
u64::from_le_bytes(self.slot_le)
@@ -130,8 +130,8 @@ impl<T: Deref<Target = [u8]>> SlotHashes<T> {
130130
/// Creates a `SlotHashes` instance with validation of the entry count and buffer size.
131131
///
132132
/// This constructor validates that the buffer has at least enough bytes to contain
133-
/// the declared number of entries. The buffer can be any size >= the minimum required,
134-
/// making it suitable for both full MAX_SIZE buffers and smaller test data.
133+
/// the declared number of entries. The buffer can be any size above the minimum required,
134+
/// making it suitable for both full `MAX_SIZE` buffers and smaller test data.
135135
/// Does not validate that entries are sorted in descending order.
136136
#[inline(always)]
137137
pub fn new(data: T) -> Result<Self, ProgramError> {
@@ -153,7 +153,7 @@ impl<T: Deref<Target = [u8]>> SlotHashes<T> {
153153
/// This function is unsafe because it does not validate the data size or format.
154154
/// The caller must ensure:
155155
/// 1. The underlying byte slice in `data` represents valid `SlotHashes` data
156-
/// (length prefix + entries, where entries are sorted in descending order by slot).
156+
/// (length prefix plus entries, where entries are sorted in descending order by slot).
157157
/// 2. The data slice has at least `NUM_ENTRIES_SIZE + (declared_entries * ENTRY_SIZE)` bytes.
158158
/// 3. The first 8 bytes contain a valid entry count in little-endian format.
159159
///
@@ -292,8 +292,8 @@ impl SlotHashes<Box<[u8]>> {
292292
/// Fills the provided buffer with the full `SlotHashes` sysvar data.
293293
///
294294
/// # Safety
295-
/// The caller must ensure the buffer pointer is valid for MAX_SIZE bytes.
296-
/// The syscall will write exactly MAX_SIZE bytes to the buffer.
295+
/// The caller must ensure the buffer pointer is valid for `MAX_SIZE` bytes.
296+
/// The syscall will write exactly `MAX_SIZE` bytes to the buffer.
297297
#[inline(always)]
298298
unsafe fn fill_from_sysvar(buffer_ptr: *mut u8) -> Result<(), ProgramError> {
299299
crate::sysvars::get_sysvar_unchecked(buffer_ptr, &SLOTHASHES_ID, 0, MAX_SIZE)?;

sdk/pinocchio/src/sysvars/slot_hashes/raw.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use super::*;
1010

1111
/// Validates that a buffer is properly sized for `SlotHashes` data.
1212
///
13-
/// Checks that the buffer length is 8 + (N × 40) for some N ≤ 512.
13+
/// Checks that the buffer length is `8 + (N × 40)` for some `N ≤ 512`.
1414
/// Unlike the `SlotHashes` constructor, this function does not require
1515
/// the buffer to be exactly 20,488 bytes.
1616
#[inline(always)]
@@ -36,8 +36,8 @@ pub(crate) fn validate_buffer_size(buffer_len: usize) -> Result<(), ProgramError
3636

3737
/// Validates offset parameters for fetching `SlotHashes` data.
3838
///
39-
/// * `offset` Byte offset within the `SlotHashes` sysvar data.
40-
/// * `buffer_len` Length of the destination buffer.
39+
/// * `offset` - Byte offset within the `SlotHashes` sysvar data.
40+
/// * `buffer_len` - Length of the destination buffer.
4141
#[inline(always)]
4242
pub fn validate_fetch_offset(offset: usize, buffer_len: usize) -> Result<(), ProgramError> {
4343
if offset >= MAX_SIZE {
@@ -80,7 +80,7 @@ pub fn fetch_into(buffer: &mut [u8], offset: usize) -> Result<usize, ProgramErro
8080
/// Copies `SlotHashes` sysvar bytes into `buffer` **without** validation.
8181
///
8282
/// The caller is responsible for ensuring that:
83-
/// 1. `buffer` is large enough for the requested `offset` + `buffer.len()` range and
83+
/// 1. `buffer` is large enough for the requested `offset + buffer.len()` range and
8484
/// properly laid out (see `validate_buffer_size` and `validate_fetch_offset`).
8585
/// 2. The memory behind `buffer` is writable for its full length.
8686
///

sdk/pinocchio/src/sysvars/slot_hashes/test_utils.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,10 @@ pub struct AccountLayout {
3333
pub enum DecrementStrategy {
3434
/// Always decrement by exactly 1.
3535
Strictly1,
36-
/// Mostly ‑1 with occasional ‑2 so that the *average* decrement ≈ 1.05.
36+
/// Mostly a decrement of 1 with occasional decrement of 2 so that the
37+
/// *average* decrement is `1.05`.
3738
Average1_05,
38-
/// Roughly 50 % chance of ‑1 and 50 % chance of ‑3 (average ≈ 2).
39+
/// Average decrement of 2.
3940
Average2,
4041
}
4142

0 commit comments

Comments
 (0)