Fixing warnings

This commit is contained in:
Tomasz Drwięga
2016-04-06 10:07:24 +02:00
parent e8fa429438
commit 85da55a537
29 changed files with 105 additions and 92 deletions

View File

@@ -154,7 +154,7 @@ impl ExecutedBlock {
}
}
/// Trait for a object that is_a `ExecutedBlock`.
/// Trait for a object that is a `ExecutedBlock`.
pub trait IsBlock {
/// Get the block associated with this object.
fn block(&self) -> &ExecutedBlock;
@@ -192,7 +192,7 @@ pub struct OpenBlock<'x> {
last_hashes: LastHashes,
}
/// Just like OpenBlock, except that we've applied `Engine::on_close_block`, finished up the non-seal header fields,
/// Just like `OpenBlock`, except that we've applied `Engine::on_close_block`, finished up the non-seal header fields,
/// and collected the uncles.
///
/// There is no function available to push a transaction.
@@ -204,7 +204,7 @@ pub struct ClosedBlock {
unclosed_state: State,
}
/// Just like ClosedBlock except that we can't reopen it and it's faster.
/// Just like `ClosedBlock` except that we can't reopen it and it's faster.
///
/// We actually store the post-`Engine::on_close_block` state, unlike in `ClosedBlock` where it's the pre.
#[derive(Clone)]
@@ -216,14 +216,15 @@ pub struct LockedBlock {
/// A block that has a valid seal.
///
/// The block's header has valid seal arguments. The block cannot be reversed into a ClosedBlock or OpenBlock.
/// The block's header has valid seal arguments. The block cannot be reversed into a `ClosedBlock` or `OpenBlock`.
pub struct SealedBlock {
block: ExecutedBlock,
uncle_bytes: Bytes,
}
impl<'x> OpenBlock<'x> {
/// Create a new OpenBlock ready for transaction pushing.
#[cfg_attr(feature="dev", allow(too_many_arguments))]
/// Create a new `OpenBlock` ready for transaction pushing.
pub fn new(engine: &'x Engine, tracing: bool, db: Box<JournalDB>, parent: &Header, last_hashes: LastHashes, author: Address, gas_floor_target: U256, extra_data: Bytes) -> Self {
let mut r = OpenBlock {
block: ExecutedBlock::new(State::from_existing(db, parent.state_root().clone(), engine.account_start_nonce()), tracing),
@@ -319,7 +320,7 @@ impl<'x> OpenBlock<'x> {
}
}
/// Turn this into a `ClosedBlock`. A BlockChain must be provided in order to figure out the uncles.
/// Turn this into a `ClosedBlock`. A `BlockChain` must be provided in order to figure out the uncles.
pub fn close(self) -> ClosedBlock {
let mut s = self;
@@ -454,6 +455,7 @@ impl IsBlock for SealedBlock {
}
/// Enact the block given by block header, transactions and uncles
#[cfg_attr(feature="dev", allow(too_many_arguments))]
pub fn enact(header: &Header, transactions: &[SignedTransaction], uncles: &[Header], engine: &Engine, tracing: bool, db: Box<JournalDB>, parent: &Header, last_hashes: LastHashes) -> Result<LockedBlock, Error> {
{
if ::log::max_log_level() >= ::log::LogLevel::Trace {

View File

@@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
//! A queue of blocks. Sits between network or other I/O and the BlockChain.
//! A queue of blocks. Sits between network or other I/O and the `BlockChain`.
//! Sorts them ready for blockchain insertion.
use std::thread::{JoinHandle, self};
use std::sync::atomic::{AtomicBool, Ordering as AtomicOrdering};
@@ -89,7 +89,7 @@ impl BlockQueueInfo {
}
}
/// A queue of blocks. Sits between network or other I/O and the BlockChain.
/// A queue of blocks. Sits between network or other I/O and the `BlockChain`.
/// Sorts them ready for blockchain insertion.
pub struct BlockQueue {
panic_handler: Arc<PanicHandler>,

View File

@@ -427,6 +427,7 @@ impl BlockChain {
}
}
#[cfg_attr(feature="dev", allow(similar_names))]
/// Inserts the block into backing cache database.
/// Expects the block to be valid and already verified.
/// If the block is already known, does nothing.
@@ -855,6 +856,7 @@ impl BlockChain {
#[cfg(test)]
mod tests {
#![cfg_attr(feature="dev", allow(similar_names))]
use std::str::FromStr;
use rustc_serialize::hex::FromHex;
use util::hash::*;

View File

@@ -60,7 +60,7 @@ impl Indexer {
}
/// Return bloom which are dependencies for given index.
///
///
/// Bloom indexes are ordered from lowest to highest.
pub fn lower_level_bloom_indexes(&self, index: &BloomIndex) -> Vec<BloomIndex> {
// this is the lowest level
@@ -87,6 +87,7 @@ impl Indexer {
#[cfg(test)]
mod tests {
#![cfg_attr(feature="dev", allow(similar_names))]
use chainfilter::BloomIndex;
use chainfilter::indexer::Indexer;

View File

@@ -23,7 +23,7 @@ use chainfilter::{BloomIndex, FilterDataSource, ChainFilter};
/// In memory cache for blooms.
///
/// Stores all blooms in HashMap, which indexes them by `BloomIndex`.
/// Stores all blooms in `HashMap`, which indexes them by `BloomIndex`.
pub struct MemoryCache {
blooms: HashMap<BloomIndex, H2048>,
}

View File

@@ -44,7 +44,7 @@ pub enum Error {
/// Invoked instruction
instruction: &'static str,
/// How many stack elements was requested by instruction
wanted: usize,
wanted: usize,
/// How many elements were on stack
on_stack: usize
},
@@ -64,8 +64,8 @@ pub enum Error {
}
/// Evm result.
///
/// Returns gas_left if execution is successful, otherwise error.
///
/// Returns `gas_left` if execution is successful, otherwise error.
pub type Result = result::Result<U256, Error>;
/// Evm interface.

View File

@@ -55,7 +55,7 @@ pub fn verify_block_basic(header: &Header, bytes: &[u8], engine: &Engine) -> Res
/// Phase 2 verification. Perform costly checks such as transaction signatures and block nonce for ethash.
/// Still operates on a individual block
/// Returns a PreverifiedBlock structure populated with transactions
/// Returns a `PreverifiedBlock` structure populated with transactions
pub fn verify_block_unordered(header: Header, bytes: Bytes, engine: &Engine) -> Result<PreverifiedBlock, Error> {
try!(engine.verify_block_unordered(&header, Some(&bytes)));
for u in Rlp::new(&bytes).at(2).iter().map(|rlp| rlp.as_val::<Header>()) {
@@ -279,7 +279,7 @@ mod tests {
impl BlockProvider for TestBlockChain {
fn have_tracing(&self) -> bool { false }
fn is_known(&self, hash: &H256) -> bool {
self.blocks.contains_key(hash)
}
@@ -331,6 +331,7 @@ mod tests {
}
#[test]
#[cfg_attr(feature="dev", allow(similar_names))]
fn test_verify_block() {
// Test against morden
let mut good = Header::new();