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

Function shard_predicted

crates/kernel/src/shard.rs:2163–2180  ·  view source on GitHub ↗

Full predicted STEPS of a shard under a partition: floor + member step-cost + cross-ingress (foreign producers' bytes). Mirrors the packer's cap test.

(p: &BlockProfile, shard_of: &[u32], s: u32)

Source from the content-addressed store, hash-verified

2161 return Err(format!(
2162 "refine: shard {} needs at least two parts, got {}",
2163 r.id,
2164 r.parts.len()
2165 ));
2166 }
2167 if r.part_peaks.len() != r.parts.len() {
2168 return Err(format!(
2169 "refine: shard {}: {} peaks for {} parts",
2170 r.id,
2171 r.part_peaks.len(),
2172 r.parts.len()
2173 ));
2174 }
2175 if let Some(k) = r.parts.iter().position(Vec::is_empty) {
2176 return Err(format!("refine: shard {} part {k} is empty", r.id));
2177 }
2178 if by_id.insert(r.id, i).is_some() {
2179 return Err(format!("refine: shard {} listed twice", r.id));
2180 }
2181 }
2182
2183 // The new shard list in id order: slots 0..n keep their ids (part 0 of a

Calls 7

block_step_costFunction · 0.85
num_blocksMethod · 0.80
blockMethod · 0.80
producersMethod · 0.80
iterMethod · 0.45
containsMethod · 0.45
insertMethod · 0.45