make verification module public

This commit is contained in:
Robert Habermeier 2016-11-04 19:21:48 +01:00
parent edf17d00c4
commit 5cabb3008f
6 changed files with 20 additions and 8 deletions

View File

@ -137,7 +137,7 @@ pub mod miner;
pub mod snapshot;
pub mod action_params;
pub mod db;
pub mod light;
pub mod verification;
#[macro_use] pub mod evm;
mod cache_manager;
@ -151,7 +151,6 @@ mod account_db;
mod builtin;
mod executive;
mod externalities;
mod verification;
mod blockchain;
mod types;
mod factory;

View File

@ -14,6 +14,8 @@
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
//! Canonical verifier.
use blockchain::BlockProvider;
use engines::Engine;
use error::Error;
@ -21,6 +23,7 @@ use header::Header;
use super::Verifier;
use super::verification;
/// A canonial verifier -- this does full verification.
pub struct CanonVerifier;
impl Verifier for CanonVerifier {

View File

@ -14,6 +14,8 @@
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
//! Block verification utilities.
pub mod verification;
pub mod verifier;
pub mod queue;
@ -44,6 +46,7 @@ impl Default for VerifierType {
}
}
/// Create a new verifier based on type.
pub fn new(v: VerifierType) -> Box<Verifier> {
match v {
VerifierType::Canon | VerifierType::CanonNoSeal => Box::new(CanonVerifier),

View File

@ -14,12 +14,15 @@
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
//! No-op verifier.
use blockchain::BlockProvider;
use engines::Engine;
use error::Error;
use header::Header;
use super::Verifier;
/// A no-op verifier -- this will verify everything it's given immediately.
#[allow(dead_code)]
pub struct NoopVerifier;

View File

@ -14,12 +14,12 @@
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
/// Block and transaction verification functions
///
/// Block verification is done in 3 steps
/// 1. Quick verification upon adding to the block queue
/// 2. Signatures verification done in the queue.
/// 3. Final verification against the blockchain done before enactment.
//! Block and transaction verification functions
//!
//! Block verification is done in 3 steps
//! 1. Quick verification upon adding to the block queue
//! 2. Signatures verification done in the queue.
//! 3. Final verification against the blockchain done before enactment.
use util::*;
use engines::Engine;

View File

@ -14,6 +14,8 @@
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
//! A generic verifier trait.
use blockchain::BlockProvider;
use engines::Engine;
use error::Error;
@ -21,6 +23,8 @@ use header::Header;
/// Should be used to verify blocks.
pub trait Verifier: Send + Sync {
/// Verify a block relative to its parent and uncles.
fn verify_block_family(&self, header: &Header, bytes: &[u8], engine: &Engine, bc: &BlockProvider) -> Result<(), Error>;
/// Do a final verification check for an enacted header vs its expected counterpart.
fn verify_block_final(&self, expected: &Header, got: &Header) -> Result<(), Error>;
}