diff --git a/Cargo.lock b/Cargo.lock index 4377a009ef..2e0229d18c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1778,6 +1778,7 @@ dependencies = [ "clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)", "solana 0.11.0", "solana-logger 0.11.0", + "solana-netutil 0.11.0", ] [[package]] diff --git a/bench-tps/src/cli.rs b/bench-tps/src/cli.rs index 083c647556..23c87d6246 100644 --- a/bench-tps/src/cli.rs +++ b/bench-tps/src/cli.rs @@ -2,7 +2,7 @@ use std::net::SocketAddr; use std::process::exit; use std::time::Duration; -use clap::{App, Arg, ArgMatches}; +use clap::{crate_version, App, Arg, ArgMatches}; use solana_drone::drone::DRONE_PORT; use solana_sdk::signature::{read_keypair, Keypair, KeypairUtil}; diff --git a/bench-tps/src/main.rs b/bench-tps/src/main.rs index f5a3d61c4c..eb3be6de0b 100644 --- a/bench-tps/src/main.rs +++ b/bench-tps/src/main.rs @@ -1,9 +1,3 @@ -#[macro_use] -extern crate clap; - -extern crate solana; -extern crate solana_sdk; - mod bench; mod cli; diff --git a/drone/Cargo.toml b/drone/Cargo.toml index 78d0c674ad..fbba13a6df 100644 --- a/drone/Cargo.toml +++ b/drone/Cargo.toml @@ -6,6 +6,7 @@ authors = ["Solana Maintainers "] repository = "https://github.com/solana-labs/solana" license = "Apache-2.0" homepage = "https://solana.com/" +edition = "2018" [features] cuda = [] diff --git a/drone/src/bin/drone.rs b/drone/src/bin/drone.rs index e866df4f93..16047087fc 100644 --- a/drone/src/bin/drone.rs +++ b/drone/src/bin/drone.rs @@ -1,19 +1,8 @@ -extern crate byteorder; -extern crate bytes; -#[macro_use] -extern crate clap; -extern crate log; -#[macro_use] -extern crate solana_drone; -extern crate solana_metrics; -extern crate solana_sdk; -extern crate tokio; -extern crate tokio_codec; - use byteorder::{ByteOrder, LittleEndian}; use bytes::Bytes; -use clap::{App, Arg}; +use clap::{crate_version, App, Arg}; use solana_drone::drone::{Drone, DroneRequest, DRONE_PORT}; +use solana_drone::socketaddr; use solana_sdk::signature::read_keypair; use std::error; use std::io; @@ -25,7 +14,6 @@ use tokio::prelude::*; use tokio_codec::{BytesCodec, Decoder}; fn main() -> Result<(), Box> { - //logger::setup(); solana_metrics::set_panic_hook("drone"); let matches = App::new("drone") .version(crate_version!()) diff --git a/drone/src/drone.rs b/drone/src/drone.rs index 9d9decbddd..e9bc6837a4 100644 --- a/drone/src/drone.rs +++ b/drone/src/drone.rs @@ -7,6 +7,8 @@ use bincode::{deserialize, serialize}; use byteorder::{ByteOrder, LittleEndian}; use bytes::Bytes; +use log::*; +use serde_derive::{Deserialize, Serialize}; use solana_metrics; use solana_metrics::influxdb; use solana_sdk::hash::Hash; diff --git a/drone/src/lib.rs b/drone/src/lib.rs index 5973e7534b..a1f51391b8 100644 --- a/drone/src/lib.rs +++ b/drone/src/lib.rs @@ -1,14 +1 @@ pub mod drone; - -extern crate bincode; -extern crate byteorder; -extern crate bytes; -#[macro_use] -extern crate log; -extern crate serde; -#[macro_use] -extern crate serde_derive; -extern crate solana_metrics; -extern crate solana_sdk; -extern crate tokio; -extern crate tokio_codec; diff --git a/genesis/src/main.rs b/genesis/src/main.rs index 74e49bca9b..ae5c216142 100644 --- a/genesis/src/main.rs +++ b/genesis/src/main.rs @@ -1,10 +1,7 @@ //! A command-line executable for generating the chain's genesis block. -#[macro_use] -extern crate clap; +use clap::{crate_version, value_t_or_exit, App, Arg}; use serde_json; - -use clap::{App, Arg}; use solana::db_ledger::genesis; use solana::ledger::LedgerWriter; use solana::mint::Mint; diff --git a/keygen/Cargo.toml b/keygen/Cargo.toml index 147177dfc7..c644ac2d02 100644 --- a/keygen/Cargo.toml +++ b/keygen/Cargo.toml @@ -6,6 +6,7 @@ authors = ["Solana Maintainers "] repository = "https://github.com/solana-labs/solana" license = "Apache-2.0" homepage = "https://solana.com/" +edition = "2018" [features] cuda = [] diff --git a/keygen/src/keygen.rs b/keygen/src/keygen.rs index 4ef8d95bd3..fe4382eb9d 100644 --- a/keygen/src/keygen.rs +++ b/keygen/src/keygen.rs @@ -1,9 +1,4 @@ -#[macro_use] -extern crate clap; -extern crate dirs; -extern crate solana_sdk; - -use clap::{App, Arg}; +use clap::{crate_version, App, Arg}; use solana_sdk::signature::gen_keypair_file; use std::error; diff --git a/ledger-tool/src/main.rs b/ledger-tool/src/main.rs index 4425b42648..a87ca2356c 100644 --- a/ledger-tool/src/main.rs +++ b/ledger-tool/src/main.rs @@ -1,11 +1,6 @@ -#[macro_use] -extern crate clap; -use serde_json; - -use clap::{App, Arg, SubCommand}; +use clap::{crate_version, App, Arg, SubCommand}; use solana::bank::Bank; use solana::ledger::{read_ledger, verify_ledger}; - use std::io::{stdout, Write}; use std::process::exit; diff --git a/metrics/Cargo.toml b/metrics/Cargo.toml index c55d0e21d0..df0e216214 100644 --- a/metrics/Cargo.toml +++ b/metrics/Cargo.toml @@ -6,6 +6,7 @@ authors = ["Solana Maintainers "] repository = "https://github.com/solana-labs/solana" license = "Apache-2.0" homepage = "https://solana.com/" +edition = "2018" [dependencies] influx_db_client = "0.3.6" diff --git a/metrics/src/lib.rs b/metrics/src/lib.rs index c70c858804..e254d897da 100644 --- a/metrics/src/lib.rs +++ b/metrics/src/lib.rs @@ -1,16 +1,7 @@ -pub extern crate influx_db_client; -#[macro_use] -extern crate lazy_static; -extern crate reqwest; -#[macro_use] -extern crate log; -extern crate solana_sdk; -extern crate sys_info; - mod metrics; -pub use metrics::flush; -pub use metrics::query; -pub use metrics::set_panic_hook; -pub use metrics::submit; +pub use crate::metrics::flush; +pub use crate::metrics::query; +pub use crate::metrics::set_panic_hook; +pub use crate::metrics::submit; pub use influx_db_client as influxdb; diff --git a/metrics/src/metrics.rs b/metrics/src/metrics.rs index 0c49ea82cc..9b3a2e9cad 100644 --- a/metrics/src/metrics.rs +++ b/metrics/src/metrics.rs @@ -1,8 +1,8 @@ //! The `metrics` module enables sending measurements to an InfluxDB instance -extern crate reqwest; - use influx_db_client as influxdb; +use lazy_static::lazy_static; +use log::*; use solana_sdk::hash::hash; use solana_sdk::timing; use std::env; @@ -267,8 +267,6 @@ pub fn set_panic_hook(program: &'static str) { #[cfg(test)] mod test { - extern crate rand; - use super::*; use std::sync::atomic::{AtomicUsize, Ordering}; diff --git a/programs/native/bpf_loader/Cargo.toml b/programs/native/bpf_loader/Cargo.toml index eee9bd973e..edc12f9ab1 100644 --- a/programs/native/bpf_loader/Cargo.toml +++ b/programs/native/bpf_loader/Cargo.toml @@ -6,6 +6,7 @@ authors = ["Solana Maintainers "] repository = "https://github.com/solana-labs/solana" license = "Apache-2.0" homepage = "https://solana.com/" +edition = "2018" [features] bpf_c = [] diff --git a/programs/native/bpf_loader/src/lib.rs b/programs/native/bpf_loader/src/lib.rs index 610c3f4566..48c582f593 100644 --- a/programs/native/bpf_loader/src/lib.rs +++ b/programs/native/bpf_loader/src/lib.rs @@ -1,20 +1,14 @@ pub mod bpf_verifier; -extern crate byteorder; -#[macro_use] -extern crate log; -extern crate libc; -extern crate solana_rbpf; -#[macro_use] -extern crate solana_sdk; - use byteorder::{ByteOrder, LittleEndian, WriteBytesExt}; use libc::c_char; +use log::*; use solana_rbpf::EbpfVmRaw; use solana_sdk::account::KeyedAccount; use solana_sdk::loader_instruction::LoaderInstruction; use solana_sdk::native_program::ProgramError; use solana_sdk::pubkey::Pubkey; +use solana_sdk::solana_entrypoint; use std::ffi::CStr; use std::io::prelude::*; use std::io::{Error, ErrorKind}; diff --git a/programs/native/budget/Cargo.toml b/programs/native/budget/Cargo.toml index cafa5d47fa..4a5ddc1beb 100644 --- a/programs/native/budget/Cargo.toml +++ b/programs/native/budget/Cargo.toml @@ -6,6 +6,7 @@ authors = ["Solana Maintainers "] repository = "https://github.com/solana-labs/solana" license = "Apache-2.0" homepage = "https://solana.com/" +edition = "2018" [dependencies] bincode = "1.0.0" diff --git a/programs/native/budget/src/budget_program.rs b/programs/native/budget/src/budget_program.rs index a0e78f392b..3789338c54 100644 --- a/programs/native/budget/src/budget_program.rs +++ b/programs/native/budget/src/budget_program.rs @@ -1,6 +1,8 @@ //! budget program use bincode::{self, deserialize, serialize_into, serialized_size}; use chrono::prelude::{DateTime, Utc}; +use log::*; +use serde_derive::{Deserialize, Serialize}; use solana_sdk::account::KeyedAccount; use solana_sdk::budget_expr::BudgetExpr; use solana_sdk::budget_instruction::Instruction; diff --git a/programs/native/budget/src/lib.rs b/programs/native/budget/src/lib.rs index 3d1622c627..294ec5b79f 100644 --- a/programs/native/budget/src/lib.rs +++ b/programs/native/budget/src/lib.rs @@ -1,19 +1,11 @@ -extern crate bincode; -extern crate chrono; -#[macro_use] -extern crate log; -#[macro_use] -extern crate serde_derive; -#[macro_use] -extern crate solana_sdk; - mod budget_program; +use crate::budget_program::process_instruction; +use log::*; use solana_sdk::account::KeyedAccount; use solana_sdk::native_program::ProgramError; use solana_sdk::pubkey::Pubkey; - -use budget_program::process_instruction; +use solana_sdk::solana_entrypoint; solana_entrypoint!(entrypoint); fn entrypoint( diff --git a/programs/native/erc20/Cargo.toml b/programs/native/erc20/Cargo.toml index e1fbcfc293..daa51fad99 100644 --- a/programs/native/erc20/Cargo.toml +++ b/programs/native/erc20/Cargo.toml @@ -6,6 +6,7 @@ authors = ["Solana Maintainers "] repository = "https://github.com/solana-labs/solana" license = "Apache-2.0" homepage = "https://solana.com/" +edition = "2018" [dependencies] bincode = "1.0.0" diff --git a/programs/native/erc20/src/lib.rs b/programs/native/erc20/src/lib.rs index c82e0571c8..84fdf79b0c 100644 --- a/programs/native/erc20/src/lib.rs +++ b/programs/native/erc20/src/lib.rs @@ -1,17 +1,10 @@ //! The `erc20` library implements a generic erc20-like token -extern crate bincode; -#[macro_use] -extern crate log; -extern crate serde; -#[macro_use] -extern crate serde_derive; -#[macro_use] -extern crate solana_sdk; - +use log::*; use solana_sdk::account::KeyedAccount; use solana_sdk::native_program::ProgramError; use solana_sdk::pubkey::Pubkey; +use solana_sdk::solana_entrypoint; mod token_program; diff --git a/programs/native/erc20/src/token_program.rs b/programs/native/erc20/src/token_program.rs index 1d54dd63aa..f01bc05191 100644 --- a/programs/native/erc20/src/token_program.rs +++ b/programs/native/erc20/src/token_program.rs @@ -1,7 +1,8 @@ //! ERC20-like Token use bincode; - +use log::*; +use serde_derive::{Deserialize, Serialize}; use solana_sdk::account::KeyedAccount; use solana_sdk::pubkey::Pubkey; use std; diff --git a/programs/native/lua_loader/Cargo.toml b/programs/native/lua_loader/Cargo.toml index f3b91d8592..778e8fc8d9 100644 --- a/programs/native/lua_loader/Cargo.toml +++ b/programs/native/lua_loader/Cargo.toml @@ -6,6 +6,7 @@ authors = ["Solana Maintainers "] repository = "https://github.com/solana-labs/solana" license = "Apache-2.0" homepage = "https://solana.com/" +edition = "2018" [dependencies] bincode = "1.0.0" diff --git a/programs/native/lua_loader/src/lib.rs b/programs/native/lua_loader/src/lib.rs index eeb53ccb77..dfd63da486 100644 --- a/programs/native/lua_loader/src/lib.rs +++ b/programs/native/lua_loader/src/lib.rs @@ -1,14 +1,10 @@ -#[macro_use] -extern crate log; -extern crate rlua; -#[macro_use] -extern crate solana_sdk; - +use log::*; use rlua::{Lua, Table}; use solana_sdk::account::KeyedAccount; use solana_sdk::loader_instruction::LoaderInstruction; use solana_sdk::native_program::ProgramError; use solana_sdk::pubkey::Pubkey; +use solana_sdk::solana_entrypoint; use std::str; /// Make KeyAccount values available to Lua. @@ -116,10 +112,8 @@ fn entrypoint( #[cfg(test)] mod tests { - extern crate bincode; - - use self::bincode::serialize; use super::*; + use bincode::serialize; use solana_sdk::account::{create_keyed_accounts, Account}; use solana_sdk::pubkey::Pubkey; use std::fs::File; diff --git a/programs/native/native_loader/Cargo.toml b/programs/native/native_loader/Cargo.toml index a704556368..d7c14ff935 100644 --- a/programs/native/native_loader/Cargo.toml +++ b/programs/native/native_loader/Cargo.toml @@ -6,6 +6,7 @@ authors = ["Solana Maintainers "] repository = "https://github.com/solana-labs/solana" license = "Apache-2.0" homepage = "https://solana.com/" +edition = "2018" [dependencies] bincode = "1.0.0" diff --git a/programs/native/native_loader/src/lib.rs b/programs/native/native_loader/src/lib.rs index 532ff40ed2..4fbd6c68eb 100644 --- a/programs/native/native_loader/src/lib.rs +++ b/programs/native/native_loader/src/lib.rs @@ -1,16 +1,10 @@ //! Native loader -extern crate bincode; -extern crate libc; -extern crate libloading; -#[macro_use] -extern crate log; -extern crate solana_sdk; - use bincode::deserialize; #[cfg(unix)] use libloading::os::unix::*; #[cfg(windows)] use libloading::os::windows::*; +use log::*; use solana_sdk::account::KeyedAccount; use solana_sdk::loader_instruction::LoaderInstruction; pub use solana_sdk::native_loader::*; diff --git a/programs/native/noop/Cargo.toml b/programs/native/noop/Cargo.toml index 9fb55a766e..1d55e86fc7 100644 --- a/programs/native/noop/Cargo.toml +++ b/programs/native/noop/Cargo.toml @@ -6,6 +6,7 @@ authors = ["Solana Maintainers "] repository = "https://github.com/solana-labs/solana" license = "Apache-2.0" homepage = "https://solana.com/" +edition = "2018" [dependencies] solana-sdk = { path = "../../../sdk", version = "0.11.0" } diff --git a/programs/native/noop/src/lib.rs b/programs/native/noop/src/lib.rs index 238ca6f013..7d193ad7c6 100644 --- a/programs/native/noop/src/lib.rs +++ b/programs/native/noop/src/lib.rs @@ -1,9 +1,7 @@ -#[macro_use] -extern crate solana_sdk; - use solana_sdk::account::KeyedAccount; use solana_sdk::native_program::ProgramError; use solana_sdk::pubkey::Pubkey; +use solana_sdk::solana_entrypoint; solana_entrypoint!(entrypoint); fn entrypoint( diff --git a/programs/native/storage/Cargo.toml b/programs/native/storage/Cargo.toml index 6147623f4a..f86628f220 100644 --- a/programs/native/storage/Cargo.toml +++ b/programs/native/storage/Cargo.toml @@ -6,6 +6,7 @@ authors = ["Solana Maintainers "] repository = "https://github.com/solana-labs/solana" license = "Apache-2.0" homepage = "https://solana.com/" +edition = "2018" [dependencies] bincode = "1.0.0" diff --git a/programs/native/storage/src/lib.rs b/programs/native/storage/src/lib.rs index ddc2ec205d..a449a2d17c 100644 --- a/programs/native/storage/src/lib.rs +++ b/programs/native/storage/src/lib.rs @@ -2,14 +2,11 @@ //! Receive mining proofs from miners, validate the answers //! and give reward for good proofs. -#[macro_use] -extern crate log; -#[macro_use] -extern crate solana_sdk; - +use log::*; use solana_sdk::account::KeyedAccount; use solana_sdk::native_program::ProgramError; use solana_sdk::pubkey::Pubkey; +use solana_sdk::solana_entrypoint; use solana_sdk::storage_program::*; solana_entrypoint!(entrypoint); diff --git a/programs/native/system/Cargo.toml b/programs/native/system/Cargo.toml index fde284cde5..311908cd18 100644 --- a/programs/native/system/Cargo.toml +++ b/programs/native/system/Cargo.toml @@ -6,6 +6,7 @@ authors = ["Solana Maintainers "] repository = "https://github.com/solana-labs/solana" license = "Apache-2.0" homepage = "https://solana.com/" +edition = "2018" [dependencies] bincode = "1.0.0" diff --git a/programs/native/system/src/lib.rs b/programs/native/system/src/lib.rs index 86ee74dbb1..e91a3de51d 100644 --- a/programs/native/system/src/lib.rs +++ b/programs/native/system/src/lib.rs @@ -1,11 +1,8 @@ -#[macro_use] -extern crate log; -#[macro_use] -extern crate solana_sdk; - +use log::*; use solana_sdk::account::KeyedAccount; use solana_sdk::native_program::ProgramError; use solana_sdk::pubkey::Pubkey; +use solana_sdk::solana_entrypoint; use solana_sdk::system_instruction::SystemInstruction; use solana_sdk::system_program; diff --git a/programs/native/vote/Cargo.toml b/programs/native/vote/Cargo.toml index c6a5028b9a..4825f53c29 100644 --- a/programs/native/vote/Cargo.toml +++ b/programs/native/vote/Cargo.toml @@ -6,6 +6,7 @@ authors = ["Solana Maintainers "] repository = "https://github.com/solana-labs/solana" license = "Apache-2.0" homepage = "https://solana.com/" +edition = "2018" [dependencies] bincode = "1.0.0" diff --git a/programs/native/vote/src/lib.rs b/programs/native/vote/src/lib.rs index d267ef751a..3c7cfd6765 100644 --- a/programs/native/vote/src/lib.rs +++ b/programs/native/vote/src/lib.rs @@ -1,14 +1,11 @@ //! Vote program //! Receive and processes votes from validators -#[macro_use] -extern crate log; -#[macro_use] -extern crate solana_sdk; - +use log::*; use solana_sdk::account::KeyedAccount; use solana_sdk::native_program::ProgramError; use solana_sdk::pubkey::Pubkey; +use solana_sdk::solana_entrypoint; use solana_sdk::vote_program::*; use std::collections::VecDeque; @@ -39,7 +36,7 @@ fn entrypoint( // TODO: a single validator could register multiple "vote accounts" // which would clutter the "accounts" structure. See github issue 1654. - let mut vote_state = VoteProgram { + let vote_state = VoteProgram { votes: VecDeque::new(), node_id: *keyed_accounts[0].signer_key().unwrap(), }; diff --git a/sdk/Cargo.toml b/sdk/Cargo.toml index d50184e479..e2b1615914 100644 --- a/sdk/Cargo.toml +++ b/sdk/Cargo.toml @@ -6,6 +6,7 @@ authors = ["Solana Maintainers "] repository = "https://github.com/solana-labs/solana" homepage = "https://solana.com/" license = "Apache-2.0" +edition = "2018" [dependencies] bincode = "1.0.0" diff --git a/sdk/src/account.rs b/sdk/src/account.rs index c282f316a7..e2c4192a40 100644 --- a/sdk/src/account.rs +++ b/sdk/src/account.rs @@ -1,4 +1,4 @@ -use pubkey::Pubkey; +use crate::pubkey::Pubkey; /// An Account with userdata that is stored on chain #[repr(C)] diff --git a/sdk/src/bpf_loader.rs b/sdk/src/bpf_loader.rs index c26157e24c..c98e926cf9 100644 --- a/sdk/src/bpf_loader.rs +++ b/sdk/src/bpf_loader.rs @@ -1,4 +1,4 @@ -use pubkey::Pubkey; +use crate::pubkey::Pubkey; pub const BPF_LOADER_PROGRAM_ID: [u8; 32] = [ 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, diff --git a/sdk/src/budget_expr.rs b/sdk/src/budget_expr.rs index 8c2cfad5e4..37c6d513d6 100644 --- a/sdk/src/budget_expr.rs +++ b/sdk/src/budget_expr.rs @@ -3,9 +3,9 @@ //! which it uses to reduce the payment plan. When the budget is reduced to a //! `Payment`, the payment is executed. +use crate::payment_plan::{Payment, Witness}; +use crate::pubkey::Pubkey; use chrono::prelude::*; -use payment_plan::{Payment, Witness}; -use pubkey::Pubkey; use std::mem; /// A data type representing a `Witness` that the payment plan is waiting on. @@ -141,7 +141,7 @@ impl BudgetExpr { #[cfg(test)] mod tests { use super::*; - use signature::{Keypair, KeypairUtil}; + use crate::signature::{Keypair, KeypairUtil}; #[test] fn test_signature_satisfied() { diff --git a/sdk/src/budget_instruction.rs b/sdk/src/budget_instruction.rs index 78ca94e2ac..3a6ea29971 100644 --- a/sdk/src/budget_instruction.rs +++ b/sdk/src/budget_instruction.rs @@ -1,4 +1,4 @@ -use budget_expr::BudgetExpr; +use crate::budget_expr::BudgetExpr; use chrono::prelude::{DateTime, Utc}; /// A smart contract. diff --git a/sdk/src/budget_program.rs b/sdk/src/budget_program.rs index 6854b482e3..9d35232d64 100644 --- a/sdk/src/budget_program.rs +++ b/sdk/src/budget_program.rs @@ -1,4 +1,4 @@ -use pubkey::Pubkey; +use crate::pubkey::Pubkey; pub const BUDGET_PROGRAM_ID: [u8; 32] = [ 129, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, diff --git a/sdk/src/budget_transaction.rs b/sdk/src/budget_transaction.rs index fa4c1873f1..9d7d36ce99 100644 --- a/sdk/src/budget_transaction.rs +++ b/sdk/src/budget_transaction.rs @@ -1,17 +1,17 @@ //! The `budget_transaction` module provides functionality for creating Budget transactions. +use crate::budget_expr::{BudgetExpr, Condition}; +use crate::budget_instruction::Instruction; +use crate::budget_program; +use crate::hash::Hash; +use crate::payment_plan::Payment; +use crate::pubkey::Pubkey; +use crate::signature::{Keypair, KeypairUtil}; +use crate::system_instruction::SystemInstruction; +use crate::system_program; +use crate::transaction::{self, Transaction}; use bincode::deserialize; -use budget_expr::{BudgetExpr, Condition}; -use budget_instruction::Instruction; -use budget_program; use chrono::prelude::*; -use hash::Hash; -use payment_plan::Payment; -use pubkey::Pubkey; -use signature::{Keypair, KeypairUtil}; -use system_instruction::SystemInstruction; -use system_program; -use transaction::{self, Transaction}; pub trait BudgetTransaction { fn budget_new_taxed( diff --git a/sdk/src/lib.rs b/sdk/src/lib.rs index e674a02e83..d6c67b6975 100644 --- a/sdk/src/lib.rs +++ b/sdk/src/lib.rs @@ -23,16 +23,5 @@ pub mod transaction; pub mod vote_program; pub mod vote_transaction; -extern crate bincode; -extern crate bs58; -extern crate byteorder; -extern crate chrono; -extern crate generic_array; -extern crate log; -extern crate ring; -extern crate serde; #[macro_use] extern crate serde_derive; -extern crate serde_json; -extern crate sha2; -extern crate untrusted; diff --git a/sdk/src/loader_transaction.rs b/sdk/src/loader_transaction.rs index cbad3831e4..c5ecbc5108 100644 --- a/sdk/src/loader_transaction.rs +++ b/sdk/src/loader_transaction.rs @@ -1,10 +1,10 @@ //! The `loader_transaction` module provides functionality for loading and calling a program -use hash::Hash; -use loader_instruction::LoaderInstruction; -use pubkey::Pubkey; -use signature::Keypair; -use transaction::Transaction; +use crate::hash::Hash; +use crate::loader_instruction::LoaderInstruction; +use crate::pubkey::Pubkey; +use crate::signature::Keypair; +use crate::transaction::Transaction; pub trait LoaderTransaction { fn loader_write( diff --git a/sdk/src/native_loader.rs b/sdk/src/native_loader.rs index a0447568c8..e9ecb55801 100644 --- a/sdk/src/native_loader.rs +++ b/sdk/src/native_loader.rs @@ -1,4 +1,4 @@ -use pubkey::Pubkey; +use crate::pubkey::Pubkey; pub const NATIVE_LOADER_PROGRAM_ID: [u8; 32] = [ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, diff --git a/sdk/src/native_program.rs b/sdk/src/native_program.rs index d662d5b51c..3d72869386 100644 --- a/sdk/src/native_program.rs +++ b/sdk/src/native_program.rs @@ -1,5 +1,5 @@ -use account::KeyedAccount; -use pubkey::Pubkey; +use crate::account::KeyedAccount; +use crate::pubkey::Pubkey; use std; /// Reasons a program might have rejected an instruction. diff --git a/sdk/src/payment_plan.rs b/sdk/src/payment_plan.rs index 08208829a1..7ec04ce6ef 100644 --- a/sdk/src/payment_plan.rs +++ b/sdk/src/payment_plan.rs @@ -3,8 +3,8 @@ //! which it uses to reduce the payment plan. When the plan is reduced to a //! `Payment`, the payment is executed. +use crate::pubkey::Pubkey; use chrono::prelude::*; -use pubkey::Pubkey; /// The types of events a payment plan can process. #[derive(Serialize, Deserialize, Debug, PartialEq, Eq, Clone)] diff --git a/sdk/src/signature.rs b/sdk/src/signature.rs index c9a8c08973..90e0b2b84d 100644 --- a/sdk/src/signature.rs +++ b/sdk/src/signature.rs @@ -1,9 +1,9 @@ //! The `signature` module provides functionality for public, and private keys. +use crate::pubkey::Pubkey; use bs58; use generic_array::typenum::U64; use generic_array::GenericArray; -use pubkey::Pubkey; use ring::signature::Ed25519KeyPair; use ring::{rand, signature}; use serde_json; diff --git a/sdk/src/storage_program.rs b/sdk/src/storage_program.rs index a0efde05d8..69a09af1e3 100644 --- a/sdk/src/storage_program.rs +++ b/sdk/src/storage_program.rs @@ -1,7 +1,7 @@ -use hash::Hash; -use pubkey::Pubkey; -use signature::{Keypair, KeypairUtil}; -use transaction::Transaction; +use crate::hash::Hash; +use crate::pubkey::Pubkey; +use crate::signature::{Keypair, KeypairUtil}; +use crate::transaction::Transaction; #[derive(Serialize, Deserialize, Debug, Clone)] pub enum StorageProgram { diff --git a/sdk/src/system_instruction.rs b/sdk/src/system_instruction.rs index 9a21f04a8d..6e11446cbb 100644 --- a/sdk/src/system_instruction.rs +++ b/sdk/src/system_instruction.rs @@ -1,4 +1,4 @@ -use pubkey::Pubkey; +use crate::pubkey::Pubkey; #[derive(Serialize, Deserialize, Debug, Clone)] pub enum SystemInstruction { diff --git a/sdk/src/system_program.rs b/sdk/src/system_program.rs index 968b2cccd5..6990a16f9d 100644 --- a/sdk/src/system_program.rs +++ b/sdk/src/system_program.rs @@ -1,4 +1,4 @@ -use pubkey::Pubkey; +use crate::pubkey::Pubkey; pub const SYSTEM_PROGRAM_ID: [u8; 32] = [0u8; 32]; diff --git a/sdk/src/system_transaction.rs b/sdk/src/system_transaction.rs index e092c8b915..78c9a9dc14 100644 --- a/sdk/src/system_transaction.rs +++ b/sdk/src/system_transaction.rs @@ -1,11 +1,11 @@ //! The `system_transaction` module provides functionality for creating system transactions. -use hash::Hash; -use pubkey::Pubkey; -use signature::Keypair; -use system_instruction::SystemInstruction; -use system_program; -use transaction::{Instruction, Transaction}; +use crate::hash::Hash; +use crate::pubkey::Pubkey; +use crate::signature::Keypair; +use crate::system_instruction::SystemInstruction; +use crate::system_program; +use crate::transaction::{Instruction, Transaction}; pub trait SystemTransaction { fn system_create( @@ -137,7 +137,7 @@ impl SystemTransaction for Transaction { #[cfg(test)] mod tests { use super::*; - use signature::KeypairUtil; + use crate::signature::KeypairUtil; #[test] fn test_move_many() { diff --git a/sdk/src/token_program.rs b/sdk/src/token_program.rs index c1fdd12ffd..3c5c0acddb 100644 --- a/sdk/src/token_program.rs +++ b/sdk/src/token_program.rs @@ -1,5 +1,5 @@ //! An ERC20-like Token -use pubkey::Pubkey; +use crate::pubkey::Pubkey; const TOKEN_PROGRAM_ID: [u8; 32] = [ 131, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, diff --git a/sdk/src/transaction.rs b/sdk/src/transaction.rs index b950ec9abf..6e4a1f1407 100644 --- a/sdk/src/transaction.rs +++ b/sdk/src/transaction.rs @@ -1,10 +1,10 @@ //! The `transaction` module provides functionality for creating log transactions. +use crate::hash::{Hash, Hasher}; +use crate::pubkey::Pubkey; +use crate::signature::{Keypair, KeypairUtil, Signature}; use bincode::serialize; -use hash::{Hash, Hasher}; -use pubkey::Pubkey; use serde::Serialize; -use signature::{Keypair, KeypairUtil, Signature}; use std::mem::size_of; pub const SIG_OFFSET: usize = size_of::(); diff --git a/sdk/src/vote_program.rs b/sdk/src/vote_program.rs index 6af4b9ffac..18f11e8c8d 100644 --- a/sdk/src/vote_program.rs +++ b/sdk/src/vote_program.rs @@ -1,10 +1,10 @@ //! Vote program //! Receive and processes votes from validators +use crate::native_program::ProgramError; +use crate::pubkey::Pubkey; use bincode::{deserialize, serialize}; use byteorder::{ByteOrder, LittleEndian}; -use native_program::ProgramError; -use pubkey::Pubkey; use std::collections::VecDeque; use std::mem; diff --git a/sdk/src/vote_transaction.rs b/sdk/src/vote_transaction.rs index 9f916303f3..1ea07f2830 100644 --- a/sdk/src/vote_transaction.rs +++ b/sdk/src/vote_transaction.rs @@ -1,13 +1,13 @@ //! The `vote_transaction` module provides functionality for creating vote transactions. +use crate::hash::Hash; +use crate::pubkey::Pubkey; +use crate::signature::Keypair; +use crate::system_instruction::SystemInstruction; +use crate::system_program; +use crate::transaction::{Instruction, Transaction}; +use crate::vote_program::{self, Vote, VoteInstruction}; use bincode::deserialize; -use hash::Hash; -use pubkey::Pubkey; -use signature::Keypair; -use system_instruction::SystemInstruction; -use system_program; -use transaction::{Instruction, Transaction}; -use vote_program::{self, Vote, VoteInstruction}; pub trait VoteTransaction { fn vote_new(vote_account: &Keypair, vote: Vote, last_id: Hash, fee: u64) -> Self; diff --git a/src/lib.rs b/src/lib.rs index 0aca97b5c1..16b592ceb7 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -76,7 +76,6 @@ pub mod window_service; #[cfg(any(feature = "chacha", feature = "cuda"))] #[macro_use] extern crate hex_literal; -extern crate hashbrown; #[macro_use] extern crate log; diff --git a/upload-perf/src/upload-perf.rs b/upload-perf/src/upload-perf.rs index 7a0d353a1f..0151cc6e0b 100644 --- a/upload-perf/src/upload-perf.rs +++ b/upload-perf/src/upload-perf.rs @@ -1,8 +1,6 @@ use serde_json; - -use solana_metrics; - use serde_json::Value; +use solana_metrics; use solana_metrics::influxdb; use std::collections::HashMap; use std::env; diff --git a/wallet/src/main.rs b/wallet/src/main.rs index 38d2041aed..e084786884 100644 --- a/wallet/src/main.rs +++ b/wallet/src/main.rs @@ -1,16 +1,8 @@ -#[macro_use] -extern crate clap; -use dirs; -#[macro_use] -extern crate solana; -#[macro_use] -extern crate serde_json; - mod wallet; use crate::wallet::{parse_command, process_command, WalletConfig, WalletError}; -use clap::{App, Arg, ArgMatches, SubCommand}; - +use clap::{crate_version, App, Arg, ArgMatches, SubCommand}; +use solana::socketaddr; use solana_sdk::signature::{gen_keypair_file, read_keypair, KeypairUtil}; use std::error; use std::net::SocketAddr; diff --git a/wallet/src/wallet.rs b/wallet/src/wallet.rs index 4565cdd76e..42b4c6f07b 100644 --- a/wallet/src/wallet.rs +++ b/wallet/src/wallet.rs @@ -3,8 +3,10 @@ use bs58; use chrono::prelude::*; use clap::ArgMatches; use serde_json; +use serde_json::json; use solana::rpc::RpcSignatureStatus; use solana::rpc_request::{get_rpc_request_str, RpcClient, RpcRequest}; +use solana::socketaddr; use solana::thin_client::poll_gossip_for_leader; use solana_drone::drone::{request_airdrop_transaction, DRONE_PORT}; use solana_sdk::bpf_loader;