Resolve `--constant ` to the guest inputs for that one constant: its closure sub-env and a check-list. The name resolves through the full env's `named` metadata to a constant address, which maps to the `build_anon_work` item whose ingress block owns it (standalone → itself; a mutual-block member → the whole block, checked atomically). The check-list is the ENTIRE closure (full-closure typech
( full_env_bytes: &[u8], name: &str, skip_deps: bool, )
| 121 | } |
| 122 | } |
| 123 | |
| 124 | /// Resolve one `--consts` name to the guest inputs for that constant: its |
| 125 | /// closure sub-env and a check-list. The name resolves through the full env's |
| 126 | /// `named` metadata to a constant address, which maps to the `build_anon_work` |
| 127 | /// item whose ingress block owns it (standalone → itself; a mutual-block member |
| 128 | /// → the whole block, checked atomically). The check-list is the ENTIRE closure |
| 129 | /// (full-closure typecheck) by default, or just the subject when `skip_deps` is |
| 130 | /// set. Returns `(sub_env_bytes, check_list, checked_count)`. Anon-only — the |
| 131 | /// work-item model doesn't apply to Meta's `env.named` walk. |
| 132 | fn constant_inputs( |
| 133 | full_env_bytes: &[u8], |
| 134 | name: &str, |
| 135 | skip_deps: bool, |
| 136 | ) -> Result<(Vec<u8>, Vec<u8>, usize)> { |
| 137 | use ix_common::address::Address; |
| 138 | |
| 139 | // `get_anon` discards `named`, so load the full env once just for the lookup. |
| 140 | let full = |
| 141 | IxonEnv::get(&mut &full_env_bytes[..]).expect("invalid Ixon environment"); |
| 142 | let target: Address = full |
| 143 | .named |
| 144 | .iter() |
| 145 | .find(|e| e.key().to_string() == name) |
| 146 | .map(|e| e.value().addr.clone()) |
| 147 | .ok_or_else(|| anyhow::anyhow!("no constant named {name:?} in env"))?; |
| 148 | |
| 149 | let env = IxonEnv::get_anon(&mut &full_env_bytes[..]) |
| 150 | .expect("invalid Ixon environment"); |
| 151 | let work = build_anon_work(&env).expect("build_anon_work"); |
| 152 | let block = block_of_addr(&env, &target); |
| 153 | let item = work |
| 154 | .iter() |
| 155 | .find(|w| work_block_addr(&env, w) == block) |
| 156 | .ok_or_else(|| { |
| 157 | anyhow::anyhow!( |
| 158 | "{name:?} resolved to block {}… but no work item covers it", |
| 159 | &block.hex()[..16] |
| 160 | ) |
| 161 | })?; |
| 162 | |
| 163 | let roots: Vec<Address> = item.proven_targets(); |
| 164 | let sub_env = build_sub_env(&env, &roots).map_err(|e| anyhow::anyhow!(e))?; |
| 165 | |
| 166 | // Check-list: full-closure by default (every work item in the sub-env), or |
| 167 | // subject-only under `--skip-deps` (just the named constant's primary). |
| 168 | let (check_list, checked) = if skip_deps { |
| 169 | (Address::pack(&[item.primary().clone()]), 1usize) |
| 170 | } else { |
| 171 | let env_sub = |
| 172 | IxonEnv::get_anon(&mut &sub_env[..]).expect("invalid sub-env"); |
| 173 | let work_sub = build_anon_work(&env_sub).expect("build_anon_work sub"); |
| 174 | let primaries: Vec<Address> = |
| 175 | work_sub.iter().map(|w| w.primary().clone()).collect(); |
| 176 | let n = work_sub.len(); |
| 177 | (Address::pack(&primaries), n) |
| 178 | }; |
| 179 | println!( |
| 180 | "constant {name}{}: block {}… ({} work item(s) checked, {} target const(s)); closure sub-env {} vs whole env {} ({:.0}%)", |
no test coverage detected