Skip to content

Commit

Permalink
Empty sector update tree r gpu (#1528)
Browse files Browse the repository at this point in the history
* feat: re-factor tree_r_last building for external re-use
* reduce conversions in encode (@dignifiedquire)
* feat: use an enum return type to avoid transmute (unsafe)
* fix: keep new crate version consistent with latest release
* fix: add doc and additional type check
* feat: wrap settings for tree builders in a method
  • Loading branch information
cryptonemo committed Dec 9, 2021
1 parent 1266749 commit 71e02fb
Show file tree
Hide file tree
Showing 5 changed files with 253 additions and 132 deletions.
8 changes: 8 additions & 0 deletions storage-proofs-core/src/data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,14 @@ impl<'a> Data<'a> {
}
}

pub fn empty() -> Self {
Data {
raw: None,
path: None,
len: 0,
}
}

pub fn len(&self) -> usize {
self.len
}
Expand Down
10 changes: 7 additions & 3 deletions storage-proofs-porep/src/encode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,17 @@ use blstrs::Scalar as Fr;
use filecoin_hashers::Domain;

pub fn encode<T: Domain>(key: T, value: T) -> T {
let mut result: Fr = value.into();
let key: Fr = key.into();
let value: Fr = value.into();
let mut result: Fr = key.into();

result += key;
encode_fr(&mut result, value);
result.into()
}

pub fn encode_fr(key: &mut Fr, value: Fr) {
*key += value;
}

pub fn decode<T: Domain>(key: T, value: T) -> T {
let mut result: Fr = value.into();
let key: Fr = key.into();
Expand Down
2 changes: 1 addition & 1 deletion storage-proofs-porep/src/stacked/vanilla/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ pub use encoding_proof::EncodingProof;
pub use graph::{StackedBucketGraph, StackedGraph, EXP_DEGREE};
pub use labeling_proof::LabelingProof;
pub use params::*;
pub use proof::{StackedDrg, TOTAL_PARENTS};
pub use proof::{StackedDrg, TreeRElementData, TOTAL_PARENTS};
Loading

0 comments on commit 71e02fb

Please sign in to comment.