2019-01-07 11:33:07 +01:00
|
|
|
// Copyright 2015-2019 Parity Technologies (UK) Ltd.
|
|
|
|
// This file is part of Parity Ethereum.
|
2016-03-04 11:56:04 +01:00
|
|
|
|
2019-01-07 11:33:07 +01:00
|
|
|
// Parity Ethereum is free software: you can redistribute it and/or modify
|
2016-03-04 11:56:04 +01:00
|
|
|
// 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.
|
|
|
|
|
2019-01-07 11:33:07 +01:00
|
|
|
// Parity Ethereum is distributed in the hope that it will be useful,
|
2016-03-04 11:56:04 +01:00
|
|
|
// 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
|
2019-01-07 11:33:07 +01:00
|
|
|
// along with Parity Ethereum. If not, see <http://www.gnu.org/licenses/>.
|
2016-03-04 11:56:04 +01:00
|
|
|
|
2016-11-10 18:30:17 +01:00
|
|
|
//! Block verification utilities.
|
|
|
|
|
2019-08-28 10:09:42 +02:00
|
|
|
// The MallocSizeOf derive looks for this in the root
|
|
|
|
use parity_util_mem as malloc_size_of;
|
2019-08-23 15:32:58 +02:00
|
|
|
|
2019-09-11 14:15:19 +02:00
|
|
|
#[cfg(feature = "bench" )]
|
|
|
|
pub mod verification;
|
|
|
|
#[cfg(not(feature = "bench" ))]
|
2018-07-25 14:36:46 +02:00
|
|
|
mod verification;
|
2016-09-27 16:50:24 +02:00
|
|
|
pub mod queue;
|
2019-09-11 14:15:19 +02:00
|
|
|
#[cfg(any(test, feature = "bench" ))]
|
|
|
|
pub mod test_helpers;
|
2016-03-04 11:56:04 +01:00
|
|
|
|
2019-11-12 15:05:49 +01:00
|
|
|
pub use self::verification::{FullFamilyParams, verify_block_family, verify_block_final};
|
2019-08-23 15:32:58 +02:00
|
|
|
pub use self::queue::{BlockQueue, Config as QueueConfig};
|
2016-06-28 13:23:15 +02:00
|
|
|
|
|
|
|
/// Verifier type.
|
2016-09-06 15:31:13 +02:00
|
|
|
#[derive(Debug, PartialEq, Clone)]
|
2016-06-28 13:23:15 +02:00
|
|
|
pub enum VerifierType {
|
|
|
|
/// Verifies block normally.
|
|
|
|
Canon,
|
2019-07-18 12:27:08 +02:00
|
|
|
/// Verifies block normally, but skips seal verification.
|
2016-10-24 15:09:13 +02:00
|
|
|
CanonNoSeal,
|
2016-06-28 13:23:15 +02:00
|
|
|
}
|
2016-10-24 15:09:13 +02:00
|
|
|
|
|
|
|
impl VerifierType {
|
|
|
|
/// Check if seal verification is enabled for this verifier type.
|
|
|
|
pub fn verifying_seal(&self) -> bool {
|
|
|
|
match *self {
|
|
|
|
VerifierType::Canon => true,
|
2019-11-12 15:05:49 +01:00
|
|
|
VerifierType::CanonNoSeal => false,
|
2016-10-24 15:09:13 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|