From 742ee711383336f2c6b82e97ee310e62ea73022b Mon Sep 17 00:00:00 2001 From: Kevin Heavey Date: Fri, 16 Sep 2022 19:36:36 +0100 Subject: [PATCH] remove vote-program dep from account-decoder --- Cargo.lock | 1 - account-decoder/Cargo.toml | 1 - account-decoder/src/parse_account_data.rs | 21 ++++++++++++++------- account-decoder/src/parse_vote.rs | 4 ++-- programs/bpf/Cargo.lock | 1 - 5 files changed, 16 insertions(+), 12 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7d5affb5a7..1132b94f37 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4521,7 +4521,6 @@ dependencies = [ "solana-address-lookup-table-program", "solana-config-program", "solana-sdk 1.15.0", - "solana-vote-program", "spl-token", "spl-token-2022", "thiserror", diff --git a/account-decoder/Cargo.toml b/account-decoder/Cargo.toml index 7af1dce3db..39e688f996 100644 --- a/account-decoder/Cargo.toml +++ b/account-decoder/Cargo.toml @@ -22,7 +22,6 @@ serde_json = "1.0.83" 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-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-2022 = { version = "=0.4.3", features = ["no-entrypoint"] } thiserror = "1.0" diff --git a/account-decoder/src/parse_account_data.rs b/account-decoder/src/parse_account_data.rs index 1ffdc4c0f0..d349429c8a 100644 --- a/account-decoder/src/parse_account_data.rs +++ b/account-decoder/src/parse_account_data.rs @@ -11,7 +11,9 @@ use { }, inflector::Inflector, 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, thiserror::Error, }; @@ -23,7 +25,7 @@ lazy_static! { static ref STAKE_PROGRAM_ID: Pubkey = stake::program::id(); static ref SYSTEM_PROGRAM_ID: Pubkey = system_program::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 = { let mut m = HashMap::new(); m.insert( @@ -127,11 +129,16 @@ pub fn parse_account_data( mod test { use { super::*, - solana_sdk::nonce::{ - state::{Data, Versions}, - State, + solana_sdk::{ + nonce::{ + state::{Data, Versions}, + State, + }, + vote::{ + program::id as vote_program_id, + state::{VoteState, VoteStateVersions}, + }, }, - solana_vote_program::vote_state::{VoteState, VoteStateVersions}, }; #[test] @@ -147,7 +154,7 @@ mod test { VoteState::serialize(&versioned, &mut vote_account_data).unwrap(); let parsed = parse_account_data( &account_pubkey, - &solana_vote_program::id(), + &vote_program_id(), &vote_account_data, None, ) diff --git a/account-decoder/src/parse_vote.rs b/account-decoder/src/parse_vote.rs index 1c1ee08d3e..d8388c620a 100644 --- a/account-decoder/src/parse_vote.rs +++ b/account-decoder/src/parse_vote.rs @@ -3,8 +3,8 @@ use { solana_sdk::{ clock::{Epoch, Slot}, pubkey::Pubkey, + vote::state::{BlockTimestamp, Lockout, VoteState}, }, - solana_vote_program::vote_state::{BlockTimestamp, Lockout, VoteState}, }; pub fn parse_vote(data: &[u8]) -> Result { @@ -123,7 +123,7 @@ struct UiEpochCredits { #[cfg(test)] mod test { - use {super::*, solana_vote_program::vote_state::VoteStateVersions}; + use {super::*, solana_sdk::vote::state::VoteStateVersions}; #[test] fn test_parse_vote() { diff --git a/programs/bpf/Cargo.lock b/programs/bpf/Cargo.lock index 519b3dc773..a92ba8e5c7 100644 --- a/programs/bpf/Cargo.lock +++ b/programs/bpf/Cargo.lock @@ -4088,7 +4088,6 @@ dependencies = [ "solana-address-lookup-table-program", "solana-config-program", "solana-sdk 1.15.0", - "solana-vote-program", "spl-token", "spl-token-2022", "thiserror",