Skip to content
This repository was archived by the owner on Nov 6, 2020. It is now read-only.

Commit a4312e4

Browse files
committed
Merge remote-tracking branch 'upstream/master' into ethcore/VeriQueue-honor-cli-arg-num-workers
2 parents 1c6afc6 + c4af746 commit a4312e4

File tree

16 files changed

+100
-143
lines changed

16 files changed

+100
-143
lines changed

Cargo.lock

Lines changed: 19 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ethcore/light/src/client/header_chain.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ use cht;
3333
use ethcore::block_status::BlockStatus;
3434
use ethcore::encoded;
3535
use ethcore::engines::epoch::{Transition as EpochTransition, PendingTransition as PendingEpochTransition};
36-
use ethcore::error::{Error, BlockImportError, BlockImportErrorKind, BlockError};
36+
use ethcore::error::{Error, EthcoreResult, ErrorKind as EthcoreErrorKind, BlockError};
3737
use ethcore::header::Header;
3838
use ethcore::ids::BlockId;
3939
use ethcore::spec::{Spec, SpecHardcodedSync};
@@ -351,7 +351,7 @@ impl HeaderChain {
351351
transaction: &mut DBTransaction,
352352
header: &Header,
353353
transition_proof: Option<Vec<u8>>,
354-
) -> Result<PendingChanges, BlockImportError> {
354+
) -> EthcoreResult<PendingChanges> {
355355
self.insert_inner(transaction, header, None, transition_proof)
356356
}
357357

@@ -364,7 +364,7 @@ impl HeaderChain {
364364
header: &Header,
365365
total_difficulty: U256,
366366
transition_proof: Option<Vec<u8>>,
367-
) -> Result<PendingChanges, BlockImportError> {
367+
) -> EthcoreResult<PendingChanges> {
368368
self.insert_inner(transaction, header, Some(total_difficulty), transition_proof)
369369
}
370370

@@ -374,7 +374,7 @@ impl HeaderChain {
374374
header: &Header,
375375
total_difficulty: Option<U256>,
376376
transition_proof: Option<Vec<u8>>,
377-
) -> Result<PendingChanges, BlockImportError> {
377+
) -> EthcoreResult<PendingChanges> {
378378
let hash = header.hash();
379379
let number = header.number();
380380
let parent_hash = *header.parent_hash();
@@ -403,7 +403,7 @@ impl HeaderChain {
403403
.and_then(|entry| entry.candidates.iter().find(|c| c.hash == parent_hash))
404404
.map(|c| c.total_difficulty)
405405
.ok_or_else(|| BlockError::UnknownParent(parent_hash))
406-
.map_err(BlockImportErrorKind::Block)?
406+
.map_err(EthcoreErrorKind::Block)?
407407
};
408408

409409
parent_td + *header.difficulty()

ethcore/light/src/client/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ use ethcore::block_status::BlockStatus;
2222
use ethcore::client::{ClientReport, EnvInfo, ClientIoMessage};
2323
use ethcore::engines::{epoch, EthEngine, EpochChange, EpochTransition, Proof};
2424
use ethcore::machine::EthereumMachine;
25-
use ethcore::error::{Error, BlockImportError};
25+
use ethcore::error::{Error, EthcoreResult};
2626
use ethcore::ids::BlockId;
2727
use ethcore::header::{BlockNumber, Header};
2828
use ethcore::verification::queue::{self, HeaderQueue};
@@ -85,7 +85,7 @@ pub trait LightChainClient: Send + Sync {
8585

8686
/// Queue header to be verified. Required that all headers queued have their
8787
/// parent queued prior.
88-
fn queue_header(&self, header: Header) -> Result<H256, BlockImportError>;
88+
fn queue_header(&self, header: Header) -> EthcoreResult<H256>;
8989

9090
/// Attempt to get a block hash by block id.
9191
fn block_hash(&self, id: BlockId) -> Option<H256>;
@@ -206,7 +206,7 @@ impl<T: ChainDataFetcher> Client<T> {
206206
}
207207

208208
/// Import a header to the queue for additional verification.
209-
pub fn import_header(&self, header: Header) -> Result<H256, BlockImportError> {
209+
pub fn import_header(&self, header: Header) -> EthcoreResult<H256> {
210210
self.queue.import(header).map_err(Into::into)
211211
}
212212

@@ -526,7 +526,7 @@ impl<T: ChainDataFetcher> LightChainClient for Client<T> {
526526

527527
fn chain_info(&self) -> BlockChainInfo { Client::chain_info(self) }
528528

529-
fn queue_header(&self, header: Header) -> Result<H256, BlockImportError> {
529+
fn queue_header(&self, header: Header) -> EthcoreResult<H256> {
530530
self.import_header(header)
531531
}
532532

ethcore/res/ethereum/ropsten.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1979,7 +1979,7 @@
19791979
"enode://94c15d1b9e2fe7ce56e458b9a3b672ef11894ddedd0c6f247e0f1d3487f52b66208fb4aeb8179fce6e3a749ea93ed147c37976d67af557508d199d9594c35f09@192.81.208.223:30303",
19801980
"enode://30b7ab30a01c124a6cceca36863ece12c4f5fa68e3ba9b0b51407ccc002eeed3b3102d20a88f1c1d3c3154e2449317b8ef95090e77b312d5cc39354f86d5d606@52.176.7.10:30303",
19811981
"enode://865a63255b3bb68023b6bffd5095118fcc13e79dcf014fe4e47e065c350c7cc72af2e53eff895f11ba1bbb6a2b33271c1116ee870f266618eadfc2e78aa7349c@52.176.100.77:30303",
1982-
"enode://691907d5a7dee24884b791e799183e5db01f4fe0b6e9b795ffaf5cf85a3023a637f2abadc82fc0da168405092df869126377c5f190794cd2d1c067245ae2b1ce@54.180.81.196:30303"
1982+
"enode://691907d5a7dee24884b791e799183e5db01f4fe0b6e9b795ffaf5cf85a3023a637f2abadc82fc0da168405092df869126377c5f190794cd2d1c067245ae2b1ce@13.125.237.43:30303"
19831983
],
19841984
"accounts": {
19851985
"0000000000000000000000000000000000000000": { "balance": "1" },

ethcore/src/client/client.rs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -43,16 +43,16 @@ use client::{
4343
};
4444
use client::{
4545
BlockId, TransactionId, UncleId, TraceId, ClientConfig, BlockChainClient,
46-
TraceFilter, CallAnalytics, BlockImportError, Mode,
46+
TraceFilter, CallAnalytics, Mode,
4747
ChainNotify, ChainRoute, PruningInfo, ProvingBlockChainClient, EngineInfo, ChainMessageType,
4848
IoClient, BadBlocks,
4949
};
5050
use client::bad_blocks;
5151
use encoded;
5252
use engines::{EthEngine, EpochTransition, ForkChoice};
5353
use error::{
54-
ImportErrorKind, BlockImportErrorKind, ExecutionError, CallError, BlockError, ImportResult,
55-
QueueError, QueueErrorKind, Error as EthcoreError
54+
ImportErrorKind, ExecutionError, CallError, BlockError,
55+
QueueError, QueueErrorKind, Error as EthcoreError, EthcoreResult, ErrorKind as EthcoreErrorKind
5656
};
5757
use vm::{EnvInfo, LastHashes};
5858
use evm::Schedule;
@@ -1392,23 +1392,23 @@ impl CallContract for Client {
13921392
}
13931393

13941394
impl ImportBlock for Client {
1395-
fn import_block(&self, unverified: Unverified) -> Result<H256, BlockImportError> {
1395+
fn import_block(&self, unverified: Unverified) -> EthcoreResult<H256> {
13961396
if self.chain.read().is_known(&unverified.hash()) {
1397-
bail!(BlockImportErrorKind::Import(ImportErrorKind::AlreadyInChain));
1397+
bail!(EthcoreErrorKind::Import(ImportErrorKind::AlreadyInChain));
13981398
}
13991399

14001400
let status = self.block_status(BlockId::Hash(unverified.parent_hash()));
14011401
if status == BlockStatus::Unknown {
1402-
bail!(BlockImportErrorKind::Block(BlockError::UnknownParent(unverified.parent_hash())));
1402+
bail!(EthcoreErrorKind::Block(BlockError::UnknownParent(unverified.parent_hash())));
14031403
}
14041404

14051405
let raw = unverified.bytes.clone();
1406-
match self.importer.block_queue.import(unverified).map_err(Into::into) {
1406+
match self.importer.block_queue.import(unverified) {
14071407
Ok(res) => Ok(res),
14081408
// we only care about block errors (not import errors)
1409-
Err(BlockImportError(BlockImportErrorKind::Block(err), _))=> {
1409+
Err(EthcoreError(EthcoreErrorKind::Block(err), _))=> {
14101410
self.importer.bad_blocks.report(raw, format!("{:?}", err));
1411-
bail!(BlockImportErrorKind::Block(err))
1411+
bail!(EthcoreErrorKind::Block(err))
14121412
},
14131413
Err(e) => Err(e),
14141414
}
@@ -2085,14 +2085,14 @@ impl IoClient for Client {
20852085
});
20862086
}
20872087

2088-
fn queue_ancient_block(&self, unverified: Unverified, receipts_bytes: Bytes) -> Result<H256, BlockImportError> {
2088+
fn queue_ancient_block(&self, unverified: Unverified, receipts_bytes: Bytes) -> EthcoreResult<H256> {
20892089
trace_time!("queue_ancient_block");
20902090

20912091
let hash = unverified.hash();
20922092
{
20932093
// check block order
20942094
if self.chain.read().is_known(&hash) {
2095-
bail!(BlockImportErrorKind::Import(ImportErrorKind::AlreadyInChain));
2095+
bail!(EthcoreErrorKind::Import(ImportErrorKind::AlreadyInChain));
20962096
}
20972097
let parent_hash = unverified.parent_hash();
20982098
// NOTE To prevent race condition with import, make sure to check queued blocks first
@@ -2101,7 +2101,7 @@ impl IoClient for Client {
21012101
if !is_parent_pending {
21022102
let status = self.block_status(BlockId::Hash(parent_hash));
21032103
if status == BlockStatus::Unknown {
2104-
bail!(BlockImportErrorKind::Block(BlockError::UnknownParent(parent_hash)));
2104+
bail!(EthcoreErrorKind::Block(BlockError::UnknownParent(parent_hash)));
21052105
}
21062106
}
21072107
}
@@ -2237,7 +2237,7 @@ impl ScheduleInfo for Client {
22372237
}
22382238

22392239
impl ImportSealedBlock for Client {
2240-
fn import_sealed_block(&self, block: SealedBlock) -> ImportResult {
2240+
fn import_sealed_block(&self, block: SealedBlock) -> EthcoreResult<H256> {
22412241
let h = block.header().hash();
22422242
let start = Instant::now();
22432243
let route = {

ethcore/src/client/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ pub use types::call_analytics::CallAnalytics;
5050
pub use executive::{Executed, Executive, TransactOptions};
5151
pub use vm::{LastHashes, EnvInfo};
5252

53-
pub use error::{BlockImportError, BlockImportErrorKind, TransactionImportError};
53+
pub use error::TransactionImportError;
5454
pub use verification::VerifierType;
5555

5656
mod traits;

ethcore/src/client/test_client.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ use blockchain::{TreeRoute, BlockReceipts};
3737
use client::{
3838
Nonce, Balance, ChainInfo, BlockInfo, ReopenBlock, CallContract, TransactionInfo, RegistryInfo,
3939
PrepareOpenBlock, BlockChainClient, BlockChainInfo, BlockStatus, BlockId, Mode,
40-
TransactionId, UncleId, TraceId, TraceFilter, LastHashes, CallAnalytics, BlockImportError,
40+
TransactionId, UncleId, TraceId, TraceFilter, LastHashes, CallAnalytics,
4141
ProvingBlockChainClient, ScheduleInfo, ImportSealedBlock, BroadcastProposalBlock, ImportBlock, StateOrBlock,
4242
Call, StateClient, EngineInfo, AccountData, BlockChain, BlockProducer, SealedBlockImporter, IoClient,
4343
BadBlocks,
@@ -47,7 +47,7 @@ use header::{Header as BlockHeader, BlockNumber};
4747
use filter::Filter;
4848
use log_entry::LocalizedLogEntry;
4949
use receipt::{Receipt, LocalizedReceipt, TransactionOutcome};
50-
use error::{Error, ImportResult};
50+
use error::{Error, EthcoreResult};
5151
use vm::Schedule;
5252
use miner::{self, Miner, MinerService};
5353
use spec::Spec;
@@ -416,7 +416,7 @@ impl ScheduleInfo for TestBlockChainClient {
416416
}
417417

418418
impl ImportSealedBlock for TestBlockChainClient {
419-
fn import_sealed_block(&self, _block: SealedBlock) -> ImportResult {
419+
fn import_sealed_block(&self, _block: SealedBlock) -> EthcoreResult<H256> {
420420
Ok(H256::default())
421421
}
422422
}
@@ -523,7 +523,7 @@ impl RegistryInfo for TestBlockChainClient {
523523
}
524524

525525
impl ImportBlock for TestBlockChainClient {
526-
fn import_block(&self, unverified: Unverified) -> Result<H256, BlockImportError> {
526+
fn import_block(&self, unverified: Unverified) -> EthcoreResult<H256> {
527527
let header = unverified.header;
528528
let h = header.hash();
529529
let number: usize = header.number() as usize;
@@ -883,7 +883,7 @@ impl IoClient for TestBlockChainClient {
883883
self.miner.import_external_transactions(self, txs);
884884
}
885885

886-
fn queue_ancient_block(&self, unverified: Unverified, _r: Bytes) -> Result<H256, BlockImportError> {
886+
fn queue_ancient_block(&self, unverified: Unverified, _r: Bytes) -> EthcoreResult<H256> {
887887
self.import_block(unverified)
888888
}
889889

0 commit comments

Comments
 (0)