Skip to content

Commit

Permalink
updating to solana 2.1 and mollusk personal version
Browse files Browse the repository at this point in the history
  • Loading branch information
kox committed Nov 22, 2024
1 parent cdbe551 commit 24d267f
Show file tree
Hide file tree
Showing 17 changed files with 1,379 additions and 771 deletions.
2,051 changes: 1,327 additions & 724 deletions Cargo.lock

Large diffs are not rendered by default.

17 changes: 11 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,18 @@ license = "Apache-2.0"
[workspace.dependencies]
bytemuck = "1.19.0"
five8_const = "0.1.3"
mollusk-svm = { git = "https://github.com/deanmlittle/mollusk" }
mollusk-token = { git = "https://github.com/deanmlittle/mollusk" }
mollusk-svm = { git = "https://github.com/kox/mollusk", branch = "add-test-program-crates-for-token-and-memo" }
mollusk-svm-programs-token = { git = "https://github.com/kox/mollusk", branch = "add-test-program-crates-for-token-and-memo"}
pinocchio = "0.6.0"
pinocchio-system = "0.2.0"
pinocchio-token = "0.2.0"
solana-nostd-sha256 = "0.1.3"
solana-program = "=2.0.15"
solana-program-test = "=2.0.15"
solana-sdk = "=2.0.15"
spl-token = { version = "6.0.0", features = ["no-entrypoint"] }
solana-program = "=2.1.0"
solana-program-test = "=2.1.0"
solana-sdk = "=2.1.0"
spl-token = { version = "7.0.0", features = ["no-entrypoint"] }

#solana-program = "=2.0.15"
# solana-program-test = "=2.0.15"
#solana-sdk = "=2.0.15"
# spl-token = { version = "6.0.0", features = ["no-entrypoint"] }
2 changes: 1 addition & 1 deletion amm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ solana-nostd-sha256 = { workspace = true }

[dev-dependencies]
mollusk-svm = { workspace = true }
mollusk-token = { workspace = true }
mollusk-svm-programs-token = { workspace = true }
solana-sdk = { workspace = true }
spl-token = { workspace = true }

Expand Down
2 changes: 1 addition & 1 deletion amm/tests/deposit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ mod deposit_tests {
#[test]
fn deposit() {
let (mollusk, program_id) = shared::setup();
let (token_program, token_program_account) = mollusk_token::token::keyed_account();
let (token_program, token_program_account) = mollusk_svm_programs_token::token::keyed_account();

let user = Pubkey::new_unique();
let config = Pubkey::new_unique();
Expand Down
16 changes: 8 additions & 8 deletions amm/tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ mod tests {
let mut mollusk = Mollusk::new(&program_id, "../target/deploy/amm");
mollusk_token::token::add_program(&mut mollusk);
let (token_program, token_program_account) = mollusk_token::token::keyed_account();
mollusk_svm_programs_token::token::add_program(&mut mollusk);
let (token_program, token_program_account) = mollusk_svm_programs_token::token::keyed_account();
let user = Pubkey::new_unique();
let config = Pubkey::new_unique();
Expand Down Expand Up @@ -174,8 +174,8 @@ fn deposit() {
let mut mollusk = Mollusk::new(&program_id, "../target/deploy/amm");
mollusk_token::token::add_program(&mut mollusk);
let (token_program, token_program_account) = mollusk_token::token::keyed_account();
mollusk_svm_programs_token::token::add_program(&mut mollusk);
let (token_program, token_program_account) = mollusk_svm_programs_token::token::keyed_account();
let user = Pubkey::new_unique();
let config = Pubkey::new_unique();
Expand Down Expand Up @@ -389,8 +389,8 @@ fn deposit() {
let mut mollusk = Mollusk::new(&program_id, "../target/deploy/amm");
mollusk_token::token::add_program(&mut mollusk);
let (token_program, token_program_account) = mollusk_token::token::keyed_account();
mollusk_svm_programs_token::token::add_program(&mut mollusk);
let (token_program, token_program_account) = mollusk_svm_programs_token::token::keyed_account();
let user = Pubkey::new_unique();
let config = Pubkey::new_unique();
Expand Down Expand Up @@ -603,8 +603,8 @@ fn deposit() {
let mut mollusk = Mollusk::new(&program_id, "target/deploy/native_amm");
mollusk_token::token::add_program(&mut mollusk);
let (token_program, token_program_account) = mollusk_token::token::keyed_account();
mollusk_svm_programs_token::token::add_program(&mut mollusk);
let (token_program, token_program_account) = mollusk_svm_programs_token::token::keyed_account();
let user = Pubkey::new_unique();
let config = Pubkey::new_unique();
Expand Down
2 changes: 1 addition & 1 deletion amm/tests/shared.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pub fn setup() -> (Mollusk, Pubkey) {
let project_name = format!("../target/deploy/{}", env!("CARGO_PKG_NAME"));
let mut mollusk = Mollusk::new(&program_id, &project_name);

mollusk_token::token::add_program(&mut mollusk);
mollusk_svm_programs_token::token::add_program(&mut mollusk);
(mollusk, program_id)
}

Expand Down
2 changes: 1 addition & 1 deletion amm/tests/swap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ mod swap_tests {
#[test]
fn swap() {
let (mollusk, program_id) = shared::setup();
let (token_program, token_program_account) = mollusk_token::token::keyed_account();
let (token_program, token_program_account) = mollusk_svm_programs_token::token::keyed_account();

let user = Pubkey::new_unique();
let config = Pubkey::new_unique();
Expand Down
2 changes: 1 addition & 1 deletion escrow-optimized/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ solana-nostd-sha256 = { workspace = true }

[dev-dependencies]
mollusk-svm = { workspace = true }
mollusk-token = { workspace = true }
mollusk-mollusk-svm-programs-token = { workspace = true }
solana-sdk = { workspace = true }
spl-token = { workspace = true }
2 changes: 1 addition & 1 deletion experimental-loader/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ solana-nostd-sha256 = { workspace = true }

[dev-dependencies]
mollusk-svm = { workspace = true }
mollusk-token = { workspace = true }
mollusk-svm-programs-token = { workspace = true }
solana-sdk = { workspace = true }
spl-token = { workspace = true }

Expand Down
2 changes: 1 addition & 1 deletion fundraiser/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ solana-nostd-sha256 = { workspace = true }

[dev-dependencies]
mollusk-svm = { workspace = true }
mollusk-token = { workspace = true }
mollusk-svm-programs-token = { workspace = true }
solana-sdk = { workspace = true }
spl-token = { workspace = true }

Expand Down
16 changes: 8 additions & 8 deletions fundraiser/tests/checker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ mod checker_tests {
#[test]
fn should_fail_when_still_running() {
let mut mollusk = Mollusk::new(&PROGRAM_ID, "../target/deploy/fundraiser");
mollusk_token::token::add_program(&mut mollusk);
let (token_program, token_program_account) = mollusk_token::token::keyed_account();
mollusk_svm_programs_token::token::add_program(&mut mollusk);
let (token_program, token_program_account) = mollusk_svm_programs_token::token::keyed_account();

let maker = Pubkey::new_unique();
let maker_ta = Pubkey::new_unique();
Expand Down Expand Up @@ -83,9 +83,9 @@ mod checker_tests {
#[test]
fn should_fail_when_not_reach_goal() {
let mut mollusk = Mollusk::new(&PROGRAM_ID, "../target/deploy/fundraiser");
mollusk_token::token::add_program(&mut mollusk);
mollusk_svm_programs_token::token::add_program(&mut mollusk);
mollusk.sysvars.warp_to_slot(2); // We start in slot 2 so we can test expired (0)
let (token_program, token_program_account) = mollusk_token::token::keyed_account();
let (token_program, token_program_account) = mollusk_svm_programs_token::token::keyed_account();

let maker = Pubkey::new_unique();
let maker_ta = Pubkey::new_unique();
Expand Down Expand Up @@ -145,9 +145,9 @@ mod checker_tests {
#[test]
fn should_fail_when_not_maker_tries_to_claim() {
let mut mollusk = Mollusk::new(&PROGRAM_ID, "../target/deploy/fundraiser");
mollusk_token::token::add_program(&mut mollusk);
mollusk_svm_programs_token::token::add_program(&mut mollusk);
mollusk.sysvars.warp_to_slot(2); // We start in slot 2 so we can test expired (0)
let (token_program, token_program_account) = mollusk_token::token::keyed_account();
let (token_program, token_program_account) = mollusk_svm_programs_token::token::keyed_account();

let scammer = Pubkey::new_unique();
let maker = Pubkey::new_unique();
Expand Down Expand Up @@ -209,9 +209,9 @@ mod checker_tests {
#[test]
fn checker() {
let mut mollusk = Mollusk::new(&PROGRAM_ID, "../target/deploy/fundraiser");
mollusk_token::token::add_program(&mut mollusk);
mollusk_svm_programs_token::token::add_program(&mut mollusk);
mollusk.sysvars.warp_to_slot(2); // We start in slot 2 so we can test expired (0)
let (token_program, token_program_account) = mollusk_token::token::keyed_account();
let (token_program, token_program_account) = mollusk_svm_programs_token::token::keyed_account();

let maker = Pubkey::new_unique();
let maker_ta = Pubkey::new_unique();
Expand Down
16 changes: 8 additions & 8 deletions fundraiser/tests/contribute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ mod contribute_tests {
#[test]
fn should_fail_when_lower_than_minimun() {
let mut mollusk = Mollusk::new(&PROGRAM_ID, "../target/deploy/fundraiser");
mollusk_token::token::add_program(&mut mollusk);
let (token_program, token_program_account) = mollusk_token::token::keyed_account();
mollusk_svm_programs_token::token::add_program(&mut mollusk);
let (token_program, token_program_account) = mollusk_svm_programs_token::token::keyed_account();

let maker = Pubkey::new_unique();
let contributor = Pubkey::new_unique();
Expand Down Expand Up @@ -88,8 +88,8 @@ mod contribute_tests {
#[test]
fn should_fail_when_expired() {
let mut mollusk = Mollusk::new(&PROGRAM_ID, "../target/deploy/fundraiser");
mollusk_token::token::add_program(&mut mollusk);
let (token_program, token_program_account) = mollusk_token::token::keyed_account();
mollusk_svm_programs_token::token::add_program(&mut mollusk);
let (token_program, token_program_account) = mollusk_svm_programs_token::token::keyed_account();

let maker = Pubkey::new_unique();
let contributor = Pubkey::new_unique();
Expand Down Expand Up @@ -153,8 +153,8 @@ mod contribute_tests {
#[test]
fn contribute() {
let mut mollusk = Mollusk::new(&PROGRAM_ID, "../target/deploy/fundraiser");
mollusk_token::token::add_program(&mut mollusk);
let (token_program, token_program_account) = mollusk_token::token::keyed_account();
mollusk_svm_programs_token::token::add_program(&mut mollusk);
let (token_program, token_program_account) = mollusk_svm_programs_token::token::keyed_account();

let maker = Pubkey::new_unique();
let contributor = Pubkey::new_unique();
Expand Down Expand Up @@ -297,8 +297,8 @@ mod contribute_tests {
#[test]
fn contribute_twice() {
let mut mollusk = Mollusk::new(&PROGRAM_ID, "../target/deploy/fundraiser");
mollusk_token::token::add_program(&mut mollusk);
let (token_program, token_program_account) = mollusk_token::token::keyed_account();
mollusk_svm_programs_token::token::add_program(&mut mollusk);
let (token_program, token_program_account) = mollusk_svm_programs_token::token::keyed_account();

let maker = Pubkey::new_unique();
let contributor = Pubkey::new_unique();
Expand Down
12 changes: 6 additions & 6 deletions fundraiser/tests/refund.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ mod refund_tests {
#[test]
fn should_fail_when_campaign_still_running() {
let mut mollusk = Mollusk::new(&PROGRAM_ID, "../target/deploy/fundraiser");
mollusk_token::token::add_program(&mut mollusk);
let (token_program, token_program_account) = mollusk_token::token::keyed_account();
mollusk_svm_programs_token::token::add_program(&mut mollusk);
let (token_program, token_program_account) = mollusk_svm_programs_token::token::keyed_account();

let maker = Pubkey::new_unique();
let contributor = Pubkey::new_unique();
Expand Down Expand Up @@ -84,9 +84,9 @@ mod refund_tests {
#[test]
fn should_fail_when_campaign_ended_reached_goal() {
let mut mollusk = Mollusk::new(&PROGRAM_ID, "../target/deploy/fundraiser");
mollusk_token::token::add_program(&mut mollusk);
mollusk_svm_programs_token::token::add_program(&mut mollusk);
mollusk.sysvars.warp_to_slot(2); // We start in slot 2 so we can test expired (0)
let (token_program, token_program_account) = mollusk_token::token::keyed_account();
let (token_program, token_program_account) = mollusk_svm_programs_token::token::keyed_account();

let maker = Pubkey::new_unique();
let contributor = Pubkey::new_unique();
Expand Down Expand Up @@ -150,9 +150,9 @@ mod refund_tests {
#[test]
fn refund() {
let mut mollusk = Mollusk::new(&PROGRAM_ID, "../target/deploy/fundraiser");
mollusk_token::token::add_program(&mut mollusk);
mollusk_svm_programs_token::token::add_program(&mut mollusk);
mollusk.sysvars.warp_to_slot(2); // We start in slot 2 so we can test expired (0)
let (token_program, token_program_account) = mollusk_token::token::keyed_account();
let (token_program, token_program_account) = mollusk_svm_programs_token::token::keyed_account();

let maker = Pubkey::new_unique();
let contributor = Pubkey::new_unique();
Expand Down
2 changes: 1 addition & 1 deletion marketplace-native/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ solana-nostd-sha256 = { workspace = true }

[dev-dependencies]
mollusk-svm = { workspace = true }
mollusk-token = { workspace = true }
mollusk-svm-programs-token = { workspace = true }
solana-sdk = { workspace = true }
spl-token = { workspace = true }

Expand Down
2 changes: 1 addition & 1 deletion marketplace-native/src/instructions/publish.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use pinocchio::{
// > price
//
pub fn publish(accounts: &[AccountInfo], data: &[u8]) -> ProgramResult {
let [publisher, marketplace, , _token_program] = accounts
// let [publisher, marketplace, , _token_program] = accounts

Ok(())
}
2 changes: 1 addition & 1 deletion marketplace-native/tests/shared.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pub fn setup() -> (Mollusk, Pubkey) {
let project_name = format!("../target/deploy/{}", env!("CARGO_PKG_NAME"));
let mut mollusk = Mollusk::new(&program_id, &project_name);

mollusk_token::token::add_program(&mut mollusk);
mollusk_svm_programs_token::token::add_program(&mut mollusk);
(mollusk, program_id)
}

Expand Down
2 changes: 1 addition & 1 deletion voting_optimized/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ solana-nostd-sha256 = { workspace = true }

[dev-dependencies]
mollusk-svm = { workspace = true }
mollusk-token = { workspace = true }
mollusk-svm-programs-token = { workspace = true }
solana-sdk = { workspace = true }
spl-token = { workspace = true }

Expand Down

0 comments on commit 24d267f

Please sign in to comment.