Skip to content

Commit

Permalink
Improve node module in main crate [ECR-3947] (exonum#1671)
Browse files Browse the repository at this point in the history
  • Loading branch information
slowli authored and Oleksandr Anyshchenko committed Jan 9, 2020
1 parent c6e5e97 commit 9254a2a
Show file tree
Hide file tree
Showing 50 changed files with 804 additions and 897 deletions.
7 changes: 4 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ The project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html)
(to generate signed transactions), to `CallContext` (to call another service)
and some other types. See Rust runtime docs for more details. (#1606)

- The following public APIs were removed/made private: (#1629)
- The following public APIs were removed/made private: (#1629, #1671)

- `blockchain::{error reexports}` (available from `runtime::`);
- `blockchain::FatalError` public re-export;
- `blockchain::InstanceCollection` structure;
Expand All @@ -61,8 +62,8 @@ The project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html)
and `helpers::clear_consensus_messages_cache` functions;
- `impl_serde_hex_for_binary_value` macro (moved to `merkledb`);
- `messages::BinaryValue` public re-export;
- `node::state` module (constants from `node::state` are now accessible in
`node::constants` module);
- `node` module types / methods logically related to the consensus
algorithm implementation (i.e., `NodeHandler` and types used by it);
- `proto` module;
- `runtime::error` module (`catch_panic` was added to the list of public
re-exports from `runtime::error`).
Expand Down
9 changes: 4 additions & 5 deletions cli/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@

use exonum::{
blockchain::{ConsensusConfig, ValidatorKeys},
events::NetworkConfiguration,
exonum_merkledb::DbOptions,
keys::{read_keys_from_file, Keys},
node::{ConnectListConfig, MemoryPoolConfig, NodeApiConfig, NodeConfig as CoreNodeConfig},
node::{
ConnectListConfig, MemoryPoolConfig, NetworkConfiguration, NodeApiConfig,
NodeConfig as CoreNodeConfig,
},
};
use exonum_supervisor::mode::Mode as SupervisorMode;
use serde_derive::{Deserialize, Serialize};
Expand Down Expand Up @@ -100,11 +102,8 @@ impl Into<CoreNodeConfig> for NodeConfig {
network: self.private_config.network,
api: self.private_config.api,
mempool: self.private_config.mempool,
services_configs: Default::default(),
database: self.private_config.database,
connect_list: self.private_config.connect_list,
thread_pool_size: self.private_config.thread_pool_size,
master_key_path: self.private_config.master_key_path,
keys: self.private_config.keys,
}
}
Expand Down
2 changes: 1 addition & 1 deletion cli/src/config_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

//! Updating node configuration on the fly.

use exonum::{helpers::config::ConfigManager, node::ConnectListConfig};
use exonum::node::{ConfigManager, ConnectListConfig};
use failure;
use log::error;

Expand Down
7 changes: 4 additions & 3 deletions cli/tests/testdata/config/more_validators/cfg/0/node.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ master_key_path = "master.key.toml"

[private_config.api]
state_update_timeout = 10000
[private_config.api.server_restart]
max_retries = 20
retry_timeout = 500

[[private_config.connect_list.peers]]
address = "127.0.0.1:5400"
public_key = "11e1b1902690aa22c8c976cb74a27f167b3899141c1c6ce8e19bafef32715d40"
Expand Down Expand Up @@ -37,9 +41,6 @@ tcp_connect_max_retries = 10
tcp_connect_retry_timeout = 15000
tcp_nodelay = true

[private_config.network.http_backend_config]
server_restart_max_retries = 20
server_restart_retry_timeout = 500
[public_config.consensus]
first_round_timeout = 3000
max_message_len = 1048576
Expand Down
7 changes: 3 additions & 4 deletions cli/tests/testdata/config/more_validators/cfg/0/sec.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ master_key_path = "master.key.toml"

[api]
state_update_timeout = 10000
[api.server_restart]
max_retries = 20
retry_timeout = 500

[connect_list]
peers = []
Expand All @@ -23,7 +26,3 @@ max_outgoing_connections = 128
tcp_connect_max_retries = 10
tcp_connect_retry_timeout = 15000
tcp_nodelay = true

[network.http_backend_config]
server_restart_max_retries = 20
server_restart_retry_timeout = 500
7 changes: 4 additions & 3 deletions cli/tests/testdata/config/more_validators/cfg/1/node.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ master_key_path = "master.key.toml"

[private_config.api]
state_update_timeout = 10000
[private_config.api.server_restart]
max_retries = 20
retry_timeout = 500

[[private_config.connect_list.peers]]
address = "127.0.0.1:5400"
public_key = "11e1b1902690aa22c8c976cb74a27f167b3899141c1c6ce8e19bafef32715d40"
Expand Down Expand Up @@ -37,9 +41,6 @@ tcp_connect_max_retries = 10
tcp_connect_retry_timeout = 15000
tcp_nodelay = true

[private_config.network.http_backend_config]
server_restart_max_retries = 20
server_restart_retry_timeout = 500
[public_config.consensus]
first_round_timeout = 3000
max_message_len = 1048576
Expand Down
3 changes: 3 additions & 0 deletions cli/tests/testdata/config/more_validators/cfg/1/sec.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ master_key_path = "master.key.toml"

[api]
state_update_timeout = 10000
[api.server_restart]
max_retries = 20
retry_timeout = 500

[connect_list]
peers = []
Expand Down
7 changes: 4 additions & 3 deletions cli/tests/testdata/config/more_validators/cfg/2/node.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ master_key_path = "master.key.toml"

[private_config.api]
state_update_timeout = 10000
[private_config.api.server_restart]
max_retries = 20
retry_timeout = 500

[[private_config.connect_list.peers]]
address = "127.0.0.1:5400"
public_key = "11e1b1902690aa22c8c976cb74a27f167b3899141c1c6ce8e19bafef32715d40"
Expand Down Expand Up @@ -37,9 +41,6 @@ tcp_connect_max_retries = 10
tcp_connect_retry_timeout = 15000
tcp_nodelay = true

[private_config.network.http_backend_config]
server_restart_max_retries = 20
server_restart_retry_timeout = 500
[public_config.consensus]
first_round_timeout = 3000
max_message_len = 1048576
Expand Down
7 changes: 3 additions & 4 deletions cli/tests/testdata/config/more_validators/cfg/2/sec.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ master_key_path = "master.key.toml"

[api]
state_update_timeout = 10000
[api.server_restart]
max_retries = 20
retry_timeout = 500

[connect_list]
peers = []
Expand All @@ -23,7 +26,3 @@ max_outgoing_connections = 128
tcp_connect_max_retries = 10
tcp_connect_retry_timeout = 15000
tcp_nodelay = true

[network.http_backend_config]
server_restart_max_retries = 20
server_restart_retry_timeout = 500
7 changes: 4 additions & 3 deletions cli/tests/testdata/config/more_validators/cfg/3/node.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ master_key_path = "master.key.toml"

[private_config.api]
state_update_timeout = 10000
[private_config.api.server_restart]
max_retries = 20
retry_timeout = 500

[[private_config.connect_list.peers]]
address = "127.0.0.1:5400"
public_key = "11e1b1902690aa22c8c976cb74a27f167b3899141c1c6ce8e19bafef32715d40"
Expand Down Expand Up @@ -37,9 +41,6 @@ tcp_connect_max_retries = 10
tcp_connect_retry_timeout = 15000
tcp_nodelay = true

[private_config.network.http_backend_config]
server_restart_max_retries = 20
server_restart_retry_timeout = 500
[public_config.consensus]
first_round_timeout = 3000
max_message_len = 1048576
Expand Down
7 changes: 3 additions & 4 deletions cli/tests/testdata/config/more_validators/cfg/3/sec.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ master_key_path = "master.key.toml"

[api]
state_update_timeout = 10000
[api.server_restart]
max_retries = 20
retry_timeout = 500

[connect_list]
peers = []
Expand All @@ -23,7 +26,3 @@ max_outgoing_connections = 128
tcp_connect_max_retries = 10
tcp_connect_retry_timeout = 15000
tcp_nodelay = true

[network.http_backend_config]
server_restart_max_retries = 20
server_restart_retry_timeout = 500
7 changes: 4 additions & 3 deletions cli/tests/testdata/config/with_pass/cfg/0/node.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ master_key_path = "master.key.toml"

[private_config.api]
state_update_timeout = 10000
[private_config.api.server_restart]
max_retries = 20
retry_timeout = 500

[[private_config.connect_list.peers]]
address = "127.0.0.1:5400"
public_key = "12285e9b9d6440ffe0e0dc8e8d381cf6a071c38d053d9f1273c7b794175529fc"
Expand All @@ -25,9 +29,6 @@ tcp_connect_max_retries = 10
tcp_connect_retry_timeout = 15000
tcp_nodelay = true

[private_config.network.http_backend_config]
server_restart_max_retries = 20
server_restart_retry_timeout = 500
[public_config.consensus]
first_round_timeout = 3000
max_message_len = 1048576
Expand Down
4 changes: 4 additions & 0 deletions cli/tests/testdata/config/with_pass/cfg/0/sec.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,17 @@ master_key_path = "master.key.toml"

[api]
state_update_timeout = 10000
[api.server_restart]
max_retries = 20
retry_timeout = 500

[connect_list]
peers = []

[database]
compression_type = "none"
create_if_missing = true

[mempool.events_pool_capacity]
api_requests_capacity = 1024
internal_events_capacity = 128
Expand Down
9 changes: 5 additions & 4 deletions cli/tests/testdata/config/without_pass/cfg/0/node.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ master_key_path = "master.key.toml"

[private_config.api]
state_update_timeout = 10000
[private_config.api.server_restart]
max_retries = 20
retry_timeout = 500

[[private_config.connect_list.peers]]
address = "127.0.0.1:5400"
public_key = "11e1b1902690aa22c8c976cb74a27f167b3899141c1c6ce8e19bafef32715d40"
Expand All @@ -24,6 +28,7 @@ public_key = "6f3f614692d678b664be7eaafbe280d14e2d4191299ae146874eec389c93ece7"
[private_config.database]
compression_type = "none"
create_if_missing = true

[private_config.mempool.events_pool_capacity]
api_requests_capacity = 1024
internal_events_capacity = 128
Expand All @@ -37,10 +42,6 @@ tcp_connect_max_retries = 10
tcp_connect_retry_timeout = 15000
tcp_nodelay = true

[private_config.network.http_backend_config]
server_restart_max_retries = 20
server_restart_retry_timeout = 500

[public_config.consensus]
first_round_timeout = 3000
max_message_len = 1048576
Expand Down
8 changes: 4 additions & 4 deletions cli/tests/testdata/config/without_pass/cfg/0/sec.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ master_key_path = "master.key.toml"
[api]
state_update_timeout = 10000

[api.server_restart]
max_retries = 20
retry_timeout = 500

[connect_list]
peers = []

Expand All @@ -23,7 +27,3 @@ max_outgoing_connections = 128
tcp_connect_max_retries = 10
tcp_connect_retry_timeout = 15000
tcp_nodelay = true

[network.http_backend_config]
server_restart_max_retries = 20
server_restart_retry_timeout = 500
8 changes: 4 additions & 4 deletions cli/tests/testdata/config/without_pass/cfg/1/node.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ master_key_path = "master.key.toml"

[private_config.api]
state_update_timeout = 10000
[private_config.api.server_restart]
max_retries = 20
retry_timeout = 500

[[private_config.connect_list.peers]]
address = "127.0.0.1:5400"
public_key = "11e1b1902690aa22c8c976cb74a27f167b3899141c1c6ce8e19bafef32715d40"
Expand Down Expand Up @@ -37,10 +41,6 @@ tcp_connect_max_retries = 10
tcp_connect_retry_timeout = 15000
tcp_nodelay = true

[private_config.network.http_backend_config]
server_restart_max_retries = 20
server_restart_retry_timeout = 500

[public_config.consensus]
first_round_timeout = 3000
max_message_len = 1048576
Expand Down
8 changes: 4 additions & 4 deletions cli/tests/testdata/config/without_pass/cfg/1/sec.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ master_key_path = "master.key.toml"
[api]
state_update_timeout = 10000

[api.server_restart]
max_retries = 20
retry_timeout = 500

[connect_list]
peers = []

Expand All @@ -23,7 +27,3 @@ max_outgoing_connections = 128
tcp_connect_max_retries = 10
tcp_connect_retry_timeout = 15000
tcp_nodelay = true

[network.http_backend_config]
server_restart_max_retries = 20
server_restart_retry_timeout = 500
8 changes: 4 additions & 4 deletions cli/tests/testdata/config/without_pass/cfg/2/node.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ master_key_path = "master.key.toml"

[private_config.api]
state_update_timeout = 10000
[private_config.api.server_restart]
max_retries = 20
retry_timeout = 500

[[private_config.connect_list.peers]]
address = "127.0.0.1:5400"
public_key = "11e1b1902690aa22c8c976cb74a27f167b3899141c1c6ce8e19bafef32715d40"
Expand Down Expand Up @@ -37,10 +41,6 @@ tcp_connect_max_retries = 10
tcp_connect_retry_timeout = 15000
tcp_nodelay = true

[private_config.network.http_backend_config]
server_restart_max_retries = 20
server_restart_retry_timeout = 500

[public_config.consensus]
first_round_timeout = 3000
max_message_len = 1048576
Expand Down
8 changes: 4 additions & 4 deletions cli/tests/testdata/config/without_pass/cfg/2/sec.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ master_key_path = "master.key.toml"
[api]
state_update_timeout = 10000

[api.server_restart]
max_retries = 20
retry_timeout = 500

[connect_list]
peers = []

Expand All @@ -23,7 +27,3 @@ max_outgoing_connections = 128
tcp_connect_max_retries = 10
tcp_connect_retry_timeout = 15000
tcp_nodelay = true

[network.http_backend_config]
server_restart_max_retries = 20
server_restart_retry_timeout = 500
8 changes: 4 additions & 4 deletions cli/tests/testdata/config/without_pass/cfg/3/node.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ master_key_path = "master.key.toml"

[private_config.api]
state_update_timeout = 10000
[private_config.api.server_restart]
max_retries = 20
retry_timeout = 500

[[private_config.connect_list.peers]]
address = "127.0.0.1:5400"
public_key = "11e1b1902690aa22c8c976cb74a27f167b3899141c1c6ce8e19bafef32715d40"
Expand Down Expand Up @@ -37,10 +41,6 @@ tcp_connect_max_retries = 10
tcp_connect_retry_timeout = 15000
tcp_nodelay = true

[private_config.network.http_backend_config]
server_restart_max_retries = 20
server_restart_retry_timeout = 500

[public_config.consensus]
first_round_timeout = 3000
max_message_len = 1048576
Expand Down
Loading

0 comments on commit 9254a2a

Please sign in to comment.