Remove warnings, restructure validation files
This commit is contained in:
parent
67f2850d37
commit
4d3422d332
@ -36,6 +36,9 @@ impl DiskDB {
|
|||||||
let mut options = Options::default();
|
let mut options = Options::default();
|
||||||
options.create_if_missing(true);
|
options.create_if_missing(true);
|
||||||
|
|
||||||
|
// TODO: ensure that columns are created (and remove
|
||||||
|
// the dead_code allow)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Initialise the path
|
* Initialise the path
|
||||||
*/
|
*/
|
||||||
@ -58,6 +61,7 @@ impl DiskDB {
|
|||||||
|
|
||||||
/// Create a RocksDB column family. Corresponds to the
|
/// Create a RocksDB column family. Corresponds to the
|
||||||
/// `create_cf()` function on the RocksDB API.
|
/// `create_cf()` function on the RocksDB API.
|
||||||
|
#[allow(dead_code)]
|
||||||
fn create_col(&mut self, col: &str)
|
fn create_col(&mut self, col: &str)
|
||||||
-> Result<(), DBError>
|
-> Result<(), DBError>
|
||||||
{
|
{
|
||||||
|
@ -21,7 +21,7 @@ impl<T: ClientDB> ValidatorStore<T> {
|
|||||||
pub fn put_validator_record_by_index(&self, hash: &[u8], val: &[u8])
|
pub fn put_validator_record_by_index(&self, hash: &[u8], val: &[u8])
|
||||||
-> Result<(), DBError>
|
-> 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])
|
pub fn get_validator_record_by_index(&self, hash: &[u8])
|
||||||
|
@ -1,9 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Collection of helper functions used in the state transition modules
|
* 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::errors::ParameterError;
|
||||||
use super::utils::types::Hash256;
|
use super::utils::types::Hash256;
|
||||||
|
|
||||||
|
@ -1,16 +1,8 @@
|
|||||||
use super::block;
|
|
||||||
use super::Logger;
|
|
||||||
use super::utils::types::Hash256;
|
use super::utils::types::Hash256;
|
||||||
use super::utils::errors::ParameterError;
|
use super::utils::errors::ParameterError;
|
||||||
use super::db;
|
|
||||||
|
|
||||||
mod attestation_parent_hashes;
|
mod attestation_parent_hashes;
|
||||||
mod shuffling;
|
mod shuffling;
|
||||||
mod validate_block;
|
|
||||||
|
|
||||||
pub use self::attestation_parent_hashes::attestation_parent_hashes;
|
pub use self::attestation_parent_hashes::attestation_parent_hashes;
|
||||||
pub use self::shuffling::shuffle;
|
pub use self::shuffling::shuffle;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,7 +1,13 @@
|
|||||||
|
/*
|
||||||
use super::crystallized_state::CrystallizedState;
|
use super::crystallized_state::CrystallizedState;
|
||||||
use super::active_state::ActiveState;
|
use super::active_state::ActiveState;
|
||||||
use super::attestation_record::AttestationRecord;
|
use super::attestation_record::AttestationRecord;
|
||||||
use super::block::Block;
|
use super::block::Block;
|
||||||
use super::chain_config::ChainConfig;
|
use super::chain_config::ChainConfig;
|
||||||
|
*/
|
||||||
|
use super::block;
|
||||||
|
use super::Logger;
|
||||||
|
use super::db;
|
||||||
|
|
||||||
mod attestation_validation;
|
// mod attestation_validation;
|
||||||
|
mod ssz_block;
|
||||||
|
@ -16,7 +16,6 @@ pub enum BlockStatus {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub enum SszBlockValidationError {
|
pub enum SszBlockValidationError {
|
||||||
SszInvalid,
|
|
||||||
FutureSlot,
|
FutureSlot,
|
||||||
UnknownPoWChainRef,
|
UnknownPoWChainRef,
|
||||||
DatabaseError(String),
|
DatabaseError(String),
|
||||||
@ -28,13 +27,13 @@ impl From<DBError> for SszBlockValidationError {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(dead_code)]
|
||||||
pub fn validate_ssz_block<T>(b: &SszBlock,
|
pub fn validate_ssz_block<T>(b: &SszBlock,
|
||||||
expected_slot: u64,
|
expected_slot: u64,
|
||||||
block_store: &BlockStore<T>,
|
block_store: &BlockStore<T>,
|
||||||
pow_store: &PoWChainStore<T>,
|
pow_store: &PoWChainStore<T>,
|
||||||
validator_store: &ValidatorStore<T>,
|
_validator_store: &ValidatorStore<T>,
|
||||||
log: &Logger)
|
_log: &Logger)
|
||||||
-> Result<BlockStatus, SszBlockValidationError>
|
-> Result<BlockStatus, SszBlockValidationError>
|
||||||
where T: Sized + ClientDB
|
where T: Sized + ClientDB
|
||||||
{
|
{
|
@ -1,7 +1,7 @@
|
|||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! assert_error {
|
macro_rules! assert_error {
|
||||||
($exp: expr, $err: expr) => {
|
($exp: expr, $err: expr) => {
|
||||||
if ( !$exp ) {
|
if !$exp {
|
||||||
return Err($err);
|
return Err($err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user