program-test: remove solana-sdk dependency#6299
Conversation
| solana_commitment_config::CommitmentLevel, | ||
| solana_instruction::{AccountMeta, Instruction}, | ||
| solana_msg::msg, | ||
| solana_program::program::{get_return_data, invoke, set_return_data}, |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
i mean solana-program is up next, but i guess this is a step in the right direction
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #6299 +/- ##
=======================================
Coverage 82.8% 82.8%
=======================================
Files 846 846
Lines 378217 378215 -2
=======================================
+ Hits 313234 313315 +81
+ Misses 64983 64900 -83 🚀 New features to boost your workflow:
|
|
i think this one was superseded by #6302 |
The overlap was in 'core/src/banking_stage/latest_validator_vote_packet.rs', and got dropped in the rebase. So this is now strictly "program-test" clean-up. |
…_sdk_macro with sdk_pubkey to completely remove solana-sdk
| solana-sbpf = { workspace = true } | ||
| solana-sdk = { workspace = true } | ||
| solana-sdk-ids = { workspace = true } | ||
| solana-sdk-macro = { workspace = true } |
There was a problem hiding this comment.
I would expect this PR to remove solana-sdk from the list (2 lines up from here) as well
There was a problem hiding this comment.
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_commitment_config::CommitmentLevel, | ||
| solana_instruction::{AccountMeta, Instruction}, | ||
| solana_msg::msg, | ||
| solana_program::program::{get_return_data, invoke, set_return_data}, |
There was a problem hiding this comment.
i mean solana-program is up next, but i guess this is a step in the right direction
Problem
As part of invalidator upstream sync, I hit CI failures related to these solana-sdk crate imports.
Summary of Changes
Remove the solana-sdk and solana-sdk-macro dependencies from program-test.