Skip to content

Add julc smart contract and devnet integration#8

Open
satran004 wants to merge 19 commits intomasterfrom
feat/julc-yano-integration
Open

Add julc smart contract and devnet integration#8
satran004 wants to merge 19 commits intomasterfrom
feat/julc-yano-integration

Conversation

@satran004
Copy link
Copy Markdown
Member

julc Integration:

  • Project creation wizard (Gradle/Maven/Basic via julc CLI download)
  • julc CLI download from GitHub releases with version selection
  • SDK configuration with download button and PATH auto-detection
  • Build action (./gradlew clean build -x test) with VFS refresh
  • Test action, Blueprint viewer, Deploy validator dialog
  • Embedded REPL tool window (julc repl --no-jline)
  • Live templates (julcspend, julcmint, julcmulti, julcentry, julctest)
  • Inline error highlighting via JavaParser-based validators:
    • Language subset (try/catch, null, arrays, this/super, float/double)
    • API blocklist (java.io, java.net, HashMap, Thread, System)
    • Cross-file @onchainlibrary check via PSI (red error)
    • Non-julc JAR library detection (META-INF/plutus-sources/)

Yano Integration:

  • Download from GitHub releases (version selection, native/JVM)
  • Process lifecycle (start/stop, health polling, auto-start)
  • Devnet control panel with 5 tabs:
    • Setup (download, start/stop, live status)
    • Fund (with account chooser from Cardano panel)
    • Snapshots (create, restore, delete)
    • Rollback (undo last N blocks)
    • Time Machine (advance slots/epochs, past time travel)
  • Status bar widget with live slot/block counter
  • Backend routing (Yano as new NodeType, Blockfrost-compatible)
  • Inline status feedback on all devnet operations

Infrastructure:

  • Upgrade to IntelliJ Platform Gradle Plugin 2.11.0
  • Upgrade to IntelliJ IDEA 2025.1.1, Kotlin 2.1.10, Gradle 8.13
  • Upgrade LSP4IJ to 0.10.0, sinceBuild to 251
  • Add com.intellij.modules.java dependency for PSI-based analysis
  • Add javaparser-core 3.26.3 for subset validation

Also includes pre-existing Aiken enhancements:

  • Aiken grammar updates, completion contributors
  • Symbol index, navigation, stdlib reference resolution
  • DevKit lifecycle management (process manager, status monitor)

julc Integration:
- Project creation wizard (Gradle/Maven/Basic via julc CLI download)
- julc CLI download from GitHub releases with version selection
- SDK configuration with download button and PATH auto-detection
- Build action (./gradlew clean build -x test) with VFS refresh
- Test action, Blueprint viewer, Deploy validator dialog
- Embedded REPL tool window (julc repl --no-jline)
- Live templates (julcspend, julcmint, julcmulti, julcentry, julctest)
- Inline error highlighting via JavaParser-based validators:
  - Language subset (try/catch, null, arrays, this/super, float/double)
  - API blocklist (java.io, java.net, HashMap, Thread, System)
  - Cross-file @onchainlibrary check via PSI (red error)
  - Non-julc JAR library detection (META-INF/plutus-sources/)

Yano Integration:
- Download from GitHub releases (version selection, native/JVM)
- Process lifecycle (start/stop, health polling, auto-start)
- Devnet control panel with 5 tabs:
  - Setup (download, start/stop, live status)
  - Fund (with account chooser from Cardano panel)
  - Snapshots (create, restore, delete)
  - Rollback (undo last N blocks)
  - Time Machine (advance slots/epochs, past time travel)
- Status bar widget with live slot/block counter
- Backend routing (Yano as new NodeType, Blockfrost-compatible)
- Inline status feedback on all devnet operations

Infrastructure:
- Upgrade to IntelliJ Platform Gradle Plugin 2.11.0
- Upgrade to IntelliJ IDEA 2025.1.1, Kotlin 2.1.10, Gradle 8.13
- Upgrade LSP4IJ to 0.10.0, sinceBuild to 251
- Add com.intellij.modules.java dependency for PSI-based analysis
- Add javaparser-core 3.26.3 for subset validation

Also includes pre-existing Aiken enhancements:
- Aiken grammar updates, completion contributors
- Symbol index, navigation, stdlib reference resolution
- DevKit lifecycle management (process manager, status monitor)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@satran004 satran004 changed the title Add julc smart contract and Yano devnet integration Add julc smart contract and devnet integration Apr 10, 2026
satran004 and others added 18 commits April 10, 2026 13:56
Quick fixes:
- "Add @onchainlibrary" one-click fix when annotation is missing
- "Replace null with Optional.empty()" for null literals in validators

Gutter icons:
- Deploy icon next to @Validator/@SpendingValidator classes (click to build)
- Run icon next to @entrypoint methods (click to build)
- Library icon next to @onchainlibrary classes (click to build)
- Parameter icon next to @param fields
- All icons trigger julc build on click

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ssloader

Build infrastructure:
- Upgrade IntelliJ Platform Gradle Plugin to 2.14.0
- Upgrade to IntelliJ IDEA 2026.1 (build 261)
- Upgrade Gradle to 9.4.1
- Migrate grammarkit to bundled platform plugin
- Replace intellijIdeaCommunity() with intellijIdea() (IC merged in 2025.3+)
- Remove stale gen:blockfrost-api from settings.gradle

julc-compiler runtime bridge:
- Bundle julc-compiler-all.jar (2MB) and julc-vm-java-all.jar (8MB) shadow JARs
- JulcCompilerBridge loads real SubsetValidator via isolated URLClassLoader
- JBR 25 at runtime executes Java 24+ bytecode from shadow JARs
- Graceful fallback to local JavaParser-based validators on older JBR
- User override: place newer JARs in ~/.intelliada/julc-libs/
- Shadow JAR build configs added to julc repo (julc-compiler, julc-vm-java)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The wizard now requires a valid julc SDK before allowing project creation:
- SDK selector panel with path browser and auto-detection
- Checks existing SDKs, ~/.julc/bin, ~/.intelliada/julc-cli/
- "Download" button to fetch julc CLI (blocking until complete)
- Version detection and validation before proceeding
- SDK persisted to JulcSDKState for future projects
- ConfigurationException thrown if no SDK selected (prevents empty projects)

Fixes the chicken-and-egg issue where project creation ran before
julc CLI download completed, resulting in empty projects.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
JulcCompilerBridge: Loads julc-compiler-all.jar via isolated URLClassLoader
- SubsetValidator for real-time error highlighting (replaces copied validator)
- Falls back to local JavaParser validators on JBR < 25

JulcVmBridge: Loads julc-vm-java-all.jar for local evaluation
- compile(source) -> CompileInfo (diagnostics, script size, UPLC text, program)
- evaluate(program) -> EvalInfo (success/failure, CPU/memory budget, traces)
- VM classloader chains to compiler classloader for shared types
- Enables local validator evaluation without Yano devnet

Both bridges:
- Check ~/.intelliada/julc-libs/ for user-updated JARs (override)
- Fall back to bundled lib/julc/ JARs
- Graceful degradation if JARs missing or JBR incompatible

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Add prepareSandbox task to copy lib/julc/*.jar to plugin sandbox
- Add id attribute to YanoStatusBarWidgetFactory in plugin.xml

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Added classloader-based JAR resolution as fallback when PluginManagerCore
path doesn't find the JARs. Uses JulcCompilerBridge's own CodeSource
location to find lib/julc/ relative to the plugin's JAR.

Confirmed working: "julc-compiler bridge initialized successfully" in
IDE log on JBR 25, real SubsetValidator running via shadow JAR classloader.

Also shared resolveJarPath() between JulcCompilerBridge and JulcVmBridge.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Remove local JavaParser-based validators (replaced by runtime bridge):
- Delete JulcSubsetValidator.java (now runs from julc-compiler-all.jar)
- Delete JulcApiValidator.java (replaced by PSI-based JulcApiAnnotator)
- Remove javaparser-core dependency from build.gradle

Two validation layers:
1. julc-compiler bridge (ExternalAnnotator) — real SubsetValidator from
   shadow JAR via isolated URLClassLoader on JBR 25. Catches language
   subset violations (try/catch, null, arrays, float, etc.)
2. PSI annotators (Annotator) — API blocklist (java.io, HashMap, etc.)
   and @onchainlibrary cross-file check. Uses IntelliJ PSI for
   instant resolution without external dependencies.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Feature #1: Live Script Size — shows compiled size next to @validator
  with color coding (green < 8KB, yellow < 14KB, red approaching 16KB)

Feature #2: Inline Budget Estimation — part of trace panel

Feature #3: Run Validator — context menu action, compiles + evaluates
  locally via julc VM bridge, shows pass/fail + budget + traces

Feature #4: Script Size Warning Banner — EditorNotificationProvider
  shows banner when script exceeds 12KB warning threshold

Feature #5: UPLC Preview Panel — tool window showing generated UPLC,
  updates on file open, shows compilation errors inline

Feature #6: Budget Delta Tracking — JulcBudgetTracker records budget
  per file, shows delta between runs (CPU +50K, Memory -1.2K)

Feature #7: Visual Execution Trace — tool window with Run & Trace
  button, shows result, budget, user traces, UPLC output

Feature #8: Trace-to-Source Mapping — foundation in place via
  CompileResult.sourceMap(), to be enhanced with editor overlay

Feature #9: Budget Hotspot Visualization — hotspot table in trace
  panel, to be populated when builtin trace data is extracted

ADR-003 documents all 9 features with implementation details.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The JulcVmBridge was creating its own compiler classloader, causing
Program objects from compile() to be incompatible with the VM's
evaluate() method (different ClassLoader = different Class objects).

Fix: JulcVmBridge now reuses JulcCompilerBridge.julcClassLoader,
ensuring compile results can be passed directly to the VM evaluator.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Merge UPLC, Trace, REPL into single "julc" tool window with tabs
- Remove separate julc UPLC, julc Trace, julc REPL tool windows
- Add debug logging to VmBridge compile/evaluate for VM diagnosis
- Trace tab is default, UPLC and REPL as additional tabs

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…evaluate

Added initialize() guards to compile() and evaluate() methods to
prevent race conditions where these are called before isCompilerAvailable()
or isVmAvailable() triggers initialization.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
IntelliJ's plugin classloader auto-scans all JARs in lib/, causing
ZipException when it tries to load classes from the Java 24+ shadow
JARs (compiled for a newer bytecode version). This corrupted the
entire plugin classloader, breaking YanoDevnetPanel and other classes.

Fix: shadow JARs now live in julc-runtime/ (outside lib/), which
IntelliJ does not auto-scan. The runtime URLClassLoader in
JulcCompilerBridge and JulcVmBridge loads them explicitly.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
JulcVm.create() uses ServiceLoader.load(JulcVmProvider.class) which
relies on the thread context classloader. In IntelliJ's plugin environment,
the context classloader is the IDE's classloader, not our isolated
URLClassLoader. The ServiceLoader couldn't find JavaVmProvider.

Fix: temporarily set thread context classloader to vmClassLoader before
calling JulcVm.create(), then restore the original.

Also upgraded evaluate() error logging from debug to warn for visibility.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Remove all file-based debug logging from VmBridge and TracePanel
- Remove System.err debug from button handler
- Fix REPL: remove --no-jline flag (not supported in julc 0.1.0-pre10)
- Note: Budget 0 for AlwaysSucceeds is correct (trivial validator, no computation)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Issues found in review:
1. Leftover /tmp debug file writes in runCurrentFile() — removed
2. ExBudget field names are cpuSteps/memoryUnits, not cpu/mem —
   was causing NoSuchMethodException silently caught, budget always 0
3. traceArea.setText() was called from background thread in error path
   — moved to SwingUtilities.invokeLater()
4. Added user-visible status messages for early returns (no file,
   not Java, not julc project)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Save all documents before Run & Trace to pick up unsaved edits
- Log source length in compile to debug stale source issues

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
FileDocumentManager.saveAllDocuments() triggers file watchers which
cause DynamicPluginVfsListener to reload the plugin, resetting static
VM bridge state. Document.getText() already returns in-memory content
including unsaved edits — no save needed.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Document.getText() in a background thread may return stale content.
Now read the source on EDT (where the button click runs) and pass
it as a final variable to the background task. This ensures edits
are always picked up for recompilation.

Co-Authored-By: Claude Opus 4.6 (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.

1 participant