Skip to content

Commit ca7b335

Browse files
authored
Merge pull request #471 from filecoin-project/fix/prove/request-parents-once
drgporep: add parents to `decode_domain_block`
2 parents cba59e8 + 51ab3d9 commit ca7b335

File tree

2 files changed

+11
-12
lines changed

2 files changed

+11
-12
lines changed

storage-proofs/src/drgporep.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -282,12 +282,12 @@ where
282282
let parents = pub_params.graph.parents(challenge);
283283
let mut replica_parentsi = Vec::with_capacity(parents.len());
284284

285-
for p in parents {
286-
replica_parentsi.push((p, {
287-
let proof = tree_r.gen_proof(p);
285+
for p in &parents {
286+
replica_parentsi.push((*p, {
287+
let proof = tree_r.gen_proof(*p);
288288
DataProof {
289289
proof: MerkleProof::new_from_proof(&proof),
290-
data: domain_replica[p],
290+
data: domain_replica[*p],
291291
}
292292
}));
293293
}
@@ -305,12 +305,13 @@ where
305305
// challenge,
306306
// )?;
307307

308-
let extracted = decode_domain_block(
309-
&pub_params.graph,
308+
let extracted = decode_domain_block::<H>(
309+
pub_params.graph.degree(),
310310
pub_params.sloth_iter,
311311
&pub_inputs.replica_id,
312312
domain_replica,
313313
challenge,
314+
parents,
314315
)?
315316
.into_bytes();
316317
data_nodes.push(DataProof {

storage-proofs/src/vde.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,25 +86,23 @@ where
8686
Ok(H::sloth_decode(&key, &node_data, sloth_iter))
8787
}
8888

89-
pub fn decode_domain_block<'a, H, G>(
90-
graph: &'a G,
89+
pub fn decode_domain_block<'a, H>(
90+
degree: usize,
9191
sloth_iter: usize,
9292
replica_id: &'a H::Domain,
9393
data: &'a [H::Domain],
9494
v: usize,
95+
parents: Vec<usize>,
9596
) -> Result<H::Domain>
9697
where
9798
H: Hasher,
98-
G: Graph<H>,
9999
{
100-
let parents = graph.parents(v);
101-
102100
let byte_data = data
103101
.iter()
104102
.flat_map(H::Domain::into_bytes)
105103
.collect::<Vec<u8>>();
106104

107-
let key = create_key::<H>(replica_id, v, &parents, &byte_data, graph.degree())?;
105+
let key = create_key::<H>(replica_id, v, &parents, &byte_data, degree)?;
108106
let node_data = data[v];
109107

110108
// TODO: round constant

0 commit comments

Comments
 (0)