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

Extract reserved-account-keys and sdk-ids crates #3141

Open
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

kevinheavey
Copy link

@kevinheavey kevinheavey commented Oct 11, 2024

Problem

  • solana_sdk::reserved_account_keys blocks moving out solana_sdk::transaction
  • It would be good to be able to use important program IDs without importing heavy dependencies or inlining them

Summary of Changes

  • Extract reserved-account-keys-crate and re-export for backwards compatibility
  • For every ID definition imported by reserved-account-keys, move that definition to solana-sdk-ids and re-export it where it used to be

This branches off #3140 so that needs to be merged first

Copy link

mergify bot commented Oct 11, 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

kevinheavey commented Oct 13, 2024

This might be cleaner as two separate crates? One that just contains the ID declarations (perhaps solana-sdk-ids) and another containing ReservedAccountKeys &co.

This would avoid having to do all the feature and target_os stuff that ended up being uglier than I expected.

@joncinque thoughts?

@kevinheavey kevinheavey force-pushed the extract-reserved-account-keys branch 2 times, most recently from a220745 to b2ebbdd Compare October 15, 2024 12:39
@kevinheavey kevinheavey marked this pull request as ready for review October 15, 2024 13:12
@kevinheavey
Copy link
Author

This might be cleaner as two separate crates? One that just contains the ID declarations (perhaps solana-sdk-ids

I see there is already a deprecated solana_program::sdk_ids module so the name would clash. But no other name comes to mind and it wouldn't be the worst thing to clash with

@kevinheavey kevinheavey force-pushed the extract-reserved-account-keys branch 3 times, most recently from 0fa703a to bfb99a2 Compare October 22, 2024 23:59
@kevinheavey kevinheavey force-pushed the extract-reserved-account-keys branch 2 times, most recently from 31f8d8c to d607510 Compare October 29, 2024 21:19
@kevinheavey kevinheavey changed the title Extract reserved-account-keys crate Extract reserved-account-keys and sdk-ids crates Oct 29, 2024
@kevinheavey
Copy link
Author

kevinheavey commented Oct 29, 2024

Ok ended up having no choice but to make it two crates because there was a circular dependency when everything was in reserved-account-keys

@kevinheavey kevinheavey force-pushed the extract-reserved-account-keys branch 2 times, most recently from c44c07a to ab74ae8 Compare November 1, 2024 12:24
Copy link

@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 to me! Just one little point for stake::program

@@ -0,0 +1,19 @@
[package]
name = "solana-sdk-ids"

Choose a reason for hiding this comment

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

I went back and forth on other possible names for the crate, but solana-sdk-ids seems like the clearest

sdk/sdk-ids/src/lib.rs Outdated Show resolved Hide resolved

Choose a reason for hiding this comment

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

Out of curiosity, does this crate negatively impact build times on the crates that re-export it? Or is the macro quick?

Copy link
Author

Choose a reason for hiding this comment

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

Based on running cargo build -r on solana-sysvar-id ten times each for this branch and the master branch, the increase in build time is 0.05 seconds on my machine. And that's the worst case because solana-sysvar-id gets blocked waiting for solana-sdk-ids to compile

@kevinheavey kevinheavey force-pushed the extract-reserved-account-keys branch 2 times, most recently from 4b84eeb to 8d342e9 Compare November 5, 2024 21:40
Copy link

@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 good to me! @yihau can you accept solana-sdk-ids and solana-reserved-account-keys?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

2 participants