Commit Graph

5 Commits

Author SHA1 Message Date
teor eb2e58ba53
Security: reject compact sizes greater than the protocol message limit (#2155)
These sizes should be impossible in valid messages.
So they likely represent a memory preallocation attack.
2021-05-17 18:23:06 -04:00
teor 456842aa86 Run the equihash tests on every block test vector 2020-10-28 21:24:28 -04:00
teor 77e227dfe4 Fix some function docs and parameter names 2020-10-13 08:11:11 +10:00
Ramana Venkata 7118e4da3c Move is_equihash_solution_valid to zebra-consensus 2020-09-09 12:48:15 +10:00
Henry de Valence 855b89dec4 chain: create a new work module for proof-of-work
This extracts the `difficulty` module from `block` and the
`equihash_solution` module from the crate root.  The PoW calculations
are significantly more complicated than the other block code and pretty
dissimilar from it, so it makes more sense to create a common proof of
work module.

The `EquihashSolution` and `EQUIHASH_SOLUTION_SIZE` are renamed to
`equihash::Solution` and `equihash::SOLUTION_SIZE` and imported that
way, except in `block/header.rs`, to avoid a conflict with the
`equihash` crate.  In the future it would be better to encapsulate the
equihash solution check into the `equihash::Solution` type so that
callers only need to import our `work::equihash`.

The test organization leaves a little to be desired but I think that
this can be improved as we fill out the proof of work implementation.
2020-08-17 11:46:34 -07:00