Skip to content

feat: surfpool SDK#600

Merged
MicaiahReid merged 39 commits intomainfrom
feat/sdk
Apr 21, 2026
Merged

feat: surfpool SDK#600
MicaiahReid merged 39 commits intomainfrom
feat/sdk

Conversation

@lgalabru
Copy link
Copy Markdown
Collaborator

No description provided.

lgalabru and others added 30 commits March 28, 2026 17:55
- Add report module: collect transaction profiles from each Surfnet
  instance, consolidate across parallel tests, and generate a
  self-contained HTML report with transaction inspection
- Report triggered via SURFPOOL_REPORT=1 env var or .report(true) builder
- Auto-detect test function names from thread names
- Rich HTML report: Surfpool-branded UI with inline transaction tables,
  per-instruction CU breakdown, parsed JSON + hex byte comparison with
  diff highlighting, account state diffs
- Add SurfpoolReport::from_directory() / generate_html() / write_html()
- Add uuid, chrono, serde dependencies to SDK
Native Node.js bindings using napi-rs, following the same pattern
as litesvm's node-litesvm crate.

Exposes:
- Surfnet.start() / Surfnet.startWithConfig() — spin up embedded surfpool
- surfnet.rpcUrl / wsUrl / payer / payerSecretKey — accessors
- surfnet.fundSol() / fundToken() / setAccount() / getAta() — cheatcodes
- Surfnet.newKeypair() — generate random keypair

TypeScript wrapper in surfpool-sdk/index.ts provides clean DX.
Build: npx napi build --platform surfpool-sdk
Two composite actions for use by any repo:

.github/actions/report — Surfpool Test Report
  - Upload report HTML as artifact
  - Deploy to GitHub Pages under configurable path (per-PR by default)
  - Post sticky PR comment with direct link
  Inputs: report-dir, output-path, generate-command, pages-path

.github/actions/coverage — Coverage Report
  - Accept cargo-llvm-cov JSON and/or vitest coverage-summary.json
  - Render unified table with color badges (green ≥90%, yellow ≥80%, red <80%)
  - Post as sticky PR comment
  Inputs: rust-coverage-json, ts-coverage-json, thresholds

Usage:
  uses: solana-foundation/surfpool/.github/actions/report@feat/sdk
  uses: solana-foundation/surfpool/.github/actions/coverage@feat/sdk
One-liner for test files:
  surfpool_sdk::report::SurfpoolReport::generate(None, None);

Uses default paths (target/surfpool-reports → target/surfpool-report.html)
and handles missing data gracefully with eprintln.
Avoids needing a tsc build step — 'import { Surfnet } from surfpool-sdk'
now resolves directly to the napi-generated internal.js binding.
Merges the two separate actions into one that posts a single PR comment:
- Coverage table (Rust + TS) at the top
- Surfpool test report link below (separated by ----)
- GitHub Pages deploy for the HTML report
- Artifact upload

Usage:
  uses: solana-foundation/surfpool/.github/actions/test-report@feat/sdk
  with:
    rust-coverage-json: rust-cov/coverage.json
    ts-coverage-json: ts-cov/coverage-summary.json
    report-path: surfpool-report.html
@MicaiahReid MicaiahReid marked this pull request as ready for review April 20, 2026 20:33
@MicaiahReid MicaiahReid changed the title feat: draft surfpool-sdk feat: add rust + TS sdk Apr 20, 2026
@MicaiahReid MicaiahReid changed the title feat: add rust + TS sdk feat: surfpool SDK Apr 21, 2026
@MicaiahReid MicaiahReid self-requested a review April 21, 2026 02:13
@MicaiahReid MicaiahReid merged commit 619752c into main Apr 21, 2026
6 checks passed
@lgalabru lgalabru deleted the feat/sdk branch April 28, 2026 00:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants