Skip to content

Commit

Permalink
consistent use of porep_id and endianess
Browse files Browse the repository at this point in the history
  • Loading branch information
dignifiedquire committed Jun 15, 2020
1 parent a989f87 commit 3d69ca2
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
3 changes: 1 addition & 2 deletions storage-proofs/porep/src/stacked/circuit/proof.rs
Original file line number Diff line number Diff line change
Expand Up @@ -443,11 +443,10 @@ mod tests {
assert_ne!(data, copied, "replication did not change data");

let seed = rng.gen();
let arbitrary_porep_id = [44; 32];
let pub_inputs =
PublicInputs::<<Tree::Hasher as Hasher>::Domain, <Sha256Hasher as Hasher>::Domain> {
replica_id: replica_id.into(),
porep_id: arbitrary_porep_id,
porep_id: [32; 32],
seed,
tau: Some(tau.into()),
k: None,
Expand Down
9 changes: 6 additions & 3 deletions storage-proofs/porep/src/stacked/vanilla/cache.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::path::PathBuf;

use anyhow::{bail, ensure, Context};
use byteorder::{BigEndian, ByteOrder};
use byteorder::{ByteOrder, LittleEndian};
use log::info;
use rayon::prelude::*;
use sha2::{Digest, Sha256};
Expand Down Expand Up @@ -83,7 +83,7 @@ impl CacheData {
let end = start + DEGREE * NODE_BYTES;

let mut res = [0u32; DEGREE];
BigEndian::read_u32_into(&self.data[start..end], &mut res);
LittleEndian::read_u32_into(&self.data[start..end], &mut res);
res
}

Expand Down Expand Up @@ -199,7 +199,7 @@ impl ParentCache {
.parents(node, &mut parents[..BASE_DEGREE])?;
graph.generate_expanded_parents(node, &mut parents[BASE_DEGREE..]);

BigEndian::write_u32_into(&parents, entry);
LittleEndian::write_u32_into(&parents, entry);
Ok(())
})?;

Expand Down Expand Up @@ -254,6 +254,9 @@ where

hasher.input(H::name());
hasher.input(graph.identifier());
for key in &graph.feistel_keys {
hasher.input(key.to_le_bytes());
}
hasher.input(cache_entries.to_le_bytes());
let h = hasher.result();
PathBuf::from(PARENT_CACHE_DIR).join(format!(
Expand Down
2 changes: 1 addition & 1 deletion storage-proofs/porep/src/stacked/vanilla/graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ where
{
expansion_degree: usize,
base_graph: G,
feistel_keys: [feistel::Index; 4],
pub(crate) feistel_keys: [feistel::Index; 4],
feistel_precomputed: FeistelPrecomputed,
id: String,
_h: PhantomData<H>,
Expand Down
3 changes: 1 addition & 2 deletions storage-proofs/porep/src/stacked/vanilla/proof.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1492,11 +1492,10 @@ mod tests {
assert_ne!(data, copied, "replication did not change data");

let seed = rng.gen();
let arbitrary_porep_id = [92; 32];
let pub_inputs =
PublicInputs::<<Tree::Hasher as Hasher>::Domain, <Blake2sHasher as Hasher>::Domain> {
replica_id,
porep_id: arbitrary_porep_id,
porep_id: [32; 32],
seed,
tau: Some(tau),
k: None,
Expand Down

0 comments on commit 3d69ca2

Please sign in to comment.