use crate::contract::budget::{BudgetAvailability, BudgetProfile};
use crate::contract::capability::{Enforcement, EvidenceClaim, EvidenceSet};
#[must_use]
pub(super) fn observed_budget_profile() -> BudgetProfile {
let mediated = |mechanism: &str| BudgetAvailability {
available: u64::MAX,
enforcement: Enforcement::Mediated,
evidence: EvidenceSet::new(),
mechanism: mechanism.to_string(),
};
let hard = |mechanism: &str, evidence: EvidenceSet| BudgetAvailability {
available: u64::MAX,
enforcement: Enforcement::Enforced,
evidence,
mechanism: mechanism.to_string(),
};
BudgetProfile {
wall_micros: mediated("wasmi_fuel:mediated-wall"),
cpu_micros: mediated("wasmi_fuel:mediated-cpu"),
resident_bytes: hard("wasmi_store_limits:memory_size", EvidenceSet::new()),
process_count: hard("wasm_single_instance:no-child-process", EvidenceSet::new()),
handle_count: mediated("wasi_handles:preopen-stdio"),
storage_bytes: mediated("wasi_preopen:host-storage"),
network_bytes: hard(
"wasi_no_socket_cap:deny-all",
[EvidenceClaim::DeniedAttempts].into_iter().collect(),
),
}
}