Rust 2018 cleanup

This commit is contained in:
Michael Vines 2018-12-14 20:39:10 -08:00 committed by Grimes
parent aaa5cd4615
commit fd562cb9e2
59 changed files with 109 additions and 209 deletions

1
Cargo.lock generated
View File

@ -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]]

View File

@ -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};

View File

@ -1,9 +1,3 @@
#[macro_use]
extern crate clap;
extern crate solana;
extern crate solana_sdk;
mod bench;
mod cli;

View File

@ -6,6 +6,7 @@ authors = ["Solana Maintainers <maintainers@solana.com>"]
repository = "https://github.com/solana-labs/solana"
license = "Apache-2.0"
homepage = "https://solana.com/"
edition = "2018"
[features]
cuda = []

View File

@ -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<error::Error>> {
//logger::setup();
solana_metrics::set_panic_hook("drone");
let matches = App::new("drone")
.version(crate_version!())

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -6,6 +6,7 @@ authors = ["Solana Maintainers <maintainers@solana.com>"]
repository = "https://github.com/solana-labs/solana"
license = "Apache-2.0"
homepage = "https://solana.com/"
edition = "2018"
[features]
cuda = []

View File

@ -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;

View File

@ -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;

View File

@ -6,6 +6,7 @@ authors = ["Solana Maintainers <maintainers@solana.com>"]
repository = "https://github.com/solana-labs/solana"
license = "Apache-2.0"
homepage = "https://solana.com/"
edition = "2018"
[dependencies]
influx_db_client = "0.3.6"

View File

@ -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;

View File

@ -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};

View File

@ -6,6 +6,7 @@ authors = ["Solana Maintainers <maintainers@solana.com>"]
repository = "https://github.com/solana-labs/solana"
license = "Apache-2.0"
homepage = "https://solana.com/"
edition = "2018"
[features]
bpf_c = []

View File

@ -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};

View File

@ -6,6 +6,7 @@ authors = ["Solana Maintainers <maintainers@solana.com>"]
repository = "https://github.com/solana-labs/solana"
license = "Apache-2.0"
homepage = "https://solana.com/"
edition = "2018"
[dependencies]
bincode = "1.0.0"

View File

@ -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;

View File

@ -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(

View File

@ -6,6 +6,7 @@ authors = ["Solana Maintainers <maintainers@solana.com>"]
repository = "https://github.com/solana-labs/solana"
license = "Apache-2.0"
homepage = "https://solana.com/"
edition = "2018"
[dependencies]
bincode = "1.0.0"

View File

@ -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;

View File

@ -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;

View File

@ -6,6 +6,7 @@ authors = ["Solana Maintainers <maintainers@solana.com>"]
repository = "https://github.com/solana-labs/solana"
license = "Apache-2.0"
homepage = "https://solana.com/"
edition = "2018"
[dependencies]
bincode = "1.0.0"

View File

@ -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;

View File

@ -6,6 +6,7 @@ authors = ["Solana Maintainers <maintainers@solana.com>"]
repository = "https://github.com/solana-labs/solana"
license = "Apache-2.0"
homepage = "https://solana.com/"
edition = "2018"
[dependencies]
bincode = "1.0.0"

View File

@ -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::*;

View File

@ -6,6 +6,7 @@ authors = ["Solana Maintainers <maintainers@solana.com>"]
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" }

View File

@ -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(

View File

@ -6,6 +6,7 @@ authors = ["Solana Maintainers <maintainers@solana.com>"]
repository = "https://github.com/solana-labs/solana"
license = "Apache-2.0"
homepage = "https://solana.com/"
edition = "2018"
[dependencies]
bincode = "1.0.0"

View File

@ -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);

View File

@ -6,6 +6,7 @@ authors = ["Solana Maintainers <maintainers@solana.com>"]
repository = "https://github.com/solana-labs/solana"
license = "Apache-2.0"
homepage = "https://solana.com/"
edition = "2018"
[dependencies]
bincode = "1.0.0"

View File

@ -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;

View File

@ -6,6 +6,7 @@ authors = ["Solana Maintainers <maintainers@solana.com>"]
repository = "https://github.com/solana-labs/solana"
license = "Apache-2.0"
homepage = "https://solana.com/"
edition = "2018"
[dependencies]
bincode = "1.0.0"

View File

@ -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(),
};

View File

@ -6,6 +6,7 @@ authors = ["Solana Maintainers <maintainers@solana.com>"]
repository = "https://github.com/solana-labs/solana"
homepage = "https://solana.com/"
license = "Apache-2.0"
edition = "2018"
[dependencies]
bincode = "1.0.0"

View File

@ -1,4 +1,4 @@
use pubkey::Pubkey;
use crate::pubkey::Pubkey;
/// An Account with userdata that is stored on chain
#[repr(C)]

View File

@ -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,

View File

@ -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() {

View File

@ -1,4 +1,4 @@
use budget_expr::BudgetExpr;
use crate::budget_expr::BudgetExpr;
use chrono::prelude::{DateTime, Utc};
/// A smart contract.

View File

@ -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,

View File

@ -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(

View File

@ -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;

View File

@ -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(

View File

@ -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,

View File

@ -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.

View File

@ -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)]

View File

@ -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;

View File

@ -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 {

View File

@ -1,4 +1,4 @@
use pubkey::Pubkey;
use crate::pubkey::Pubkey;
#[derive(Serialize, Deserialize, Debug, Clone)]
pub enum SystemInstruction {

View File

@ -1,4 +1,4 @@
use pubkey::Pubkey;
use crate::pubkey::Pubkey;
pub const SYSTEM_PROGRAM_ID: [u8; 32] = [0u8; 32];

View File

@ -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() {

View File

@ -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,

View File

@ -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::<u64>();

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;