make verification module public
This commit is contained in:
parent
edf17d00c4
commit
5cabb3008f
@ -137,7 +137,7 @@ pub mod miner;
|
|||||||
pub mod snapshot;
|
pub mod snapshot;
|
||||||
pub mod action_params;
|
pub mod action_params;
|
||||||
pub mod db;
|
pub mod db;
|
||||||
pub mod light;
|
pub mod verification;
|
||||||
#[macro_use] pub mod evm;
|
#[macro_use] pub mod evm;
|
||||||
|
|
||||||
mod cache_manager;
|
mod cache_manager;
|
||||||
@ -151,7 +151,6 @@ mod account_db;
|
|||||||
mod builtin;
|
mod builtin;
|
||||||
mod executive;
|
mod executive;
|
||||||
mod externalities;
|
mod externalities;
|
||||||
mod verification;
|
|
||||||
mod blockchain;
|
mod blockchain;
|
||||||
mod types;
|
mod types;
|
||||||
mod factory;
|
mod factory;
|
||||||
|
@ -14,6 +14,8 @@
|
|||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
//! Canonical verifier.
|
||||||
|
|
||||||
use blockchain::BlockProvider;
|
use blockchain::BlockProvider;
|
||||||
use engines::Engine;
|
use engines::Engine;
|
||||||
use error::Error;
|
use error::Error;
|
||||||
@ -21,6 +23,7 @@ use header::Header;
|
|||||||
use super::Verifier;
|
use super::Verifier;
|
||||||
use super::verification;
|
use super::verification;
|
||||||
|
|
||||||
|
/// A canonial verifier -- this does full verification.
|
||||||
pub struct CanonVerifier;
|
pub struct CanonVerifier;
|
||||||
|
|
||||||
impl Verifier for CanonVerifier {
|
impl Verifier for CanonVerifier {
|
||||||
|
@ -14,6 +14,8 @@
|
|||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
//! Block verification utilities.
|
||||||
|
|
||||||
pub mod verification;
|
pub mod verification;
|
||||||
pub mod verifier;
|
pub mod verifier;
|
||||||
pub mod queue;
|
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> {
|
pub fn new(v: VerifierType) -> Box<Verifier> {
|
||||||
match v {
|
match v {
|
||||||
VerifierType::Canon | VerifierType::CanonNoSeal => Box::new(CanonVerifier),
|
VerifierType::Canon | VerifierType::CanonNoSeal => Box::new(CanonVerifier),
|
||||||
|
@ -14,12 +14,15 @@
|
|||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
//! No-op verifier.
|
||||||
|
|
||||||
use blockchain::BlockProvider;
|
use blockchain::BlockProvider;
|
||||||
use engines::Engine;
|
use engines::Engine;
|
||||||
use error::Error;
|
use error::Error;
|
||||||
use header::Header;
|
use header::Header;
|
||||||
use super::Verifier;
|
use super::Verifier;
|
||||||
|
|
||||||
|
/// A no-op verifier -- this will verify everything it's given immediately.
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
pub struct NoopVerifier;
|
pub struct NoopVerifier;
|
||||||
|
|
||||||
|
@ -14,12 +14,12 @@
|
|||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
/// Block and transaction verification functions
|
//! Block and transaction verification functions
|
||||||
///
|
//!
|
||||||
/// Block verification is done in 3 steps
|
//! Block verification is done in 3 steps
|
||||||
/// 1. Quick verification upon adding to the block queue
|
//! 1. Quick verification upon adding to the block queue
|
||||||
/// 2. Signatures verification done in the queue.
|
//! 2. Signatures verification done in the queue.
|
||||||
/// 3. Final verification against the blockchain done before enactment.
|
//! 3. Final verification against the blockchain done before enactment.
|
||||||
|
|
||||||
use util::*;
|
use util::*;
|
||||||
use engines::Engine;
|
use engines::Engine;
|
||||||
|
@ -14,6 +14,8 @@
|
|||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
//! A generic verifier trait.
|
||||||
|
|
||||||
use blockchain::BlockProvider;
|
use blockchain::BlockProvider;
|
||||||
use engines::Engine;
|
use engines::Engine;
|
||||||
use error::Error;
|
use error::Error;
|
||||||
@ -21,6 +23,8 @@ use header::Header;
|
|||||||
|
|
||||||
/// Should be used to verify blocks.
|
/// Should be used to verify blocks.
|
||||||
pub trait Verifier: Send + Sync {
|
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>;
|
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>;
|
fn verify_block_final(&self, expected: &Header, got: &Header) -> Result<(), Error>;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user