about summary refs log tree commit diff
path: root/tvix/nar-bridge/pkg/http/narinfo_get.go
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2023-10-11T17·12+0200
committerflokli <flokli@flokli.de>2023-10-12T06·24+0000
commit1c5bf366be915fd91c3d87f9b779f394505214a8 (patch)
treebfce816a479f1a07774e9edd0ad01a9cc93dbddd /tvix/nar-bridge/pkg/http/narinfo_get.go
parente64e97ee23bdcc0529036bd4cb66eabfd97cb45d (diff)
refactor(tvix/nar-bridge): panic on inval PathInfo.NarInfo.NarSha256 r/6787
Bump code.tvl.fyi/tvix/store/protos past cl/9649, where Validate()
already ensures the NarSha256 has the correct size.

Change-Id: I774668822f4d9dbd4dea47dde6e4745dc95e8e7f
Reviewed-on: https://cl.tvl.fyi/c/depot/+/9665
Reviewed-by: edef <edef@edef.eu>
Tested-by: BuildkiteCI
Diffstat (limited to '')
-rw-r--r--tvix/nar-bridge/pkg/http/narinfo_get.go7
1 files changed, 2 insertions, 5 deletions
diff --git a/tvix/nar-bridge/pkg/http/narinfo_get.go b/tvix/nar-bridge/pkg/http/narinfo_get.go
index acb80c7390..b3ee01fab5 100644
--- a/tvix/nar-bridge/pkg/http/narinfo_get.go
+++ b/tvix/nar-bridge/pkg/http/narinfo_get.go
@@ -65,13 +65,10 @@ func renderNarinfo(
 		return fmt.Errorf("PathInfo doesn't contain Narinfo field")
 	}
 
-	// extract the NARHash
+	// extract the NARHash. This must succeed, as Validate() did succeed.
 	narHash, err := nixhash.FromHashTypeAndDigest(0x12, pathInfo.GetNarinfo().GetNarSha256())
 	if err != nil {
-		// TODO: replace with panic once we use cl/9649
-
-		log.WithError(err).Error("invalid NarHash in PathInfo")
-		return fmt.Errorf("invalid NarHash in PathInfo")
+		panic("must parse NarHash")
 	}
 
 	// add things to the lookup table, in case the same process didn't handle the NAR hash yet.