Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
interface-test
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
董子豪
interface-test
Commits
657757de
Commit
657757de
authored
Aug 17, 2021
by
董子豪
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
agg window post
parent
b2628d86
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
18 deletions
+21
-18
post.rs
extern/rust-filecoin-proofs-api/src/post.rs
+21
-18
No files found.
extern/rust-filecoin-proofs-api/src/post.rs
View file @
657757de
...
...
@@ -7,6 +7,7 @@ use crate::types::VanillaProofBytes;
use
crate
::{
ChallengeSeed
,
FallbackPoStSectorProof
,
MerkleTreeTrait
,
PoStType
,
PrivateReplicaInfo
,
ProverId
,
PublicReplicaInfo
,
RegisteredPoStProof
,
SectorId
,
SnarkProof
,
AggregateSnarkProof
,
RegisteredAggregationProof
,
};
pub
fn
generate_winning_post_sector_challenge
(
...
...
@@ -494,12 +495,18 @@ fn verify_window_post_inner<Tree: 'static + MerkleTreeTrait>(
Ok
(
valid_v1
)
}
pub
fn
aggregate_window_post_proofs
(
registered_aggregation
:
RegisteredAggregationProof
,
randomnesses
:
&
[
ChallengeSeed
],
proofs
:
&
[(
RegisteredPoStProof
,
&
[
u8
])],
total_sector_count
:
usize
,
)
->
Result
<
AggregateSnarkProof
>
{
ensure!
(
!
replicas
.is_empty
(),
"no replicas supplied"
);
ensure!
(
randomnesses
.len
()
==
proofs
.len
(),
"the lenth of randomness and proof is not match"
);
let
registered_post_proof_type_v1
=
proofs
[
0
]
.
0
;
ensure!
(
registered_post_proof_type_v1
.typ
()
==
PoStType
::
Window
,
...
...
@@ -517,7 +524,7 @@ pub fn aggregate_window_post_proofs(
registered_post_proof_type_v1
,
randomnesses
,
proofs
,
1
,
total_sector_count
,
)
}
...
...
@@ -525,17 +532,17 @@ fn aggregate_window_post_proofs_inner<Tree: 'static + MerkleTreeTrait>(
registered_proof_v1
:
RegisteredPoStProof
,
randomnesses
:
&
[
ChallengeSeed
],
proofs
:
&
[(
RegisteredPoStProof
,
&
[
u8
])],
partitons
:
usize
,
total_sector_count
:
usize
,
)
->
Result
<
AggregateSnarkProof
>
{
let
mut
agg_proofs
:
Vec
<
Vec
<
u8
>>
=
Vec
::
new
();
for
(
registered_proof
,
proof
)
in
proofs
.iter
()
{
for
(
registered_proof
,
proof
)
in
proofs
.i
nto_i
ter
()
{
ensure!
(
registered_proof
==
&
registered_proof_v1
,
"can only generate the same kind of PoSt"
);
agg_proofs
.push
(
proof
);
agg_proofs
.push
(
proof
.to_vec
()
);
}
ensure!
(
!
agg_proofs
.is_empty
(),
"missing proofs"
);
...
...
@@ -543,7 +550,7 @@ fn aggregate_window_post_proofs_inner<Tree: 'static + MerkleTreeTrait>(
&
registered_proof_v1
.as_v1_config
(),
randomnesses
,
agg_proofs
.as_slice
(),
partitons
,
total_sector_count
,
)
}
...
...
@@ -556,12 +563,13 @@ pub fn verify_aggregate_window_post_proofs(
replicas
:
&
[
BTreeMap
<
SectorId
,
PublicReplicaInfo
>
],
)
->
Result
<
bool
>
{
ensure!
(
!
replicas
.is_empty
(),
"no replicas supplied"
);
ensure!
(
proofs
.len
()
==
1
,
"only one version of PoSt supported"
);
let
registered_post_proof_type_v1
=
proofs
[
0
]
.
0
;
ensure!
(
randomnesses
.len
()
==
replicas
.len
(),
"Randomnesses and Replica don't match"
);
ensure!
(
registered_p
ost_proof_type
_v1
.major_version
()
==
1
,
registered_p
roof
_v1
.major_version
()
==
1
,
"only V1 supported"
);
...
...
@@ -571,9 +579,9 @@ pub fn verify_aggregate_window_post_proofs(
);
with_shape!
(
u64
::
from
(
registered_p
ost_proof_type
_v1
.sector_size
()),
u64
::
from
(
registered_p
roof
_v1
.sector_size
()),
verify_aggregate_window_post_proofs_inner
,
registered_p
ost_proof_type
_v1
,
registered_p
roof
_v1
,
prover_id
,
aggregate_proof_bytes
,
randomnesses
,
...
...
@@ -590,14 +598,9 @@ fn verify_aggregate_window_post_proofs_inner<Tree: 'static + MerkleTreeTrait>(
)
->
Result
<
bool
>
{
let
mut
replica_infos_v1
=
Vec
::
new
();
ensure!
(
randomnesses
.len
()
==
replicas
.len
(),
"Randomnesses and Replica don't match"
);
for
replica
in
replicas
.iter
()
{
let
mut
replica_info_v1
=
BTreeMap
::
new
();
for
(
id
,
info
)
in
repica
.iter
(){
for
(
id
,
info
)
in
rep
l
ica
.iter
(){
let
PublicReplicaInfo
{
registered_proof
,
comm_r
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment