Skip to content

feat(mollusk): execute a BenchPlan for real compute units#9

Closed
MerlijnW70 wants to merge 2 commits into
feat/bench-scaffoldingfrom
feat/bench-mollusk-execution
Closed

feat(mollusk): execute a BenchPlan for real compute units#9
MerlijnW70 wants to merge 2 commits into
feat/bench-scaffoldingfrom
feat/bench-mollusk-execution

Conversation

@MerlijnW70

Copy link
Copy Markdown
Owner

Stacked on #8 (depends on cu_profiler_core::bench::BenchPlan). The Feature-3 follow-up: completes the turnkey real-CU path at the library level.

What

MolluskBackend::from_plan(plan, program_name) builds a live execution backend straight from a validated BenchPlan:

  • parses each fixture's base58 program/account addresses and hex instruction/account data into solana-instruction/solana-account types (fail-fast, once, up front);
  • registers one Mollusk scenario setup per instruction; a fresh Mollusk harness + Instruction is built per run;
  • meters real compute_units_consumed, which flows through the existing canonical-log → parser → report pipeline.

No hand-written harness — a declarative bench.toml in, real metered CU out.

Verification boundary (important)

This lives in the workspace-detached, Linux-only cu-profiler-mollusk crate (the Solana/SBF stack does not build on Windows, where the local grade-A gate runs). I therefore could not compile it locally — it is verified by the Linux SBF CI job, not the local gate. The pure helpers (decode_hex, parse_pubkey) and the plan→setup conversion are unit-tested, plus an end-to-end test that runs the demo .so from a declarative plan and asserts real metered CU.

If the SBF CI job flags a Solana-API mismatch I'll iterate on it.

Not yet wired

Making cu-profiler bench (the CLI from #8) call this on Linux needs a feature-gated CLI dependency on the detached crate — a separate step. This PR delivers the library API + tests.

🤖 Generated with Claude Code

intentos-dev and others added 2 commits June 21, 2026 15:34
Wire the turnkey path end-to-end in the Linux-only cu-profiler-mollusk
crate: `MolluskBackend::from_plan(plan, program_name)` converts a
validated `BenchPlan` into Mollusk scenario setups — parsing each
fixture's base58 program/account addresses and hex instruction/account
data into `solana-instruction`/`solana-account` types — and meters real
`compute_units_consumed`, feeding the existing report pipeline.

Parsing happens once up front (fail-fast on malformed fixtures); a fresh
Mollusk harness + Instruction is built per run. Pure helpers (decode_hex,
parse_pubkey) and the plan->setup conversion are unit-tested, plus an
end-to-end test that runs the demo .so from a declarative plan and
asserts real metered CU.

This crate is workspace-detached (Solana/SBF stack, not buildable on
Windows), so it is verified by the Linux SBF CI job, not the local gate.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add `run_plan(plan, program_name) -> Report` tying a validated BenchPlan
through MolluskBackend + the core Profiler into a Mollusk-tagged report,
and a thin Linux-only `cu-profiler-bench` binary that reads bench.toml,
runs it, and renders the report.

This completes the turnkey path as a *separate* binary in the detached
crate, deliberately NOT a feature-gated dependency of the main CLI — the
core/CLI stay Solana-free and Windows-buildable (the project invariant).

run_plan is covered by an end-to-end test that meters the demo .so from a
declarative plan. Verified by the Linux SBF CI job (the crate does not
build on the local Windows gate).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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