Skip to content
Draft
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
26 changes: 15 additions & 11 deletions driver/src/pexe_catalog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@
//! on demand, matching the per-call pattern used before.

use std::collections::HashMap;
use std::path::{Path, PathBuf};

Check warning on line 21 in driver/src/pexe_catalog.rs

View workflow job for this annotation

GitHub Actions / Rust formatting

Diff in /home/runner/work/zk-craft/zk-craft/driver/src/pexe_catalog.rs
use std::sync::Arc;

use anyhow::{Context, Result, anyhow};
use anyhow::{anyhow, Context, Result};
use common::decode_hash_hex;
use pod2::middleware::Hash;
use sdk::{Sdk, SpendableObject, SpendableObjects, manifest::Manifest};
use sdk::{manifest::Manifest, Sdk, SpendableObject, SpendableObjects};
use txlib::GroundingWitness;

use crate::catalog::{ActionCatalog, CatalogClass, extract_predicate};
use crate::catalog::{extract_predicate, ActionCatalog, CatalogClass};
use wire_types::{ActionSummary, ClassRef, QualifiedName};

struct Plugin {
Expand Down Expand Up @@ -527,33 +527,37 @@

const ALPHA_SCRIPT: &str = r#"
fn MakeFoo(action) {
var foo = action.output("Foo");
foo.set([["durability", 100]]);
var foo = action.output("Foo", [
["durability", 100]
]);
var key = action.random();
foo.update("key", key);
}

fn ConsumeFoo(action) {
var foo = action.input("Foo");
var bar = action.output("Bar");
bar.set([["durability", 100]]);
var bar = action.output("Bar", [
["durability", 100]
]);
var key = action.random();
bar.update("key", key);
}
"#;

const BETA_SCRIPT: &str = r#"
fn MakeFoo(action) {
var foo = action.output("Foo");
foo.set([["durability", 200]]);
var foo = action.output("Foo", [
["durability", 200]
]);
var key = action.random();
foo.update("key", key);
}

fn ConsumeFoo(action) {
var foo = action.input("Foo");
var bar = action.output("Bar");
bar.set([["durability", 200]]);
var bar = action.output("Bar", [
["durability", 200]
]);
var key = action.random();
bar.update("key", key);
}
Expand Down
18 changes: 8 additions & 10 deletions plugins/craft-basics/plugin.rhai
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
fn FindLog(action) {
var log = action.output("Log");
var log = action.output("Log", []);
var work = action.intro_vdf(3, log);
log.update("work", work);
}

fn CraftWood(action) {
var log = action.input("Log");
var wood = action.output("Wood");
var wood = action.output("Wood", []);
// Difficulty target: top limb ≤ 2^53. Both pow_obj_grind and
// intro_lt_eq_u256 consume the same u256, so the proved statement
// matches what grinding produced.
Expand All @@ -18,15 +18,14 @@ fn CraftWood(action) {

fn CraftSticks(action) {
var wood = action.input("Wood");
var stick_a = action.output("Stick");
var stick_b = action.output("Stick");
var stick_a = action.output("Stick", []);
var stick_b = action.output("Stick", []);
}

fn CraftWoodPick(action) {
var wood = action.input("Wood");
var stick = action.input("Stick");
var pick = action.output("WoodPick");
pick.set([
var pick = action.output("WoodPick", [
["durability", 100]
]);
}
Expand All @@ -49,14 +48,13 @@ fn UseWoodPick(action) {

fn MineStoneWithWoodPick(action) {
var pick = action.subaction("UseWoodPick");
var stone = action.output("Stone");
var stone = action.output("Stone", []);
}

fn CraftStonePick(action) {
var stone = action.input("Stone");
var stick = action.input("Stick");
var pick = action.output("StonePick");
pick.set([
var pick = action.output("StonePick", [
["durability", 200]
]);
}
Expand All @@ -68,5 +66,5 @@ fn UseStonePick(action) {

fn MineStoneWithStonePick(action) {
var pick = action.subaction("UseStonePick");
var stone = action.output("Stone");
var stone = action.output("Stone", []);
}
Loading
Loading