Reformat imports to a consistent style for imports
rustfmt.toml configuration: imports_granularity = "One" group_imports = "One"
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
use log::*;
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
use solana_sdk::{clock::Epoch, pubkey::Pubkey};
|
||||
use std::collections::BTreeMap;
|
||||
use {
|
||||
log::*,
|
||||
serde_derive::{Deserialize, Serialize},
|
||||
solana_sdk::{clock::Epoch, pubkey::Pubkey},
|
||||
std::collections::BTreeMap,
|
||||
};
|
||||
|
||||
#[derive(Debug, Default, Serialize, Deserialize, PartialEq, Eq, Clone, AbiExample)]
|
||||
pub struct AuthorizedVoters {
|
||||
|
@@ -1,28 +1,30 @@
|
||||
//! Vote program
|
||||
//! Receive and processes votes from validators
|
||||
|
||||
use crate::{
|
||||
id,
|
||||
vote_state::{self, Vote, VoteAuthorize, VoteInit, VoteState},
|
||||
use {
|
||||
crate::{
|
||||
id,
|
||||
vote_state::{self, Vote, VoteAuthorize, VoteInit, VoteState},
|
||||
},
|
||||
log::*,
|
||||
num_derive::{FromPrimitive, ToPrimitive},
|
||||
serde_derive::{Deserialize, Serialize},
|
||||
solana_metrics::inc_new_counter_info,
|
||||
solana_program_runtime::invoke_context::InvokeContext,
|
||||
solana_sdk::{
|
||||
decode_error::DecodeError,
|
||||
feature_set,
|
||||
hash::Hash,
|
||||
instruction::{AccountMeta, Instruction, InstructionError},
|
||||
keyed_account::{from_keyed_account, get_signers, keyed_account_at_index, KeyedAccount},
|
||||
program_utils::limited_deserialize,
|
||||
pubkey::Pubkey,
|
||||
system_instruction,
|
||||
sysvar::{self, clock::Clock, slot_hashes::SlotHashes},
|
||||
},
|
||||
std::collections::HashSet,
|
||||
thiserror::Error,
|
||||
};
|
||||
use log::*;
|
||||
use num_derive::{FromPrimitive, ToPrimitive};
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
use solana_metrics::inc_new_counter_info;
|
||||
use solana_program_runtime::invoke_context::InvokeContext;
|
||||
use solana_sdk::{
|
||||
decode_error::DecodeError,
|
||||
feature_set,
|
||||
hash::Hash,
|
||||
instruction::{AccountMeta, Instruction, InstructionError},
|
||||
keyed_account::{from_keyed_account, get_signers, keyed_account_at_index, KeyedAccount},
|
||||
program_utils::limited_deserialize,
|
||||
pubkey::Pubkey,
|
||||
system_instruction,
|
||||
sysvar::{self, clock::Clock, slot_hashes::SlotHashes},
|
||||
};
|
||||
use std::collections::HashSet;
|
||||
use thiserror::Error;
|
||||
|
||||
/// Reasons the stake might have had an error
|
||||
#[derive(Error, Debug, Clone, PartialEq, FromPrimitive, ToPrimitive)]
|
||||
@@ -405,15 +407,16 @@ pub fn process_instruction(
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use bincode::serialize;
|
||||
use solana_program_runtime::invoke_context::mock_process_instruction;
|
||||
use solana_sdk::{
|
||||
account::{self, Account, AccountSharedData},
|
||||
rent::Rent,
|
||||
use {
|
||||
super::*,
|
||||
bincode::serialize,
|
||||
solana_program_runtime::invoke_context::mock_process_instruction,
|
||||
solana_sdk::{
|
||||
account::{self, Account, AccountSharedData},
|
||||
rent::Rent,
|
||||
},
|
||||
std::{cell::RefCell, rc::Rc, str::FromStr},
|
||||
};
|
||||
use std::str::FromStr;
|
||||
use std::{cell::RefCell, rc::Rc};
|
||||
|
||||
fn create_default_account() -> Rc<RefCell<AccountSharedData>> {
|
||||
AccountSharedData::new_ref(0, 0, &Pubkey::new_unique())
|
||||
|
@@ -1,26 +1,29 @@
|
||||
//! Vote state, vote program
|
||||
//! Receive and processes votes from validators
|
||||
use crate::authorized_voters::AuthorizedVoters;
|
||||
use crate::{id, vote_instruction::VoteError};
|
||||
use bincode::{deserialize, serialize_into, serialized_size, ErrorKind};
|
||||
use log::*;
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
use solana_sdk::{
|
||||
account::{AccountSharedData, ReadableAccount, WritableAccount},
|
||||
account_utils::State,
|
||||
clock::{Epoch, Slot, UnixTimestamp},
|
||||
epoch_schedule::MAX_LEADER_SCHEDULE_EPOCH_OFFSET,
|
||||
hash::Hash,
|
||||
instruction::InstructionError,
|
||||
keyed_account::KeyedAccount,
|
||||
pubkey::Pubkey,
|
||||
rent::Rent,
|
||||
slot_hashes::SlotHash,
|
||||
sysvar::clock::Clock,
|
||||
use {
|
||||
crate::{authorized_voters::AuthorizedVoters, id, vote_instruction::VoteError},
|
||||
bincode::{deserialize, serialize_into, serialized_size, ErrorKind},
|
||||
log::*,
|
||||
serde_derive::{Deserialize, Serialize},
|
||||
solana_sdk::{
|
||||
account::{AccountSharedData, ReadableAccount, WritableAccount},
|
||||
account_utils::State,
|
||||
clock::{Epoch, Slot, UnixTimestamp},
|
||||
epoch_schedule::MAX_LEADER_SCHEDULE_EPOCH_OFFSET,
|
||||
hash::Hash,
|
||||
instruction::InstructionError,
|
||||
keyed_account::KeyedAccount,
|
||||
pubkey::Pubkey,
|
||||
rent::Rent,
|
||||
slot_hashes::SlotHash,
|
||||
sysvar::clock::Clock,
|
||||
},
|
||||
std::{
|
||||
boxed::Box,
|
||||
cmp::Ordering,
|
||||
collections::{HashSet, VecDeque},
|
||||
},
|
||||
};
|
||||
use std::boxed::Box;
|
||||
use std::cmp::Ordering;
|
||||
use std::collections::{HashSet, VecDeque};
|
||||
|
||||
mod vote_state_0_23_5;
|
||||
pub mod vote_state_versions;
|
||||
@@ -793,15 +796,17 @@ pub fn create_account(
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::vote_state;
|
||||
use solana_sdk::{
|
||||
account::AccountSharedData,
|
||||
account_utils::StateMut,
|
||||
hash::hash,
|
||||
keyed_account::{get_signers, keyed_account_at_index},
|
||||
use {
|
||||
super::*,
|
||||
crate::vote_state,
|
||||
solana_sdk::{
|
||||
account::AccountSharedData,
|
||||
account_utils::StateMut,
|
||||
hash::hash,
|
||||
keyed_account::{get_signers, keyed_account_at_index},
|
||||
},
|
||||
std::cell::RefCell,
|
||||
};
|
||||
use std::cell::RefCell;
|
||||
|
||||
const MAX_RECENT_VOTES: usize = 16;
|
||||
|
||||
|
@@ -1,5 +1,4 @@
|
||||
use super::*;
|
||||
use crate::vote_state::vote_state_0_23_5::VoteState0_23_5;
|
||||
use {super::*, crate::vote_state::vote_state_0_23_5::VoteState0_23_5};
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, PartialEq, Eq, Clone)]
|
||||
pub enum VoteStateVersions {
|
||||
|
@@ -1,16 +1,17 @@
|
||||
use solana_sdk::{
|
||||
clock::Slot,
|
||||
hash::Hash,
|
||||
instruction::CompiledInstruction,
|
||||
program_utils::limited_deserialize,
|
||||
pubkey::Pubkey,
|
||||
signature::{Keypair, Signer},
|
||||
transaction::{SanitizedTransaction, Transaction},
|
||||
};
|
||||
|
||||
use crate::{
|
||||
vote_instruction::{self, VoteInstruction},
|
||||
vote_state::Vote,
|
||||
use {
|
||||
crate::{
|
||||
vote_instruction::{self, VoteInstruction},
|
||||
vote_state::Vote,
|
||||
},
|
||||
solana_sdk::{
|
||||
clock::Slot,
|
||||
hash::Hash,
|
||||
instruction::CompiledInstruction,
|
||||
program_utils::limited_deserialize,
|
||||
pubkey::Pubkey,
|
||||
signature::{Keypair, Signer},
|
||||
transaction::{SanitizedTransaction, Transaction},
|
||||
},
|
||||
};
|
||||
|
||||
pub type ParsedVote = (Pubkey, Vote, Option<Hash>);
|
||||
@@ -104,8 +105,7 @@ pub fn new_vote_transaction(
|
||||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
use solana_sdk::hash::hash;
|
||||
use {super::*, solana_sdk::hash::hash};
|
||||
|
||||
fn run_test_parse_vote_transaction(input_hash: Option<Hash>) {
|
||||
let node_keypair = Keypair::new();
|
||||
|
Reference in New Issue
Block a user