Skip to content

Conversation

@rustopian
Copy link
Owner

No description provided.

joncinque and others added 30 commits June 17, 2025 21:22
…a-xyz#196)

#### Problem

There are now a lot of dead crates in the sdk, mostly around the
precompiles.

#### Summary of changes

Remove all references to precompiles, including solana-precompiles, the
verify implementation for all precompiles (secp256k1, secp256r1, and
ed25519).

Also remove solana-feature-set, solana-feature-set-interface, and
solana-reserved-account-keys.
* add conversion logic from and into compressed types

* fix variable name
* remove DecodeError

* fmt toml
#### Problem

The publish job against maintenance/v2.x failed to generate a changelog
because we look for changes to `master`, but we really want changes up
to the current HEAD.

#### Summary of changes

Use `HEAD` instead of `master`.
…e so that it works with any projective, affine, and compressed types (anza-xyz#202)

* define traits to convert signature, pubkey, and proof-of-possession types to projective

* implement signaturre and proof of possession verification using traits

* remove todo regarding type conversions

* use a generic implementation of the verification traits

* move verification logic outside of the traits to prevent circular dependencies

* directly convert uncompressed types to projective to avoid unnecessary array allocation

* remove AsProjective... and Verifiable... traits

* add `As*Projective` and `Verifiable*` traits to simplify the function signatures

* fix a typo

* use a macro for the type `From` and `TryFrom` implementations for projective, affine, and compressed types

* move `As...Projective` implementation into a macro

* include `BlsError` directly in the macro
* Add solana base3 encoding crate

* clippy

* use little-endian instead of big-endian

* fix big-endian to little-endian in the docs

* use `BASE3_SYMBOL_PER_CHUNK` for 80

* add a `max_len` parameter

* use u8 to translate the symbols

* keep the ternary-bits in ascending order

* update the tests for `u8` encoding

* make bitvec crate dependency optional

* clippy

* cargo fmt

* cargo sort

* add a clarifying comment about extra bytes

* add a comment noting that we use 2 bytes to hold the bit length
#### Problem

Rust has been upgrading, but not the version used in the sdk repo. Also,
with the upcoming breaking changes to the sdk, it's a good time to bump
the rust edition to 2024, but we should upgrade to the newest Rust
first.

#### Summary of changes

Bump the version in rust-toolchain.toml and scripts/rust-version.sh,
then fix any issues reported.
* turn BorshIoError variants into unit variants

make std optional in solana-program-error

extract solana-pubkey-error crate

add missing feature activation

extract instruction-error crate

remove unnecessary docs target from pubkey-error

make num-traits optional in solana-program-error

missing feature activation in solana-program

move min_specialization to instruction-error

missing feature activation in solana-instruction

remove redundant DecodeError constraint from PrintProgramError

remove unncecessary Error constraint from PrintProgramError

remove num-traits dep and rename the num-traits feature to solana-msg

add missing changes after removing num-traits

make pubkey-error optional

move instruction error codes to program-error and fix pubkey-error import

fmt

move PubkeyError back to solana-pubkey and move ProgramError conversion to solana-pubkey

enable std if solana-msg is enabled

add ToStr trait

post-rebase fixes

fmt toml

* Fix CI, remove solana-instruction where not needed

* Run cargo-sort

---------

Co-authored-by: Jon C <me@jonc.dev>
* Improve sysvar get error handling

* Improve use of constants

* Fix clippy

* Qualify program error use
* refactor out hard-coded test data

* clean up test imports

* refactor out integration tests

* add a clarifying comment regarding the length check in the tests
* refactor out test constants

* move bench from sdk into `big-mod-exp` and use criterion

* cargo fmt

* use `black_box` around the function result rather than the inputs
…ion to be generic (anza-xyz#213)

* make the `aggregate_with` and `aggregate` functions generic and add support for dyn types

* remove `Default` implementation for public key and signatures; instead add an identity function

* cargo fmt
* add benches for base3 encoding

* clippy
* vote-interface: rename `VoteState` to `VoteStateV3`

* add deprecatio attr
* docs: Fix all warnings in docs build

#### Problem

Although we check that all of the rustdocs build correctly for the whole
sdk, there are warnings in the build.

#### Summary of changes

Fix the warnings, and forbid warnings in CI.

* deny warnings in check-doc.sh

* Use non-bare links

---------

Co-authored-by: Kevin Heavey <heaveykevin2@gmail.com>
* typo lib.rs

* typo abi_example.rs
* docs: Fix tests, run tests in CI

#### Problem

The doctests are currently very broken, but it wasn't detected because
we only run checks on the docs.

#### Summary of changes

Fix all of the doctests, and add a step to test them in CI.

* Fix circular deps
#### Problem

There's a maintenance branch for v2 crates in the SDK repo called
`maintenance/v2.x`, but there's no way to automatically backport PRs to
that branch.

#### Summary of changes

Copy / paste how Kit does things and include a backporting job.

There's also some new info about the maintenance branch and how to
perform backports.
* Remove some unused dependencies

* return solana-logger

* return getrandom
* borsh!: Remove borsh v0.10 support

#### Problem

The sdk has implemented the borsh v0.10 traits for years, even though v1
has been out for awhile. This was to avoid breaking people who were
still on the older crate version.

#### Summary of changes

It's been two years, and we're making breaking changes, so remove all
borsh 0.10 support!

* Fix doc build by referencing borsh1
#### Problem

The SDK depends on tokio v1.43.0, which has a small security issue.
Although this isn't directly an issue since this repo only has
libraries, there's no reason to keep around the issue.

#### Summary of changes

Simply bump to 1.43.1.
* Remove deprecated functions and structs

#### Problem

There are a lot of deprecated functions and structs all over the SDK
that can be removed now that we're making breaking changes.

#### Summary of changes

Remove it all!

* Fixup CI errors
* deps: Update env_logger to v0.11

#### Problem

The SDK and Agave are still using env_logger v0.9, which has a
dependency on an unmaintained crate, atty.

#### Summary of changes

Update to the newest version of env_logger.

* Specify a slightly older version for minimal-versions to pass
joncinque and others added 20 commits July 21, 2025 12:17
* wasm-js: Remove system program dependency

#### Problem

While working on the refactor of all wasm-js logic into sdk-wasm-js, I
noticed that no matter what I did, `SystemInstruction` still made it
into the final build. That made it impossible to build the package with
breaking changes.

#### Summary of changes

Remove the usage of `SystemInstruction` in the tests. This required
exposing `Instruction` and `AccountMeta` through wasm-bindgen to be able
to create instructions.

The API doesn't need to be perfect, just usable, so I went with a
builder pattern for adding `AccountMeta`s to an `Instruction`, which
hugely simplifies the logic. Otherwise we'd need to perform conversions
between JS arrays and `Vec<AccountMeta>`, which I was too lazy to do
properly because wasm-js crate is more of a proof-of-concept.

While doing that, I moved the wasm-js deps to the component crates that
were required for the tests.

* Regenerate cargo.lock, fixup wasmbindgen attribute

* No builder pattern
* account-info: Rename `rent_epoch` to `unused`

#### Problem

The concept of rent-epoch doesn't exist anymore in the runtime, but the
account-info type for on-chain programs requires some 8-byte field where
the rent-epoch is currently.

#### Summary of changes

Rename the field, skip it in the program entrypoint.

Also, move the layout test into solana-account-info.

BREAKING: `solana_account_info::Account` trait removes `Epoch`

* Rename unused -> _unused, deprecate it
…nza-xyz#239)

* message: Remove dependency on solana-system-interface

#### Problem

While debugging changes to the wasm-js build, I noticed that
`solana-transaction` and `solana-message` were pulling in
`solana-system-interface` in a lot of situations, even though there's a
lot of code in place to make sure that doesn't happen.

#### Summary of changes

Totally remove the dependency on solana-system-interface by inlining
some nonce-related code in solana-message.

* Run cargo-sort

* Remove bincode feature-gating where it's no longer needed

* Fixup imports

* Remove solana_bincode dep, use bincode directly
* hash!: Unify all hash types, introduce "offchain" feature

#### Problem

There are many repeated `Hash` types in all of the different hasher
crates, which brings in unnecessary dependencies and copied code.

#### Summary of changes

Unify all hashes under `solana_hash::Hash`, by re-exporting that type
from keccak and blake3.

While doing this work, I also cleaned up the dependencies, which were
unnecessarily bringing in the crate for the offchain implementation.

When integrating the SDK with Pinocchio, we'll have many situations in
which Pinocchio doesn't want to have an offchain fallback implementation
available, but that fallback is still used by other downstream users.

To satisfy both uses, this PR also introduces a general `"offchain"` crate
feature.  For example, `Pubkey::find_program_address` could use the
offchain feature for deriving the address without using the syscall,
which is useful for most offchain applications.

I could also split off the offchain feature in a different PR if that's
clearer.

* Guard Hasher re-export with not(target_os = "solana")

* Fixup CI

* Properly use offchain feature

* Oops, missing semi-colon

* Enable offchain feature in offchain-message

* Fix doctests

* Improve panic message

* Require offchain feature for tests

* Revert feature names
* create `solana-program-stubs` crate

* create `solana-epoch-stake` crate

* Revert "create `solana-program-stubs` crate"

This reverts commit ebfa4e0.

* make epoch-stake crate on-chain only

* update patch script

* add black box
* Bump ed25519-dalek to 2.1.1, ed25519-dalek-bip32 to 0.3.0

* unwrap where error is impossible

* use from_keypair_bytes

* nit: change unwrap to ?

Co-authored-by: samkim-crypto <skim13@cs.stanford.edu>

* fmt

* don't accept slices longer than 64 bytes

---------

Co-authored-by: samkim-crypto <skim13@cs.stanford.edu>
* docs: fix memory layout comment in instructions sysvar

* rewrite
#### Problem

The SDK repo provides libraries, which should allow downstream users
some flexibility when choosing what dependencies they want to use.
However, we currently pin two dependencies: array-bytes and
ed25519-dalek.

#### Summary of changes

Unpin both of them!

array-bytes is only used in tests, so it shouldn't have any impact.
ed25519-dalek is definitely more sensitive, but Agave and other
downstream users should decide what version they want to use, and we
shouldn't force that at the library level.
…nza-xyz#87)

* factor out SysvarGet from Sysvar

* move Default constraint to SysvarGet

* fmt

* rename original Sysvar to SysvarSerialize, and SysvarGet to Sysvar

* fmt

* fix doc links

* fmt

* fix doctests

* remove SysvarSerialize::get
* secp256k1-program: Fix doc tests

#### Problem

The doctests for secp256k1-program fail when run on the crate
individually because of a missing feature declaration on
`solana-keccak-hasher`.

#### Summary of changes

Add the feature. At the same time, run the doctests with `cargo-hack` to
catch these in the future.

The sdk-wasm-js package fails to run doctests because it doesn't have an
rlib target, so add that too.

* Use nightly and install hack for doc test job
#### Problem

As noted in anza-xyz/agave#7028, the
`extend_and_hash` function is unnecessary and creates another
allocation, so we inlined it in Agave.

#### Summary of changes

Deprecate it formally in the crate. This PR will be backported to v2.x
and published, so we can remove the function in a follow-up PR.
#### Problem

As mentioned in anza-xyz/agave#7028, the `extend_and_hash` function is
unnecessary and creates another allocation, so we inlined it in Agave.

#### Summary of changes

Since it's been properly marked as deprecated, remove it.
* sdk!: Remove `program` feature

#### Problem

The `program` feature has existed since v1.3 so that people can use
solana-sdk in on-chain programs.

`cargo-build-sbf` even had a special case where it would enable the
`program` feature when building solana-sdk, but it was removed in
anza-xyz/agave#5870.

This means that our current build-sbf script fails when using v2.3 of
the tools.

#### Summary of changes

Remove the `program` feature from the sdk, and fix the build-sbf script
to exclude the sdk, and then try to build without default features.

Rather than adding more excludes, I also changes the build-sbf script to
use `cargo hack`, which is a bit cleaner.

* Exclude solana-sdk
* replace std with core for Error

* Also adds rust-version = "1.81.0" for all such crates
* Removes the redundant std attribute

* Fix CI failures

---------

Co-authored-by: Jon C <me@jonc.dev>
wasm-js: Move all implementations into sdk-wasm-js

#### Problem

As outlined in anza-xyz#118, the sdk incorrectly assumes that all wasm builds
are targeting a js environment, which breaks builds in non-js targets.

#### Summary of changes

The wasm-js code isn't strictly needed to make things work, so instead,
move all of the code into different modules. This causes some
copy-pasta, but keeps wasm builds lean. If people are using wasm-js,
most likely they'll roll their own code anyway.

As part of this, since solana-keypair now uses rand 0.8, we can upgrade
the getrandom backend to 0.2.
@github-actions
Copy link

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 merged commit d5f9804 into 235-sol-get-sysvar Jul 30, 2025
5 checks passed
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.