Skip to content

Commit a7f2601

Browse files
authored
Merge pull request #1804 from EOSIO/merge-664-try-3
Third try at getting a clean commit pushed. #1614
2 parents cc817b2 + 793a01b commit a7f2601

24 files changed

+1086
-476
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ object_database/*
7474
build/*
7575
build-debug/*
7676

77-
tn_data_*
77+
etc/eosio/node_*
78+
var/lib/node_*
7879
.vscode
7980
.DS_Store

CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,11 +202,19 @@ add_subdirectory( tests )
202202
add_subdirectory( tools )
203203
add_subdirectory( debian )
204204

205+
install(FILES genesis.json DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
206+
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/genesis.json ${CMAKE_CURRENT_BINARY_DIR}/genesis.json COPYONLY)
207+
205208
install(FILES genesis.json DESTINATION ${CMAKE_INSTALL_FULL_SYSCONFDIR}/eosio/node_00)
206209
install_directory_permissions(DIRECTORY ${CMAKE_INSTALL_FULL_SYSCONFDIR}/eosio)
207210
install_directory_permissions(DIRECTORY ${CMAKE_INSTALL_FULL_SYSCONFDIR}/eosio/node_00)
208211
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/genesis.json ${CMAKE_CURRENT_BINARY_DIR}/etc/eosio/node_00/genesis.json COPYONLY)
209212

213+
install(FILES testnet.template DESTINATION ${CMAKE_INSTALL_FULL_SYSCONFDIR}/eosio/launcher)
214+
install_directory_permissions(DIRECTORY ${CMAKE_INSTALL_FULL_SYSCONFDIR}/eosio)
215+
install_directory_permissions(DIRECTORY ${CMAKE_INSTALL_FULL_SYSCONFDIR}/eosio/launcher)
216+
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/testnet.template ${CMAKE_CURRENT_BINARY_DIR}/etc/eosio/launcher/testnet.template COPYONLY)
217+
210218
include(installer)
211219

212220
include(doxygen)

Jenkinsfile

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ pipeline {
1818
steps {
1919
sh '''
2020
. $HOME/.bash_profile
21-
echo 1 | ./eosio_build.sh
22-
'''
21+
echo 1 | ./eosio_build.sh
22+
'''
2323
stash includes: 'build/**/*', name: 'buildMacOS'
2424
}
2525
}
@@ -28,7 +28,7 @@ pipeline {
2828
steps {
2929
sh '''
3030
. $HOME/.bash_profile
31-
echo 1 | ./eosio_build.sh
31+
echo 1 | ./eosio_build.sh
3232
'''
3333
stash includes: 'build/**/*', name: 'buildFedora'
3434
}
@@ -53,8 +53,8 @@ pipeline {
5353
post {
5454
failure {
5555
archiveArtifacts 'build/genesis.json'
56-
archiveArtifacts 'build/tn_data_00/config.ini'
57-
archiveArtifacts 'build/tn_data_00/stderr.txt'
56+
archiveArtifacts 'build/etc/eosio/node_00/config.ini'
57+
archiveArtifacts 'build/var/lib/node_00/stderr.txt'
5858
archiveArtifacts 'build/test_walletd_output.log'
5959
}
6060
}
@@ -75,8 +75,8 @@ pipeline {
7575
post {
7676
failure {
7777
archiveArtifacts 'build/genesis.json'
78-
archiveArtifacts 'build/tn_data_00/config.ini'
79-
archiveArtifacts 'build/tn_data_00/stderr.txt'
78+
archiveArtifacts 'build/etc/eosio/node_00/config.ini'
79+
archiveArtifacts 'build/var/lib/node_00/stderr.txt'
8080
archiveArtifacts 'build/test_walletd_output.log'
8181
}
8282
}
@@ -97,21 +97,21 @@ pipeline {
9797
post {
9898
failure {
9999
archiveArtifacts 'build/genesis.json'
100-
archiveArtifacts 'build/tn_data_00/config.ini'
101-
archiveArtifacts 'build/tn_data_00/stderr.txt'
100+
archiveArtifacts 'build/etc/eosio/node_00/config.ini'
101+
archiveArtifacts 'build/var/lib/node_00/stderr.txt'
102102
archiveArtifacts 'build/test_walletd_output.log'
103103
}
104104
}
105105
}
106106
}
107107
}
108108
}
109-
post {
110-
always {
109+
post {
110+
always {
111111
node('Ubuntu') {
112112
cleanWs()
113113
}
114-
114+
115115
node('MacOS') {
116116
cleanWs()
117117
}

eosio_build.sh

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,19 @@
66
# Copyright (c) 2017, Respective Authors all rights reserved.
77
#
88
# After June 1, 2018 this software is available under the following terms:
9-
#
9+
#
1010
# The MIT License
11-
#
11+
#
1212
# Permission is hereby granted, free of charge, to any person obtaining a copy
1313
# of this software and associated documentation files (the "Software"), to deal
1414
# in the Software without restriction, including without limitation the rights
1515
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1616
# copies of the Software, and to permit persons to whom the Software is
1717
# furnished to do so, subject to the following conditions:
18-
#
18+
#
1919
# The above copyright notice and this permission notice shall be included in
2020
# all copies or substantial portions of the Software.
21-
#
21+
#
2222
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
2323
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
2424
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -37,15 +37,16 @@
3737
TEMP_DIR=/tmp
3838
ARCH=$( uname )
3939
DISK_MIN=20
40-
40+
BUILD_MONGO_DB_PLUGIN=false
41+
4142
txtbld=$(tput bold)
4243
bldred=${txtbld}$(tput setaf 1)
4344
txtrst=$(tput sgr0)
4445

4546
printf "\n\tARCHITECTURE: ${ARCH}\n"
4647

4748
if [ $ARCH == "Linux" ]; then
48-
49+
4950
if [ ! -e /etc/os-release ]; then
5051
printf "\n\tEOSIO currently supports Amazon, Centos, Fedora, Mint & Ubuntu Linux only.\n"
5152
printf "\tPlease install on the latest version of one of these Linux distributions.\n"
@@ -57,9 +58,9 @@
5758
printf "\tExiting now.\n"
5859
exit 1
5960
fi
60-
61+
6162
OS_NAME=$( cat /etc/os-release | grep ^NAME | cut -d'=' -f2 | sed 's/\"//gI' )
62-
63+
6364
case $OS_NAME in
6465
"Amazon Linux AMI")
6566
FILE=${WORK_DIR}/scripts/eosio_build_amazon.sh
@@ -102,7 +103,7 @@
102103
printf "\n\tUnsupported Linux Distribution. Exiting now.\n\n"
103104
exit 1
104105
esac
105-
106+
106107
export BOOST_ROOT=${HOME}/opt/boost_1_66_0
107108
export OPENSSL_ROOT_DIR=/usr/include/openssl
108109
export OPENSSL_LIBRARIES=/usr/include/openssl
@@ -134,12 +135,16 @@
134135
if [ -z $CMAKE ]; then
135136
CMAKE=$( which cmake )
136137
fi
137-
138+
139+
if [ -f ${MONGOD_CONF} ]; then
140+
BUILD_MONGO_DB_PLUGIN=true
141+
fi
142+
138143
$CMAKE -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_CXX_COMPILER=${CXX_COMPILER} \
139144
-DCMAKE_C_COMPILER=${C_COMPILER} -DWASM_ROOT=${WASM_ROOT} \
140145
-DOPENSSL_ROOT_DIR=${OPENSSL_ROOT_DIR} -DBUILD_MONGO_DB_PLUGIN=true \
141146
-DOPENSSL_LIBRARIES=${OPENSSL_LIBRARIES} ..
142-
147+
143148
if [ $? -ne 0 ]; then
144149
printf "\n\t>>>>>>>>>>>>>>>>>>>> CMAKE building EOSIO has exited with the above error.\n\n"
145150
exit -1
@@ -169,8 +174,8 @@
169174
else
170175
printf "\n\tMongoDB is running PID=${MONGODB_PID}.\n"
171176
fi
172-
173-
if [ "x${EOSIO_BUILD_PACKAGE}" != "x" ]; then
177+
178+
if [ "x${EOSIO_BUILD_PACKAGE}" != "x" ]; then
174179
# Build eos.io package
175180
$CMAKE -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_CXX_COMPILER=${CXX_COMPILER} \
176181
-DCMAKE_C_COMPILER=${C_COMPILER} -DWASM_ROOT=${WASM_ROOT} \
@@ -190,4 +195,4 @@
190195
fi
191196

192197
printf "\n\t>>>>>>>>>>>>>>>>>>>> eos.io package has been successfully built.\n\n"
193-
fi
198+
fi

plugins/net_plugin/net_plugin.cpp

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -965,7 +965,7 @@ namespace eosio {
965965
}
966966

967967
void connection::enqueue( const net_message &m, bool trigger_send ) {
968-
bool close_after_send = false;
968+
go_away_reason close_after_send = no_reason;
969969
if(m.contains<sync_request_message>()) {
970970
sync_wait( );
971971
}
@@ -974,7 +974,9 @@ namespace eosio {
974974
fetch_wait( );
975975
}
976976
else {
977-
close_after_send = m.contains<go_away_message>();
977+
if (m.contains<go_away_message>()) {
978+
close_after_send = m.get<go_away_message>().reason;
979+
}
978980
}
979981

980982
uint32_t payload_size = fc::raw::pack_size( m );
@@ -991,8 +993,8 @@ namespace eosio {
991993
queue_write(send_buffer,trigger_send,
992994
[this, close_after_send](boost::system::error_code ec, std::size_t ) {
993995
write_depth--;
994-
if(close_after_send) {
995-
elog ("sent a go away message, closing connection to ${p}",("p",peer_name()));
996+
if(close_after_send != no_reason) {
997+
elog ("sent a go away message: ${r}, closing connection to ${p}",("r",reason_str(close_after_send))("p",peer_name()));
996998
my_impl->close(shared_from_this());
997999
return;
9981000
}
@@ -1124,6 +1126,9 @@ namespace eosio {
11241126
state = newstate;
11251127
string ns = state == in_sync ? "in sync" : state == lib_catchup ? "lib catchup" : "head catchup";
11261128
fc_dlog(logger, "old state ${os} becoming ${ns}",("os",os)("ns",ns));
1129+
if (state == in_sync) {
1130+
source.reset();
1131+
}
11271132
}
11281133

11291134
bool sync_manager::is_active(connection_ptr c) {
@@ -1137,12 +1142,16 @@ namespace eosio {
11371142
}
11381143

11391144
void sync_manager::reset_lib_num(connection_ptr c) {
1145+
if(state == in_sync) {
1146+
sync_last_requested_num = chain_plug->chain().last_irreversible_block_num();
1147+
source.reset();
1148+
}
11401149
if( c->current() ) {
11411150
if( c->last_handshake_recv.last_irreversible_block_num > sync_known_lib_num) {
11421151
sync_known_lib_num =c->last_handshake_recv.last_irreversible_block_num;
11431152
}
11441153
} else if( c == source ) {
1145-
sync_last_requested_num = chain_plug->chain().head_block_num();
1154+
sync_last_requested_num = chain_plug->chain().last_irreversible_block_num();
11461155
request_next_chunk();
11471156
}
11481157
}
@@ -1212,10 +1221,8 @@ namespace eosio {
12121221

12131222
if (!source) {
12141223
elog("Unable to continue syncing at this time");
1215-
sync_last_requested_num = chain_plug->chain().head_block_num();
12161224
sync_known_lib_num = chain_plug->chain().last_irreversible_block_num();
1217-
fc_ilog(logger, "resetting request, our last req is ${cc}, peer ${p}",
1218-
( "cc",sync_last_requested_num)("p",source->peer_name()));
1225+
sync_last_requested_num = sync_known_lib_num;
12191226
return;
12201227
}
12211228

plugins/producer_plugin/producer_plugin.cpp

Lines changed: 43 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ class producer_plugin_impl {
4141
std::map<chain::public_key_type, chain::private_key_type> _private_keys;
4242
std::set<chain::account_name> _producers;
4343
boost::asio::deadline_timer _timer;
44+
45+
block_production_condition::block_production_condition_enum _prev_result = block_production_condition::produced;
46+
uint32_t _prev_result_count = 0;
4447
};
4548

4649
void new_chain_banner(const eosio::chain::chain_controller& db)
@@ -215,40 +218,48 @@ block_production_condition::block_production_condition_enum producer_plugin_impl
215218
elog("Got exception while generating block:\n${e}", ("e", e.to_detail_string()));
216219
result = block_production_condition::exception_producing_block;
217220
}
218-
219-
switch(result)
220-
{
221-
case block_production_condition::produced: {
222-
const auto& db = app().get_plugin<chain_plugin>().chain();
223-
auto producer = db.head_block_producer();
224-
// auto pending = db.pending().size();
225-
226-
wlog("\r${p} generated block ${id}... #${n} @ ${t} with ${count} trxs", ("p", producer)(capture) );
227-
break;
221+
if(result != block_production_condition::produced && result == _prev_result) {
222+
_prev_result_count++;
223+
}
224+
else {
225+
if (_prev_result_count > 1) {
226+
ilog("Previous result occurred ${r} times",("r", _prev_result_count));
228227
}
229-
case block_production_condition::not_synced:
230-
ilog("Not producing block because production is disabled until we receive a recent block (see: --enable-stale-production)");
231-
break;
232-
case block_production_condition::not_my_turn:
233-
ilog("Not producing block because it isn't my turn, its ${scheduled_producer}", (capture) );
234-
break;
235-
case block_production_condition::not_time_yet:
236-
ilog("Not producing block because slot has not yet arrived");
237-
break;
238-
case block_production_condition::no_private_key:
239-
ilog("Not producing block because I don't have the private key for ${scheduled_key}", (capture) );
240-
break;
241-
case block_production_condition::low_participation:
242-
elog("Not producing block because node appears to be on a minority fork with only ${pct}% producer participation", (capture) );
243-
break;
244-
case block_production_condition::lag:
245-
elog("Not producing block because node didn't wake up within 500ms of the slot time.");
246-
break;
247-
case block_production_condition::exception_producing_block:
248-
elog( "exception producing block" );
249-
break;
228+
_prev_result_count = 1;
229+
_prev_result = result;
230+
switch(result)
231+
{
232+
case block_production_condition::produced: {
233+
const auto& db = app().get_plugin<chain_plugin>().chain();
234+
auto producer = db.head_block_producer();
235+
// auto pending = db.pending().size();
236+
237+
wlog("\r${p} generated block ${id}... #${n} @ ${t} with ${count} trxs", ("p", producer)(capture) );
238+
break;
239+
}
240+
case block_production_condition::not_synced:
241+
ilog("Not producing block because production is disabled until we receive a recent block (see: --enable-stale-production)");
242+
break;
243+
case block_production_condition::not_my_turn:
244+
ilog("Not producing block because it isn't my turn, its ${scheduled_producer}", (capture) );
245+
break;
246+
case block_production_condition::not_time_yet:
247+
ilog("Not producing block because slot has not yet arrived");
248+
break;
249+
case block_production_condition::no_private_key:
250+
ilog("Not producing block because I don't have the private key for ${scheduled_key}", (capture) );
251+
break;
252+
case block_production_condition::low_participation:
253+
elog("Not producing block because node appears to be on a minority fork with only ${pct}% producer participation", (capture) );
254+
break;
255+
case block_production_condition::lag:
256+
elog("Not producing block because node didn't wake up within 500ms of the slot time.");
257+
break;
258+
case block_production_condition::exception_producing_block:
259+
elog( "exception producing block" );
260+
break;
261+
}
250262
}
251-
252263
schedule_production_loop();
253264
return result;
254265
}

programs/eosio-launcher/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ configure_file(config.hpp.in config.hpp ESCAPE_QUOTES)
2929
target_include_directories(eosio-launcher PUBLIC ${CMAKE_CURRENT_BINARY_DIR})
3030

3131
target_link_libraries(eosio-launcher
32-
PRIVATE fc ${CMAKE_DL_LIBS} ${PLATFORM_SPECIFIC_LIBS} )
32+
PRIVATE eosio_chain fc ${CMAKE_DL_LIBS} ${PLATFORM_SPECIFIC_LIBS} )
3333

3434
install( TARGETS
3535
eosio-launcher

0 commit comments

Comments
 (0)