Skip to content

Extract solana-nonce crate #3082

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

Merged
merged 7 commits into from
Oct 29, 2024
Merged

Conversation

kevinheavey
Copy link

Problem

solana_program::nonce imposes a solana_program dependency on solana_svm

Summary of Changes

  • Move to its own crate and re-export for backwards compatibility
  • Make serde optional in the new crate

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

@kevinheavey kevinheavey force-pushed the extract-nonce branch 4 times, most recently from 77d3e88 to 7dd9377 Compare October 11, 2024 10:12
@kevinheavey kevinheavey force-pushed the extract-nonce branch 3 times, most recently from 24f67a7 to aa15407 Compare October 22, 2024 10:11
@kevinheavey kevinheavey marked this pull request as ready for review October 22, 2024 12:02
@kevinheavey kevinheavey force-pushed the extract-nonce branch 2 times, most recently from b9b4d8d to 43c4f26 Compare October 28, 2024 12:48
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.

The change looks good as is, while we're here, I'd like to do a little reorg for these files, since I always get lost in them. Could you:

  • rename state/mod.rs to versions.rs, remove the re-export from current
  • rename state/current.rs to state.rs

This makes some of the re-exports in solana-program a little gnarly, but I hope it'll be clearer at the base crate level. I believe we'll need to:

  • re-export solana_nonce::state::State in nonce/mod.rs
  • re-export solana_nonce::versions::* and solana_nonce::state as current in nonce/state/mod.rs
  • remove nonce/state/current.rs

Or if it's too annoying, I can push those changes to your branch. Let me know!

Copy link

mergify bot commented Oct 29, 2024

Backports to the beta branch are to be avoided unless absolutely necessary for fixing bugs, security issues, and perf regressions. Changes intended for backport should be structured such that a minimum effective diff can be committed separately from any refactoring, plumbing, cleanup, etc that are not strictly necessary to achieve the goal. Any of the latter should go only into master and ride the normal stabilization schedule. Exceptions include CI/metrics changes, CLI improvements and documentation updates on a case by case basis.

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, please accept ownership of solana-nonce once it's passed

@kevinheavey kevinheavey added the automerge automerge Merge this Pull Request automatically once CI passes label Oct 29, 2024
@mergify mergify bot merged commit 1cde3d5 into anza-xyz:master Oct 29, 2024
54 checks passed
mergify bot pushed a commit that referenced this pull request Oct 29, 2024
* extract solana-nonce crate

* activate solana-nonce/serde in solana-program

* update lock file

* post-rebase fixes

* add docsrs metadata

Co-authored-by: Jon C <me@jonc.dev>

* add doc_auto_cfg

* reorganise modules

---------

Co-authored-by: Jon C <me@jonc.dev>
(cherry picked from commit 1cde3d5)

# Conflicts:
#	Cargo.toml
@kevinheavey kevinheavey deleted the extract-nonce branch October 29, 2024 22:02
@t-nelson
Copy link

is this not missing deprecation warnings for the old locations?

@joncinque
Copy link

is this not missing deprecation warnings for the old locations?

Nice catch! Yeah we can add them. Since the deprecation warnings on re-exports don't actually do anything, it's not a big deal if they're missing. It's like forgetting comments.

@febo
Copy link

febo commented Oct 31, 2024

is this not missing deprecation warnings for the old locations?

Nice catch! Yeah we can add them. Since the deprecation warnings on re-exports don't actually do anything, it's not a big deal if they're missing. It's like forgetting comments.

It might be the case that clippy will actually start complaining about having them. 😅

rust-lang/rust#132038

@t-nelson
Copy link

is this not missing deprecation warnings for the old locations?

Nice catch! Yeah we can add them. Since the deprecation warnings on re-exports don't actually do anything, it's not a big deal if they're missing. It's like forgetting comments.

yeah i've been thinking that we've been doing this backwards. we should be deprecating the symbols in their original location, then allowing deprecated on the new location/reexport. when we remove the deprecated code, that's when we actually move the symbols.

@kevinheavey
Copy link
Author

yeah i've been thinking that we've been doing this backwards. we should be deprecating the symbols in their original location, then allowing deprecated on the new location/reexport. when we remove the deprecated code, that's when we actually move the symbols.

Wouldn't that mean we'd be stuck with solana-program as a dependency everywhere until 3.0?

ray-kast pushed a commit to abklabs/agave that referenced this pull request Nov 27, 2024
* extract solana-nonce crate

* activate solana-nonce/serde in solana-program

* update lock file

* post-rebase fixes

* add docsrs metadata

Co-authored-by: Jon C <me@jonc.dev>

* add doc_auto_cfg

* reorganise modules

---------

Co-authored-by: Jon C <me@jonc.dev>
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
No open projects
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants