Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
a033111
hello-solana: port to Anchor v2.0.0-rc.1
claude Aug 13, 2026
ec51acf
basics: port checking-accounts, processing-instructions, create-accou…
claude Aug 13, 2026
ab3c71d
basics: port counter and transfer-sol to Anchor v2
claude Aug 13, 2026
f1ec750
close-account: port to Anchor v2, and record the migration in CHANGELOG
claude Aug 13, 2026
05d7ae8
basics: port the remaining examples to Anchor v2 (verification in pro…
claude Aug 13, 2026
8c0c87b
basics: finish the v2 port, with all 16 examples building and passing
claude Aug 13, 2026
f6dacc7
tokens/finance/compression: in-progress Anchor v2 port (does not yet …
claude Aug 13, 2026
607f2dc
tokens: borsh derives, SPL discriminators and interface programs
claude Aug 13, 2026
b3ce3ba
tokens: port the six extension examples that used init constraints
claude Aug 14, 2026
4f89276
tokens: finish metadata and allow-block-list-token
claude Aug 14, 2026
9ddd88c
tokens/finance: automate the CPI borrow-exclusivity rewrite
claude Aug 14, 2026
2d1f988
finance: escrow ports and passes; fundraiser and betting-market compile
claude Aug 14, 2026
5fc6a6b
finance: prop-amm, perpetual-futures, vault-strategy and betting-mark…
claude Aug 14, 2026
075f64e
finance: token-fundraiser passes 17/17; vault-strategy builds
claude Aug 14, 2026
77bac77
lending: restore a stripped lifetime and decode Reserve the v2 way
claude Aug 14, 2026
3a53cdc
ci: install Anchor 2.0.0-rc.1 rather than 1.1.2
claude Aug 14, 2026
a74f88f
all: borsh derive feature, and replace the compat-only error! macro
claude Aug 14, 2026
8acdedd
order-book: v2 zero-copy mappings (65 -> 30 errors)
claude Aug 14, 2026
1a3b023
docs: write down the Anchor v1 -> v2 porting rules
claude Aug 14, 2026
6a03e1f
docs: has_one deprecation and the v2-only primitives
claude Aug 14, 2026
832fb2d
tests: repair the Pubkey->Address rename inside import paths
claude Aug 14, 2026
fb2f611
compression: port cnft-burn, cnft-vault and cutils to Anchor v2
claude Aug 14, 2026
12e1c5f
compression: align raw CPI handle lists with v2's positional matching
claude Aug 14, 2026
d0ef9f3
docs: record the v2 rules for hand-built CPIs and error codes
claude Aug 14, 2026
e9ce409
anchor: replace the deprecated has_one constraint with address
claude Aug 14, 2026
503b9f4
transfer-hook: give the hook programs a real entrypoint
claude Aug 14, 2026
e466583
transfer-hook: wire the entrypoint shim into the remaining hook programs
claude Aug 14, 2026
f20c062
docs: record the v2 discriminator rules and the interface-program gap
claude Aug 14, 2026
f6515f0
transfer-hook: finish porting the hook family
claude Aug 16, 2026
ecf4f0c
transfer-hook/transfer-switch: port the remaining v2 differences
claude Aug 16, 2026
80b957e
docs: record v2's duplicate-mutable-account rule
claude Aug 16, 2026
e94ef8a
lending: finish the v2 port so the crate builds
claude Aug 16, 2026
1c44ab1
lending: all 24 tests pass under Anchor v2
claude Aug 16, 2026
e394c4e
token-swap: 20/20 tests pass under Anchor v2
claude Aug 16, 2026
bb2c0f5
order-book: 28/28 tests pass under Anchor v2
claude Aug 16, 2026
e6ffb97
tokens: port nft-operations, transfer-fee and interest-bearing
claude Aug 16, 2026
582b98a
tokens: port pda-mint-authority, cpi-guard and nft-minter
claude Aug 16, 2026
191f5f3
nft-meta-data-pointer: drop the Anchor v1-only session-keys dependency
claude Aug 16, 2026
6ce5ca5
all: cargo fmt
claude Aug 16, 2026
7ab9cbc
docs: record the remaining v1-to-v2 accessor renames
claude Aug 16, 2026
3afdf14
changelog: record the full Anchor v2 migration
claude Aug 16, 2026
4e496a4
lint: fix the clippy errors CI would fail on
claude Aug 16, 2026
9890b42
lint: silence the last clippy errors
claude Aug 16, 2026
a5cd472
lint: silence the last clippy errors
claude Aug 16, 2026
7298fd3
lint: clear the remaining clippy errors
claude Aug 16, 2026
5e8a370
pyth: repair the test imports
claude Aug 16, 2026
214995b
tests: repair two doubled crate prefixes and a missing Clock import
claude Aug 16, 2026
c04f2d7
nft-minter: restore update_authority_is_signer on the metadata CPI
claude Aug 16, 2026
16d30e4
tokens: allow the self-send duplicate and use wrapper CPI handles
claude Aug 16, 2026
eff9f03
token-extensions: fix the borrow and CPI-meta faults in three examples
claude Aug 16, 2026
6f751eb
token-extensions/basics: spell out the token program for the init con…
claude Aug 16, 2026
c76f124
finance: use to_cpi_handle on the Boxed accounts
claude Aug 16, 2026
2c18e42
vault-strategy: 22/22 tests pass under Anchor v2
claude Aug 16, 2026
34de4df
docs: record the multi-program build hazard and the final tally
claude Aug 16, 2026
44f7c35
Remove every avoidable unsafe block from the Anchor programs
claude Aug 17, 2026
b3587d9
anchor: take the em-dashes out of the ported comments
claude Aug 19, 2026
ce23a3a
docs: correct the READMEs the v2 port made untrue
claude Aug 19, 2026
a171394
changelog: correct the has_one tally and drop the em-dashes
claude Aug 19, 2026
e67c4a1
docs: rewrite the v2 migration guide against the writing rules
claude Aug 19, 2026
0948e4f
Merge main into the v2 port
claude Aug 19, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
13 changes: 7 additions & 6 deletions .github/workflows/anchor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -193,17 +193,18 @@ jobs:
~/.cargo/bin/avm
~/.avm
# Pinned to match the anchor-lang/anchor-spl crate version the programs depend on.
key: anchor-toolchain-${{ runner.os }}-1.1.2
- name: Install Anchor 1.1.2
key: anchor-toolchain-${{ runner.os }}-2.0.0-rc.1
- name: Install Anchor 2.0.0-rc.1
run: |
export PATH="$HOME/.cargo/bin:$HOME/.avm/bin:$PATH"
# `anchor --version` can emit more than one line; read the first line only so
# a multi-line value never reaches downstream parsing.
current="$(anchor --version 2>/dev/null | head -n1 | awk '{print $2}' || true)"
if [ "$current" != "1.1.2" ]; then
cargo install --git https://github.com/coral-xyz/anchor avm --force
avm install 1.1.2
avm use 1.1.2
if [ "$current" != "2.0.0-rc.1" ]; then
cargo install --git https://github.com/solana-foundation/anchor avm --force
# 2.0.0-rc.1 is a pre-release, so avm needs it named explicitly.
avm install 2.0.0-rc.1
avm use 2.0.0-rc.1
fi
echo "$HOME/.cargo/bin" >> "$GITHUB_PATH"
echo "$HOME/.avm/bin" >> "$GITHUB_PATH"
Expand Down
84 changes: 84 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,90 @@ All notable changes to this repository are documented here.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).

## [2026-08-16] - Every Anchor example on Anchor v2.0.0-rc.1

All 55 Anchor examples build and pass their tests on 2.0.0-rc.1 (304 tests),
and `cargo fmt --check` and `cargo clippy -- -D warnings` are clean.

### Changed

- The remaining 39 Anchor examples, all of `tokens/`, `finance/` and
`compression/`, now build against `anchor-lang` 2.0.0-rc.1, joining the
`basics/` examples ported below. `.github/workflows/anchor.yml` installs
2.0.0-rc.1, since `anchor build` under a v2 CLI will not build v1 programs.
- `docs/anchor-v2-migration.md` collects every difference the port ran into,
ordered by how often it bites. The rules the compiler will not catch for you
are called out: borrows held across CPIs, `Box`'s missing `cpi_handle_mut`
forwarding, and hand-built read-only handles over a live data account.
- `has_one` is deprecated in v2 and this repository's `rust.yml` runs
`cargo clippy -- -D warnings`, so every one of the 161 uses across 66 files
in the Anchor programs moves to the `address` constraint on the sibling field
it named. The Quasar crates keep `has_one`, which is still current there.
- The seven `transfer-hook` examples supply their own entrypoint. v2's
`#[program(interface, ...)]` generates a CPI client and no dispatch, so the
program declared that way builds to a ~900-byte object with no `entrypoint`
crate has no entrypoint symbol, while an executable `#[program]` limits
byte, which the transfer-hook interface's eight-byte values cannot use. Each
crate now builds with `no-entrypoint`, so anchor exports its dispatch as
`__anchor_dispatch`, and `src/entrypoint.rs` maps the interface
discriminators onto handlers before delegating.
- `tokens/pda-mint-authority` and `tokens/token-extensions/cpi-guard` build
their PDA by hand (`create_account` plus `initialize_mint2` /
`initialize_account3`). Both examples exist to show an account that is its own
authority, and a v2 SPL `init` constraint cannot name the account being
initialized.
- `finance/order-book` keeps its ~180 KB zero-copy critbit book zero-copy: v2's
`Account<T>` derefs straight to `T`, so `load_init` / `load_mut` simply go
away rather than the state converting to borsh.
- Tests that asserted on an Anchor error *name* now assert on the numeric custom
code (the `#[error_code]` discriminant plus the default 6000 offset). v2 does
not log variant names, so the old assertions could never match.

### Removed

- `tokens/token-extensions/nft-meta-data-pointer` no longer depends on
`session-keys`. That crate is Anchor v1 only: its `Session` derive requires
`Option<Account<'info, SessionToken>>`, and `SessionToken` is not `Pod`, so
v2's zero-copy `Account<T>` cannot hold it either. The program reads the
session-token account layout itself (`src/session.rs`), checking owner,
discriminator and PDA, and spells out the `#[session_auth_or]` fallback in the
handler, so the gasless-session lesson and its security warning both survive.

## [2026-08-13] - Anchor examples in `basics/` move to Anchor v2.0.0-rc.1

### Changed

- Every Anchor example under `basics/` now builds against `anchor-lang`
2.0.0-rc.1. v2 is a ground-up rewrite rather than a version bump: the crate is
`no_std` and built on pinocchio, so handlers take `&mut Context<T>`, the
`<'info>` lifetime disappears from `#[derive(Accounts)]` structs and account
wrappers, `Pubkey` becomes `Address`, `.to_account_info()` becomes
`.cpi_handle_mut()` / `.cpi_handle()`, and `.key()` becomes `.address()`.
- `#[account]` is now zero-copy and requires a `Pod` layout. State holding
`String` or `Vec` moves to `#[account(borsh)]` plus `BorshAccount<T>`
(`account-data`, `close-account`, `favorites`, `realloc`, `pyth`); state that
is already fixed-layout keeps the zero-copy default but must carry explicit
padding (`program-derived-addresses`) and cannot use `bool`
(`cross-program-invocation` uses `PodBool`).
- Instruction data is wincode-encoded rather than borsh. The `#[program]` macro
expands to `wincode` paths, so every program crate takes a direct `wincode`
dependency. `BorshConfig` keeps the wire format byte-identical to borsh, so
the checked-in account layouts and the tests that decode them with borsh are
unaffected.
- The only edit most LiteSVM tests needed: v2's `solana_program` compat shim has
no `system_program` submodule (the real module is at the crate root and
exposes `ID`, not `id()`) and no `pubkey::Pubkey` unless the `compat` feature
is on (`anchor_lang::Address` is the same 32-byte type).

### Fixed

- Anchor programs that put an `Address` in serialized state pin
`solana-address = ">=2.6, <2.7"`. anchor-lang 2.0.0-rc.1 is built against
wincode 0.5, but solana-address 2.7 moved to wincode 0.6; with both in the
graph, `Address`'s wincode impls belong to the version the `#[account(borsh)]`
derive is not using, and every `SchemaRead` / `SchemaWrite` bound fails. This
is the same class of split that the zeropod/quasar-lang pin below addresses.

## [2026-08-04] - Oracle readers reject prices from before a cluster restart

### Added
Expand Down
Loading
Loading