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 <flokli@flokli.de>
Reviewed-by: edef <edef@edef.eu>
Tested-by: BuildkiteCI
This commit is contained in:
Florian Klink 2023-10-05 10:59:27 +03:00 committed by flokli
parent 7706a8f224
commit 1f03a520a9
2 changed files with 60 additions and 6 deletions

View file

@ -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
};