From 1f03a520a9d0d7d49de59f8a7b8dc314281642fa Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Thu, 5 Oct 2023 10:59:27 +0300 Subject: feat(tvix/store): add validation for references This validates the size of reference digests in the PathInfo message, as well as inside the narinfo submessage. If narinfo is set, they need to parse to StorePath, and have the same digest there as in the PathInfo message. `proto::tests::pathinfo::validate_references` needed to be updated, because we actually did not populate the proper references before. Change-Id: I9545b2487aab9fe0d229c26aceba5ddc5e6daafd Reviewed-on: https://cl.tvl.fyi/c/depot/+/9545 Autosubmit: flokli Reviewed-by: edef Tested-by: BuildkiteCI --- tvix/store/src/proto/tests/pathinfo.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tvix/store/src/proto/tests/pathinfo.rs') diff --git a/tvix/store/src/proto/tests/pathinfo.rs b/tvix/store/src/proto/tests/pathinfo.rs index a74b7c3f7ce5..3a9ce2e7e3e7 100644 --- a/tvix/store/src/proto/tests/pathinfo.rs +++ b/tvix/store/src/proto/tests/pathinfo.rs @@ -161,7 +161,7 @@ fn validate_references() { size: 0, })), }), - references: vec![DUMMY_DIGEST_2.clone().into()], + references: vec![DUMMY_OUTPUT_HASH.clone().into()], narinfo: None, }; assert!(path_info.validate().is_ok()); @@ -190,7 +190,7 @@ fn validate_references() { nar_size: 0, nar_sha256: DUMMY_DIGEST.clone().into(), signatures: vec![], - reference_names: vec![format!("/nix/store/{}", DUMMY_NAME)], + reference_names: vec![DUMMY_NAME.to_string()], }), ..path_info }; -- cgit 1.4.1