Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade boost #141

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[submodule "libraries/chainbase"]
path = libraries/chainbase
url = https://github.com/eosio/chainbase
url = https://github.com/boscore/chainbase
ignore = dirty
[submodule "libraries/appbase"]
path = libraries/appbase
Expand Down
43 changes: 15 additions & 28 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,8 @@ endif()
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/libraries/fc/CMakeModules")
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules")

if (UNIX)
if (APPLE)
if (LLVM_DIR STREQUAL "" OR NOT LLVM_DIR)
set(LLVM_DIR "/usr/local/opt/llvm@4/lib/cmake/llvm/")
endif()
endif()
if (UNIX AND APPLE)
list(APPEND CMAKE_PREFIX_PATH "/usr/local/opt/llvm@4" "/usr/local/opt/gettext")
endif()

include( GNUInstallDirs )
Expand Down Expand Up @@ -52,8 +48,8 @@ set( INSTALLER_APP_ID "68ad7005-8eee-49c9-95ce-9eed97e5b347" )

# http://stackoverflow.com/a/18369825
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 6.0)
message(FATAL_ERROR "GCC version must be at least 6.0!")
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.0)
message(FATAL_ERROR "GCC version must be at least 7.0!")
endif()
if ("${CMAKE_GENERATOR}" STREQUAL "Ninja")
add_compile_options(-fdiagnostics-color=always)
Expand Down Expand Up @@ -112,24 +108,18 @@ IF( WIN32 )
set(Boost_USE_MULTITHREADED ON)
set(BOOST_ALL_DYN_LINK OFF) # force dynamic linking for all libraries
ENDIF(WIN32)
FIND_PACKAGE(Boost 1.67 REQUIRED COMPONENTS
set( Boost_NO_BOOST_CMAKE ON CACHE STRING "ON or OFF" )
FIND_PACKAGE(Boost 1.71 REQUIRED COMPONENTS
thread
date_time
filesystem
system
program_options
signals
serialization
chrono
unit_test_framework
context
locale
iostreams)

# Some new stdlibc++s will #error on <experimental/string_view>; a problem for boost pre-1.69
if( APPLE AND UNIX )
add_definitions(-DBOOST_ASIO_DISABLE_STD_EXPERIMENTAL_STRING_VIEW)
endif()
add_definitions(-DBOOST_ASIO_DISABLE_STD_EXPERIMENTAL_STRING_VIEW)

if( WIN32 )

Expand Down Expand Up @@ -169,11 +159,11 @@ else( WIN32 ) # Apple AND Linux
if( APPLE )
# Apple Specific Options Here
message( STATUS "Configuring EOSIO on OS X" )
set( CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -Wall -Wno-deprecated-declarations" )
set( CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_CXX_FLAGS} -Wall -Wno-deprecated-declarations" )
else( APPLE )
# Linux Specific Options Here
message( STATUS "Configuring EOSIO on Linux" )
set( CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -Wall" )
set( CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_CXX_FLAGS} -Wall" )
if ( FULL_STATIC_BUILD )
set( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libstdc++ -static-libgcc")
endif ( FULL_STATIC_BUILD )
Expand Down Expand Up @@ -262,27 +252,24 @@ install(FILES ${CMAKE_BINARY_DIR}/modules/eosio-config.cmake DESTINATION ${CMAKE
configure_file(${CMAKE_SOURCE_DIR}/CMakeModules/EosioTester.cmake.in ${CMAKE_BINARY_DIR}/modules/EosioTester.cmake @ONLY)
install(FILES ${CMAKE_BINARY_DIR}/modules/EosioTester.cmake DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}/cmake/eosio)

configure_file(${CMAKE_SOURCE_DIR}/LICENSE
configure_file(${CMAKE_SOURCE_DIR}/LICENSE
${CMAKE_BINARY_DIR}/licenses/eosio/LICENSE COPYONLY)
configure_file(${CMAKE_SOURCE_DIR}/libraries/wabt/LICENSE
configure_file(${CMAKE_SOURCE_DIR}/libraries/wabt/LICENSE
${CMAKE_BINARY_DIR}/licenses/eosio/LICENSE.wabt COPYONLY)
configure_file(${CMAKE_SOURCE_DIR}/libraries/softfloat/COPYING.txt
configure_file(${CMAKE_SOURCE_DIR}/libraries/softfloat/COPYING.txt
${CMAKE_BINARY_DIR}/licenses/eosio/LICENSE.softfloat COPYONLY)
configure_file(${CMAKE_SOURCE_DIR}/libraries/wasm-jit/LICENSE
configure_file(${CMAKE_SOURCE_DIR}/libraries/wasm-jit/LICENSE
${CMAKE_BINARY_DIR}/licenses/eosio/LICENSE.wavm COPYONLY)
configure_file(${CMAKE_SOURCE_DIR}/libraries/fc/secp256k1/upstream/COPYING
configure_file(${CMAKE_SOURCE_DIR}/libraries/fc/secp256k1/upstream/COPYING
${CMAKE_BINARY_DIR}/licenses/eosio/LICENSE.secp256k1 COPYONLY)
configure_file(${CMAKE_SOURCE_DIR}/libraries/fc/src/network/LICENSE.go
configure_file(${CMAKE_SOURCE_DIR}/libraries/fc/src/network/LICENSE.go
${CMAKE_BINARY_DIR}/licenses/eosio/LICENSE.go COPYONLY)
configure_file(${CMAKE_SOURCE_DIR}/externals/binaryen/LICENSE
${CMAKE_BINARY_DIR}/licenses/eosio/LICENSE.binaryen COPYONLY)

install(FILES LICENSE DESTINATION ${CMAKE_INSTALL_FULL_DATAROOTDIR}/licenses/eosio/)
install(FILES libraries/wabt/LICENSE DESTINATION ${CMAKE_INSTALL_FULL_DATAROOTDIR}/licenses/eosio/ RENAME LICENSE.wabt)
install(FILES libraries/softfloat/COPYING.txt DESTINATION ${CMAKE_INSTALL_FULL_DATAROOTDIR}/licenses/eosio/ RENAME LICENSE.softfloat)
install(FILES libraries/wasm-jit/LICENSE DESTINATION ${CMAKE_INSTALL_FULL_DATAROOTDIR}/licenses/eosio/ RENAME LICENSE.wavm)
install(FILES libraries/fc/secp256k1/upstream/COPYING DESTINATION ${CMAKE_INSTALL_FULL_DATAROOTDIR}/licenses/eosio/ RENAME LICENSE.secp256k1)
install(FILES externals/binaryen/LICENSE DESTINATION ${CMAKE_INSTALL_FULL_DATAROOTDIR}/licenses/eosio/ RENAME LICENSE.binaryen)
install(FILES libraries/fc/src/network/LICENSE.go DESTINATION ${CMAKE_INSTALL_FULL_DATAROOTDIR}/licenses/eosio/ )

include(package)
Expand Down
2 changes: 1 addition & 1 deletion Docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ COPY --from=builder /bos/Docker/nodeosd.sh /opt/eosio/bin/nodeosd.sh
ENV EOSIO_ROOT=/opt/eosio
RUN chmod +x /opt/eosio/bin/nodeosd.sh
ENV LD_LIBRARY_PATH /usr/local/lib
ENV PATH /opt/eosio/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
ENV PATH /opt/eosio/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
8 changes: 4 additions & 4 deletions Docker/builder/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ RUN wget https://cmake.org/files/v3.9/cmake-3.9.6-Linux-x86_64.sh \
ENV CC clang
ENV CXX clang++

RUN wget https://dl.bintray.com/boostorg/release/1.67.0/source/boost_1_67_0.tar.bz2 -O - | tar -xj \
&& cd boost_1_67_0 \
RUN wget https://dl.bintray.com/boostorg/release/1.71.0/source/boost_1_71_0.tar.bz2 -O - | tar -xj \
&& cd boost_1_71_0 \
&& ./bootstrap.sh --prefix=/usr/local \
&& echo 'using clang : 4.0 : clang++-4.0 ;' >> project-config.jam \
&& ./b2 -d0 -j$(nproc) --with-thread --with-date_time --with-system --with-filesystem --with-program_options \
--with-signals --with-serialization --with-chrono --with-test --with-context --with-locale --with-coroutine --with-iostreams toolset=clang link=static install \
&& cd .. && rm -rf boost_1_67_0
--with-serialization --with-chrono --with-test --with-context --with-locale --with-coroutine --with-iostreams toolset=clang link=static install \
&& cd .. && rm -rf boost_1_71_0

RUN wget https://github.com/mongodb/mongo-c-driver/releases/download/1.10.2/mongo-c-driver-1.10.2.tar.gz -O - | tar -xz \
&& cd mongo-c-driver-1.10.2 \
Expand Down
12 changes: 0 additions & 12 deletions Docker/config.ini
Original file line number Diff line number Diff line change
@@ -1,15 +1,3 @@
# the endpoint upon which to listen for incoming connections (eosio::bnet_plugin)
bnet-endpoint = 0.0.0.0:4321

# the number of threads to use to process network messages (eosio::bnet_plugin)
# bnet-threads =

# remote endpoint of other node to connect to; Use multiple bnet-connect options as needed to compose a network (eosio::bnet_plugin)
# bnet-connect =

# this peer will request no pending transactions from other nodes (eosio::bnet_plugin)
bnet-no-trx = false

# the location of the blocks directory (absolute path or relative to application data dir) (eosio::chain_plugin)
blocks-dir = "blocks"

Expand Down
16 changes: 8 additions & 8 deletions eosio_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,8 @@
;;
"elementary OS")
FILE="${SOURCE_DIR}/scripts/eosio_build_ubuntu.sh"
CXX_COMPILER=clang++-4.0
C_COMPILER=clang-4.0
CXX_COMPILER=clang++
C_COMPILER=clang
MONGOD_CONF=${HOME}/opt/mongodb/mongod.conf
export PATH=${HOME}/opt/mongodb/bin:$PATH
;;
Expand All @@ -201,22 +201,22 @@
;;
"Linux Mint")
FILE="${SOURCE_DIR}/scripts/eosio_build_ubuntu.sh"
CXX_COMPILER=clang++-4.0
C_COMPILER=clang-4.0
CXX_COMPILER=clang++
C_COMPILER=clang
MONGOD_CONF=${HOME}/opt/mongodb/mongod.conf
export PATH=${HOME}/opt/mongodb/bin:$PATH
;;
"Ubuntu")
FILE="${SOURCE_DIR}/scripts/eosio_build_ubuntu.sh"
CXX_COMPILER=clang++-4.0
C_COMPILER=clang-4.0
CXX_COMPILER=clang++
C_COMPILER=clang
MONGOD_CONF=${HOME}/opt/mongodb/mongod.conf
export PATH=${HOME}/opt/mongodb/bin:$PATH
;;
"Debian GNU/Linux")
FILE=${SOURCE_DIR}/scripts/eosio_build_ubuntu.sh
CXX_COMPILER=clang++-4.0
C_COMPILER=clang-4.0
CXX_COMPILER=clang++
C_COMPILER=clang
MONGOD_CONF=${HOME}/opt/mongodb/mongod.conf
export PATH=${HOME}/opt/mongodb/bin:$PATH
;;
Expand Down
24 changes: 19 additions & 5 deletions libraries/chain/controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,10 @@ struct controller_impl {
template<typename Signal, typename Arg>
void emit( const Signal& s, Arg&& a ) {
try {
s(std::forward<Arg>(a));
s( std::forward<Arg>( a ));
} catch (std::bad_alloc& e) {
wlog( "std::bad_alloc" );
throw e;
} catch (boost::interprocess::bad_alloc& e) {
wlog( "bad alloc" );
throw e;
Expand Down Expand Up @@ -466,9 +469,6 @@ struct controller_impl {

~controller_impl() {
pending.reset();

db.flush();
reversible_blocks.flush();
}

void add_indices() {
Expand Down Expand Up @@ -671,7 +671,6 @@ struct controller_impl {
return enc.result();
}


/**
* Sets fork database head to the genesis state.
*/
Expand Down Expand Up @@ -1651,7 +1650,22 @@ struct controller_impl {
if (!pbft_enabled) return;

if ( pending_pbft_lib ) {
//this is a temp solution for getting current lib, should not use anywhere else;
auto current_lib = fork_db.get_block_in_current_chain_by_num(head->bft_irreversible_blocknum)->id;
fork_db.set_bft_irreversible(*pending_pbft_lib);
if (!replaying) {
auto libs_to_be_emitted = vector<block_state_ptr>{};
auto b = fork_db.get_block(*pending_pbft_lib);
while (b->id != current_lib) {
libs_to_be_emitted.emplace_back(b);
b = fork_db.get_block(b->prev());
}
while (!libs_to_be_emitted.empty()) {
emit( self.new_irreversible_block, libs_to_be_emitted.back() );
libs_to_be_emitted.pop_back();
}
}

pending_pbft_lib.reset();

if (!pending && read_mode != db_read_mode::IRREVERSIBLE) {
Expand Down
2 changes: 1 addition & 1 deletion libraries/chain/include/eosio/chain/asset.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ with amount = 10 and symbol(4,"CUR")

*/

struct asset
struct asset : fc::reflect_init
{
static constexpr int64_t max_amount = (1LL << 62) - 1;

Expand Down
2 changes: 0 additions & 2 deletions libraries/chain/include/eosio/chain/chain_id_type.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@ namespace chain {

friend class eosio::net_plugin_impl;
friend struct eosio::handshake_message;

friend struct ::hello; // TODO: Rushed hack to support bnet_plugin. Need a better solution.
};

} } // namespace eosio::chain
Expand Down
1 change: 1 addition & 0 deletions libraries/chain/include/eosio/chain/controller.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,7 @@ namespace eosio { namespace chain {
signal<void(const block_state_ptr&)> accepted_block_header;
signal<void(const block_state_ptr&)> accepted_block;
signal<void(const block_state_ptr&)> irreversible_block;
signal<void(const block_state_ptr&)> new_irreversible_block;
signal<void(const transaction_metadata_ptr&)> accepted_transaction;
signal<void(const transaction_trace_ptr&)> applied_transaction;
signal<void(const header_confirmation&)> accepted_confirmation;
Expand Down
2 changes: 1 addition & 1 deletion libraries/chain/include/eosio/chain/symbol.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ namespace eosio {
operator uint64_t()const { return value; }
};

class symbol {
class symbol : fc::reflect_init {
public:

static constexpr uint8_t max_precision = 18;
Expand Down
3 changes: 2 additions & 1 deletion libraries/chain/include/eosio/chain/transaction.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ namespace eosio { namespace chain {
bool allow_duplicate_keys = false )const;
};

struct packed_transaction {
struct packed_transaction : fc::reflect_init {
enum compression_type {
none = 0,
zlib = 1,
Expand Down Expand Up @@ -158,6 +158,7 @@ namespace eosio { namespace chain {

friend struct fc::reflector<packed_transaction>;
friend struct fc::reflector_init_visitor<packed_transaction>;
friend struct fc::has_reflector_init<packed_transaction>;
void reflector_init();
private:
vector<signature_type> signatures;
Expand Down
12 changes: 6 additions & 6 deletions libraries/chain/transaction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,18 +99,19 @@ fc::microseconds transaction::get_signature_keys( const vector<signature_type>&

std::unique_lock<std::mutex> lock(cache_mtx, std::defer_lock);
fc::microseconds sig_cpu_usage;
const auto digest_time = fc::time_point::now() - start;
for(const signature_type& sig : signatures) {
auto now = fc::time_point::now();
EOS_ASSERT( now < deadline, tx_cpu_usage_exceeded, "transaction signature verification executed for too long",
("now", now)("deadline", deadline)("start", start) );
auto sig_start = fc::time_point::now();
EOS_ASSERT( sig_start < deadline, tx_cpu_usage_exceeded, "transaction signature verification executed for too long",
("now", sig_start)("deadline", deadline)("start", start) );
public_key_type recov;
const auto& tid = id();
lock.lock();
recovery_cache_type::index<by_sig>::type::iterator it = recovery_cache.get<by_sig>().find( sig );
if( it == recovery_cache.get<by_sig>().end() || it->trx_id != tid ) {
lock.unlock();
recov = public_key_type( sig, digest );
fc::microseconds cpu_usage = fc::time_point::now() - start;
fc::microseconds cpu_usage = fc::time_point::now() - sig_start;
lock.lock();
recovery_cache.emplace_back( cached_pub_key{tid, recov, sig, cpu_usage} ); //could fail on dup signatures; not a problem
sig_cpu_usage += cpu_usage;
Expand All @@ -131,7 +132,7 @@ fc::microseconds transaction::get_signature_keys( const vector<signature_type>&
recovery_cache.erase( recovery_cache.begin());
lock.unlock();

return sig_cpu_usage;
return sig_cpu_usage + digest_time;
} FC_CAPTURE_AND_RETHROW() }


Expand Down Expand Up @@ -327,7 +328,6 @@ packed_transaction::packed_transaction( transaction&& t, vector<signature_type>&
void packed_transaction::reflector_init()
{
// called after construction, but always on the same thread and before packed_transaction passed to any other threads
static_assert(&fc::reflector_init_visitor<packed_transaction>::reflector_init, "FC with reflector_init required");
static_assert(fc::raw::has_feature_reflector_init_on_unpacked_reflected_types,
"FC unpack needs to call reflector_init otherwise unpacked_trx will not be initialized");
EOS_ASSERT( unpacked_trx.expiration == time_point_sec(), tx_decompression_error, "packed_transaction already unpacked" );
Expand Down
2 changes: 1 addition & 1 deletion libraries/chainbase
Submodule chainbase updated 1 files
+35 −35 src/chainbase.cpp
2 changes: 1 addition & 1 deletion libraries/fc
Submodule fc updated 48 files
+4 −8 CMakeLists.txt
+160 −0 include/fc/container/container_detail.hpp
+157 −102 include/fc/container/flat.hpp
+34 −18 include/fc/container/flat_fwd.hpp
+80 −124 include/fc/interprocess/container.hpp
+7 −7 include/fc/io/json.hpp
+10 −10 include/fc/io/json_relaxed.hpp
+4 −8 include/fc/io/raw.hpp
+0 −9 include/fc/io/raw_fwd.hpp
+9 −9 include/fc/log/appender.hpp
+1 −1 include/fc/log/console_appender.hpp
+1 −1 include/fc/log/file_appender.hpp
+2 −2 include/fc/log/gelf_appender.hpp
+5 −1 include/fc/log/log_message.hpp
+4 −5 include/fc/log/logger.hpp
+1 −0 include/fc/log/logger_config.hpp
+64 −19 include/fc/network/message_buffer.hpp
+1 −2 include/fc/network/udp_socket.hpp
+49 −17 include/fc/reflect/reflect.hpp
+1 −1 include/fc/reflect/variant.hpp
+0 −90 include/fc/shared_ptr.hpp
+1 −1 include/fc/string.hpp
+0 −3 include/fc/time.hpp
+1 −1 include/fc/uint128.hpp
+94 −8 include/fc/utility.hpp
+18 −13 include/fc/variant.hpp
+3 −2 include/fc/variant_object.hpp
+9 −3 src/compress/miniz.c
+6 −6 src/crypto/aes.cpp
+4 −4 src/crypto/elliptic_common.cpp
+2 −2 src/crypto/elliptic_r1.cpp
+9 −10 src/io/json.cpp
+0 −1 src/log/appender.cpp
+2 −3 src/log/console_appender.cpp
+4 −5 src/log/file_appender.cpp
+3 −4 src/log/gelf_appender.cpp
+7 −0 src/log/log_message.cpp
+5 −5 src/log/logger.cpp
+18 −4 src/log/logger_config.cpp
+4 −4 src/network/http/http_client.cpp
+1 −1 src/network/udp_socket.cpp
+0 −30 src/shared_ptr.cpp
+88 −62 src/variant.cpp
+1 −1 vendor/websocketpp/websocketpp/common/memory.hpp
+2 −3 vendor/websocketpp/websocketpp/transport/asio/connection.hpp
+3 −7 vendor/websocketpp/websocketpp/transport/asio/endpoint.hpp
+1 −2 vendor/websocketpp/websocketpp/transport/asio/security/none.hpp
+1 −2 vendor/websocketpp/websocketpp/transport/asio/security/tls.hpp
1 change: 0 additions & 1 deletion plugins/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
add_subdirectory(bnet_plugin)
add_subdirectory(net_plugin)
add_subdirectory(net_api_plugin)
add_subdirectory(http_plugin)
Expand Down
7 changes: 0 additions & 7 deletions plugins/bnet_plugin/CMakeLists.txt

This file was deleted.

Loading