-
Notifications
You must be signed in to change notification settings - Fork 113
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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.
- Loading branch information
1 parent
dad6340
commit 855b89d
Showing
14 changed files
with
306 additions
and
290 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
//! Proof-of-work implementation. | ||
pub mod difficulty; | ||
pub mod equihash; | ||
|
||
#[cfg(test)] | ||
mod tests; |
File renamed without changes.
2 changes: 0 additions & 2 deletions
2
zebra-chain/src/block/difficulty/tests.rs → zebra-chain/src/work/difficulty/tests.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
//! Tests for difficulty and work | ||
use super::*; | ||
|
||
use crate::block::Block; | ||
|
Oops, something went wrong.