Skip to content

Commit a91edf7

Browse files
Seulgi Kimsgkim126
authored andcommitted
Use 2018 edition
1 parent a0cd93a commit a91edf7

File tree

53 files changed

+70
-39
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+70
-39
lines changed

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ exclude = [
1212
"spec/*",
1313
"test/*",
1414
]
15+
edition = "2018"
1516

1617
[dependencies]
1718
app_dirs = "^1.2.1"

core/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
name = "codechain-core"
33
version = "0.1.0"
44
authors = ["CodeChain Team <[email protected]>"]
5+
edition = "2018"
56

67
[dependencies]
78
codechain-crypto = { git = "https://github.com/CodeChain-io/rust-codechain-crypto.git", version = "0.1" }

core/src/client/client.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ impl Client {
9292
message_channel: IoChannel<ClientIoMessage>,
9393
reseal_timer: TimerApi,
9494
) -> Result<Arc<Client>, Error> {
95-
let journal_db = journaldb::new(Arc::clone(&db), journaldb::Algorithm::Archive, ::db::COL_STATE);
95+
let journal_db = journaldb::new(Arc::clone(&db), journaldb::Algorithm::Archive, crate::db::COL_STATE);
9696
let mut state_db = StateDB::new(journal_db);
9797
if !scheme.check_genesis_root(state_db.as_hashdb()) {
9898
return Err(SchemeError::InvalidState.into())
@@ -607,7 +607,7 @@ impl BlockChainTrait for Client {
607607
self.genesis_accounts.iter().map(|addr| PlatformAddress::new_v1(network_id, *addr)).collect()
608608
}
609609

610-
fn block_header(&self, id: &BlockId) -> Option<::encoded::Header> {
610+
fn block_header(&self, id: &BlockId) -> Option<encoded::Header> {
611611
let chain = self.block_chain();
612612

613613
Self::block_hash(&chain, id).and_then(|hash| chain.block_header_data(&hash))
@@ -635,7 +635,7 @@ impl BlockChainTrait for Client {
635635
self.transaction_address(id).map(|addr| addr.block_hash)
636636
}
637637

638-
fn transaction_header(&self, tracker: &Tracker) -> Option<::encoded::Header> {
638+
fn transaction_header(&self, tracker: &Tracker) -> Option<encoded::Header> {
639639
self.transaction_addresses(tracker).map(|addr| addr.block_hash).and_then(|hash| self.block_header(&hash.into()))
640640
}
641641
}
@@ -655,7 +655,7 @@ impl ImportBlock for Client {
655655
}
656656

657657
fn import_header(&self, bytes: Bytes) -> Result<BlockHash, BlockImportError> {
658-
let unverified = ::encoded::Header::new(bytes).decode();
658+
let unverified = encoded::Header::new(bytes).decode();
659659
{
660660
if self.block_chain().is_known_header(&unverified.hash()) {
661661
return Err(BlockImportError::Import(ImportError::AlreadyInChain))

core/src/client/importer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ use rlp::Encodable;
2929
use super::{BlockChainTrait, Client, ClientConfig};
3030
use crate::block::{enact, IsBlock, LockedBlock};
3131
use crate::blockchain::{BodyProvider, HeaderProvider, ImportRoute};
32+
use crate::client::EngineInfo;
3233
use crate::consensus::CodeChainEngine;
3334
use crate::error::Error;
3435
use crate::miner::{Miner, MinerService};
@@ -37,7 +38,6 @@ use crate::types::BlockId;
3738
use crate::verification::queue::{BlockQueue, HeaderQueue};
3839
use crate::verification::{self, PreverifiedBlock, Verifier};
3940
use crate::views::{BlockView, HeaderView};
40-
use client::EngineInfo;
4141

4242
pub struct Importer {
4343
/// Lock used during block import

core/src/client/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ pub trait BlockChainTrait {
7575
/// Get the hash of block that contains the transaction, if any.
7676
fn transaction_block(&self, id: &TransactionId) -> Option<BlockHash>;
7777

78-
fn transaction_header(&self, tracker: &Tracker) -> Option<::encoded::Header>;
78+
fn transaction_header(&self, tracker: &Tracker) -> Option<encoded::Header>;
7979

8080
fn transaction_block_number(&self, tracker: &Tracker) -> Option<BlockNumber> {
8181
self.transaction_header(tracker).map(|header| header.number())

core/src/client/test_client.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,9 @@ use rlp::*;
5454

5555
use crate::block::{ClosedBlock, OpenBlock, SealedBlock};
5656
use crate::blockchain_info::BlockChainInfo;
57-
use crate::client::ImportResult;
5857
use crate::client::{
59-
AccountData, BlockChainClient, BlockChainTrait, BlockProducer, BlockStatus, EngineInfo, ImportBlock,
60-
MiningBlockChainClient, StateInfo, StateOrBlock, TermInfo,
58+
AccountData, BlockChainClient, BlockChainTrait, BlockProducer, BlockStatus, ConsensusClient, EngineInfo,
59+
ImportBlock, ImportResult, MiningBlockChainClient, StateInfo, StateOrBlock, TermInfo,
6160
};
6261
use crate::consensus::stake::{Validator, Validators};
6362
use crate::consensus::EngineError;
@@ -68,7 +67,6 @@ use crate::miner::{Miner, MinerService, TransactionImportResult};
6867
use crate::scheme::Scheme;
6968
use crate::transaction::{LocalizedTransaction, PendingSignedTransactions, SignedTransaction};
7069
use crate::types::{BlockId, TransactionId, VerificationQueueInfo as QueueInfo};
71-
use client::ConsensusClient;
7270

7371
/// Test client.
7472
pub struct TestBlockChainClient {
@@ -459,7 +457,7 @@ impl BlockChainTrait for TestBlockChainClient {
459457
None // Simple default.
460458
}
461459

462-
fn transaction_header(&self, _tracker: &Tracker) -> Option<::encoded::Header> {
460+
fn transaction_header(&self, _tracker: &Tracker) -> Option<encoded::Header> {
463461
None
464462
}
465463
}

core/src/consensus/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ use crate::codechain_machine::CodeChainMachine;
5656
use crate::error::Error;
5757
use crate::transaction::UnverifiedTransaction;
5858
use crate::views::HeaderView;
59-
use Client;
59+
use crate::Client;
6060

6161
pub enum Seal {
6262
Solo,

core/src/consensus/stake/actions.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ use std::sync::Arc;
1818

1919
use ccrypto::Blake;
2020
use ckey::{recover, Address, Signature};
21-
use client::ConsensusClient;
2221
use ctypes::errors::SyntaxError;
2322
use ctypes::CommonParams;
2423
use primitives::{Bytes, H256};
2524
use rlp::{Decodable, DecoderError, Encodable, Rlp, RlpStream};
2625

26+
use crate::client::ConsensusClient;
2727
use crate::consensus::{ConsensusMessage, ValidatorSet};
2828

2929
const ACTION_TAG_TRANSFER_CCS: u8 = 1;
@@ -358,9 +358,9 @@ impl Decodable for Action {
358358
#[cfg(test)]
359359
mod tests {
360360
use super::*;
361+
use crate::client::TestBlockChainClient;
362+
use crate::consensus::{ConsensusMessage, DynamicValidator, Step, VoteOn, VoteStep};
361363
use ckey::sign_schnorr;
362-
use client::TestBlockChainClient;
363-
use consensus::{ConsensusMessage, DynamicValidator, Step, VoteOn, VoteStep};
364364
use ctypes::BlockHash;
365365
use rlp::rlp_encode_and_decode_test;
366366

core/src/consensus/stake/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,7 @@ mod tests {
547547
use super::action_data::get_account_key;
548548
use super::*;
549549

550-
use consensus::stake::action_data::{get_delegation_key, Candidate, Prisoner};
550+
use crate::consensus::stake::action_data::{get_delegation_key, Candidate, Prisoner};
551551
use cstate::tests::helpers;
552552
use cstate::TopStateView;
553553
use rlp::Encodable;

core/src/consensus/tendermint/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ pub use self::types::{Height, Step, View};
4141
use super::{stake, ValidatorSet};
4242
use crate::client::ConsensusClient;
4343
use crate::codechain_machine::CodeChainMachine;
44-
use ChainNotify;
44+
use crate::ChainNotify;
4545

4646
/// Timer token representing the consensus step timeouts.
4747
const ENGINE_TIMEOUT_TOKEN_NONCE_BASE: TimerToken = 23;

0 commit comments

Comments
 (0)