-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Migrating Rust programs from v1.5 to v1.6
The v1.6 release line requires some minor changes to Rust program source that previously used v1.5.14 or earlier. These changes can be made with a ~v1.5.15 release as well, to prepare your program for the upgrade to v1.6.
As a reference, https://github.com/solana-labs/example-helloworld/pull/158/files makes the necessary changes to the helloworld example
- Edit your Cargo.toml and remove the
tokio = { version = "0.3", features = ["macros"]}
from your[dev-dependencies]
. A compatible tokio can now be imported from program-test with ause solana_program_test::tokio;
statement.
Instruction::new()
is deprecated by Instruction::new_with_bincode()
which shares the same function signature.
Most existing programs (and the built-in programs like the SystemProgram
) use bincode encoded instruction data. Bincode serialization/deserialization in-program is very expensive, therefore where possible, and for new program interfaces, it is recommended not to use bincode for instruction data encoding.
The v1.5.15 and newer Rust crates pin the version of dependent Solana Rust crates to the same version, to avoid accidental version mixing and build breakage during the non-atomic publish of new release crates to crates.io.
If your program is referencing v1.5.14 or earlier, bump the Solana version to v1.5.15 to take advantage of this version pinning.
- General
- Feature Gates
- Technical
- Schedule
- Testnet