Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
35359595 committed Apr 11, 2024
2 parents 696c8db + d5c291a commit fccf9d7
Show file tree
Hide file tree
Showing 58 changed files with 1,170 additions and 838 deletions.
35 changes: 12 additions & 23 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ Inflector = "0.11.4"
aquamarine = "0.3.3"
aes-gcm-siv = "0.10.3"
ahash = "0.8.10"
anyhow = "1.0.81"
anyhow = "1.0.82"
arbitrary = "1.3.2"
ark-bn254 = "0.4.0"
ark-ec = "0.4.0"
Expand Down Expand Up @@ -252,7 +252,7 @@ merlin = "3"
min-max-heap = "1.3.0"
mockall = "0.11.4"
modular-bitfield = "0.11.2"
nix = "0.26.4"
nix = "0.28.0"
num-bigint = "0.4.4"
num-derive = "0.4"
num-traits = "0.2"
Expand Down Expand Up @@ -305,7 +305,7 @@ sha2 = "0.10.8"
sha3 = "0.10.8"
signal-hook = "0.3.17"
siphasher = "0.3.11"
smallvec = "1.13.1"
smallvec = "1.13.2"
smpl_jwt = "0.7.1"
socket2 = "0.5.6"
soketto = "0.7"
Expand Down
11 changes: 6 additions & 5 deletions accounts-db/src/accounts_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1203,8 +1203,9 @@ impl AccountStorageEntry {
count
}

pub fn get_path(&self) -> PathBuf {
self.accounts.get_path()
/// Returns the path to the underlying accounts storage file
pub fn path(&self) -> &Path {
self.accounts.path()
}
}

Expand Down Expand Up @@ -5508,13 +5509,13 @@ impl AccountsDb {
let store = Arc::new(self.new_storage_entry(slot, Path::new(&paths[path_index]), size));

debug!(
"creating store: {} slot: {} len: {} size: {} from: {} path: {:?}",
"creating store: {} slot: {} len: {} size: {} from: {} path: {}",
store.append_vec_id(),
slot,
store.accounts.len(),
store.accounts.capacity(),
from,
store.accounts.get_path()
store.accounts.path().display(),
);

store
Expand Down Expand Up @@ -6790,7 +6791,7 @@ impl AccountsDb {
if let Some(append_vec) = storage {
// hash info about this storage
append_vec.written_bytes().hash(hasher);
let storage_file = append_vec.accounts.get_path();
let storage_file = append_vec.accounts.path();
slot.hash(hasher);
storage_file.hash(hasher);
let amod = std::fs::metadata(storage_file);
Expand Down
13 changes: 9 additions & 4 deletions accounts-db/src/accounts_file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,12 @@ use {
clock::Slot,
pubkey::Pubkey,
},
std::{borrow::Borrow, io::Read, mem, path::PathBuf},
std::{
borrow::Borrow,
io::Read,
mem,
path::{Path, PathBuf},
},
thiserror::Error,
};

Expand Down Expand Up @@ -166,10 +171,10 @@ impl AccountsFile {
}

/// Return the path of the underlying account file.
pub fn get_path(&self) -> PathBuf {
pub fn path(&self) -> &Path {
match self {
Self::AppendVec(av) => av.get_path(),
Self::TieredStorage(ts) => ts.path().to_path_buf(),
Self::AppendVec(av) => av.path(),
Self::TieredStorage(ts) => ts.path(),
}
}

Expand Down
7 changes: 4 additions & 3 deletions accounts-db/src/append_vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ use {
fs::{remove_file, OpenOptions},
io::{Seek, SeekFrom, Write},
mem,
path::PathBuf,
path::{Path, PathBuf},
sync::{
atomic::{AtomicU64, AtomicUsize, Ordering},
Mutex,
Expand Down Expand Up @@ -615,8 +615,9 @@ impl AppendVec {
Some((meta, stored_account.to_account_shared_data()))
}

pub fn get_path(&self) -> PathBuf {
self.path.clone()
/// Returns the path to the file where the data is stored
pub fn path(&self) -> &Path {
self.path.as_path()
}

/// help with the math of offsets when navigating the on-disk layout in an AppendVec.
Expand Down
4 changes: 1 addition & 3 deletions accounts-db/store-tool/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,8 @@ fn main() {
break;
}
info!(
" account: {:?} version: {} lamports: {} data: {} hash: {:?}",
" account: {:?} lamports: {} data: {} hash: {:?}",
account.pubkey(),
account.write_version(),
account.lamports(),
account.data_len(),
account.hash()
Expand All @@ -69,7 +68,6 @@ fn main() {
fn is_account_zeroed(account: &StoredAccountMeta) -> bool {
account.hash() == &AccountHash(Hash::default())
&& account.data_len() == 0
&& account.write_version() == 0
&& account.pubkey() == &Pubkey::default()
&& account.to_account_shared_data() == AccountSharedData::default()
}
4 changes: 2 additions & 2 deletions cli-output/src/cli_output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -978,7 +978,7 @@ pub struct CliKeyedEpochReward {

#[derive(Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct CliEpochRewardshMetadata {
pub struct CliEpochRewardsMetadata {
pub epoch: Epoch,
pub effective_slot: Slot,
pub block_time: UnixTimestamp,
Expand All @@ -988,7 +988,7 @@ pub struct CliEpochRewardshMetadata {
#[serde(rename_all = "camelCase")]
pub struct CliKeyedEpochRewards {
#[serde(flatten, skip_serializing_if = "Option::is_none")]
pub epoch_metadata: Option<CliEpochRewardshMetadata>,
pub epoch_metadata: Option<CliEpochRewardsMetadata>,
pub rewards: Vec<CliKeyedEpochReward>,
}

Expand Down
4 changes: 2 additions & 2 deletions cli/src/inflation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use {
keypair::*,
},
solana_cli_output::{
CliEpochRewardshMetadata, CliInflation, CliKeyedEpochReward, CliKeyedEpochRewards,
CliEpochRewardsMetadata, CliInflation, CliKeyedEpochReward, CliKeyedEpochRewards,
},
solana_remote_wallet::remote_wallet::RemoteWalletManager,
solana_rpc_client::rpc_client::RpcClient,
Expand Down Expand Up @@ -128,7 +128,7 @@ fn process_rewards(
});
}
let block_time = rpc_client.get_block_time(first_reward.effective_slot)?;
Some(CliEpochRewardshMetadata {
Some(CliEpochRewardsMetadata {
epoch: first_reward.epoch,
effective_slot: first_reward.effective_slot,
block_time,
Expand Down
1 change: 0 additions & 1 deletion core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ bytes = { workspace = true }
chrono = { workspace = true, features = ["default", "serde"] }
crossbeam-channel = { workspace = true }
dashmap = { workspace = true, features = ["rayon", "raw-api"] }
eager = { workspace = true }
etcd-client = { workspace = true, features = ["tls"] }
futures = { workspace = true }
histogram = { workspace = true }
Expand Down
14 changes: 7 additions & 7 deletions core/benches/banking_stage.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
#![allow(clippy::arithmetic_side_effects)]
#![feature(test)]

use solana_core::validator::BlockProductionMethod;
use {
solana_core::validator::BlockProductionMethod,
solana_vote_program::{vote_state::TowerSync, vote_transaction::new_tower_sync_transaction},
};

extern crate test;

Expand Down Expand Up @@ -50,9 +53,6 @@ use {
transaction::{Transaction, VersionedTransaction},
},
solana_streamer::socket::SocketAddrSpace,
solana_vote_program::{
vote_state::VoteStateUpdate, vote_transaction::new_vote_state_update_transaction,
},
std::{
iter::repeat_with,
sync::{atomic::Ordering, Arc},
Expand Down Expand Up @@ -169,11 +169,11 @@ fn make_vote_txs(txes: usize) -> Vec<Transaction> {
.map(|i| {
// Quarter of the votes should be filtered out
let vote = if i % 4 == 0 {
VoteStateUpdate::from(vec![(2, 1)])
TowerSync::from(vec![(2, 1)])
} else {
VoteStateUpdate::from(vec![(i as u64, 1)])
TowerSync::from(vec![(i as u64, 1)])
};
new_vote_state_update_transaction(
new_tower_sync_transaction(
vote,
Hash::new_unique(),
&keypairs[i % num_voters],
Expand Down
Loading

0 comments on commit fccf9d7

Please sign in to comment.