Merge branch 'master' of github.com:ethcore/parity into discovery
This commit is contained in:
commit
a2c0508792
@ -20,26 +20,6 @@ use util::*;
|
|||||||
use header::BlockNumber;
|
use header::BlockNumber;
|
||||||
use basic_types::LogBloom;
|
use basic_types::LogBloom;
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Eq)]
|
|
||||||
/// Error indicating an expected value was not found.
|
|
||||||
pub struct Mismatch<T: fmt::Debug> {
|
|
||||||
/// Value expected.
|
|
||||||
pub expected: T,
|
|
||||||
/// Value found.
|
|
||||||
pub found: T,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Eq)]
|
|
||||||
/// Error indicating value found is outside of a valid range.
|
|
||||||
pub struct OutOfBounds<T: fmt::Debug> {
|
|
||||||
/// Minimum allowed value.
|
|
||||||
pub min: Option<T>,
|
|
||||||
/// Maximum allowed value.
|
|
||||||
pub max: Option<T>,
|
|
||||||
/// Value found.
|
|
||||||
pub found: T,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Result of executing the transaction.
|
/// Result of executing the transaction.
|
||||||
#[derive(PartialEq, Debug)]
|
#[derive(PartialEq, Debug)]
|
||||||
pub enum ExecutionError {
|
pub enum ExecutionError {
|
||||||
|
@ -20,6 +20,7 @@ use rustc_serialize::hex::FromHexError;
|
|||||||
use network::NetworkError;
|
use network::NetworkError;
|
||||||
use rlp::DecoderError;
|
use rlp::DecoderError;
|
||||||
use io;
|
use io;
|
||||||
|
use std::fmt;
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
/// Error in database subsystem.
|
/// Error in database subsystem.
|
||||||
@ -55,6 +56,27 @@ pub enum UtilError {
|
|||||||
BadSize,
|
BadSize,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#[derive(Debug, PartialEq, Eq)]
|
||||||
|
/// Error indicating an expected value was not found.
|
||||||
|
pub struct Mismatch<T: fmt::Debug> {
|
||||||
|
/// Value expected.
|
||||||
|
pub expected: T,
|
||||||
|
/// Value found.
|
||||||
|
pub found: T,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, PartialEq, Eq)]
|
||||||
|
/// Error indicating value found is outside of a valid range.
|
||||||
|
pub struct OutOfBounds<T: fmt::Debug> {
|
||||||
|
/// Minimum allowed value.
|
||||||
|
pub min: Option<T>,
|
||||||
|
/// Maximum allowed value.
|
||||||
|
pub max: Option<T>,
|
||||||
|
/// Value found.
|
||||||
|
pub found: T,
|
||||||
|
}
|
||||||
|
|
||||||
impl From<FromHexError> for UtilError {
|
impl From<FromHexError> for UtilError {
|
||||||
fn from(err: FromHexError) -> UtilError {
|
fn from(err: FromHexError) -> UtilError {
|
||||||
UtilError::FromHex(err)
|
UtilError::FromHex(err)
|
||||||
|
1088
util/src/keys/directory.rs
Normal file
1088
util/src/keys/directory.rs
Normal file
File diff suppressed because it is too large
Load Diff
19
util/src/keys/mod.rs
Normal file
19
util/src/keys/mod.rs
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
// Copyright 2015, 2016 Ethcore (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/>.
|
||||||
|
|
||||||
|
//! Key management module
|
||||||
|
|
||||||
|
pub mod directory;
|
@ -142,6 +142,7 @@ pub mod io;
|
|||||||
pub mod network;
|
pub mod network;
|
||||||
pub mod log;
|
pub mod log;
|
||||||
pub mod panics;
|
pub mod panics;
|
||||||
|
pub mod keys;
|
||||||
|
|
||||||
pub use common::*;
|
pub use common::*;
|
||||||
pub use misc::*;
|
pub use misc::*;
|
||||||
@ -162,3 +163,6 @@ pub use semantic_version::*;
|
|||||||
pub use network::*;
|
pub use network::*;
|
||||||
pub use io::*;
|
pub use io::*;
|
||||||
pub use log::*;
|
pub use log::*;
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests;
|
||||||
|
31
util/src/tests/helpers.rs
Normal file
31
util/src/tests/helpers.rs
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
use common::*;
|
||||||
|
use std::path::PathBuf;
|
||||||
|
use std::fs::{remove_dir_all};
|
||||||
|
use std::env;
|
||||||
|
|
||||||
|
pub struct RandomTempPath {
|
||||||
|
path: PathBuf
|
||||||
|
}
|
||||||
|
|
||||||
|
impl RandomTempPath {
|
||||||
|
pub fn create_dir() -> RandomTempPath {
|
||||||
|
let mut dir = env::temp_dir();
|
||||||
|
dir.push(H32::random().hex());
|
||||||
|
fs::create_dir_all(dir.as_path()).unwrap();
|
||||||
|
RandomTempPath {
|
||||||
|
path: dir.clone()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn as_path(&self) -> &PathBuf {
|
||||||
|
&self.path
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Drop for RandomTempPath {
|
||||||
|
fn drop(&mut self) {
|
||||||
|
if let Err(e) = remove_dir_all(self.as_path()) {
|
||||||
|
panic!("failed to remove temp directory, probably something failed to destroyed ({})", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
1
util/src/tests/mod.rs
Normal file
1
util/src/tests/mod.rs
Normal file
@ -0,0 +1 @@
|
|||||||
|
pub mod helpers;
|
Loading…
Reference in New Issue
Block a user