Repository navigation
Move Anchor v2 examples to 2.0.0-rc.4 - #215
Merged
Merged
Conversation
- anchor-lang and anchor-spl 2.0.0-rc.2 -> 2.0.0-rc.4 in all 56 anchor/ projects; anchor-v2-testing pinned to 2cdb58ba (the v2.0.0-rc.4 tag). - Anchor v2 workflow installs anchor-cli 2.0.0-rc.4. - rc.3 removed #[account(unsafe(dup))]: token-minter, transfer-tokens and transfer-switch use #[account(mut)] on the aliasing Signer/UncheckedAccount fields. - rc.3 made remaining_accounts() infallible and it returns &[AccountView]: drop the `?` at all eleven call sites; transfer-fee's harvest copies with .to_vec(). - Docs, READMEs, migration guide and CHANGELOG name rc.4. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01GZHin7DpSfM4XDLwarivAB
rc.4 removed Box<T>'s AnchorAccount impl (anchor#5185) and the lifetime parameter on Interface (anchor#4891). Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01GZHin7DpSfM4XDLwarivAB
rc.4's CpiContext takes a const N, the number of accounts the CPI passes (anchor#5185). harvest_withheld_tokens_to_mint takes its sources as a slice. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01GZHin7DpSfM4XDLwarivAB
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01GZHin7DpSfM4XDLwarivAB
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01GZHin7DpSfM4XDLwarivAB
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01GZHin7DpSfM4XDLwarivAB
- compression: hand-built Bubblegum CPIs use a local OwnedInstruction that implements CpiInstruction; rc.4 no longer re-exports Instruction onchain. - cross-program-invocation: supply the FixedVec data buffer the generated switch_power CPI takes onchain, cap `name` at MAX_NAME_LEN with a NameTooLong error, and test both sides of the limit. - transfer-fee: harvest's CpiContext holds the mint plus MAX_HARVEST_SOURCES token accounts; more fail with TooManyHarvestSources, tested. - escrow, options: a mutable account in two slots now fails with AccountBorrowFailed rather than ConstraintDuplicateMutableAccount. - Remove comments and README notes about boxed accounts. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01GZHin7DpSfM4XDLwarivAB
The declare_program! CPI function takes `String` on the host and `&str` onchain. CHANGELOG and docs/anchor-v2-migration.md describe unboxed accounts, CpiContext capacities, declare_program! data buffers, OwnedInstruction and the safe load_mut. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01GZHin7DpSfM4XDLwarivAB
anchor-lang, anchor-spl and anchor-derive-accounts move from 2.0.0-rc.2 to 2.0.0-rc.4, and anchor-v2-testing to the v2.0.0-rc.4 tag revision 2cdb58ba. Claude-Session: https://claude.ai/code/session_01GZHin4a7zmaQg8n7Dv4BAP
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Moves all 56 Anchor v2 examples (
anchor/directories) from 2.0.0-rc.2 to 2.0.0-rc.4. Theanchor-v1/copies are unchanged. CI builds and tests all 56 projects (496 tests), and every workflow passes.Versions
anchor-lang/anchor-spl→2.0.0-rc.4;anchor-v2-testing→2cdb58ba(thev2.0.0-rc.4tag).wincodestays on 0.6.Cargo.lockrecords the same:anchor-lang,anchor-splandanchor-derive-accountsat2.0.0-rc.4,anchor-v2-testingat2cdb58ba.anchor-cli 2.0.0-rc.4.rc.3 breaking changes
#[account(unsafe(dup))]is removed (anchor#5091).token-minter,transfer-tokensandtransfer-switchuse#[account(mut)], becauseSigner/SystemAccount/UncheckedAccountalias freely. A mutable account in two data slots now fails withAccountBorrowFailed, so theescrowandoptionssame-account tests expect that error.remaining_accounts()is infallible and returns&[AccountView], so I dropped the?at all 11 call sites.rc.4 changes missing from Anchor's changelog
rc.4's changelog lists only TypeScript changes, but it also ships anchor#5185 (allocator-free v2 public API) and anchor#4891:
Boxaccounts. I unboxed 245 fields. CI shows no stack-frame warnings across the 56 programs.Interface<'static, T>→Interface<T>(81 fields).CpiContext::<_, N>. N is the CPI's account capacity and can't be inferred, so I set N to the struct's field count at all 176 calls.transfer-fee'sharvestnow caps sources atMAX_HARVEST_SOURCES(16) with a newTooManyHarvestSourceserror, and has a test for it.declare_program!CPI functions take aFixedVecdata buffer onchain.handsupplies one, capsnameatMAX_NAME_LEN(32) withNameTooLong, and tests 32 and 33 bytes.Instruction. The compression examples use a localOwnedInstructionthat implementsCpiInstruction.load_mutis safe, soorder-bookdrops itsunsafeblocks.Docs
The CHANGELOG,
docs/anchor-v2-migration.md(new "Duplicate Accounts Fail Through Borrows" section, plus the API changes above), READMEs and CONTRIBUTING are all updated. Comments about boxing are removed.The finance plugin's Anchor v2 guide is updated to match in quicknode/solana-finance-claude-plugin#94.
https://claude.ai/code/session_01GZHin7DpSfM4XDLwarivAB
https://claude.ai/code/session_01GZHin4a7zmaQg8n7Dv4BAP