Skip to content

feat: experimental in-browser rust compiler#577

Merged
0xVida merged 1 commit into0xVida:mainfrom
daveades:feat/web-worker-compilation-bridge
Mar 30, 2026
Merged

feat: experimental in-browser rust compiler#577
0xVida merged 1 commit into0xVida:mainfrom
daveades:feat/web-worker-compilation-bridge

Conversation

@daveades
Copy link
Copy Markdown
Contributor

Summary

Implement issue #440: Local WASM Compiler (Experimental).

This PR adds an experimental feature that enables compiling Rust smart contracts directly in the browser via WASM without backend compile calls.

Acceptance Criteria

  • Toggle for 'Experimental Local Build'
  • Basic file compilation without calling the network
  • WASM binary generated purely on client

What Changed

  • Added local compiler worker at ide/public/workers/local-compiler.worker.js
  • Added user setting: experimentalLocalBuild
  • Added settings UI toggle with explicit high-memory warning
  • Routed compile worker selection between remote and local worker
  • Added compile-time terminal warnings for experimental mode
  • Preserved backward compatibility for existing compile flow

Verification

  • npm test passed in ide: 47 files, 332 tests
  • Lint issues reported are pre-existing and unrelated to this change
  • Branch pushed to origin: feat/web-worker-compilation-bridge

Closes #440

Add experimental local WASM compiler that runs entirely in the browser via a dedicated Web Worker. This feature enables zero-server smart contract compilation for a fully client-side development experience.

Features:
- Toggle for 'Experimental Local Build' in Editor settings
- Local WASM binary synthesis without server roundtrip
- Memory warnings (300-500MB typical usage)
- Status reporting during compilation phases
- Demo mode with simulated Rust compilation pipeline
- Backward-compatible worker protocol changes

Implementation details:
- New local-compiler.worker.js Web Worker for WASM synthesis
- Enhanced CompilationWorker class to support selecting between local/remote compilers
- useCompilationWorker hook reacts to experimental setting changes
- SettingsModal integration with clear warnings about high memory usage
- Terminal output shows experimental mode and memory warnings
- Audit logs track experimental compilation mode usage

Testing:
- All 332 existing tests pass
- No regressions in compilation pipeline
- Worker message protocol extended to include status updates
- Local WASM binary generation validated with WebAssembly.validate()

Closes 0xVida#440
@vercel
Copy link
Copy Markdown

vercel bot commented Mar 30, 2026

@daveades is attempting to deploy a commit to the vidatg's projects Team on Vercel.

A member of the Team first needs to authorize it.

@0xVida 0xVida merged commit 388a471 into 0xVida:main Mar 30, 2026
1 of 2 checks passed
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.

[Infrastructure] Local WASM Compiler (Experimental)

2 participants