diff options
author | Determinant <[email protected]> | 2018-09-10 16:24:49 -0400 |
---|---|---|
committer | Determinant <[email protected]> | 2018-09-10 16:24:49 -0400 |
commit | 8d5449339d3dacc31c614e27669ce6eb9eb11960 (patch) | |
tree | f5164f02d35b1b3a5723a52ff4f05a300d794119 | |
parent | b425736e5ccb0eeba7a70df332a82dff619a42a8 (diff) | |
parent | 95b193bb3b0bba62f168c7e2c3f45c54d4849e27 (diff) |
Merge branch 'master' of /home/ymf/lwork/hot-stuff/code
-rw-r--r-- | hotstuff.conf | 1 | ||||
-rw-r--r-- | include/hotstuff/hotstuff.h | 8 | ||||
-rwxr-xr-x | scripts/run_client.sh | 1 | ||||
-rw-r--r-- | src/hotstuff_app.cpp | 13 |
4 files changed, 16 insertions, 7 deletions
diff --git a/hotstuff.conf b/hotstuff.conf index 4823340..6ad5b4e 100644 --- a/hotstuff.conf +++ b/hotstuff.conf @@ -1,3 +1,4 @@ +nworker = 8 replica = 127.0.0.1:2234;22234, 028a1caf2c503a1e9b0b3ddf1d1df30253facdd50b93add05ebc7f708db00c11e4 replica = 127.0.0.1:2235;22235, 034ca53338e69321c1bc83e2fa76b1b00d68f64911074221abda88aac8af9d2b53 replica = 127.0.0.1:2236;22236, 0340f9d12dd1532968f7d8a99f95c3cd03992346487e15bd43265a3f273558ff2e diff --git a/include/hotstuff/hotstuff.h b/include/hotstuff/hotstuff.h index 983a7b3..eeffaab 100644 --- a/include/hotstuff/hotstuff.h +++ b/include/hotstuff/hotstuff.h @@ -185,7 +185,7 @@ class HotStuffBase: public HotStuffCore { NetAddr listen_addr, pacemaker_bt pmaker, EventContext eb, - size_t nworker = 4); + size_t nworker); ~HotStuffBase(); @@ -248,13 +248,15 @@ class HotStuff: public HotStuffBase { const bytearray_t &raw_privkey, NetAddr listen_addr, pacemaker_bt pmaker, - EventContext eb = EventContext()): + EventContext eb = EventContext(), + size_t nworker = 4): HotStuffBase(blk_size, rid, new PrivKeyType(raw_privkey), listen_addr, std::move(pmaker), - eb) {} + eb, + nworker) {} void add_replica(ReplicaID idx, const NetAddr &addr, const bytearray_t &pubkey_raw) { DataStream s(pubkey_raw); diff --git a/scripts/run_client.sh b/scripts/run_client.sh index 2ecdf31..7825c02 100755 --- a/scripts/run_client.sh +++ b/scripts/run_client.sh @@ -144,6 +144,7 @@ function _remote_start { local client_port="$5" local client_ip="$6" local cmd="${run_remote_pat//<rworkdir>/$rworkdir}" + cmd="${cmd//<node_id_step>/$node_id_step}" cmd="${cmd//<node_id>/$((node_id * node_id_step))}" cmd="${cmd//<server>/$node_ip:$client_port}" execute_remote_cmd_pid "$client_ip" "$cmd" \ diff --git a/src/hotstuff_app.cpp b/src/hotstuff_app.cpp index 768e81e..87c80e3 100644 --- a/src/hotstuff_app.cpp +++ b/src/hotstuff_app.cpp @@ -92,7 +92,8 @@ class HotStuffApp: public HotStuff { NetAddr plisten_addr, NetAddr clisten_addr, hotstuff::pacemaker_bt pmaker, - const EventContext &ec); + const EventContext &ec, + size_t nworker); void start(); }; @@ -131,6 +132,7 @@ int main(int argc, char **argv) { auto opt_fixed_proposer = Config::OptValInt::create(1); auto opt_qc_timeout = Config::OptValDouble::create(0.5); auto opt_imp_timeout = Config::OptValDouble::create(11); + auto opt_nworker = Config::OptValInt::create(4); config.add_opt("block-size", opt_blk_size, Config::SET_VAL); config.add_opt("parent-limit", opt_parent_limit, Config::SET_VAL); @@ -143,6 +145,7 @@ int main(int argc, char **argv) { config.add_opt("proposer", opt_fixed_proposer, Config::SET_VAL, 'l', "set the fixed proposer (for dummy)"); config.add_opt("qc-timeout", opt_qc_timeout, Config::SET_VAL, 't', "set QC timeout (for sticky)"); config.add_opt("imp-timeout", opt_imp_timeout, Config::SET_VAL, 'u', "set impeachment timeout (for sticky)"); + config.add_opt("nworker", opt_nworker, Config::SET_VAL, 'n', "the number of threads for verification"); config.add_opt("help", opt_help, Config::SWITCH_ON, 'h', "show this help info"); EventContext ec; @@ -199,7 +202,8 @@ int main(int argc, char **argv) { plisten_addr, NetAddr("0.0.0.0", client_port), std::move(pmaker), - ec); + ec, + opt_nworker->get()); for (size_t i = 0; i < replicas.size(); i++) { auto p = split_ip_port_cport(replicas[i].first); @@ -224,9 +228,10 @@ HotStuffApp::HotStuffApp(uint32_t blk_size, NetAddr plisten_addr, NetAddr clisten_addr, hotstuff::pacemaker_bt pmaker, - const EventContext &ec): + const EventContext &ec, + size_t nworker): HotStuff(blk_size, idx, raw_privkey, - plisten_addr, std::move(pmaker), ec), + plisten_addr, std::move(pmaker), ec, nworker), stat_period(stat_period), impeach_timeout(impeach_timeout), ec(ec), |