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

Client refactoring #7038

Merged
merged 130 commits into from
Mar 3, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
130 commits
Select commit Hold shift + click to select a range
a1c21ca
Improves `BestBlock` comment
0x7CFE Nov 13, 2017
ff2209f
Improves `TraceDB` comment
0x7CFE Nov 13, 2017
bf49cc0
Improves `journaldb::Algorithm` comment.
0x7CFE Nov 13, 2017
0d19f6b
Comments some of the `Client`'s fields
0x7CFE Nov 13, 2017
34f9feb
Deglobs client imports
0x7CFE Nov 13, 2017
a1c126b
Fixes comments
0x7CFE Nov 14, 2017
182ccd2
Extracts `import_lock` to `Importer` struct
0x7CFE Nov 14, 2017
7c76730
Extracts `verifier` to `Importer` struct
0x7CFE Nov 14, 2017
070aa12
Extracts `block_queue` to `Importer` struct
0x7CFE Nov 14, 2017
d58bc6e
Extracts `miner` to `Importer` struct
0x7CFE Nov 14, 2017
0e13b8b
Extracts `ancient_verifier` to `Importer` struct
0x7CFE Nov 14, 2017
89341af
Extracts `rng` to `Importer` struct
0x7CFE Nov 14, 2017
2a806e7
Extracts `import_old_block` to `Importer` struct
0x7CFE Nov 15, 2017
377bce5
Adds `Nonce` trait
0x7CFE Nov 20, 2017
711c45f
Adds `Balance` trait
0x7CFE Nov 20, 2017
ce312fc
Adds `ChainInfo` trait
0x7CFE Nov 20, 2017
82dad1c
Fixes imports for tests using `chain_info` method
0x7CFE Nov 21, 2017
466d5ac
Adds `BlockInfo` trait
0x7CFE Nov 21, 2017
9edaf25
Adds more `ChainInfo` imports
0x7CFE Nov 21, 2017
5d059c1
Adds `BlockInfo` imports
0x7CFE Nov 21, 2017
60a1f83
Adds `ReopenBlock` trait
0x7CFE Nov 21, 2017
798adc9
Adds `PrepareOpenBlock` trait
0x7CFE Nov 22, 2017
dd412fd
Fixes import in tests
0x7CFE Nov 22, 2017
8f4f9ee
Adds `CallContract` trait
0x7CFE Nov 23, 2017
e38bf78
Fixes imports in tests using `call_contract` method
0x7CFE Nov 23, 2017
b154169
Adds `TransactionInfo` trait
0x7CFE Nov 23, 2017
3cee537
Adds `RegistryInfo` trait
0x7CFE Nov 23, 2017
fcb41bc
Fixes imports in tests using `registry_address` method
0x7CFE Nov 23, 2017
0c5e03e
Adds `ScheduleInfo` trait
0x7CFE Nov 24, 2017
d45a795
Adds `ImportSealedBlock` trait
0x7CFE Nov 24, 2017
2469fcf
Fixes imports in test using `import_sealed_block` method
0x7CFE Nov 24, 2017
f92f942
Adds `BroadcastProposalBlock` trait
0x7CFE Nov 24, 2017
8d0d5d5
Migrates `Miner` to static dispatch
0x7CFE Nov 24, 2017
2c6e763
Merge remote-tracking branch 'origin/master' into client_split
0x7CFE Dec 8, 2017
42450fe
Fixes tests
0x7CFE Dec 8, 2017
e1f9f75
Moves `calculate_enacted_retracted` to `Importer`
0x7CFE Dec 11, 2017
bdb713a
Moves import-related methods to `Importer`
0x7CFE Dec 12, 2017
33c3655
Removes redundant `import_old_block` wrapper
0x7CFE Dec 13, 2017
8c060b9
Extracts `import_block*` into separate trait
0x7CFE Dec 13, 2017
7c83db3
Fixes tests
0x7CFE Dec 13, 2017
215435b
Handles `Pending` in `LightFetch`
0x7CFE Dec 20, 2017
e6b2d85
Handles `Pending` in filters
0x7CFE Dec 20, 2017
187cc1f
Handles `Pending` in `ParityClient`
0x7CFE Dec 20, 2017
60fabe3
Handles `Pending` in `EthClient`
0x7CFE Dec 20, 2017
5b47cb7
Removes `BlockId::Pending`, partly refactors dependent code
0x7CFE Dec 28, 2017
02c9f0b
Adds `StateInfo` trait
0x7CFE Dec 27, 2017
cfd5542
Makes `MinerService::pending_state`'s return type dynamic
0x7CFE Dec 28, 2017
42c91c0
Adds `StateOrBlock` and `BlockChain` types
0x7CFE Dec 28, 2017
f193925
Exports `StateInfo` trait from `client` module
0x7CFE Dec 28, 2017
3d47003
Exports `StateOrBlock` and `BlockChain` types from `client` module
0x7CFE Dec 27, 2017
a903749
Adds impl of `client::BlockChain` for `Client`
0x7CFE Dec 28, 2017
d596412
Refactors `balance` RPC using generic API
0x7CFE Dec 27, 2017
fd81510
Refactors `storage_at` RPC using generic API
0x7CFE Dec 27, 2017
462f117
Missing `self` use
0x7CFE Dec 27, 2017
fde7da8
Adds `number_to_id` and refactors dependent RPC methods
0x7CFE Dec 27, 2017
32f1d4f
Refactors `code_at` using generic API
0x7CFE Dec 27, 2017
d568dc9
Reverts `client::BlockChain` trait stuff, refactors methods to accept…
0x7CFE Dec 28, 2017
85b82a7
Adds `StateClient` trait
0x7CFE Dec 28, 2017
d4ce1aa
Refactors RPC to use `StateClient` trait
0x7CFE Dec 28, 2017
d73802c
Refactors TestClient
0x7CFE Dec 28, 2017
b2b3609
Adds helper function `block_number_to_id`
0x7CFE Dec 29, 2017
3b98354
Uses `block_number_to_id` instead of local function
0x7CFE Dec 29, 2017
e0ef78a
Handles `Pending` in `list_accounts` and `list_storage_keys`
0x7CFE Dec 29, 2017
0953332
Attempt to use associated types for state instead of trait objects
0x7CFE Dec 31, 2017
856dfe2
Simplifies `state_at_beginning`
0x7CFE Jan 11, 2018
d659688
Extracts `call` and `call_many` into separate trait
0x7CFE Jan 15, 2018
f97f19d
Refactors `build_last_hashes` to accept reference
0x7CFE Jan 15, 2018
56c5065
Exports `Call` type from the module
0x7CFE Jan 15, 2018
7f7c91b
Refactors `call` and `call_many` to accept state and header
0x7CFE Jan 16, 2018
ea9aea6
Exports `state_at` in `StateClient`
0x7CFE Jan 17, 2018
2bd1822
Exports `pending_block_header` from `MinerService`
0x7CFE Jan 17, 2018
e7adc6e
Refactors RPC `call` method using new API
0x7CFE Jan 17, 2018
3b35ef4
Adds missing parentheses
0x7CFE Jan 17, 2018
3086ef5
Refactors `parity::call` to use new call API
0x7CFE Jan 17, 2018
0b570a4
Update .gitlab-ci.yml
General-Beck Jan 17, 2018
ced6988
Fixes error handling
0x7CFE Jan 17, 2018
31962cd
Refactors `traces::call` and `call_many` to use new call API
0x7CFE Jan 17, 2018
ef3dc9d
Refactors `call_contract`
0x7CFE Jan 18, 2018
67258e4
Refactors `block_header`
0x7CFE Jan 19, 2018
7523de6
Refactors internal RPC method `block`
0x7CFE Jan 19, 2018
56b4fad
Moves `estimate_gas` to `Call` trait, refactors parameters
0x7CFE Jan 23, 2018
683fe61
Refactors `estimate_gas` in RPC
0x7CFE Jan 23, 2018
5bf55cd
Refactors `uncle`
0x7CFE Jan 23, 2018
2a0da21
Refactors RPC `transaction`
0x7CFE Jan 24, 2018
3221d68
Covers missing branches
0x7CFE Jan 24, 2018
b61bc2a
Makes it all compile, fixes compiler grumbles
0x7CFE Jan 24, 2018
fd31c3e
Adds casts in `blockchain` module
0x7CFE Jan 24, 2018
e08b733
Fixes `PendingBlock` tests, work on `MinerService`
0x7CFE Jan 31, 2018
61d18bc
Adds test stubs for StateClient and EngineInfo
0x7CFE Jan 31, 2018
7c999e4
Makes `state_db` public
0x7CFE Feb 1, 2018
3a5d5dc
Adds missing impls for `TestBlockChainClient`
0x7CFE Feb 1, 2018
9205963
Adds trait documentation
0x7CFE Feb 2, 2018
32af6eb
Adds missing docs to the `state_db` module
0x7CFE Feb 2, 2018
2732187
Merge branch 'master' into client_split
tomusdrw Feb 5, 2018
9173530
Fixes trivial compilation errors
0x7CFE Feb 7, 2018
46ec4e8
Moves `code_hash` method to a `BlockInfo` trait
0x7CFE Feb 7, 2018
dbc0c23
Refactors `Verifier` to be generic over client
0x7CFE Feb 7, 2018
5a75869
Refactors `TransactionFilter` to be generic over client
0x7CFE Feb 7, 2018
2cbb61b
Refactors `Miner` and `Client` to reflect changes in verifier and txf…
0x7CFE Feb 7, 2018
77492ea
Moves `ServiceTransactionChecker` back to `ethcore`
0x7CFE Feb 7, 2018
422f43e
Fixes trait bounds in `Miner` API
0x7CFE Feb 7, 2018
c0683ad
Fixes `Client`
0x7CFE Feb 7, 2018
d38d063
Fixes lifetime bound in `FullFamilyParams`
0x7CFE Feb 7, 2018
3aad2a3
Adds comments to `FullFamilyParams`
0x7CFE Feb 7, 2018
cb10795
Fixes imports in `ethcore`
0x7CFE Feb 7, 2018
0c5982a
Fixes BlockNumber handling in `code_at` and `replay_block_transactions`
0x7CFE Feb 7, 2018
4f32e81
Merge branch 'master' into client_split
debris Feb 8, 2018
6eef944
fix compile issues
debris Feb 8, 2018
a7d5674
First step to redundant trait merge
0x7CFE Feb 9, 2018
27df295
Fixes compilation error in RPC tests
0x7CFE Feb 9, 2018
7441f4b
Adds mock `State` as a stub for `TestClient`
0x7CFE Feb 13, 2018
cdc51a2
Handles `StateOrBlock::State` in `TestBlockChainClient::balance`
0x7CFE Feb 13, 2018
49b7015
Fixes `transaction_count` RPC
0x7CFE Feb 13, 2018
07f558b
Fixes `transaction_count`
0x7CFE Feb 13, 2018
93a0913
Merge remote-tracking branch 'origin/master' into client_split
0x7CFE Feb 16, 2018
9b7f739
Merge remote-tracking branch 'origin/master' into client_split
0x7CFE Feb 16, 2018
5c0ae46
Moves `service_transaction.json` to the `contracts` subfolder
0x7CFE Feb 16, 2018
bb09094
Fixes compilation errors in tests
0x7CFE Feb 16, 2018
8457a49
Merge remote-tracking branch 'origin/master' into client_split
0x7CFE Feb 21, 2018
7300f65
Refactors client to use `AccountData`
0x7CFE Feb 23, 2018
fb5a1c8
Refactors client to use `BlockChain`
0x7CFE Feb 23, 2018
15e8080
Refactors miner to use aggregate traits
0x7CFE Feb 23, 2018
cdca730
Adds `SealedBlockImporter` trait
0x7CFE Feb 23, 2018
693e3fc
Refactors miner to use `SealedBlockImporter` trait
0x7CFE Feb 23, 2018
9362e55
Removes unused imports
0x7CFE Feb 23, 2018
f0194fc
Merge remote-tracking branch 'origin/master' into client_split
0x7CFE Feb 23, 2018
9dc2e3e
Simplifies `RegistryInfo::registry_address`
0x7CFE Mar 2, 2018
b14a6e4
Fixes indentation
0x7CFE Mar 2, 2018
99185ad
Merge remote-tracking branch 'origin/master' into client_split
0x7CFE Mar 2, 2018
a23e11d
Removes commented out trait bound
0x7CFE Mar 2, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 3 additions & 4 deletions ethcore/light/src/client/header_chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ impl HeaderChain {
if self.best_block.read().number < num { return None }
self.candidates.read().get(&num).map(|entry| entry.canonical_hash)
}
BlockId::Latest | BlockId::Pending => {
BlockId::Latest => {
Some(self.best_block.read().hash)
}
}
Expand Down Expand Up @@ -539,7 +539,7 @@ impl HeaderChain {
self.candidates.read().get(&num).map(|entry| entry.canonical_hash)
.and_then(load_from_db)
}
BlockId::Latest | BlockId::Pending => {
BlockId::Latest => {
// hold candidates hear to prevent deletion of the header
// as we read it.
let _candidates = self.candidates.read();
Expand Down Expand Up @@ -575,7 +575,7 @@ impl HeaderChain {
if self.best_block.read().number < num { return None }
candidates.get(&num).map(|era| era.candidates[0].total_difficulty)
}
BlockId::Latest | BlockId::Pending => Some(self.best_block.read().total_difficulty)
BlockId::Latest => Some(self.best_block.read().total_difficulty)
}
}

Expand Down Expand Up @@ -866,7 +866,6 @@ mod tests {

assert!(chain.block_header(BlockId::Earliest).is_some());
assert!(chain.block_header(BlockId::Latest).is_some());
assert!(chain.block_header(BlockId::Pending).is_some());
}

#[test]
Expand Down
10 changes: 6 additions & 4 deletions ethcore/light/src/client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,12 @@ impl<T: ChainDataFetcher> LightChainClient for Client<T> {
}
}

impl<T: ChainDataFetcher> ::ethcore::client::ChainInfo for Client<T> {
fn chain_info(&self) -> BlockChainInfo {
Client::chain_info(self)
}
}

impl<T: ChainDataFetcher> ::ethcore::client::EngineClient for Client<T> {
fn update_sealing(&self) { }
fn submit_seal(&self, _block_hash: H256, _seal: Vec<Vec<u8>>) { }
Expand All @@ -587,10 +593,6 @@ impl<T: ChainDataFetcher> ::ethcore::client::EngineClient for Client<T> {
})
}

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

fn as_full_client(&self) -> Option<&::ethcore::client::BlockChainClient> {
None
}
Expand Down
2 changes: 1 addition & 1 deletion ethcore/light/src/on_demand/request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -948,7 +948,7 @@ mod tests {
use trie::recorder::Recorder;
use hash::keccak;

use ethcore::client::{BlockChainClient, TestBlockChainClient, EachBlockWith};
use ethcore::client::{BlockChainClient, BlockInfo, TestBlockChainClient, EachBlockWith};
use ethcore::header::Header;
use ethcore::encoded;
use ethcore::receipt::{Receipt, TransactionOutcome};
Expand Down
8 changes: 4 additions & 4 deletions ethcore/light/src/provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
use std::sync::Arc;

use ethcore::blockchain_info::BlockChainInfo;
use ethcore::client::{BlockChainClient, ProvingBlockChainClient};
use ethcore::encoded;
use ethcore::client::{BlockChainClient, ProvingBlockChainClient, ChainInfo, BlockInfo as ClientBlockInfo};
use ethcore::ids::BlockId;
use ethcore::encoded;
use ethereum_types::H256;
use parking_lot::RwLock;
use transaction::PendingTransaction;
Expand Down Expand Up @@ -138,7 +138,7 @@ pub trait Provider: Send + Sync {
// Implementation of a light client data provider for a client.
impl<T: ProvingBlockChainClient + ?Sized> Provider for T {
fn chain_info(&self) -> BlockChainInfo {
BlockChainClient::chain_info(self)
ChainInfo::chain_info(self)
}

fn reorg_depth(&self, a: &H256, b: &H256) -> Option<u64> {
Expand All @@ -150,7 +150,7 @@ impl<T: ProvingBlockChainClient + ?Sized> Provider for T {
}

fn block_header(&self, id: BlockId) -> Option<encoded::Header> {
BlockChainClient::block_header(self, id)
ClientBlockInfo::block_header(self, id)
}

fn transaction_index(&self, req: request::CompleteTransactionIndexRequest)
Expand Down
7 changes: 6 additions & 1 deletion ethcore/src/blockchain/best_block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,12 @@ use ethereum_types::{H256, U256};
use bytes::Bytes;
use header::BlockNumber;

/// Best block info.
/// Contains information on a best block that is specific to the consensus engine.
///
/// For GHOST fork-choice rule it would typically describe the block with highest
/// combined difficulty (usually the block with the highest block number).
///
/// Sometimes refered as 'latest block'.
#[derive(Default)]
pub struct BestBlock {
/// Best block hash.
Expand Down
Loading