Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support streaming contribution. #1184

Closed
wants to merge 21 commits into from

Conversation

porcuquine
Copy link
Collaborator

No description provided.

cryptonemo and others added 7 commits June 18, 2020 13:25
* style(storage-proofs): collapse else if block

clippy emits error:

        error: this `else { if .. }` block can be collapsed

Do what clippy suggests, collapse the else if block.

* style(storage-proofs): remove unused import

In test module we bring into scope `rand` but do not use
it (thread_rng() is called using a qualified path).

Remove the unused `rand` import.

* refactor(storage-proofs): use iter() instead of into_iter()

As suggested by clippy we can use `iter()` instead of `into_iter() in
a bunch of places.`

* refactor(storage-proofs): use slice directly

Clippy emits a bunch of warnings of type:

        warning: useless use of `vec!`

And suggests that we can use a slice direcly

        help: you can use a slice directly: `&[None; 256]`

Do as clippy suggests; use slices directly.

* refactor(storage-proofs): use iterator instead of for loop

Found with clippy; we are using a for loop but the current lint level
requires us to use an iterator.

As suggested; use an iterator instead of the for loop.

* refactor(storage-proofs): remove unneeded mutable reference

Found with clippy; `bytes_to_fr` does not need a mutable reference.

* refactor(storage-proofs): remove unnecessary clone()

Remove  unnecessary usage of `clone()`, found by clippy.

* refactor(storage-proofs): remove reference from match pattern

Clippy emits error:

        error: you don't need to add `&` to all patterns

Along with the suggestion to dereference the expression instead of
prefixing all patters with `&`.

Do as suggested by clippy and dereference the expressions.

* refactor(storage-proofs): use dedicated `copied` method

Clippy emits two errors of type:

        error: You are using an explicit closure for copying elements

Along with the suggestion to us `copied` instead. Do as clippy
suggests.

* refactor(storage-proofs): remove unnecessary into()

Remove  unnecessary usage of `into()`, found by clippy.

* refactor(storage-proofs): include function in criterion_group

The function `pedersen_md_circuit_benchmark` is defined but not used,
it appears that this function should be added to the `criterion_group`
marcro call.

Found by clippy.

* refactor(storage-proofs): remove unnecessary use

`tempfile` is brought into scope but is never used. Found by clippy.

* refactor(storage-proofs): remove unnecessary ()

Plain old `return;` is idiomatic Rust these days, found by clippy.

* refactor(storage-proofs): remove unused local variable

We declare a local buffer and never use it. Found by clippy.

* refactor(filecoin-proofs): use consistent underscoring

Clippy emits warning

        warning: digits grouped inconsistently by underscores

Add an underscore, as suggested, in order to be consistent.

* refactor(filecoin-proofs): remove redundant import

Import is unused; found by clippy.

* refactor(filecoin-proofs): remove unnecessary into_iter()

Clippy emits error:

        error: identical conversion

Remove, as suggested by clippy, unnecessary `into_iter()`.

* refactor(filecoin-proofs): use iterator instead of indexing

Clippy emits error:

        error: the loop variable `i` is used to index `val`

Use an iterator, as suggested, to loop over the arrays of bytes. Use
combinators `skip` and `take` as needed.

* refactor(storage-proofs): use separators

Clippy emits error:

        error: long literal lacking separators

Use separators, as suggested by clippy, to assist reading.

* refactor(storage-proofs): pass unit directly

Clippy emits warning:

        warning: passing a unit value to a function

The argument in question is not actually used by the function
`circuit` (if I've jumped to the correct definition).

We can safely pass in unit `()` instead. Does this result in any loss
of meaning?

* refactor(filecoin-proofs): use _f64 type

Clippy emits error:

        error: casting integer literal to `f64` is unnecessary

Use `32_f64` as suggested instead of casting to an `f64`.

* refactor(filecoin-proofs): allow identity_op in test

Clippy emits error:

  error: the operation is ineffective. Consider reducing it to `127`

This is caused because we use `1 * 127` in order to be consistent with
other usages i.e., `2 * 127` and `8 * 127`. Clippy is wrong in this
instance, the ineffective operation makes the code easier to read.

Instruct clippy to allow this lint.

* refactor(filecoin-proofs): remove useless use of vec!

Clippy emits warning/error;

        useless use of `vec!`

Do as suggested by clippy and use a slice directly.

* refactor(filecoin-proofs): remove redundant clone

Clippy emits warning:

        warning: redundant clone

Do as clippy suggests; remove redundant calls to `clone()`

* refactor(filecoin-proofs): remove clone on double reference

Clippy emits error:

        error: using `clone` on a double-reference; this will copy the
        reference instead of cloning the inner type

This error is caused by code that is mildly convoluted by the fact
that the only method on  `TempDir` that returns a `PathBuf` consumes
self. We cannot use that because at the call site we cannot consume
the temp dir. To get around this we do a little dance of getting a
reference to a `Path` and then calling `to_path_buf()` on it. We end
up with code that looks kind of funky:

        self.cache_dire.path().to_path_buf()

That's the best I could come up with :)

* refactor(filecoin-proofs): use unwrap_or_else

`unwrap_or_else()` is more performant than `unwrap_or`. Found by
clippy.

* refactor(filecoin-proofs): use iter() directly

Clippy emits warning:

        warning: this `.into_iter()` call is equivalent to `.iter()`
        and will not move the `slice`

Do as clippy suggests and use `iter()` directly.

* refactor(filecoin-proofs): use write_all

Clippy emits error:

 error: written amount is not handled. Use `Write::write_all` instead

Use `write_all` as clippy suggests since we do not use the return
result.

* refactor(filecoin-proofs): remove identical conversion

Clippy emits warning:

        warning: identical conversion

Remove the call to `into_iter()`, as suggested by clippy, and use
`iter()`.

* refactor(filecoin-proofs): no function call after expect

Clippy emits error:

        error: use of `expect` followed by a function call

Do as suggested by clippy and use `unwrap_or_else()` coupled with
`panic!` instead of calling `format!` as an argument to `expect()`.

* refactor(fil-proofs-tooling): add separators

Clippy emits warning:

        warning: long literal lacking separators

Add separators as suggested by clippy to assist reading.

* refactor(storage-proofs): all clippy lint unit_arg

We use the `black_box` function in a bunch of places, at times the
function argument returns unit, this is to be expected since the
argument is not used for its return value.

Instruct clippy to set the `unit_arg` lint to allow.

* refactor(fil-proofs-tooling): all clippy lint float_cmp

We use a couple of strict float comparisons to test. In each case the
strict comparison is ok.

Add a lint ignore and also comment each site that does strict float
comparison.
Signed-off-by: koushiro <koushiro.cqx@gmail.com>
From the issue description: "FFI exposed functions should log when called and right before they return."

Add logging to all the public functions (excl. public trait implementations) within the `api` module.

Closes: #650
After cloning the repository `cargo build` fails if the system does not
have OpenCL installed.

Add comment as such, including Ubuntu command to install OpenCL.
…fs. (#1174)

Co-authored-by: porcuquine <porcuquine@users.noreply.github.com>
@porcuquine porcuquine force-pushed the feat/streaming-contribution branch from 0c944a2 to 52f0641 Compare June 23, 2020 18:07
cryptonemo and others added 14 commits June 23, 2020 14:35
* feat: extend update_tree_r_cache command with new features

Added are 'inspect' and 'verify' options.  Inspect makes sure the cache
is consistent with itself and verify rebuilds trees and then verifies
against the cached data (which can detect an error in the replica data).

* feat: re-factor and simplify
* fix: apply review feedback
The motivation for this is because of a broken test that attempts to use this from rust-filecoin-proofs-api, which always fails due to the paranter file not being available
* feat: add some README notes on available settings
* feat: update README and remove some outdated info
* feat: allow an env configurable parent cache location
* fix: update README with corrections
* feat: update pairing dependency
* feat: move parameter and parent cache path to settings
This commit is here because v4.0.1 was a hotfix placed directly on the v4.0.0 branch.  Because that branch contains fixes that are not desired in the master branch (or the next version), we are temporarily updating the cargo versions manually to 4.0.1 here just in order to publish the next release.  Mea culpa, this kind of workaround will hopefully not be needed in the future.
@porcuquine porcuquine force-pushed the feat/streaming-contribution branch from 52f0641 to 417d6fd Compare June 25, 2020 22:11
@porcuquine
Copy link
Collaborator Author

Closed in favor of #1188 .

@porcuquine porcuquine closed this Jun 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants