Solana: QA setup blockers — tsconfig, missing deps, surfpool, stub scripts #62

Closed
opened 2026-03-19 06:23:26 +00:00 by Brouie · 23 comments
Brouie commented 2026-03-19 06:23:26 +00:00 (Migrated from gitlab.com)

Branch: feat/solana-integration\nRef: #60 Steps 2-4\n\nIssues found during QA setup:\n\n1. tsconfig.json (packages/contracts-solana): types only includes mocha/chai, missing node. Scripts fail with 'Cannot find name process/console/Buffer'. Workaround: --transpile-only --skip-project\n\n2. Module resolution: Scripts in scripts/solana/ can't resolve node_modules from packages/contracts-solana. Workaround: NODE_PATH=$(pwd)/node_modules\n\n3. Missing dep: register-chain-evm.ts requires 'viem' which is not in package.json\n\n4. initialize-bridge.ts is a stub: Prints config but says 'Use anchor CLI or IDL-based client for actual initialization' — doesn't send tx\n\n5. surfpool not found: anchor test requires surfpool (local validator) which is not in prerequisites or installed. Error: 'Failed to spawn surfpool: No such file or directory'\n\n6. deploy.sh hash parity: Step [4/4] fails with '--grep' arg not recognized by cargo-build-sbf\n\nEnvironment: Contabo VPS, Ubuntu 22.04, Node v24.14.0, Rust 1.94.0, Solana CLI 3.1.11, Anchor 1.0.0-rc.3

**Branch:** feat/solana-integration\n**Ref:** #60 Steps 2-4\n\n**Issues found during QA setup:**\n\n1. **tsconfig.json** (packages/contracts-solana): types only includes mocha/chai, missing node. Scripts fail with 'Cannot find name process/console/Buffer'. Workaround: --transpile-only --skip-project\n\n2. **Module resolution**: Scripts in scripts/solana/ can't resolve node_modules from packages/contracts-solana. Workaround: NODE_PATH=$(pwd)/node_modules\n\n3. **Missing dep**: register-chain-evm.ts requires 'viem' which is not in package.json\n\n4. **initialize-bridge.ts is a stub**: Prints config but says 'Use anchor CLI or IDL-based client for actual initialization' — doesn't send tx\n\n5. **surfpool not found**: anchor test requires surfpool (local validator) which is not in prerequisites or installed. Error: 'Failed to spawn surfpool: No such file or directory'\n\n6. **deploy.sh hash parity**: Step [4/4] fails with '--grep' arg not recognized by cargo-build-sbf\n\n**Environment:** Contabo VPS, Ubuntu 22.04, Node v24.14.0, Rust 1.94.0, Solana CLI 3.1.11, Anchor 1.0.0-rc.3
Brouie commented 2026-03-19 06:33:21 +00:00 (Migrated from gitlab.com)

mentioned in commit e45dfe4d35

mentioned in commit e45dfe4d350c911c3fb0badb58fb416fd943a425
Brouie commented 2026-03-19 06:33:56 +00:00 (Migrated from gitlab.com)

mentioned in merge request !146

mentioned in merge request !146
Brouie commented 2026-03-19 08:48:17 +00:00 (Migrated from gitlab.com)

mentioned in commit 3d5c45f67574fc1c167a46fd84f85a4b6fd3b0ad

mentioned in commit 3d5c45f67574fc1c167a46fd84f85a4b6fd3b0ad
PlasticDigits commented 2026-03-19 10:53:13 +00:00 (Migrated from gitlab.com)

mentioned in commit b21e250565

mentioned in commit b21e2505650ee2ea9c492da2fe8c6116cf725658
PlasticDigits commented 2026-03-19 11:53:28 +00:00 (Migrated from gitlab.com)

Re: Blocker 5 — surfpool not found

This is an environment version mismatch, not a project bug. The project targets @coral-xyz/anchor: ^0.30.1 (anchor-cli 0.30.x), which uses solana-test-validator as the local validator. surfpool is only required by Anchor 1.0+ (the Anza toolchain).

Correct setup:

  • anchor-cli 0.30.1 (not 1.0.0-rc.3)
  • solana-test-validator (ships with solana-cli 2.x)

If you have Anchor 1.0.0-rc.3 installed, downgrade:

cargo install --git https://github.com/coral-xyz/anchor avm --force
avm install 0.30.1
avm use 0.30.1

@brouie Verify: anchor --version should show anchor-cli 0.30.1, and anchor test will use solana-test-validator which is already available via solana-cli.

**Re: Blocker 5 — surfpool not found** This is an environment version mismatch, not a project bug. The project targets `@coral-xyz/anchor: ^0.30.1` (anchor-cli 0.30.x), which uses `solana-test-validator` as the local validator. `surfpool` is only required by Anchor 1.0+ (the Anza toolchain). **Correct setup:** - anchor-cli **0.30.1** (not 1.0.0-rc.3) - solana-test-validator (ships with solana-cli 2.x) If you have Anchor 1.0.0-rc.3 installed, downgrade: ``` cargo install --git https://github.com/coral-xyz/anchor avm --force avm install 0.30.1 avm use 0.30.1 ``` @brouie Verify: `anchor --version` should show `anchor-cli 0.30.1`, and `anchor test` will use `solana-test-validator` which is already available via `solana-cli`.
PlasticDigits commented 2026-03-19 11:55:02 +00:00 (Migrated from gitlab.com)

mentioned in commit c9ebf6254d

mentioned in commit c9ebf6254d9636f47d3786a43c23226d6b022c65
PlasticDigits commented 2026-03-19 11:58:37 +00:00 (Migrated from gitlab.com)

Correction on Anchor version: The correct stable version to target is Anchor 0.32.1 (released October 2025), not 0.32 or 1.0.0-rc.x.

  • anchor-lang = 0.32.1
  • anchor-spl = 0.32.1
  • @coral-xyz/anchor (npm) = ^0.32.1
  • Recommended Solana CLI: 2.3.0

The 1.0.0 release candidates (rc.1, rc.2, rc.3) are pre-release and not yet stable — they have very low adoption (~3k downloads vs 259k for 0.32.1) and may still have breaking changes before the final 1.0 release.

Dependencies have been updated in packages/contracts-solana/programs/cl8y-bridge/Cargo.toml and packages/contracts-solana/package.json to target 0.32.1.

**Correction on Anchor version:** The correct stable version to target is **Anchor 0.32.1** (released October 2025), not 0.32 or 1.0.0-rc.x. - `anchor-lang` = `0.32.1` - `anchor-spl` = `0.32.1` - `@coral-xyz/anchor` (npm) = `^0.32.1` - Recommended Solana CLI: `2.3.0` The 1.0.0 release candidates (rc.1, rc.2, rc.3) are pre-release and not yet stable — they have very low adoption (~3k downloads vs 259k for 0.32.1) and may still have breaking changes before the final 1.0 release. Dependencies have been updated in `packages/contracts-solana/programs/cl8y-bridge/Cargo.toml` and `packages/contracts-solana/package.json` to target 0.32.1.
Brouie commented 2026-03-23 01:21:42 +00:00 (Migrated from gitlab.com)

Verified: Anchor downgraded to 0.32.1 — surfpool issue resolved (0.32.1 uses solana-test-validator). Build clean, 32/33 tests pass. Remaining open items: initialize-bridge.ts still a stub, deploy.sh hash parity --grep flag still broken.

Verified: Anchor downgraded to 0.32.1 — surfpool issue resolved (0.32.1 uses solana-test-validator). Build clean, 32/33 tests pass. Remaining open items: initialize-bridge.ts still a stub, deploy.sh hash parity --grep flag still broken.
Brouie commented 2026-03-23 01:27:34 +00:00 (Migrated from gitlab.com)

Additional finding: initialize-bridge.sh uses ANCHOR_PROVIDER_URI but Anchor expects ANCHOR_PROVIDER_URL. Script works when ANCHOR_PROVIDER_URL is set directly but the internal variable name is wrong (line ~51). Steps 2-3 progress: initialize works, register-chain-evm needs PRIVATE_KEY, register-chain-terra needs BRIDGE_CONTRACT.

Additional finding: initialize-bridge.sh uses ANCHOR_PROVIDER_URI but Anchor expects ANCHOR_PROVIDER_URL. Script works when ANCHOR_PROVIDER_URL is set directly but the internal variable name is wrong (line ~51). Steps 2-3 progress: initialize works, register-chain-evm needs PRIVATE_KEY, register-chain-terra needs BRIDGE_CONTRACT.
PlasticDigits commented 2026-03-23 03:34:25 +00:00 (Migrated from gitlab.com)

mentioned in commit 02bf9b9aa6

mentioned in commit 02bf9b9aa6fa14f6203963702a41852bc4c6c53d
PlasticDigits commented 2026-03-23 03:35:01 +00:00 (Migrated from gitlab.com)

Fixed ANCHOR_PROVIDER_URI → ANCHOR_PROVIDER_URL typo in initialize-bridge.sh (line 49) — pushed to feat/solana-integration as 02bf9b9.

Re: other items from your latest comments:

  • deploy.sh hash parity --grep — already resolved in current code; deploy.sh calls npx ts-mocha directly instead of anchor test -- --grep.
  • initialize-bridge.ts stub — replaced by the test-based approach (ts-mocha --grep "initialize") which sends real transactions.
  • register-chain-evm PRIVATE_KEY / register-chain-terra BRIDGE_CONTRACT — these are required env vars by design, not bugs.

@brouie Please verify the URI→URL fix resolves the provider fallback issue you observed. 32/33 tests should still pass.

Fixed ANCHOR_PROVIDER_URI → ANCHOR_PROVIDER_URL typo in `initialize-bridge.sh` (line 49) — pushed to `feat/solana-integration` as `02bf9b9`. **Re: other items from your latest comments:** - **deploy.sh hash parity --grep** — already resolved in current code; `deploy.sh` calls `npx ts-mocha` directly instead of `anchor test -- --grep`. - **initialize-bridge.ts stub** — replaced by the test-based approach (`ts-mocha --grep "initialize"`) which sends real transactions. - **register-chain-evm PRIVATE_KEY / register-chain-terra BRIDGE_CONTRACT** — these are required env vars by design, not bugs. @brouie Please verify the URI→URL fix resolves the provider fallback issue you observed. 32/33 tests should still pass.
PlasticDigits commented 2026-03-23 03:45:30 +00:00 (Migrated from gitlab.com)

mentioned in commit f906e186a5

mentioned in commit f906e186a5496e46b720978af3a93bad89f9eaad
PlasticDigits commented 2026-03-23 03:45:41 +00:00 (Migrated from gitlab.com)

Fixed the remaining additional findings — pushed to feat/solana-integration as f906e18:

1. Fragile path resolution in deploy.sh and initialize-bridge.sh
Both scripts used bare cd packages/contracts-solana which only worked when invoked from repo root. Now uses SCRIPT_DIR/REPO_ROOT pattern (consistent with run-test-validator.sh) — scripts work from any directory.

2. deploy.sh step [4/4] missing provider env vars
The ts-mocha hash parity step didn't set ANCHOR_PROVIDER_URL or ANCHOR_WALLET, so non-localnet deployments would verify against localhost instead of the target cluster. Now passes both env vars (same pattern as initialize-bridge.sh).

3. register-tokens.sh was a pure stub
Same class of issue as original finding #4 (initialize-bridge.ts stub). Replaced with a functional script that:

  • Accepts SOLANA_RPC_URL and SOLANA_KEYPAIR env vars
  • Uses SCRIPT_DIR/REPO_ROOT for reliable path resolution
  • Calls register_token instruction via ts-mocha --grep "register_token"
  • Added register_token test coverage to bridge.test.ts (happy path + unauthorized admin check)

@brouie Please verify these fixes and confirm the QA setup blockers are resolved. All pre-commit checks pass and the new register_token tests should bring the count to 35 (from 32/33).

Fixed the remaining additional findings — pushed to `feat/solana-integration` as `f906e18`: **1. Fragile path resolution in `deploy.sh` and `initialize-bridge.sh`** Both scripts used bare `cd packages/contracts-solana` which only worked when invoked from repo root. Now uses `SCRIPT_DIR`/`REPO_ROOT` pattern (consistent with `run-test-validator.sh`) — scripts work from any directory. **2. `deploy.sh` step [4/4] missing provider env vars** The ts-mocha hash parity step didn't set `ANCHOR_PROVIDER_URL` or `ANCHOR_WALLET`, so non-localnet deployments would verify against localhost instead of the target cluster. Now passes both env vars (same pattern as `initialize-bridge.sh`). **3. `register-tokens.sh` was a pure stub** Same class of issue as original finding #4 (initialize-bridge.ts stub). Replaced with a functional script that: - Accepts `SOLANA_RPC_URL` and `SOLANA_KEYPAIR` env vars - Uses `SCRIPT_DIR`/`REPO_ROOT` for reliable path resolution - Calls `register_token` instruction via `ts-mocha --grep "register_token"` - Added `register_token` test coverage to `bridge.test.ts` (happy path + unauthorized admin check) @brouie Please verify these fixes and confirm the QA setup blockers are resolved. All pre-commit checks pass and the new register_token tests should bring the count to 35 (from 32/33).
Brouie commented 2026-03-23 04:02:59 +00:00 (Migrated from gitlab.com)

register-tokens.sh on devnet hits 429 airdrop rate limit — setupTest() airdrops SOL to fresh keypairs every run. Devnet faucet blocks after a few attempts. Scripts work fine on localnet. Suggest either: (1) pre-fund test accounts, or (2) skip airdrop if accounts already have balance.

register-tokens.sh on devnet hits 429 airdrop rate limit — setupTest() airdrops SOL to fresh keypairs every run. Devnet faucet blocks after a few attempts. Scripts work fine on localnet. Suggest either: (1) pre-fund test accounts, or (2) skip airdrop if accounts already have balance.
PlasticDigits commented 2026-03-23 05:04:32 +00:00 (Migrated from gitlab.com)

mentioned in commit d62ac24fe3

mentioned in commit d62ac24fe317226728bc77329ba256bb3740a982
PlasticDigits commented 2026-03-23 05:04:38 +00:00 (Migrated from gitlab.com)

Fixed the devnet airdrop rate-limiting — pushed as d62ac24.

The airdrop() helper in tests/helpers/setup.ts now:

  1. Checks balance first — skips the airdrop entirely if the account already has >= 1 SOL
  2. Retries on 429 — up to 3 attempts with exponential backoff (2s, 4s, 8s)

This handles both scenarios: reruns against already-funded accounts skip the faucet entirely, and transient rate-limits are retried automatically. Localnet behavior is unchanged (faucet never returns 429).

@brouie Please re-verify register-tokens.sh on devnet with this fix.

Fixed the devnet airdrop rate-limiting — pushed as `d62ac24`. The `airdrop()` helper in `tests/helpers/setup.ts` now: 1. **Checks balance first** — skips the airdrop entirely if the account already has >= 1 SOL 2. **Retries on 429** — up to 3 attempts with exponential backoff (2s, 4s, 8s) This handles both scenarios: reruns against already-funded accounts skip the faucet entirely, and transient rate-limits are retried automatically. Localnet behavior is unchanged (faucet never returns 429). @brouie Please re-verify `register-tokens.sh` on devnet with this fix.
Brouie commented 2026-03-23 05:51:39 +00:00 (Migrated from gitlab.com)

Still blocked on devnet. The airdrop retry fix (d62ac24) helps with transient 429s, but setupTest() generates fresh Keypair.generate() for operator/user/canceler every run — new wallets always have 0 balance, so the balance check on line 21-22 never skips. Suggest: use saved devnet keypairs (e.g. from JSON files) instead of Keypair.generate() when SOLANA_RPC_URL points to devnet.

Still blocked on devnet. The airdrop retry fix (d62ac24) helps with transient 429s, but setupTest() generates fresh Keypair.generate() for operator/user/canceler every run — new wallets always have 0 balance, so the balance check on line 21-22 never skips. Suggest: use saved devnet keypairs (e.g. from JSON files) instead of Keypair.generate() when SOLANA_RPC_URL points to devnet.
Brouie commented 2026-03-23 05:53:48 +00:00 (Migrated from gitlab.com)

mentioned in issue #67

mentioned in issue #67
PlasticDigits commented 2026-03-23 11:54:22 +00:00 (Migrated from gitlab.com)

@Brouie Should be fixed, I updated the qa dev server, please check

@Brouie Should be fixed, I updated the qa dev server, please check
Brouie commented 2026-03-25 03:25:55 +00:00 (Migrated from gitlab.com)

Re-verified — still blocked. register-tokens.sh on devnet still hits 429. setupTest() still generates fresh Keypair.generate() every run, so balance check never skips. The d62ac24 retry fix helps transient 429s but doesn't solve the fundamental issue of new wallets needing airdrops every time.

Re-verified — still blocked. register-tokens.sh on devnet still hits 429. setupTest() still generates fresh Keypair.generate() every run, so balance check never skips. The d62ac24 retry fix helps transient 429s but doesn't solve the fundamental issue of new wallets needing airdrops every time.
PlasticDigits commented 2026-03-25 05:05:42 +00:00 (Migrated from gitlab.com)

mentioned in commit f5dec317ba

mentioned in commit f5dec317bae020dabafc3d0501fa43f43125e39c
PlasticDigits commented 2026-03-25 05:05:49 +00:00 (Migrated from gitlab.com)

Update (devnet 429 / setupTest funding) — pushed f5dec31 on feat/solana-integration.

What changed (packages/contracts-solana/tests/helpers/setup.ts):

  • Remote clusters (e.g. devnet): Top up the admin with a single requestAirdrop when needed, then fund operator/user/canceler via SystemProgram.transfer — avoids hammering the public faucet (one faucet hit per run instead of three, plus no burst on ad-hoc test wallets that use airdrop()).
  • Localhost: Unchanged behavior: requestAirdrop per account; default per-wallet funding restored to 100 SOL so fuzz / large-deposit tests keep enough lamports (same as before the regression).
  • Persistent QA keypairs: On non-localhost, optional JSON under .devnet-keys/ (gitignored) so reruns reuse funded wallets when env keypair paths are not set.

Also: Fixed types import to ../../target/types/cl8y_bridge (correct path from tests/helpers/).

anchor test was run locally: 178 passing.

@brouie Please re-verify register-tokens.sh / devnet scripts with this commit; if anything still blocks QA, note the exact error.

**Update (devnet 429 / setupTest funding)** — pushed `f5dec31` on `feat/solana-integration`. **What changed** (`packages/contracts-solana/tests/helpers/setup.ts`): - **Remote clusters (e.g. devnet):** Top up the admin with a single `requestAirdrop` when needed, then fund operator/user/canceler via `SystemProgram.transfer` — avoids hammering the public faucet (one faucet hit per run instead of three, plus no burst on ad-hoc test wallets that use `airdrop()`). - **Localhost:** Unchanged behavior: `requestAirdrop` per account; default per-wallet funding restored to **100 SOL** so fuzz / large-deposit tests keep enough lamports (same as before the regression). - **Persistent QA keypairs:** On non-localhost, optional JSON under `.devnet-keys/` (gitignored) so reruns reuse funded wallets when env keypair paths are not set. **Also:** Fixed types import to `../../target/types/cl8y_bridge` (correct path from `tests/helpers/`). `anchor test` was run locally: **178 passing**. @brouie Please re-verify `register-tokens.sh` / devnet scripts with this commit; if anything still blocks QA, note the exact error.
Brouie commented 2026-03-25 05:13:35 +00:00 (Migrated from gitlab.com)

Closing per dev — #62 only affects long-running devnet. Localnet uses make solana-test/solana-reset with clean state each run.

Closing per dev — #62 only affects long-running devnet. Localnet uses make solana-test/solana-reset with clean state each run.
Brouie (Migrated from gitlab.com) closed this issue 2026-03-25 05:13:37 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
code/cl8y-bridge-monorepo#62
No description provided.