Backports to 2.0.1-beta (#9145)
* parity-version: bump beta to 2.0.1 * ci: update version strings for snaps * Be more graceful on Aura difficulty validation (#9164) * Be more graceful on Aura difficulty validation * test: rejects_step_backwards * test: proposer_switching * test: rejects_future_block * test: reports_skipped * test: verify_empty_seal_steps * Remove node-health (#9119) * Remove node-health * Remove ntp_servers * Add --ntp-servers as legacy instead of removing it * Add --ntp-servers to deprecated args * Remove unused stuff * Remove _legacy_ntp_servers * parity: fix UserDefaults json parser (#9189) * parity: fix UserDefaults json parser * parity: use serde_derive for UserDefaults * parity: support deserialization of old UserDefault json format * parity: make UserDefaults serde backwards compatible * parity: tabify indentation in UserDefaults * Fix bugfix hard fork logic (#9138) * Fix bugfix hard fork logic * Remove dustProtectionTransition from bugfix category EIP-168 is not enabled by default * Remove unnecessary 'static * Disable per-sender limit for local transactions. (#9148) * Disable per-sender limit for local transactions. * Add a missing new line. * rpc: fix is_major_importing sync state condition (#9112) * rpc: fix is_major_importing sync state condition * rpc: fix informant printout when waiting for peers * fix verification in ethcore-sync collect_blocks (#9135) * docker: update hub dockerfile (#9173) * update Dockerfile for hub update to Ubuntu Xenial 16.04 fix cmake version * docker: fix tab indentation in hub dockerfile * rpc: fix broken merge * rcp: remove node_health leftover from merge * rpc: remove dapps leftover from merge
This commit is contained in:
@@ -60,7 +60,6 @@ extern crate ethkey;
|
||||
extern crate ethstore;
|
||||
extern crate fetch;
|
||||
extern crate keccak_hash as hash;
|
||||
extern crate node_health;
|
||||
extern crate parity_reactor;
|
||||
extern crate parity_updater as updater;
|
||||
extern crate parity_version as version;
|
||||
@@ -119,7 +118,7 @@ pub use http::{
|
||||
};
|
||||
|
||||
pub use v1::{NetworkSettings, Metadata, Origin, informant, dispatch, signer};
|
||||
pub use v1::block_import::is_major_importing;
|
||||
pub use v1::block_import::{is_major_importing, is_major_importing_or_waiting};
|
||||
pub use v1::extractors::{RpcExtractor, WsExtractor, WsStats, WsDispatcher};
|
||||
pub use authcodes::{AuthCodes, TimeProvider};
|
||||
pub use http_common::HttpMetaExtractor;
|
||||
|
||||
@@ -19,16 +19,23 @@
|
||||
use ethcore::client::BlockQueueInfo;
|
||||
use sync::SyncState;
|
||||
|
||||
/// Check if client is during major sync or during block import.
|
||||
pub fn is_major_importing(sync_state: Option<SyncState>, queue_info: BlockQueueInfo) -> bool {
|
||||
/// Check if client is during major sync or during block import and allows defining whether 'waiting for peers' should
|
||||
/// be considered a syncing state.
|
||||
pub fn is_major_importing_or_waiting(sync_state: Option<SyncState>, queue_info: BlockQueueInfo, waiting_is_syncing_state: bool) -> bool {
|
||||
let is_syncing_state = sync_state.map_or(false, |s| match s {
|
||||
SyncState::Idle | SyncState::NewBlocks | SyncState::WaitingPeers => false,
|
||||
SyncState::Idle | SyncState::NewBlocks => false,
|
||||
SyncState::WaitingPeers if !waiting_is_syncing_state => false,
|
||||
_ => true,
|
||||
});
|
||||
let is_verifying = queue_info.unverified_queue_size + queue_info.verified_queue_size > 3;
|
||||
is_verifying || is_syncing_state
|
||||
}
|
||||
|
||||
/// Check if client is during major sync or during block import.
|
||||
pub fn is_major_importing(sync_state: Option<SyncState>, queue_info: BlockQueueInfo) -> bool {
|
||||
is_major_importing_or_waiting(sync_state, queue_info, true)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use ethcore::client::BlockQueueInfo;
|
||||
|
||||
@@ -26,7 +26,6 @@ use ethstore::random_phrase;
|
||||
use sync::LightSyncProvider;
|
||||
use ethcore::account_provider::AccountProvider;
|
||||
use ethcore_logger::RotatingLogger;
|
||||
use node_health::{NodeHealth, Health};
|
||||
use ethcore::ids::BlockId;
|
||||
|
||||
use light::client::LightChainClient;
|
||||
@@ -56,7 +55,6 @@ pub struct ParityClient {
|
||||
accounts: Arc<AccountProvider>,
|
||||
logger: Arc<RotatingLogger>,
|
||||
settings: Arc<NetworkSettings>,
|
||||
health: NodeHealth,
|
||||
signer: Option<Arc<SignerService>>,
|
||||
ws_address: Option<Host>,
|
||||
eip86_transition: u64,
|
||||
@@ -71,7 +69,6 @@ impl ParityClient {
|
||||
accounts: Arc<AccountProvider>,
|
||||
logger: Arc<RotatingLogger>,
|
||||
settings: Arc<NetworkSettings>,
|
||||
health: NodeHealth,
|
||||
signer: Option<Arc<SignerService>>,
|
||||
ws_address: Option<Host>,
|
||||
gas_price_percentile: usize,
|
||||
@@ -81,7 +78,6 @@ impl ParityClient {
|
||||
accounts,
|
||||
logger,
|
||||
settings,
|
||||
health,
|
||||
signer,
|
||||
ws_address,
|
||||
eip86_transition: client.eip86_transition(),
|
||||
@@ -432,9 +428,4 @@ impl Parity for ParityClient {
|
||||
fn call(&self, _meta: Self::Metadata, _requests: Vec<CallRequest>, _block: Trailing<BlockNumber>) -> Result<Vec<Bytes>> {
|
||||
Err(errors::light_unimplemented(None))
|
||||
}
|
||||
|
||||
fn node_health(&self) -> BoxFuture<Health> {
|
||||
Box::new(self.health.health()
|
||||
.map_err(|err| errors::internal("Health API failure.", err)))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,10 +32,9 @@ use ethcore::ids::BlockId;
|
||||
use ethcore::miner::{self, MinerService};
|
||||
use ethcore::state::StateInfo;
|
||||
use ethcore_logger::RotatingLogger;
|
||||
use node_health::{NodeHealth, Health};
|
||||
use updater::{Service as UpdateService};
|
||||
use jsonrpc_core::{BoxFuture, Result};
|
||||
use jsonrpc_core::futures::{future, Future};
|
||||
use jsonrpc_core::futures::future;
|
||||
use jsonrpc_macros::Trailing;
|
||||
use v1::helpers::{self, errors, fake_sign, ipfs, SigningQueue, SignerService, NetworkSettings};
|
||||
use v1::metadata::Metadata;
|
||||
@@ -58,7 +57,6 @@ pub struct ParityClient<C, M, U> {
|
||||
updater: Arc<U>,
|
||||
sync: Arc<SyncProvider>,
|
||||
net: Arc<ManageNetwork>,
|
||||
health: NodeHealth,
|
||||
accounts: Arc<AccountProvider>,
|
||||
logger: Arc<RotatingLogger>,
|
||||
settings: Arc<NetworkSettings>,
|
||||
@@ -77,7 +75,6 @@ impl<C, M, U> ParityClient<C, M, U> where
|
||||
sync: Arc<SyncProvider>,
|
||||
updater: Arc<U>,
|
||||
net: Arc<ManageNetwork>,
|
||||
health: NodeHealth,
|
||||
accounts: Arc<AccountProvider>,
|
||||
logger: Arc<RotatingLogger>,
|
||||
settings: Arc<NetworkSettings>,
|
||||
@@ -91,7 +88,6 @@ impl<C, M, U> ParityClient<C, M, U> where
|
||||
sync,
|
||||
updater,
|
||||
net,
|
||||
health,
|
||||
accounts,
|
||||
logger,
|
||||
settings,
|
||||
@@ -466,9 +462,4 @@ impl<C, M, U, S> Parity for ParityClient<C, M, U> where
|
||||
.map(|res| res.into_iter().map(|res| res.output.into()).collect())
|
||||
.map_err(errors::call)
|
||||
}
|
||||
|
||||
fn node_health(&self) -> BoxFuture<Health> {
|
||||
Box::new(self.health.health()
|
||||
.map_err(|err| errors::internal("Health API failure.", err)))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,8 +21,6 @@ use ethcore_logger::RotatingLogger;
|
||||
use ethereum_types::{Address, U256, H256};
|
||||
use ethstore::ethkey::{Generator, Random};
|
||||
use miner::pool::local_transactions::Status as LocalTransactionStatus;
|
||||
use node_health::{self, NodeHealth};
|
||||
use parity_reactor;
|
||||
use sync::ManageNetwork;
|
||||
|
||||
use jsonrpc_core::IoHandler;
|
||||
@@ -40,7 +38,6 @@ pub struct Dependencies {
|
||||
pub client: Arc<TestBlockChainClient>,
|
||||
pub sync: Arc<TestSyncProvider>,
|
||||
pub updater: Arc<TestUpdater>,
|
||||
pub health: NodeHealth,
|
||||
pub logger: Arc<RotatingLogger>,
|
||||
pub settings: Arc<NetworkSettings>,
|
||||
pub network: Arc<ManageNetwork>,
|
||||
@@ -57,11 +54,6 @@ impl Dependencies {
|
||||
network_id: 3,
|
||||
num_peers: 120,
|
||||
})),
|
||||
health: NodeHealth::new(
|
||||
Arc::new(FakeSync),
|
||||
node_health::TimeChecker::new::<String>(&[], node_health::CpuPool::new(1)),
|
||||
parity_reactor::Remote::new_sync(),
|
||||
),
|
||||
updater: Arc::new(TestUpdater::default()),
|
||||
logger: Arc::new(RotatingLogger::new("rpc=trace".to_owned())),
|
||||
settings: Arc::new(NetworkSettings {
|
||||
@@ -85,7 +77,6 @@ impl Dependencies {
|
||||
self.sync.clone(),
|
||||
self.updater.clone(),
|
||||
self.network.clone(),
|
||||
self.health.clone(),
|
||||
self.accounts.clone(),
|
||||
self.logger.clone(),
|
||||
self.settings.clone(),
|
||||
@@ -107,13 +98,6 @@ impl Dependencies {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
struct FakeSync;
|
||||
impl node_health::SyncStatus for FakeSync {
|
||||
fn is_major_importing(&self) -> bool { false }
|
||||
fn peers(&self) -> (usize, usize) { (4, 25) }
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn rpc_parity_accounts_info() {
|
||||
let deps = Dependencies::new();
|
||||
@@ -554,14 +538,3 @@ fn rpc_parity_call() {
|
||||
|
||||
assert_eq!(io.handle_request_sync(request), Some(response.to_owned()));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn rpc_parity_node_health() {
|
||||
let deps = Dependencies::new();
|
||||
let io = deps.default_client();
|
||||
|
||||
let request = r#"{"jsonrpc": "2.0", "method": "parity_nodeHealth", "params":[], "id": 1}"#;
|
||||
let response = r#"{"jsonrpc":"2.0","result":{"peers":{"details":[4,25],"message":"","status":"ok"},"sync":{"details":false,"message":"","status":"ok"},"time":{"details":0,"message":"","status":"ok"}},"id":1}"#;
|
||||
|
||||
assert_eq!(io.handle_request_sync(request), Some(response.to_owned()));
|
||||
}
|
||||
|
||||
@@ -21,7 +21,6 @@ use std::collections::BTreeMap;
|
||||
use jsonrpc_core::{BoxFuture, Result};
|
||||
use jsonrpc_macros::Trailing;
|
||||
|
||||
use node_health::Health;
|
||||
use v1::types::{
|
||||
H160, H256, H512, U256, U64, Bytes, CallRequest,
|
||||
Peers, Transaction, RpcSettings, Histogram,
|
||||
@@ -219,9 +218,5 @@ build_rpc_trait! {
|
||||
/// Call contract, returning the output data.
|
||||
#[rpc(meta, name = "parity_call")]
|
||||
fn call(&self, Self::Metadata, Vec<CallRequest>, Trailing<BlockNumber>) -> Result<Vec<Bytes>>;
|
||||
|
||||
/// Returns node's health report.
|
||||
#[rpc(name = "parity_nodeHealth")]
|
||||
fn node_health(&self) -> BoxFuture<Health>;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user