refactor(tvix/nar-bridge): panic on inval PathInfo.NarInfo.NarSha256
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
This commit is contained in:
parent
e64e97ee23
commit
1c5bf366be
4 changed files with 6 additions and 9 deletions
|
|
@ -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.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue