Skip to content

Conversation

@joncinque
Copy link
Collaborator

Problem

The build is currently failing due to circular dependencies between the sdk, system-interface, and stake-interface. This is totally normal since we're publishing breaking changes, but in general, these circular dependencies can be tricky to manage. See #263 for more info.

Summary of changes

Remove the circular dependencies for good:

  • BREAKING: remove stake-interface from the sysvar crate
  • bring system-interface back into the repo
  • update system-interface based on breaking changes currently in the sdk
  • remove all patches from the sdk toml

Work to do after:

  • add back the wasm-js code for the system interface via a new crate
  • fix up solana-stake-interface to implement the sysvar trait once all the crates have been published

#### Problem

The circular dependencies between the sdk, system-interface, and
stake-interface make crate publishing very tricky, especially around
breaking changes.

#### Summary of changes

To start breaking the chain, remove stake-interface from the repo.
stake-interface will implement the sysvar trait itself as part of the
next breaking change.
#### Problem

Too many sdk crates depend on the system interface, which makes
updating, building, and publishing a big headache.

#### Summary of changes

Declare defeat, and add the system interface back into the sdk repo.
This will also remove circular dependencies completely, and make
publishing a pleasure once again.
@joncinque joncinque requested a review from buffalojoec August 5, 2025 11:42
@github-actions
Copy link
Contributor

github-actions bot commented Aug 5, 2025

If this PR represents a change to the sysvar layout, please open a follow-up PR to update the JavaScript client @solana/sysvars (example)
Thank you for keeping the JavaScript clients in sync with the Rust clients.

@github-actions
Copy link
Contributor

github-actions bot commented Aug 5, 2025

If this PR represents a change to the sysvar layout, please open a follow-up PR to update the JavaScript client @solana/sysvars (example)
Thank you for keeping the JavaScript clients in sync with the Rust clients.

@github-actions
Copy link
Contributor

github-actions bot commented Aug 5, 2025

If this PR represents a change to the sysvar layout, please open a follow-up PR to update the JavaScript client @solana/sysvars (example)
Thank you for keeping the JavaScript clients in sync with the Rust clients.

@github-actions
Copy link
Contributor

github-actions bot commented Aug 5, 2025

If this PR represents a change to the sysvar layout, please open a follow-up PR to update the JavaScript client @solana/sysvars (example)
Thank you for keeping the JavaScript clients in sync with the Rust clients.

1 similar comment
@github-actions
Copy link
Contributor

github-actions bot commented Aug 5, 2025

If this PR represents a change to the sysvar layout, please open a follow-up PR to update the JavaScript client @solana/sysvars (example)
Thank you for keeping the JavaScript clients in sync with the Rust clients.

@joncinque joncinque force-pushed the rm-stake-interface branch from 9be72f2 to e1eed08 Compare August 5, 2025 12:35
@github-actions
Copy link
Contributor

github-actions bot commented Aug 5, 2025

If this PR represents a change to the sysvar layout, please open a follow-up PR to update the JavaScript client @solana/sysvars (example)
Thank you for keeping the JavaScript clients in sync with the Rust clients.

Comment on lines +17 to +18
[features]
bincode = ["solana-system-interface/bincode"]
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This change looks unrelated, but it's unfortunately needed.

The docs build fails without it, because example-mocks is re-exporting from system-interface, but doesn't have the bincode feature enabled, which means that the instructions referenced in the docs don't exist.

Comment on lines -335 to -368
[patch.crates-io]
# We include the following crates as our dependencies above from crates.io:
#
# * solana-system-interface
#
# They, in turn, depend on a number of crates that we also include directly
# using `path` specifications. For example, `solana-system-interface` depends
# on `solana-instruction`. And we explicitly specify `solana-instruction` above
# as a local path dependency:
#
# solana-instruction = { path = "instruction", version = "2.2.1" }
#
# Unfortunately, Cargo will try to resolve the `solana-system-interface`
# `solana-instruction` dependency only using what is available on crates.io.
# Crates.io normally contains a previous version of these crates, and we end up
# with two versions of `solana-instruction` and all of their dependencies in our
# build tree.
#
# If you are developing downstream using non-crates-io solana-program (local or
# forked repo, or from github rev, eg), duplicate the following patch statements
# in your Cargo.toml. If you still hit duplicate-type errors with the patch
# statements in place, run `cargo update -p solana-program` to remove extraneous
# versions from your Cargo.lock file.
solana-account = { path = "account" }
solana-clock = { path = "clock" }
solana-cpi = { path = "cpi" }
solana-frozen-abi = { path = "frozen-abi" }
solana-frozen-abi-macro = { path = "frozen-abi-macro" }
solana-instruction = { path = "instruction" }
solana-program-error = { path = "program-error" }
solana-pubkey = { path = "pubkey" }
solana-rent = { path = "rent" }
solana-signature = { path = "signature" }
solana-sysvar-id = { path = "sysvar-id" }
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is the best part of this change, and the whole motivation

@github-actions
Copy link
Contributor

github-actions bot commented Aug 5, 2025

If this PR represents a change to the sysvar layout, please open a follow-up PR to update the JavaScript client @solana/sysvars (example)
Thank you for keeping the JavaScript clients in sync with the Rust clients.

Comment on lines +39 to +40
//! [`Instruction`]:
//! https://docs.rs/solana-instruction/latest/solana_instruction/struct.Instruction.html
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is the only change in this file

/// Handler for retrieving a slice of sysvar data from the `sol_get_sysvar`
/// syscall.
fn get_sysvar(
pub fn get_sysvar(
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We'll need this function when reimplementing the moved logic in solana-stake-interface, so make it public

solana-frozen-abi-macro = { workspace = true, optional = true }
solana-hash = { workspace = true, features = ["bytemuck"] }
solana-instruction = { workspace = true }
solana-instruction = { workspace = true, features = ["std"] }
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This was being enabled through solana-stake-interface

@github-actions
Copy link
Contributor

github-actions bot commented Aug 5, 2025

If this PR represents a change to the sysvar layout, please open a follow-up PR to update the JavaScript client @solana/sysvars (example)
Thank you for keeping the JavaScript clients in sync with the Rust clients.

rustopian
rustopian previously approved these changes Aug 5, 2025
Copy link
Contributor

@rustopian rustopian 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. Some improvements to error.rs, rm wasm as you mentioned, otherwise diffs are clean.

I noticed one sort-of-broken link in the docs. Up to you.


# Solana System Interface

This crate contains instructions and constructors for interacting with the [System program](https://docs.solanalabs.com/runtime/programs#system-program).
Copy link
Contributor

@rustopian rustopian Aug 5, 2025

Choose a reason for hiding this comment

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

Not really essential to this PR, but

Suggested change
This crate contains instructions and constructors for interacting with the [System program](https://docs.solanalabs.com/runtime/programs#system-program).
This crate contains instructions and constructors for interacting with the [System program](https://solana.com/docs/core/programs#core-programs).

The old link has an awkward redirect notice... which arguably takes you to the wrong page anyway (account model).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Works for me!

@github-actions
Copy link
Contributor

github-actions bot commented Aug 5, 2025

If this PR represents a change to the sysvar layout, please open a follow-up PR to update the JavaScript client @solana/sysvars (example)
Thank you for keeping the JavaScript clients in sync with the Rust clients.

joncinque added a commit to joncinque/solana-sdk that referenced this pull request Aug 5, 2025
#### Problem

The stake-history module in solana-sysvar will be removed with anza-xyz#264, but
there hasn't been a deprecation warning.

#### Summary of changes

Put in a deprecation warning.
@joncinque
Copy link
Collaborator Author

For what it's worth, I know it kind of stinks to not use the program-specific repo for the system interface, but it's just too tied into the rest of the sdk unfortunately.

I prefer the sanity of a self-contained repo over splitting things up. It'll also mean that tools like cargo-semver-checks just work, instead of requiring fixes or hacks on our side.

Also, since the plans for a BPF system program have been put on hold for a long time, the program-specific repo becomes a bit less necessary for the rust crates. We can certainly keep hosting the idl and kit library though.

@rustopian rustopian self-requested a review August 6, 2025 15:05
joncinque added a commit that referenced this pull request Aug 6, 2025
* sysvar: Deprecate stake-history and functions

#### Problem

The stake-history module in solana-sysvar will be removed with #264, but
there hasn't been a deprecation warning.

#### Summary of changes

Put in a deprecation warning.

* Improve deprecation notice
@joncinque joncinque merged commit 8d94267 into anza-xyz:master Aug 6, 2025
26 checks passed
@joncinque joncinque deleted the rm-stake-interface branch August 6, 2025 17:32
joncinque added a commit to joncinque/system that referenced this pull request Aug 20, 2025
#### Problem

As part of the upgrade to SDK v3, the cyclical dependency between the
sdk crates and the system interface were too much of an annoyance, so
the interface was migrated back into the SDK with
anza-xyz/solana-sdk#264. But the interface code
still lives in this repo as well.

#### Summary of changes

Remove the interface crate and all references to it.
joncinque added a commit to solana-program/system that referenced this pull request Aug 21, 2025
#### Problem

As part of the upgrade to SDK v3, the cyclical dependency between the
sdk crates and the system interface were too much of an annoyance, so
the interface was migrated back into the SDK with
anza-xyz/solana-sdk#264. But the interface code
still lives in this repo as well.

#### Summary of changes

Remove the interface crate and all references to it.
febo pushed a commit to febo/solana-sdk that referenced this pull request Sep 21, 2025
…a-xyz#264)

* sysvar!: Remove stake-interface dependency

The circular dependencies between the sdk, system-interface, and
stake-interface make crate publishing very tricky, especially around
breaking changes.

To start breaking the chain, remove stake-interface from the repo.
stake-interface will implement the sysvar trait itself as part of the
next breaking change.

* system-interface: Add back into the sdk repo

Too many sdk crates depend on the system interface, which makes
updating, building, and publishing a big headache.

Declare defeat, and add the system interface back into the sdk repo.
This will also remove circular dependencies completely, and make
publishing a pleasure once again.

* system-interface: Fixup post-migration

* Add feature required for solana-instruction

* Run cargo sort, specify circular dev deps with path

* Pacify dep checker by specifying path dependency

* Fixup docs build

* Fix doc / powerset build issues

* Run doctests with all features

* Update broken link
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.

2 participants