MCPcopy Create free account
hub / github.com/argumentcomputer/ix / load_proof_index

Function load_proof_index

zisk/host/src/main.rs:447–470  ·  view source on GitHub ↗

Load the proof store. Entries missing the `.asm` witness file (written by a pre-discharge host) are skipped with a note — without the assumption preimages they cannot be folded as mode-1 children.

(dir: &std::path::Path)

Source from the content-addressed store, hash-verified

445 dir: &std::path::Path,
446 proof: &[u8],
447 covered: &[ix_common::address::Address],
448 assumptions: &[ix_common::address::Address],
449) -> Result<()> {
450 use ix_common::address::Address;
451 let pdir = dir.join("proofs");
452 fs::create_dir_all(&pdir)?;
453 let idx = (0..)
454 .find(|n| !pdir.join(format!("{n}.proof")).exists())
455 .expect("free proof index");
456 fs::write(pdir.join(format!("{idx}.proof")), proof)?;
457 fs::write(pdir.join(format!("{idx}.cover")), Address::pack(covered))?;
458 fs::write(pdir.join(format!("{idx}.asm")), Address::pack(assumptions))?;
459 Ok(())
460}
461
462/// Load the proof store. Entries missing the `.asm` witness file (written by
463/// a pre-discharge host) are skipped with a note — without the assumption
464/// preimages they cannot be folded as mode-1 children.
465fn load_proof_index(dir: &std::path::Path) -> Vec<StoredProof> {
466 use ix_common::address::Address;
467 let pdir = dir.join("proofs");
468 let mut out = Vec::new();
469 for idx in 0.. {
470 let pf = pdir.join(format!("{idx}.proof"));
471 let Ok(blob) = fs::read(&pf) else { break };
472 let Ok(cov) = fs::read(pdir.join(format!("{idx}.cover"))) else { break };
473 let Ok(asm) = fs::read(pdir.join(format!("{idx}.asm"))) else {

Callers 2

run_shard_planFunction · 0.85
mainFunction · 0.85

Calls 2

joinMethod · 0.80
pushMethod · 0.80

Tested by

no test coverage detected