Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
782 changes: 368 additions & 414 deletions Cargo.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions discriminator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ borsh = ["dep:borsh"]
[dependencies]
borsh = { version = "1", optional = true, features = ["derive"] }
bytemuck = { version = "1.23.2", features = ["derive"] }
solana-program-error = "2.2.2"
solana-sha256-hasher = "2.3.0"
solana-program-error = "3.0.0"
solana-sha256-hasher = { version = "3.0.0", features = ["sha2"] }
spl-discriminator-derive = { version = "0.2.0", path = "./derive" }

[dev-dependencies]
Expand Down
5 changes: 3 additions & 2 deletions generic-token-tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ edition = "2021"
[dev-dependencies]
rand = "0.9.2"
spl-generic-token = { path = "../generic-token" }
spl-token = "8.0.0"
spl-token-2022 = "9.0.0"
spl-token-interface = "1.0.0"
spl-token-2022-interface = "1.0.0"
solana-program-pack = "2.2.1"
solana-pubkey = { version = "2.2.1", features = [
"rand",
] }
Expand Down
40 changes: 29 additions & 11 deletions generic-token-tests/tests/test_generic_token.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
use {
rand::prelude::*,
solana_program_pack::Pack,
spl_generic_token::{generic_token, token, token_2022},
spl_token::{
solana_program::program_pack::Pack,
state::{Account as SplAccount, AccountState as SplAccountState, Mint as SplMint},
},
spl_token_2022::{
spl_token_2022_interface::{
extension::set_account_type,
state::{Account as SplAccount2022, Mint as SplMint2022, Multisig as SplMultisig},
},
spl_token_interface::state::{
Account as SplAccount, AccountState as SplAccountState, Mint as SplMint,
},
test_case::test_case,
};

Expand Down Expand Up @@ -85,23 +85,41 @@ fn test_generic_account(is_token_2022_account: bool) {
let test_account =
generic_token::Account::unpack(&account_data, &token_2022::id()).unwrap();

assert_eq!(test_account.mint, expected_account.mint);
assert_eq!(test_account.owner, expected_account.owner);
assert_eq!(
test_account.mint.to_bytes(),
expected_account.mint.to_bytes()
);
assert_eq!(
test_account.owner.to_bytes(),
expected_account.owner.to_bytes()
);
assert_eq!(test_account.amount, expected_account.amount);
} else if is_initialized {
// token
let test_account = generic_token::Account::unpack(&account_data, &token::id()).unwrap();

assert_eq!(test_account.mint, expected_account.mint);
assert_eq!(test_account.owner, expected_account.owner);
assert_eq!(
test_account.mint.to_bytes(),
expected_account.mint.to_bytes()
);
assert_eq!(
test_account.owner.to_bytes(),
expected_account.owner.to_bytes()
);
assert_eq!(test_account.amount, expected_account.amount);

// token22
let test_account =
generic_token::Account::unpack(&account_data, &token_2022::id()).unwrap();

assert_eq!(test_account.mint, expected_account.mint);
assert_eq!(test_account.owner, expected_account.owner);
assert_eq!(
test_account.mint.to_bytes(),
expected_account.mint.to_bytes()
);
assert_eq!(
test_account.owner.to_bytes(),
expected_account.owner.to_bytes()
);
assert_eq!(test_account.amount, expected_account.amount);
} else {
// token
Expand Down
2 changes: 1 addition & 1 deletion generic-token/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ edition = "2021"

[dependencies]
bytemuck = "1.23.2"
solana-pubkey = { version = "2.2.1", default-features = false, features = [
solana-pubkey = { version = "3.0.0", default-features = false, features = [
"bytemuck",
] }

Expand Down
8 changes: 4 additions & 4 deletions pod/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ num-derive = "0.4"
num_enum = "0.7"
num-traits = "0.2"
serde = { version = "1.0.219", optional = true }
solana-program-error = "2.2.2"
solana-program-option = "2.2.1"
solana-pubkey = "2.2.1"
solana-zk-sdk = "3.0.0"
solana-program-error = "3.0.0"
solana-program-option = "3.0.0"
solana-pubkey = "3.0.0"
solana-zk-sdk = "4.0.0"
thiserror = "2.0"

[dev-dependencies]
Expand Down
2 changes: 1 addition & 1 deletion pod/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ impl From<PodSliceError> for ProgramError {
}

impl ToStr for PodSliceError {
fn to_str<E>(&self) -> &'static str {
fn to_str(&self) -> &'static str {
match self {
PodSliceError::CalculationFailure => "Error in checked math operation",
PodSliceError::BufferTooSmall => "Provided byte buffer too small for expected type",
Expand Down
7 changes: 3 additions & 4 deletions program-error/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,16 @@ edition = "2021"
num-derive = "0.4"
num_enum = "0.7"
num-traits = "0.2"
solana-decode-error = "2.2.1"
solana-msg = "3.0.0"
solana-program-error = "2.2.2"
solana-program-error = "3.0.0"
spl-program-error-derive = { version = "0.5.0", path = "./derive" }
thiserror = "2.0"

[dev-dependencies]
lazy_static = "1.5"
serial_test = "3.2"
solana-sha256-hasher = "2.3.0"
solana-sysvar = "2.3.0"
solana-sha256-hasher = "3.0.0"
solana-sysvar = "3.0.0"

[lib]
crate-type = ["cdylib", "lib"]
Expand Down
2 changes: 1 addition & 1 deletion program-error/derive/src/macro_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ pub fn to_str(
});
let this_impl = quote! {
impl #program_error_import::ToStr for #ident {
fn to_str<E>(&self) -> &'static str {
fn to_str(&self) -> &'static str {
match self {
#(#ppe_match_arms),*
}
Expand Down
2 changes: 1 addition & 1 deletion program-error/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ extern crate self as spl_program_error;
// Make these available downstream for the macro to work without
// additional imports
pub use {
num_derive, num_traits, solana_decode_error, solana_program_error,
num_derive, num_traits, solana_program_error,
spl_program_error_derive::{spl_program_error, IntoProgramError, ToStr},
thiserror,
};
2 changes: 1 addition & 1 deletion program-error/tests/bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ impl From<ExampleError> for solana_program_error::ProgramError {
}

impl solana_program_error::ToStr for ExampleError {
fn to_str<E>(&self) -> &'static str {
fn to_str(&self) -> &'static str {
match self {
ExampleError::MintHasNoMintAuthority => "Mint has no mint authority",
ExampleError::IncorrectMintAuthority => {
Expand Down
8 changes: 4 additions & 4 deletions program-error/tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ mod tests {
);
// `ToStr`
assert_eq!(
ToStr::to_str::<to_str::ExampleError>(&to_str::ExampleError::MintHasNoMintAuthority,),
ToStr::to_str(&to_str::ExampleError::MintHasNoMintAuthority,),
"Mint has no mint authority"
);
assert_eq!(
ToStr::to_str::<to_str::ExampleError>(&to_str::ExampleError::IncorrectMintAuthority,),
ToStr::to_str(&to_str::ExampleError::IncorrectMintAuthority,),
"Incorrect mint authority has signed the instruction"
);
}
Expand All @@ -61,11 +61,11 @@ mod tests {
);
// `ToStr`
assert_eq!(
ToStr::to_str::<spl::ExampleError>(&spl::ExampleError::MintHasNoMintAuthority),
ToStr::to_str(&spl::ExampleError::MintHasNoMintAuthority),
"Mint has no mint authority"
);
assert_eq!(
ToStr::to_str::<spl::ExampleError>(&spl::ExampleError::IncorrectMintAuthority),
ToStr::to_str(&spl::ExampleError::IncorrectMintAuthority),
"Incorrect mint authority has signed the instruction",
);
}
Expand Down
9 changes: 4 additions & 5 deletions tlv-account-resolution/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,10 @@ num-derive = "0.4"
num_enum = "0.7"
num-traits = "0.2"
serde = { version = "1.0.219", optional = true }
solana-account-info = "2.2.1"
solana-decode-error = "2.2.1"
solana-instruction = { version = "2.2.1", features = ["std"] }
solana-program-error = "2.2.2"
solana-pubkey = { version = "2.2.1", features = ["curve25519"] }
solana-account-info = "3.0.0"
solana-instruction = { version = "3.0.0", features = ["std"] }
solana-program-error = "3.0.0"
solana-pubkey = { version = "3.0.0", features = ["curve25519"] }
spl-discriminator = { version = "0.4.0", path = "../discriminator" }
spl-program-error = { version = "0.7.0", path = "../program-error" }
spl-pod = { version = "0.6.0", path = "../pod" }
Expand Down
2 changes: 1 addition & 1 deletion tlv-account-resolution/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ impl From<AccountResolutionError> for ProgramError {
}

impl ToStr for AccountResolutionError {
fn to_str<E>(&self) -> &'static str {
fn to_str(&self) -> &'static str {
match self {
AccountResolutionError::IncorrectAccount => {
"Incorrect account provided"
Expand Down
5 changes: 1 addition & 4 deletions tlv-account-resolution/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,4 @@ pub mod state;

// Export current sdk types for downstream users building with a different sdk
// version
pub use {
solana_account_info, solana_decode_error, solana_instruction, solana_program_error,
solana_pubkey,
};
pub use {solana_account_info, solana_instruction, solana_program_error, solana_pubkey};
Loading