Skip to content

Commit

Permalink
Merge pull request EOSIO#698 from EOSIO/p2p-sync-vs-newblocks-697
Browse files Browse the repository at this point in the history
P2p sync vs newblocks 697

(reapplied on noon branch)
  • Loading branch information
heifner authored and spoonincode committed Dec 7, 2017
1 parent 281a7ca commit e1afcec
Show file tree
Hide file tree
Showing 9 changed files with 155 additions and 201 deletions.
113 changes: 47 additions & 66 deletions mesh.dot
Original file line number Diff line number Diff line change
@@ -1,68 +1,49 @@
digraph G
{
inita->initb [dir="both"]
inita->initc [dir="both"]
inita->initd [dir="both"]
inita->inite [dir="both"]
inita->initf [dir="both"]
inita->initg [dir="both"]
inita->inith [dir="both"]
inita->initi [dir="both"]
inita->initj [dir="both"]
inita->initk [dir="both"]

initb->initc [dir="both"]
initb->initd [dir="both"]
initb->inite [dir="both"]
initb->initf [dir="both"]
initb->initg [dir="both"]
initb->inith [dir="both"]
initb->initi [dir="both"]
initb->initj [dir="both"]
initb->initk [dir="both"]

initc->initd [dir="both"]
initc->inite [dir="both"]
initc->initf [dir="both"]
initc->initg [dir="both"]
initc->inith [dir="both"]
initc->initi [dir="both"]
initc->initj [dir="both"]
initc->initk [dir="both"]

initd->inite [dir="both"]
initd->initf [dir="both"]
initd->initg [dir="both"]
initd->inith [dir="both"]
initd->initi [dir="both"]
initd->initj [dir="both"]
initd->initk [dir="both"]

inite->initf [dir="both"]
inite->initg [dir="both"]
inite->inith [dir="both"]
inite->initi [dir="both"]
inite->initj [dir="both"]
inite->initk [dir="both"]

initf->initg [dir="both"]
initf->inith [dir="both"]
initf->initi [dir="both"]
initf->initj [dir="both"]
initf->initk [dir="both"]

initg->inith [dir="both"]
initg->initi [dir="both"]
initg->initj [dir="both"]
initg->initk [dir="both"]

inith->initi [dir="both"]
inith->initj [dir="both"]
inith->initk [dir="both"]

initi->initj [dir="both"]
initi->initk [dir="both"]

initj->initk [dir="both"]
{
layout="circo";
"testnet_0\nprod=inita,initk,initu"->"testnet_1\nprod=initb,initl" [dir="forward"];
"testnet_0\nprod=inita,initk,initu"->"testnet_2\nprod=initc,initm" [dir="forward"];
"testnet_0\nprod=inita,initk,initu"->"testnet_3\nprod=initd,initn" [dir="forward"];
"testnet_0\nprod=inita,initk,initu"->"testnet_4\nprod=inite,inito" [dir="forward"];
"testnet_0\nprod=inita,initk,initu"->"testnet_5\nprod=initf,initp" [dir="forward"];
"testnet_0\nprod=inita,initk,initu"->"testnet_6\nprod=initg,initq" [dir="forward"];
"testnet_0\nprod=inita,initk,initu"->"testnet_7\nprod=inith,initr" [dir="forward"];
"testnet_0\nprod=inita,initk,initu"->"testnet_8\nprod=initi,inits" [dir="forward"];
"testnet_0\nprod=inita,initk,initu"->"testnet_9\nprod=initj,initt" [dir="forward"];
"testnet_1\nprod=initb,initl"->"testnet_2\nprod=initc,initm" [dir="forward"];
"testnet_1\nprod=initb,initl"->"testnet_3\nprod=initd,initn" [dir="forward"];
"testnet_1\nprod=initb,initl"->"testnet_4\nprod=inite,inito" [dir="forward"];
"testnet_1\nprod=initb,initl"->"testnet_5\nprod=initf,initp" [dir="forward"];
"testnet_1\nprod=initb,initl"->"testnet_6\nprod=initg,initq" [dir="forward"];
"testnet_1\nprod=initb,initl"->"testnet_7\nprod=inith,initr" [dir="forward"];
"testnet_1\nprod=initb,initl"->"testnet_8\nprod=initi,inits" [dir="forward"];
"testnet_1\nprod=initb,initl"->"testnet_9\nprod=initj,initt" [dir="forward"];
"testnet_2\nprod=initc,initm"->"testnet_3\nprod=initd,initn" [dir="forward"];
"testnet_2\nprod=initc,initm"->"testnet_4\nprod=inite,inito" [dir="forward"];
"testnet_2\nprod=initc,initm"->"testnet_5\nprod=initf,initp" [dir="forward"];
"testnet_2\nprod=initc,initm"->"testnet_6\nprod=initg,initq" [dir="forward"];
"testnet_2\nprod=initc,initm"->"testnet_7\nprod=inith,initr" [dir="forward"];
"testnet_2\nprod=initc,initm"->"testnet_8\nprod=initi,inits" [dir="forward"];
"testnet_2\nprod=initc,initm"->"testnet_9\nprod=initj,initt" [dir="forward"];
"testnet_3\nprod=initd,initn"->"testnet_4\nprod=inite,inito" [dir="forward"];
"testnet_3\nprod=initd,initn"->"testnet_5\nprod=initf,initp" [dir="forward"];
"testnet_3\nprod=initd,initn"->"testnet_6\nprod=initg,initq" [dir="forward"];
"testnet_3\nprod=initd,initn"->"testnet_7\nprod=inith,initr" [dir="forward"];
"testnet_3\nprod=initd,initn"->"testnet_8\nprod=initi,inits" [dir="forward"];
"testnet_3\nprod=initd,initn"->"testnet_9\nprod=initj,initt" [dir="forward"];
"testnet_4\nprod=inite,inito"->"testnet_5\nprod=initf,initp" [dir="forward"];
"testnet_4\nprod=inite,inito"->"testnet_6\nprod=initg,initq" [dir="forward"];
"testnet_4\nprod=inite,inito"->"testnet_7\nprod=inith,initr" [dir="forward"];
"testnet_4\nprod=inite,inito"->"testnet_8\nprod=initi,inits" [dir="forward"];
"testnet_4\nprod=inite,inito"->"testnet_9\nprod=initj,initt" [dir="forward"];
"testnet_5\nprod=initf,initp"->"testnet_6\nprod=initg,initq" [dir="forward"];
"testnet_5\nprod=initf,initp"->"testnet_7\nprod=inith,initr" [dir="forward"];
"testnet_5\nprod=initf,initp"->"testnet_8\nprod=initi,inits" [dir="forward"];
"testnet_5\nprod=initf,initp"->"testnet_9\nprod=initj,initt" [dir="forward"];
"testnet_6\nprod=initg,initq"->"testnet_7\nprod=inith,initr" [dir="forward"];
"testnet_6\nprod=initg,initq"->"testnet_8\nprod=initi,inits" [dir="forward"];
"testnet_6\nprod=initg,initq"->"testnet_9\nprod=initj,initt" [dir="forward"];
"testnet_7\nprod=inith,initr"->"testnet_8\nprod=initi,inits" [dir="forward"];
"testnet_7\nprod=inith,initr"->"testnet_9\nprod=initj,initt" [dir="forward"];
"testnet_8\nprod=initi,inits"->"testnet_9\nprod=initj,initt" [dir="forward"];
}

Binary file modified mesh.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions plugins/net_plugin/net_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2136,10 +2136,10 @@ namespace eosio {
void net_plugin::set_program_options( options_description& /*cli*/, options_description& cfg )
{
cfg.add_options()
( "listen-endpoint", bpo::value<string>()->default_value( "0.0.0.0:9876" ), "The local IP address and port to listen for incoming connections.")
( "remote-endpoint", bpo::value< vector<string> >()->composing(), "The IP address and port of a remote peer to sync with.")
( "public-endpoint", bpo::value<string>(), "Overrides the advertised listen endpointlisten ip address.")
( "agent-name", bpo::value<string>()->default_value("EOS Test Agent"), "The name supplied to identify this node amongst the peers.")
( "listen-endpoint", bpo::value<string>()->default_value( "0.0.0.0:9876" ), "The actual host:port used to listen for incoming p2p connections.")
( "public-endpoint", bpo::value<string>(), "An externally accessible host:port for identifying this node. Defaults to listen-endpoint.")
( "remote-endpoint", bpo::value< vector<string> >()->composing(), "The public endpoint of a peer node to connect to. Use multiple remote-endpoint options as needed to compose a network.")
( "agent-name", bpo::value<string>()->default_value("\"EOS Test Agent\""), "The name supplied to identify this node amongst the peers.")
( "send-whole-blocks", bpo::value<bool>()->default_value(def_send_whole_blocks), "True to always send full blocks, false to send block summaries" )
( "allowed-connection", bpo::value<vector<string>>()->multitoken()->default_value({"none"}, "none"), "Can be 'any' or 'producers' or 'specified' or 'none'. If 'specified', peer-key must be specified at least once. If only 'producers', peer-key is not required. 'producers' and 'specified' may be combined.")
( "peer-key", bpo::value<vector<string>>()->composing()->multitoken(), "Optional public key of peer allowed to connect. May be used multiple times.")
Expand Down
7 changes: 0 additions & 7 deletions plugins/producer_plugin/producer_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,6 @@ void producer_plugin::set_program_options(
fc::json::to_string(private_key_default)),
"Tuple of [public key, WIF private key] (may specify multiple times)")
;

command_line_options.add(producer_options);
config_file_options.add(producer_options);
}

Expand Down Expand Up @@ -257,11 +255,6 @@ block_production_condition::block_production_condition_enum producer_plugin_impl
// If the next block production opportunity is in the present or future, we're synced.
if( !_production_enabled )
{
#if 0
if( app().get_plugin<net_plugin>().num_peers() == 0 ) {
_production_enabled = true;
}
#endif
if( chain.get_slot_time(1) >= now )
_production_enabled = true;
else
Expand Down
24 changes: 8 additions & 16 deletions programs/launcher/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -311,9 +311,10 @@ struct launcher_def {
int start_delay;
bool nogen;
string launch_name;
bool random_start;

void assign_name (eosd_def &node);

void set_options (bpo::options_description &cli);
void initialize (const variables_map &vmap);
bool generate ();
Expand Down Expand Up @@ -347,6 +348,7 @@ launcher_def::set_options (bpo::options_description &cli) {
("delay,d",bpo::value<int>(&start_delay)->default_value(0),"seconds delay before starting each node after the first")
("nogen",bpo::bool_switch(&nogen)->default_value(false),"launch nodes without writing new config files")
("host-map",bpo::value<bf::path>(&host_map_file)->default_value(""),"a file containing mapping specific nodes to hosts. Used to enhance the custom shape argument")
("random", bpo::bool_switch(&random_start)->default_value(false),"start the nodes in a random order")
;
}

Expand Down Expand Up @@ -612,30 +614,19 @@ launcher_def::write_config_file (tn_node_def &node) {
cfg << "remote-endpoint = " << network.nodes.find(p)->second.instance->p2p_endpoint << "\n";
}
if (node.producers.size()) {
cfg << "enable-stale-production = false\n"
<< "required-participation = true\n";
cfg << "required-participation = true\n";
for (const auto &kp : node.keys ) {
cfg << "private-key = [\"" << kp.public_key
<< "\",\"" << kp.wif_private_key << "\"]\n";
}
cfg << "plugin = eosio::producer_plugin\n"
<< "plugin = eosio::chain_api_plugin\n"
<< "plugin = eosio::wallet_api_plugin\n"
<< "plugin = eosio::db_plugin\n"
<< "plugin = eosio::account_history_plugin\n"
<< "plugin = eosio::account_history_api_plugin\n";
for (auto &p : node.producers) {
cfg << "producer-name = " << p << "\n";
}
}
if( instance.has_db ) {
if( !node.producers.size() ) {
cfg << "plugin = eosio::producer_plugin\n";
}
cfg << "plugin = eosio::db_plugin\n";
cfg << "plugin = eosio::producer_plugin\n";
}
cfg << "plugin = eosio::chain_api_plugin\n"
<< "plugin = eosio::wallet_api_plugin\n"
<< "plugin = eosio::db_plugin\n"
<< "plugin = eosio::account_history_plugin\n"
<< "plugin = eosio::account_history_api_plugin\n";
cfg.close();
Expand Down Expand Up @@ -843,6 +834,7 @@ launcher_def::launch (eosd_def &node, string &gts) {
eosdcmd += "--skip-transaction-signatures ";
}
eosdcmd += eosd_extra_args + " ";
eosdcmd += "--enable-stale-production true ";
eosdcmd += "--data-dir " + node.data_dir;
if (gts.length()) {
eosdcmd += " --genesis-timestamp " + gts;
Expand Down Expand Up @@ -929,7 +921,7 @@ launcher_def::start_all (string &gts, launch_modes mode) {
case LM_REMOTE:
case LM_LOCAL: {
for (auto &h : host_map.bindings ) {
if (mode == LM_ALL ||
if (!random_start && mode == LM_ALL ||
(h.second.is_local() ? mode == LM_LOCAL : mode == LM_REMOTE)) {
for (auto &inst : h.second.instances) {
try {
Expand Down
74 changes: 32 additions & 42 deletions star.dot
Original file line number Diff line number Diff line change
@@ -1,44 +1,34 @@
digraph G
{
inita->initb [dir="both"]
inita->initd [dir="both"]
inita->initf [dir="both"]
inita->inith [dir="both"]
inita->initj [dir="both"]

initb->initc [dir="both"]
initb->inite [dir="both"]
initb->initg [dir="both"]
initb->initi [dir="both"]
initb->initk [dir="both"]

initc->initd [dir="both"]
initc->initf [dir="both"]
initc->inith [dir="both"]
initc->initj [dir="both"]

initd->inite [dir="both"]
initd->initg [dir="both"]
initd->initi [dir="both"]
initd->initk [dir="both"]

inite->initf [dir="both"]
inite->inith [dir="both"]
inite->initj [dir="both"]

initf->initg [dir="both"]
initf->initi [dir="both"]
initf->initk [dir="both"]

initg->inith [dir="both"]
initg->initj [dir="both"]

inith->initi [dir="both"]
inith->initk [dir="both"]

initi->initj [dir="both"]
initi->initk [dir="both"]

initj->initk [dir="both"]
{
layout="circo";
"testnet_0\nprod=inita,initk,initu"->"testnet_3\nprod=initd,initn" [dir="forward"];
"testnet_0\nprod=inita,initk,initu"->"testnet_6\nprod=initg,initq" [dir="forward"];
"testnet_0\nprod=inita,initk,initu"->"testnet_9\nprod=initj,initt" [dir="forward"];
"testnet_1\nprod=initb,initl"->"testnet_4\nprod=inite,inito" [dir="forward"];
"testnet_1\nprod=initb,initl"->"testnet_7\nprod=inith,initr" [dir="forward"];
"testnet_1\nprod=initb,initl"->"testnet_0\nprod=inita,initk,initu" [dir="forward"];
"testnet_2\nprod=initc,initm"->"testnet_5\nprod=initf,initp" [dir="forward"];
"testnet_2\nprod=initc,initm"->"testnet_8\nprod=initi,inits" [dir="forward"];
"testnet_2\nprod=initc,initm"->"testnet_1\nprod=initb,initl" [dir="forward"];
"testnet_3\nprod=initd,initn"->"testnet_6\nprod=initg,initq" [dir="forward"];
"testnet_3\nprod=initd,initn"->"testnet_9\nprod=initj,initt" [dir="forward"];
"testnet_3\nprod=initd,initn"->"testnet_2\nprod=initc,initm" [dir="forward"];
"testnet_4\nprod=inite,inito"->"testnet_7\nprod=inith,initr" [dir="forward"];
"testnet_4\nprod=inite,inito"->"testnet_0\nprod=inita,initk,initu" [dir="forward"];
"testnet_4\nprod=inite,inito"->"testnet_3\nprod=initd,initn" [dir="forward"];
"testnet_5\nprod=initf,initp"->"testnet_8\nprod=initi,inits" [dir="forward"];
"testnet_5\nprod=initf,initp"->"testnet_1\nprod=initb,initl" [dir="forward"];
"testnet_5\nprod=initf,initp"->"testnet_4\nprod=inite,inito" [dir="forward"];
"testnet_6\nprod=initg,initq"->"testnet_9\nprod=initj,initt" [dir="forward"];
"testnet_6\nprod=initg,initq"->"testnet_2\nprod=initc,initm" [dir="forward"];
"testnet_6\nprod=initg,initq"->"testnet_5\nprod=initf,initp" [dir="forward"];
"testnet_7\nprod=inith,initr"->"testnet_0\nprod=inita,initk,initu" [dir="forward"];
"testnet_7\nprod=inith,initr"->"testnet_3\nprod=initd,initn" [dir="forward"];
"testnet_7\nprod=inith,initr"->"testnet_6\nprod=initg,initq" [dir="forward"];
"testnet_8\nprod=initi,inits"->"testnet_1\nprod=initb,initl" [dir="forward"];
"testnet_8\nprod=initi,inits"->"testnet_4\nprod=inite,inito" [dir="forward"];
"testnet_8\nprod=initi,inits"->"testnet_7\nprod=inith,initr" [dir="forward"];
"testnet_9\nprod=initj,initt"->"testnet_2\nprod=initc,initm" [dir="forward"];
"testnet_9\nprod=initj,initt"->"testnet_5\nprod=initf,initp" [dir="forward"];
"testnet_9\nprod=initj,initt"->"testnet_8\nprod=initi,inits" [dir="forward"];
}

Binary file modified star.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit e1afcec

Please sign in to comment.