This repository has been archived by the owner on Nov 6, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Initial Whisper implementation #6009
Merged
Changes from 38 commits
Commits
Show all changes
39 commits
Select commit
Hold shift + click to select a range
b7708b5
whisper skeleton
rphmeier 0ff28fe
basic message store
rphmeier 5c8a374
rallying and message logic
rphmeier 125389e
pass host info to network protocol handlers
rphmeier 61acfc6
choose who starts rally based on node key
rphmeier 7ecbb7f
module reshuffling
rphmeier 8122805
mining messages
rphmeier 1161a76
prune messages by low PoW until below size target
rphmeier 67a51d2
Merge branch 'master' into whisper
rphmeier 32575c6
associated error type for ethkey generators and `OsRng` generator
rphmeier 8bff980
beginnings of RPC
rphmeier fdb8cbc
generic message handler for whisper
rphmeier 435d494
reshuffle code order
rphmeier 4332566
standard payload encoding and decoding
rphmeier 79f6bfe
basic crypto
rphmeier 953ad99
minor restructuring of net code
rphmeier 9d09a67
implement shh_post
rphmeier a2af2e5
merge?
rphmeier 601f6cd
Merge branch 'master' into whisper
rphmeier 6837950
implement filters
rphmeier 975fb81
rand trait for hash types
rphmeier 03a839c
filter RPCs for whisper
rphmeier 034db4e
symmetric encryption of payload
rphmeier 2041439
pub-sub
rphmeier 6b8cd61
filter tests
rphmeier 7261b0c
use only secure random IDs
rphmeier e504198
attach arbitrary protocols to network
rphmeier 6acf0b5
basic integration of whisper into Parity
rphmeier 2cf05a7
eagerly prune low PoW entries
rphmeier 1e31280
broadcast messages with salted topics
rphmeier 860a68f
node info RPC
rphmeier fcf8b01
Merge branch 'master' into whisper
rphmeier ca8f8eb
Merge github.com:paritytech/parity into whisper
rphmeier 921f0d3
fix import
rphmeier a7bb56a
fix leading zeros calculation
rphmeier 79f03ea
Merge branch 'master' into whisper
rphmeier 7431461
Merge branch 'master' into whisper
rphmeier 9f0741f
Merge branch 'master' into whisper
rphmeier 69b2c7c
address minor grumbles
rphmeier File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// Copyright 2015-2017 Parity Technologies (UK) Ltd. | ||
// This file is part of Parity. | ||
|
||
// Parity is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
|
||
// Parity is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
|
||
// You should have received a copy of the GNU General Public License | ||
// along with Parity. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
// Epoch verifiers. | ||
|
||
use error::Error; | ||
use header::Header; | ||
|
||
/// Verifier for all blocks within an epoch with self-contained state. | ||
/// | ||
/// See docs on `Engine` relating to proving functions for more details. | ||
pub trait EpochVerifier: Send + Sync { | ||
/// Get the epoch number. | ||
fn epoch_number(&self) -> u64; | ||
|
||
/// Lightly verify the next block header. | ||
/// This may not be a header belonging to a different epoch. | ||
fn verify_light(&self, header: &Header) -> Result<(), Error>; | ||
|
||
/// Perform potentially heavier checks on the next block header. | ||
fn verify_heavy(&self, header: &Header) -> Result<(), Error> { | ||
self.verify_light(header) | ||
} | ||
|
||
/// Check if the header is the end of an epoch. | ||
fn is_epoch_end(&self, header: &Header, Ancestry) -> EpochChange; | ||
|
||
} | ||
|
||
/// Special "no-op" verifier for stateless, epoch-less engines. | ||
pub struct NoOp; | ||
|
||
impl EpochVerifier for NoOp { | ||
fn epoch_number(&self) -> u64 { 0 } | ||
fn verify_light(&self, _header: &Header) -> Result<(), Error> { Ok(()) } | ||
} |
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 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 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is invalid capabilities the only possible source of failure here? Why not just pass the error as it was before the change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's the only source of failure, yeah. @debris and I discussed making this function infallible before, and I figured this was a good time for it.