Skip to content

feat: implement contract graph → Soroban WASM compilation pipeline#42

Merged
Pvsaint merged 1 commit into
MetroLogic:mainfrom
GideonBature:contract-graph
Jun 19, 2026
Merged

feat: implement contract graph → Soroban WASM compilation pipeline#42
Pvsaint merged 1 commit into
MetroLogic:mainfrom
GideonBature:contract-graph

Conversation

@GideonBature

Copy link
Copy Markdown
Contributor

Summary

Implements the core compilation pipeline for LumensBlock: visual block graphs are validated, converted to Soroban Rust source, compiled to WASM via cargo, and wired into the deploy flow.

Screenshot 2026-06-19 at 4 09 51 am

Changes

  • ContractGraph schema — TypeScript types and JSON Schema for nodes, edges, block parameters, and compile errors (frontend/src/lib/compile/)
  • Validation — Rejects malformed, oversized, or structurally invalid graphs with structured { code, message } errors
  • Codegen — BFS traversal from Start generates Soroban contract source for Auth, Transfer, Storage, Event, and Condition blocks
  • Compiler — Temp crate + cargo build --target wasm32-unknown-unknown --release wrapper
  • POST /api/compile — Accepts a graph, returns base64 WASM or a compilation error
  • Deploy integrationdeployContract() calls the compile endpoint; DeployButton surfaces human-readable errors
  • Tests — Vitest unit tests for validation and codegen; CI runs npm test
  • Editor fixes — Resolves merge conflicts in BlockEditor.tsx and Toolbar.tsx

Approach

Server-side codegen (graph JSON → generated Rust → WASM) rather than pre-compiled templates, for flexibility as block types grow.

Test plan

  • npm test — validation and codegen unit tests pass
  • npx tsc --noEmit — type-check passes
  • Load Token Transfer template → Deploy → compiles and shows WASM summary
  • Invalid graph (Start only) → structured error shown in UI
  • Oversized/malformed payload → API returns 400 with readable message
  • Requires Rust + wasm32-unknown-unknown for full WASM compilation locally

Closes #3.

Introduce server-side codegen and POST /api/compile so visual block
graphs compile to deployable WASM, with validation, structured errors,
and deploy flow integration.
@Pvsaint Pvsaint merged commit 7aa0aac into MetroLogic:main Jun 19, 2026
1 check failed
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.

Implement contract graph → Soroban WASM compilation pipeline

2 participants