Remove warnings, restructure validation files

This commit is contained in:
Paul Hauner 2018-09-22 15:53:31 +10:00
parent 67f2850d37
commit 4d3422d332
No known key found for this signature in database
GPG Key ID: 303E4494BB28068C
7 changed files with 19 additions and 21 deletions

View File

@ -36,6 +36,9 @@ impl DiskDB {
let mut options = Options::default();
options.create_if_missing(true);
// TODO: ensure that columns are created (and remove
// the dead_code allow)
/*
* Initialise the path
*/
@ -58,6 +61,7 @@ impl DiskDB {
/// Create a RocksDB column family. Corresponds to the
/// `create_cf()` function on the RocksDB API.
#[allow(dead_code)]
fn create_col(&mut self, col: &str)
-> Result<(), DBError>
{

View File

@ -21,7 +21,7 @@ impl<T: ClientDB> ValidatorStore<T> {
pub fn put_validator_record_by_index(&self, hash: &[u8], val: &[u8])
-> Result<(), DBError>
{
self.db.put(DB_COLUMN, hash, &vec![0])
self.db.put(DB_COLUMN, hash, val)
}
pub fn get_validator_record_by_index(&self, hash: &[u8])

View File

@ -1,9 +1,6 @@
/*
* Collection of helper functions used in the state transition modules
*/
use super::active_state::ActiveState;
use super::block::Block;
use super::chain_config::ChainConfig;
use super::utils::errors::ParameterError;
use super::utils::types::Hash256;

View File

@ -1,16 +1,8 @@
use super::block;
use super::Logger;
use super::utils::types::Hash256;
use super::utils::errors::ParameterError;
use super::db;
mod attestation_parent_hashes;
mod shuffling;
mod validate_block;
pub use self::attestation_parent_hashes::attestation_parent_hashes;
pub use self::shuffling::shuffle;

View File

@ -1,7 +1,13 @@
/*
use super::crystallized_state::CrystallizedState;
use super::active_state::ActiveState;
use super::attestation_record::AttestationRecord;
use super::block::Block;
use super::chain_config::ChainConfig;
*/
use super::block;
use super::Logger;
use super::db;
mod attestation_validation;
// mod attestation_validation;
mod ssz_block;

View File

@ -16,7 +16,6 @@ pub enum BlockStatus {
}
pub enum SszBlockValidationError {
SszInvalid,
FutureSlot,
UnknownPoWChainRef,
DatabaseError(String),
@ -28,13 +27,13 @@ impl From<DBError> for SszBlockValidationError {
}
}
#[allow(dead_code)]
pub fn validate_ssz_block<T>(b: &SszBlock,
expected_slot: u64,
block_store: &BlockStore<T>,
pow_store: &PoWChainStore<T>,
validator_store: &ValidatorStore<T>,
log: &Logger)
expected_slot: u64,
block_store: &BlockStore<T>,
pow_store: &PoWChainStore<T>,
_validator_store: &ValidatorStore<T>,
_log: &Logger)
-> Result<BlockStatus, SszBlockValidationError>
where T: Sized + ClientDB
{

View File

@ -1,7 +1,7 @@
#[macro_export]
macro_rules! assert_error {
($exp: expr, $err: expr) => {
if ( !$exp ) {
if !$exp {
return Err($err);
}
}