Skip to content

Commit

Permalink
Maintenance : simplify a few patterns, remove unneeded dependencies (s…
Browse files Browse the repository at this point in the history
…olana-labs#8137)

* Simplify a few pattern matches

* Removing unneeded dependencies, upgrading internal version #s

 net-shaper: Removing log, semver, serde_derive
 bench-tps: Removing serde, serde_derive
 banking-bench: Removing solana
 ledger-tool: Removing bincode, serde, serde_derive
 librapay: Removing solana, language_e2e_tests
 log-analyzer: Removing log, semver, serde_derive
 exchange: Removing solana
 core: Removing crc, memmap, symlink, untrusted
 perf: Removing serde_derive
 genesis: Removing hex, serde_derive
 sdk-c: Removing sha2
 sys-tuner: Removing semver
 bench-exchange: Removing bincode, bs58, env_logger, serde, serde_derive, untrusted, ws
 btc_spv_bin: Removing serde_json
 btc_spv: Removing chrono
 bpf_loader: Removing serde
 ledger: Removing dlopen, dlopen_derive, serde_derive
 move_loader: Removing byteorder, libc, language_e2e_tests
 ownable: Removing serde, serde_derive
 client: Removing rand
 archiver-utils: Removing rand_chacha
 validator: Removing serde_json, tempfile
 param_passing_dep: Removing solana
 failure: Removing log
 vest: Removing log
 vote-signer: Removing bs58, serde
 local-cluster: Removing symlink
 keygen: Removing rpassword
 install: Removing bs58, log
 upload-perf: Removing log
 runtime: Removing serde_json
 stake: Removing rand

* Add modified Cargo.lock

* fixup! Simplify a few pattern matches

* fixup! Simplify a few pattern matches
  • Loading branch information
huitseeker authored Feb 6, 2020
1 parent 59ba1df commit f016c9a
Show file tree
Hide file tree
Showing 40 changed files with 53 additions and 283 deletions.
155 changes: 0 additions & 155 deletions Cargo.lock

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion archiver-utils/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ edition = "2018"
[dependencies]
log = "0.4.8"
rand = "0.6.5"
rand_chacha = "0.1.1"
solana-chacha = { path = "../chacha", version = "0.24.0" }
solana-chacha-sys = { path = "../chacha-sys", version = "0.24.0" }
solana-ledger = { path = "../ledger", version = "0.24.0" }
Expand Down
7 changes: 0 additions & 7 deletions bench-exchange/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,13 @@ homepage = "https://solana.com/"
publish = false

[dependencies]
bincode = "1.2.1"
bs58 = "0.3.0"
clap = "2.32.0"
env_logger = "0.7.1"
itertools = "0.8.2"
log = "0.4.8"
num-derive = "0.3"
num-traits = "0.2"
rand = "0.6.5"
rayon = "1.2.0"
serde = "1.0.104"
serde_derive = "1.0.103"
serde_json = "1.0.46"
serde_yaml = "0.8.11"
solana-clap-utils = { path = "../clap-utils", version = "0.24.0" }
Expand All @@ -34,8 +29,6 @@ solana-metrics = { path = "../metrics", version = "0.24.0" }
solana-net-utils = { path = "../net-utils", version = "0.24.0" }
solana-runtime = { path = "../runtime", version = "0.24.0" }
solana-sdk = { path = "../sdk", version = "0.24.0" }
untrusted = "0.7.0"
ws = "0.9.1"

[dev-dependencies]
solana-local-cluster = { path = "../local-cluster", version = "0.24.0" }
2 changes: 0 additions & 2 deletions bench-tps/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ bincode = "1.2.1"
clap = "2.33.0"
log = "0.4.8"
rayon = "1.2.0"
serde = "1.0.104"
serde_derive = "1.0.103"
serde_json = "1.0.46"
serde_yaml = "0.8.11"
solana-clap-utils = { path = "../clap-utils", version = "0.24.0" }
Expand Down
1 change: 0 additions & 1 deletion client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ bincode = "1.2.1"
bs58 = "0.3.0"
jsonrpc-core = "14.0.5"
log = "0.4.8"
rand = "0.6.5"
rayon = "1.2.0"
reqwest = { version = "0.10.1", default-features = false, features = ["blocking", "rustls-tls"] }
serde = "1.0.104"
Expand Down
4 changes: 0 additions & 4 deletions core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ bs58 = "0.3.0"
byteorder = "1.3.2"
chrono = { version = "0.4.10", features = ["serde"] }
core_affinity = "0.5.10"
crc = { version = "1.8.1", optional = true }
crossbeam-channel = "0.3"
fs_extra = "1.1.0"
indexmap = "1.3"
Expand All @@ -31,7 +30,6 @@ jsonrpc-pubsub = "14.0.5"
jsonrpc-ws-server = "14.0.5"
libc = "0.2.66"
log = "0.4.8"
memmap = { version = "0.7.0", optional = true }
nix = "0.17.0"
num-traits = "0.2"
rand = "0.6.5"
Expand Down Expand Up @@ -60,15 +58,13 @@ solana-storage-program = { path = "../programs/storage", version = "0.24.0" }
solana-vote-program = { path = "../programs/vote", version = "0.24.0" }
solana-vote-signer = { path = "../vote-signer", version = "0.24.0" }
solana-sys-tuner = { path = "../sys-tuner", version = "0.24.0" }
symlink = "0.1.0"
sys-info = "0.5.9"
tempfile = "3.1.0"
thiserror = "1.0"
tokio = "0.1"
tokio-codec = "0.1"
tokio-fs = "0.1"
tokio-io = "0.1"
untrusted = "0.7.0"
solana-rayon-threadlimit = { path = "../rayon-threadlimit", version = "0.24.0" }
reed-solomon-erasure = { package = "solana-reed-solomon-erasure", version = "4.0.1-3", features = ["simd-accel"] }
trees = "0.2.1"
Expand Down
5 changes: 1 addition & 4 deletions core/src/banking_stage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -660,10 +660,7 @@ impl BankingStage {
transactions
.into_iter()
.zip(indexes)
.filter_map(|(tx, index)| match tx {
None => None,
Some(tx) => Some((tx, index)),
})
.filter_map(|(tx, index)| tx.map(|tx| (tx, index)))
.unzip()
}

Expand Down
68 changes: 36 additions & 32 deletions core/src/cluster_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -402,8 +402,7 @@ impl ClusterInfo {
.table
.values()
.filter_map(|x| x.value.contact_info())
.filter(|x| x.id != me.id)
.filter(|x| ContactInfo::is_valid_address(&x.rpc))
.filter(|x| x.id != me.id && ContactInfo::is_valid_address(&x.rpc))
.cloned()
.collect()
}
Expand All @@ -429,10 +428,8 @@ impl ClusterInfo {
.table
.values()
.filter_map(|x| x.value.contact_info())
.filter(|x| x.id != me)
/* shred_version not considered for gossip peers (ie, spy nodes do not set
shred_version) */
.filter(|x| ContactInfo::is_valid_address(&x.gossip))
// shred_version not considered for gossip peers (ie, spy nodes do not set shred_version)
.filter(|x| x.id != me && ContactInfo::is_valid_address(&x.gossip))
.cloned()
.collect()
}
Expand All @@ -445,9 +442,11 @@ impl ClusterInfo {
.table
.values()
.filter_map(|x| x.value.contact_info())
.filter(|x| ContactInfo::is_valid_address(&x.tvu))
.filter(|x| !ClusterInfo::is_archiver(x))
.filter(|x| x.id != me.id)
.filter(|x| {
ContactInfo::is_valid_address(&x.tvu)
&& !ClusterInfo::is_archiver(x)
&& x.id != me.id
})
.cloned()
.collect()
}
Expand All @@ -460,10 +459,12 @@ impl ClusterInfo {
.table
.values()
.filter_map(|x| x.value.contact_info())
.filter(|x| ContactInfo::is_valid_address(&x.tvu))
.filter(|x| !ClusterInfo::is_archiver(x))
.filter(|x| x.id != me.id)
.filter(|x| x.shred_version == me.shred_version)
.filter(|x| {
ContactInfo::is_valid_address(&x.tvu)
&& !ClusterInfo::is_archiver(x)
&& x.id != me.id
&& x.shred_version == me.shred_version
})
.cloned()
.collect()
}
Expand All @@ -476,8 +477,7 @@ impl ClusterInfo {
.table
.values()
.filter_map(|x| x.value.contact_info())
.filter(|x| ContactInfo::is_valid_address(&x.storage_addr))
.filter(|x| x.id != me.id)
.filter(|x| ContactInfo::is_valid_address(&x.storage_addr) && x.id != me.id)
.cloned()
.collect()
}
Expand All @@ -490,9 +490,11 @@ impl ClusterInfo {
.table
.values()
.filter_map(|x| x.value.contact_info())
.filter(|x| ContactInfo::is_valid_address(&x.storage_addr))
.filter(|x| x.id != me.id)
.filter(|x| x.shred_version == me.shred_version)
.filter(|x| {
ContactInfo::is_valid_address(&x.storage_addr)
&& x.id != me.id
&& x.shred_version == me.shred_version
})
.cloned()
.collect()
}
Expand All @@ -505,10 +507,12 @@ impl ClusterInfo {
.table
.values()
.filter_map(|x| x.value.contact_info())
.filter(|x| x.id != me.id)
.filter(|x| x.shred_version == me.shred_version)
.filter(|x| ContactInfo::is_valid_address(&x.tvu))
.filter(|x| ContactInfo::is_valid_address(&x.tvu_forwards))
.filter(|x| {
x.id != me.id
&& x.shred_version == me.shred_version
&& ContactInfo::is_valid_address(&x.tvu)
&& ContactInfo::is_valid_address(&x.tvu_forwards)
})
.cloned()
.collect()
}
Expand All @@ -518,13 +522,15 @@ impl ClusterInfo {
let me = self.my_data();
ClusterInfo::tvu_peers(self)
.into_iter()
.filter(|x| x.id != me.id)
.filter(|x| x.shred_version == me.shred_version)
.filter(|x| ContactInfo::is_valid_address(&x.gossip))
.filter(|x| {
self.get_epoch_state_for_node(&x.id, None)
.map(|(epoch_slots, _)| epoch_slots.lowest <= slot)
.unwrap_or_else(|| /* fallback to legacy behavior */ true)
x.id != me.id
&& x.shred_version == me.shred_version
&& ContactInfo::is_valid_address(&x.gossip)
&& {
self.get_epoch_state_for_node(&x.id, None)
.map(|(epoch_slots, _)| epoch_slots.lowest <= slot)
.unwrap_or_else(|| /* fallback to legacy behavior */ true)
}
})
.collect()
}
Expand Down Expand Up @@ -621,8 +627,7 @@ impl ClusterInfo {
.table
.values()
.filter_map(|x| x.value.contact_info())
.filter(|x| x.id != me)
.filter(|x| ContactInfo::is_valid_address(&x.tpu))
.filter(|x| x.id != me && ContactInfo::is_valid_address(&x.tpu))
.cloned()
.collect()
}
Expand Down Expand Up @@ -984,12 +989,11 @@ impl ClusterInfo {
.and_then(CrdsValue::contact_info)
.map(|p| (p.gossip, messages))
})
.map(|(peer, msgs)| {
.flat_map(|(peer, msgs)| {
Self::split_gossip_messages(msgs)
.into_iter()
.map(move |payload| (peer, Protocol::PushMessage(self_id, payload)))
})
.flatten()
.collect()
}

Expand Down
10 changes: 2 additions & 8 deletions core/src/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,7 @@ impl JsonRpcRequestProcessor {
commitment: Option<CommitmentConfig>,
) -> RpcResponse<Option<RpcAccount>> {
let bank = &*self.bank(commitment);
match pubkey {
Ok(key) => new_response(bank, bank.get_account(&key).map(RpcAccount::encode)),
Err(e) => Err(e),
}
pubkey.and_then(|key| new_response(bank, bank.get_account(&key).map(RpcAccount::encode)))
}

pub fn get_minimum_balance_for_rent_exemption(
Expand Down Expand Up @@ -148,10 +145,7 @@ impl JsonRpcRequestProcessor {
commitment: Option<CommitmentConfig>,
) -> RpcResponse<u64> {
let bank = &*self.bank(commitment);
match pubkey {
Ok(key) => new_response(bank, bank.get_balance(&key)),
Err(e) => Err(e),
}
pubkey.and_then(|key| new_response(bank, bank.get_balance(&key)))
}

fn get_recent_blockhash(
Expand Down
2 changes: 0 additions & 2 deletions genesis/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ homepage = "https://solana.com/"
base64 = "0.11.0"
clap = "2.33.0"
chrono = "0.4"
hex = "0.4.0"
serde = "1.0.104"
serde_derive = "1.0.103"
serde_json = "1.0.46"
serde_yaml = "0.8.11"
solana-clap-utils = { path = "../clap-utils", version = "0.24.0" }
Expand Down
2 changes: 0 additions & 2 deletions install/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ homepage = "https://solana.com/"
[dependencies]
atty = "0.2.11"
bincode = "1.2.1"
bs58 = "0.3.0"
bzip2 = "0.3.3"
chrono = { version = "0.4.10", features = ["serde"] }
clap = { version = "2.33.0" }
Expand All @@ -20,7 +19,6 @@ ctrlc = { version = "3.1.3", features = ["termination"] }
dirs = "2.0.2"
indicatif = "0.14.0"
lazy_static = "1.4.0"
log = "0.4.8"
nix = "0.17.0"
reqwest = { version = "0.10.1", default-features = false, features = ["blocking", "rustls-tls"] }
serde = "1.0.104"
Expand Down
1 change: 0 additions & 1 deletion keygen/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ bs58 = "0.3.0"
clap = "2.33"
dirs = "2.0.2"
num_cpus = "1.12.0"
rpassword = "4.0"
solana-clap-utils = { path = "../clap-utils", version = "0.24.0" }
solana-cli-config = { path = "../cli-config", version = "0.24.0" }
solana-sdk = { path = "../sdk", version = "0.24.0" }
Expand Down
3 changes: 0 additions & 3 deletions ledger-tool/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,8 @@ license = "Apache-2.0"
homepage = "https://solana.com/"

[dependencies]
bincode = "1.2.1"
clap = "2.33.0"
histogram = "*"
serde = "1.0.104"
serde_derive = "1.0.103"
serde_json = "1.0.46"
serde_yaml = "0.8.11"
solana-clap-utils = { path = "../clap-utils", version = "0.24.0" }
Expand Down
3 changes: 0 additions & 3 deletions ledger/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ bzip2 = "0.3.3"
chrono = { version = "0.4.10", features = ["serde"] }
crossbeam-channel = "0.3"
dir-diff = "0.3.2"
dlopen = "0.1.8"
dlopen_derive = "0.1.4"
sha2 = "0.8.1"
fs_extra = "1.1.0"
itertools = "0.8.2"
Expand All @@ -28,7 +26,6 @@ rayon = "1.2.0"
reed-solomon-erasure = { package = "solana-reed-solomon-erasure", version = "4.0.1-3", features = ["simd-accel"] }
serde = "1.0.104"
serde_bytes = "0.11.3"
serde_derive = "1.0.103"
solana-client = { path = "../client", version = "0.24.0" }
solana-genesis-programs = { path = "../genesis-programs", version = "0.24.0" }
solana-logger = { path = "../logger", version = "0.24.0" }
Expand Down
7 changes: 2 additions & 5 deletions ledger/src/leader_schedule_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,11 +193,8 @@ impl LeaderScheduleCache {
cache_result
} else {
let (epoch, slot_index) = bank.get_epoch_and_slot_index(slot);
if let Some(epoch_schedule) = self.compute_epoch_schedule(epoch, bank) {
Some(epoch_schedule[slot_index])
} else {
None
}
self.compute_epoch_schedule(epoch, bank)
.map(|epoch_schedule| epoch_schedule[slot_index])
}
}

Expand Down
1 change: 0 additions & 1 deletion local-cluster/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ solana-stake-program = { path = "../programs/stake", version = "0.24.0" }
solana-storage-program = { path = "../programs/storage", version = "0.24.0" }
solana-vest-program = { path = "../programs/vest", version = "0.24.0" }
solana-vote-program = { path = "../programs/vote", version = "0.24.0" }
symlink = "0.1.0"
tempfile = "3.1.0"
solana-rayon-threadlimit = { path = "../rayon-threadlimit", version = "0.24.0" }

Expand Down
3 changes: 0 additions & 3 deletions log-analyzer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,7 @@ publish = false
[dependencies]
byte-unit = "3.0.3"
clap = "2.33.0"
log = "0.4.8"
semver = "0.9.0"
serde = "1.0.104"
serde_derive = "1.0.103"
serde_json = "1.0.46"
solana-clap-utils = { path = "../clap-utils", version = "0.24.0" }
solana-logger = { path = "../logger", version = "0.24.0" }
Expand Down
3 changes: 0 additions & 3 deletions net-shaper/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@ publish = false

[dependencies]
clap = "2.33.0"
log = "0.4.8"
semver = "0.9.0"
serde = "1.0.104"
serde_derive = "1.0.103"
serde_json = "1.0.46"
solana-clap-utils = { path = "../clap-utils", version = "0.24.0" }
solana-logger = { path = "../logger", version = "0.24.0" }
Expand Down
Loading

0 comments on commit f016c9a

Please sign in to comment.