Skip to content

Commit

Permalink
Avoid spl-sdk dependency, which inhibits crate publishing
Browse files Browse the repository at this point in the history
  • Loading branch information
mvines authored and mergify[bot] committed Jul 30, 2020
1 parent 1d2426d commit c78e12a
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 22 deletions.
6 changes: 2 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions account-decoder/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ Inflector = "0.11.4"
lazy_static = "1.4.0"
solana-sdk = { path = "../sdk", version = "1.3.0" }
solana-vote-program = { path = "../programs/vote", version = "1.3.0" }
spl-sdk = { package = "solana-sdk", version = "=1.2.13", default-features = false }
spl-token-v1-0 = { package = "spl-token", version = "1.0.2", features = ["skip-no-mangle"] }
spl-token-v1-0 = { package = "spl-token", version = "1.0.3", features = ["skip-no-mangle"] }
serde = "1.0.112"
serde_derive = "1.0.103"
serde_json = "1.0.56"
Expand Down
16 changes: 8 additions & 8 deletions account-decoder/src/parse_token.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use crate::parse_account_data::{ParsableAccount, ParseAccountError};
use solana_sdk::pubkey::Pubkey;
use spl_sdk::pubkey::Pubkey as SplPubkey;
use spl_token_v1_0::{
option::COption,
solana_sdk::pubkey::Pubkey as SplTokenPubkey,
state::{Account, Mint, Multisig, State},
};
use std::{mem::size_of, str::FromStr};
Expand Down Expand Up @@ -51,7 +51,7 @@ pub fn parse_token(data: &[u8]) -> Result<TokenAccountType, ParseAccountError> {
.signers
.iter()
.filter_map(|pubkey| {
if pubkey != &SplPubkey::default() {
if pubkey != &SplTokenPubkey::default() {
Some(pubkey.to_string())
} else {
None
Expand Down Expand Up @@ -109,8 +109,8 @@ mod test {

#[test]
fn test_parse_token() {
let mint_pubkey = SplPubkey::new(&[2; 32]);
let owner_pubkey = SplPubkey::new(&[3; 32]);
let mint_pubkey = SplTokenPubkey::new(&[2; 32]);
let owner_pubkey = SplTokenPubkey::new(&[3; 32]);
let mut account_data = [0; size_of::<Account>()];
let mut account: &mut Account = State::unpack_unchecked(&mut account_data).unwrap();
account.mint = mint_pubkey;
Expand Down Expand Up @@ -144,12 +144,12 @@ mod test {
}),
);

let signer1 = SplPubkey::new(&[1; 32]);
let signer2 = SplPubkey::new(&[2; 32]);
let signer3 = SplPubkey::new(&[3; 32]);
let signer1 = SplTokenPubkey::new(&[1; 32]);
let signer2 = SplTokenPubkey::new(&[2; 32]);
let signer3 = SplTokenPubkey::new(&[3; 32]);
let mut multisig_data = [0; size_of::<Multisig>()];
let mut multisig: &mut Multisig = State::unpack_unchecked(&mut multisig_data).unwrap();
let mut signers = [SplPubkey::default(); 11];
let mut signers = [SplTokenPubkey::default(); 11];
signers[0] = signer1;
signers[1] = signer2;
signers[2] = signer3;
Expand Down
3 changes: 1 addition & 2 deletions core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,7 @@ solana-transaction-status = { path = "../transaction-status", version = "1.3.0"
solana-version = { path = "../version", version = "1.3.0" }
solana-vote-program = { path = "../programs/vote", version = "1.3.0" }
solana-vote-signer = { path = "../vote-signer", version = "1.3.0" }
spl-sdk = { package = "solana-sdk", version = "=1.2.13", default-features = false }
spl-token-v1-0 = { package = "spl-token", version = "1.0.2", features = ["skip-no-mangle"] }
spl-token-v1-0 = { package = "spl-token", version = "1.0.3", features = ["skip-no-mangle"] }
tempfile = "3.1.0"
thiserror = "1.0"
tokio = "0.1"
Expand Down
13 changes: 7 additions & 6 deletions core/src/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2087,8 +2087,9 @@ pub mod tests {
vote_instruction,
vote_state::{Vote, VoteInit, MAX_LOCKOUT_HISTORY},
};
use spl_sdk::pubkey::Pubkey as SplPubkey;
use spl_token_v1_0::{option::COption, state::Mint};
use spl_token_v1_0::{
option::COption, solana_sdk::pubkey::Pubkey as SplTokenPubkey, state::Mint,
};
use std::collections::HashMap;

const TEST_MINT_LAMPORTS: u64 = 1_000_000;
Expand Down Expand Up @@ -4267,9 +4268,9 @@ pub mod tests {

let mut account_data = [0; size_of::<TokenAccount>()];
let account: &mut TokenAccount = TokenState::unpack_unchecked(&mut account_data).unwrap();
let mint = SplPubkey::new(&[2; 32]);
let owner = SplPubkey::new(&[3; 32]);
let delegate = SplPubkey::new(&[4; 32]);
let mint = SplTokenPubkey::new(&[2; 32]);
let owner = SplTokenPubkey::new(&[3; 32]);
let delegate = SplTokenPubkey::new(&[4; 32]);
*account = TokenAccount {
mint,
owner,
Expand Down Expand Up @@ -4349,7 +4350,7 @@ pub mod tests {
// Add another token account with the same owner and delegate but different mint
let mut account_data = [0; size_of::<TokenAccount>()];
let account: &mut TokenAccount = TokenState::unpack_unchecked(&mut account_data).unwrap();
let new_mint = SplPubkey::new(&[5; 32]);
let new_mint = SplTokenPubkey::new(&[5; 32]);
*account = TokenAccount {
mint: new_mint,
owner,
Expand Down

0 comments on commit c78e12a

Please sign in to comment.