remove vote-program dep from account-decoder

This commit is contained in:
Kevin Heavey 2022-09-16 19:36:36 +01:00 committed by Michael Vines
parent 9831e4ddad
commit 742ee71138
5 changed files with 16 additions and 12 deletions

1
Cargo.lock generated
View File

@ -4521,7 +4521,6 @@ dependencies = [
"solana-address-lookup-table-program", "solana-address-lookup-table-program",
"solana-config-program", "solana-config-program",
"solana-sdk 1.15.0", "solana-sdk 1.15.0",
"solana-vote-program",
"spl-token", "spl-token",
"spl-token-2022", "spl-token-2022",
"thiserror", "thiserror",

View File

@ -22,7 +22,6 @@ serde_json = "1.0.83"
solana-address-lookup-table-program = { path = "../programs/address-lookup-table", version = "=1.15.0" } solana-address-lookup-table-program = { path = "../programs/address-lookup-table", version = "=1.15.0" }
solana-config-program = { path = "../programs/config", version = "=1.15.0" } solana-config-program = { path = "../programs/config", version = "=1.15.0" }
solana-sdk = { path = "../sdk", version = "=1.15.0" } solana-sdk = { path = "../sdk", version = "=1.15.0" }
solana-vote-program = { path = "../programs/vote", version = "=1.15.0" }
spl-token = { version = "=3.5.0", features = ["no-entrypoint"] } spl-token = { version = "=3.5.0", features = ["no-entrypoint"] }
spl-token-2022 = { version = "=0.4.3", features = ["no-entrypoint"] } spl-token-2022 = { version = "=0.4.3", features = ["no-entrypoint"] }
thiserror = "1.0" thiserror = "1.0"

View File

@ -11,7 +11,9 @@ use {
}, },
inflector::Inflector, inflector::Inflector,
serde_json::Value, serde_json::Value,
solana_sdk::{instruction::InstructionError, pubkey::Pubkey, stake, system_program, sysvar}, solana_sdk::{
instruction::InstructionError, pubkey::Pubkey, stake, system_program, sysvar, vote,
},
std::collections::HashMap, std::collections::HashMap,
thiserror::Error, thiserror::Error,
}; };
@ -23,7 +25,7 @@ lazy_static! {
static ref STAKE_PROGRAM_ID: Pubkey = stake::program::id(); static ref STAKE_PROGRAM_ID: Pubkey = stake::program::id();
static ref SYSTEM_PROGRAM_ID: Pubkey = system_program::id(); static ref SYSTEM_PROGRAM_ID: Pubkey = system_program::id();
static ref SYSVAR_PROGRAM_ID: Pubkey = sysvar::id(); static ref SYSVAR_PROGRAM_ID: Pubkey = sysvar::id();
static ref VOTE_PROGRAM_ID: Pubkey = solana_vote_program::id(); static ref VOTE_PROGRAM_ID: Pubkey = vote::program::id();
pub static ref PARSABLE_PROGRAM_IDS: HashMap<Pubkey, ParsableAccount> = { pub static ref PARSABLE_PROGRAM_IDS: HashMap<Pubkey, ParsableAccount> = {
let mut m = HashMap::new(); let mut m = HashMap::new();
m.insert( m.insert(
@ -127,11 +129,16 @@ pub fn parse_account_data(
mod test { mod test {
use { use {
super::*, super::*,
solana_sdk::nonce::{ solana_sdk::{
state::{Data, Versions}, nonce::{
State, state::{Data, Versions},
State,
},
vote::{
program::id as vote_program_id,
state::{VoteState, VoteStateVersions},
},
}, },
solana_vote_program::vote_state::{VoteState, VoteStateVersions},
}; };
#[test] #[test]
@ -147,7 +154,7 @@ mod test {
VoteState::serialize(&versioned, &mut vote_account_data).unwrap(); VoteState::serialize(&versioned, &mut vote_account_data).unwrap();
let parsed = parse_account_data( let parsed = parse_account_data(
&account_pubkey, &account_pubkey,
&solana_vote_program::id(), &vote_program_id(),
&vote_account_data, &vote_account_data,
None, None,
) )

View File

@ -3,8 +3,8 @@ use {
solana_sdk::{ solana_sdk::{
clock::{Epoch, Slot}, clock::{Epoch, Slot},
pubkey::Pubkey, pubkey::Pubkey,
vote::state::{BlockTimestamp, Lockout, VoteState},
}, },
solana_vote_program::vote_state::{BlockTimestamp, Lockout, VoteState},
}; };
pub fn parse_vote(data: &[u8]) -> Result<VoteAccountType, ParseAccountError> { pub fn parse_vote(data: &[u8]) -> Result<VoteAccountType, ParseAccountError> {
@ -123,7 +123,7 @@ struct UiEpochCredits {
#[cfg(test)] #[cfg(test)]
mod test { mod test {
use {super::*, solana_vote_program::vote_state::VoteStateVersions}; use {super::*, solana_sdk::vote::state::VoteStateVersions};
#[test] #[test]
fn test_parse_vote() { fn test_parse_vote() {

View File

@ -4088,7 +4088,6 @@ dependencies = [
"solana-address-lookup-table-program", "solana-address-lookup-table-program",
"solana-config-program", "solana-config-program",
"solana-sdk 1.15.0", "solana-sdk 1.15.0",
"solana-vote-program",
"spl-token", "spl-token",
"spl-token-2022", "spl-token-2022",
"thiserror", "thiserror",