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

Function find_missing_deps

zisk/host/src/main.rs:580–623  ·  view source on GitHub ↗

Core of the closure check, factored out for testing: given parsed inputs and the store, return `(missing, checked, axioms)` where `missing` is the list of `(label, dangling-ref)` typing dependencies that are neither certified in-batch nor in the store nor a literal blob. `checked` is the number of constants inspected; `axioms` how many are `Axio` declarations.

(
  parsed: &[(String, IxonEnv, Vec<AnonWorkItem>)],
  store: &std::collections::HashSet<[u8; 32]>,
)

Source from the content-addressed store, hash-verified

578 proof.get(16..48).map(|s| s.to_vec()).unwrap_or_default()
579}
580
581/// The distinct program vks across a set of proofs (the allowed set to pin the
582/// agg guest against — typically {SHARD_VK} or {SHARD_VK, AGG_VK}).
583fn distinct_vks(proofs: &[Vec<u8>]) -> Vec<Vec<u8>> {
584 let mut out: Vec<Vec<u8>> = Vec::new();
585 for p in proofs {
586 let vk = program_vk(p);
587 if !out.contains(&vk) {
588 out.push(vk);
589 }
590 }
591 out
592}
593
594/// Core of the closure check, factored out for testing: given parsed inputs
595/// and the store, return `(missing, checked, axioms)` where `missing` is the
596/// list of `(label, dangling-ref)` typing dependencies that are neither
597/// certified in-batch nor in the store nor a literal blob. `checked` is the
598/// number of constants inspected; `axioms` how many are `Axio` declarations.
599fn find_missing_deps(
600 parsed: &[(String, IxonEnv, Vec<AnonWorkItem>)],
601 store: &std::collections::HashSet<[u8; 32]>,
602) -> (Vec<(String, ix_common::address::Address)>, usize, usize) {
603 use std::collections::HashSet;
604
605 use ix_common::address::Address;
606 use ixon::constant::ConstantInfo;
607
608 // certified = every target the batch will prove ∪ the store.
609 let mut certified: HashSet<[u8; 32]> = store.clone();
610 for (_, _, work) in parsed {
611 for w in work {
612 for t in w.proven_targets() {
613 certified.insert(*t.as_bytes());
614 }
615 }
616 }
617
618 // Every non-blob ref of every certified constant must be in `certified`.
619 let mut missing: Vec<(String, Address)> = Vec::new();
620 let mut axioms = 0usize;
621 let mut checked = 0usize;
622 for (label, env, work) in parsed {
623 for w in work {
624 for t in w.proven_targets() {
625 let Some(c) = env.get_const(&t) else { continue };
626 if matches!(&c.info, ConstantInfo::Axio(_)) {

Callers 2

check_inputs_closedFunction · 0.85

Calls 8

proven_targetsMethod · 0.80
as_bytesMethod · 0.80
pushMethod · 0.80
cloneMethod · 0.45
insertMethod · 0.45
get_constMethod · 0.45
get_blobMethod · 0.45
containsMethod · 0.45

Tested by 1