fix: fix all broken builds and tests across the repo#535
Open
mikemaccana-edwardbot wants to merge 1 commit intosolana-developers:mainfrom
Open
fix: fix all broken builds and tests across the repo#535mikemaccana-edwardbot wants to merge 1 commit intosolana-developers:mainfrom
mikemaccana-edwardbot wants to merge 1 commit intosolana-developers:mainfrom
Conversation
Contributor
|
@ZYJLiu this should fix all the broken tests in program-examples - can you please trigger the workflow? Thanks. 🙏 |
11baf3a to
105d9ea
Compare
Native tests (16/16 passing): - counter/native & escrow/native: add bn.js as explicit dependency. pnpm's strict dependency resolution does not hoist transitive deps (unlike npm), so bn.js from @solana/web3.js is not accessible directly. - All native tests using borsh: migrate from borsh v0.7 class-based API to borsh v2 object schema API. The v0.7 API (Map schemas, Assignable classes, 3-arg deserialize) is incompatible with borsh v1+. Updated 19 test files and 14 package.json files. Introduced a shared borshSerialize(schema, data) helper to replace the repeated Buffer.from(borsh.serialize(...)) pattern. Removed per-schema typed wrappers in favour of exporting schemas directly. - create-account/native: replace litesvm with solana-bankrun. litesvm's native binary crashes with SIGABRT on Linux x64 (LiteSVM/litesvm#171). This was the only native test using litesvm — all others use solana-bankrun, the recommended framework per CONTRIBUTING.md. - Upgrade TypeScript 4.x to 5.x in 10 token projects. TS4 can't parse @solana/codecs-data-structures type definitions. Also fix Keypair.fromSecretKey(Buffer.from(...)) to use Uint8Array.from() for TS5 compatibility. Anchor builds (39/39 passing): - Set solana_version = "3.1.8" in all 49 Anchor.toml files. Anchor's default BPF toolchain ships rustc 1.79, but anchor-lang 0.32.1's dependency tree requires rustc 1.82+ (indexmap 2.13.0) and Cargo's edition2024 feature. Solana 3.1.8 platform-tools v1.52 (rustc 1.89) resolves both. All projects now use a consistent toolchain version. - allow-block-list-token: bump spl-transfer-hook-interface 0.8.2 -> 2.1.0, spl-tlv-account-resolution 0.8.1 -> 0.11.1, spl-discriminator 0.3 -> 0.5.1. Old SPL versions used solana-program v1, causing type mismatches with anchor-lang 0.32.1's v2 types. litesvm Rust test moved to tests-rs/ because litesvm pins solana-account-info =2.2.1 but anchor-lang 0.32.1 needs >=2.3.0 for AccountInfo::resize(). See tests-rs/README.md. Compression projects (3/3 building): - Rewrite cnft-burn, cnft-vault, cutils from anchor-lang 0.26.0 to 0.32.1. Upgrade to mpl-bubblegum 2.1.1 + spl-account-compression 1.0.0 (both use solana-program v2, matching anchor-lang 0.32.1). cnft-vault: manual invoke_signed rewritten to TransferCpi. cutils verify: raw invoke because spl-account-compression 1.0.0's CPI module is built against anchor-lang 0.31, which has incompatible traits with 0.32.1. Discriminator computed from sha256("global:verify_leaf") rather than hardcoded. Comment documents when this workaround can be removed. Documentation: - README: remove TypeScript/Poseidon references (none exist in repo), Anchor before Native in badges, fix typos. - CONTRIBUTING: remove Steel/Python/Solidity/Poseidon references (none exist in repo), fix markdown, renumber sections.
105d9ea to
0a20794
Compare
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.
Summary
Fixes all broken Native tests, Anchor builds, and compression projects. Migrates all borsh usage from deprecated v0.7 API to v2. Removes references to frameworks not present in the repo.
Native tests (16/16 passing)
bn.jsas explicit dependency. pnpm's strict dependency resolution does not hoist transitive deps (unlike npm), sobn.jsfrom@solana/web3.jsis not accessible directly.Mapschemas,Assignableclasses, 3-argdeserialize) is incompatible with borsh v1+. Updated 19 test files and 14 package.json files. Introduced a sharedborshSerialize(schema, data)helper to replace the repeatedBuffer.from(borsh.serialize(...))pattern. Removed per-schema typed wrappers in favour of exporting schemas directly.@solana/codecs-data-structurestype definitions. Also fixKeypair.fromSecretKey(Buffer.from(...))to useUint8Array.from()for TS5 compatibility.Anchor builds (39/39 passing)
solana_version = "3.1.8"in all 49 Anchor.toml files. Anchor's default BPF toolchain ships rustc 1.79, but anchor-lang 0.32.1's dependency tree requires rustc 1.82+ (indexmap 2.13.0) and Cargo's edition2024 feature. Solana 3.1.8 platform-tools v1.52 (rustc 1.89) resolves both. All projects now use a consistent toolchain version.tests-rs/because litesvm pins solana-account-info =2.2.1 but anchor-lang 0.32.1 needs >=2.3.0 forAccountInfo::resize(). Seetests-rs/README.md.Compression projects (3/3 building)
invoke_signedrewritten toTransferCpi. cutils verify: raw invoke because spl-account-compression 1.0.0's CPI module is built against anchor-lang 0.31, which has incompatible traits with 0.32.1. Discriminator computed fromsha256("global:verify_leaf")rather than hardcoded. Comment documents when this workaround can be removed.Documentation