-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathslbit_observatory.rs
More file actions
65 lines (59 loc) · 2.11 KB
/
Copy pathslbit_observatory.rs
File metadata and controls
65 lines (59 loc) · 2.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
use power_house::{prove_with_rootprint, provenance::PhaArtifact, ObservatorySidecar};
use serde_json::json;
use slbit::{BitInteractiveTranscript, LuminousClaim, SimpleLuminousSumcheck, VizHints};
use std::collections::BTreeMap;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let artifact = PhaArtifact::new(
json!({
"producer": "vision-pipeline",
"frame": 7842
}),
"vision/v1",
json!({
"claim": "stop-sign-detected",
"confidence_millionths": 987_000
}),
json!({
"accepted": true
}),
)?;
let graph = prove_with_rootprint!(
label: "drone-perception-7842",
artifact: artifact,
)?;
graph.verify()?;
let rootprint_fingerprint = graph.replay()?.state_fingerprint;
let claim = LuminousClaim::new("drone-camera-frame-7842", 4096).with_viz_hints(VizHints {
color: Some([0, 200, 255]),
icon: Some("camera".into()),
layer_name: Some("perception-conv3".into()),
});
let mut transcript = BitInteractiveTranscript::new(b"drone-seed-7842");
transcript.record_round_with_note(
0,
&[0xde, 0xad, 0xbe, 0xef],
"sensor-processing",
"Raw sensor frame converted into features",
);
transcript.record_round_with_note(
1,
&[0x42],
"attention-head-7",
"Stop-sign feature strongly activated",
);
let luminous = SimpleLuminousSumcheck { claim, transcript };
let metadata = luminous.to_luminous_metadata();
let packet = luminous.to_viz_packet()?;
packet.verify()?;
let packet_json = serde_json::from_str(&packet.to_json())?;
let sidecar = ObservatorySidecar::new(
&graph,
BTreeMap::from([(graph.root_branch.clone(), packet_json)]),
)?;
sidecar.verify(&graph)?;
assert_eq!(graph.replay()?.state_fingerprint, rootprint_fingerprint);
println!("Rootprint replay fingerprint: {rootprint_fingerprint}");
println!("Semantic transcript: {}", metadata.transcript_digest);
println!("Observatory sidecar: {}", sidecar.sidecar_sha256);
Ok(())
}