From a65c49fbc3e73276dc4eb42a2931a49f15ac7eea Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Mon, 18 Mar 2024 15:28:10 +0200 Subject: refactor(tvix/store/pathinfo/nix_http): NixHash to display NARHash 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 Autosubmit: flokli Tested-by: BuildkiteCI --- tvix/store/src/pathinfoservice/nix_http.rs | 8 +++++--- 1 file 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( -- cgit 1.4.1