Skip to content

Commit e2ea698

Browse files
cryptonemodignifiedquire
authored andcommitted
feat: add api version enum for determining runtime behaviour
feat: add tests paths for both v1_0_0 and v1_1_0 versions feat: allow api_version to be used as cli argument fix: renamed ApiVersion and use semver string parsing
1 parent 53158a9 commit e2ea698

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/main.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ use rand::rngs::OsRng;
3232
use rand::{RngCore, SeedableRng};
3333
use rand_chacha::ChaChaRng;
3434
use simplelog::{self, CombinedLogger, LevelFilter, TermLogger, TerminalMode, WriteLogger};
35+
use storage_proofs::api_version::ApiVersion;
3536
use storage_proofs::compound_proof::{self, CompoundProof};
3637
use storage_proofs::merkle::MerkleTreeTrait;
3738
use storage_proofs::parameter_cache::{
@@ -44,6 +45,8 @@ use storage_proofs::post::fallback::{
4445
FallbackPoSt, FallbackPoStCircuit, FallbackPoStCompound, PublicParams as PoStPublicParams,
4546
};
4647

48+
const FIXED_API_VERSION: ApiVersion = ApiVersion::V1_0_0;
49+
4750
const CHUNK_SIZE: usize = 10_000;
4851

4952
// Non-raw sizes.
@@ -301,13 +304,15 @@ fn blank_sdr_poseidon_params<Tree: MerkleTreeTrait>(sector_size: u64) -> PoRepPu
301304
sector_size: SectorSize(sector_size),
302305
partitions: PoRepProofPartitions(n_partitions),
303306
porep_id: [0; 32],
307+
api_version: FIXED_API_VERSION,
304308
};
305309

306310
let setup_params = compound_proof::SetupParams {
307311
vanilla_params: setup_params(
308312
PaddedBytesAmount::from(porep_config),
309313
usize::from(PoRepProofPartitions::from(porep_config)),
310314
porep_config.porep_id,
315+
porep_config.api_version,
311316
)
312317
.expect("failed to setup params"),
313318
partitions: Some(usize::from(PoRepProofPartitions::from(porep_config))),
@@ -331,6 +336,7 @@ fn blank_winning_post_poseidon_params<Tree: 'static + MerkleTreeTrait>(
331336
sector_count: WINNING_POST_SECTOR_COUNT,
332337
typ: PoStType::Winning,
333338
priority: false,
339+
api_version: FIXED_API_VERSION,
334340
};
335341

336342
winning_post_public_params::<Tree>(&post_config).expect("winning post public params failed")
@@ -349,6 +355,7 @@ fn blank_window_post_poseidon_params<Tree: 'static + MerkleTreeTrait>(
349355
.expect("post config sector count get failure"),
350356
typ: PoStType::Window,
351357
priority: false,
358+
api_version: FIXED_API_VERSION,
352359
};
353360

354361
window_post_public_params::<Tree>(&post_config).expect("window post public params failed")

0 commit comments

Comments
 (0)