From a43922ccbf20165c067a610763e7a3038c5d386a Mon Sep 17 00:00:00 2001 From: Greg Fitzgerald Date: Mon, 12 Aug 2019 16:46:49 -0600 Subject: [PATCH] Boot hashbrown (#5505) As of Rust 1.36.0, hashbrown now implements the HashMap in std (which implements HashSet). https://blog.rust-lang.org/2019/07/04/Rust-1.36.0.html#a-new-hashmapk,-v%3E-implementation --- Cargo.lock | 11 ----------- core/Cargo.toml | 1 - core/src/cluster_tests.rs | 2 +- genesis/Cargo.toml | 4 ---- genesis_programs/Cargo.toml | 1 - genesis_programs/src/lib.rs | 2 +- local_cluster/Cargo.toml | 1 - local_cluster/tests/local_cluster.rs | 2 +- runtime/Cargo.toml | 1 - runtime/benches/bloom.rs | 3 +-- runtime/src/accounts_index.rs | 2 +- 11 files changed, 5 insertions(+), 25 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0458e6e2c..befb6e394 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1244,11 +1244,6 @@ dependencies = [ "scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "hashbrown" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "heck" version = "0.3.1" @@ -3048,7 +3043,6 @@ dependencies = [ "dir-diff 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "flate2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", "fs_extra 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "hashbrown 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "hex-literal 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "indexmap 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3357,7 +3351,6 @@ version = "0.18.0-pre1" dependencies = [ "bincode 1.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)", - "hashbrown 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.98 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.98 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3374,7 +3367,6 @@ dependencies = [ name = "solana-genesis-programs" version = "0.18.0-pre1" dependencies = [ - "hashbrown 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "solana-bpf-loader-api 0.18.0-pre1", "solana-bpf-loader-program 0.18.0-pre1", "solana-budget-api 0.18.0-pre1", @@ -3501,7 +3493,6 @@ dependencies = [ name = "solana-local-cluster" version = "0.18.0-pre1" dependencies = [ - "hashbrown 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "serial_test 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "serial_test_derive 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3636,7 +3627,6 @@ dependencies = [ "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "fs_extra 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "hashbrown 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.61 (registry+https://github.com/rust-lang/crates.io-index)", "libloading 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -5341,7 +5331,6 @@ dependencies = [ "checksum h2 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)" = "a5b34c246847f938a410a03c5458c7fee2274436675e76d8b903c08efc29c462" "checksum hash32 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "12d790435639c06a7b798af9e1e331ae245b7ef915b92f70a39b4cf8c00686af" "checksum hashbrown 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "3bae29b6653b3412c2e71e9d486db9f9df5d701941d86683005efb9f2d28e3da" -"checksum hashbrown 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e1de41fb8dba9714efd92241565cdff73f78508c95697dd56787d3cba27e2353" "checksum heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "20564e78d53d2bb135c343b3f47714a56af2061f1c928fdb541dc7b9fdd94205" "checksum hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "805026a5d0141ffc30abb3be3173848ad46a1b1664fe632428479619a3644d77" "checksum hex-literal 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c3da68162fdd2147e66682e78e729bd77f93b4c99656db058c5782d8c6b6225a" diff --git a/core/Cargo.toml b/core/Cargo.toml index 14f60aaaa..576eea5a1 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -28,7 +28,6 @@ crossbeam-channel = "0.3" dir-diff = "0.3.1" flate2 = "1.0.9" fs_extra = "1.1.0" -hashbrown = "0.5.0" indexmap = "1.0" itertools = "0.8.0" jsonrpc-core = "13.0.0" diff --git a/core/src/cluster_tests.rs b/core/src/cluster_tests.rs index d134c5996..650ec5a25 100644 --- a/core/src/cluster_tests.rs +++ b/core/src/cluster_tests.rs @@ -8,7 +8,6 @@ use crate::consensus::VOTE_THRESHOLD_DEPTH; use crate::contact_info::ContactInfo; use crate::entry::{Entry, EntrySlice}; use crate::gossip_service::discover_cluster; -use hashbrown::HashSet; use solana_client::thin_client::create_client; use solana_runtime::epoch_schedule::MINIMUM_SLOTS_PER_EPOCH; use solana_sdk::client::SyncClient; @@ -22,6 +21,7 @@ use solana_sdk::timing::{ NUM_CONSECUTIVE_LEADER_SLOTS, }; use solana_sdk::transport::TransportError; +use std::collections::HashSet; use std::path::Path; use std::thread::sleep; use std::time::Duration; diff --git a/genesis/Cargo.toml b/genesis/Cargo.toml index 3cba2631e..b720c3941 100644 --- a/genesis/Cargo.toml +++ b/genesis/Cargo.toml @@ -22,10 +22,6 @@ solana-stake-api = { path = "../programs/stake_api", version = "0.18.0-pre1" } solana-storage-api = { path = "../programs/storage_api", version = "0.18.0-pre1" } solana-vote-api = { path = "../programs/vote_api", version = "0.18.0-pre1" } -[dev-dependencies] -hashbrown = "0.5.0" - - [features] cuda = ["solana/cuda"] diff --git a/genesis_programs/Cargo.toml b/genesis_programs/Cargo.toml index 748cc909e..7091a499d 100644 --- a/genesis_programs/Cargo.toml +++ b/genesis_programs/Cargo.toml @@ -9,7 +9,6 @@ homepage = "https://solana.com/" edition = "2018" [dependencies] -hashbrown = "0.5.0" solana-bpf-loader-api = { path = "../programs/bpf_loader_api", version = "0.18.0-pre1" } solana-bpf-loader-program = { path = "../programs/bpf_loader_program", version = "0.18.0-pre1" } solana-budget-api= { path = "../programs/budget_api", version = "0.18.0-pre0" } diff --git a/genesis_programs/src/lib.rs b/genesis_programs/src/lib.rs index 196f2344e..af3fde0cb 100644 --- a/genesis_programs/src/lib.rs +++ b/genesis_programs/src/lib.rs @@ -35,7 +35,7 @@ pub fn get() -> Vec<(String, Pubkey)> { #[cfg(test)] mod tests { - use hashbrown::HashSet; + use std::collections::HashSet; #[test] fn test_id_uniqueness() { diff --git a/local_cluster/Cargo.toml b/local_cluster/Cargo.toml index 0875f5065..a995bfb99 100644 --- a/local_cluster/Cargo.toml +++ b/local_cluster/Cargo.toml @@ -21,7 +21,6 @@ solana-storage-program = { path = "../programs/storage_program", version = "0.18 solana-vote-api = { path = "../programs/vote_api", version = "0.18.0-pre1" } [dev-dependencies] -hashbrown = "0.5.0" serial_test = "0.2.0" serial_test_derive = "0.2.0" diff --git a/local_cluster/tests/local_cluster.rs b/local_cluster/tests/local_cluster.rs index 84b457509..dc3917f57 100644 --- a/local_cluster/tests/local_cluster.rs +++ b/local_cluster/tests/local_cluster.rs @@ -1,6 +1,5 @@ extern crate solana; -use hashbrown::HashSet; use log::*; use serial_test_derive::serial; use solana::blocktree::Blocktree; @@ -14,6 +13,7 @@ use solana_runtime::epoch_schedule::{EpochSchedule, MINIMUM_SLOTS_PER_EPOCH}; use solana_sdk::client::SyncClient; use solana_sdk::poh_config::PohConfig; use solana_sdk::timing; +use std::collections::HashSet; use std::thread::sleep; use std::time::Duration; diff --git a/runtime/Cargo.toml b/runtime/Cargo.toml index 4c08586a0..2da122a76 100644 --- a/runtime/Cargo.toml +++ b/runtime/Cargo.toml @@ -14,7 +14,6 @@ bv = { version = "0.11.0", features = ["serde"] } byteorder = "1.3.2" fnv = "1.0.6" fs_extra = "1.1.0" -hashbrown = "0.5.0" lazy_static = "1.3.0" libc = "0.2.61" libloading = "0.5.2" diff --git a/runtime/benches/bloom.rs b/runtime/benches/bloom.rs index 66b0f4fee..cd71b8836 100644 --- a/runtime/benches/bloom.rs +++ b/runtime/benches/bloom.rs @@ -6,8 +6,7 @@ use fnv::FnvHasher; use solana_runtime::bloom::{Bloom, BloomHashIndex}; use solana_sdk::hash::{hash, Hash}; use solana_sdk::signature::Signature; -//use std::collections::HashSet; -use hashbrown::HashSet; +use std::collections::HashSet; use std::hash::Hasher; use test::Bencher; diff --git a/runtime/src/accounts_index.rs b/runtime/src/accounts_index.rs index 191bec757..e0971c9dc 100644 --- a/runtime/src/accounts_index.rs +++ b/runtime/src/accounts_index.rs @@ -7,7 +7,7 @@ type ForkList = Vec<(Fork, T)>; #[derive(Debug, Default)] pub struct AccountsIndex { - pub account_maps: hashbrown::HashMap>>, + pub account_maps: HashMap>>, pub roots: HashSet,