unfork dalek ed25519 (#6776)

This commit is contained in:
Rob Walker 2019-11-07 17:08:10 -08:00 committed by GitHub
parent 20a52f153b
commit b64b54f48f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 105 additions and 91 deletions

25
Cargo.lock generated
View File

@ -3281,6 +3281,7 @@ dependencies = [
"core_affinity 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)", "core_affinity 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)",
"crc 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "crc 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
"crossbeam-channel 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "crossbeam-channel 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
"ed25519-dalek 1.0.0-pre.1 (registry+https://github.com/rust-lang/crates.io-index)",
"fs_extra 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "fs_extra 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"hex-literal 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "hex-literal 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"indexmap 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "indexmap 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -3312,7 +3313,6 @@ dependencies = [
"solana-chacha-sys 0.21.0", "solana-chacha-sys 0.21.0",
"solana-client 0.21.0", "solana-client 0.21.0",
"solana-drone 0.21.0", "solana-drone 0.21.0",
"solana-ed25519-dalek 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"solana-ledger 0.21.0", "solana-ledger 0.21.0",
"solana-logger 0.21.0", "solana-logger 0.21.0",
"solana-measure 0.21.0", "solana-measure 0.21.0",
@ -3347,6 +3347,7 @@ dependencies = [
"bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)",
"cc 1.0.47 (registry+https://github.com/rust-lang/crates.io-index)", "cc 1.0.47 (registry+https://github.com/rust-lang/crates.io-index)",
"curve25519-dalek 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "curve25519-dalek 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
"ed25519-dalek 1.0.0-pre.1 (registry+https://github.com/rust-lang/crates.io-index)",
"either 1.5.3 (registry+https://github.com/rust-lang/crates.io-index)", "either 1.5.3 (registry+https://github.com/rust-lang/crates.io-index)",
"failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -3355,7 +3356,6 @@ dependencies = [
"regex-syntax 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", "regex-syntax 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)",
"reqwest 0.9.22 (registry+https://github.com/rust-lang/crates.io-index)", "reqwest 0.9.22 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)",
"solana-ed25519-dalek 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"syn 0.15.42 (registry+https://github.com/rust-lang/crates.io-index)", "syn 0.15.42 (registry+https://github.com/rust-lang/crates.io-index)",
"syn 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "syn 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio 0.1.22 (registry+https://github.com/rust-lang/crates.io-index)", "tokio 0.1.22 (registry+https://github.com/rust-lang/crates.io-index)",
@ -3380,19 +3380,6 @@ dependencies = [
"tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]]
name = "solana-ed25519-dalek"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"clear_on_drop 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
"curve25519-dalek 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
"failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)",
"sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]] [[package]]
name = "solana-exchange-api" name = "solana-exchange-api"
version = "0.21.0" version = "0.21.0"
@ -3549,6 +3536,7 @@ dependencies = [
"dir-diff 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "dir-diff 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"dlopen 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "dlopen 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
"dlopen_derive 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "dlopen_derive 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"ed25519-dalek 1.0.0-pre.1 (registry+https://github.com/rust-lang/crates.io-index)",
"fs_extra 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "fs_extra 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"itertools 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "itertools 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -3563,7 +3551,6 @@ dependencies = [
"serde_derive 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)",
"sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
"solana-budget-api 0.21.0", "solana-budget-api 0.21.0",
"solana-ed25519-dalek 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"solana-genesis-programs 0.21.0", "solana-genesis-programs 0.21.0",
"solana-logger 0.21.0", "solana-logger 0.21.0",
"solana-measure 0.21.0", "solana-measure 0.21.0",
@ -3849,6 +3836,7 @@ dependencies = [
"bs58 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "bs58 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"chrono 0.4.9 (registry+https://github.com/rust-lang/crates.io-index)", "chrono 0.4.9 (registry+https://github.com/rust-lang/crates.io-index)",
"ed25519-dalek 1.0.0-pre.1 (registry+https://github.com/rust-lang/crates.io-index)",
"generic-array 0.13.2 (registry+https://github.com/rust-lang/crates.io-index)", "generic-array 0.13.2 (registry+https://github.com/rust-lang/crates.io-index)",
"hex 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "hex 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"itertools 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "itertools 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
@ -3865,7 +3853,6 @@ dependencies = [
"serde_json 1.0.41 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.41 (registry+https://github.com/rust-lang/crates.io-index)",
"sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
"solana-crate-features 0.21.0", "solana-crate-features 0.21.0",
"solana-ed25519-dalek 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"solana-logger 0.21.0", "solana-logger 0.21.0",
"untrusted 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "untrusted 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
@ -3877,10 +3864,11 @@ dependencies = [
"bincode 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "bincode 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"bs58 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "bs58 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cbindgen 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", "cbindgen 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
"ed25519-dalek 1.0.0-pre.1 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)",
"rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"solana-ed25519-dalek 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
"solana-sdk 0.21.0", "solana-sdk 0.21.0",
] ]
@ -5716,7 +5704,6 @@ dependencies = [
"checksum slog-term 2.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cb9b3fd9a3c2c86580fce3558a98ed7c69039da0288b08a3f15b371635254e08" "checksum slog-term 2.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cb9b3fd9a3c2c86580fce3558a98ed7c69039da0288b08a3f15b371635254e08"
"checksum smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)" = "ab606a9c5e214920bb66c458cd7be8ef094f813f20fe77a54cc7dbfff220d4b7" "checksum smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)" = "ab606a9c5e214920bb66c458cd7be8ef094f813f20fe77a54cc7dbfff220d4b7"
"checksum socket2 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)" = "e8b74de517221a2cb01a53349cf54182acdc31a074727d3079068448c0676d85" "checksum socket2 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)" = "e8b74de517221a2cb01a53349cf54182acdc31a074727d3079068448c0676d85"
"checksum solana-ed25519-dalek 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1c21f9d5aa62959872194dfd086feb4e8efec1c2589d27e6a0339904759e99fc"
"checksum solana-reed-solomon-erasure 4.0.1-3 (registry+https://github.com/rust-lang/crates.io-index)" = "d5b3ab3f4dd12af687a7d0d0ee73299cbc06ed3aada42dccac26fe243e73399e" "checksum solana-reed-solomon-erasure 4.0.1-3 (registry+https://github.com/rust-lang/crates.io-index)" = "d5b3ab3f4dd12af687a7d0d0ee73299cbc06ed3aada42dccac26fe243e73399e"
"checksum solana_libra_bytecode_verifier 0.0.1-sol4 (registry+https://github.com/rust-lang/crates.io-index)" = "79c3b7e9555da6f04a3f542a40e92bbbd46d0f05bd270ae3ff8c0283c329a179" "checksum solana_libra_bytecode_verifier 0.0.1-sol4 (registry+https://github.com/rust-lang/crates.io-index)" = "79c3b7e9555da6f04a3f542a40e92bbbd46d0f05bd270ae3ff8c0283c329a179"
"checksum solana_libra_canonical_serialization 0.0.1-sol4 (registry+https://github.com/rust-lang/crates.io-index)" = "c674689dd2d17b0bab49501f0d63ec71b3e1f8fab2eae86174e37768435a54aa" "checksum solana_libra_canonical_serialization 0.0.1-sol4 (registry+https://github.com/rust-lang/crates.io-index)" = "c674689dd2d17b0bab49501f0d63ec71b3e1f8fab2eae86174e37768435a54aa"

View File

@ -43,6 +43,28 @@ use std::{
const USERDATA_CHUNK_SIZE: usize = 229; // Keep program chunks under PACKET_DATA_SIZE const USERDATA_CHUNK_SIZE: usize = 229; // Keep program chunks under PACKET_DATA_SIZE
#[derive(Debug)]
pub struct KeypairEq(Keypair);
impl From<Keypair> for KeypairEq {
fn from(keypair: Keypair) -> Self {
Self(keypair)
}
}
impl PartialEq for KeypairEq {
fn eq(&self, other: &Self) -> bool {
self.pubkey() == other.pubkey()
}
}
impl std::ops::Deref for KeypairEq {
type Target = Keypair;
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[derive(Debug, PartialEq)] #[derive(Debug, PartialEq)]
#[allow(clippy::large_enum_variant)] #[allow(clippy::large_enum_variant)]
pub enum CliCommand { pub enum CliCommand {
@ -66,7 +88,7 @@ pub enum CliCommand {
Deploy(String), Deploy(String),
// Stake Commands // Stake Commands
CreateStakeAccount { CreateStakeAccount {
stake_account: Keypair, stake_account: KeypairEq,
staker: Option<Pubkey>, staker: Option<Pubkey>,
withdrawer: Option<Pubkey>, withdrawer: Option<Pubkey>,
lockup: Lockup, lockup: Lockup,
@ -87,7 +109,7 @@ pub enum CliCommand {
// Storage Commands // Storage Commands
CreateStorageAccount { CreateStorageAccount {
account_owner: Pubkey, account_owner: Pubkey,
storage_account: Keypair, storage_account: KeypairEq,
account_type: StorageAccountType, account_type: StorageAccountType,
}, },
ClaimStorageReward { ClaimStorageReward {
@ -104,7 +126,7 @@ pub enum CliCommand {
}, },
// Vote Commands // Vote Commands
CreateVoteAccount { CreateVoteAccount {
vote_account: Keypair, vote_account: KeypairEq,
node_pubkey: Pubkey, node_pubkey: Pubkey,
authorized_voter: Option<Pubkey>, authorized_voter: Option<Pubkey>,
authorized_withdrawer: Option<Pubkey>, authorized_withdrawer: Option<Pubkey>,
@ -1796,7 +1818,7 @@ mod tests {
let bob_pubkey = bob_keypair.pubkey(); let bob_pubkey = bob_keypair.pubkey();
let node_pubkey = Pubkey::new_rand(); let node_pubkey = Pubkey::new_rand();
config.command = CliCommand::CreateVoteAccount { config.command = CliCommand::CreateVoteAccount {
vote_account: bob_keypair, vote_account: bob_keypair.into(),
node_pubkey, node_pubkey,
authorized_voter: Some(bob_pubkey), authorized_voter: Some(bob_pubkey),
authorized_withdrawer: Some(bob_pubkey), authorized_withdrawer: Some(bob_pubkey),
@ -1815,7 +1837,7 @@ mod tests {
let bob_pubkey = bob_keypair.pubkey(); let bob_pubkey = bob_keypair.pubkey();
let custodian = Pubkey::new_rand(); let custodian = Pubkey::new_rand();
config.command = CliCommand::CreateStakeAccount { config.command = CliCommand::CreateStakeAccount {
stake_account: bob_keypair, stake_account: bob_keypair.into(),
staker: None, staker: None,
withdrawer: None, withdrawer: None,
lockup: Lockup { slot: 0, custodian }, lockup: Lockup { slot: 0, custodian },
@ -1961,7 +1983,7 @@ mod tests {
let bob_keypair = Keypair::new(); let bob_keypair = Keypair::new();
config.command = CliCommand::CreateVoteAccount { config.command = CliCommand::CreateVoteAccount {
vote_account: bob_keypair, vote_account: bob_keypair.into(),
node_pubkey, node_pubkey,
authorized_voter: Some(bob_pubkey), authorized_voter: Some(bob_pubkey),
authorized_withdrawer: Some(bob_pubkey), authorized_withdrawer: Some(bob_pubkey),

View File

@ -125,14 +125,17 @@ mod tests {
let matches = app() let matches = app()
.clone() .clone()
.get_matches_from(vec!["test", "--single", &outfile]); .get_matches_from(vec!["test", "--single", &outfile]);
assert_eq!(keypair_of(&matches, "single"), Some(keypair)); assert_eq!(
assert_eq!(keypair_of(&matches, "multiple"), None); keypair_of(&matches, "single").unwrap().pubkey(),
keypair.pubkey()
);
assert!(keypair_of(&matches, "multiple").is_none());
let matches = let matches =
app() app()
.clone() .clone()
.get_matches_from(vec!["test", "--single", "random_keypair_file.json"]); .get_matches_from(vec!["test", "--single", "random_keypair_file.json"]);
assert_eq!(keypair_of(&matches, "single"), None); assert!(keypair_of(&matches, "single").is_none());
fs::remove_file(&outfile).unwrap(); fs::remove_file(&outfile).unwrap();
} }

View File

@ -283,7 +283,7 @@ pub fn parse_stake_create_account(matches: &ArgMatches<'_>) -> Result<CliCommand
Ok(CliCommandInfo { Ok(CliCommandInfo {
command: CliCommand::CreateStakeAccount { command: CliCommand::CreateStakeAccount {
stake_account, stake_account: stake_account.into(),
staker, staker,
withdrawer, withdrawer,
lockup: Lockup { custodian, slot }, lockup: Lockup { custodian, slot },
@ -788,7 +788,7 @@ mod tests {
parse_command(&test_create_stake_account).unwrap(), parse_command(&test_create_stake_account).unwrap(),
CliCommandInfo { CliCommandInfo {
command: CliCommand::CreateStakeAccount { command: CliCommand::CreateStakeAccount {
stake_account: stake_account_keypair, stake_account: stake_account_keypair.into(),
staker: Some(authorized), staker: Some(authorized),
withdrawer: Some(authorized), withdrawer: Some(authorized),
lockup: Lockup { lockup: Lockup {
@ -819,7 +819,7 @@ mod tests {
parse_command(&test_create_stake_account2).unwrap(), parse_command(&test_create_stake_account2).unwrap(),
CliCommandInfo { CliCommandInfo {
command: CliCommand::CreateStakeAccount { command: CliCommand::CreateStakeAccount {
stake_account: stake_account_keypair, stake_account: stake_account_keypair.into(),
staker: None, staker: None,
withdrawer: None, withdrawer: None,
lockup: Lockup { lockup: Lockup {

View File

@ -107,7 +107,7 @@ pub fn parse_storage_create_archiver_account(
Ok(CliCommandInfo { Ok(CliCommandInfo {
command: CliCommand::CreateStorageAccount { command: CliCommand::CreateStorageAccount {
account_owner, account_owner,
storage_account, storage_account: storage_account.into(),
account_type: StorageAccountType::Archiver, account_type: StorageAccountType::Archiver,
}, },
require_keypair: true, require_keypair: true,
@ -122,7 +122,7 @@ pub fn parse_storage_create_validator_account(
Ok(CliCommandInfo { Ok(CliCommandInfo {
command: CliCommand::CreateStorageAccount { command: CliCommand::CreateStorageAccount {
account_owner, account_owner,
storage_account, storage_account: storage_account.into(),
account_type: StorageAccountType::Validator, account_type: StorageAccountType::Validator,
}, },
require_keypair: true, require_keypair: true,
@ -257,7 +257,7 @@ mod tests {
CliCommandInfo { CliCommandInfo {
command: CliCommand::CreateStorageAccount { command: CliCommand::CreateStorageAccount {
account_owner: pubkey, account_owner: pubkey,
storage_account: storage_account_keypair, storage_account: storage_account_keypair.into(),
account_type: StorageAccountType::Archiver, account_type: StorageAccountType::Archiver,
}, },
require_keypair: true require_keypair: true
@ -281,7 +281,7 @@ mod tests {
CliCommandInfo { CliCommandInfo {
command: CliCommand::CreateStorageAccount { command: CliCommand::CreateStorageAccount {
account_owner: pubkey, account_owner: pubkey,
storage_account: storage_account_keypair, storage_account: storage_account_keypair.into(),
account_type: StorageAccountType::Validator, account_type: StorageAccountType::Validator,
}, },
require_keypair: true require_keypair: true

View File

@ -170,7 +170,7 @@ pub fn parse_vote_create_account(matches: &ArgMatches<'_>) -> Result<CliCommandI
Ok(CliCommandInfo { Ok(CliCommandInfo {
command: CliCommand::CreateVoteAccount { command: CliCommand::CreateVoteAccount {
vote_account, vote_account: vote_account.into(),
node_pubkey, node_pubkey,
authorized_voter, authorized_voter,
authorized_withdrawer, authorized_withdrawer,
@ -479,7 +479,7 @@ mod tests {
parse_command(&test_create_vote_account).unwrap(), parse_command(&test_create_vote_account).unwrap(),
CliCommandInfo { CliCommandInfo {
command: CliCommand::CreateVoteAccount { command: CliCommand::CreateVoteAccount {
vote_account: keypair, vote_account: keypair.into(),
node_pubkey, node_pubkey,
authorized_voter: None, authorized_voter: None,
authorized_withdrawer: None, authorized_withdrawer: None,
@ -503,7 +503,7 @@ mod tests {
parse_command(&test_create_vote_account2).unwrap(), parse_command(&test_create_vote_account2).unwrap(),
CliCommandInfo { CliCommandInfo {
command: CliCommand::CreateVoteAccount { command: CliCommand::CreateVoteAccount {
vote_account: keypair, vote_account: keypair.into(),
node_pubkey, node_pubkey,
authorized_voter: None, authorized_voter: None,
authorized_withdrawer: None, authorized_withdrawer: None,
@ -531,7 +531,7 @@ mod tests {
parse_command(&test_create_vote_account3).unwrap(), parse_command(&test_create_vote_account3).unwrap(),
CliCommandInfo { CliCommandInfo {
command: CliCommand::CreateVoteAccount { command: CliCommand::CreateVoteAccount {
vote_account: keypair, vote_account: keypair.into(),
node_pubkey, node_pubkey,
authorized_voter: Some(authed), authorized_voter: Some(authed),
authorized_withdrawer: None, authorized_withdrawer: None,
@ -557,7 +557,7 @@ mod tests {
parse_command(&test_create_vote_account4).unwrap(), parse_command(&test_create_vote_account4).unwrap(),
CliCommandInfo { CliCommandInfo {
command: CliCommand::CreateVoteAccount { command: CliCommand::CreateVoteAccount {
vote_account: keypair, vote_account: keypair.into(),
node_pubkey, node_pubkey,
authorized_voter: None, authorized_voter: None,
authorized_withdrawer: Some(authed), authorized_withdrawer: Some(authed),

View File

@ -50,7 +50,7 @@ solana-budget-program = { path = "../programs/budget_program", version = "0.21.0
solana-chacha-sys = { path = "../chacha-sys", version = "0.21.0" } solana-chacha-sys = { path = "../chacha-sys", version = "0.21.0" }
solana-client = { path = "../client", version = "0.21.0" } solana-client = { path = "../client", version = "0.21.0" }
solana-drone = { path = "../drone", version = "0.21.0" } solana-drone = { path = "../drone", version = "0.21.0" }
solana-ed25519-dalek = "0.2.0" ed25519-dalek = "1.0.0-pre.1"
solana-ledger = { path = "../ledger", version = "0.21.0" } solana-ledger = { path = "../ledger", version = "0.21.0" }
solana-logger = { path = "../logger", version = "0.21.0" } solana-logger = { path = "../logger", version = "0.21.0" }
solana-merkle-tree = { path = "../merkle-tree", version = "0.21.0" } solana-merkle-tree = { path = "../merkle-tree", version = "0.21.0" }

View File

@ -16,10 +16,10 @@ use crate::{
window_service::WindowService, window_service::WindowService,
}; };
use crossbeam_channel::unbounded; use crossbeam_channel::unbounded;
use ed25519_dalek;
use rand::{thread_rng, Rng, SeedableRng}; use rand::{thread_rng, Rng, SeedableRng};
use rand_chacha::ChaChaRng; use rand_chacha::ChaChaRng;
use solana_client::{rpc_client::RpcClient, rpc_request::RpcRequest, thin_client::ThinClient}; use solana_client::{rpc_client::RpcClient, rpc_request::RpcRequest, thin_client::ThinClient};
use solana_ed25519_dalek as ed25519_dalek;
use solana_ledger::{ use solana_ledger::{
blocktree::Blocktree, leader_schedule_cache::LeaderScheduleCache, shred::Shred, blocktree::Blocktree, leader_schedule_cache::LeaderScheduleCache, shred::Shred,
}; };

View File

@ -1,4 +1,4 @@
//! The `signature` module provides functionality for public, and private keys. //! The `gen_keys` module makes lots of keypairs
use rand::{Rng, SeedableRng}; use rand::{Rng, SeedableRng};
use rand_chacha::ChaChaRng; use rand_chacha::ChaChaRng;

View File

@ -21,7 +21,7 @@ rand_chacha = { version = "0.1.1" }
regex-syntax = { version = "0.6.12" } regex-syntax = { version = "0.6.12" }
reqwest = { version = "0.9.20", default-features = false, features = ["rustls-tls"] } reqwest = { version = "0.9.20", default-features = false, features = ["rustls-tls"] }
serde = { version = "1.0.100", features = ["rc"] } serde = { version = "1.0.100", features = ["rc"] }
solana-ed25519-dalek = { version = "0.2.0", features = ["serde"] } ed25519-dalek = { version = "1.0.0-pre.1", features = ["serde"] }
syn_0_15 = { package = "syn", version = "0.15.42", features = ["extra-traits", "fold", "full"] } syn_0_15 = { package = "syn", version = "0.15.42", features = ["extra-traits", "fold", "full"] }
syn_1_0 = { package = "syn", version = "1.0.3", features = ["extra-traits", "fold", "full"] } syn_1_0 = { package = "syn", version = "1.0.3", features = ["extra-traits", "fold", "full"] }
tokio = { version = "0.1.22",features=["bytes", "codec", "default", "fs", "io", "mio", "num_cpus", "reactor", "rt-full", "sync", "tcp", "timer", "tokio-codec", "tokio-current-thread", "tokio-executor", "tokio-io", "tokio-io", "tokio-reactor", "tokio-tcp", "tokio-tcp", "tokio-threadpool", "tokio-timer", "tokio-udp", "tokio-uds", "udp", "uds"] } tokio = { version = "0.1.22",features=["bytes", "codec", "default", "fs", "io", "mio", "num_cpus", "reactor", "rt-full", "sync", "tcp", "timer", "tokio-codec", "tokio-current-thread", "tokio-executor", "tokio-io", "tokio-io", "tokio-reactor", "tokio-tcp", "tokio-tcp", "tokio-threadpool", "tokio-timer", "tokio-udp", "tokio-uds", "udp", "uds"] }

View File

@ -34,7 +34,7 @@ solana-measure = { path = "../measure", version = "0.21.0" }
solana-merkle-tree = { path = "../merkle-tree", version = "0.21.0" } solana-merkle-tree = { path = "../merkle-tree", version = "0.21.0" }
solana-metrics = { path = "../metrics", version = "0.21.0" } solana-metrics = { path = "../metrics", version = "0.21.0" }
solana-perf = { path = "../perf", version = "0.21.0" } solana-perf = { path = "../perf", version = "0.21.0" }
solana-ed25519-dalek = "0.2.0" ed25519-dalek = "1.0.0-pre.1"
solana-rayon-threadlimit = { path = "../rayon-threadlimit", version = "0.21.0" } solana-rayon-threadlimit = { path = "../rayon-threadlimit", version = "0.21.0" }
solana-runtime = { path = "../runtime", version = "0.21.0" } solana-runtime = { path = "../runtime", version = "0.21.0" }
solana-sdk = { path = "../sdk", version = "0.21.0" } solana-sdk = { path = "../sdk", version = "0.21.0" }

View File

@ -1,24 +1,24 @@
#![allow(clippy::implicit_hasher)] #![allow(clippy::implicit_hasher)]
use crate::shred::ShredType; use crate::shred::ShredType;
use rayon::iter::IndexedParallelIterator; use ed25519_dalek::{Keypair, PublicKey, SecretKey};
use rayon::iter::IntoParallelIterator; use rayon::{
use rayon::iter::IntoParallelRefMutIterator; iter::{
use rayon::iter::ParallelIterator; IndexedParallelIterator, IntoParallelIterator, IntoParallelRefMutIterator, ParallelIterator,
use rayon::ThreadPool; },
ThreadPool,
};
use sha2::{Digest, Sha512}; use sha2::{Digest, Sha512};
use solana_ed25519_dalek::{Keypair, PublicKey, SecretKey};
use solana_metrics::inc_new_counter_debug; use solana_metrics::inc_new_counter_debug;
use solana_perf::cuda_runtime::PinnedVec; use solana_perf::{
use solana_perf::packet::{limited_deserialize, Packet, Packets}; cuda_runtime::PinnedVec,
use solana_perf::perf_libs; packet::{limited_deserialize, Packet, Packets},
use solana_perf::recycler::Recycler; perf_libs,
use solana_perf::sigverify::{self, TxOffset}; recycler::Recycler,
sigverify::{self, TxOffset},
};
use solana_rayon_threadlimit::get_thread_count; use solana_rayon_threadlimit::get_thread_count;
use solana_sdk::signature::Signature; use solana_sdk::signature::Signature;
use std::collections::HashMap; use std::{cell::RefCell, collections::HashMap, mem::size_of};
use std::mem::size_of;
use std::cell::RefCell;
thread_local!(static PAR_THREAD_POOL: RefCell<ThreadPool> = RefCell::new(rayon::ThreadPoolBuilder::new() thread_local!(static PAR_THREAD_POOL: RefCell<ThreadPool> = RefCell::new(rayon::ThreadPoolBuilder::new()
.num_threads(get_thread_count()) .num_threads(get_thread_count())

View File

@ -19,7 +19,8 @@ libc = "0.2.65"
rand_chacha = "0.1.1" rand_chacha = "0.1.1"
rand_core = { version = ">=0.2, <0.4", default-features = false } rand_core = { version = ">=0.2, <0.4", default-features = false }
solana-sdk = { path = "../sdk", version = "0.21.0" } solana-sdk = { path = "../sdk", version = "0.21.0" }
solana-ed25519-dalek = "0.2.0" ed25519-dalek = "1.0.0-pre.1"
sha2 = "0.8.0"
[build-dependencies] [build-dependencies]
cbindgen = "0.9.1" cbindgen = "0.9.1"

View File

@ -1,21 +1,23 @@
use bincode::{deserialize, serialize}; use bincode::{deserialize, serialize};
use ed25519_dalek::{SignatureError, KEYPAIR_LENGTH, PUBLIC_KEY_LENGTH};
use libc::{c_int, size_t}; use libc::{c_int, size_t};
use rand_chacha::ChaChaRng; use rand_chacha::ChaChaRng;
use rand_core::SeedableRng; use rand_core::SeedableRng;
use solana_ed25519_dalek::{SignatureError, KEYPAIR_LENGTH, PUBLIC_KEY_LENGTH}; use solana_sdk::{
use solana_sdk::hash::Hash; hash::Hash,
use solana_sdk::instruction::CompiledInstruction as CompiledInstructionNative; instruction::CompiledInstruction as CompiledInstructionNative,
use solana_sdk::message::Message as MessageNative; message::{Message as MessageNative, MessageHeader as MessageHeaderNative},
use solana_sdk::message::MessageHeader as MessageHeaderNative; pubkey::Pubkey,
use solana_sdk::pubkey::Pubkey; signature::{Keypair as KeypairNative, KeypairUtil, Signature as SignatureNative},
use solana_sdk::signature::Signature as SignatureNative; transaction::Transaction as TransactionNative,
use solana_sdk::signature::{Keypair as KeypairNative, KeypairUtil}; };
use solana_sdk::transaction::Transaction as TransactionNative; use std::{
use std::convert::TryInto; convert::TryInto,
use std::ffi::CString; ffi::CString,
use std::os::raw::c_char; os::raw::c_char,
use std::vec::Vec; vec::Vec,
use std::{fmt, mem, ptr, slice}; {fmt, mem, ptr, slice},
};
#[repr(C)] #[repr(C)]
#[derive(Debug)] #[derive(Debug)]
@ -481,7 +483,7 @@ mod tests {
let mut rng = ChaChaRng::from_seed(seed); let mut rng = ChaChaRng::from_seed(seed);
let keypair = KeypairNative::generate(&mut rng); let keypair = KeypairNative::generate(&mut rng);
let c_keypair = unsafe { Box::from_raw(generate_keypair(seed.as_ptr())) }; let c_keypair = unsafe { Box::from_raw(generate_keypair(seed.as_ptr())) };
assert_eq!(c_keypair.new_native(), Ok(keypair)); assert_eq!(c_keypair.new_native().unwrap().pubkey(), keypair.pubkey());
} }
#[test] #[test]

View File

@ -21,7 +21,7 @@ default = [
"rand_chacha", "rand_chacha",
"rayon", "rayon",
"serde_json", "serde_json",
"solana-ed25519-dalek", "ed25519-dalek",
"solana-logger", "solana-logger",
"untrusted", "untrusted",
"solana-crate-features" "solana-crate-features"
@ -48,7 +48,7 @@ serde_bytes = "0.11"
serde_derive = "1.0.102" serde_derive = "1.0.102"
serde_json = { version = "1.0.41", optional = true } serde_json = { version = "1.0.41", optional = true }
sha2 = "0.8.0" sha2 = "0.8.0"
solana-ed25519-dalek = { version = "0.2.0", optional = true } ed25519-dalek = { version = "1.0.0-pre.1", optional = true }
solana-logger = { path = "../logger", version = "0.21.0", optional = true } solana-logger = { path = "../logger", version = "0.21.0", optional = true }
untrusted = { version = "0.7.0", optional = true } untrusted = { version = "0.7.0", optional = true }
solana-crate-features = { path = "../crate-features", version = "0.21.0", optional = true } solana-crate-features = { path = "../crate-features", version = "0.21.0", optional = true }

View File

@ -2,20 +2,19 @@
use crate::pubkey::Pubkey; use crate::pubkey::Pubkey;
use bs58; use bs58;
use generic_array::typenum::U64; use ed25519_dalek;
use generic_array::GenericArray; use generic_array::{typenum::U64, GenericArray};
use rand::rngs::OsRng; use rand::rngs::OsRng;
use serde_json; use serde_json;
use solana_ed25519_dalek as ed25519_dalek; use std::{
use std::borrow::Borrow; borrow::{Borrow, Cow},
use std::borrow::Cow; error, fmt,
use std::error; fs::{self, File},
use std::fmt; io::{Read, Write},
use std::fs::{self, File}; mem,
use std::io::{Read, Write}; path::Path,
use std::mem; str::FromStr,
use std::path::Path; };
use std::str::FromStr;
pub type Keypair = ed25519_dalek::Keypair; pub type Keypair = ed25519_dalek::Keypair;
@ -117,7 +116,7 @@ impl KeypairUtil for Keypair {
/// 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::new(&self.public.as_ref()) Pubkey::new(self.public.as_ref())
} }
fn sign_message(&self, message: &[u8]) -> Signature { fn sign_message(&self, message: &[u8]) -> Signature {