Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion applications/viewer/.dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,3 @@ deno.lock
.env
.env.*
*.log
static/julc
1 change: 0 additions & 1 deletion applications/viewer/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ node_modules
vite.config.js.timestamp-*
vite.config.ts.timestamp-*
.idea
/static/julc
/test-results
/playwright-report
/.cache
26 changes: 16 additions & 10 deletions applications/viewer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ Set these in the environment, or in a `.env` file in the directory you start Yac
| `PUBLIC_INDEXER_CLIENT_BASE_URL` | same as above | Yaci Store as the browser sees it, when that differs (e.g. Docker) |
| `PUBLIC_INDEXER_WS_URL` | `ws://localhost:8080/ws/liveblocks` | Live updates. Leave empty for a store without the live module; the viewer polls instead |
| `PUBLIC_MAINTENANCE_MSG` | | Optional banner shown on every page |
| `PUBLIC_JULC_BASE_URL` | `/julc/` | Where the browser loads the julc engine from, if not served by Yaci Viewer itself |
| `PORT`, `HOST` | `3000`, `0.0.0.0` | Where Yaci Viewer listens |
| `HEAVY_ADDRESS_GUARD` | `true` | Protects a large Yaci Store from busy addresses (below). `false` restores the plain behaviour |
| `YACI_ANALYTICS` | `auto` | `off` stops Yaci Viewer from using the store's analytics query API (below) even when the store has it |
Expand Down Expand Up @@ -153,15 +152,22 @@ npm run build # production build in build/, run with `node build`

### Script Lab and the julc engine

Script Lab uses the julc WebAssembly engine. It is not built here: `npm run dev` and `npm run build` run
`scripts/fetch-julc.mjs`, which downloads the julc release pinned in `julc.lock.json`, checks its SHA-256 and unpacks it
into `static/julc/` (git-ignored). The engine is only downloaded by the browser when a user decodes a script (about
5.5 MB with compression, then cached).

- A production build fails if the engine can't be installed. Set `JULC_SKIP=1` to build without Script Lab (its
panels then say so), or `JULC_ARCHIVE=/path/to/julc-wasm-<version>.tar.gz` to install from a local copy.
- To upgrade julc, change `tag`, `version`, `file` and `sha256` in `julc.lock.json` together; the checksum is in the
release's `julc-wasm-<version>-SHA256SUMS.txt`.
Script Lab uses the julc WebAssembly engine from the npm package
[`@julclang/julc-wasm`](https://www.npmjs.com/package/@julclang/julc-wasm) (with its client, `@julclang/wasm-client`).
julc is never built here: the package is an ordinary dependency, pinned to an exact julc release in `package.json`, and
Vite bundles its worker, launcher and WebAssembly module into the build as assets, served by Yaci Viewer itself (the
engine only loads them from the page's own origin). The engine is only downloaded by the browser when a feature needs it
(a 35 MB WebAssembly module, about 9 MB with Brotli, which the production server sends precompressed; then cached).

- To upgrade julc, change the version of `@julclang/julc-wasm` in `package.json` (exact; it brings the client at the
same version) and run `npm install`.
- The Vite dev server must not pre-bundle the julc packages (`optimizeDeps.exclude` in `vite.config.js`): their files
are named relative to their own modules. Production builds need nothing.
- A Content Security Policy in front of Yaci Viewer must allow `script-src 'self' 'wasm-unsafe-eval'`, on the page and
on the engine's worker scripts.
- The validator lab compiles plain Java: a validator imports the ledger and stdlib classes it uses (for example
`import org.julclang.stdlib.annotation.SpendingValidator;`). Since julc 0.1.0-pre21 they are no longer imported
implicitly, so a source saved in the browser by an earlier version may need its imports added.
- The engine needs WebAssembly GC and exception handling (exnref): current Chrome, Edge, Firefox and Safari. Other
browsers get a message instead. Playwright's bundled Chromium is too old, so run the Script Lab test with Chrome:
`SCRIPT_LAB_HASH=<plutus script hash> SCRIPT_LAB_TX=<tx with redeemers> SCRIPT_LAB_RUN=<purpose/index> SCRIPT_LAB_PROPOSAL=<tx>_<index> PW_CHANNEL=chrome npx playwright test script-lab`.
Expand Down
8 changes: 0 additions & 8 deletions applications/viewer/julc.lock.json

This file was deleted.

24 changes: 24 additions & 0 deletions applications/viewer/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions applications/viewer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@
"homepage": "https://devkit.yaci.xyz/",
"repository": "github:bloxbean/yaci-devkit",
"scripts": {
"predev": "node scripts/fetch-julc.mjs --optional",
"dev": "vite dev --host 0.0.0.0",
"prebuild": "node scripts/fetch-julc.mjs",
"build": "vite build",
"preview": "vite preview --host 0.0.0.0",
"test": "playwright test",
Expand All @@ -34,6 +32,7 @@
"@fontsource-variable/inter": "5.3.0",
"@fontsource-variable/jetbrains-mono": "5.3.0",
"@fontsource-variable/space-grotesk": "5.3.0",
"@julclang/julc-wasm": "0.1.0-pre21",
"@lucide/svelte": "1.47.0",
"@playwright/test": "^1.46.0",
"@sveltejs/adapter-node": "5.5.7",
Expand Down
84 changes: 0 additions & 84 deletions applications/viewer/scripts/fetch-julc.mjs

This file was deleted.

32 changes: 0 additions & 32 deletions applications/viewer/scripts/lib/untar.mjs

This file was deleted.

48 changes: 0 additions & 48 deletions applications/viewer/scripts/lib/untar.test.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@
{:else}
<div class="mb-3 flex items-start gap-2 rounded-xl border border-warn/30 bg-warn/5 px-3 py-2 text-xs text-muted">
<FlaskConical class="mt-0.5 h-3.5 w-3.5 shrink-0 text-warn" />
<span><b class="font-medium text-ink">Experimental (julc 0.1.0-pre18).</b> {warning ?? 'This debug build is compiled without the optimizer, so its budget differs from your script’s.'} Only some steps map to Java lines (reliably the one a validator fails on), and many locals aren’t tracked yet.</span>
<span><b class="font-medium text-ink">Experimental (julc {julc.manifest?.julcVersion ?? ''}).</b> {warning ?? 'This debug build is compiled without the optimizer, so its budget differs from your script’s.'} Only some steps map to Java lines (reliably the one a validator fails on), and many locals aren’t tracked yet.</span>
</div>
{#if unmapped}<p class="mb-3 text-sm text-muted">julc mapped none of this run’s steps to a Java line, so there is nothing to stop on. The UPLC debugger steps through every term.</p>{/if}
<div class="grid items-start gap-4 lg:grid-cols-[minmax(0,1.5fr)_minmax(0,1fr)]">
Expand Down
25 changes: 23 additions & 2 deletions applications/viewer/src/lib/julc/authoring/examples.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/* Starter validators for the validator lab, in julc Java. Each compiles with julc 0.1.0-pre18. */
/* Starter validators for the validator lab, in julc Java. Each compiles with julc 0.1.0-pre21, which reads plain Java: every
* class is imported, as javac needs (the ledger and stdlib are no longer imported implicitly). */

export interface Example {
id: string;
Expand All @@ -14,6 +15,13 @@ export const EXAMPLES: Example[] = [
summary: 'Spend: the beneficiary can claim after a time; the owner can cancel at any time.',
source: `import java.math.BigInteger;

import org.julclang.ledger.ScriptContext;
import org.julclang.ledger.TxInfo;
import org.julclang.stdlib.annotation.Entrypoint;
import org.julclang.stdlib.annotation.SpendingValidator;
import org.julclang.stdlib.lib.ContextsLib;
import org.julclang.stdlib.lib.IntervalLib;

@SpendingValidator
class Vesting {
record VestingDatum(byte[] owner, byte[] beneficiary, BigInteger unlockAt) {}
Expand Down Expand Up @@ -42,7 +50,14 @@ class Vesting {
id: 'owner',
name: 'Owner only',
summary: 'Spend: a script parameter fixes the one key that may spend.',
source: `@SpendingValidator
source: `import org.julclang.core.PlutusData;
import org.julclang.ledger.ScriptContext;
import org.julclang.stdlib.annotation.Entrypoint;
import org.julclang.stdlib.annotation.Param;
import org.julclang.stdlib.annotation.SpendingValidator;
import org.julclang.stdlib.lib.ContextsLib;

@SpendingValidator
class OwnerOnly {
@Param static byte[] owner;

Expand All @@ -61,6 +76,12 @@ class OwnerOnly {
summary: 'Mint: minting needs the issuer’s signature; anyone may burn.',
source: `import java.math.BigInteger;

import org.julclang.ledger.ScriptContext;
import org.julclang.stdlib.annotation.Entrypoint;
import org.julclang.stdlib.annotation.MintingValidator;
import org.julclang.stdlib.annotation.Param;
import org.julclang.stdlib.lib.ContextsLib;

@MintingValidator
class SignedMint {
@Param static byte[] issuer;
Expand Down
Loading
Loading