Skip to content

Commit

Permalink
fix: enable metrics_capture in order to debug
Browse files Browse the repository at this point in the history
feat: enable proof validate by default on merkleproof bench

While proofs_count is CLI configurable, if it's more than the number
of nodes in the tree, just sequentially challenge each node in the
tree instead of randomly selecting and over-proving.
  • Loading branch information
cryptonemo committed Jul 15, 2020
1 parent f77527b commit d06cbcf
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 7 deletions.
4 changes: 0 additions & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,3 @@ workflows:
- metrics_capture:
requires:
- cargo_fetch
filters:
branches:
only:
- master
2 changes: 2 additions & 0 deletions fil-proofs-tooling/scripts/run-remote.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/usr/bin/env bash

echo "Benchmark server: $2"

CMDS=$(cat <<EOF
set -e
Expand Down
2 changes: 1 addition & 1 deletion fil-proofs-tooling/src/bin/benchy/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ fn main() -> Result<()> {
Arg::with_name("validate")
.long("validate")
.required(false)
.default_value("false")
.default_value("true")
.help("Validate proofs if specified")
.takes_value(false),
);
Expand Down
17 changes: 15 additions & 2 deletions fil-proofs-tooling/src/bin/benchy/merkleproofs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,31 @@ fn generate_proofs<R: Rng, Tree: MerkleTreeTrait>(
proofs_count: usize,
validate: bool,
) -> Result<()> {
let proofs_count = if proofs_count >= nodes {
info!(
"requested {} proofs, but instead challenging all {} nodes sequentially",
proofs_count, nodes
);
std::cmp::min(nodes, proofs_count)
} else {
proofs_count
};

info!(
"creating {} inclusion proofs over {} nodes (validate enabled? {})",
proofs_count, nodes, validate
);

let proofs_count = std::cmp::min(nodes, proofs_count);
let rows_to_discard = default_rows_to_discard(
base_tree_nodes,
<Tree as MerkleTreeTrait>::Arity::to_usize(),
);
for i in 0..proofs_count {
let challenge = rng.gen_range(0, nodes);
let challenge = if proofs_count == nodes {
i
} else {
rng.gen_range(0, nodes)
};
debug!("challenge[{}] = {}", i, challenge);
let proof = tree
.gen_cached_proof(challenge, Some(rows_to_discard))
Expand Down

0 comments on commit d06cbcf

Please # to comment.