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
2 changes: 1 addition & 1 deletion Cargo.lock

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

2 changes: 1 addition & 1 deletion program-test/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ solana-runtime = { workspace = true }
solana-sbpf = { workspace = true }
solana-sdk = { workspace = true }
solana-sdk-ids = { workspace = true }
solana-sdk-macro = { workspace = true }
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would expect this PR to remove solana-sdk from the list (2 lines up from here) as well

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Normally yes, but that's the last reference in the repo. If I do that, I'd have to pull in the changes from other PRs mentioned in my last comment, which are all the other cargo changes that are also deleted. I wanted to fix each in a separate PR to keep it clean and easier to review.

This is the last module dependent on solana-sdk. Once this PR lands, we can land #6333 then #6334 in that order.

solana-signer = { workspace = true }
solana-stable-layout = { workspace = true }
solana-stake-interface = { workspace = true }
Expand All @@ -69,5 +68,6 @@ thiserror = { workspace = true }
tokio = { workspace = true, features = ["full"] }

[dev-dependencies]
solana-program = { workspace = true }
solana-stake-program = { workspace = true }
test-case = { workspace = true }
4 changes: 2 additions & 2 deletions program-test/src/programs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ use {
};

mod spl_memo_1_0 {
solana_sdk_macro::declare_id!("Memo1UhkJRfHyvLMcVucJwxXeuD728EqVDDwQDxFMNo");
solana_pubkey::declare_id!("Memo1UhkJRfHyvLMcVucJwxXeuD728EqVDDwQDxFMNo");
}
mod spl_memo_3_0 {
solana_sdk_macro::declare_id!("MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr");
solana_pubkey::declare_id!("MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr");
}

static SPL_PROGRAMS: &[(Pubkey, Pubkey, &[u8])] = &[
Expand Down
2 changes: 1 addition & 1 deletion program-test/tests/cpi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ use {
solana_instruction::{AccountMeta, Instruction},
solana_keypair::Keypair,
solana_msg::msg,
solana_program::instruction::get_stack_height,
solana_program_entrypoint::{ProgramResult, MAX_PERMITTED_DATA_INCREASE},
solana_program_test::{processor, ProgramTest},
solana_pubkey::Pubkey,
solana_rent::Rent,
solana_sdk::instruction::get_stack_height,
solana_signer::Signer,
solana_system_interface::{instruction as system_instruction, program as system_program},
solana_sysvar::Sysvar,
Expand Down
2 changes: 1 addition & 1 deletion program-test/tests/return_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ use {
solana_commitment_config::CommitmentLevel,
solana_instruction::{AccountMeta, Instruction},
solana_msg::msg,
solana_program::program::{get_return_data, invoke, set_return_data},
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Per this guide from Kevin, the recomended replacement for solana_program::program is solana_cpi crate. However when I import the latter here, both tests fail. So I seem to be hitting a bug in that crate that I don't have the BW to debug at the moment. So I oped for using the "legacy" import for now to unblock my immediate problem. But I wanted to flag that here.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

problem here is that the new implementations drop the sysvar_stubs module and just blindly return None. gonna need some thought to clear this one

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I looked into this a bit more. It's actually working as expected and I had an incorrect understanding of the two crates being functionally equivalent. The solana_cpi vs solana_{sdk; program}::program differences for these methods look intentional based on the implementation and comments.

The tests expect the overwrite as well.

/// Like [`solana_cpi::get_return_data`], but with support
/// for overwriting the `sol_get_return_data` syscall stub.
///
/// [`solana_cpi::get_return_data`]: https://docs.rs/solana-cpi/latest/solana_cpi/fn.get_return_data.html
pub fn get_return_data() -> Option<(Pubkey, Vec<u8>)> {
    #[cfg(target_os = "solana")]
    {
        solana_cpi::get_return_data()
    }

    #[cfg(not(target_os = "solana"))]
    crate::program_stubs::sol_get_return_data()
}

Considering this resolved.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i mean solana-program is up next, but i guess this is a step in the right direction

solana_program_error::{ProgramError, ProgramResult},
solana_program_test::{processor, ProgramTest},
solana_pubkey::Pubkey,
solana_sdk::program::{get_return_data, invoke, set_return_data},
solana_signer::Signer,
solana_transaction::Transaction,
solana_transaction_context::TransactionReturnData,
Expand Down
1 change: 0 additions & 1 deletion programs/sbf/Cargo.lock

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

1 change: 0 additions & 1 deletion svm/examples/Cargo.lock

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

Loading