Skip to content

deprecate DecodeError and stop using it #104

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kevinheavey
Copy link
Contributor

The only part of DecodeError that is not a trivial wrapper over num_traits::FromPrimitive is the type_of method. AFAICT this method is not used anywhere. We should delete the decode-error dir and stop publishing the crate. For now we can just deprecate the trait and avoid using it anywhere in this repo.

This is a breaking change for solana-precompile-error, solana-program-error, solana-pubkey and solana-vote-interface

@joncinque joncinque added the breaking PR contains breaking changes label Mar 31, 2025
@joncinque joncinque requested a review from febo March 31, 2025 19:27
febo
febo previously approved these changes Apr 1, 2025
Copy link
Contributor

@febo febo 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!

@kevinheavey
Copy link
Contributor Author

@febo can you merge this? I don't have permissions

@febo
Copy link
Contributor

febo commented Apr 2, 2025

@febo can you merge this? I don't have permissions

I can't either. 😅 It might need a rebase so all checks pass.

@kevinheavey kevinheavey force-pushed the deprecate-decode-error branch from aac3de6 to dc47fab Compare April 2, 2025 09:17
@kevinheavey
Copy link
Contributor Author

ok rebased

@joncinque
Copy link
Collaborator

I'm still going through and marking everything deprecated that we want to remove in the next breaking release. After that, I'll publish new patch releases with those deprecation warnings. And after that, we can start merging breaking changes like this one. I plan to have it ready by the end of this week / early next week.

@febo febo dismissed their stale review April 3, 2025 16:34

Waiting for patch releases.

@febo febo self-requested a review April 3, 2025 16:34
@therealdannzor
Copy link
Contributor

therealdannzor commented Apr 14, 2025

This PR would probably contribute to resolving solana-program/libraries#73

Discovered this while working on a MRE to demo the problem

Merging this would help when upgrading to Solana 2.x

cc @joncinque

@therealdannzor
Copy link
Contributor

bump @kevinheavey @febo

instead of opening a less-than PR than this myself 😬

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

There are many different crates and types that we would like to remove
from the sdk, but they are still re-exported from solana-sdk and
solana-program. The re-exports have a `#[deprecated(...)]` attribute,
but they aren't flagged to downstream users.

#### Summary of changes

Make the re-export deprecations louder by creating a deprecated module
and re-exporting from in there.

These are the types affected

* `DecodeError`: this trait isn't all that useful, and is set to be
  removed entirely with anza-xyz#104, so deprecate it here

These are the crates to no longer re-export from solana-program because
they will be moved to program-specific repos:

* `address_lookup_table` -> `solana_address_lookup_table_interface`
* `bpf_loader_upgradeable` -> `solana_loader_v3_interface`
* `loader_upgradeable_instruction` ->
  `solana_loader_v3_interface::instruction`
* `loader_v4` -> `solana_loader_v4_interface`
* `loader_v4_instruction` -> `solana_loader_v4_interface::instruction`
* `nonce` -> `solana_nonce`
* `feature` -> `solana_feature_gate_interface`
* `loader_instruction` -> `solana_loader_v2_interface`
* `vote` -> `solana_vote_interface`
* `stake` -> `solana_stake_interface`
* `stake_history` -> `solana_stake_interface::stake_history`
* `system_instruction` -> `solana_system_interface`
* `system_program` -> `solana_sdk_ids::system_program` (not sure about
  this one)

Separately, `solana_message` and `solana_sanitize` are no longer
re-exported. They never quite fit in `solana_program`, and caused more
annoyance than anything else. The re-exports remain in `solana_sdk`.

`solana-decode-error` will be removed entirely, so its deprecation is
louder too.

For `solana-sdk`, there are many types that just don't belong, so stop
re-exporting these:

* `commitment_config` -> `solana_commitment_config`
* `genesis_config` -> `solana_genesis_config`
* `hard_forks` -> `solana_hard_forks`
* `rent_collector` -> `solana_rent_collector`
* `alt_bn128` -> `solana_bn254`
* `client` -> `solana_client_traits`
* `compute_budget` -> `solana_compute_budget_interface`
* `derivation_path` -> `solana_derivation_path`
* `ed25519_instruction` -> `solana_ed25519_program`
* `nonce_account` -> `solana_nonce_account`
* `packet` -> `solana_packet`
* `poh_config` -> `solana_poh_config`
* `quic` -> `solana_quic_definitions`
* `rent_debits` -> `solana_rent_debits`
* `secp256k1_instruction` -> `solana_secp256k1_program`
* `secp256k1_recover` -> `solana_secp256k1_recover`
* `system_transaction` -> `solana_system_transaction`
* `exit` -> `solana_validator_exit`
joncinque added a commit to joncinque/solana-sdk that referenced this pull request Apr 30, 2025
#### Problem

There are many different crates and types that we would like to remove
from the sdk, but they are still re-exported from solana-sdk and
solana-program. The re-exports have a `#[deprecated(...)]` attribute,
but they aren't flagged to downstream users.

#### Summary of changes

Make the re-export deprecations louder by creating a deprecated module
and re-exporting from in there.

These are the types affected

* `DecodeError`: this trait isn't all that useful, and is set to be
  removed entirely with anza-xyz#104, so deprecate it here

These are the crates to no longer re-export from solana-program because
they will be moved to program-specific repos:

* `address_lookup_table` -> `solana_address_lookup_table_interface`
* `bpf_loader_upgradeable` -> `solana_loader_v3_interface`
* `loader_upgradeable_instruction` ->
  `solana_loader_v3_interface::instruction`
* `loader_v4` -> `solana_loader_v4_interface`
* `loader_v4_instruction` -> `solana_loader_v4_interface::instruction`
* `nonce` -> `solana_nonce`
* `feature` -> `solana_feature_gate_interface`
* `loader_instruction` -> `solana_loader_v2_interface`
* `vote` -> `solana_vote_interface`
* `stake` -> `solana_stake_interface`
* `stake_history` -> `solana_stake_interface::stake_history`
* `system_instruction` -> `solana_system_interface`
* `system_program` -> `solana_sdk_ids::system_program` (not sure about
  this one)

Separately, `solana_message` and `solana_sanitize` are no longer
re-exported. They never quite fit in `solana_program`, and caused more
annoyance than anything else. The re-exports remain in `solana_sdk`.

`solana-decode-error` will be removed entirely, so its deprecation is
louder too.

For `solana-sdk`, there are many types that just don't belong, so stop
re-exporting these:

* `commitment_config` -> `solana_commitment_config`
* `genesis_config` -> `solana_genesis_config`
* `hard_forks` -> `solana_hard_forks`
* `rent_collector` -> `solana_rent_collector`
* `alt_bn128` -> `solana_bn254`
* `client` -> `solana_client_traits`
* `compute_budget` -> `solana_compute_budget_interface`
* `derivation_path` -> `solana_derivation_path`
* `ed25519_instruction` -> `solana_ed25519_program`
* `nonce_account` -> `solana_nonce_account`
* `packet` -> `solana_packet`
* `poh_config` -> `solana_poh_config`
* `quic` -> `solana_quic_definitions`
* `rent_debits` -> `solana_rent_debits`
* `secp256k1_instruction` -> `solana_secp256k1_program`
* `secp256k1_recover` -> `solana_secp256k1_recover`
* `system_transaction` -> `solana_system_transaction`
* `exit` -> `solana_validator_exit`
joncinque added a commit that referenced this pull request May 6, 2025
* Deprecate re-exports more loudly

#### Problem

There are many different crates and types that we would like to remove
from the sdk, but they are still re-exported from solana-sdk and
solana-program. The re-exports have a `#[deprecated(...)]` attribute,
but they aren't flagged to downstream users.

#### Summary of changes

Make the re-export deprecations louder by creating a deprecated module
and re-exporting from in there.

These are the types affected

* `DecodeError`: this trait isn't all that useful, and is set to be
  removed entirely with #104, so deprecate it here

These are the crates to no longer re-export from solana-program because
they will be moved to program-specific repos:

* `address_lookup_table` -> `solana_address_lookup_table_interface`
* `bpf_loader_upgradeable` -> `solana_loader_v3_interface`
* `loader_upgradeable_instruction` ->
  `solana_loader_v3_interface::instruction`
* `loader_v4` -> `solana_loader_v4_interface`
* `loader_v4_instruction` -> `solana_loader_v4_interface::instruction`
* `nonce` -> `solana_nonce`
* `feature` -> `solana_feature_gate_interface`
* `loader_instruction` -> `solana_loader_v2_interface`
* `vote` -> `solana_vote_interface`
* `stake` -> `solana_stake_interface`
* `stake_history` -> `solana_stake_interface::stake_history`
* `system_instruction` -> `solana_system_interface`
* `system_program` -> `solana_sdk_ids::system_program` (not sure about
  this one)

Separately, `solana_message` and `solana_sanitize` are no longer
re-exported. They never quite fit in `solana_program`, and caused more
annoyance than anything else. The re-exports remain in `solana_sdk`.

`solana-decode-error` will be removed entirely, so its deprecation is
louder too.

For `solana-sdk`, there are many types that just don't belong, so stop
re-exporting these:

* `commitment_config` -> `solana_commitment_config`
* `genesis_config` -> `solana_genesis_config`
* `hard_forks` -> `solana_hard_forks`
* `rent_collector` -> `solana_rent_collector`
* `alt_bn128` -> `solana_bn254`
* `client` -> `solana_client_traits`
* `compute_budget` -> `solana_compute_budget_interface`
* `derivation_path` -> `solana_derivation_path`
* `ed25519_instruction` -> `solana_ed25519_program`
* `nonce_account` -> `solana_nonce_account`
* `packet` -> `solana_packet`
* `poh_config` -> `solana_poh_config`
* `quic` -> `solana_quic_definitions`
* `rent_debits` -> `solana_rent_debits`
* `secp256k1_instruction` -> `solana_secp256k1_program`
* `secp256k1_recover` -> `solana_secp256k1_recover`
* `system_transaction` -> `solana_system_transaction`
* `exit` -> `solana_validator_exit`

* Address review feedback
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking PR contains breaking changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants