|
| 1 | +--- |
| 2 | +title: 0.31.1 |
| 3 | +description: Anchor - Release Notes 0.31.1 |
| 4 | +--- |
| 5 | + |
| 6 | +This release uses a new docker image found at `solanafoundation/anchor` for the `anchor verify` command. New images will be pushed to this organization in the future. |
| 7 | + |
| 8 | +Releases for anchor will also be published under the `solanafoundation` Github organization from now on. |
| 9 | + |
| 10 | +As always, there are a great number of changes, but we'll only be covering the |
| 11 | +most important ones here. For a list of all notable changes, see the |
| 12 | +[CHANGELOG](https://github.com/coral-xyz/anchor/blob/v0.31.1/CHANGELOG.md#0311---2025-04-19). |
| 13 | + |
| 14 | +### IDL Build Fixes |
| 15 | + |
| 16 | +As of `nightly-2025-04-16`, `SourceFile` does not exist anymore. |
| 17 | +IDLs have been historically built with nightly, and in order to fix this we had |
| 18 | +to update our `proc_macro2` usage accordingly. |
| 19 | + |
| 20 | +If you ran into the following error whild building: |
| 21 | + |
| 22 | +``` |
| 23 | +no method named `source_file` found for reference `&proc_macro::Span` in the current scope |
| 24 | +``` |
| 25 | + |
| 26 | +This should now be fixed in this release. |
| 27 | + |
| 28 | + |
| 29 | +--- |
| 30 | + |
| 31 | +## How to upgrade |
| 32 | + |
| 33 | +1. Install the latest version of `avm`: |
| 34 | + |
| 35 | + ```sh |
| 36 | + cargo install --git https://github.com/coral-xyz/anchor avm --force |
| 37 | + ``` |
| 38 | + |
| 39 | + This will allow installing Anchor CLI without having to compile from source, |
| 40 | + see [Install from binary](#install-from-binary). |
| 41 | + |
| 42 | +2. Update `anchor-cli`: |
| 43 | + |
| 44 | + ```sh |
| 45 | + avm install 0.31.1 |
| 46 | + ``` |
| 47 | + |
| 48 | +3. Update Anchor crate(s) to `0.31.1`. |
| 49 | + |
| 50 | +4. Update TS package(s) to `0.31.1`. |
| 51 | + |
| 52 | +## Recommended Solana Version |
| 53 | + |
| 54 | +The recommended Solana version is `2.1.0`. This is a special upgrade because |
| 55 | +some of the Solana binaries have been renamed to Agave, see |
| 56 | +[Agave transition](https://github.com/anza-xyz/agave/wiki/Agave-Transition). |
| 57 | + |
| 58 | +You can install the newer tooling by running: |
| 59 | + |
| 60 | +``` |
| 61 | +sh -c "$(curl -sSfL https://release.anza.xyz/v2.1.0/install)" |
| 62 | +``` |
| 63 | + |
| 64 | +This change is handled automatically if you specify `toolchain.solana_version`, |
| 65 | +see [Automatic Agave transition](#automatic-agave-transition). |
| 66 | + |
| 67 | +--- |
| 68 | + |
| 69 | +See the full list of notable changes in the |
| 70 | +[CHANGELOG](https://github.com/solana-foundation/anchor/blob/v0.31.1/CHANGELOG.md#0311---2025-04-19). |
0 commit comments