Supply Chain Integrity, Transparency, and Trust (IETF SCITT)
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Fix SCITT review items: Hashtbl.add, Ptime_clock.now

- ATP backend: Hashtbl.replace -> Hashtbl.add for append-only
semantics (the duplicate check via Hashtbl.mem already guards this)
- Core: Unix.gettimeofday() -> Ptime_clock.now() to match ATP backend
convention and remove the assert false on Ptime.of_float_s failure

+5 -8
+4 -1
lib/atp/scitt_atp.ml
··· 151 151 match value_to_cid ~key value with 152 152 | Error e -> err_encoding e 153 153 | Ok cid -> 154 - Hashtbl.replace t.values key value; 154 + (* add, not replace: the Hashtbl.mem check above guarantees the key 155 + is absent, so add creates the first binding. This is clearer for 156 + an append-only log than replace which implies overwrite. *) 157 + Hashtbl.add t.values key value; 155 158 t.mst <- Atp.Mst.add repo_key cid t.mst ~store:C.store; 156 159 Ok (compute_proof t ~key repo_key) 157 160
+1 -7
lib/scitt.ml
··· 746 746 type t = { service_id : string; key : X509.Private_key.t; vds : vds } 747 747 748 748 let create ~service_id ~vds ~key = { service_id; key; vds } 749 - 750 - (* Ptime.of_float_s only fails for NaN, infinity, or dates outside 751 - 0000-9999 — none of which gettimeofday produces. *) 752 - let now () = 753 - match Ptime.of_float_s (Unix.gettimeofday ()) with 754 - | Some t -> t 755 - | None -> assert false 749 + let now () = Ptime_clock.now () 756 750 757 751 let register t signed = 758 752 let subject = Signed_statement.subject signed in