Skip to content

Commit a11baad

Browse files
author
Zoran Cvetkov
committed
truncate the old style hash
1 parent b3543bb commit a11baad

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

graph/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ serde_derive = { workspace = true }
4848
serde_json = { workspace = true }
4949
serde_regex = { workspace = true }
5050
serde_yaml = { workspace = true }
51+
sha2 = "0.10.8"
5152
slog = { version = "2.7.0", features = [
5253
"release_max_level_trace",
5354
"max_level_trace",

graph/src/components/subgraph/proof_of_indexing/online.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,14 @@ impl BlockEventStream {
132132
}
133133
Hashers::Fast(mut digest) => {
134134
if let Some(prev) = prev {
135-
let prev = prev
136-
.try_into()
137-
.expect("Expected valid fast stable hash representation");
135+
let prev = if prev.len() == 32 {
136+
prev.try_into()
137+
.expect("Expected valid fast stable hash representation")
138+
} else {
139+
prev[..32]
140+
.try_into()
141+
.expect("Expected valid fast stable hash representation")
142+
};
138143
let prev = FastStableHasher::from_bytes(prev);
139144
digest.mixin(&prev);
140145
}

0 commit comments

Comments
 (0)