Merge pull request #1017 from nuttycom/test_with_bundled_prover

Test with bundled prover instead of local prover.
This commit is contained in:
Kris Nuttycombe 2023-11-07 13:14:47 -07:00 committed by GitHub
commit c915c93862
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 3 additions and 91 deletions

View File

@ -12,21 +12,6 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Fetch path to Zcash parameters
working-directory: ./zcash_proofs
shell: bash
run: echo "ZCASH_PARAMS=$(cargo run --release --example get-params-path --features directories)" >> $GITHUB_ENV
- name: Cache Zcash parameters
id: cache-params
uses: actions/cache@v3.3.2
with:
path: ${{ env.ZCASH_PARAMS }}
key: ${{ runner.os }}-params
- name: Fetch Zcash parameters
if: steps.cache-params.outputs.cache-hit != 'true'
working-directory: ./zcash_proofs
run: cargo run --release --example download-params --features download-params
- name: Run tests
run: cargo test --all-features --verbose --release --all
- name: Run slow tests
@ -134,21 +119,6 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Fetch path to Zcash parameters
working-directory: ./zcash_proofs
shell: bash
run: echo "ZCASH_PARAMS=$(cargo run --release --example get-params-path --features directories)" >> $GITHUB_ENV
- name: Cache Zcash parameters
id: cache-params
uses: actions/cache@v3.3.2
with:
path: ${{ env.ZCASH_PARAMS }}
key: ${{ runner.os }}-params
- name: Fetch Zcash parameters
if: steps.cache-params.outputs.cache-hit != 'true'
working-directory: ./zcash_proofs
run: cargo run --release --example download-params --features download-params
- name: Generate coverage report
run: cargo tarpaulin --engine llvm --all-features --release --timeout 600 --out xml
- name: Upload coverage to Codecov

View File

@ -61,7 +61,7 @@ rand_core.workspace = true
regex = "1.4"
tempfile = "3.5.0"
zcash_note_encryption.workspace = true
zcash_proofs = { workspace = true, features = ["local-prover"] }
zcash_proofs = { workspace = true, features = ["bundled-prover"] }
zcash_primitives = { workspace = true, features = ["test-dependencies"] }
zcash_client_backend = { workspace = true, features = ["test-dependencies", "unstable-serialization", "unstable-spanning-tree"] }
zcash_address = { workspace = true, features = ["test-dependencies"] }

View File

@ -499,12 +499,7 @@ pub(crate) mod tests {
};
pub(crate) fn test_prover() -> impl SpendProver + OutputProver {
match LocalTxProver::with_default_location() {
Some(tx_prover) => tx_prover,
None => {
panic!("Cannot locate the Zcash parameters. Please run zcash-fetch-params or fetch-params.sh to download the parameters, and then re-run the tests.");
}
}
LocalTxProver::bundled()
}
#[test]

View File

@ -796,11 +796,7 @@ mod tests {
.activation_height(NetworkUpgrade::ZFuture)
.unwrap();
// Only run the test if we have the prover parameters.
let prover = match LocalTxProver::with_default_location() {
Some(prover) => prover,
None => return,
};
let prover = LocalTxProver::bundled();
//
// Opening transaction

View File

@ -53,17 +53,5 @@ multicore = ["bellman/multicore", "zcash_primitives/multicore"]
[lib]
bench = false
[[example]]
name = "get-params-path"
required-features = ["directories"]
[[example]]
name = "download-params"
required-features = ["download-params"]
[[example]]
name = "download-sprout-and-sapling-params"
required-features = ["download-params"]
[badges]
maintenance = { status = "actively-developed" }

View File

@ -1,4 +0,0 @@
fn main() -> Result<(), minreq::Error> {
#[allow(deprecated)]
zcash_proofs::download_parameters()
}

View File

@ -1,26 +0,0 @@
fn main() -> Result<(), minreq::Error> {
const DOWNLOAD_TIMEOUT_SECONDS: u64 = 3600;
#[allow(unused_mut, unused_assignments)]
let mut params_folder =
zcash_proofs::default_params_folder().expect("unexpected missing HOME env var");
// Always do a download to /tmp, if compiled with `RUSTFLAGS="--cfg always_download"`
#[cfg(always_download)]
{
std::env::set_var("HOME", "/tmp");
params_folder =
zcash_proofs::default_params_folder().expect("unexpected missing HOME env var");
println!("removing temporary parameters folder: {:?}", params_folder);
let _ = std::fs::remove_dir_all(&params_folder);
}
println!("downloading sapling parameters to: {:?}", params_folder);
zcash_proofs::download_sapling_parameters(Some(DOWNLOAD_TIMEOUT_SECONDS))?;
println!("downloading sprout parameters to: {:?}", params_folder);
zcash_proofs::download_sprout_parameters(Some(DOWNLOAD_TIMEOUT_SECONDS))?;
Ok(())
}

View File

@ -1,7 +0,0 @@
fn main() {
if let Some(path) = zcash_proofs::default_params_folder() {
if let Some(path) = path.to_str() {
println!("{}", path);
}
}
}