Skip to content
This repository has been archived by the owner on Jan 22, 2025. It is now read-only.

Switch account hashing to blake3 (bp #11969) #11992

Merged
merged 1 commit into from
Sep 2, 2020
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
47 changes: 41 additions & 6 deletions Cargo.lock

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

4 changes: 2 additions & 2 deletions accounts-bench/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use solana_runtime::{
accounts::{create_test_accounts, update_accounts, Accounts},
accounts_index::Ancestors,
};
use solana_sdk::pubkey::Pubkey;
use solana_sdk::{genesis_config::OperatingMode, pubkey::Pubkey};
use std::fs;
use std::path::PathBuf;

Expand Down Expand Up @@ -54,7 +54,7 @@ fn main() {
if fs::remove_dir_all(path.clone()).is_err() {
println!("Warning: Couldn't remove {:?}", path);
}
let accounts = Accounts::new(vec![path]);
let accounts = Accounts::new(vec![path], &OperatingMode::Preview);
println!("Creating {} accounts", num_accounts);
let mut create_time = Measure::start("create accounts");
let pubkeys: Vec<_> = (0..num_slots)
Expand Down
63 changes: 58 additions & 5 deletions programs/bpf/Cargo.lock

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

1 change: 1 addition & 0 deletions runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ edition = "2018"

[dependencies]
bincode = "1.3.1"
blake3 = "0.3.6"
bv = { version = "0.11.1", features = ["serde"] }
byteorder = "1.3.4"
bzip2 = "0.3.3"
Expand Down
26 changes: 21 additions & 5 deletions runtime/benches/accounts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ use solana_runtime::{
accounts::{create_test_accounts, Accounts},
bank::*,
};
use solana_sdk::{account::Account, genesis_config::create_genesis_config, pubkey::Pubkey};
use solana_sdk::{
account::Account,
genesis_config::{create_genesis_config, OperatingMode},
pubkey::Pubkey,
};
use std::{path::PathBuf, sync::Arc};
use test::Bencher;

Expand Down Expand Up @@ -65,7 +69,10 @@ fn test_accounts_squash(bencher: &mut Bencher) {

#[bench]
fn test_accounts_hash_bank_hash(bencher: &mut Bencher) {
let accounts = Accounts::new(vec![PathBuf::from("bench_accounts_hash_internal")]);
let accounts = Accounts::new(
vec![PathBuf::from("bench_accounts_hash_internal")],
&OperatingMode::Development,
);
let mut pubkeys: Vec<Pubkey> = vec![];
create_test_accounts(&accounts, &mut pubkeys, 60000, 0);
let ancestors = vec![(0, 0)].into_iter().collect();
Expand All @@ -76,7 +83,10 @@ fn test_accounts_hash_bank_hash(bencher: &mut Bencher) {
#[bench]
fn test_update_accounts_hash(bencher: &mut Bencher) {
solana_logger::setup();
let accounts = Accounts::new(vec![PathBuf::from("update_accounts_hash")]);
let accounts = Accounts::new(
vec![PathBuf::from("update_accounts_hash")],
&OperatingMode::Development,
);
let mut pubkeys: Vec<Pubkey> = vec![];
create_test_accounts(&accounts, &mut pubkeys, 50_000, 0);
let ancestors = vec![(0, 0)].into_iter().collect();
Expand All @@ -88,7 +98,10 @@ fn test_update_accounts_hash(bencher: &mut Bencher) {
#[bench]
fn test_accounts_delta_hash(bencher: &mut Bencher) {
solana_logger::setup();
let accounts = Accounts::new(vec![PathBuf::from("accounts_delta_hash")]);
let accounts = Accounts::new(
vec![PathBuf::from("accounts_delta_hash")],
&OperatingMode::Development,
);
let mut pubkeys: Vec<Pubkey> = vec![];
create_test_accounts(&accounts, &mut pubkeys, 100_000, 0);
bencher.iter(|| {
Expand All @@ -99,7 +112,10 @@ fn test_accounts_delta_hash(bencher: &mut Bencher) {
#[bench]
fn bench_delete_dependencies(bencher: &mut Bencher) {
solana_logger::setup();
let accounts = Accounts::new(vec![PathBuf::from("accounts_delete_deps")]);
let accounts = Accounts::new(
vec![PathBuf::from("accounts_delete_deps")],
&OperatingMode::Development,
);
let mut old_pubkey = Pubkey::default();
let zero_account = Account::new(0, 0, &Account::default().owner);
for i in 0..1000 {
Expand Down
Loading