Skip to content

Commit ca61bf7

Browse files
authored
Merge pull request #117 from DMDcoin/i115-smart-contract-macros
merge spec generation and dependecy update
2 parents c69c572 + f602384 commit ca61bf7

File tree

6 files changed

+57
-46
lines changed

6 files changed

+57
-46
lines changed

Cargo.lock

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

bin/oe/logger/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@ lazy_static = "1.0"
1313
regex = "1.0"
1414
time = "0.1"
1515
parking_lot = "0.11.1"
16-
arrayvec = "0.4"
16+
arrayvec = "0.7"
1717
ansi_term = "0.10"

bin/oe/logger/src/rotating.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ pub struct RotatingLogger {
5050
/// Defined logger levels
5151
levels: String,
5252
/// Logs array. Latest log is always at index 0
53-
logs: RwLock<ArrayVec<[String; LOG_SIZE]>>,
53+
logs: RwLock<ArrayVec<String, LOG_SIZE>>,
5454
}
5555

5656
impl RotatingLogger {
@@ -59,7 +59,7 @@ impl RotatingLogger {
5959
pub fn new(levels: String) -> Self {
6060
RotatingLogger {
6161
levels: levels,
62-
logs: RwLock::new(ArrayVec::<[_; LOG_SIZE]>::new()),
62+
logs: RwLock::new(ArrayVec::<_, LOG_SIZE>::new()),
6363
}
6464
}
6565

@@ -78,7 +78,7 @@ impl RotatingLogger {
7878
}
7979

8080
/// Return logs
81-
pub fn logs(&self) -> RwLockReadGuard<ArrayVec<[String; LOG_SIZE]>> {
81+
pub fn logs(&self) -> RwLockReadGuard<ArrayVec<String, LOG_SIZE>> {
8282
self.logs.read()
8383
}
8484
}

crates/ethcore/src/engines/hbbft/hbbft_config_generator/src/main.rs

Lines changed: 45 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ fn to_toml_array(vec: Vec<&str>) -> Value {
104104

105105
fn to_toml(
106106
i: usize,
107+
open_ports: bool,
107108
config_type: &ConfigType,
108109
external_ip: Option<&str>,
109110
signer_address: &Address,
@@ -116,6 +117,7 @@ fn to_toml(
116117
base_ws_port: u16,
117118
) -> Value {
118119
let mut parity = Map::new();
120+
119121
match config_type {
120122
ConfigType::PosdaoSetup => {
121123
parity.insert("chain".into(), Value::String("./spec/spec.json".into()));
@@ -169,33 +171,37 @@ fn to_toml(
169171
}
170172

171173
let mut rpc = Map::new();
172-
rpc.insert("interface".into(), Value::String("all".into()));
173-
rpc.insert("cors".into(), to_toml_array(vec!["all"]));
174-
rpc.insert("hosts".into(), to_toml_array(vec!["all"]));
175-
let apis = to_toml_array(vec![
176-
"web3",
177-
"eth",
178-
"pubsub",
179-
"net",
180-
"parity",
181-
"parity_set",
182-
"parity_pubsub",
183-
"personal",
184-
"traces",
185-
]);
186-
rpc.insert("apis".into(), apis);
187-
rpc.insert(
188-
"port".into(),
189-
Value::Integer((base_rpc_port as usize + i) as i64),
190-
);
191-
192174
let mut websockets = Map::new();
193-
websockets.insert("interface".into(), Value::String("all".into()));
194-
websockets.insert("origins".into(), to_toml_array(vec!["all"]));
195-
websockets.insert(
196-
"port".into(),
197-
Value::Integer((base_ws_port as usize + i) as i64),
198-
);
175+
176+
if open_ports {
177+
rpc.insert("interface".into(), Value::String("all".into()));
178+
rpc.insert("cors".into(), to_toml_array(vec!["all"]));
179+
rpc.insert("hosts".into(), to_toml_array(vec!["all"]));
180+
let apis = to_toml_array(vec![
181+
"web3",
182+
"eth",
183+
"pubsub",
184+
"net",
185+
"parity",
186+
"parity_pubsub",
187+
"traces",
188+
]);
189+
rpc.insert("apis".into(), apis);
190+
rpc.insert(
191+
"port".into(),
192+
Value::Integer((base_rpc_port as usize + i) as i64),
193+
);
194+
195+
websockets.insert("interface".into(), Value::String("all".into()));
196+
websockets.insert("origins".into(), to_toml_array(vec!["all"]));
197+
websockets.insert(
198+
"port".into(),
199+
Value::Integer((base_ws_port as usize + i) as i64),
200+
);
201+
} else {
202+
rpc.insert("disable".into(), Value::Boolean(true));
203+
websockets.insert("disable".into(), Value::Boolean(true));
204+
}
199205

200206
let mut ipc = Map::new();
201207
ipc.insert("disable".into(), Value::Boolean(true));
@@ -231,11 +237,10 @@ fn to_toml(
231237
}
232238

233239
mining.insert("force_sealing".into(), Value::Boolean(true));
234-
mining.insert("min_gas_price".into(), Value::Integer(1000000000));
235-
mining.insert(
236-
"gas_floor_target".into(),
237-
Value::String("1000000000".into()),
238-
);
240+
// we put an extremly low min gas price in the config
241+
// the min gas price is gathered from the DAO
242+
// this makes sure that the min_gas_price wont be higher then the gas pricce the DAO decides.
243+
mining.insert("min_gas_price".into(), Value::Integer(1000));
239244
mining.insert("reseal_on_txs".into(), Value::String("none".into()));
240245
mining.insert("reseal_min_period".into(), Value::Integer(0));
241246

@@ -252,7 +257,7 @@ fn to_toml(
252257
// Value::String("txqueue=trace,consensus=debug,engine=trace,own_tx=trace,miner=trace,tx_filter=trace".into())
253258
misc.insert(
254259
"logging".into(),
255-
Value::String("txqueue=info,consensus=debug,engine=trace,tx_own=trace".into()),
260+
Value::String("txqueue=info,consensus=debug,engine=debug,tx_own=trace".into()),
256261
);
257262
misc.insert("log_file".into(), Value::String("diamond-node.log".into()));
258263

@@ -431,12 +436,12 @@ fn main() {
431436
)
432437
});
433438

434-
let fork_block_number: Option<i64> = matches.value_of("fork_block_number").map_or(None, |v| {
435-
Some(
436-
v.parse::<i64>()
437-
.expect("fork_block_number need to be of integer type"),
438-
)
439-
});
439+
// let fork_block_number: Option<i64> = matches.value_of("fork_block_number").map_or(None, |v| {
440+
// Some(
441+
// v.parse::<i64>()
442+
// .expect("fork_block_number need to be of integer type"),
443+
// )
444+
// });
440445

441446
let metrics_port_base: Option<u16> = matches.value_of("metrics_port_base").map_or(None, |v| {
442447
Some(
@@ -525,6 +530,7 @@ fn main() {
525530
// the unwrap is safe, because there is a default value defined.
526531
let toml_string = toml::to_string(&to_toml(
527532
i,
533+
false,
528534
&config_type,
529535
external_ip,
530536
&enode.address,
@@ -565,6 +571,7 @@ fn main() {
565571
// Write rpc node config
566572
let rpc_string = toml::to_string(&to_toml(
567573
0,
574+
true,
568575
&ConfigType::Rpc,
569576
external_ip,
570577
&Address::default(), // todo: insert HBBFT Contracts pot here.

crates/ethcore/src/engines/hbbft/hbbft_engine.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
use super::{
22
block_reward_hbbft::BlockRewardContract,
33
hbbft_early_epoch_end_manager::HbbftEarlyEpochEndManager,
4-
hbbft_network_fork_manager::HbbftNetworkForkManager,
54
};
65
use crate::{
76
client::BlockChainClient,

crates/ethcore/src/engines/hbbft/hbbft_network_fork_manager.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@ use std::{
33
sync::Arc,
44
};
55

6-
use ethereum_types::{Address, H512};
6+
use ethereum_types::H512;
77
use ethjson::spec::hbbft::HbbftNetworkFork;
88
use hbbft::{
9-
crypto::PublicKeySet,
109
sync_key_gen::{Ack, AckOutcome, Part, PartOutcome, SyncKeyGen},
1110
util::max_faulty,
1211
NetworkInfo,

0 commit comments

Comments
 (0)