Move src/logger.rs into logger/ crate to unify logging across the workspace
This commit is contained in:
parent
d45fcc4381
commit
6ac466c0a4
|
@ -1731,7 +1731,6 @@ dependencies = [
|
|||
"chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"dirs 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"env_logger 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"generic-array 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"indexmap 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -1764,6 +1763,7 @@ dependencies = [
|
|||
"solana-jsonrpc-pubsub 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"solana-jsonrpc-ws-server 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"solana-keygen 0.11.0",
|
||||
"solana-logger 0.11.0",
|
||||
"solana-lualoader 0.11.0",
|
||||
"solana-metrics 0.11.0",
|
||||
"solana-native-loader 0.11.0",
|
||||
|
@ -1784,6 +1784,7 @@ version = "0.11.0"
|
|||
dependencies = [
|
||||
"clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"solana 0.11.0",
|
||||
"solana-logger 0.11.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1795,6 +1796,7 @@ dependencies = [
|
|||
"serde_json 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"solana 0.11.0",
|
||||
"solana-drone 0.11.0",
|
||||
"solana-logger 0.11.0",
|
||||
"solana-metrics 0.11.0",
|
||||
"solana-sdk 0.11.0",
|
||||
]
|
||||
|
@ -1814,10 +1816,10 @@ dependencies = [
|
|||
"bincode 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"elf 0.0.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"env_logger 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 1.0.82 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"solana-logger 0.11.0",
|
||||
"solana-sdk 0.11.0",
|
||||
"solana_rbpf 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
@ -1828,10 +1830,10 @@ version = "0.11.0"
|
|||
dependencies = [
|
||||
"bincode 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"env_logger 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 1.0.82 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_derive 1.0.82 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"solana-logger 0.11.0",
|
||||
"solana-sdk 0.11.0",
|
||||
]
|
||||
|
||||
|
@ -1846,6 +1848,7 @@ dependencies = [
|
|||
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 1.0.82 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_derive 1.0.82 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"solana-logger 0.11.0",
|
||||
"solana-metrics 0.11.0",
|
||||
"solana-sdk 0.11.0",
|
||||
"tokio 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -1857,10 +1860,10 @@ name = "solana-erc20"
|
|||
version = "0.11.0"
|
||||
dependencies = [
|
||||
"bincode 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"env_logger 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 1.0.82 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_derive 1.0.82 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"solana-logger 0.11.0",
|
||||
"solana-sdk 0.11.0",
|
||||
]
|
||||
|
||||
|
@ -1874,6 +1877,7 @@ dependencies = [
|
|||
"serde_json 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"solana 0.11.0",
|
||||
"solana-drone 0.11.0",
|
||||
"solana-logger 0.11.0",
|
||||
"solana-metrics 0.11.0",
|
||||
"solana-sdk 0.11.0",
|
||||
]
|
||||
|
@ -1887,6 +1891,7 @@ dependencies = [
|
|||
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_json 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"solana 0.11.0",
|
||||
"solana-logger 0.11.0",
|
||||
"solana-sdk 0.11.0",
|
||||
]
|
||||
|
||||
|
@ -2052,6 +2057,14 @@ dependencies = [
|
|||
"clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_json 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"solana 0.11.0",
|
||||
"solana-logger 0.11.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "solana-logger"
|
||||
version = "0.11.0"
|
||||
dependencies = [
|
||||
"env_logger 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -2059,11 +2072,11 @@ name = "solana-lualoader"
|
|||
version = "0.11.0"
|
||||
dependencies = [
|
||||
"bincode 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"env_logger 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rlua 0.15.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 1.0.82 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_derive 1.0.82 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"solana-logger 0.11.0",
|
||||
"solana-sdk 0.11.0",
|
||||
]
|
||||
|
||||
|
@ -2105,6 +2118,7 @@ dependencies = [
|
|||
"dirs 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_json 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"solana 0.11.0",
|
||||
"solana-logger 0.11.0",
|
||||
"solana-sdk 0.11.0",
|
||||
]
|
||||
|
||||
|
@ -2133,10 +2147,10 @@ name = "solana-storage-program"
|
|||
version = "0.11.0"
|
||||
dependencies = [
|
||||
"bincode 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"env_logger 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 1.0.82 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_derive 1.0.82 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"solana-logger 0.11.0",
|
||||
"solana-sdk 0.11.0",
|
||||
]
|
||||
|
||||
|
@ -2145,7 +2159,6 @@ name = "solana-system-program"
|
|||
version = "0.11.0"
|
||||
dependencies = [
|
||||
"bincode 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"env_logger 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 1.0.82 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"solana-sdk 0.11.0",
|
||||
|
@ -2164,10 +2177,10 @@ name = "solana-vote-program"
|
|||
version = "0.11.0"
|
||||
dependencies = [
|
||||
"bincode 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"env_logger 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 1.0.82 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_derive 1.0.82 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"solana-logger 0.11.0",
|
||||
"solana-metrics 0.11.0",
|
||||
"solana-sdk 0.11.0",
|
||||
]
|
||||
|
@ -2199,6 +2212,7 @@ dependencies = [
|
|||
"serde_json 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"solana 0.11.0",
|
||||
"solana-drone 0.11.0",
|
||||
"solana-logger 0.11.0",
|
||||
"solana-sdk 0.11.0",
|
||||
]
|
||||
|
||||
|
|
|
@ -31,7 +31,6 @@ bytes = "0.4"
|
|||
chrono = { version = "0.4.0", features = ["serde"] }
|
||||
clap = "2.31"
|
||||
dirs = "1.0.2"
|
||||
env_logger = "0.6.0"
|
||||
generic-array = { version = "0.12.0", default-features = false, features = ["serde"] }
|
||||
hex-literal = "0.1.1"
|
||||
indexmap = "1.0"
|
||||
|
@ -64,6 +63,7 @@ solana-jsonrpc-macros = "0.4.0"
|
|||
solana-jsonrpc-pubsub = "0.4.0"
|
||||
solana-jsonrpc-ws-server = "0.4.0"
|
||||
solana-keygen = { path = "keygen", version = "0.11.0" }
|
||||
solana-logger = { path = "logger", version = "0.11.0" }
|
||||
solana-lualoader = { path = "programs/native/lua_loader", version = "0.11.0" }
|
||||
solana-metrics = { path = "metrics", version = "0.11.0" }
|
||||
solana-native-loader = { path = "programs/native/native_loader", version = "0.11.0" }
|
||||
|
@ -110,6 +110,7 @@ members = [
|
|||
"genesis",
|
||||
"keygen",
|
||||
"ledger-tool",
|
||||
"logger",
|
||||
"metrics",
|
||||
"programs/bpf/rust/noop",
|
||||
"programs/native/bpf_loader",
|
||||
|
|
|
@ -10,6 +10,7 @@ homepage = "https://solana.com/"
|
|||
[dependencies]
|
||||
clap = "2.32.0"
|
||||
solana = { path = "..", version = "0.11.0" }
|
||||
solana-logger = { path = "../logger", version = "0.11.0" }
|
||||
|
||||
[features]
|
||||
cuda = []
|
||||
|
|
|
@ -13,6 +13,7 @@ rayon = "1.0.3"
|
|||
serde_json = "1.0.10"
|
||||
solana = { path = "..", version = "0.11.0" }
|
||||
solana-drone = { path = "../drone", version = "0.11.0" }
|
||||
solana-logger = { path = "../logger", version = "0.11.0" }
|
||||
solana-metrics = { path = "../metrics", version = "0.11.0" }
|
||||
solana-sdk = { path = "../sdk", version = "0.11.0" }
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ mod cli;
|
|||
use solana::client::mk_client;
|
||||
use solana::cluster_info::{ClusterInfo, NodeInfo};
|
||||
use solana::gossip_service::GossipService;
|
||||
use solana::logger;
|
||||
|
||||
use solana::service::Service;
|
||||
use solana::signature::GenKeys;
|
||||
use solana::thin_client::poll_gossip_for_leader;
|
||||
|
@ -76,7 +76,7 @@ fn converge(
|
|||
}
|
||||
|
||||
fn main() {
|
||||
logger::setup();
|
||||
solana_logger::setup();
|
||||
solana_metrics::set_panic_hook("bench-tps");
|
||||
|
||||
let matches = cli::build_args().get_matches();
|
||||
|
|
|
@ -11,6 +11,7 @@ cd "$(dirname "$0")/.."
|
|||
# here. (TODO: figure the crate ordering dynamically)
|
||||
#
|
||||
CRATES=(
|
||||
logger
|
||||
sdk
|
||||
keygen
|
||||
metrics
|
||||
|
|
|
@ -18,6 +18,7 @@ clap = "2.31"
|
|||
log = "0.4.2"
|
||||
serde = "1.0.82"
|
||||
serde_derive = "1.0.82"
|
||||
solana-logger = { path = "../logger", version = "0.11.0" }
|
||||
solana-sdk = { path = "../sdk", version = "0.11.0" }
|
||||
solana-metrics = { path = "../metrics", version = "0.11.0" }
|
||||
tokio = "0.1"
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
extern crate bincode;
|
||||
extern crate byteorder;
|
||||
extern crate bytes;
|
||||
#[macro_use]
|
||||
|
@ -11,12 +10,10 @@ extern crate solana_sdk;
|
|||
extern crate tokio;
|
||||
extern crate tokio_codec;
|
||||
|
||||
use bincode::{deserialize, serialize};
|
||||
use byteorder::{ByteOrder, LittleEndian};
|
||||
use bytes::Bytes;
|
||||
use clap::{App, Arg};
|
||||
use solana_drone::drone::{Drone, DroneRequest, DRONE_PORT};
|
||||
//use solana::logger;
|
||||
use solana_sdk::signature::read_keypair;
|
||||
use std::error;
|
||||
use std::io;
|
||||
|
@ -100,7 +97,7 @@ fn main() -> Result<(), Box<error::Error>> {
|
|||
let (writer, reader) = framed.split();
|
||||
|
||||
let processor = reader.and_then(move |bytes| {
|
||||
let req: DroneRequest = deserialize(&bytes).or_else(|err| {
|
||||
let req: DroneRequest = bincode::deserialize(&bytes).or_else(|err| {
|
||||
Err(io::Error::new(
|
||||
io::ErrorKind::Other,
|
||||
format!("deserialize packet in drone: {:?}", err),
|
||||
|
@ -112,7 +109,7 @@ fn main() -> Result<(), Box<error::Error>> {
|
|||
let res = drone2.lock().unwrap().build_airdrop_transaction(req);
|
||||
match res {
|
||||
Ok(tx) => {
|
||||
let response_vec = serialize(&tx).or_else(|err| {
|
||||
let response_vec = bincode::serialize(&tx).or_else(|err| {
|
||||
Err(io::Error::new(
|
||||
io::ErrorKind::Other,
|
||||
format!("deserialize packet in drone: {:?}", err),
|
||||
|
|
|
@ -379,7 +379,7 @@ mod tests {
|
|||
const SMALL_BATCH: u64 = 50;
|
||||
const TPS_BATCH: u64 = 5_000_000;
|
||||
|
||||
logger::setup();
|
||||
solana_logger::setup();
|
||||
let leader_keypair = Arc::new(Keypair::new());
|
||||
let leader = Node::new_localhost_with_pubkey(leader_keypair.pubkey());
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@ dirs = "1.0.2"
|
|||
log = "0.4.2"
|
||||
serde_json = "1.0.10"
|
||||
solana = { path = "..", version = "0.11.0" }
|
||||
solana-logger = { path = "../logger", version = "0.11.0" }
|
||||
solana-sdk = { path = "../sdk", version = "0.11.0" }
|
||||
|
||||
[features]
|
||||
|
|
|
@ -7,14 +7,14 @@ use serde_json;
|
|||
use clap::{App, Arg};
|
||||
use solana::cluster_info::FULLNODE_PORT_RANGE;
|
||||
use solana::fullnode::Config;
|
||||
use solana::logger;
|
||||
|
||||
use solana::netutil::{get_ip_addr, get_public_ip_addr, parse_port_or_addr};
|
||||
use solana_sdk::signature::{gen_pkcs8, read_pkcs8};
|
||||
use std::io;
|
||||
use std::net::SocketAddr;
|
||||
|
||||
fn main() {
|
||||
logger::setup();
|
||||
solana_logger::setup();
|
||||
let matches = App::new("fullnode-config")
|
||||
.version(crate_version!())
|
||||
.arg(
|
||||
|
|
|
@ -14,6 +14,7 @@ rayon = "1.0.3"
|
|||
serde_json = "1.0.10"
|
||||
solana = { path = "..", version = "0.11.0" }
|
||||
solana-drone = { path = "../drone", version = "0.11.0" }
|
||||
solana-logger = { path = "../logger", version = "0.11.0" }
|
||||
solana-metrics = { path = "../metrics", version = "0.11.0" }
|
||||
solana-sdk = { path = "../sdk", version = "0.11.0" }
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ use solana::client::mk_client;
|
|||
use solana::cluster_info::{Node, FULLNODE_PORT_RANGE};
|
||||
use solana::fullnode::{Config, Fullnode, FullnodeReturnType};
|
||||
use solana::leader_scheduler::LeaderScheduler;
|
||||
use solana::logger;
|
||||
|
||||
use solana::netutil::find_available_port_in_range;
|
||||
use solana::thin_client::poll_gossip_for_leader;
|
||||
use solana_sdk::signature::{Keypair, KeypairUtil};
|
||||
|
@ -27,7 +27,7 @@ use std::thread::sleep;
|
|||
use std::time::Duration;
|
||||
|
||||
fn main() {
|
||||
logger::setup();
|
||||
solana_logger::setup();
|
||||
solana_metrics::set_panic_hook("fullnode");
|
||||
let matches = App::new("fullnode")
|
||||
.version(crate_version!())
|
||||
|
|
|
@ -11,6 +11,7 @@ homepage = "https://solana.com/"
|
|||
clap = "2.32.0"
|
||||
serde_json = "1.0.10"
|
||||
solana = { path = "..", version = "0.11.0" }
|
||||
solana-logger = { path = "../logger", version = "0.11.0" }
|
||||
|
||||
[features]
|
||||
cuda = []
|
||||
|
|
|
@ -5,12 +5,12 @@ use serde_json;
|
|||
use clap::{App, Arg, SubCommand};
|
||||
use solana::bank::Bank;
|
||||
use solana::ledger::{read_ledger, verify_ledger};
|
||||
use solana::logger;
|
||||
|
||||
use std::io::{stdout, Write};
|
||||
use std::process::exit;
|
||||
|
||||
fn main() {
|
||||
logger::setup();
|
||||
solana_logger::setup();
|
||||
let matches = App::new("ledger-tool")
|
||||
.version(crate_version!())
|
||||
.arg(
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
[package]
|
||||
name = "solana-logger"
|
||||
version = "0.11.0"
|
||||
description = "Solana Logger"
|
||||
authors = ["Solana Maintainers <maintainers@solana.com>"]
|
||||
repository = "https://github.com/solana-labs/solana"
|
||||
license = "Apache-2.0"
|
||||
homepage = "https://solana.com/"
|
||||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
env_logger = "0.6.0"
|
||||
|
||||
[lib]
|
||||
name = "solana_logger"
|
|
@ -14,11 +14,11 @@ bpf_c = []
|
|||
bincode = "1.0.0"
|
||||
byteorder = "1.2.1"
|
||||
elf = "0.0.10"
|
||||
env_logger = "0.6.0"
|
||||
libc = "0.2.45"
|
||||
log = "0.4.2"
|
||||
solana_rbpf = "=0.1.5"
|
||||
serde = "1.0.82"
|
||||
solana-logger = { path = "../../../logger", version = "0.11.0" }
|
||||
solana-sdk = { path = "../../../sdk", version = "0.11.0" }
|
||||
|
||||
[lib]
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
pub mod bpf_verifier;
|
||||
|
||||
extern crate bincode;
|
||||
extern crate byteorder;
|
||||
extern crate env_logger;
|
||||
#[macro_use]
|
||||
extern crate log;
|
||||
extern crate libc;
|
||||
|
@ -10,7 +8,6 @@ extern crate solana_rbpf;
|
|||
#[macro_use]
|
||||
extern crate solana_sdk;
|
||||
|
||||
use bincode::deserialize;
|
||||
use byteorder::{ByteOrder, LittleEndian, WriteBytesExt};
|
||||
use libc::c_char;
|
||||
use solana_rbpf::EbpfVmRaw;
|
||||
|
@ -22,7 +19,6 @@ use std::ffi::CStr;
|
|||
use std::io::prelude::*;
|
||||
use std::io::{Error, ErrorKind};
|
||||
use std::mem;
|
||||
use std::sync::{Once, ONCE_INIT};
|
||||
|
||||
// TODO use rbpf's disassemble
|
||||
#[allow(dead_code)]
|
||||
|
@ -153,11 +149,7 @@ fn entrypoint(
|
|||
tx_data: &[u8],
|
||||
tick_height: u64,
|
||||
) -> Result<(), ProgramError> {
|
||||
static INIT: Once = ONCE_INIT;
|
||||
INIT.call_once(|| {
|
||||
// env_logger can only be initialized once
|
||||
env_logger::init();
|
||||
});
|
||||
solana_logger::setup();
|
||||
|
||||
if keyed_accounts[0].account.executable {
|
||||
let prog = keyed_accounts[0].account.userdata.clone();
|
||||
|
@ -188,7 +180,7 @@ fn entrypoint(
|
|||
"BPF program executed {} instructions",
|
||||
vm.get_last_instruction_count()
|
||||
);
|
||||
} else if let Ok(instruction) = deserialize(tx_data) {
|
||||
} else if let Ok(instruction) = bincode::deserialize(tx_data) {
|
||||
if keyed_accounts[0].signer_key().is_none() {
|
||||
warn!("key[0] did not sign the transaction");
|
||||
return Err(ProgramError::GenericError);
|
||||
|
|
|
@ -10,10 +10,10 @@ homepage = "https://solana.com/"
|
|||
[dependencies]
|
||||
bincode = "1.0.0"
|
||||
chrono = { version = "0.4.0", features = ["serde"] }
|
||||
env_logger = "0.6.0"
|
||||
log = "0.4.2"
|
||||
serde = "1.0.82"
|
||||
serde_derive = "1.0.82"
|
||||
solana-logger = { path = "../../../logger", version = "0.11.0" }
|
||||
solana-sdk = { path = "../../../sdk", version = "0.11.0" }
|
||||
|
||||
[lib]
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
extern crate bincode;
|
||||
extern crate chrono;
|
||||
extern crate env_logger;
|
||||
#[macro_use]
|
||||
extern crate log;
|
||||
#[macro_use]
|
||||
|
@ -13,7 +12,6 @@ mod budget_program;
|
|||
use solana_sdk::account::KeyedAccount;
|
||||
use solana_sdk::native_program::ProgramError;
|
||||
use solana_sdk::pubkey::Pubkey;
|
||||
use std::sync::{Once, ONCE_INIT};
|
||||
|
||||
use budget_program::process_instruction;
|
||||
|
||||
|
@ -24,11 +22,7 @@ fn entrypoint(
|
|||
data: &[u8],
|
||||
_tick_height: u64,
|
||||
) -> Result<(), ProgramError> {
|
||||
static INIT: Once = ONCE_INIT;
|
||||
INIT.call_once(|| {
|
||||
// env_logger can only be initialized once
|
||||
env_logger::init();
|
||||
});
|
||||
solana_logger::setup();
|
||||
|
||||
trace!("process_instruction: {:?}", data);
|
||||
trace!("keyed_accounts: {:?}", keyed_accounts);
|
||||
|
|
|
@ -9,10 +9,10 @@ homepage = "https://solana.com/"
|
|||
|
||||
[dependencies]
|
||||
bincode = "1.0.0"
|
||||
env_logger = "0.6.0"
|
||||
log = "0.4.2"
|
||||
serde = "1.0.82"
|
||||
serde_derive = "1.0.82"
|
||||
solana-logger = { path = "../../../logger", version = "0.11.0" }
|
||||
solana-sdk = { path = "../../../sdk", version = "0.11.0" }
|
||||
|
||||
[lib]
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
//! The `erc20` library implements a generic erc20-like token
|
||||
|
||||
extern crate bincode;
|
||||
extern crate env_logger;
|
||||
#[macro_use]
|
||||
extern crate log;
|
||||
extern crate serde;
|
||||
|
@ -13,7 +12,6 @@ extern crate solana_sdk;
|
|||
use solana_sdk::account::KeyedAccount;
|
||||
use solana_sdk::native_program::ProgramError;
|
||||
use solana_sdk::pubkey::Pubkey;
|
||||
use std::sync::{Once, ONCE_INIT};
|
||||
|
||||
mod token_program;
|
||||
|
||||
|
@ -24,9 +22,7 @@ fn entrypoint(
|
|||
input: &[u8],
|
||||
_tick_height: u64,
|
||||
) -> Result<(), ProgramError> {
|
||||
// env_logger can only be initialized once
|
||||
static INIT: Once = ONCE_INIT;
|
||||
INIT.call_once(env_logger::init);
|
||||
solana_logger::setup();
|
||||
|
||||
token_program::TokenProgram::process(program_id, info, input).map_err(|err| {
|
||||
error!("error: {:?}", err);
|
||||
|
|
|
@ -9,11 +9,11 @@ homepage = "https://solana.com/"
|
|||
|
||||
[dependencies]
|
||||
bincode = "1.0.0"
|
||||
env_logger = "0.6.0"
|
||||
log = "0.4.2"
|
||||
rlua = "0.15.2"
|
||||
serde = "1.0.82"
|
||||
serde_derive = "1.0.82"
|
||||
solana-logger = { path = "../../../logger", version = "0.11.0" }
|
||||
solana-sdk = { path = "../../../sdk", version = "0.11.0" }
|
||||
|
||||
[dev-dependencies]
|
||||
|
|
|
@ -1,19 +1,15 @@
|
|||
extern crate bincode;
|
||||
extern crate env_logger;
|
||||
#[macro_use]
|
||||
extern crate log;
|
||||
extern crate rlua;
|
||||
#[macro_use]
|
||||
extern crate solana_sdk;
|
||||
|
||||
use bincode::deserialize;
|
||||
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 std::str;
|
||||
use std::sync::{Once, ONCE_INIT};
|
||||
|
||||
/// Make KeyAccount values available to Lua.
|
||||
fn set_accounts(lua: &Lua, name: &str, keyed_accounts: &[KeyedAccount]) -> rlua::Result<()> {
|
||||
|
@ -68,11 +64,7 @@ fn entrypoint(
|
|||
tx_data: &[u8],
|
||||
_tick_height: u64,
|
||||
) -> Result<(), ProgramError> {
|
||||
static INIT: Once = ONCE_INIT;
|
||||
INIT.call_once(|| {
|
||||
// env_logger can only be initialized once
|
||||
env_logger::init();
|
||||
});
|
||||
solana_logger::setup();
|
||||
|
||||
if keyed_accounts[0].account.executable {
|
||||
let code = keyed_accounts[0].account.userdata.clone();
|
||||
|
@ -86,7 +78,7 @@ fn entrypoint(
|
|||
return Err(ProgramError::GenericError);
|
||||
}
|
||||
}
|
||||
} else if let Ok(instruction) = deserialize(tx_data) {
|
||||
} else if let Ok(instruction) = bincode::deserialize(tx_data) {
|
||||
if keyed_accounts[0].signer_key().is_none() {
|
||||
warn!("key[0] did not sign the transaction");
|
||||
return Err(ProgramError::GenericError);
|
||||
|
|
|
@ -9,10 +9,10 @@ homepage = "https://solana.com/"
|
|||
|
||||
[dependencies]
|
||||
bincode = "1.0.0"
|
||||
env_logger = "0.6.0"
|
||||
log = "0.4.2"
|
||||
serde = "1.0.27"
|
||||
serde_derive = "1.0.27"
|
||||
solana-logger = { path = "../../../logger", version = "0.11.0" }
|
||||
solana-sdk = { path = "../../../sdk", version = "0.11.0" }
|
||||
|
||||
[lib]
|
||||
|
|
|
@ -2,14 +2,11 @@
|
|||
//! Receive mining proofs from miners, validate the answers
|
||||
//! and give reward for good proofs.
|
||||
|
||||
extern crate bincode;
|
||||
extern crate env_logger;
|
||||
#[macro_use]
|
||||
extern crate log;
|
||||
#[macro_use]
|
||||
extern crate solana_sdk;
|
||||
|
||||
use bincode::deserialize;
|
||||
use solana_sdk::account::KeyedAccount;
|
||||
use solana_sdk::native_program::ProgramError;
|
||||
use solana_sdk::pubkey::Pubkey;
|
||||
|
@ -22,13 +19,15 @@ fn entrypoint(
|
|||
data: &[u8],
|
||||
_tick_height: u64,
|
||||
) -> Result<(), ProgramError> {
|
||||
solana_logger::setup();
|
||||
|
||||
// accounts_keys[0] must be signed
|
||||
if keyed_accounts[0].signer_key().is_none() {
|
||||
info!("account[0] is unsigned");
|
||||
Err(ProgramError::InvalidArgument)?;
|
||||
}
|
||||
|
||||
if let Ok(syscall) = deserialize(data) {
|
||||
if let Ok(syscall) = bincode::deserialize(data) {
|
||||
match syscall {
|
||||
StorageProgram::SubmitMiningProof {
|
||||
sha_state,
|
||||
|
|
|
@ -9,7 +9,6 @@ homepage = "https://solana.com/"
|
|||
|
||||
[dependencies]
|
||||
bincode = "1.0.0"
|
||||
env_logger = "0.6.0"
|
||||
log = "0.4.2"
|
||||
serde = "1.0.27"
|
||||
solana-sdk = { path = "../../../sdk", version = "0.11.0" }
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
extern crate bincode;
|
||||
#[macro_use]
|
||||
extern crate log;
|
||||
#[macro_use]
|
||||
extern crate solana_sdk;
|
||||
|
||||
use bincode::deserialize;
|
||||
use solana_sdk::account::KeyedAccount;
|
||||
use solana_sdk::native_program::ProgramError;
|
||||
use solana_sdk::pubkey::Pubkey;
|
||||
|
@ -18,7 +16,7 @@ pub fn entrypoint(
|
|||
data: &[u8],
|
||||
_tick_height: u64,
|
||||
) -> Result<(), ProgramError> {
|
||||
if let Ok(syscall) = deserialize(data) {
|
||||
if let Ok(syscall) = bincode::deserialize(data) {
|
||||
trace!("process_instruction: {:?}", syscall);
|
||||
trace!("keyed_accounts: {:?}", keyed_accounts);
|
||||
let from = 0;
|
||||
|
|
|
@ -9,10 +9,10 @@ homepage = "https://solana.com/"
|
|||
|
||||
[dependencies]
|
||||
bincode = "1.0.0"
|
||||
env_logger = "0.6.0"
|
||||
log = "0.4.2"
|
||||
serde = "1.0.82"
|
||||
serde_derive = "1.0.82"
|
||||
solana-logger = { path = "../../../logger", version = "0.11.0" }
|
||||
solana-metrics = { path = "../../../metrics", version = "0.11.0" }
|
||||
solana-sdk = { path = "../../../sdk", version = "0.11.0" }
|
||||
|
||||
|
|
|
@ -1,22 +1,16 @@
|
|||
//! Vote program
|
||||
//! Receive and processes votes from validators
|
||||
|
||||
extern crate bincode;
|
||||
extern crate env_logger;
|
||||
#[macro_use]
|
||||
extern crate log;
|
||||
extern crate solana_metrics;
|
||||
#[macro_use]
|
||||
extern crate solana_sdk;
|
||||
|
||||
use bincode::deserialize;
|
||||
use solana_metrics::{influxdb, submit};
|
||||
use solana_sdk::account::KeyedAccount;
|
||||
use solana_sdk::native_program::ProgramError;
|
||||
use solana_sdk::pubkey::Pubkey;
|
||||
use solana_sdk::vote_program::*;
|
||||
use std::collections::VecDeque;
|
||||
use std::sync::{Once, ONCE_INIT};
|
||||
|
||||
solana_entrypoint!(entrypoint);
|
||||
fn entrypoint(
|
||||
|
@ -25,11 +19,7 @@ fn entrypoint(
|
|||
data: &[u8],
|
||||
_tick_height: u64,
|
||||
) -> Result<(), ProgramError> {
|
||||
static INIT: Once = ONCE_INIT;
|
||||
INIT.call_once(|| {
|
||||
// env_logger can only be initialized once
|
||||
env_logger::init();
|
||||
});
|
||||
solana_logger::setup();
|
||||
|
||||
trace!("process_instruction: {:?}", data);
|
||||
trace!("keyed_accounts: {:?}", keyed_accounts);
|
||||
|
@ -40,7 +30,7 @@ fn entrypoint(
|
|||
Err(ProgramError::InvalidArgument)?;
|
||||
}
|
||||
|
||||
match deserialize(data) {
|
||||
match bincode::deserialize(data) {
|
||||
Ok(VoteInstruction::RegisterAccount) => {
|
||||
if !check_id(&keyed_accounts[1].account.owner) {
|
||||
error!("account[1] is not assigned to the VOTE_PROGRAM");
|
||||
|
@ -64,9 +54,9 @@ fn entrypoint(
|
|||
Err(ProgramError::InvalidArgument)?;
|
||||
}
|
||||
debug!("{:?} by {}", vote, keyed_accounts[0].signer_key().unwrap());
|
||||
submit(
|
||||
influxdb::Point::new("vote-native")
|
||||
.add_field("count", influxdb::Value::Integer(1))
|
||||
solana_metrics::submit(
|
||||
solana_metrics::influxdb::Point::new("vote-native")
|
||||
.add_field("count", solana_metrics::influxdb::Value::Integer(1))
|
||||
.to_owned(),
|
||||
);
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@ clap = "2.32.0"
|
|||
dirs = "1.0.2"
|
||||
serde_json = "1.0.10"
|
||||
solana = { path = "..", version = "0.11.0" }
|
||||
solana-logger = { path = "../logger", version = "0.11.0" }
|
||||
solana-sdk = { path = "../sdk", version = "0.11.0" }
|
||||
|
||||
[features]
|
||||
|
|
|
@ -8,7 +8,7 @@ extern crate solana;
|
|||
use clap::{App, Arg};
|
||||
use solana::cluster_info::{Node, NodeInfo};
|
||||
use solana::fullnode::Config;
|
||||
use solana::logger;
|
||||
|
||||
use solana::replicator::Replicator;
|
||||
use solana_sdk::signature::{Keypair, KeypairUtil};
|
||||
use std::fs::File;
|
||||
|
@ -16,7 +16,7 @@ use std::net::{Ipv4Addr, SocketAddr};
|
|||
use std::process::exit;
|
||||
|
||||
fn main() {
|
||||
logger::setup();
|
||||
solana_logger::setup();
|
||||
|
||||
let matches = App::new("replicator")
|
||||
.version(crate_version!())
|
||||
|
|
|
@ -116,8 +116,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn test_encrypt_file_many_keys_single() {
|
||||
use crate::logger;
|
||||
logger::setup();
|
||||
solana_logger::setup();
|
||||
|
||||
let entries = make_tiny_test_entries(32);
|
||||
let ledger_dir = "test_encrypt_file_many_keys_single";
|
||||
|
@ -156,8 +155,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn test_encrypt_file_many_keys_multiple_keys() {
|
||||
use crate::logger;
|
||||
logger::setup();
|
||||
solana_logger::setup();
|
||||
|
||||
let entries = make_tiny_test_entries(32);
|
||||
let ledger_dir = "test_encrypt_file_many_keys_multiple";
|
||||
|
|
|
@ -1109,7 +1109,7 @@ mod tests {
|
|||
use crate::crds_value::CrdsValueLabel;
|
||||
use crate::db_ledger::DbLedger;
|
||||
use crate::ledger::get_tmp_ledger_path;
|
||||
use crate::logger;
|
||||
|
||||
use crate::packet::BLOB_HEADER_SIZE;
|
||||
use crate::result::Error;
|
||||
use solana_sdk::signature::{Keypair, KeypairUtil};
|
||||
|
@ -1206,7 +1206,7 @@ mod tests {
|
|||
/// test window requests respond with the right blob, and do not overrun
|
||||
#[test]
|
||||
fn run_window_request() {
|
||||
logger::setup();
|
||||
solana_logger::setup();
|
||||
let ledger_path = get_tmp_ledger_path("run_window_request");
|
||||
{
|
||||
let db_ledger = Arc::new(RwLock::new(DbLedger::open(&ledger_path).unwrap()));
|
||||
|
@ -1254,7 +1254,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn test_default_leader() {
|
||||
logger::setup();
|
||||
solana_logger::setup();
|
||||
let node_info = NodeInfo::new_localhost(Keypair::new().pubkey(), 0);
|
||||
let mut cluster_info = ClusterInfo::new(node_info);
|
||||
let network_entry_point = NodeInfo::new_entry_point(&socketaddr!("127.0.0.1:1239"));
|
||||
|
|
|
@ -150,7 +150,7 @@ pub mod tests {
|
|||
use crate::bank::Bank;
|
||||
use crate::compute_leader_finality_service::ComputeLeaderFinalityService;
|
||||
use crate::create_vote_account::*;
|
||||
use crate::logger;
|
||||
|
||||
use crate::mint::Mint;
|
||||
use bincode::serialize;
|
||||
use solana_sdk::hash::hash;
|
||||
|
@ -164,7 +164,7 @@ pub mod tests {
|
|||
|
||||
#[test]
|
||||
fn test_compute_finality() {
|
||||
logger::setup();
|
||||
solana_logger::setup();
|
||||
|
||||
let mint = Mint::new(1234);
|
||||
let dummy_leader_id = Keypair::new().pubkey();
|
||||
|
|
|
@ -491,32 +491,28 @@ mod test {
|
|||
#[test]
|
||||
#[ignore]
|
||||
fn test_star_network_large_pull() {
|
||||
use crate::logger;
|
||||
logger::setup();
|
||||
solana_logger::setup();
|
||||
let mut network = star_network_create(2000);
|
||||
network_simulator_pull_only(&mut network);
|
||||
}
|
||||
#[test]
|
||||
#[ignore]
|
||||
fn test_rstar_network_large_push() {
|
||||
use crate::logger;
|
||||
logger::setup();
|
||||
solana_logger::setup();
|
||||
let mut network = rstar_network_create(4000);
|
||||
network_simulator(&mut network);
|
||||
}
|
||||
#[test]
|
||||
#[ignore]
|
||||
fn test_ring_network_large_push() {
|
||||
use crate::logger;
|
||||
logger::setup();
|
||||
solana_logger::setup();
|
||||
let mut network = ring_network_create(4001);
|
||||
network_simulator(&mut network);
|
||||
}
|
||||
#[test]
|
||||
#[ignore]
|
||||
fn test_star_network_large_push() {
|
||||
use crate::logger;
|
||||
logger::setup();
|
||||
solana_logger::setup();
|
||||
let mut network = star_network_create(4002);
|
||||
network_simulator(&mut network);
|
||||
}
|
||||
|
|
|
@ -342,8 +342,7 @@ mod test {
|
|||
}
|
||||
#[test]
|
||||
fn test_refresh_active_set() {
|
||||
use crate::logger;
|
||||
logger::setup();
|
||||
solana_logger::setup();
|
||||
let mut crds = Crds::default();
|
||||
let mut push = CrdsGossipPush::default();
|
||||
let value1 = CrdsValue::ContactInfo(ContactInfo::new_localhost(Keypair::new().pubkey(), 0));
|
||||
|
|
|
@ -570,7 +570,7 @@ pub mod test {
|
|||
use super::*;
|
||||
use crate::db_ledger::{DbLedger, DEFAULT_SLOT_HEIGHT};
|
||||
use crate::ledger::{get_tmp_ledger_path, make_tiny_test_entries, Block};
|
||||
use crate::logger;
|
||||
|
||||
use crate::packet::{index_blobs, SharedBlob, BLOB_DATA_SIZE, BLOB_SIZE};
|
||||
use crate::window::WindowSlot;
|
||||
use rand::{thread_rng, Rng};
|
||||
|
@ -824,7 +824,7 @@ pub mod test {
|
|||
// Remove a data block, test for successful recovery
|
||||
#[test]
|
||||
pub fn test_window_recover_basic() {
|
||||
logger::setup();
|
||||
solana_logger::setup();
|
||||
|
||||
// Setup the window
|
||||
let offset = 0;
|
||||
|
@ -878,7 +878,7 @@ pub mod test {
|
|||
// Remove a data and coding block, test for successful recovery
|
||||
#[test]
|
||||
pub fn test_window_recover_basic2() {
|
||||
logger::setup();
|
||||
solana_logger::setup();
|
||||
|
||||
// Setup the window
|
||||
let offset = 0;
|
||||
|
@ -951,7 +951,7 @@ pub mod test {
|
|||
// #[test]
|
||||
// #[ignore]
|
||||
// pub fn test_window_recover() {
|
||||
// logger::setup();
|
||||
// solana_logger::setup();
|
||||
// let offset = 4;
|
||||
// let data_len = 16;
|
||||
// let num_blobs = NUM_DATA + 2;
|
||||
|
|
|
@ -731,8 +731,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn test_verify_slice() {
|
||||
use crate::logger;
|
||||
logger::setup();
|
||||
solana_logger::setup();
|
||||
let zero = Hash::default();
|
||||
let one = hash(&zero.as_ref());
|
||||
assert!(vec![][..].verify(&zero)); // base case
|
||||
|
@ -775,8 +774,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn test_entries_to_blobs() {
|
||||
use crate::logger;
|
||||
logger::setup();
|
||||
solana_logger::setup();
|
||||
let entries = make_test_entries();
|
||||
|
||||
let blob_q = entries.to_blobs();
|
||||
|
@ -786,8 +784,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn test_bad_blobs_attack() {
|
||||
use crate::logger;
|
||||
logger::setup();
|
||||
solana_logger::setup();
|
||||
let addr = SocketAddr::new(IpAddr::V4(Ipv4Addr::new(0, 0, 0, 0)), 8000);
|
||||
let blobs_q = to_blobs(vec![(0, addr)]).unwrap(); // <-- attack!
|
||||
assert!(reconstruct_entries_from_blobs(blobs_q).is_err());
|
||||
|
@ -795,8 +792,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn test_next_entries() {
|
||||
use crate::logger;
|
||||
logger::setup();
|
||||
solana_logger::setup();
|
||||
let id = Hash::default();
|
||||
let next_id = hash(&id.as_ref());
|
||||
let keypair = Keypair::new();
|
||||
|
@ -844,8 +840,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn test_ledger_reader_writer() {
|
||||
use crate::logger;
|
||||
logger::setup();
|
||||
solana_logger::setup();
|
||||
let ledger_path = get_tmp_ledger_path("test_ledger_reader_writer");
|
||||
let entries = make_tiny_test_entries(10);
|
||||
|
||||
|
@ -922,8 +917,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn test_recover_ledger() {
|
||||
use crate::logger;
|
||||
logger::setup();
|
||||
solana_logger::setup();
|
||||
|
||||
let entries = make_tiny_test_entries(10);
|
||||
let ledger_path = get_tmp_ledger_path("test_recover_ledger");
|
||||
|
@ -973,8 +967,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn test_verify_ledger() {
|
||||
use crate::logger;
|
||||
logger::setup();
|
||||
solana_logger::setup();
|
||||
|
||||
let entries = make_tiny_test_entries(10);
|
||||
let ledger_path = get_tmp_ledger_path("test_verify_ledger");
|
||||
|
@ -991,8 +984,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn test_get_entries_bytes() {
|
||||
use crate::logger;
|
||||
logger::setup();
|
||||
solana_logger::setup();
|
||||
let entries = make_tiny_test_entries(10);
|
||||
let ledger_path = get_tmp_ledger_path("test_raw_entries");
|
||||
{
|
||||
|
|
|
@ -42,7 +42,6 @@ pub mod gossip_service;
|
|||
pub mod leader_scheduler;
|
||||
pub mod ledger;
|
||||
pub mod ledger_write_stage;
|
||||
pub mod logger;
|
||||
pub mod mint;
|
||||
pub mod netutil;
|
||||
pub mod packet;
|
||||
|
|
|
@ -203,14 +203,14 @@ pub fn find_available_port_in_range(range: (u16, u16)) -> io::Result<u16> {
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::logger;
|
||||
|
||||
use crate::netutil::*;
|
||||
use ipnetwork::IpNetwork;
|
||||
use pnet_datalink as datalink;
|
||||
|
||||
#[test]
|
||||
fn test_find_eth0ish_ip_addr() {
|
||||
logger::setup();
|
||||
solana_logger::setup();
|
||||
|
||||
macro_rules! mock_interface {
|
||||
($name:ident, $ip_mask:expr) => {
|
||||
|
|
|
@ -256,7 +256,7 @@ mod test {
|
|||
make_active_set_entries, LeaderScheduler, LeaderSchedulerConfig,
|
||||
};
|
||||
use crate::ledger::{create_ticks, create_tmp_sample_ledger, LedgerWriter};
|
||||
use crate::logger;
|
||||
|
||||
use crate::packet::BlobError;
|
||||
use crate::replay_stage::{ReplayStage, ReplayStageReturnType};
|
||||
use crate::result::Error;
|
||||
|
@ -271,7 +271,7 @@ mod test {
|
|||
|
||||
#[test]
|
||||
pub fn test_replay_stage_leader_rotation_exit() {
|
||||
logger::setup();
|
||||
solana_logger::setup();
|
||||
|
||||
// Set up dummy node to host a ReplayStage
|
||||
let my_keypair = Keypair::new();
|
||||
|
|
|
@ -301,7 +301,7 @@ impl Replicator {
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::logger;
|
||||
|
||||
use crate::replicator::sample_file;
|
||||
use solana_sdk::hash::Hash;
|
||||
use solana_sdk::signature::{Keypair, KeypairUtil};
|
||||
|
@ -327,7 +327,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn test_sample_file() {
|
||||
logger::setup();
|
||||
solana_logger::setup();
|
||||
let in_path = tmp_file_path("test_sample_file_input.txt");
|
||||
let num_strings = 4096;
|
||||
let string = "12foobar";
|
||||
|
|
|
@ -481,8 +481,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn test_verify_multi_sig() {
|
||||
use crate::logger;
|
||||
logger::setup();
|
||||
solana_logger::setup();
|
||||
let keypair0 = Keypair::new();
|
||||
let keypair1 = Keypair::new();
|
||||
let keypairs = vec![&keypair0, &keypair1];
|
||||
|
|
|
@ -339,7 +339,7 @@ mod tests {
|
|||
use crate::entry::Entry;
|
||||
use crate::ledger::make_tiny_test_entries;
|
||||
use crate::ledger::{create_tmp_sample_ledger, LedgerWriter};
|
||||
use crate::logger;
|
||||
|
||||
use crate::service::Service;
|
||||
use crate::storage_stage::StorageState;
|
||||
use crate::storage_stage::NUM_IDENTITIES;
|
||||
|
@ -380,7 +380,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn test_storage_stage_process_entries() {
|
||||
logger::setup();
|
||||
solana_logger::setup();
|
||||
let keypair = Arc::new(Keypair::new());
|
||||
let exit = Arc::new(AtomicBool::new(false));
|
||||
|
||||
|
@ -445,7 +445,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn test_storage_stage_process_vote_entries() {
|
||||
logger::setup();
|
||||
solana_logger::setup();
|
||||
let keypair = Arc::new(Keypair::new());
|
||||
let exit = Arc::new(AtomicBool::new(false));
|
||||
|
||||
|
|
|
@ -430,7 +430,7 @@ mod tests {
|
|||
use crate::fullnode::Fullnode;
|
||||
use crate::leader_scheduler::LeaderScheduler;
|
||||
use crate::ledger::create_tmp_ledger_with_mint;
|
||||
use crate::logger;
|
||||
|
||||
use crate::mint::Mint;
|
||||
use bincode::deserialize;
|
||||
use solana_sdk::signature::{Keypair, KeypairUtil};
|
||||
|
@ -441,7 +441,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn test_thin_client() {
|
||||
logger::setup();
|
||||
solana_logger::setup();
|
||||
let leader_keypair = Arc::new(Keypair::new());
|
||||
let leader = Node::new_localhost_with_pubkey(leader_keypair.pubkey());
|
||||
let leader_data = leader.info.clone();
|
||||
|
@ -495,7 +495,7 @@ mod tests {
|
|||
#[test]
|
||||
#[ignore]
|
||||
fn test_bad_sig() {
|
||||
logger::setup();
|
||||
solana_logger::setup();
|
||||
let leader_keypair = Arc::new(Keypair::new());
|
||||
let leader = Node::new_localhost_with_pubkey(leader_keypair.pubkey());
|
||||
let alice = Mint::new(10_000);
|
||||
|
@ -552,7 +552,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn test_client_check_signature() {
|
||||
logger::setup();
|
||||
solana_logger::setup();
|
||||
let leader_keypair = Arc::new(Keypair::new());
|
||||
let leader = Node::new_localhost_with_pubkey(leader_keypair.pubkey());
|
||||
let alice = Mint::new(10_000);
|
||||
|
@ -597,7 +597,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn test_register_vote_account() {
|
||||
logger::setup();
|
||||
solana_logger::setup();
|
||||
let leader_keypair = Arc::new(Keypair::new());
|
||||
let leader = Node::new_localhost_with_pubkey(leader_keypair.pubkey());
|
||||
let mint = Mint::new(10_000);
|
||||
|
@ -680,7 +680,7 @@ mod tests {
|
|||
#[test]
|
||||
fn test_transaction_count() {
|
||||
// set a bogus address, see that we don't hang
|
||||
logger::setup();
|
||||
solana_logger::setup();
|
||||
let addr = "0.0.0.0:1234".parse().unwrap();
|
||||
let transactions_socket = UdpSocket::bind("0.0.0.0:0").unwrap();
|
||||
let mut client =
|
||||
|
@ -690,7 +690,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn test_zero_balance_after_nonzero() {
|
||||
logger::setup();
|
||||
solana_logger::setup();
|
||||
let leader_keypair = Arc::new(Keypair::new());
|
||||
let leader = Node::new_localhost_with_pubkey(leader_keypair.pubkey());
|
||||
let alice = Mint::new(10_000);
|
||||
|
|
|
@ -185,7 +185,7 @@ pub mod tests {
|
|||
use crate::gossip_service::GossipService;
|
||||
use crate::leader_scheduler::LeaderScheduler;
|
||||
use crate::ledger::get_tmp_ledger_path;
|
||||
use crate::logger;
|
||||
|
||||
use crate::mint::Mint;
|
||||
use crate::packet::SharedBlob;
|
||||
use crate::service::Service;
|
||||
|
@ -219,7 +219,7 @@ pub mod tests {
|
|||
#[test]
|
||||
#[ignore]
|
||||
fn test_replay() {
|
||||
logger::setup();
|
||||
solana_logger::setup();
|
||||
let leader = Node::new_localhost();
|
||||
let target1_keypair = Keypair::new();
|
||||
let target1 = Node::new_localhost_with_pubkey(target1_keypair.pubkey());
|
||||
|
|
|
@ -237,7 +237,7 @@ mod test {
|
|||
use crate::entry::Entry;
|
||||
use crate::leader_scheduler::LeaderScheduler;
|
||||
use crate::ledger::{get_tmp_ledger_path, make_consecutive_blobs};
|
||||
use crate::logger;
|
||||
|
||||
use crate::packet::{SharedBlob, PACKET_DATA_SIZE};
|
||||
use crate::streamer::{blob_receiver, responder};
|
||||
use crate::window_service::{repair_backoff, window_service};
|
||||
|
@ -267,7 +267,7 @@ mod test {
|
|||
|
||||
#[test]
|
||||
pub fn window_send_test() {
|
||||
logger::setup();
|
||||
solana_logger::setup();
|
||||
let tn = Node::new_localhost();
|
||||
let exit = Arc::new(AtomicBool::new(false));
|
||||
let mut cluster_info_me = ClusterInfo::new(tn.info.clone());
|
||||
|
@ -338,7 +338,7 @@ mod test {
|
|||
|
||||
#[test]
|
||||
pub fn window_send_leader_test2() {
|
||||
logger::setup();
|
||||
solana_logger::setup();
|
||||
let tn = Node::new_localhost();
|
||||
let exit = Arc::new(AtomicBool::new(false));
|
||||
let cluster_info_me = ClusterInfo::new(tn.info.clone());
|
||||
|
|
|
@ -4,7 +4,7 @@ extern crate log;
|
|||
use rayon::iter::*;
|
||||
use solana::cluster_info::{ClusterInfo, Node};
|
||||
use solana::gossip_service::GossipService;
|
||||
use solana::logger;
|
||||
|
||||
use solana::packet::{Blob, SharedBlob};
|
||||
use solana::result;
|
||||
use solana::service::Service;
|
||||
|
@ -61,7 +61,7 @@ where
|
|||
/// ring a -> b -> c -> d -> e -> a
|
||||
#[test]
|
||||
fn gossip_ring() -> result::Result<()> {
|
||||
logger::setup();
|
||||
solana_logger::setup();
|
||||
run_gossip_topo(50, |listen| {
|
||||
let num = listen.len();
|
||||
for n in 0..num {
|
||||
|
@ -82,7 +82,7 @@ fn gossip_ring() -> result::Result<()> {
|
|||
#[test]
|
||||
#[ignore]
|
||||
fn gossip_ring_large() -> result::Result<()> {
|
||||
logger::setup();
|
||||
solana_logger::setup();
|
||||
run_gossip_topo(600, |listen| {
|
||||
let num = listen.len();
|
||||
for n in 0..num {
|
||||
|
@ -101,7 +101,7 @@ fn gossip_ring_large() -> result::Result<()> {
|
|||
/// star a -> (b,c,d,e)
|
||||
#[test]
|
||||
fn gossip_star() {
|
||||
logger::setup();
|
||||
solana_logger::setup();
|
||||
run_gossip_topo(50, |listen| {
|
||||
let num = listen.len();
|
||||
for n in 0..(num - 1) {
|
||||
|
@ -120,7 +120,7 @@ fn gossip_star() {
|
|||
/// rstar a <- (b,c,d,e)
|
||||
#[test]
|
||||
fn gossip_rstar() {
|
||||
logger::setup();
|
||||
solana_logger::setup();
|
||||
run_gossip_topo(50, |listen| {
|
||||
let num = listen.len();
|
||||
let xd = {
|
||||
|
@ -139,7 +139,7 @@ fn gossip_rstar() {
|
|||
|
||||
#[test]
|
||||
pub fn cluster_info_retransmit() -> result::Result<()> {
|
||||
logger::setup();
|
||||
solana_logger::setup();
|
||||
let exit = Arc::new(AtomicBool::new(false));
|
||||
trace!("c1:");
|
||||
let (c1, dr1, tn1) = test_node(exit.clone());
|
||||
|
|
|
@ -248,7 +248,8 @@ impl LockTower {
|
|||
// hard coded to 100 nodes
|
||||
assert!(v <= 100);
|
||||
v > 50
|
||||
}).unwrap_or(true)
|
||||
})
|
||||
.unwrap_or(true)
|
||||
}
|
||||
pub fn score(&self, vote: &Vote, fork_tree: &HashMap<usize, Fork>) -> usize {
|
||||
let st = self.rollback_count(vote.time);
|
||||
|
|
|
@ -15,7 +15,7 @@ use solana::ledger::{
|
|||
create_tmp_genesis, create_tmp_sample_ledger, read_ledger, tmp_copy_ledger, LedgerWindow,
|
||||
LedgerWriter,
|
||||
};
|
||||
use solana::logger;
|
||||
|
||||
use solana::mint::Mint;
|
||||
use solana::packet::SharedBlob;
|
||||
use solana::poh_service::NUM_TICKS_PER_SECOND;
|
||||
|
@ -116,7 +116,7 @@ fn make_tiny_test_entries(start_hash: Hash, num: usize) -> Vec<Entry> {
|
|||
|
||||
#[test]
|
||||
fn test_multi_node_ledger_window() -> result::Result<()> {
|
||||
logger::setup();
|
||||
solana_logger::setup();
|
||||
|
||||
let leader_keypair = Arc::new(Keypair::new());
|
||||
let leader_pubkey = leader_keypair.pubkey().clone();
|
||||
|
@ -212,7 +212,7 @@ fn test_multi_node_ledger_window() -> result::Result<()> {
|
|||
#[test]
|
||||
#[ignore]
|
||||
fn test_multi_node_validator_catchup_from_zero() -> result::Result<()> {
|
||||
logger::setup();
|
||||
solana_logger::setup();
|
||||
const N: usize = 5;
|
||||
trace!("test_multi_node_validator_catchup_from_zero");
|
||||
let leader_keypair = Arc::new(Keypair::new());
|
||||
|
@ -358,7 +358,7 @@ fn test_multi_node_validator_catchup_from_zero() -> result::Result<()> {
|
|||
#[test]
|
||||
#[ignore]
|
||||
fn test_multi_node_basic() {
|
||||
logger::setup();
|
||||
solana_logger::setup();
|
||||
const N: usize = 5;
|
||||
trace!("test_multi_node_basic");
|
||||
let leader_keypair = Arc::new(Keypair::new());
|
||||
|
@ -439,7 +439,7 @@ fn test_multi_node_basic() {
|
|||
#[test]
|
||||
#[ignore]
|
||||
fn test_boot_validator_from_file() -> result::Result<()> {
|
||||
logger::setup();
|
||||
solana_logger::setup();
|
||||
let leader_keypair = Arc::new(Keypair::new());
|
||||
let leader_pubkey = leader_keypair.pubkey();
|
||||
let leader = Node::new_localhost_with_pubkey(leader_keypair.pubkey());
|
||||
|
@ -517,7 +517,7 @@ fn test_leader_restart_validator_start_from_old_ledger() -> result::Result<()> {
|
|||
// this test verifies that a freshly started leader makes his ledger available
|
||||
// in the repair window to validators that are started with an older
|
||||
// ledger (currently up to WINDOW_SIZE entries)
|
||||
logger::setup();
|
||||
solana_logger::setup();
|
||||
|
||||
let leader_keypair = Arc::new(Keypair::new());
|
||||
let initial_leader_balance = 500;
|
||||
|
@ -604,7 +604,7 @@ fn test_leader_restart_validator_start_from_old_ledger() -> result::Result<()> {
|
|||
#[test]
|
||||
#[ignore]
|
||||
fn test_multi_node_dynamic_network() {
|
||||
logger::setup();
|
||||
solana_logger::setup();
|
||||
assert!(cfg!(feature = "test"));
|
||||
let key = "SOLANA_DYNAMIC_NODES";
|
||||
let num_nodes: usize = match env::var(key) {
|
||||
|
@ -801,7 +801,7 @@ fn test_multi_node_dynamic_network() {
|
|||
|
||||
#[test]
|
||||
fn test_leader_to_validator_transition() {
|
||||
logger::setup();
|
||||
solana_logger::setup();
|
||||
let leader_rotation_interval = 20;
|
||||
|
||||
// Make a dummy validator id to be the next leader
|
||||
|
@ -929,7 +929,7 @@ fn test_leader_to_validator_transition() {
|
|||
|
||||
#[test]
|
||||
fn test_leader_validator_basic() {
|
||||
logger::setup();
|
||||
solana_logger::setup();
|
||||
let leader_rotation_interval = 10;
|
||||
|
||||
// Account that will be the sink for all the test's transactions
|
||||
|
@ -1109,11 +1109,11 @@ fn run_node(
|
|||
#[test]
|
||||
#[ignore]
|
||||
fn test_dropped_handoff_recovery() {
|
||||
logger::setup();
|
||||
solana_logger::setup();
|
||||
// The number of validators
|
||||
const N: usize = 3;
|
||||
assert!(N > 1);
|
||||
logger::setup();
|
||||
solana_logger::setup();
|
||||
|
||||
// Create the bootstrap leader node information
|
||||
let bootstrap_leader_keypair = Arc::new(Keypair::new());
|
||||
|
@ -1257,10 +1257,10 @@ fn test_dropped_handoff_recovery() {
|
|||
#[ignore]
|
||||
//TODO: Ignore for now due to bug exposed by the test "test_dropped_handoff_recovery"
|
||||
fn test_full_leader_validator_network() {
|
||||
logger::setup();
|
||||
solana_logger::setup();
|
||||
// The number of validators
|
||||
const N: usize = 5;
|
||||
logger::setup();
|
||||
solana_logger::setup();
|
||||
|
||||
// Create the bootstrap leader node information
|
||||
let bootstrap_leader_keypair = Keypair::new();
|
||||
|
@ -1509,10 +1509,10 @@ fn test_full_leader_validator_network() {
|
|||
|
||||
#[test]
|
||||
fn test_broadcast_last_tick() {
|
||||
logger::setup();
|
||||
solana_logger::setup();
|
||||
// The number of validators
|
||||
const N: usize = 5;
|
||||
logger::setup();
|
||||
solana_logger::setup();
|
||||
|
||||
// Create the bootstrap leader node information
|
||||
let bootstrap_leader_keypair = Keypair::new();
|
||||
|
|
|
@ -2,7 +2,7 @@ use solana;
|
|||
use solana_native_loader;
|
||||
|
||||
use solana::bank::Bank;
|
||||
use solana::logger;
|
||||
|
||||
use solana::mint::Mint;
|
||||
#[cfg(feature = "bpf_c")]
|
||||
use solana_sdk::bpf_loader;
|
||||
|
@ -177,7 +177,7 @@ impl Program {
|
|||
|
||||
#[test]
|
||||
fn test_program_native_noop() {
|
||||
logger::setup();
|
||||
solana_logger::setup();
|
||||
|
||||
let loader = Loader::new_native();
|
||||
let name = String::from("noop");
|
||||
|
@ -202,7 +202,7 @@ fn test_program_native_noop() {
|
|||
|
||||
#[test]
|
||||
fn test_program_lua_move_funds() {
|
||||
logger::setup();
|
||||
solana_logger::setup();
|
||||
|
||||
let loader = Loader::new_dynamic("solana_lua_loader");
|
||||
let userdata = r#"
|
||||
|
@ -269,7 +269,7 @@ fn test_program_lua_move_funds() {
|
|||
#[cfg(feature = "bpf_c")]
|
||||
#[test]
|
||||
fn test_program_builtin_bpf_noop() {
|
||||
logger::setup();
|
||||
solana_logger::setup();
|
||||
|
||||
let mut file = File::open(create_bpf_path("noop")).expect("file open failed");
|
||||
let mut elf = Vec::new();
|
||||
|
@ -297,7 +297,7 @@ fn test_program_builtin_bpf_noop() {
|
|||
#[cfg(feature = "bpf_c")]
|
||||
#[test]
|
||||
fn test_program_bpf_c() {
|
||||
logger::setup();
|
||||
solana_logger::setup();
|
||||
|
||||
let programs = [
|
||||
"noop",
|
||||
|
|
|
@ -16,6 +16,7 @@ dirs = "1.0.2"
|
|||
serde_json = "1.0.10"
|
||||
solana = { path = "..", version = "0.11.0" }
|
||||
solana-drone = { path = "../drone", version = "0.11.0" }
|
||||
solana-logger = { path = "../logger", version = "0.11.0" }
|
||||
solana-sdk = { path = "../sdk", version = "0.11.0" }
|
||||
|
||||
[features]
|
||||
|
|
|
@ -10,7 +10,7 @@ mod wallet;
|
|||
|
||||
use crate::wallet::{parse_command, process_command, WalletConfig, WalletError};
|
||||
use clap::{App, Arg, ArgMatches, SubCommand};
|
||||
use solana::logger;
|
||||
|
||||
use solana_sdk::signature::{gen_keypair_file, read_keypair, KeypairUtil};
|
||||
use std::error;
|
||||
use std::net::SocketAddr;
|
||||
|
@ -65,7 +65,7 @@ pub fn parse_args(matches: &ArgMatches<'_>) -> Result<WalletConfig, Box<dyn erro
|
|||
}
|
||||
|
||||
fn main() -> Result<(), Box<dyn error::Error>> {
|
||||
logger::setup();
|
||||
solana_logger::setup();
|
||||
let matches = App::new("solana-wallet")
|
||||
.version(crate_version!())
|
||||
.arg(
|
||||
|
|
Loading…
Reference in New Issue