Move Pubkey into its own module
This commit is contained in:
parent
c6d7cd2d33
commit
b7ae5b712a
|
@ -12,7 +12,8 @@ use solana::banking_stage::{BankingStage, NUM_THREADS};
|
||||||
use solana::entry::Entry;
|
use solana::entry::Entry;
|
||||||
use solana::mint::Mint;
|
use solana::mint::Mint;
|
||||||
use solana::packet::{to_packets_chunked, PacketRecycler};
|
use solana::packet::{to_packets_chunked, PacketRecycler};
|
||||||
use solana::signature::{KeypairUtil, Pubkey, Signature};
|
use solana::pubkey::Pubkey;
|
||||||
|
use solana::signature::{KeypairUtil, Signature};
|
||||||
use solana::system_transaction::SystemTransaction;
|
use solana::system_transaction::SystemTransaction;
|
||||||
use solana::transaction::Transaction;
|
use solana::transaction::Transaction;
|
||||||
use std::iter;
|
use std::iter;
|
||||||
|
|
|
@ -23,7 +23,7 @@ mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use bincode::serialize;
|
use bincode::serialize;
|
||||||
use solana::account::Account;
|
use solana::account::Account;
|
||||||
use solana::signature::Pubkey;
|
use solana::pubkey::Pubkey;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_move_funds() {
|
fn test_move_funds() {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use signature::Pubkey;
|
use pubkey::Pubkey;
|
||||||
|
|
||||||
/// An Account with userdata that is stored on chain
|
/// An Account with userdata that is stored on chain
|
||||||
#[derive(Serialize, Deserialize, Debug, Clone, Default)]
|
#[derive(Serialize, Deserialize, Debug, Clone, Default)]
|
||||||
|
|
|
@ -17,7 +17,8 @@ use ledger::Block;
|
||||||
use log::Level;
|
use log::Level;
|
||||||
use mint::Mint;
|
use mint::Mint;
|
||||||
use payment_plan::Payment;
|
use payment_plan::Payment;
|
||||||
use signature::{Keypair, Pubkey, Signature};
|
use pubkey::Pubkey;
|
||||||
|
use signature::{Keypair, Signature};
|
||||||
use std;
|
use std;
|
||||||
use std::collections::{BTreeMap, HashMap, VecDeque};
|
use std::collections::{BTreeMap, HashMap, VecDeque};
|
||||||
use std::result;
|
use std::result;
|
||||||
|
|
|
@ -283,8 +283,9 @@ mod tests {
|
||||||
use entry::Entry;
|
use entry::Entry;
|
||||||
use ledger::next_entries_mut;
|
use ledger::next_entries_mut;
|
||||||
use mint::Mint;
|
use mint::Mint;
|
||||||
|
use pubkey::Pubkey;
|
||||||
use service::Service;
|
use service::Service;
|
||||||
use signature::{Keypair, KeypairUtil, Pubkey};
|
use signature::{Keypair, KeypairUtil};
|
||||||
use std::cmp;
|
use std::cmp;
|
||||||
use std::sync::atomic::AtomicBool;
|
use std::sync::atomic::AtomicBool;
|
||||||
use std::sync::mpsc::{channel, Sender};
|
use std::sync::mpsc::{channel, Sender};
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
use chrono::prelude::*;
|
use chrono::prelude::*;
|
||||||
use payment_plan::{Payment, Witness};
|
use payment_plan::{Payment, Witness};
|
||||||
use signature::Pubkey;
|
use pubkey::Pubkey;
|
||||||
use std::mem;
|
use std::mem;
|
||||||
|
|
||||||
/// A data type representing a `Witness` that the payment plan is waiting on.
|
/// A data type representing a `Witness` that the payment plan is waiting on.
|
||||||
|
|
|
@ -5,7 +5,7 @@ use budget::Budget;
|
||||||
use budget_instruction::Instruction;
|
use budget_instruction::Instruction;
|
||||||
use chrono::prelude::{DateTime, Utc};
|
use chrono::prelude::{DateTime, Utc};
|
||||||
use payment_plan::Witness;
|
use payment_plan::Witness;
|
||||||
use signature::Pubkey;
|
use pubkey::Pubkey;
|
||||||
use std::io;
|
use std::io;
|
||||||
use transaction::Transaction;
|
use transaction::Transaction;
|
||||||
|
|
||||||
|
@ -271,7 +271,8 @@ mod test {
|
||||||
use budget_transaction::BudgetTransaction;
|
use budget_transaction::BudgetTransaction;
|
||||||
use chrono::prelude::{DateTime, NaiveDate, Utc};
|
use chrono::prelude::{DateTime, NaiveDate, Utc};
|
||||||
use hash::Hash;
|
use hash::Hash;
|
||||||
use signature::{GenKeys, Keypair, KeypairUtil, Pubkey};
|
use pubkey::Pubkey;
|
||||||
|
use signature::{GenKeys, Keypair, KeypairUtil};
|
||||||
use transaction::Transaction;
|
use transaction::Transaction;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
|
@ -7,7 +7,8 @@ use budget_program::BudgetState;
|
||||||
use chrono::prelude::*;
|
use chrono::prelude::*;
|
||||||
use hash::Hash;
|
use hash::Hash;
|
||||||
use payment_plan::Payment;
|
use payment_plan::Payment;
|
||||||
use signature::{Keypair, Pubkey};
|
use pubkey::Pubkey;
|
||||||
|
use signature::Keypair;
|
||||||
use transaction::Transaction;
|
use transaction::Transaction;
|
||||||
|
|
||||||
pub trait BudgetTransaction {
|
pub trait BudgetTransaction {
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
use crdt::{CrdtError, NodeInfo};
|
use crdt::{CrdtError, NodeInfo};
|
||||||
|
use pubkey::Pubkey;
|
||||||
use rand::distributions::{Distribution, Weighted, WeightedChoice};
|
use rand::distributions::{Distribution, Weighted, WeightedChoice};
|
||||||
use rand::thread_rng;
|
use rand::thread_rng;
|
||||||
use result::Result;
|
use result::Result;
|
||||||
use signature::Pubkey;
|
|
||||||
use std;
|
use std;
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
|
||||||
|
@ -192,7 +192,8 @@ impl<'a> ChooseGossipPeerStrategy for ChooseWeightedPeerStrategy<'a> {
|
||||||
mod tests {
|
mod tests {
|
||||||
use choose_gossip_peer_strategy::{ChooseWeightedPeerStrategy, DEFAULT_WEIGHT};
|
use choose_gossip_peer_strategy::{ChooseWeightedPeerStrategy, DEFAULT_WEIGHT};
|
||||||
use logger;
|
use logger;
|
||||||
use signature::{Keypair, KeypairUtil, Pubkey};
|
use pubkey::Pubkey;
|
||||||
|
use signature::{Keypair, KeypairUtil};
|
||||||
use std;
|
use std;
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
|
||||||
|
|
|
@ -21,10 +21,11 @@ use ledger::LedgerWindow;
|
||||||
use log::Level;
|
use log::Level;
|
||||||
use netutil::{bind_in_range, bind_to, multi_bind_in_range};
|
use netutil::{bind_in_range, bind_to, multi_bind_in_range};
|
||||||
use packet::{to_blob, Blob, BlobRecycler, SharedBlob, BLOB_SIZE};
|
use packet::{to_blob, Blob, BlobRecycler, SharedBlob, BLOB_SIZE};
|
||||||
|
use pubkey::Pubkey;
|
||||||
use rand::{thread_rng, Rng};
|
use rand::{thread_rng, Rng};
|
||||||
use rayon::prelude::*;
|
use rayon::prelude::*;
|
||||||
use result::{Error, Result};
|
use result::{Error, Result};
|
||||||
use signature::{Keypair, KeypairUtil, Pubkey};
|
use signature::{Keypair, KeypairUtil};
|
||||||
use std;
|
use std;
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::net::{IpAddr, Ipv4Addr, SocketAddr, UdpSocket};
|
use std::net::{IpAddr, Ipv4Addr, SocketAddr, UdpSocket};
|
||||||
|
@ -1408,8 +1409,9 @@ mod tests {
|
||||||
use ledger::{LedgerWindow, LedgerWriter};
|
use ledger::{LedgerWindow, LedgerWriter};
|
||||||
use logger;
|
use logger;
|
||||||
use packet::BlobRecycler;
|
use packet::BlobRecycler;
|
||||||
|
use pubkey::Pubkey;
|
||||||
use result::Error;
|
use result::Error;
|
||||||
use signature::{Keypair, KeypairUtil, Pubkey};
|
use signature::{Keypair, KeypairUtil};
|
||||||
use std::fs::remove_dir_all;
|
use std::fs::remove_dir_all;
|
||||||
use std::net::{IpAddr, Ipv4Addr, SocketAddr};
|
use std::net::{IpAddr, Ipv4Addr, SocketAddr};
|
||||||
use std::sync::atomic::{AtomicBool, Ordering};
|
use std::sync::atomic::{AtomicBool, Ordering};
|
||||||
|
|
|
@ -8,8 +8,8 @@ use bincode::{deserialize, serialize};
|
||||||
use bytes::Bytes;
|
use bytes::Bytes;
|
||||||
use influx_db_client as influxdb;
|
use influx_db_client as influxdb;
|
||||||
use metrics;
|
use metrics;
|
||||||
use signature::Signature;
|
use pubkey::Pubkey;
|
||||||
use signature::{Keypair, Pubkey};
|
use signature::{Keypair, Signature};
|
||||||
use std::io;
|
use std::io;
|
||||||
use std::io::{Error, ErrorKind};
|
use std::io::{Error, ErrorKind};
|
||||||
use std::net::{IpAddr, Ipv4Addr, SocketAddr, UdpSocket};
|
use std::net::{IpAddr, Ipv4Addr, SocketAddr, UdpSocket};
|
||||||
|
|
|
@ -4,7 +4,7 @@ extern crate generic_array;
|
||||||
use account::Account;
|
use account::Account;
|
||||||
use libc;
|
use libc;
|
||||||
use libloading;
|
use libloading;
|
||||||
use signature::Pubkey;
|
use pubkey::Pubkey;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
|
||||||
#[cfg(debug_assertions)]
|
#[cfg(debug_assertions)]
|
||||||
|
@ -107,7 +107,7 @@ mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use account::Account;
|
use account::Account;
|
||||||
use bincode::serialize;
|
use bincode::serialize;
|
||||||
use signature::Pubkey;
|
use pubkey::Pubkey;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
use std::thread;
|
use std::thread;
|
||||||
|
|
||||||
|
|
|
@ -7,8 +7,8 @@ use budget_transaction::BudgetTransaction;
|
||||||
use hash::Hash;
|
use hash::Hash;
|
||||||
use packet::{BlobRecycler, SharedBlob, BLOB_DATA_SIZE};
|
use packet::{BlobRecycler, SharedBlob, BLOB_DATA_SIZE};
|
||||||
use poh::Poh;
|
use poh::Poh;
|
||||||
|
use pubkey::Pubkey;
|
||||||
use rayon::prelude::*;
|
use rayon::prelude::*;
|
||||||
use signature::Pubkey;
|
|
||||||
use std::io::Cursor;
|
use std::io::Cursor;
|
||||||
use std::net::SocketAddr;
|
use std::net::SocketAddr;
|
||||||
use std::sync::mpsc::{Receiver, Sender};
|
use std::sync::mpsc::{Receiver, Sender};
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// Support erasure coding
|
// Support erasure coding
|
||||||
use packet::{BlobRecycler, SharedBlob, BLOB_DATA_SIZE, BLOB_HEADER_SIZE};
|
use packet::{BlobRecycler, SharedBlob, BLOB_DATA_SIZE, BLOB_HEADER_SIZE};
|
||||||
use signature::Pubkey;
|
use pubkey::Pubkey;
|
||||||
use std::cmp;
|
use std::cmp;
|
||||||
use std::mem;
|
use std::mem;
|
||||||
use std::result;
|
use std::result;
|
||||||
|
@ -603,8 +603,9 @@ mod test {
|
||||||
use erasure;
|
use erasure;
|
||||||
use logger;
|
use logger;
|
||||||
use packet::{BlobRecycler, BLOB_DATA_SIZE, BLOB_HEADER_SIZE, BLOB_SIZE};
|
use packet::{BlobRecycler, BLOB_DATA_SIZE, BLOB_HEADER_SIZE, BLOB_SIZE};
|
||||||
|
use pubkey::Pubkey;
|
||||||
use rand::{thread_rng, Rng};
|
use rand::{thread_rng, Rng};
|
||||||
use signature::{Keypair, KeypairUtil, Pubkey};
|
use signature::{Keypair, KeypairUtil};
|
||||||
// use std::sync::{Arc, RwLock};
|
// use std::sync::{Arc, RwLock};
|
||||||
use window::{index_blobs, WindowSlot};
|
use window::{index_blobs, WindowSlot};
|
||||||
|
|
||||||
|
|
|
@ -7,10 +7,11 @@ use drone::DRONE_PORT;
|
||||||
use entry::Entry;
|
use entry::Entry;
|
||||||
use ledger::read_ledger;
|
use ledger::read_ledger;
|
||||||
use ncp::Ncp;
|
use ncp::Ncp;
|
||||||
|
use pubkey::Pubkey;
|
||||||
use rpc::{JsonRpcService, RPC_PORT};
|
use rpc::{JsonRpcService, RPC_PORT};
|
||||||
use rpu::Rpu;
|
use rpu::Rpu;
|
||||||
use service::Service;
|
use service::Service;
|
||||||
use signature::{Keypair, KeypairUtil, Pubkey};
|
use signature::{Keypair, KeypairUtil};
|
||||||
use std::net::UdpSocket;
|
use std::net::UdpSocket;
|
||||||
use std::net::{IpAddr, Ipv4Addr, SocketAddr};
|
use std::net::{IpAddr, Ipv4Addr, SocketAddr};
|
||||||
use std::sync::atomic::{AtomicBool, Ordering};
|
use std::sync::atomic::{AtomicBool, Ordering};
|
||||||
|
|
|
@ -11,9 +11,9 @@ use log::Level::Trace;
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
use mint::Mint;
|
use mint::Mint;
|
||||||
use packet::{self, SharedBlob, BLOB_DATA_SIZE};
|
use packet::{self, SharedBlob, BLOB_DATA_SIZE};
|
||||||
|
use pubkey::Pubkey;
|
||||||
use rayon::prelude::*;
|
use rayon::prelude::*;
|
||||||
use result::{Error, Result};
|
use result::{Error, Result};
|
||||||
use signature::Pubkey;
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
use signature::{Keypair, KeypairUtil};
|
use signature::{Keypair, KeypairUtil};
|
||||||
use std::fs::{create_dir_all, remove_dir_all, File, OpenOptions};
|
use std::fs::{create_dir_all, remove_dir_all, File, OpenOptions};
|
||||||
|
|
|
@ -41,6 +41,7 @@ pub mod packet;
|
||||||
pub mod payment_plan;
|
pub mod payment_plan;
|
||||||
pub mod poh;
|
pub mod poh;
|
||||||
pub mod poh_recorder;
|
pub mod poh_recorder;
|
||||||
|
pub mod pubkey;
|
||||||
pub mod recvmmsg;
|
pub mod recvmmsg;
|
||||||
pub mod recycler;
|
pub mod recycler;
|
||||||
pub mod replicate_stage;
|
pub mod replicate_stage;
|
||||||
|
|
|
@ -2,8 +2,9 @@
|
||||||
|
|
||||||
use entry::Entry;
|
use entry::Entry;
|
||||||
use hash::{hash, Hash};
|
use hash::{hash, Hash};
|
||||||
|
use pubkey::Pubkey;
|
||||||
use ring::rand::SystemRandom;
|
use ring::rand::SystemRandom;
|
||||||
use signature::{Keypair, KeypairUtil, Pubkey};
|
use signature::{Keypair, KeypairUtil};
|
||||||
use system_transaction::SystemTransaction;
|
use system_transaction::SystemTransaction;
|
||||||
use transaction::Transaction;
|
use transaction::Transaction;
|
||||||
use untrusted::Input;
|
use untrusted::Input;
|
||||||
|
|
|
@ -7,11 +7,11 @@ use hash::Hash;
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
use ledger::{next_entries_mut, Block};
|
use ledger::{next_entries_mut, Block};
|
||||||
use log::Level;
|
use log::Level;
|
||||||
|
use pubkey::Pubkey;
|
||||||
use recvmmsg::{recv_mmsg, NUM_RCVMMSGS};
|
use recvmmsg::{recv_mmsg, NUM_RCVMMSGS};
|
||||||
use recycler;
|
use recycler;
|
||||||
use result::{Error, Result};
|
use result::{Error, Result};
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
use signature::Pubkey;
|
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::io;
|
use std::io;
|
||||||
use std::mem::size_of;
|
use std::mem::size_of;
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
//! `Payment`, the payment is executed.
|
//! `Payment`, the payment is executed.
|
||||||
|
|
||||||
use chrono::prelude::*;
|
use chrono::prelude::*;
|
||||||
use signature::Pubkey;
|
use pubkey::Pubkey;
|
||||||
|
|
||||||
/// The types of events a payment plan can process.
|
/// The types of events a payment plan can process.
|
||||||
#[derive(Serialize, Deserialize, Debug, PartialEq, Eq, Clone)]
|
#[derive(Serialize, Deserialize, Debug, PartialEq, Eq, Clone)]
|
||||||
|
|
|
@ -0,0 +1,31 @@
|
||||||
|
use bs58;
|
||||||
|
use generic_array::typenum::U32;
|
||||||
|
use generic_array::GenericArray;
|
||||||
|
use std::fmt;
|
||||||
|
|
||||||
|
#[derive(Serialize, Deserialize, Clone, Copy, Default, Eq, PartialEq, Ord, PartialOrd, Hash)]
|
||||||
|
pub struct Pubkey(GenericArray<u8, U32>);
|
||||||
|
|
||||||
|
impl Pubkey {
|
||||||
|
pub fn new(pubkey_vec: &[u8]) -> Self {
|
||||||
|
Pubkey(GenericArray::clone_from_slice(&pubkey_vec))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl AsRef<[u8]> for Pubkey {
|
||||||
|
fn as_ref(&self) -> &[u8] {
|
||||||
|
&self.0[..]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl fmt::Debug for Pubkey {
|
||||||
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
|
write!(f, "{}", bs58::encode(self.0).into_string())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl fmt::Display for Pubkey {
|
||||||
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
|
write!(f, "{}", bs58::encode(self.0).into_string())
|
||||||
|
}
|
||||||
|
}
|
|
@ -2,7 +2,8 @@
|
||||||
|
|
||||||
use account::Account;
|
use account::Account;
|
||||||
use hash::Hash;
|
use hash::Hash;
|
||||||
use signature::{Pubkey, Signature};
|
use pubkey::Pubkey;
|
||||||
|
use signature::Signature;
|
||||||
|
|
||||||
#[cfg_attr(feature = "cargo-clippy", allow(large_enum_variant))]
|
#[cfg_attr(feature = "cargo-clippy", allow(large_enum_variant))]
|
||||||
#[derive(Serialize, Deserialize, Debug, Clone, Copy)]
|
#[derive(Serialize, Deserialize, Debug, Clone, Copy)]
|
||||||
|
|
|
@ -6,8 +6,9 @@ use bincode::deserialize;
|
||||||
use bs58;
|
use bs58;
|
||||||
use jsonrpc_core::*;
|
use jsonrpc_core::*;
|
||||||
use jsonrpc_http_server::*;
|
use jsonrpc_http_server::*;
|
||||||
|
use pubkey::Pubkey;
|
||||||
use service::Service;
|
use service::Service;
|
||||||
use signature::{Pubkey, Signature};
|
use signature::Signature;
|
||||||
use std::mem;
|
use std::mem;
|
||||||
use std::net::{SocketAddr, UdpSocket};
|
use std::net::{SocketAddr, UdpSocket};
|
||||||
use std::result;
|
use std::result;
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
//! The `signature` module provides functionality for public, and private keys.
|
//! The `signature` module provides functionality for public, and private keys.
|
||||||
|
|
||||||
use bs58;
|
use bs58;
|
||||||
use generic_array::typenum::{U32, U64};
|
use generic_array::typenum::U64;
|
||||||
use generic_array::GenericArray;
|
use generic_array::GenericArray;
|
||||||
|
use pubkey::Pubkey;
|
||||||
use rand::{ChaChaRng, Rng, SeedableRng};
|
use rand::{ChaChaRng, Rng, SeedableRng};
|
||||||
use rayon::prelude::*;
|
use rayon::prelude::*;
|
||||||
use ring::signature::Ed25519KeyPair;
|
use ring::signature::Ed25519KeyPair;
|
||||||
|
@ -14,32 +15,6 @@ use std::fs::File;
|
||||||
use untrusted::Input;
|
use untrusted::Input;
|
||||||
|
|
||||||
pub type Keypair = Ed25519KeyPair;
|
pub type Keypair = Ed25519KeyPair;
|
||||||
#[derive(Serialize, Deserialize, Clone, Copy, Default, Eq, PartialEq, Ord, PartialOrd, Hash)]
|
|
||||||
pub struct Pubkey(GenericArray<u8, U32>);
|
|
||||||
|
|
||||||
impl Pubkey {
|
|
||||||
pub fn new(pubkey_vec: &[u8]) -> Self {
|
|
||||||
Pubkey(GenericArray::clone_from_slice(&pubkey_vec))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl AsRef<[u8]> for Pubkey {
|
|
||||||
fn as_ref(&self) -> &[u8] {
|
|
||||||
&self.0[..]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl fmt::Debug for Pubkey {
|
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
|
||||||
write!(f, "{}", bs58::encode(self.0).into_string())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl fmt::Display for Pubkey {
|
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
|
||||||
write!(f, "{}", bs58::encode(self.0).into_string())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Clone, Copy, Default, Eq, PartialEq, Ord, PartialOrd, Hash)]
|
#[derive(Serialize, Deserialize, Clone, Copy, Default, Eq, PartialEq, Ord, PartialOrd, Hash)]
|
||||||
pub struct Signature(GenericArray<u8, U64>);
|
pub struct Signature(GenericArray<u8, U64>);
|
||||||
|
@ -89,7 +64,7 @@ impl KeypairUtil for Ed25519KeyPair {
|
||||||
|
|
||||||
/// Return the public key for the given keypair
|
/// Return the public key for the given keypair
|
||||||
fn pubkey(&self) -> Pubkey {
|
fn pubkey(&self) -> Pubkey {
|
||||||
Pubkey(GenericArray::clone_from_slice(self.public_key_bytes()))
|
Pubkey::new(self.public_key_bytes())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,8 +43,9 @@ pub fn init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn verify_packet(packet: &Packet) -> u8 {
|
fn verify_packet(packet: &Packet) -> u8 {
|
||||||
|
use pubkey::Pubkey;
|
||||||
use ring::signature;
|
use ring::signature;
|
||||||
use signature::{Pubkey, Signature};
|
use signature::Signature;
|
||||||
use untrusted;
|
use untrusted;
|
||||||
|
|
||||||
let msg_start = TX_OFFSET + SIGNED_DATA_OFFSET;
|
let msg_start = TX_OFFSET + SIGNED_DATA_OFFSET;
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
use account::Account;
|
use account::Account;
|
||||||
use bincode::deserialize;
|
use bincode::deserialize;
|
||||||
use signature::Pubkey;
|
use pubkey::Pubkey;
|
||||||
use transaction::Transaction;
|
use transaction::Transaction;
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Debug, Clone)]
|
#[derive(Serialize, Deserialize, Debug, Clone)]
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
use account::Account;
|
use account::Account;
|
||||||
use bincode::deserialize;
|
use bincode::deserialize;
|
||||||
use dynamic_program::DynamicProgram;
|
use dynamic_program::DynamicProgram;
|
||||||
use signature::Pubkey;
|
use pubkey::Pubkey;
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::sync::RwLock;
|
use std::sync::RwLock;
|
||||||
use transaction::Transaction;
|
use transaction::Transaction;
|
||||||
|
@ -101,7 +101,8 @@ mod test {
|
||||||
use bincode::serialize;
|
use bincode::serialize;
|
||||||
use dynamic_program::KeyedAccount;
|
use dynamic_program::KeyedAccount;
|
||||||
use hash::Hash;
|
use hash::Hash;
|
||||||
use signature::{Keypair, KeypairUtil, Pubkey};
|
use pubkey::Pubkey;
|
||||||
|
use signature::{Keypair, KeypairUtil};
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::sync::RwLock;
|
use std::sync::RwLock;
|
||||||
use std::thread;
|
use std::thread;
|
||||||
|
|
|
@ -2,7 +2,8 @@
|
||||||
|
|
||||||
use bincode::serialize;
|
use bincode::serialize;
|
||||||
use hash::Hash;
|
use hash::Hash;
|
||||||
use signature::{Keypair, KeypairUtil, Pubkey};
|
use pubkey::Pubkey;
|
||||||
|
use signature::{Keypair, KeypairUtil};
|
||||||
use system_program::SystemProgram;
|
use system_program::SystemProgram;
|
||||||
use transaction::Transaction;
|
use transaction::Transaction;
|
||||||
|
|
||||||
|
|
|
@ -10,9 +10,10 @@ use crdt::{Crdt, CrdtError, NodeInfo};
|
||||||
use hash::Hash;
|
use hash::Hash;
|
||||||
use log::Level;
|
use log::Level;
|
||||||
use ncp::Ncp;
|
use ncp::Ncp;
|
||||||
|
use pubkey::Pubkey;
|
||||||
use request::{Request, Response};
|
use request::{Request, Response};
|
||||||
use result::{Error, Result};
|
use result::{Error, Result};
|
||||||
use signature::{Keypair, Pubkey, Signature};
|
use signature::{Keypair, Signature};
|
||||||
use std;
|
use std;
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::io;
|
use std::io;
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
//! tic-tac-toe program
|
//! tic-tac-toe program
|
||||||
|
|
||||||
use account::Account;
|
use account::Account;
|
||||||
|
use pubkey::Pubkey;
|
||||||
use serde_cbor;
|
use serde_cbor;
|
||||||
use signature::Pubkey;
|
|
||||||
use std;
|
use std;
|
||||||
use transaction::Transaction;
|
use transaction::Transaction;
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,8 @@
|
||||||
|
|
||||||
use bincode::serialize;
|
use bincode::serialize;
|
||||||
use hash::{Hash, Hasher};
|
use hash::{Hash, Hasher};
|
||||||
use signature::{Keypair, KeypairUtil, Pubkey, Signature};
|
use pubkey::Pubkey;
|
||||||
|
use signature::{Keypair, KeypairUtil, Signature};
|
||||||
use std::mem::size_of;
|
use std::mem::size_of;
|
||||||
|
|
||||||
pub const SIGNED_DATA_OFFSET: usize = size_of::<Signature>();
|
pub const SIGNED_DATA_OFFSET: usize = size_of::<Signature>();
|
||||||
|
|
|
@ -10,8 +10,9 @@ use influx_db_client as influxdb;
|
||||||
use log::Level;
|
use log::Level;
|
||||||
use metrics;
|
use metrics;
|
||||||
use packet::{BlobRecycler, SharedBlob};
|
use packet::{BlobRecycler, SharedBlob};
|
||||||
|
use pubkey::Pubkey;
|
||||||
use result::Result;
|
use result::Result;
|
||||||
use signature::{Keypair, Pubkey};
|
use signature::Keypair;
|
||||||
use std::result;
|
use std::result;
|
||||||
use std::sync::atomic::AtomicUsize;
|
use std::sync::atomic::AtomicUsize;
|
||||||
use std::sync::{Arc, RwLock};
|
use std::sync::{Arc, RwLock};
|
||||||
|
|
|
@ -8,12 +8,13 @@ use crdt::NodeInfo;
|
||||||
use drone::DroneRequest;
|
use drone::DroneRequest;
|
||||||
use fullnode::Config;
|
use fullnode::Config;
|
||||||
use hash::Hash;
|
use hash::Hash;
|
||||||
|
use pubkey::Pubkey;
|
||||||
use reqwest;
|
use reqwest;
|
||||||
use reqwest::header::CONTENT_TYPE;
|
use reqwest::header::CONTENT_TYPE;
|
||||||
use ring::rand::SystemRandom;
|
use ring::rand::SystemRandom;
|
||||||
use ring::signature::Ed25519KeyPair;
|
use ring::signature::Ed25519KeyPair;
|
||||||
use serde_json::{self, Value};
|
use serde_json::{self, Value};
|
||||||
use signature::{Keypair, KeypairUtil, Pubkey, Signature};
|
use signature::{Keypair, KeypairUtil, Signature};
|
||||||
use std::fs::{self, File};
|
use std::fs::{self, File};
|
||||||
use std::io::prelude::*;
|
use std::io::prelude::*;
|
||||||
use std::io::{Error, ErrorKind, Write};
|
use std::io::{Error, ErrorKind, Write};
|
||||||
|
|
|
@ -8,8 +8,8 @@ use erasure;
|
||||||
use ledger::{reconstruct_entries_from_blobs, Block};
|
use ledger::{reconstruct_entries_from_blobs, Block};
|
||||||
use log::Level;
|
use log::Level;
|
||||||
use packet::{BlobRecycler, SharedBlob};
|
use packet::{BlobRecycler, SharedBlob};
|
||||||
|
use pubkey::Pubkey;
|
||||||
use result::Result;
|
use result::Result;
|
||||||
use signature::Pubkey;
|
|
||||||
use std::cmp;
|
use std::cmp;
|
||||||
use std::mem;
|
use std::mem;
|
||||||
use std::net::SocketAddr;
|
use std::net::SocketAddr;
|
||||||
|
@ -450,7 +450,7 @@ pub fn new_window_from_entries(
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test {
|
mod test {
|
||||||
use packet::{Blob, BlobRecycler, Packet, Packets, PACKET_DATA_SIZE};
|
use packet::{Blob, BlobRecycler, Packet, Packets, PACKET_DATA_SIZE};
|
||||||
use signature::Pubkey;
|
use pubkey::Pubkey;
|
||||||
use std::io;
|
use std::io;
|
||||||
use std::io::Write;
|
use std::io::Write;
|
||||||
use std::net::UdpSocket;
|
use std::net::UdpSocket;
|
||||||
|
|
|
@ -5,9 +5,9 @@ use crdt::{Crdt, NodeInfo};
|
||||||
use entry::EntrySender;
|
use entry::EntrySender;
|
||||||
use log::Level;
|
use log::Level;
|
||||||
use packet::{BlobRecycler, SharedBlob};
|
use packet::{BlobRecycler, SharedBlob};
|
||||||
|
use pubkey::Pubkey;
|
||||||
use rand::{thread_rng, Rng};
|
use rand::{thread_rng, Rng};
|
||||||
use result::{Error, Result};
|
use result::{Error, Result};
|
||||||
use signature::Pubkey;
|
|
||||||
use std::net::UdpSocket;
|
use std::net::UdpSocket;
|
||||||
use std::sync::atomic::{AtomicBool, AtomicUsize, Ordering};
|
use std::sync::atomic::{AtomicBool, AtomicUsize, Ordering};
|
||||||
use std::sync::mpsc::RecvTimeoutError;
|
use std::sync::mpsc::RecvTimeoutError;
|
||||||
|
|
|
@ -299,8 +299,9 @@ mod tests {
|
||||||
use entry::Entry;
|
use entry::Entry;
|
||||||
use hash::Hash;
|
use hash::Hash;
|
||||||
use ledger::{genesis, next_entries_mut, read_ledger};
|
use ledger::{genesis, next_entries_mut, read_ledger};
|
||||||
|
use pubkey::Pubkey;
|
||||||
use service::Service;
|
use service::Service;
|
||||||
use signature::{Keypair, KeypairUtil, Pubkey};
|
use signature::{Keypair, KeypairUtil};
|
||||||
use std::fs::remove_dir_all;
|
use std::fs::remove_dir_all;
|
||||||
use std::sync::mpsc::{channel, Receiver, Sender};
|
use std::sync::mpsc::{channel, Receiver, Sender};
|
||||||
use std::sync::{Arc, RwLock};
|
use std::sync::{Arc, RwLock};
|
||||||
|
|
|
@ -13,9 +13,10 @@ use solana::ledger::{read_ledger, LedgerWriter};
|
||||||
use solana::logger;
|
use solana::logger;
|
||||||
use solana::mint::Mint;
|
use solana::mint::Mint;
|
||||||
use solana::ncp::Ncp;
|
use solana::ncp::Ncp;
|
||||||
|
use solana::pubkey::Pubkey;
|
||||||
use solana::result;
|
use solana::result;
|
||||||
use solana::service::Service;
|
use solana::service::Service;
|
||||||
use solana::signature::{Keypair, KeypairUtil, Pubkey};
|
use solana::signature::{Keypair, KeypairUtil};
|
||||||
use solana::thin_client::ThinClient;
|
use solana::thin_client::ThinClient;
|
||||||
use solana::timing::{duration_as_ms, duration_as_s};
|
use solana::timing::{duration_as_ms, duration_as_s};
|
||||||
use solana::window::{default_window, WINDOW_SIZE};
|
use solana::window::{default_window, WINDOW_SIZE};
|
||||||
|
|
Loading…
Reference in New Issue