Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correct the paths for the computation of the RPC API hash and WIT API hash #2142

Merged
merged 4 commits into from
Jun 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions linera-version/src/version_info/type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,17 @@ fn get_hash(

let package_glob = format!("{}/{}", package_root.display(), glob);

let mut n_file = 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

file_count

for path in glob::glob(&package_glob)? {
let path = path?;
let mut file = std::fs::File::open(&path)?;
relevant_paths.push(path);
n_file += 1;
while file.read(&mut buffer)? != 0 {
hasher.update(buffer);
}
}
assert!(n_file > 0);

Ok(STANDARD_NO_PAD.encode(hasher.finalize()))
}
Expand Down Expand Up @@ -191,8 +194,13 @@ impl VersionInfo {
}
.into();

let rpc_hash =
get_hash(paths, &metadata, "linera-rpc", "tests/staged/formats.yaml")?.into();
let rpc_hash = get_hash(
paths,
&metadata,
"linera-rpc",
"tests/snapshots/format__format.yaml.snap",
)?
.into();

let graphql_hash = get_hash(
paths,
Expand All @@ -202,7 +210,8 @@ impl VersionInfo {
)?
.into();

let wit_hash = get_hash(paths, &metadata, "linera-sdk", "*.wit")?.into();
let wit_hash = get_hash(paths, &metadata, "linera-sdk", "wit/*.wit")?.into();
assert_ne!(rpc_hash, wit_hash);

Ok(Self {
crate_version,
Expand Down
Loading