Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
1a2dbdd
Port @artwyman's BatchDef, ItemInBatch, AllItemsInBatch predicates
arnaucube Nov 26, 2025
e8af4c6
add st_{batch/item}_def, st_item_in_batch methods; pending update macro
arnaucube Nov 26, 2025
e73940c
Adjust predicates
ax0 Nov 27, 2025
2288bb7
WIP
ax0 Nov 27, 2025
de016a6
Fix commitlib tests
ax0 Dec 1, 2025
e608127
Change itemdef statement method signature
ax0 Dec 1, 2025
3269e08
Update craftlib
ax0 Dec 2, 2025
936c403
Use HashMap for keys
ax0 Dec 2, 2025
ecb3cc9
Update app
ax0 Dec 2, 2025
e953251
small fixes, identify the cause of the error at the Synchronizer veri…
arnaucube Dec 2, 2025
c777b15
Fix committing & verifying
ax0 Dec 3, 2025
ffc39b9
Merge branch 'main' into multi-outputs
ax0 Dec 3, 2025
94d2a49
Form item POD in steps
ax0 Dec 3, 2025
345a8ad
Clean-up
ax0 Dec 3, 2025
85242b7
wip draft DisassembleStone into 2 outputs predicates
arnaucube Dec 3, 2025
2c1bf8c
fix DisassembleStone related predicates
arnaucube Dec 4, 2025
c5e0108
draft multi-outputs DisassembleStone rust statements methods
arnaucube Dec 4, 2025
7cde696
Complete statement methods
ax0 Dec 5, 2025
161b2ce
(wip) integrate multi-outputs crafting into the app_cli
arnaucube Dec 5, 2025
1d6d4de
add ui elems for multi-outputs DisassembleStone into Dust+Gem (not ye…
arnaucube Dec 5, 2025
1bb36f3
Fix CLI
ax0 Dec 8, 2025
9631c5c
Fix mock mode toggle
ax0 Dec 8, 2025
f853b36
Clippy
ax0 Dec 9, 2025
6a1dbbc
Code review
ax0 Dec 9, 2025
4c60ce2
Fix GUI flow
ax0 Dec 9, 2025
8e222e1
Remove print statements
ax0 Dec 9, 2025
6a2ddf4
fix multi-output outputs file naming (& ui icons), parametrize & redu…
arnaucube Dec 9, 2025
3876041
Fix CLI
ax0 Dec 11, 2025
d8075cb
Drop unnecessary PODs when crafting
ax0 Dec 12, 2025
7e2d79a
rm shell.nix file
arnaucube Jan 7, 2026
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
14 changes: 8 additions & 6 deletions app_cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -513,19 +513,21 @@ pub fn craft_item(

// TODO instead of 'i', use 'index' (which is the blueprint (which takes
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this TODO sounds good, I suggest applying this already.

// values as 'dust', 'gem'))
for (i, pod) in pods.iter().enumerate() {
for (def, pod) in std::iter::zip(item_def, pods.iter()) {
let i = def.index.clone();
let crafted_item = CraftedItem {
pod: pod.clone(),
def: item_def[i].clone(),
def,
};
let sufix = if pods.len() > 1 {
format!("_{i}")
let suffix = if pods.len() > 1 {
format!("_{}", i.name())
} else {
"".to_string()
};
let mut file = std::fs::File::create(format! {"{}{sufix}", output.display()})?;
let filename = format! {"{}{suffix}", output.display()};
let mut file = std::fs::File::create(&filename)?;
serde_json::to_writer(&mut file, &crafted_item)?;
info!("Stored crafted item mined with recipe {recipe} to {output:?}{sufix}");
info!("Stored crafted item mined with recipe {recipe} to {filename}");
}

Ok(())
Expand Down
6 changes: 3 additions & 3 deletions commitlib/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,9 +205,9 @@ impl<'a> ItemBuilder<'a> {

// Build ItemInBatch(item, batch)
Ok(st_custom!(self.ctx,
ItemInBatch() = (
HashOf(item_hash, batch_hash, item_def.index.hash()),
DictContains(keys_dict, item_def.index.name(), item_def.item_key())
ItemInBatch() = (
HashOf(item_hash, batch_hash, item_def.index.hash()),
DictContains(keys_dict, item_def.index.name(), item_def.item_key())
))?)
}

Expand Down
3 changes: 2 additions & 1 deletion common/src/payload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,15 @@ impl Payload {
.expect("vec write");
self.proof.write_bytes(&mut buffer);
write_elems(&mut buffer, &self.created_items_root.0);
// TODO: What are the constraints on these lengths apart from the type casts below?

assert!(self.items.len() < 256);
buffer
.write_all(&(self.items.len() as u8).to_le_bytes())
.expect("vec write");
for item in &self.items {
write_elems(&mut buffer, &item.0);
}

assert!(self.nullifiers.len() < 256);
buffer
.write_all(&(self.nullifiers.len() as u8).to_le_bytes())
Expand Down
48 changes: 43 additions & 5 deletions craftlib/src/item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,7 @@ impl<'a> CraftBuilder<'a> {
let mut s1 = empty_set.clone();
s1.insert(&wood).unwrap();
let mut inputs = s1.clone();
println!("1");
println!("{wood}");
println!("{stone}");
inputs.insert(&stone).unwrap();
println!("2");
Ok(st_custom!(self.ctx,
AxeInputs() = (
SetInsert(s1, empty_set, wood),
Expand Down Expand Up @@ -218,7 +214,6 @@ impl<'a> CraftBuilder<'a> {
let batch_hash = batch_def.batch_hash(self.params)?;
let dust_hash = hash_values(&[batch_hash.into(), DUST_BLUEPRINT.into()]);
let gem_hash = hash_values(&[batch_hash.into(), GEM_BLUEPRINT.into()]);
dbg!(&batch_def.ingredients.keys);
let dust_key = batch_def.ingredients.keys[&DUST_BLUEPRINT.into()].clone();
let gem_key = batch_def.ingredients.keys[&GEM_BLUEPRINT.into()].clone();

Expand Down Expand Up @@ -255,6 +250,49 @@ impl<'a> CraftBuilder<'a> {
st_stone_disassemble_outputs
))?)
}
pub fn st_is_dust(
&mut self,
item_def: ItemDef,
st_stone_disassemble: Statement,
) -> anyhow::Result<Statement> {
let batch_hash = item_def.batch.batch_hash(self.params)?;
let dust_hash = hash_values(&[batch_hash.into(), DUST_BLUEPRINT.into()]);
let keys_dict = Dictionary::new(
self.params.max_depth_mt_containers,
item_def.batch.ingredients.keys.clone(),
)?;
let dust_key = item_def.batch.ingredients.keys[&DUST_BLUEPRINT.into()].clone();
Ok(st_custom!(self.ctx,
IsDust() = (
HashOf(dust_hash, batch_hash, DUST_BLUEPRINT),
DictContains(keys_dict, DUST_BLUEPRINT, dust_key),
Equal(item_def.batch.work, EMPTY_VALUE),
st_stone_disassemble
))?)
}

pub fn st_is_gem(
&mut self,
item_def: ItemDef,
st_stone_disassemble: Statement,
) -> anyhow::Result<Statement> {
let batch_hash = item_def.batch.batch_hash(self.params)?;
let gem_hash = hash_values(&[batch_hash.into(), GEM_BLUEPRINT.into()]);
let keys_dict = Dictionary::new(
self.params.max_depth_mt_containers,
item_def.batch.ingredients.keys.clone(),
)?;
let gem_key = item_def.batch.ingredients.keys[&GEM_BLUEPRINT.into()].clone();

Ok(st_custom!(self.ctx,
IsGem() = (
HashOf(gem_hash, batch_hash, GEM_BLUEPRINT),
DictContains(keys_dict, GEM_BLUEPRINT, gem_key),
Equal(item_def.batch.work, EMPTY_VALUE),
st_stone_disassemble
))?)
}

pub fn st_stone_disassemble(
&mut self,
st_stone_disassemble_inputs_outputs: Statement,
Expand Down
2 changes: 1 addition & 1 deletion shell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ let
wayland
wayland.dev
wayland-protocols
sway
emacs
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😆

mesa
mesa-gl-headers
egl-wayland
Expand Down
2 changes: 1 addition & 1 deletion synchronizer/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ impl Node {
info!("Valid do_blob at slot {}, blob_index {}!", slot, blob.index);
}
Err(e) => {
error!("Ignoring blob due: Invalid do_blob: {:?}", e);
info!("Ignoring blob due to invalid do_blob: {:?}", e);
continue;
}
};
Expand Down