Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove solana-sdk from solana-timings #3731

Merged
merged 12 commits into from
Dec 6, 2024

Conversation

kevinheavey
Copy link

Problem

This crate can compile faster without solana-sdk

Summary of Changes

  • Use solana-pubkey instead of solana_sdk::pubkey
  • Use the saturating_add_assign crate instead of solana_sdk::saturating_add_assign. I copied this macro from solana-sdk and published it in a standalone crate. I did this because it seems silly to include this in the normal Agave publishing workflow when this crate will probably never change. For that reason I also pinned the version to "=1.0.0".

That said, I would make no objection to just copy-pasting the macro into solana-timings and other crates

Copy link

@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.

agave/sdk/src/lib.rs

Lines 206 to 213 in 86a7062

/// Convenience macro for `AddAssign` with saturating arithmetic.
/// Replace by `std::num::Saturating` once stable
#[macro_export]
macro_rules! saturating_add_assign {
($i:expr, $v:expr) => {{
$i = $i.saturating_add($v)
}};
}

Saturating is stable as of 1.74.0:
https://doc.rust-lang.org/std/num/struct.Saturating.html

So, I think I'd prefer to see us update to use Saturating<T> in solana-timings instead of shifting the macro + depending on the new crate

Certainly out of scope for this PR, but replacing all instances of saturating_add_assign! with Saturating<T> would be nice too

Copy link

mergify bot commented Nov 21, 2024

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.

@kevinheavey
Copy link
Author

@steviez done. I regret doing this because it looked like a small change at first

@steviez
Copy link

steviez commented Nov 21, 2024

@steviez done. I regret doing this because it looked like a small change at first

After I commented, I started making the change as well and then also realized it went a lot further than just solana-timing so thank you for doing it

Copy link

@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.

Apologies on the delayed review, but this LGTM! Tedious work but the right move long term.

Looks like we need a review from @anza-xyz/svm too; I'll try to poke someone from there too

@kevinheavey kevinheavey added the automerge automerge Merge this Pull Request automatically once CI passes label Dec 5, 2024
@pgarg66 pgarg66 merged commit 89872fd into anza-xyz:master Dec 6, 2024
52 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge automerge Merge this Pull Request automatically once CI passes need:merge-assist
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants