about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2024-03-18T13·28+0200
committerflokli <flokli@flokli.de>2024-03-18T16·10+0000
commita65c49fbc3e73276dc4eb42a2931a49f15ac7eea (patch)
tree2302c87024151e57e1e3d910a5f0e5ec86746876
parentd62c6e642deaae04edccd9256a7d193ce1b3656e (diff)
refactor(tvix/store/pathinfo/nix_http): NixHash to display NARHash r/7732
This will give us the sha256: prefix, and hashes we're more used to, in
that context.

Change-Id: I72e42fe685e365ba9baa7cd81001387d239fa7c8
Reviewed-on: https://cl.tvl.fyi/c/depot/+/11194
Reviewed-by: Connor Brewster <cbrewster@hey.com>
Autosubmit: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
-rw-r--r--tvix/store/src/pathinfoservice/nix_http.rs8
1 files changed, 5 insertions, 3 deletions
diff --git a/tvix/store/src/pathinfoservice/nix_http.rs b/tvix/store/src/pathinfoservice/nix_http.rs
index 7b4130fcae..bdb0e2c3cb 100644
--- a/tvix/store/src/pathinfoservice/nix_http.rs
+++ b/tvix/store/src/pathinfoservice/nix_http.rs
@@ -5,6 +5,7 @@ use futures::{stream::BoxStream, TryStreamExt};
 use nix_compat::{
     narinfo::{self, NarInfo},
     nixbase32,
+    nixhash::NixHash,
 };
 use reqwest::StatusCode;
 use sha2::{digest::FixedOutput, Digest, Sha256};
@@ -223,10 +224,11 @@ where
                         io::ErrorKind::InvalidData,
                         "NarSize mismatch".to_string(),
                     ))?;
-                } else if narinfo.nar_hash != nar_hash {
+                }
+                if narinfo.nar_hash != nar_hash {
                     warn!(
-                        narinfo.nar_hash = BASE64.encode(&narinfo.nar_hash),
-                        http.nar_hash = BASE64.encode(&nar_hash),
+                        narinfo.nar_hash = %NixHash::Sha256(narinfo.nar_hash),
+                        http.nar_hash = %NixHash::Sha256(nar_hash),
                         "NarHash mismatch"
                     );
                     Err(io::Error::new(