open-standards/sandbox/sandbox-rs/crates/sandbox-tee/tests
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Transaction Science c2b7f8af04 sandbox-tee: attested_efficiency attests what this host's meter read
The example attested a literal 117,000 µJ, described as "the on-device
meter read 117 mJ … a real sensor reading", under CounterClass::Rapl and
sealed it into efficiency/1 as Energy::modeled. No meter ran and no task
ran; on a host with no RAPL counter it printed a RAPL "real sensor
reading" at IntegrityAttested.

It now runs a bounded SHA-512 chain on this thread, meters it with
PowerMeter::detect_in_process, and attests the figure under the class of
the counter that read the CPU work, sealing it HwShunt; where no counter
read it (none live, or one that did not advance), the figure is the
meter's estimate, attested as CounterClass::Estimator and sealed
Estimator. The closing text follows the attested class. No value figure
is invented (value_uusd: None).

The kernel's per-process count (macOS ri_energy_nj) is the counter
detect_in_process reads on macOS, and no class named it, so
CounterClass::ProcessEnergy is added (tag process_energy, binding
discriminant 7; existing discriminants unchanged; not independently
rooted). jcp-efficiency MAPPING.md now describes the example as it is.

Tests: tests/attested_efficiency_example.rs compiles the example in and
asserts the attested class is one of the meter's live probes over a span
with a CPU reading and sealed HwShunt, else Estimator/Estimator, and that
a span with no CPU reading (the machine meter here) is attested as a
non-zero estimate. energy.rs: every class binds a distinct statement.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-10 17:51:59 -04:00
..
attested_efficiency_example.rs sandbox-tee: attested_efficiency attests what this host's meter read 2026-10-10 17:51:59 -04:00