Skip to content

Commit e449912

Browse files
authored
feat: add API features (#88)
`rust-fil-proofs` now has the concept of API features, make the code compatible to those.
1 parent d55c397 commit e449912

File tree

4 files changed

+64
-53
lines changed

4 files changed

+64
-53
lines changed

Cargo.toml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ readme = "README.md"
1010

1111
[dependencies]
1212
anyhow = "1.0.26"
13-
bellperson = { version = "0.24.1", default-features = false }
13+
bellperson = { version = "0.25", default-features = false }
1414
bincode = "1.1.2"
15-
blstrs = "0.6.1"
15+
blstrs = "0.7"
1616
lazy_static = "1.2"
1717
serde = "1.0.104"
1818
filecoin-proofs-v1 = { package = "filecoin-proofs", version = "~14.0.0", default-features = false }
@@ -25,4 +25,10 @@ default = ["opencl", "cuda"]
2525
cuda = ["filecoin-proofs-v1/cuda", "filecoin-hashers/cuda", "storage-proofs-core/cuda", "bellperson/cuda"]
2626
opencl = ["filecoin-proofs-v1/opencl", "filecoin-hashers/opencl", "storage-proofs-core/opencl", "bellperson/opencl"]
2727
multicore-sdr = ["filecoin-proofs-v1/multicore-sdr"]
28-
big-tests = []
28+
big-tests = []
29+
30+
[patch.crates-io]
31+
filecoin-proofs = { git = "https://github.com/filecoin-project/rust-fil-proofs", branch = "master" }
32+
filecoin-hashers = { git = "https://github.com/filecoin-project/rust-fil-proofs", branch = "master" }
33+
storage-proofs-core = { git = "https://github.com/filecoin-project/rust-fil-proofs", branch = "master" }
34+
fr32 = { git = "https://github.com/filecoin-project/rust-fil-proofs", branch = "master" }

src/registry.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ impl RegisteredSealProof {
195195
partitions: PoRepProofPartitions(self.partitions()),
196196
porep_id: self.porep_id(),
197197
api_version: self.version(),
198+
api_features: Vec::new(),
198199
}
199200
}
200201
StackedDrg2KiBV1_1 | StackedDrg8MiBV1_1 | StackedDrg512MiBV1_1
@@ -205,6 +206,7 @@ impl RegisteredSealProof {
205206
partitions: PoRepProofPartitions(self.partitions()),
206207
porep_id: self.porep_id(),
207208
api_version: self.version(),
209+
api_features: Vec::new(),
208210
}
209211
} // _ => panic!("Can only be called on V1 configs"),
210212
}
@@ -688,6 +690,7 @@ impl RegisteredUpdateProof {
688690
partitions: PoRepProofPartitions(self.partitions()),
689691
porep_id: self.porep_id(),
690692
api_version: self.version(),
693+
api_features: Vec::new(),
691694
}
692695
} // _ => panic!("Can only be called on V1 configs"),
693696
}

src/seal.rs

Lines changed: 44 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ fn seal_pre_commit_phase1_inner<Tree: 'static + MerkleTreeTrait>(
378378
let config = registered_proof.as_v1_config();
379379

380380
let output = filecoin_proofs_v1::seal_pre_commit_phase1::<_, _, _, Tree>(
381-
config,
381+
&config,
382382
cache_path,
383383
in_path,
384384
out_path,
@@ -462,7 +462,7 @@ fn seal_pre_commit_phase2_inner<Tree: 'static + MerkleTreeTrait>(
462462
)?;
463463

464464
let output = filecoin_proofs_v1::seal_pre_commit_phase2::<_, _, Tree>(
465-
registered_proof.as_v1_config(),
465+
&registered_proof.as_v1_config(),
466466
seal_pre_commit_phase1_output,
467467
cache_path,
468468
out_path,
@@ -556,7 +556,7 @@ fn seal_commit_phase1_inner<Tree: 'static + MerkleTreeTrait>(
556556
filecoin_proofs_v1::validate_cache_for_commit::<_, _, Tree>(&cache_path, &replica_path)?;
557557

558558
let output = filecoin_proofs_v1::seal_commit_phase1::<_, Tree>(
559-
config,
559+
&config,
560560
cache_path,
561561
replica_path,
562562
prover_id,
@@ -643,7 +643,7 @@ fn seal_commit_phase2_inner<Tree: 'static + MerkleTreeTrait>(
643643
ticket,
644644
};
645645

646-
let output = filecoin_proofs_v1::seal_commit_phase2::<Tree>(config, co, prover_id, sector_id)?;
646+
let output = filecoin_proofs_v1::seal_commit_phase2::<Tree>(&config, co, prover_id, sector_id)?;
647647

648648
Ok(SealCommitPhase2Output {
649649
proof: output.proof,
@@ -708,7 +708,7 @@ pub fn get_seal_inputs_inner<Tree: 'static + MerkleTreeTrait>(
708708
let config = registered_proof.as_v1_config();
709709

710710
filecoin_proofs_v1::get_seal_inputs::<Tree>(
711-
config, comm_r, comm_d, prover_id, sector_id, ticket, seed,
711+
&config, comm_r, comm_d, prover_id, sector_id, ticket, seed,
712712
)
713713
}
714714

@@ -775,7 +775,7 @@ pub fn aggregate_seal_commit_proofs_inner<Tree: 'static + MerkleTreeTrait>(
775775
.collect();
776776

777777
filecoin_proofs_v1::aggregate_seal_commit_proofs::<Tree>(
778-
config,
778+
&config,
779779
comm_rs,
780780
seeds,
781781
&outputs,
@@ -845,7 +845,7 @@ pub fn verify_aggregate_seal_commit_proofs_inner<Tree: 'static + MerkleTreeTrait
845845
let config = registered_proof.as_v1_config();
846846

847847
filecoin_proofs_v1::verify_aggregate_seal_commit_proofs::<Tree>(
848-
config,
848+
&config,
849849
aggregate_proof_bytes,
850850
comm_rs,
851851
seeds,
@@ -882,34 +882,36 @@ pub fn fauxrep<R: AsRef<Path>, S: AsRef<Path>>(
882882
// Note also that not all of these sector sizes are production, so some could be pruned.
883883
match sector_size {
884884
SECTOR_SIZE_2_KIB => {
885-
filecoin_proofs_v1::fauxrep::<_, _, SectorShape2KiB>(config, cache_path, replica_path)
885+
filecoin_proofs_v1::fauxrep::<_, _, SectorShape2KiB>(&config, cache_path, replica_path)
886886
}
887887
SECTOR_SIZE_4_KIB => {
888-
filecoin_proofs_v1::fauxrep::<_, _, SectorShape4KiB>(config, cache_path, replica_path)
888+
filecoin_proofs_v1::fauxrep::<_, _, SectorShape4KiB>(&config, cache_path, replica_path)
889889
}
890890
SECTOR_SIZE_16_KIB => {
891-
filecoin_proofs_v1::fauxrep::<_, _, SectorShape16KiB>(config, cache_path, replica_path)
891+
filecoin_proofs_v1::fauxrep::<_, _, SectorShape16KiB>(&config, cache_path, replica_path)
892892
}
893893
SECTOR_SIZE_32_KIB => {
894-
filecoin_proofs_v1::fauxrep::<_, _, SectorShape32KiB>(config, cache_path, replica_path)
894+
filecoin_proofs_v1::fauxrep::<_, _, SectorShape32KiB>(&config, cache_path, replica_path)
895895
}
896896
SECTOR_SIZE_8_MIB => {
897-
filecoin_proofs_v1::fauxrep::<_, _, SectorShape8MiB>(config, cache_path, replica_path)
897+
filecoin_proofs_v1::fauxrep::<_, _, SectorShape8MiB>(&config, cache_path, replica_path)
898898
}
899899
SECTOR_SIZE_16_MIB => {
900-
filecoin_proofs_v1::fauxrep::<_, _, SectorShape16MiB>(config, cache_path, replica_path)
901-
}
902-
SECTOR_SIZE_512_MIB => {
903-
filecoin_proofs_v1::fauxrep::<_, _, SectorShape512MiB>(config, cache_path, replica_path)
900+
filecoin_proofs_v1::fauxrep::<_, _, SectorShape16MiB>(&config, cache_path, replica_path)
904901
}
902+
SECTOR_SIZE_512_MIB => filecoin_proofs_v1::fauxrep::<_, _, SectorShape512MiB>(
903+
&config,
904+
cache_path,
905+
replica_path,
906+
),
905907
SECTOR_SIZE_1_GIB => {
906-
filecoin_proofs_v1::fauxrep::<_, _, SectorShape1GiB>(config, cache_path, replica_path)
908+
filecoin_proofs_v1::fauxrep::<_, _, SectorShape1GiB>(&config, cache_path, replica_path)
907909
}
908910
SECTOR_SIZE_32_GIB => {
909-
filecoin_proofs_v1::fauxrep::<_, _, SectorShape32GiB>(config, cache_path, replica_path)
911+
filecoin_proofs_v1::fauxrep::<_, _, SectorShape32GiB>(&config, cache_path, replica_path)
910912
}
911913
SECTOR_SIZE_64_GIB => {
912-
filecoin_proofs_v1::fauxrep::<_, _, SectorShape64GiB>(config, cache_path, replica_path)
914+
filecoin_proofs_v1::fauxrep::<_, _, SectorShape64GiB>(&config, cache_path, replica_path)
913915
}
914916
_ => panic!("unsupported sector size: {}", sector_size),
915917
}
@@ -1003,7 +1005,7 @@ pub fn verify_seal(
10031005
with_shape!(
10041006
u64::from(registered_proof.sector_size()),
10051007
verify_seal,
1006-
config,
1008+
&config,
10071009
comm_r_in,
10081010
comm_d_in,
10091011
prover_id,
@@ -1044,7 +1046,7 @@ pub fn verify_batch_seal(
10441046
with_shape!(
10451047
u64::from(registered_proof.sector_size()),
10461048
verify_batch_seal,
1047-
config,
1049+
&config,
10481050
comm_r_ins,
10491051
comm_d_ins,
10501052
prover_ids,
@@ -1122,7 +1124,7 @@ fn get_unsealed_range_inner<Tree: 'static + MerkleTreeTrait>(
11221124
let config = registered_proof.as_v1_config();
11231125

11241126
filecoin_proofs_v1::get_unsealed_range::<_, Tree>(
1125-
config,
1127+
&config,
11261128
cache_path,
11271129
sealed_path,
11281130
output_path,
@@ -1179,7 +1181,7 @@ pub fn get_unsealed_range_mapped<T: Into<PathBuf> + AsRef<Path>, W: Write>(
11791181
// Note also that not all of these sector sizes are production, so some could be pruned.
11801182
match sector_size {
11811183
SECTOR_SIZE_2_KIB => filecoin_proofs_v1::unseal_range_mapped::<_, _, SectorShape2KiB>(
1182-
config,
1184+
&config,
11831185
cache_path,
11841186
sealed_path.into(),
11851187
unsealed_output,
@@ -1191,7 +1193,7 @@ pub fn get_unsealed_range_mapped<T: Into<PathBuf> + AsRef<Path>, W: Write>(
11911193
num_bytes,
11921194
),
11931195
SECTOR_SIZE_4_KIB => filecoin_proofs_v1::unseal_range_mapped::<_, _, SectorShape4KiB>(
1194-
config,
1196+
&config,
11951197
cache_path,
11961198
sealed_path.into(),
11971199
unsealed_output,
@@ -1203,7 +1205,7 @@ pub fn get_unsealed_range_mapped<T: Into<PathBuf> + AsRef<Path>, W: Write>(
12031205
num_bytes,
12041206
),
12051207
SECTOR_SIZE_16_KIB => filecoin_proofs_v1::unseal_range_mapped::<_, _, SectorShape16KiB>(
1206-
config,
1208+
&config,
12071209
cache_path,
12081210
sealed_path.into(),
12091211
unsealed_output,
@@ -1215,7 +1217,7 @@ pub fn get_unsealed_range_mapped<T: Into<PathBuf> + AsRef<Path>, W: Write>(
12151217
num_bytes,
12161218
),
12171219
SECTOR_SIZE_32_KIB => filecoin_proofs_v1::unseal_range_mapped::<_, _, SectorShape32KiB>(
1218-
config,
1220+
&config,
12191221
cache_path,
12201222
sealed_path.into(),
12211223
unsealed_output,
@@ -1227,7 +1229,7 @@ pub fn get_unsealed_range_mapped<T: Into<PathBuf> + AsRef<Path>, W: Write>(
12271229
num_bytes,
12281230
),
12291231
SECTOR_SIZE_8_MIB => filecoin_proofs_v1::unseal_range_mapped::<_, _, SectorShape8MiB>(
1230-
config,
1232+
&config,
12311233
cache_path,
12321234
sealed_path.into(),
12331235
unsealed_output,
@@ -1239,7 +1241,7 @@ pub fn get_unsealed_range_mapped<T: Into<PathBuf> + AsRef<Path>, W: Write>(
12391241
num_bytes,
12401242
),
12411243
SECTOR_SIZE_16_MIB => filecoin_proofs_v1::unseal_range_mapped::<_, _, SectorShape16MiB>(
1242-
config,
1244+
&config,
12431245
cache_path,
12441246
sealed_path.into(),
12451247
unsealed_output,
@@ -1251,7 +1253,7 @@ pub fn get_unsealed_range_mapped<T: Into<PathBuf> + AsRef<Path>, W: Write>(
12511253
num_bytes,
12521254
),
12531255
SECTOR_SIZE_512_MIB => filecoin_proofs_v1::unseal_range_mapped::<_, _, SectorShape512MiB>(
1254-
config,
1256+
&config,
12551257
cache_path,
12561258
sealed_path.into(),
12571259
unsealed_output,
@@ -1263,7 +1265,7 @@ pub fn get_unsealed_range_mapped<T: Into<PathBuf> + AsRef<Path>, W: Write>(
12631265
num_bytes,
12641266
),
12651267
SECTOR_SIZE_1_GIB => filecoin_proofs_v1::unseal_range_mapped::<_, _, SectorShape1GiB>(
1266-
config,
1268+
&config,
12671269
cache_path,
12681270
sealed_path.into(),
12691271
unsealed_output,
@@ -1275,7 +1277,7 @@ pub fn get_unsealed_range_mapped<T: Into<PathBuf> + AsRef<Path>, W: Write>(
12751277
num_bytes,
12761278
),
12771279
SECTOR_SIZE_32_GIB => filecoin_proofs_v1::unseal_range_mapped::<_, _, SectorShape32GiB>(
1278-
config,
1280+
&config,
12791281
cache_path,
12801282
sealed_path.into(),
12811283
unsealed_output,
@@ -1287,7 +1289,7 @@ pub fn get_unsealed_range_mapped<T: Into<PathBuf> + AsRef<Path>, W: Write>(
12871289
num_bytes,
12881290
),
12891291
SECTOR_SIZE_64_GIB => filecoin_proofs_v1::unseal_range_mapped::<_, _, SectorShape64GiB>(
1290-
config,
1292+
&config,
12911293
cache_path,
12921294
sealed_path.into(),
12931295
unsealed_output,
@@ -1346,7 +1348,7 @@ pub fn unseal_range<T: Into<PathBuf> + AsRef<Path>, R: Read, W: Write>(
13461348
// Note also that not all of these sector sizes are production, so some could be pruned.
13471349
match sector_size {
13481350
SECTOR_SIZE_2_KIB => filecoin_proofs_v1::unseal_range::<_, _, _, SectorShape2KiB>(
1349-
config,
1351+
&config,
13501352
cache_path,
13511353
sealed_sector,
13521354
unsealed_output,
@@ -1358,7 +1360,7 @@ pub fn unseal_range<T: Into<PathBuf> + AsRef<Path>, R: Read, W: Write>(
13581360
num_bytes,
13591361
),
13601362
SECTOR_SIZE_4_KIB => filecoin_proofs_v1::unseal_range::<_, _, _, SectorShape4KiB>(
1361-
config,
1363+
&config,
13621364
cache_path,
13631365
sealed_sector,
13641366
unsealed_output,
@@ -1370,7 +1372,7 @@ pub fn unseal_range<T: Into<PathBuf> + AsRef<Path>, R: Read, W: Write>(
13701372
num_bytes,
13711373
),
13721374
SECTOR_SIZE_16_KIB => filecoin_proofs_v1::unseal_range::<_, _, _, SectorShape16KiB>(
1373-
config,
1375+
&config,
13741376
cache_path,
13751377
sealed_sector,
13761378
unsealed_output,
@@ -1382,7 +1384,7 @@ pub fn unseal_range<T: Into<PathBuf> + AsRef<Path>, R: Read, W: Write>(
13821384
num_bytes,
13831385
),
13841386
SECTOR_SIZE_32_KIB => filecoin_proofs_v1::unseal_range::<_, _, _, SectorShape32KiB>(
1385-
config,
1387+
&config,
13861388
cache_path,
13871389
sealed_sector,
13881390
unsealed_output,
@@ -1394,7 +1396,7 @@ pub fn unseal_range<T: Into<PathBuf> + AsRef<Path>, R: Read, W: Write>(
13941396
num_bytes,
13951397
),
13961398
SECTOR_SIZE_8_MIB => filecoin_proofs_v1::unseal_range::<_, _, _, SectorShape8MiB>(
1397-
config,
1399+
&config,
13981400
cache_path,
13991401
sealed_sector,
14001402
unsealed_output,
@@ -1406,7 +1408,7 @@ pub fn unseal_range<T: Into<PathBuf> + AsRef<Path>, R: Read, W: Write>(
14061408
num_bytes,
14071409
),
14081410
SECTOR_SIZE_16_MIB => filecoin_proofs_v1::unseal_range::<_, _, _, SectorShape16MiB>(
1409-
config,
1411+
&config,
14101412
cache_path,
14111413
sealed_sector,
14121414
unsealed_output,
@@ -1418,7 +1420,7 @@ pub fn unseal_range<T: Into<PathBuf> + AsRef<Path>, R: Read, W: Write>(
14181420
num_bytes,
14191421
),
14201422
SECTOR_SIZE_512_MIB => filecoin_proofs_v1::unseal_range::<_, _, _, SectorShape512MiB>(
1421-
config,
1423+
&config,
14221424
cache_path,
14231425
sealed_sector,
14241426
unsealed_output,
@@ -1430,7 +1432,7 @@ pub fn unseal_range<T: Into<PathBuf> + AsRef<Path>, R: Read, W: Write>(
14301432
num_bytes,
14311433
),
14321434
SECTOR_SIZE_1_GIB => filecoin_proofs_v1::unseal_range::<_, _, _, SectorShape1GiB>(
1433-
config,
1435+
&config,
14341436
cache_path,
14351437
sealed_sector,
14361438
unsealed_output,
@@ -1442,7 +1444,7 @@ pub fn unseal_range<T: Into<PathBuf> + AsRef<Path>, R: Read, W: Write>(
14421444
num_bytes,
14431445
),
14441446
SECTOR_SIZE_32_GIB => filecoin_proofs_v1::unseal_range::<_, _, _, SectorShape32GiB>(
1445-
config,
1447+
&config,
14461448
cache_path,
14471449
sealed_sector,
14481450
unsealed_output,
@@ -1454,7 +1456,7 @@ pub fn unseal_range<T: Into<PathBuf> + AsRef<Path>, R: Read, W: Write>(
14541456
num_bytes,
14551457
),
14561458
SECTOR_SIZE_64_GIB => filecoin_proofs_v1::unseal_range::<_, _, _, SectorShape64GiB>(
1457-
config,
1459+
&config,
14581460
cache_path,
14591461
sealed_sector,
14601462
unsealed_output,

0 commit comments

Comments
 (0)