Skip to content

replace low-hanging fruit dependencies on solana-program#6351

Merged
t-nelson merged 1 commit intoanza-xyz:masterfrom
t-nelson:dplf
Jun 4, 2025
Merged

replace low-hanging fruit dependencies on solana-program#6351
t-nelson merged 1 commit intoanza-xyz:masterfrom
t-nelson:dplf

Conversation

@t-nelson
Copy link
Copy Markdown

Problem

solana-program has received similar treatment to that of solana-sdk, so we now have individual crates for most of the symbols that this omnicrate used to provide. continuing to use the omnicrate symbols unnecessarily bloats the dependency graph and compile times

Summary of Changes

replace the low-hanging fruit dependencies upon solana-program

@t-nelson t-nelson requested review from a team as code owners May 29, 2025 16:16
@mergify
Copy link
Copy Markdown

mergify Bot commented May 29, 2025

The Firedancer team maintains a line-for-line reimplementation of the
native programs, and until native programs are moved to BPF, those
implementations must exactly match their Agave counterparts.
If this PR represents a change to a native program implementation (not
tests), please include a reviewer from the Firedancer team. And please
keep refactors to a minimum.

steviez
steviez previously approved these changes May 30, 2025
Copy link
Copy Markdown

@steviez steviez left a comment

Choose a reason for hiding this comment

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

Just a couple comments, nothing actionable so LGTM

Comment thread svm/tests/example-programs/write-to-account/Cargo.toml
Comment thread program-test/tests/cpi.rs
Comment on lines -7 to +6
solana_program::instruction::get_stack_height,
solana_program::{instruction::get_stack_height, program::invoke},
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 think I saw you asking about this in Discord - confirming that reintroducing solana_program::program::invoke() is intentional as solana_cpi::invoke() is not 1-for-1 ?

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.

yeah native target code path is just a noop

Comment thread programs/sbf/rust/account_mem_deprecated/Cargo.toml Outdated
LucasSte
LucasSte previously approved these changes May 30, 2025
Copy link
Copy Markdown

@joncinque joncinque left a comment

Choose a reason for hiding this comment

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

Looks great overall, mostly small things!

All of the solana_program::program usage in programs/sbf (invoke, invoke_signed, set_return_data, get_return_data) should be able to use solana_cpi instead, but that can be done in a follow-up.

Comment thread programs/sbf/Cargo.toml Outdated
Comment thread compute-budget-instruction/Cargo.toml Outdated
Comment thread compute-budget-instruction/Cargo.toml Outdated
solana_transaction_context::BorrowedAccount,
std::{mem, ptr},
};
// consts inlined to avoid solana-program dep
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This is pretty glorious. I do wonder if we'll need to expose these consts somewhere else, but we can let people complain first

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 was surprised that they weren't in solana-cpi tbh

Comment thread programs/sbf/rust/iter/src/lib.rs Outdated
Comment thread programs/sbf/rust/sibling_inner_instructions/src/lib.rs Outdated
solana_account_info::AccountInfo,
solana_msg::msg,
solana_program::{
epoch_stake::{get_epoch_stake_for_vote_account, get_epoch_total_stake},
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Eep, these need to get migrated somewhere: anza-xyz/solana-sdk#178

Comment thread rpc-client/Cargo.toml Outdated
Comment thread rpc-client/Cargo.toml
Comment thread runtime-transaction/Cargo.toml Outdated
Comment thread programs/sbf/rust/iter/Cargo.toml Outdated
Comment thread programs/sbf/rust/many_args/Cargo.toml Outdated
Comment thread programs/sbf/rust/many_args_dep/Cargo.toml Outdated
Comment thread programs/sbf/rust/param_passing/Cargo.toml Outdated
Comment thread programs/sbf/rust/sanity/Cargo.toml Outdated
Comment thread programs/sbf/rust/sysvar/Cargo.toml Outdated
@t-nelson t-nelson force-pushed the dplf branch 2 times, most recently from 9767598 to 6912775 Compare June 3, 2025 00:24
Comment thread programs/sbf/Cargo.toml
Copy link
Copy Markdown
Author

@t-nelson t-nelson left a comment

Choose a reason for hiding this comment

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

ok. addressed all comments. ci should go this time

Comment thread program-test/tests/cpi.rs
Comment on lines -7 to +6
solana_program::instruction::get_stack_height,
solana_program::{instruction::get_stack_height, program::invoke},
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.

yeah native target code path is just a noop

solana_transaction_context::BorrowedAccount,
std::{mem, ptr},
};
// consts inlined to avoid solana-program dep
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 was surprised that they weren't in solana-cpi tbh

Comment thread rpc-client/Cargo.toml
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Jun 3, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 82.8%. Comparing base (ad0b379) to head (9108f68).
Report is 5 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #6351   +/-   ##
=======================================
  Coverage    82.7%    82.8%           
=======================================
  Files         849      849           
  Lines      379076   379076           
=======================================
+ Hits       313862   313910   +48     
+ Misses      65214    65166   -48     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

steviez
steviez previously approved these changes Jun 3, 2025
Copy link
Copy Markdown

@steviez steviez left a comment

Choose a reason for hiding this comment

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

This LGTM, but it'd be good to get a ship-it from Jon too

Comment thread programs/sbf/Cargo.toml
Copy link
Copy Markdown

@joncinque joncinque left a comment

Choose a reason for hiding this comment

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

Just a couple of last things

Comment thread programs/sbf/Cargo.toml
Comment thread programs/sbf/rust/sibling_inner_instructions/Cargo.toml Outdated
Comment thread rpc-client/Cargo.toml Outdated
@t-nelson
Copy link
Copy Markdown
Author

t-nelson commented Jun 3, 2025

ok ready for real this time

Copy link
Copy Markdown

@joncinque joncinque left a comment

Choose a reason for hiding this comment

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

Looks great! Thanks for fighting through it

@t-nelson t-nelson mentioned this pull request Jun 4, 2025
Copy link
Copy Markdown

@tao-stones tao-stones left a comment

Choose a reason for hiding this comment

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

:shipit:

@t-nelson t-nelson merged commit 4b2a5a5 into anza-xyz:master Jun 4, 2025
58 checks passed
@t-nelson t-nelson deleted the dplf branch June 4, 2025 14:42
mircea-c pushed a commit to mircea-c/agave that referenced this pull request Jun 12, 2025
mircea-c added a commit to mircea-c/agave that referenced this pull request Jun 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants