From 590163d41c43671d43d721edaac532299ee6a4f7 Mon Sep 17 00:00:00 2001 From: Bucky Kittinger Date: Wed, 23 May 2018 18:08:03 -0400 Subject: [PATCH 01/22] Fix for eos3330 --- libraries/chain/CMakeLists.txt | 10 ++++++++++ libraries/chain/genesis_state.cpp | 2 +- .../include/eosio/chain/{config.hpp => config.hpp.in} | 2 ++ libraries/chain/include/eosio/chain/genesis_state.hpp | 7 +------ 4 files changed, 14 insertions(+), 7 deletions(-) rename libraries/chain/include/eosio/chain/{config.hpp => config.hpp.in} (98%) diff --git a/libraries/chain/CMakeLists.txt b/libraries/chain/CMakeLists.txt index 8636af2f5d4..bbdc864bdd5 100644 --- a/libraries/chain/CMakeLists.txt +++ b/libraries/chain/CMakeLists.txt @@ -1,5 +1,15 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/include/eosio/chain/core_symbol.hpp.in ${CMAKE_CURRENT_SOURCE_DIR}/include/eosio/chain/core_symbol.hpp) +# set the chain id +if (NOT "${CHAIN_ID}" STREQUAL "") + set(eosio_CHAIN_ID "${CHAIN_ID}") +else() + ## sha256("eosio::chain version 1.0") + set(eosio_CHAIN_ID "144B6AB7924EA47BAE7A5846B4494A35563AE816E2ED5AFFA7A9C990C2B3CFB3") +endif() + +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/include/eosio/chain/config.hpp.in ${CMAKE_CURRENT_SOURCE_DIR}/include/eosio/chain/config.hpp) + file(GLOB HEADERS "include/eosio/chain/*.hpp" "include/eosio/chain/contracts/*.hpp") ## SORT .cpp by most likely to change / break compile diff --git a/libraries/chain/genesis_state.cpp b/libraries/chain/genesis_state.cpp index f17a5ce55f8..d0e42fcd519 100644 --- a/libraries/chain/genesis_state.cpp +++ b/libraries/chain/genesis_state.cpp @@ -12,7 +12,7 @@ namespace eosio { namespace chain { chain::chain_id_type genesis_state::compute_chain_id() const { - return initial_chain_id; + return config::chain_id; } } } // namespace eosio::chain diff --git a/libraries/chain/include/eosio/chain/config.hpp b/libraries/chain/include/eosio/chain/config.hpp.in similarity index 98% rename from libraries/chain/include/eosio/chain/config.hpp rename to libraries/chain/include/eosio/chain/config.hpp.in index 152bebbe9cc..3971c27d03c 100644 --- a/libraries/chain/include/eosio/chain/config.hpp +++ b/libraries/chain/include/eosio/chain/config.hpp.in @@ -108,6 +108,8 @@ const static int irreversible_threshold_percent= 70 * percent_1; const static uint64_t billable_alignment = 16; +const static chain_id_type chain_id = fc::sha256("${eosio_CHAIN_ID}"); + template struct billable_size; diff --git a/libraries/chain/include/eosio/chain/genesis_state.hpp b/libraries/chain/include/eosio/chain/genesis_state.hpp index 4ca58cfd61b..61ea86b7471 100644 --- a/libraries/chain/include/eosio/chain/genesis_state.hpp +++ b/libraries/chain/include/eosio/chain/genesis_state.hpp @@ -42,11 +42,6 @@ struct genesis_state { time_point initial_timestamp = fc::time_point::from_iso_string( "2018-03-02T12:00:00" ); public_key_type initial_key = fc::variant("EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV").as(); - /** - * Temporary, will be moved elsewhere. - */ - chain_id_type initial_chain_id; - /** * Get the chain_id corresponding to this genesis state. * @@ -59,4 +54,4 @@ struct genesis_state { FC_REFLECT(eosio::chain::genesis_state, - (initial_timestamp)(initial_key)(initial_configuration)(initial_chain_id)) + (initial_timestamp)(initial_key)(initial_configuration)) From 028951342aaa7bc4b610cc8b9aa17067324d5a02 Mon Sep 17 00:00:00 2001 From: Bucky Kittinger Date: Wed, 23 May 2018 18:13:14 -0400 Subject: [PATCH 02/22] Added back the config.hpp, this will be overridden --- .../chain/include/eosio/chain/config.hpp | 129 ++++++++++++++++++ 1 file changed, 129 insertions(+) create mode 100644 libraries/chain/include/eosio/chain/config.hpp diff --git a/libraries/chain/include/eosio/chain/config.hpp b/libraries/chain/include/eosio/chain/config.hpp new file mode 100644 index 00000000000..03ffb036bbc --- /dev/null +++ b/libraries/chain/include/eosio/chain/config.hpp @@ -0,0 +1,129 @@ +/** + * @file + * @copyright defined in eos/LICENSE.txt + */ +#pragma once +#include +#include + +#pragma GCC diagnostic ignored "-Wunused-variable" + +namespace eosio { namespace chain { namespace config { + +typedef __uint128_t uint128_t; + +const static auto default_block_log_dir = "block_log"; +const static auto default_shared_memory_dir = "shared_mem"; +const static auto default_shared_memory_size = 1*1024*1024*1024ll; +const static auto default_reversible_cache_size = 320*1024*1024ll;/// 1MB * 340 blocks based on 21 producer BFT delay + +const static uint64_t system_account_name = N(eosio); +const static uint64_t null_account_name = N(eosio.null); +const static uint64_t producers_account_name = N(eosio.prods); + +// Active permission of producers account requires greater than 2/3 of the producers to authorize +const static uint64_t majority_producers_permission_name = N(prod.major); // greater than 1/2 of producers needed to authorize +const static uint64_t minority_producers_permission_name = N(prod.minor); // greater than 1/3 of producers needed to authorize0 + +const static uint64_t eosio_auth_scope = N(eosio.auth); +const static uint64_t eosio_all_scope = N(eosio.all); + +const static uint64_t active_name = N(active); +const static uint64_t owner_name = N(owner); +const static uint64_t eosio_any_name = N(eosio.any); +const static uint64_t eosio_code_name = N(eosio.code); + +const static int block_interval_ms = 500; +const static int block_interval_us = block_interval_ms*1000; +const static uint64_t block_timestamp_epoch = 946684800000ll; // epoch is year 2000. + +/** Percentages are fixed point with a denominator of 10,000 */ +const static int percent_100 = 10000; +const static int percent_1 = 100; + +const static uint32_t required_producer_participation = 33 * config::percent_1; + +static const uint32_t account_cpu_usage_average_window_ms = 24*60*60*1000l; +static const uint32_t account_net_usage_average_window_ms = 24*60*60*1000l; +static const uint32_t block_cpu_usage_average_window_ms = 60*1000l; +static const uint32_t block_size_average_window_ms = 60*1000l; + +//const static uint64_t default_max_storage_size = 10 * 1024; +//const static uint32_t default_max_trx_runtime = 10*1000; +//const static uint32_t default_max_gen_trx_size = 64 * 1024; + +const static uint32_t rate_limiting_precision = 1000*1000; + + +const static uint32_t default_max_block_net_usage = 1024 * 1024; /// at 500ms blocks and 200byte trx, this enables ~10,000 TPS burst +const static uint32_t default_target_block_net_usage_pct = 10 * percent_1; /// we target 1000 TPS +const static uint32_t default_max_transaction_net_usage = default_max_block_net_usage / 2; +const static uint32_t default_base_per_transaction_net_usage = 12; // 12 bytes (11 bytes for worst case of transaction_receipt_header + 1 byte for static_variant tag) +const static uint32_t default_net_usage_leeway = 500; // TODO: is this reasonable? +const static uint32_t default_context_free_discount_net_usage_num = 20; // TODO: is this reasonable? +const static uint32_t default_context_free_discount_net_usage_den = 100; +const static uint32_t transaction_id_net_usage = 32; // 32 bytes for the size of a transaction id + +const static uint32_t default_max_block_cpu_usage = 100'000; /// max block cpu usage in microseconds +const static uint32_t default_target_block_cpu_usage_pct = 5 * percent_1; /// target 1000 TPS +const static uint32_t default_max_transaction_cpu_usage = default_max_block_cpu_usage / 2; /// max trx cpu usage in microseconds +const static uint32_t default_min_transaction_cpu_usage = 100; /// min trx cpu usage in microseconds (10000 TPS equiv) + +const static uint32_t default_max_trx_lifetime = 60*60; // 1 hour +const static uint32_t default_deferred_trx_expiration_window = 10*60; // 10 minutes +const static uint32_t default_max_trx_delay = 45*24*3600; // 45 days +const static uint32_t default_max_inline_action_size = 4 * 1024; // 4 KB +const static uint16_t default_max_inline_action_depth = 4; +const static uint16_t default_max_auth_depth = 6; +const static uint32_t default_max_gen_trx_count = 16; + +const static uint32_t fixed_net_overhead_of_packed_trx = 16; // TODO: is this reasonable? + +const static uint32_t fixed_overhead_shared_vector_ram_bytes = 16; ///< overhead accounts for fixed portion of size of shared_vector field +const static uint32_t overhead_per_row_per_index_ram_bytes = 32; ///< overhead accounts for basic tracking structures in a row per index +const static uint32_t overhead_per_account_ram_bytes = 2*1024; ///< overhead accounts for basic account storage and pre-pays features like account recovery +const static uint32_t setcode_ram_bytes_multiplier = 10; ///< multiplier on contract size to account for multiple copies and cached compilation + +const static uint32_t hashing_checktime_block_size = 10*1024; /// call checktime from hashing intrinsic once per this number of bytes + +const static eosio::chain::wasm_interface::vm_type default_wasm_runtime = eosio::chain::wasm_interface::vm_type::binaryen; + +/** + * The number of sequential blocks produced by a single producer + */ +const static int producer_repetitions = 12; +const static int max_producers = 125; + +const static size_t maximum_tracked_dpos_confirmations = 1024; ///< +static_assert(maximum_tracked_dpos_confirmations >= ((max_producers * 2 / 3) + 1) * producer_repetitions, "Settings never allow for DPOS irreversibility" ); + + +/** + * The number of blocks produced per round is based upon all producers having a chance + * to produce all of their consecutive blocks. + */ +//const static int blocks_per_round = producer_count * producer_repetitions; + +const static int irreversible_threshold_percent= 70 * percent_1; + +const static uint64_t billable_alignment = 16; + +const static chain_id_type chain_id = fc::sha256("144B6AB7924EA47BAE7A5846B4494A35563AE816E2ED5AFFA7A9C990C2B3CFB3"); + +template +struct billable_size; + +template +constexpr uint64_t billable_size_v = ((billable_size::value + billable_alignment - 1) / billable_alignment) * billable_alignment; + + +} } } // namespace eosio::chain::config + +constexpr uint64_t EOS_PERCENT(uint64_t value, uint32_t percentage) { + return (value * percentage) / eosio::chain::config::percent_100; +} + +template +Number EOS_PERCENT_CEIL(Number value, uint32_t percentage) { + return ((value * percentage) + eosio::chain::config::percent_100 - eosio::chain::config::percent_1) / eosio::chain::config::percent_100; +} From 8241d22be8fe19c4014f6e26a1e7353de99948bc Mon Sep 17 00:00:00 2001 From: Bucky Kittinger Date: Wed, 23 May 2018 21:12:22 -0400 Subject: [PATCH 03/22] This is a rabbit hole --- libraries/chain/CMakeLists.txt | 2 +- .../chain/include/eosio/chain/chain_id.hpp | 5 ++++ .../chain/include/eosio/chain/chain_id.hpp.in | 5 ++++ .../chain/include/eosio/chain/config.hpp | 3 +- .../chain/include/eosio/chain/config.hpp.in | 12 +++++--- .../eosio/chain/transaction_metadata.hpp | 2 +- libraries/chain/include/eosio/chain/types.hpp | 12 ++++++-- libraries/testing/tester.cpp | 30 +++++++++---------- 8 files changed, 46 insertions(+), 25 deletions(-) create mode 100644 libraries/chain/include/eosio/chain/chain_id.hpp create mode 100644 libraries/chain/include/eosio/chain/chain_id.hpp.in diff --git a/libraries/chain/CMakeLists.txt b/libraries/chain/CMakeLists.txt index bbdc864bdd5..e61a4dacd43 100644 --- a/libraries/chain/CMakeLists.txt +++ b/libraries/chain/CMakeLists.txt @@ -8,7 +8,7 @@ else() set(eosio_CHAIN_ID "144B6AB7924EA47BAE7A5846B4494A35563AE816E2ED5AFFA7A9C990C2B3CFB3") endif() -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/include/eosio/chain/config.hpp.in ${CMAKE_CURRENT_SOURCE_DIR}/include/eosio/chain/config.hpp) +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/include/eosio/chain/chain_id.hpp.in ${CMAKE_CURRENT_SOURCE_DIR}/include/eosio/chain/chain_id.hpp) file(GLOB HEADERS "include/eosio/chain/*.hpp" "include/eosio/chain/contracts/*.hpp") diff --git a/libraries/chain/include/eosio/chain/chain_id.hpp b/libraries/chain/include/eosio/chain/chain_id.hpp new file mode 100644 index 00000000000..76774bbacbe --- /dev/null +++ b/libraries/chain/include/eosio/chain/chain_id.hpp @@ -0,0 +1,5 @@ +#pragma once + +namespace eosio { namespace chain { namespace config { +const static char chain_id_str[] = "144B6AB7924EA47BAE7A5846B4494A35563AE816E2ED5AFFA7A9C990C2B3CFB3"; +}}} // namespace eosio, config diff --git a/libraries/chain/include/eosio/chain/chain_id.hpp.in b/libraries/chain/include/eosio/chain/chain_id.hpp.in new file mode 100644 index 00000000000..8b22ae63281 --- /dev/null +++ b/libraries/chain/include/eosio/chain/chain_id.hpp.in @@ -0,0 +1,5 @@ +#pragma once + +namespace eosio { namespace chain { namespace config { +const static char chain_id_str[] = "${eosio_CHAIN_ID}"; +}} // namespace eosio, config diff --git a/libraries/chain/include/eosio/chain/config.hpp b/libraries/chain/include/eosio/chain/config.hpp index db2244cf18b..4d033f2f407 100644 --- a/libraries/chain/include/eosio/chain/config.hpp +++ b/libraries/chain/include/eosio/chain/config.hpp @@ -4,6 +4,7 @@ */ #pragma once #include +#include #include #pragma GCC diagnostic ignored "-Wunused-variable" @@ -112,7 +113,7 @@ const static int irreversible_threshold_percent= 70 * percent_1; const static uint64_t billable_alignment = 16; -const static chain_id_type chain_id = fc::sha256("144B6AB7924EA47BAE7A5846B4494A35563AE816E2ED5AFFA7A9C990C2B3CFB3"); +const static chain_id_type chain_id = {config::chain_id_str}; template struct billable_size; diff --git a/libraries/chain/include/eosio/chain/config.hpp.in b/libraries/chain/include/eosio/chain/config.hpp.in index 3971c27d03c..6322a6dff35 100644 --- a/libraries/chain/include/eosio/chain/config.hpp.in +++ b/libraries/chain/include/eosio/chain/config.hpp.in @@ -12,10 +12,14 @@ namespace eosio { namespace chain { namespace config { typedef __uint128_t uint128_t; -const static auto default_block_log_dir = "block_log"; -const static auto default_shared_memory_dir = "shared_mem"; -const static auto default_shared_memory_size = 1*1024*1024*1024ll; -const static auto default_reversible_cache_size = 320*1024*1024ll;/// 1MB * 340 blocks based on 21 producer BFT delay +const static auto default_blocks_dir_name = "blocks"; +const static auto reversible_blocks_dir_name = "reversible"; +const static auto default_reversible_cache_size = 340*1024*1024ll;/// 1MB * 340 blocks based on 21 producer BFT delay + +const static auto default_state_dir_name = "state"; +const static auto forkdb_filename = "forkdb.dat"; +const static auto default_state_size = 1*1024*1024*1024ll; + const static uint64_t system_account_name = N(eosio); const static uint64_t null_account_name = N(eosio.null); diff --git a/libraries/chain/include/eosio/chain/transaction_metadata.hpp b/libraries/chain/include/eosio/chain/transaction_metadata.hpp index a7a04407269..f84eacae167 100644 --- a/libraries/chain/include/eosio/chain/transaction_metadata.hpp +++ b/libraries/chain/include/eosio/chain/transaction_metadata.hpp @@ -39,7 +39,7 @@ class transaction_metadata { const flat_set& recover_keys() { // TODO: Update caching logic below when we use a proper chain id setup for the particular blockchain rather than just chain_id_type() if( !signing_keys ) - signing_keys = trx.get_signature_keys( chain_id_type() ); + signing_keys = trx.get_signature_keys( config::chain_id ); return *signing_keys; } diff --git a/libraries/chain/include/eosio/chain/types.hpp b/libraries/chain/include/eosio/chain/types.hpp index dd4069ce38b..4bb1ad91abb 100644 --- a/libraries/chain/include/eosio/chain/types.hpp +++ b/libraries/chain/include/eosio/chain/types.hpp @@ -4,6 +4,7 @@ */ #pragma once #include +#include #include @@ -88,6 +89,13 @@ namespace eosio { namespace chain { struct void_t{}; + struct chain_id_type { + chain_id_type(const fc::string& s) : _id(s){} + chain_id_type() : _id(config::chain_id_str) {} + operator fc::sha256() { return _id; } + fc::sha256 _id; + }; + using chainbase::allocator; using shared_string = boost::interprocess::basic_string, allocator>; template @@ -95,8 +103,6 @@ namespace eosio { namespace chain { template using shared_set = boost::interprocess::set, allocator>; - using chain_id_type = fc::sha256; - using action_name = name; using scope_name = name; using account_name = name; @@ -181,7 +187,6 @@ namespace eosio { namespace chain { } } // eosio::chain - FC_REFLECT_ENUM(eosio::chain::object_type, (null_object_type) (account_object_type) @@ -224,3 +229,4 @@ FC_REFLECT_ENUM(eosio::chain::object_type, (OBJECT_TYPE_COUNT) ) FC_REFLECT( eosio::chain::void_t, ) +FC_REFLECT(eosio::chain::chain_id_type, (_id) ) diff --git a/libraries/testing/tester.cpp b/libraries/testing/tester.cpp index 46c358a3fc2..25a93478c96 100644 --- a/libraries/testing/tester.cpp +++ b/libraries/testing/tester.cpp @@ -267,7 +267,7 @@ namespace eosio { namespace testing { }); set_transaction_headers(trx); - trx.sign( get_private_key( creator, "active" ), chain_id_type() ); + trx.sign( get_private_key( creator, "active" ), config::chain_id ); return push_transaction( trx ); } @@ -313,7 +313,7 @@ namespace eosio { namespace testing { trx.actions.emplace_back(std::move(act)); set_transaction_headers(trx); if (authorizer) { - trx.sign(get_private_key(authorizer, "active"), chain_id_type()); + trx.sign(get_private_key(authorizer, "active"), config::chain_id); } try { push_transaction(trx); @@ -370,7 +370,7 @@ namespace eosio { namespace testing { trx.actions.emplace_back( get_action( code, acttype, auths, data ) ); set_transaction_headers( trx, expiration, delay_sec ); for (const auto& auth : auths) { - trx.sign( get_private_key( auth.actor, auth.permission.to_string() ), chain_id_type() ); + trx.sign( get_private_key( auth.actor, auth.permission.to_string() ), config::chain_id ); } return push_transaction( trx ); @@ -412,7 +412,7 @@ namespace eosio { namespace testing { abi_serializer::from_variant(pretty_trx, trx, get_resolver()); set_transaction_headers(trx); for(auto iter = keys.begin(); iter != keys.end(); iter++) - trx.sign( *iter, chain_id_type() ); + trx.sign( *iter, config::chain_id ); return push_transaction( trx ); } @@ -458,7 +458,7 @@ namespace eosio { namespace testing { abi_serializer::from_variant(pretty_trx, trx, get_resolver()); set_transaction_headers(trx); - trx.sign( get_private_key( from, "active" ), chain_id_type() ); + trx.sign( get_private_key( from, "active" ), config::chain_id ); return push_transaction( trx, fc::time_point::maximum(), billed_cpu_time_us ); } @@ -492,7 +492,7 @@ namespace eosio { namespace testing { abi_serializer::from_variant(pretty_trx, trx, get_resolver()); set_transaction_headers(trx); - trx.sign( get_private_key( from, name(config::active_name).to_string() ), chain_id_type() ); + trx.sign( get_private_key( from, name(config::active_name).to_string() ), config::chain_id ); return push_transaction( trx ); } @@ -519,7 +519,7 @@ namespace eosio { namespace testing { abi_serializer::from_variant(pretty_trx, trx, get_resolver()); set_transaction_headers(trx); - trx.sign( get_private_key( currency, name(config::active_name).to_string() ), chain_id_type() ); + trx.sign( get_private_key( currency, name(config::active_name).to_string() ), config::chain_id ); return push_transaction( trx ); } @@ -530,7 +530,7 @@ namespace eosio { namespace testing { trx.actions.emplace_back( vector{{account, config::active_name}}, linkauth(account, code, type, req)); set_transaction_headers(trx); - trx.sign( get_private_key( account, "active" ), chain_id_type() ); + trx.sign( get_private_key( account, "active" ), config::chain_id ); push_transaction( trx ); } @@ -542,7 +542,7 @@ namespace eosio { namespace testing { trx.actions.emplace_back( vector{{account, config::active_name}}, unlinkauth(account, code, type )); set_transaction_headers(trx); - trx.sign( get_private_key( account, "active" ), chain_id_type() ); + trx.sign( get_private_key( account, "active" ), config::chain_id ); push_transaction( trx ); } @@ -566,7 +566,7 @@ namespace eosio { namespace testing { set_transaction_headers(trx); for (const auto& key: keys) { - trx.sign( key, chain_id_type() ); + trx.sign( key, config::chain_id ); } push_transaction( trx ); @@ -592,7 +592,7 @@ namespace eosio { namespace testing { set_transaction_headers(trx); for (const auto& key: keys) { - trx.sign( key, chain_id_type() ); + trx.sign( key, config::chain_id ); } push_transaction( trx ); @@ -622,9 +622,9 @@ namespace eosio { namespace testing { set_transaction_headers(trx); if( signer ) { - trx.sign( *signer, chain_id_type() ); + trx.sign( *signer, config::chain_id ); } else { - trx.sign( get_private_key( account, "active" ), chain_id_type() ); + trx.sign( get_private_key( account, "active" ), config::chain_id ); } push_transaction( trx ); } FC_CAPTURE_AND_RETHROW( (account) ) @@ -641,9 +641,9 @@ namespace eosio { namespace testing { set_transaction_headers(trx); if( signer ) { - trx.sign( *signer, chain_id_type() ); + trx.sign( *signer, config::chain_id ); } else { - trx.sign( get_private_key( account, "active" ), chain_id_type() ); + trx.sign( get_private_key( account, "active" ), config::chain_id ); } push_transaction( trx ); } From 33ef7fd7f9b42156fb7d4cac82be30bce2dc4f87 Mon Sep 17 00:00:00 2001 From: Eric Iles Date: Thu, 24 May 2018 10:02:33 -0400 Subject: [PATCH 04/22] Dev image changes --- Docker/dev/Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Docker/dev/Dockerfile b/Docker/dev/Dockerfile index 82f200ee1f0..232610afbe2 100644 --- a/Docker/dev/Dockerfile +++ b/Docker/dev/Dockerfile @@ -6,10 +6,10 @@ RUN git clone -b $branch https://github.com/EOSIO/eos.git --recursive \ && cmake -H. -B"/opt/eosio" -GNinja -DCMAKE_BUILD_TYPE=Release -DWASM_ROOT=/opt/wasm -DCMAKE_CXX_COMPILER=clang++ \ -DCMAKE_C_COMPILER=clang -DCMAKE_INSTALL_PREFIX=/opt/eosio -DSecp256k1_ROOT_DIR=/usr/local -DBUILD_MONGO_DB_PLUGIN=true \ && cmake --build /opt/eosio --target install \ - && mv /eos/Docker/config.ini / && mv /opt/eosio/contracts /contracts && mv /eos/Docker/nodeosd.sh /opt/eosio/bin/nodeosd.sh \ + && mv /eos/Docker/config.ini / && mv /opt/eosio/contracts /contracts && mv /eos/Docker/nodeosd.sh /opt/eosio/bin/nodeosd.sh && mv programs /programs \ && rm -rf /eos -RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -y install openssl && rm -rf /var/lib/apt/lists/* +RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -y install openssl vim psmisc python3-pip && rm -rf /var/lib/apt/lists/* ENV EOSIO_ROOT=/opt/eosio RUN chmod +x /opt/eosio/bin/nodeosd.sh ENV LD_LIBRARY_PATH /usr/local/lib From 3e06fec92cf2e37b2fc496873fa510ac3f257077 Mon Sep 17 00:00:00 2001 From: Eric Iles Date: Thu, 24 May 2018 10:02:51 -0400 Subject: [PATCH 05/22] Update builder to Ubuntu 18.04 LTS --- Docker/builder/Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Docker/builder/Dockerfile b/Docker/builder/Dockerfile index 6e8ca3b8e4a..c0bfec7aeae 100644 --- a/Docker/builder/Dockerfile +++ b/Docker/builder/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:16.04 +FROM ubuntu:18.04 LABEL author="xiaobo " maintainer="Xiaobo Huang-Ming Huang " version="0.1.1" \ description="This is a base image for building eosio/eos" @@ -6,7 +6,7 @@ LABEL author="xiaobo " maintainer="Xiaobo > /etc/apt/apt.conf.d/01norecommends \ && echo 'APT::Install-Suggests 0;' >> /etc/apt/apt.conf.d/01norecommends \ && apt-get update \ - && DEBIAN_FRONTEND=noninteractive apt-get install -y sudo wget curl net-tools ca-certificates unzip + && DEBIAN_FRONTEND=noninteractive apt-get install -y sudo wget curl net-tools ca-certificates unzip gnupg RUN echo "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-4.0 main" >> /etc/apt/sources.list.d/llvm.list \ && wget -O - http://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add - \ From db6043890a9903573ff44d4dc2e997a5c0e218ac Mon Sep 17 00:00:00 2001 From: Eric Iles Date: Thu, 24 May 2018 10:03:28 -0400 Subject: [PATCH 06/22] Add symbol arg to eosio/eos --- Docker/Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Docker/Dockerfile b/Docker/Dockerfile index 6eaad49b8ea..ce1e1bbe8fa 100644 --- a/Docker/Dockerfile +++ b/Docker/Dockerfile @@ -1,10 +1,11 @@ FROM eosio/builder as builder ARG branch=master +ARG symbol=SYS RUN git clone -b $branch https://github.com/EOSIO/eos.git --recursive \ && cd eos && echo "$branch:$(git rev-parse HEAD)" > /etc/eosio-version \ && cmake -H. -B"/tmp/build" -GNinja -DCMAKE_BUILD_TYPE=Release -DWASM_ROOT=/opt/wasm -DCMAKE_CXX_COMPILER=clang++ \ - -DCMAKE_C_COMPILER=clang -DCMAKE_INSTALL_PREFIX=/tmp/build -DSecp256k1_ROOT_DIR=/usr/local -DBUILD_MONGO_DB_PLUGIN=true \ + -DCMAKE_C_COMPILER=clang -DCMAKE_INSTALL_PREFIX=/tmp/build -DSecp256k1_ROOT_DIR=/usr/local -DBUILD_MONGO_DB_PLUGIN=true -DCORE_SYMBOL_NAME=$symbol \ && cmake --build /tmp/build --target install && rm /tmp/build/bin/eosiocpp From 4839d4c4bdb89c2063cfcb6dfb2c80483d8ff4a8 Mon Sep 17 00:00:00 2001 From: Bucky Kittinger Date: Thu, 24 May 2018 11:19:54 -0400 Subject: [PATCH 07/22] Fixed problems --- .../chain/include/eosio/chain/chain_id.hpp | 5 - .../chain/include/eosio/chain/chain_id.hpp.in | 2 +- .../chain/include/eosio/chain/config.hpp.in | 133 ------------------ libraries/chain/include/eosio/chain/types.hpp | 10 +- plugins/chain_plugin/chain_plugin.cpp | 2 +- plugins/net_plugin/net_plugin.cpp | 2 +- 6 files changed, 8 insertions(+), 146 deletions(-) delete mode 100644 libraries/chain/include/eosio/chain/chain_id.hpp delete mode 100644 libraries/chain/include/eosio/chain/config.hpp.in diff --git a/libraries/chain/include/eosio/chain/chain_id.hpp b/libraries/chain/include/eosio/chain/chain_id.hpp deleted file mode 100644 index 76774bbacbe..00000000000 --- a/libraries/chain/include/eosio/chain/chain_id.hpp +++ /dev/null @@ -1,5 +0,0 @@ -#pragma once - -namespace eosio { namespace chain { namespace config { -const static char chain_id_str[] = "144B6AB7924EA47BAE7A5846B4494A35563AE816E2ED5AFFA7A9C990C2B3CFB3"; -}}} // namespace eosio, config diff --git a/libraries/chain/include/eosio/chain/chain_id.hpp.in b/libraries/chain/include/eosio/chain/chain_id.hpp.in index 8b22ae63281..848d423b5a5 100644 --- a/libraries/chain/include/eosio/chain/chain_id.hpp.in +++ b/libraries/chain/include/eosio/chain/chain_id.hpp.in @@ -2,4 +2,4 @@ namespace eosio { namespace chain { namespace config { const static char chain_id_str[] = "${eosio_CHAIN_ID}"; -}} // namespace eosio, config +}}} // namespace eosio, config diff --git a/libraries/chain/include/eosio/chain/config.hpp.in b/libraries/chain/include/eosio/chain/config.hpp.in deleted file mode 100644 index 6322a6dff35..00000000000 --- a/libraries/chain/include/eosio/chain/config.hpp.in +++ /dev/null @@ -1,133 +0,0 @@ -/** - * @file - * @copyright defined in eos/LICENSE.txt - */ -#pragma once -#include -#include - -#pragma GCC diagnostic ignored "-Wunused-variable" - -namespace eosio { namespace chain { namespace config { - -typedef __uint128_t uint128_t; - -const static auto default_blocks_dir_name = "blocks"; -const static auto reversible_blocks_dir_name = "reversible"; -const static auto default_reversible_cache_size = 340*1024*1024ll;/// 1MB * 340 blocks based on 21 producer BFT delay - -const static auto default_state_dir_name = "state"; -const static auto forkdb_filename = "forkdb.dat"; -const static auto default_state_size = 1*1024*1024*1024ll; - - -const static uint64_t system_account_name = N(eosio); -const static uint64_t null_account_name = N(eosio.null); -const static uint64_t producers_account_name = N(eosio.prods); - -// Active permission of producers account requires greater than 2/3 of the producers to authorize -const static uint64_t majority_producers_permission_name = N(prod.major); // greater than 1/2 of producers needed to authorize -const static uint64_t minority_producers_permission_name = N(prod.minor); // greater than 1/3 of producers needed to authorize0 - -const static uint64_t eosio_auth_scope = N(eosio.auth); -const static uint64_t eosio_all_scope = N(eosio.all); - -const static uint64_t active_name = N(active); -const static uint64_t owner_name = N(owner); -const static uint64_t eosio_any_name = N(eosio.any); -const static uint64_t eosio_code_name = N(eosio.code); - -const static int block_interval_ms = 500; -const static int block_interval_us = block_interval_ms*1000; -const static uint64_t block_timestamp_epoch = 946684800000ll; // epoch is year 2000. - -/** Percentages are fixed point with a denominator of 10,000 */ -const static int percent_100 = 10000; -const static int percent_1 = 100; - -const static uint32_t required_producer_participation = 33 * config::percent_1; - -static const uint32_t account_cpu_usage_average_window_ms = 24*60*60*1000l; -static const uint32_t account_net_usage_average_window_ms = 24*60*60*1000l; -static const uint32_t block_cpu_usage_average_window_ms = 60*1000l; -static const uint32_t block_size_average_window_ms = 60*1000l; - -//const static uint64_t default_max_storage_size = 10 * 1024; -//const static uint32_t default_max_trx_runtime = 10*1000; -//const static uint32_t default_max_gen_trx_size = 64 * 1024; - -const static uint32_t rate_limiting_precision = 1000*1000; - - -const static uint32_t default_max_block_net_usage = 1024 * 1024; /// at 500ms blocks and 200byte trx, this enables ~10,000 TPS burst -const static uint32_t default_target_block_net_usage_pct = 10 * percent_1; /// we target 1000 TPS -const static uint32_t default_max_transaction_net_usage = default_max_block_net_usage / 2; -const static uint32_t default_base_per_transaction_net_usage = 12; // 12 bytes (11 bytes for worst case of transaction_receipt_header + 1 byte for static_variant tag) -const static uint32_t default_net_usage_leeway = 500; // TODO: is this reasonable? -const static uint32_t default_context_free_discount_net_usage_num = 20; // TODO: is this reasonable? -const static uint32_t default_context_free_discount_net_usage_den = 100; -const static uint32_t transaction_id_net_usage = 32; // 32 bytes for the size of a transaction id - -const static uint32_t default_max_block_cpu_usage = 100'000; /// max block cpu usage in microseconds -const static uint32_t default_target_block_cpu_usage_pct = 5 * percent_1; /// target 1000 TPS -const static uint32_t default_max_transaction_cpu_usage = default_max_block_cpu_usage / 2; /// max trx cpu usage in microseconds -const static uint32_t default_min_transaction_cpu_usage = 100; /// min trx cpu usage in microseconds (10000 TPS equiv) - -const static uint32_t default_max_trx_lifetime = 60*60; // 1 hour -const static uint32_t default_deferred_trx_expiration_window = 10*60; // 10 minutes -const static uint32_t default_max_trx_delay = 45*24*3600; // 45 days -const static uint32_t default_max_inline_action_size = 4 * 1024; // 4 KB -const static uint16_t default_max_inline_action_depth = 4; -const static uint16_t default_max_auth_depth = 6; -const static uint32_t default_max_gen_trx_count = 16; - -const static uint32_t fixed_net_overhead_of_packed_trx = 16; // TODO: is this reasonable? - -const static uint32_t fixed_overhead_shared_vector_ram_bytes = 16; ///< overhead accounts for fixed portion of size of shared_vector field -const static uint32_t overhead_per_row_per_index_ram_bytes = 32; ///< overhead accounts for basic tracking structures in a row per index -const static uint32_t overhead_per_account_ram_bytes = 2*1024; ///< overhead accounts for basic account storage and pre-pays features like account recovery -const static uint32_t setcode_ram_bytes_multiplier = 10; ///< multiplier on contract size to account for multiple copies and cached compilation - -const static uint32_t hashing_checktime_block_size = 10*1024; /// call checktime from hashing intrinsic once per this number of bytes - -const static eosio::chain::wasm_interface::vm_type default_wasm_runtime = eosio::chain::wasm_interface::vm_type::binaryen; - -/** - * The number of sequential blocks produced by a single producer - */ -const static int producer_repetitions = 12; -const static int max_producers = 125; - -const static size_t maximum_tracked_dpos_confirmations = 1024; ///< -static_assert(maximum_tracked_dpos_confirmations >= ((max_producers * 2 / 3) + 1) * producer_repetitions, "Settings never allow for DPOS irreversibility" ); - - -/** - * The number of blocks produced per round is based upon all producers having a chance - * to produce all of their consecutive blocks. - */ -//const static int blocks_per_round = producer_count * producer_repetitions; - -const static int irreversible_threshold_percent= 70 * percent_1; - -const static uint64_t billable_alignment = 16; - -const static chain_id_type chain_id = fc::sha256("${eosio_CHAIN_ID}"); - -template -struct billable_size; - -template -constexpr uint64_t billable_size_v = ((billable_size::value + billable_alignment - 1) / billable_alignment) * billable_alignment; - - -} } } // namespace eosio::chain::config - -constexpr uint64_t EOS_PERCENT(uint64_t value, uint32_t percentage) { - return (value * percentage) / eosio::chain::config::percent_100; -} - -template -Number EOS_PERCENT_CEIL(Number value, uint32_t percentage) { - return ((value * percentage) + eosio::chain::config::percent_100 - eosio::chain::config::percent_1) / eosio::chain::config::percent_100; -} diff --git a/libraries/chain/include/eosio/chain/types.hpp b/libraries/chain/include/eosio/chain/types.hpp index 4bb1ad91abb..dbaa6ca33a3 100644 --- a/libraries/chain/include/eosio/chain/types.hpp +++ b/libraries/chain/include/eosio/chain/types.hpp @@ -90,10 +90,10 @@ namespace eosio { namespace chain { struct void_t{}; struct chain_id_type { - chain_id_type(const fc::string& s) : _id(s){} - chain_id_type() : _id(config::chain_id_str) {} - operator fc::sha256() { return _id; } - fc::sha256 _id; + chain_id_type(const fc::string& s) : id(s){} + chain_id_type() : id(config::chain_id_str) {} + operator fc::sha256() { return id; } + fc::sha256 id; }; using chainbase::allocator; @@ -229,4 +229,4 @@ FC_REFLECT_ENUM(eosio::chain::object_type, (OBJECT_TYPE_COUNT) ) FC_REFLECT( eosio::chain::void_t, ) -FC_REFLECT(eosio::chain::chain_id_type, (_id) ) +FC_REFLECT(eosio::chain::chain_id_type, (id) ) diff --git a/plugins/chain_plugin/chain_plugin.cpp b/plugins/chain_plugin/chain_plugin.cpp index a6f993be6ee..4cd542c11e1 100644 --- a/plugins/chain_plugin/chain_plugin.cpp +++ b/plugins/chain_plugin/chain_plugin.cpp @@ -427,7 +427,7 @@ controller& chain_plugin::chain() { return *my->chain; } const controller& chain_plugin::chain() const { return *my->chain; } void chain_plugin::get_chain_id(chain_id_type &cid)const { - memcpy(cid.data(), my->chain_id.data(), cid.data_size()); + memcpy(cid.id.data(), my->chain_id.id.data(), cid.id.data_size()); } namespace chain_apis { diff --git a/plugins/net_plugin/net_plugin.cpp b/plugins/net_plugin/net_plugin.cpp index 35efb6d0482..bf4701b85f5 100644 --- a/plugins/net_plugin/net_plugin.cpp +++ b/plugins/net_plugin/net_plugin.cpp @@ -2244,7 +2244,7 @@ namespace eosio { fc_dlog(logger, "skipping duplicate check, addr == ${pa}, id = ${ni}",("pa",c->peer_addr)("ni",c->last_handshake_recv.node_id)); } - if( msg.chain_id != chain_id) { + if( msg.chain_id.id != chain_id.id) { elog( "Peer on a different chain. Closing connection"); c->enqueue( go_away_message(go_away_reason::wrong_chain) ); return; From 308472891b8535ac3586d2f0056f957376fbfa41 Mon Sep 17 00:00:00 2001 From: Eric Iles Date: Thu, 24 May 2018 11:31:09 -0400 Subject: [PATCH 08/22] Update Docker README.md to reflect symbol argument --- Docker/README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Docker/README.md b/Docker/README.md index 5c1f039eee8..c08a764259a 100644 --- a/Docker/README.md +++ b/Docker/README.md @@ -26,6 +26,12 @@ The above will build off the most recent commit to the master branch by default. docker build -t eosio/eos:dawn-v4.0.0 --build-arg branch=dawn-v4.0.0 . ``` +By default, the symbol in eosio.system is set to SYS. You can override this using the symbol argument while building the docker image. + +```bash +docker built -t eosio/eos --build-arg symbol= . +``` + ## Start nodeos docker container only ```bash From 877355dcf85bd7cb2c9220b336580ce4474b19a4 Mon Sep 17 00:00:00 2001 From: Bucky Kittinger Date: Thu, 24 May 2018 14:32:52 -0400 Subject: [PATCH 09/22] Addressed recompilation issues --- libraries/chain/CMakeLists.txt | 3 +- libraries/chain/chain_id.cpp.in | 6 ++++ .../chain/include/eosio/chain/chain_id.hpp.in | 5 ---- .../chain/include/eosio/chain/config.hpp | 3 +- .../eosio/chain/transaction_metadata.hpp | 2 +- libraries/chain/include/eosio/chain/types.hpp | 5 ++-- libraries/testing/tester.cpp | 30 +++++++++---------- 7 files changed, 27 insertions(+), 27 deletions(-) create mode 100644 libraries/chain/chain_id.cpp.in delete mode 100644 libraries/chain/include/eosio/chain/chain_id.hpp.in diff --git a/libraries/chain/CMakeLists.txt b/libraries/chain/CMakeLists.txt index 9f88c1c1b75..20b12847cb1 100644 --- a/libraries/chain/CMakeLists.txt +++ b/libraries/chain/CMakeLists.txt @@ -8,7 +8,7 @@ else() set(eosio_CHAIN_ID "144B6AB7924EA47BAE7A5846B4494A35563AE816E2ED5AFFA7A9C990C2B3CFB3") endif() -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/include/eosio/chain/chain_id.hpp.in ${CMAKE_CURRENT_SOURCE_DIR}/include/eosio/chain/chain_id.hpp) +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/chain_id.cpp.in ${CMAKE_CURRENT_SOURCE_DIR}/chain_id.cpp) file(GLOB HEADERS "include/eosio/chain/*.hpp" "include/eosio/chain/contracts/*.hpp") @@ -30,6 +30,7 @@ add_library( eosio_chain eosio_contract.cpp eosio_contract_abi.cpp chain_config.cpp + chain_id.cpp # chain_config.cpp # block_trace.cpp diff --git a/libraries/chain/chain_id.cpp.in b/libraries/chain/chain_id.cpp.in new file mode 100644 index 00000000000..204f0eca894 --- /dev/null +++ b/libraries/chain/chain_id.cpp.in @@ -0,0 +1,6 @@ +#include + +namespace eosio { namespace chain { + chain_id_type::chain_id_type( const fc::string& s ) { id = fc::sha256(s); } + chain_id_type::chain_id_type() { id = fc::sha256("${eosio_CHAIN_ID}"); } +}} // namespace eosio::chain diff --git a/libraries/chain/include/eosio/chain/chain_id.hpp.in b/libraries/chain/include/eosio/chain/chain_id.hpp.in deleted file mode 100644 index 848d423b5a5..00000000000 --- a/libraries/chain/include/eosio/chain/chain_id.hpp.in +++ /dev/null @@ -1,5 +0,0 @@ -#pragma once - -namespace eosio { namespace chain { namespace config { -const static char chain_id_str[] = "${eosio_CHAIN_ID}"; -}}} // namespace eosio, config diff --git a/libraries/chain/include/eosio/chain/config.hpp b/libraries/chain/include/eosio/chain/config.hpp index e846dca6e79..4160deac9c1 100644 --- a/libraries/chain/include/eosio/chain/config.hpp +++ b/libraries/chain/include/eosio/chain/config.hpp @@ -4,7 +4,6 @@ */ #pragma once #include -#include #include #pragma GCC diagnostic ignored "-Wunused-variable" @@ -116,7 +115,7 @@ const static int irreversible_threshold_percent= 70 * percent_1; const static uint64_t billable_alignment = 16; -const static chain_id_type chain_id = {config::chain_id_str}; +const static chain_id_type chain_id = chain_id_type(); template struct billable_size; diff --git a/libraries/chain/include/eosio/chain/transaction_metadata.hpp b/libraries/chain/include/eosio/chain/transaction_metadata.hpp index f84eacae167..a7a04407269 100644 --- a/libraries/chain/include/eosio/chain/transaction_metadata.hpp +++ b/libraries/chain/include/eosio/chain/transaction_metadata.hpp @@ -39,7 +39,7 @@ class transaction_metadata { const flat_set& recover_keys() { // TODO: Update caching logic below when we use a proper chain id setup for the particular blockchain rather than just chain_id_type() if( !signing_keys ) - signing_keys = trx.get_signature_keys( config::chain_id ); + signing_keys = trx.get_signature_keys( chain_id_type() ); return *signing_keys; } diff --git a/libraries/chain/include/eosio/chain/types.hpp b/libraries/chain/include/eosio/chain/types.hpp index dbaa6ca33a3..98f05b33770 100644 --- a/libraries/chain/include/eosio/chain/types.hpp +++ b/libraries/chain/include/eosio/chain/types.hpp @@ -4,7 +4,6 @@ */ #pragma once #include -#include #include @@ -90,8 +89,8 @@ namespace eosio { namespace chain { struct void_t{}; struct chain_id_type { - chain_id_type(const fc::string& s) : id(s){} - chain_id_type() : id(config::chain_id_str) {} + chain_id_type(const fc::string& s); + chain_id_type(); operator fc::sha256() { return id; } fc::sha256 id; }; diff --git a/libraries/testing/tester.cpp b/libraries/testing/tester.cpp index dacab7b1512..69d1862f87a 100644 --- a/libraries/testing/tester.cpp +++ b/libraries/testing/tester.cpp @@ -268,7 +268,7 @@ namespace eosio { namespace testing { }); set_transaction_headers(trx); - trx.sign( get_private_key( creator, "active" ), config::chain_id ); + trx.sign( get_private_key( creator, "active" ), chain_id_type() ); return push_transaction( trx ); } @@ -312,7 +312,7 @@ namespace eosio { namespace testing { trx.actions.emplace_back(std::move(act)); set_transaction_headers(trx); if (authorizer) { - trx.sign(get_private_key(authorizer, "active"), config::chain_id); + trx.sign(get_private_key(authorizer, "active"), chain_id_type()); } try { push_transaction(trx); @@ -369,7 +369,7 @@ namespace eosio { namespace testing { trx.actions.emplace_back( get_action( code, acttype, auths, data ) ); set_transaction_headers( trx, expiration, delay_sec ); for (const auto& auth : auths) { - trx.sign( get_private_key( auth.actor, auth.permission.to_string() ), config::chain_id ); + trx.sign( get_private_key( auth.actor, auth.permission.to_string() ), chain_id_type() ); } return push_transaction( trx ); @@ -411,7 +411,7 @@ namespace eosio { namespace testing { abi_serializer::from_variant(pretty_trx, trx, get_resolver()); set_transaction_headers(trx); for(auto iter = keys.begin(); iter != keys.end(); iter++) - trx.sign( *iter, config::chain_id ); + trx.sign( *iter, chain_id_type() ); return push_transaction( trx ); } @@ -457,7 +457,7 @@ namespace eosio { namespace testing { abi_serializer::from_variant(pretty_trx, trx, get_resolver()); set_transaction_headers(trx); - trx.sign( get_private_key( from, "active" ), config::chain_id ); + trx.sign( get_private_key( from, "active" ), chain_id_type() ); return push_transaction( trx, fc::time_point::maximum(), billed_cpu_time_us ); } @@ -491,7 +491,7 @@ namespace eosio { namespace testing { abi_serializer::from_variant(pretty_trx, trx, get_resolver()); set_transaction_headers(trx); - trx.sign( get_private_key( from, name(config::active_name).to_string() ), config::chain_id ); + trx.sign( get_private_key( from, name(config::active_name).to_string() ), chain_id_type() ); return push_transaction( trx ); } @@ -518,7 +518,7 @@ namespace eosio { namespace testing { abi_serializer::from_variant(pretty_trx, trx, get_resolver()); set_transaction_headers(trx); - trx.sign( get_private_key( currency, name(config::active_name).to_string() ), config::chain_id ); + trx.sign( get_private_key( currency, name(config::active_name).to_string() ), chain_id_type() ); return push_transaction( trx ); } @@ -529,7 +529,7 @@ namespace eosio { namespace testing { trx.actions.emplace_back( vector{{account, config::active_name}}, linkauth(account, code, type, req)); set_transaction_headers(trx); - trx.sign( get_private_key( account, "active" ), config::chain_id ); + trx.sign( get_private_key( account, "active" ), chain_id_type() ); push_transaction( trx ); } @@ -541,7 +541,7 @@ namespace eosio { namespace testing { trx.actions.emplace_back( vector{{account, config::active_name}}, unlinkauth(account, code, type )); set_transaction_headers(trx); - trx.sign( get_private_key( account, "active" ), config::chain_id ); + trx.sign( get_private_key( account, "active" ), chain_id_type() ); push_transaction( trx ); } @@ -565,7 +565,7 @@ namespace eosio { namespace testing { set_transaction_headers(trx); for (const auto& key: keys) { - trx.sign( key, config::chain_id ); + trx.sign( key, chain_id_type() ); } push_transaction( trx ); @@ -591,7 +591,7 @@ namespace eosio { namespace testing { set_transaction_headers(trx); for (const auto& key: keys) { - trx.sign( key, config::chain_id ); + trx.sign( key, chain_id_type() ); } push_transaction( trx ); @@ -621,9 +621,9 @@ namespace eosio { namespace testing { set_transaction_headers(trx); if( signer ) { - trx.sign( *signer, config::chain_id ); + trx.sign( *signer, chain_id_type() ); } else { - trx.sign( get_private_key( account, "active" ), config::chain_id ); + trx.sign( get_private_key( account, "active" ), chain_id_type() ); } push_transaction( trx ); } FC_CAPTURE_AND_RETHROW( (account) ) @@ -640,9 +640,9 @@ namespace eosio { namespace testing { set_transaction_headers(trx); if( signer ) { - trx.sign( *signer, config::chain_id ); + trx.sign( *signer, chain_id_type() ); } else { - trx.sign( get_private_key( account, "active" ), config::chain_id ); + trx.sign( get_private_key( account, "active" ), chain_id_type() ); } push_transaction( trx ); } From 1c582f73bddad0abbae6337767b9e909b101cdfa Mon Sep 17 00:00:00 2001 From: Eric Iles Date: Thu, 24 May 2018 14:54:27 -0400 Subject: [PATCH 10/22] Install numpy on eos-dev --- Docker/dev/Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Docker/dev/Dockerfile b/Docker/dev/Dockerfile index 232610afbe2..3b1d2efb3b4 100644 --- a/Docker/dev/Dockerfile +++ b/Docker/dev/Dockerfile @@ -10,6 +10,7 @@ RUN git clone -b $branch https://github.com/EOSIO/eos.git --recursive \ && rm -rf /eos RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -y install openssl vim psmisc python3-pip && rm -rf /var/lib/apt/lists/* +RUN pip3 install numpy ENV EOSIO_ROOT=/opt/eosio RUN chmod +x /opt/eosio/bin/nodeosd.sh ENV LD_LIBRARY_PATH /usr/local/lib From 37ba6a789219648f2271b6f98e28f043a9a8ccd1 Mon Sep 17 00:00:00 2001 From: Anton Perkov Date: Thu, 24 May 2018 15:16:35 -0400 Subject: [PATCH 11/22] parameter --contracts-console added to config #3339 --- plugins/chain_plugin/chain_plugin.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/chain_plugin/chain_plugin.cpp b/plugins/chain_plugin/chain_plugin.cpp index 0c2113d30cb..a6dfec88ecb 100644 --- a/plugins/chain_plugin/chain_plugin.cpp +++ b/plugins/chain_plugin/chain_plugin.cpp @@ -117,6 +117,8 @@ void chain_plugin::set_program_options(options_description& cli, options_descrip ("wasm-runtime", bpo::value()->value_name("wavm/binaryen"), "Override default WASM runtime") ("chain-state-db-size-mb", bpo::value()->default_value(config::default_state_size / (1024 * 1024)), "Maximum size (in MB) of the chain state database") ("reversible-blocks-db-size-mb", bpo::value()->default_value(config::default_reversible_cache_size / (1024 * 1024)), "Maximum size (in MB) of the reversible blocks database") + ("contracts-console", bpo::bool_switch()->default_value(false), + "print contract's output to console") #warning TODO: rate limiting @@ -140,8 +142,6 @@ void chain_plugin::set_program_options(options_description& cli, options_descrip "clear chain state database, recover as many blocks as possible from the block log, and then replay those blocks") ("delete-all-blocks", bpo::bool_switch()->default_value(false), "clear chain state database and block log") - ("contracts-console", bpo::bool_switch()->default_value(false), - "print contract's output to console") ; } From dab4ae36021ad002bd351005874eee2edbafe028 Mon Sep 17 00:00:00 2001 From: Phil Mesnier Date: Thu, 24 May 2018 09:02:23 -0500 Subject: [PATCH 12/22] fix for issue #3280 --- plugins/net_plugin/CMakeLists.txt | 2 +- plugins/net_plugin/net_plugin.cpp | 234 +++++++++++------------------- 2 files changed, 86 insertions(+), 150 deletions(-) diff --git a/plugins/net_plugin/CMakeLists.txt b/plugins/net_plugin/CMakeLists.txt index 5d6515319d2..3b8c1cd7b71 100644 --- a/plugins/net_plugin/CMakeLists.txt +++ b/plugins/net_plugin/CMakeLists.txt @@ -4,4 +4,4 @@ add_library( net_plugin ${HEADERS} ) target_link_libraries( net_plugin chain_plugin producer_plugin appbase fc ) -target_include_directories( net_plugin PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include ${CMAKE_CURRENT_SOURCE_DIR}/../chain_interface/include ) +target_include_directories( net_plugin PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include ${CMAKE_CURRENT_SOURCE_DIR}/../chain_interface/include "${CMAKE_CURRENT_SOURCE_DIR}/../../libraries/appbase/include") diff --git a/plugins/net_plugin/net_plugin.cpp b/plugins/net_plugin/net_plugin.cpp index 35efb6d0482..08c8586d947 100644 --- a/plugins/net_plugin/net_plugin.cpp +++ b/plugins/net_plugin/net_plugin.cpp @@ -52,6 +52,7 @@ namespace eosio { namespace bip = boost::interprocess; class connection; + class sync_manager; class dispatch_manager; @@ -305,6 +306,7 @@ namespace eosio { constexpr auto def_resp_expected_wait = std::chrono::seconds(5); constexpr auto def_sync_fetch_span = 100; constexpr uint32_t def_max_just_send = 1500; // roughly 1 "mtu" + constexpr bool large_msg_notify = false; constexpr auto message_header_size = 4; @@ -347,22 +349,6 @@ namespace eosio { time_point requested_time; /// in case we fetch large trx }; - struct update_block_num { - uint32_t new_bnum; - update_block_num(uint32_t bnum) : new_bnum(bnum) {} - void operator() (node_transaction_state& nts) { - if (nts.requests ) { - nts.true_block = new_bnum; - } - else { - nts.block_num = new_bnum; - } - } - void operator() (transaction_state& ts) { - ts.block_num = new_bnum; - } - }; - struct update_txn_expiry { time_point_sec new_expiry; update_txn_expiry(time_point_sec e) : new_expiry(e) {} @@ -423,6 +409,26 @@ namespace eosio { } } set_is_known; + + struct update_block_num { + uint32_t new_bnum; + update_block_num(uint32_t bnum) : new_bnum(bnum) {} + void operator() (node_transaction_state& nts) { + if (nts.requests ) { + nts.true_block = new_bnum; + } + else { + nts.block_num = new_bnum; + } + } + void operator() (transaction_state& ts) { + ts.block_num = new_bnum; + } + void operator() (peer_block_state& pbs) { + pbs.block_num = new_bnum; + } + }; + /** * Index by start_block_num */ @@ -573,6 +579,8 @@ namespace eosio { * encountered unpacking or processing the message. */ bool process_next_message(net_plugin_impl& impl, uint32_t message_length); + + bool add_peer_block(const peer_block_state &pbs); }; struct msgHandler : public fc::visitor { @@ -653,7 +661,7 @@ namespace eosio { void bcast_block (const signed_block& msg); void rejected_block (const block_id_type &id); - void recv_block (connection_ptr conn, const block_id_type& msg); + void recv_block (connection_ptr conn, const block_id_type& msg, uint32_t bnum); void recv_transaction(connection_ptr conn, const transaction_id_type& id); void recv_notice (connection_ptr conn, const notice_message& msg, bool generated); @@ -1198,6 +1206,23 @@ namespace eosio { return true; } + bool connection::add_peer_block(const peer_block_state &entry) { + auto bptr = blk_state.get().find(entry.id); + bool added = (bptr == blk_state.end()); + if (added){ + blk_state.insert(entry); + } + else { + blk_state.modify(bptr,set_is_known); + if (entry.block_num == 0) { + blk_state.modify(bptr,update_block_num(entry.block_num)); + } + else { + blk_state.modify(bptr,set_request_time); + } + } + return added; + } //----------------------------------------------------------- @@ -1582,42 +1607,48 @@ namespace eosio { pending_notify.known_blocks.mode = normal; pending_notify.known_blocks.ids.push_back( bid ); pending_notify.known_trx.mode = none; + + peer_block_state pbstate = {bid, bnum, false,true,time_point()}; // skip will be empty if our producer emitted this block so just send it - if (msgsiz > just_send_it_max && skip) { + if (( large_msg_notify && msgsiz > just_send_it_max) && skip) { fc_ilog(logger, "block size is ${ms}, sending notify",("ms", msgsiz)); connection_wptr weak_skip = skip; - my_impl->send_all(pending_notify, [weak_skip, bid, bnum](connection_ptr c) -> bool { - if (c == weak_skip.lock() || !c->current()) - return false; - const auto& bs = c->blk_state.find(bid); - bool unknown = bs == c->blk_state.end(); - if (unknown) { - c->blk_state.insert((eosio::peer_block_state){bid,bnum,false,true,time_point()}); - } - else { - elog("${p} already has knowledge of block ${b}", ("p",c->peer_name())("b",bid)); - } - return unknown; + my_impl->send_all(pending_notify, [weak_skip, pbstate](connection_ptr c) -> bool { + if (c == weak_skip.lock() || !c->current()) + return false; + bool unknown = c->add_peer_block(pbstate); + if (!unknown) { + elog("${p} already has knowledge of block ${b}", ("p",c->peer_name())("b",pbstate.block_num)); + } + return unknown; }); } else { + pbstate.is_known = true; for (auto cp : my_impl->connections) { if (cp == skip || !cp->current()) { continue; } - const auto& prev = cp->blk_state.find (bsum.previous); - if (prev != cp->blk_state.end() && !prev->is_known) { - cp->blk_state.insert((eosio::peer_block_state){bid,bnum,false,true,time_point()}); - cp->enqueue( pending_notify ); - } - else { - cp->blk_state.insert((eosio::peer_block_state){bid,bnum,true,true,time_point()}); - cp->enqueue( bsum ); - } + cp->add_peer_block(pbstate); + cp->enqueue( bsum ); } } } + void dispatch_manager::recv_block (connection_ptr c, const block_id_type& id, uint32_t bnum) { + received_blocks.emplace_back((block_origin){id, c}); + if (c && + c->last_req && + c->last_req->req_blocks.mode != none && + c->last_req->req_blocks.ids.back() == id) { + c->last_req.reset(); + } + c->add_peer_block({id, bnum, false,true,time_point()}); + + fc_dlog(logger, "canceling wait on ${p}", ("p",c->peer_name())); + c->cancel_wait(); + } + void dispatch_manager::rejected_block (const block_id_type& id) { fc_dlog(logger,"not sending rejected transaction ${tid}",("tid",id)); for (auto org = received_blocks.begin(); org != received_blocks.end(); org++) { @@ -1628,16 +1659,6 @@ namespace eosio { } } - void dispatch_manager::rejected_transaction (const transaction_id_type& id) { - fc_dlog(logger,"not sending rejected transaction ${tid}",("tid",id)); - for (auto org = received_transactions.begin(); org != received_transactions.end(); org++) { - if (org->id == id) { - received_transactions.erase(org); - break; - } - } - } - void dispatch_manager::bcast_transaction (const packed_transaction& trx) { connection_ptr skip; transaction_id_type id = trx.id(); @@ -1650,7 +1671,6 @@ namespace eosio { } } - for (auto ref = req_trx.begin(); ref != req_trx.end(); ++ref) { if (*ref == id) { req_trx.erase(ref); @@ -1681,7 +1701,7 @@ namespace eosio { 0, 0, 0}; my_impl->local_txns.insert(std::move(nts)); - if(bufsiz <= just_send_it_max) { + if( !large_msg_notify || bufsiz <= just_send_it_max) { connection_wptr weak_skip = skip; my_impl->send_all( trx, [weak_skip, id, trx_expiration](connection_ptr c) -> bool { if(c == weak_skip.lock() || c->syncing ) { @@ -1723,92 +1743,7 @@ namespace eosio { } } - -#if 0 - void dispatch_manager::recv_block (connection_ptr c, const signed_block& msg) { - block_id_type blk_id = msg.id(); - uint32_t num = msg.block_num(); - const auto& blkstate = c->blk_state.get().find(blk_id); - if (blkstate != c->blk_state.end()) { - c->blk_state.modify(blkstate, set_is_known); - } - if (c->last_req && - c->last_req->req_blocks.mode != none && - c->last_req->req_blocks.ids.back() == blk_id) { - c->last_req.reset(); - } - for (auto ref = req_blks.begin(); ref != req_blks.end(); ++ref) { - if (ref->id == blk_id) { - bool is_retry = ref->local_retry; - req_blks.erase(ref); - fc_dlog(logger, "received a requested block"); - - if (is_retry) { - bcast_block(msg); - } - else { - notice_message note; - note.known_blocks.mode = normal; - note.known_blocks.ids.push_back( blk_id ); - note.known_trx.mode = none; - my_impl->send_all(note, [blk_id, num](connection_ptr conn) -> bool { - const auto& bs = conn->blk_state.find(blk_id); - bool unknown = bs == conn->blk_state.end(); - if (unknown) { - conn->blk_state.insert(eosio::peer_block_state({blk_id,num,false,true,fc::time_point() })); - } - return unknown; - }); - } - return; - } - } - - if( !my_impl->sync_master->is_active(c) ) { - fc_dlog(logger,"got a block to forward"); - net_message nmsg(msg); - if(fc::raw::pack_size(nmsg) < just_send_it_max ) { - fc_dlog(logger, "forwarding the signed block"); - my_impl->send_all( msg, [c, blk_id, num](connection_ptr conn) -> bool { - bool sendit = false; - if( c != conn && !conn->syncing ) { - auto b = conn->blk_state.get().find(blk_id); - if(b == conn->blk_state.end()) { - conn->blk_state.insert({blk_id,num,true,true,fc::time_point()}); - sendit = true; - } else if (!b->is_known) { - conn->blk_state.modify(b,set_is_known); - sendit = true; - } - } - fc_dlog(logger, "${action} block ${num} to ${c}", - ("action", sendit ? "sending" : "skipping") - ("num",num) - ("c", conn->peer_name() )); - return sendit; - }); - } - else { - notice_message note; - note.known_blocks.mode = normal; - note.known_blocks.ids.push_back( blk_id ); - note.known_trx.mode = none; - my_impl->send_all(note, [blk_id, num](connection_ptr conn) -> bool { - const auto& bs = conn->blk_state.find(blk_id); - bool unknown = bs == conn->blk_state.end(); - if (unknown) { - conn->blk_state.insert(eosio::peer_block_state({blk_id,num,false,true,fc::time_point() })); - } - return unknown; - }); - } - } - else { - fc_dlog(logger, "not forwarding from active syncing connection ${p}",("p",c->peer_name())); - } - } -#endif - + void dispatch_manager::recv_transaction (connection_ptr c, const transaction_id_type& id) { received_transactions.emplace_back((transaction_origin){id, c}); if (c && @@ -1822,19 +1757,16 @@ namespace eosio { c->cancel_wait(); } - void dispatch_manager::recv_block (connection_ptr c, const block_id_type& id) { - received_blocks.emplace_back((block_origin){id, c}); - if (c && - c->last_req && - c->last_req->req_blocks.mode != none && - c->last_req->req_blocks.ids.back() == id) { - c->last_req.reset(); + void dispatch_manager::rejected_transaction (const transaction_id_type& id) { + fc_dlog(logger,"not sending rejected transaction ${tid}",("tid",id)); + for (auto org = received_transactions.begin(); org != received_transactions.end(); org++) { + if (org->id == id) { + received_transactions.erase(org); + break; + } } - - fc_dlog(logger, "canceling wait on ${p}", ("p",c->peer_name())); - c->cancel_wait(); } - + void dispatch_manager::recv_notice (connection_ptr c, const notice_message& msg, bool generated) { request_message req; req.req_trx.mode = none; @@ -1874,8 +1806,10 @@ namespace eosio { req.req_blocks.mode = normal; for( const auto& blkid : msg.known_blocks.ids) { signed_block_ptr b; + peer_block_state entry = {blkid,0,true,true,fc::time_point()}; try { b = cc.fetch_block_by_id(blkid); + entry.block_num = b->block_num(); } catch (const assert_exception &ex) { ilog( "caught assert on fetch_block_by_id, ${ex}",("ex",ex.what())); // keep going, client can ask another peer @@ -1886,7 +1820,9 @@ namespace eosio { send_req = true; req.req_blocks.ids.push_back( blkid ); req_blks.push_back( {blkid, generated} ); + entry.requested_time = fc::time_point::now(); } + c->add_peer_block(entry); } } else if (msg.known_blocks.mode != none) { @@ -2510,7 +2446,7 @@ namespace eosio { elog("Caught an unknown exception trying to recall blockID"); } - dispatcher->recv_block(c, blk_id); + dispatcher->recv_block(c, blk_id, blk_num); fc::microseconds age( fc::time_point::now() - msg.timestamp); fc_dlog(logger, "got signed_block #${n} from ${p} block age in secs = ${age}", ("n",blk_num)("p",c->peer_name())("age",age.to_seconds())); From 19b4f252082bfba40705f61d813c0406e0cddc0e Mon Sep 17 00:00:00 2001 From: Eric Iles Date: Thu, 24 May 2018 16:07:50 -0400 Subject: [PATCH 13/22] Add symbol arg to eos-dev image [skip-ci] --- Docker/dev/Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Docker/dev/Dockerfile b/Docker/dev/Dockerfile index 3b1d2efb3b4..d96bab1fd7a 100644 --- a/Docker/dev/Dockerfile +++ b/Docker/dev/Dockerfile @@ -1,10 +1,11 @@ FROM eosio/builder ARG branch=master +ARG symbole=SYS RUN git clone -b $branch https://github.com/EOSIO/eos.git --recursive \ && cd eos && echo "$branch:$(git rev-parse HEAD)" > /etc/eosio-version \ && cmake -H. -B"/opt/eosio" -GNinja -DCMAKE_BUILD_TYPE=Release -DWASM_ROOT=/opt/wasm -DCMAKE_CXX_COMPILER=clang++ \ - -DCMAKE_C_COMPILER=clang -DCMAKE_INSTALL_PREFIX=/opt/eosio -DSecp256k1_ROOT_DIR=/usr/local -DBUILD_MONGO_DB_PLUGIN=true \ + -DCMAKE_C_COMPILER=clang -DCMAKE_INSTALL_PREFIX=/opt/eosio -DSecp256k1_ROOT_DIR=/usr/local -DBUILD_MONGO_DB_PLUGIN=true -DCORE_SYMBOL_NAME=$symbol \ && cmake --build /opt/eosio --target install \ && mv /eos/Docker/config.ini / && mv /opt/eosio/contracts /contracts && mv /eos/Docker/nodeosd.sh /opt/eosio/bin/nodeosd.sh && mv programs /programs \ && rm -rf /eos From 10543ea913605f807c0a6120118d4229481d619e Mon Sep 17 00:00:00 2001 From: Eric Iles Date: Thu, 24 May 2018 17:24:59 -0400 Subject: [PATCH 14/22] Add tutorials to eos-dev [skip-ci] --- Docker/dev/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Docker/dev/Dockerfile b/Docker/dev/Dockerfile index d96bab1fd7a..d80985a856b 100644 --- a/Docker/dev/Dockerfile +++ b/Docker/dev/Dockerfile @@ -7,7 +7,7 @@ RUN git clone -b $branch https://github.com/EOSIO/eos.git --recursive \ && cmake -H. -B"/opt/eosio" -GNinja -DCMAKE_BUILD_TYPE=Release -DWASM_ROOT=/opt/wasm -DCMAKE_CXX_COMPILER=clang++ \ -DCMAKE_C_COMPILER=clang -DCMAKE_INSTALL_PREFIX=/opt/eosio -DSecp256k1_ROOT_DIR=/usr/local -DBUILD_MONGO_DB_PLUGIN=true -DCORE_SYMBOL_NAME=$symbol \ && cmake --build /opt/eosio --target install \ - && mv /eos/Docker/config.ini / && mv /opt/eosio/contracts /contracts && mv /eos/Docker/nodeosd.sh /opt/eosio/bin/nodeosd.sh && mv programs /programs \ + && mv /eos/Docker/config.ini / && mv /opt/eosio/contracts /contracts && mv /eos/Docker/nodeosd.sh /opt/eosio/bin/nodeosd.sh && mv tutorials /tutorials \ && rm -rf /eos RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -y install openssl vim psmisc python3-pip && rm -rf /var/lib/apt/lists/* From 11ba103bdb77bcde39021511fa671b6bdf8b9129 Mon Sep 17 00:00:00 2001 From: Bill Hamilton Date: Thu, 24 May 2018 17:17:52 -0700 Subject: [PATCH 15/22] darwin: changed boost install to version 1.67 --- scripts/eosio_build_darwin.sh | 45 +++++++++++------------------------ 1 file changed, 14 insertions(+), 31 deletions(-) diff --git a/scripts/eosio_build_darwin.sh b/scripts/eosio_build_darwin.sh index 0327eb1efff..c82d8cbb855 100644 --- a/scripts/eosio_build_darwin.sh +++ b/scripts/eosio_build_darwin.sh @@ -177,19 +177,18 @@ printf "\\n\\tChecking boost library installation.\\n" BVERSION=$( grep "#define BOOST_VERSION" "/usr/local/include/boost/version.hpp" 2>/dev/null | tail -1 | tr -s ' ' | cut -d\ -f3 ) - if [ "${BVERSION}" != "106600" ]; then + if [ "${BVERSION}" != "106700" ]; then if [ ! -z "${BVERSION}" ]; then printf "\\tFound Boost Version %s.\\n" "${BVERSION}" printf "\\tEOS.IO requires Boost version 1.66.\\n" - printf "\\tWould you like to uninstall version %s and install Boost version 1.66.\\n" "${BVERSION}" + printf "\\tWould you like to uninstall version %s and install Boost version 1.67.\\n" "${BVERSION}" select yn in "Yes" "No"; do case $yn in [Yy]* ) - if brew list | grep "boost" + if "${BREW}" list | grep "boost" then - printf "\\tUnlinking Boost Version %s.\\n" "${BVERSION}" - printf "\\tunlinking boost %s\\n" "${BVERSION}" - if ! "${BREW}" unlink boost + printf "\\tUninstalling Boost Version %s.\\n" "${BVERSION}" + if ! "${BREW}" uninstall --force boost then printf "\\tUnable to remove boost libraries at this time. 0\\n" printf "\\tExiting now.\\n\\n" @@ -197,13 +196,13 @@ fi else printf "\\tRemoving Boost Version %s.\\n" "${BVERSION}" - if ! sudo rm -rf "${BOOST_ROOT}/include/boost" + if ! sudo rm -rf "/usr/local/include/boost" then printf "\\tUnable to remove boost libraries at this time. 1\\n" printf "\\tExiting now.\\n\\n" exit 1; fi - if ! sudo rm -rf "${BOOST_ROOT}/lib/libboost*" + if ! sudo rm -rf "/usr/local/lib/libboost*" then printf "\\tUnable to remove boost libraries at this time. 2\\n" printf "\\tExiting now.\\n\\n" @@ -217,31 +216,15 @@ done fi printf "\\tInstalling boost libraries.\\n" - if [ ! -d "/usr/local/Cellar/boost/1.66.0" ]; then - if ! brew install "https://raw.githubusercontent.com/Homebrew/homebrew-core/76a83d798d76aa43459ceb145b721ba4a16a54a6/Formula/boost.rb" - then - printf "\\tUnable to install boost 1.66 libraries at this time. 0\\n" - printf "\\tExiting now.\\n\\n" - exit 1; - fi - printf "\\tPinning boost libraries.\\n" - if ! brew pin boost - then - printf "\\tUnable to pin boost libraries at this time. 2\\n" - printf "\\tExiting now.\\n\\n" - exit 1; - fi - else - if ! brew switch boost 1.66.0 - then - printf "\\tUnable to swtich boost libraries to 1.66.0 at this time. 1\\n" - printf "\\tExiting now.\\n\\n" - exit; - fi + if ! "${BREW}" install boost + then + printf "\\tUnable to install boost 1.67 libraries at this time. 0\\n" + printf "\\tExiting now.\\n\\n" + exit 1; fi - printf "\\tBoost 1.66.0 successfully installed @ /usr/local.\\n" + printf "\\tBoost 1.67.0 successfully installed @ /usr/local.\\n" else - printf "\\tBoost 1.66.0 found at /usr/local.\\n" + printf "\\tBoost 1.67.0 found at /usr/local.\\n" fi printf "\\n\\tChecking MongoDB C++ driver installation.\\n" From 84004fbf6140660d4b49d9c71f6d422950aa965a Mon Sep 17 00:00:00 2001 From: Kevin Heifner Date: Thu, 24 May 2018 23:28:19 -0400 Subject: [PATCH 16/22] Remove undefined method --- libraries/chain/include/eosio/chain/abi_serializer.hpp | 1 - 1 file changed, 1 deletion(-) diff --git a/libraries/chain/include/eosio/chain/abi_serializer.hpp b/libraries/chain/include/eosio/chain/abi_serializer.hpp index b5f7030366e..e8fc1dc31a9 100644 --- a/libraries/chain/include/eosio/chain/abi_serializer.hpp +++ b/libraries/chain/include/eosio/chain/abi_serializer.hpp @@ -37,7 +37,6 @@ struct abi_serializer { map> built_in_types; void configure_built_in_types(); - bool has_cycle(const vector>& sedges)const; void validate()const; type_name resolve_type(const type_name& t)const; From dfe4c3973c67a5629681f4608d7d65a25c9c3350 Mon Sep 17 00:00:00 2001 From: Kevin Heifner Date: Thu, 24 May 2018 23:29:16 -0400 Subject: [PATCH 17/22] Add check for type already exists to typedefs and also validate abi on every set_abi --- libraries/chain/abi_serializer.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libraries/chain/abi_serializer.cpp b/libraries/chain/abi_serializer.cpp index 4db7b143e35..f0adea65d5a 100644 --- a/libraries/chain/abi_serializer.cpp +++ b/libraries/chain/abi_serializer.cpp @@ -107,6 +107,7 @@ namespace eosio { namespace chain { for( const auto& td : abi.types ) { FC_ASSERT(is_type(td.type), "invalid type", ("type",td.type)); + FC_ASSERT(!is_type(td.new_type_name), "type already exists", ("new_type_name",td.new_type_name)); typedefs[td.new_type_name] = td.type; } @@ -128,6 +129,8 @@ namespace eosio { namespace chain { FC_ASSERT( actions.size() == abi.actions.size() ); FC_ASSERT( tables.size() == abi.tables.size() ); FC_ASSERT( error_messages.size() == abi.error_messages.size() ); + + validate(); } bool abi_serializer::is_builtin_type(const type_name& type)const { From 08446b5679de580be033821c12b44a83cfd43c8c Mon Sep 17 00:00:00 2001 From: Kevin Heifner Date: Fri, 25 May 2018 00:04:50 -0400 Subject: [PATCH 18/22] Remove recursion --- libraries/chain/abi_serializer.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/libraries/chain/abi_serializer.cpp b/libraries/chain/abi_serializer.cpp index f0adea65d5a..e65fe1f9cd1 100644 --- a/libraries/chain/abi_serializer.cpp +++ b/libraries/chain/abi_serializer.cpp @@ -225,10 +225,15 @@ namespace eosio { namespace chain { } FC_CAPTURE_AND_RETHROW( (t) ) } } - type_name abi_serializer::resolve_type(const type_name& type)const { + type_name abi_serializer::resolve_type(const type_name& type)const { auto itr = typedefs.find(type); - if( itr != typedefs.end() ) - return resolve_type(itr->second); + if( itr != typedefs.end() ) { + for( auto i = typedefs.size(); i > 0; --i ) { // avoid infinit recursion + const type_name& t = itr->second; + itr = typedefs.find( t ); + if( itr == typedefs.end() ) return t; + } + } return type; } From 800dd91b9d53fe576ddff70b58d47791554404da Mon Sep 17 00:00:00 2001 From: Kevin Heifner Date: Fri, 25 May 2018 00:05:42 -0400 Subject: [PATCH 19/22] Add tests for malformed abi type_defs --- unittests/abi_tests.cpp | 206 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 201 insertions(+), 5 deletions(-) diff --git a/unittests/abi_tests.cpp b/unittests/abi_tests.cpp index 597fd4bde66..bbfaa15072a 100644 --- a/unittests/abi_tests.cpp +++ b/unittests/abi_tests.cpp @@ -2109,16 +2109,15 @@ BOOST_AUTO_TEST_CASE(abi_cycle) )====="; auto abi = eosio_contract_abi(fc::json::from_string(typedef_cycle_abi).as()); - abi_serializer abis(abi); auto is_assert_exception = [](fc::assert_exception const & e) -> bool { wlog(e.to_string()); return true; }; - BOOST_CHECK_EXCEPTION( abis.validate(), fc::assert_exception, is_assert_exception ); + BOOST_CHECK_EXCEPTION( abi_serializer abis(abi), fc::assert_exception, is_assert_exception ); abi = fc::json::from_string(struct_cycle_abi).as(); - abis.set_abi(abi); - BOOST_CHECK_EXCEPTION( abis.validate(), fc::assert_exception, is_assert_exception ); + abi_serializer abis; + BOOST_CHECK_EXCEPTION( abis.set_abi(abi), fc::assert_exception, is_assert_exception ); } FC_LOG_AND_RETHROW() } @@ -2958,7 +2957,7 @@ BOOST_AUTO_TEST_CASE(abi_type_repeat) )====="; auto abi = eosio_contract_abi(fc::json::from_string(repeat_abi).as()); - auto is_table_exception = [](fc::assert_exception const & e) -> bool { return e.to_detail_string().find("types.size") != std::string::npos; }; + auto is_table_exception = [](fc::assert_exception const & e) -> bool { return e.to_detail_string().find("type already exists") != std::string::npos; }; BOOST_CHECK_EXCEPTION( abi_serializer abis(abi), fc::assert_exception, is_table_exception ); } FC_LOG_AND_RETHROW() } @@ -3142,4 +3141,201 @@ BOOST_AUTO_TEST_CASE(abi_table_repeat) BOOST_CHECK_EXCEPTION( abi_serializer abis(abi), fc::assert_exception, is_table_exception ); } FC_LOG_AND_RETHROW() } +BOOST_AUTO_TEST_CASE(abi_type_def) +{ try { + // inifinite loop in types + const char* repeat_abi = R"=====( + { + "types": [{ + "new_type_name": "account_name", + "type": "name" + } + ], + "structs": [{ + "name": "transfer", + "base": "", + "fields": [{ + "name": "from", + "type": "account_name" + },{ + "name": "to", + "type": "name" + },{ + "name": "amount", + "type": "uint64" + }] + } + ], + "actions": [{ + "name": "transfer", + "type": "transfer", + "ricardian_contract": "transfer contract" + } + ], + "tables": [] + } + )====="; + + abi_serializer abis(fc::json::from_string(repeat_abi).as()); + BOOST_CHECK(abis.is_type("name")); + BOOST_CHECK(abis.is_type("account_name")); + + const char* test_data = R"=====( + { + "from" : "kevin", + "to" : "dan", + "amount" : 16 + } + )====="; + + auto var = fc::json::from_string(test_data); + verify_byte_round_trip_conversion(abis, "transfer", var); + +} FC_LOG_AND_RETHROW() } + +BOOST_AUTO_TEST_CASE(abi_type_loop) +{ try { + // inifinite loop in types + const char* repeat_abi = R"=====( + { + "types": [{ + "new_type_name": "account_name", + "type": "name" + },{ + "new_type_name": "name", + "type": "account_name" + } + ], + "structs": [{ + "name": "transfer", + "base": "", + "fields": [{ + "name": "from", + "type": "account_name" + },{ + "name": "to", + "type": "name" + },{ + "name": "amount", + "type": "uint64" + }] + } + ], + "actions": [{ + "name": "transfer", + "type": "transfer", + "ricardian_contract": "transfer contract" + } + ], + "tables": [] + } + )====="; + + auto is_type_exception = [](fc::assert_exception const & e) -> bool { return e.to_detail_string().find("type already exists") != std::string::npos; }; + BOOST_CHECK_EXCEPTION( abi_serializer abis(fc::json::from_string(repeat_abi).as()), fc::assert_exception, is_type_exception ); + +} FC_LOG_AND_RETHROW() } + +BOOST_AUTO_TEST_CASE(abi_type_redefine) +{ try { + // inifinite loop in types + const char* repeat_abi = R"=====( + { + "types": [{ + "new_type_name": "account_name", + "type": "account_name" + } + ], + "structs": [{ + "name": "transfer", + "base": "", + "fields": [{ + "name": "from", + "type": "account_name" + },{ + "name": "to", + "type": "name" + },{ + "name": "amount", + "type": "uint64" + }] + } + ], + "actions": [{ + "name": "transfer", + "type": "transfer", + "ricardian_contract": "transfer contract" + } + ], + "tables": [] + } + )====="; + + auto is_type_exception = [](fc::assert_exception const & e) -> bool { return e.to_detail_string().find("invalid type") != std::string::npos; }; + BOOST_CHECK_EXCEPTION( abi_serializer abis(fc::json::from_string(repeat_abi).as()), fc::assert_exception, is_type_exception ); + +} FC_LOG_AND_RETHROW() } + +BOOST_AUTO_TEST_CASE(abi_type_redefine_to_name) +{ try { + // inifinite loop in types + const char* repeat_abi = R"=====( + { + "types": [{ + "new_type_name": "name", + "type": "name" + } + ], + "structs": [], + "actions": [], + "tables": [] + } + )====="; + + auto is_type_exception = [](fc::assert_exception const & e) -> bool { return e.to_detail_string().find("type already exists") != std::string::npos; }; + BOOST_CHECK_EXCEPTION( abi_serializer abis(fc::json::from_string(repeat_abi).as()), fc::assert_exception, is_type_exception ); + +} FC_LOG_AND_RETHROW() } + +BOOST_AUTO_TEST_CASE(abi_account_name_in_eosio_abi) +{ try { + // inifinite loop in types + const char* repeat_abi = R"=====( + { + "types": [{ + "new_type_name": "account_name", + "type": "name" + } + ], + "structs": [{ + "name": "transfer", + "base": "", + "fields": [{ + "name": "from", + "type": "account_name" + },{ + "name": "to", + "type": "name" + },{ + "name": "amount", + "type": "uint64" + }] + } + ], + "actions": [{ + "name": "transfer", + "type": "transfer", + "ricardian_contract": "transfer contract" + } + ], + "tables": [] + } + )====="; + + auto abi = eosio_contract_abi(fc::json::from_string(repeat_abi).as()); + auto is_type_exception = [](fc::assert_exception const & e) -> bool { return e.to_detail_string().find("abi.types.size") != std::string::npos; }; + +} FC_LOG_AND_RETHROW() } + + BOOST_AUTO_TEST_SUITE_END() From 212b8c2106a731e696c3781500577e3ac80dc342 Mon Sep 17 00:00:00 2001 From: Kevin Heifner Date: Fri, 25 May 2018 00:23:36 -0400 Subject: [PATCH 20/22] Fix misspelled word --- libraries/chain/abi_serializer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/chain/abi_serializer.cpp b/libraries/chain/abi_serializer.cpp index e65fe1f9cd1..b13ed6d9023 100644 --- a/libraries/chain/abi_serializer.cpp +++ b/libraries/chain/abi_serializer.cpp @@ -228,7 +228,7 @@ namespace eosio { namespace chain { type_name abi_serializer::resolve_type(const type_name& type)const { auto itr = typedefs.find(type); if( itr != typedefs.end() ) { - for( auto i = typedefs.size(); i > 0; --i ) { // avoid infinit recursion + for( auto i = typedefs.size(); i > 0; --i ) { // avoid infinite recursion const type_name& t = itr->second; itr = typedefs.find( t ); if( itr == typedefs.end() ) return t; From 770ee789ced9622b965fbc61e7141ca887181293 Mon Sep 17 00:00:00 2001 From: jafri Date: Thu, 24 May 2018 22:41:21 -0600 Subject: [PATCH 21/22] Update boost 1_66 to 1_67 --- .buildkite/coverage.yml | 2 +- .gitignore | 1 + CMakeLists.txt | 2 +- Docker/builder/Dockerfile | 6 +++--- eosio_build.sh | 8 ++++---- scripts/eosio_build_amazon.sh | 22 +++++++++++----------- scripts/eosio_build_centos.sh | 22 +++++++++++----------- scripts/eosio_build_darwin.sh | 2 +- scripts/eosio_build_fedora.sh | 28 ++++++++++++++-------------- 9 files changed, 47 insertions(+), 46 deletions(-) diff --git a/.buildkite/coverage.yml b/.buildkite/coverage.yml index 99c0e064c7a..8eda049bcbd 100644 --- a/.buildkite/coverage.yml +++ b/.buildkite/coverage.yml @@ -21,7 +21,7 @@ steps: mounts: - /etc/buildkite-agent/config:/config environment: - - BOOST_ROOT=/root/opt/boost_1_66_0 + - BOOST_ROOT=/root/opt/boost_1_67_0 - OPENSSL_ROOT_DIR=/usr/include/openssl - WASM_ROOT=/root/opt/wasm - PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/root/opt/wasm/bin diff --git a/.gitignore b/.gitignore index a1c8455f4ec..0e1176e8ad0 100644 --- a/.gitignore +++ b/.gitignore @@ -76,4 +76,5 @@ build-debug/* etc/eosio/node_* var/lib/node_* .vscode +.idea .DS_Store diff --git a/CMakeLists.txt b/CMakeLists.txt index 092eac8cd54..61444f9489a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -85,7 +85,7 @@ 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.66 REQUIRED COMPONENTS +FIND_PACKAGE(Boost 1.67 REQUIRED COMPONENTS thread date_time filesystem diff --git a/Docker/builder/Dockerfile b/Docker/builder/Dockerfile index c0bfec7aeae..a01cce4942f 100644 --- a/Docker/builder/Dockerfile +++ b/Docker/builder/Dockerfile @@ -26,13 +26,13 @@ RUN wget --no-check-certificate https://cmake.org/files/v3.9/cmake-3.9.6-Linux-x ENV CC clang ENV CXX clang++ -RUN wget https://dl.bintray.com/boostorg/release/1.66.0/source/boost_1_66_0.tar.bz2 -O - | tar -xj \ - && cd boost_1_66_0 \ +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 \ && ./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_66_0 + && cd .. && rm -rf boost_1_67_0 RUN wget https://github.com/mongodb/mongo-c-driver/releases/download/1.9.3/mongo-c-driver-1.9.3.tar.gz -O - | tar -xz \ && cd mongo-c-driver-1.9.3 \ diff --git a/eosio_build.sh b/eosio_build.sh index a11ee2f3df1..50ae5126f2e 100755 --- a/eosio_build.sh +++ b/eosio_build.sh @@ -143,7 +143,7 @@ export LLVM_DIR=${HOME}/opt/wasm/lib/cmake/llvm export CMAKE=${HOME}/opt/cmake/bin/cmake export PATH=${HOME}/opt/mongodb/bin:$PATH - export BOOST_ROOT="${HOME}/opt/boost_1_66_0" + export BOOST_ROOT="${HOME}/opt/boost_1_67_0" ;; "CentOS Linux") FILE="${PWD}/scripts/eosio_build_centos.sh" @@ -153,7 +153,7 @@ export LLVM_DIR=${HOME}/opt/wasm/lib/cmake/llvm export CMAKE=${HOME}/opt/cmake/bin/cmake export PATH=${HOME}/opt/mongodb/bin:$PATH - export BOOST_ROOT="${HOME}/opt/boost_1_66_0" + export BOOST_ROOT="${HOME}/opt/boost_1_67_0" ;; "elementary OS") FILE="${PWD}/scripts/eosio_build_ubuntu.sh" @@ -161,7 +161,7 @@ C_COMPILER=clang-4.0 MONGOD_CONF=${HOME}/opt/mongodb/mongod.conf export PATH=${HOME}/opt/mongodb/bin:$PATH - export BOOST_ROOT="${HOME}/opt/boost_1_66_0" + export BOOST_ROOT="${HOME}/opt/boost_1_67_0" ;; "Fedora") FILE="${PWD}/scripts/eosio_build_fedora.sh" @@ -169,7 +169,7 @@ C_COMPILER=gcc MONGOD_CONF=/etc/mongod.conf export LLVM_DIR=${HOME}/opt/wasm/lib/cmake/llvm - export BOOST_ROOT="${HOME}/opt/boost_1_66_0" + export BOOST_ROOT="${HOME}/opt/boost_1_67_0" ;; "Linux Mint") FILE="${PWD}/scripts/eosio_build_ubuntu.sh" diff --git a/scripts/eosio_build_amazon.sh b/scripts/eosio_build_amazon.sh index 5eb077cd6d0..cce0811a2be 100644 --- a/scripts/eosio_build_amazon.sh +++ b/scripts/eosio_build_amazon.sh @@ -214,7 +214,7 @@ printf "\\n\\tChecking boost library installation.\\n" BVERSION=$( grep "BOOST_LIB_VERSION" "${BOOST_ROOT}/include/boost/version.hpp" 2>/dev/null \ | tail -1 | tr -s ' ' | cut -d\ -f3 | sed 's/[^0-9\._]//gI' ) - if [ "${BVERSION}" != "1_66" ]; then + if [ "${BVERSION}" != "1_67" ]; then printf "\\tRemoving existing boost libraries in %s/opt/boost*.\\n" "${HOME}" if ! rm -rf "${HOME}/opt/boost*" then @@ -230,27 +230,27 @@ exit 1 fi STATUS=$(curl -LO -w '%{http_code}' --connect-timeout 30 \ - "https://dl.bintray.com/boostorg/release/1.66.0/source/boost_1_66_0.tar.bz2" ) + "https://dl.bintray.com/boostorg/release/1.67.0/source/boost_1_67_0.tar.bz2" ) if [ "${STATUS}" -ne 200 ]; then printf "\\tUnable to download Boost libraries at this time.\\n" printf "\\tExiting now.\\n\\n" exit 1; fi - if ! tar xf "${TEMP_DIR}/boost_1_66_0.tar.bz2" + if ! tar xf "${TEMP_DIR}/boost_1_67_0.tar.bz2" then - printf "\\tUnable to decompress Boost libraries @ %s/boost_1_66_0.tar.bz2 at this time.\\n" "${TEMP_DIR}" + printf "\\tUnable to decompress Boost libraries @ %s/boost_1_67_0.tar.bz2 at this time.\\n" "${TEMP_DIR}" printf "\\tExiting now.\\n\\n" exit 1; fi - if ! rm -f "${TEMP_DIR}/boost_1_66_0.tar.bz2" + if ! rm -f "${TEMP_DIR}/boost_1_67_0.tar.bz2" then - printf "\\tUnable to remove Boost libraries @ %s/boost_1_66_0.tar.bz2 at this time.\\n" "${TEMP_DIR}" + printf "\\tUnable to remove Boost libraries @ %s/boost_1_67_0.tar.bz2 at this time.\\n" "${TEMP_DIR}" printf "\\tExiting now.\\n\\n" exit 1; fi - if ! cd "${TEMP_DIR}/boost_1_66_0/" + if ! cd "${TEMP_DIR}/boost_1_67_0/" then - printf "\\tUnable to change directory into %s/boost_1_66_0/ at this time.\\n" "${TEMP_DIR}" + printf "\\tUnable to change directory into %s/boost_1_67_0/ at this time.\\n" "${TEMP_DIR}" printf "\\tExiting now.\\n\\n" exit 1; fi @@ -266,14 +266,14 @@ printf "\\n\\tExiting now.\\n" exit 1 fi - if ! rm -rf "${TEMP_DIR}/boost_1_66_0/" + if ! rm -rf "${TEMP_DIR}/boost_1_67_0/" then - printf "\\n\\tUnable to remove boost libraries directory @ %s/boost_1_66_0/.\\n" "${TEMP_DIR}" + printf "\\n\\tUnable to remove boost libraries directory @ %s/boost_1_67_0/.\\n" "${TEMP_DIR}" printf "\\n\\tExiting now.\\n" exit 1 fi else - printf "\\tBoost 1.66.0 found at %s/opt/boost_1_66_0.\\n" "${HOME}" + printf "\\tBoost 1.67.0 found at %s/opt/boost_1_67_0.\\n" "${HOME}" fi printf "\\n\\tChecking MongoDB installation.\\n" diff --git a/scripts/eosio_build_centos.sh b/scripts/eosio_build_centos.sh index eeeafc22cad..3a3f0f16751 100644 --- a/scripts/eosio_build_centos.sh +++ b/scripts/eosio_build_centos.sh @@ -315,27 +315,27 @@ printf "\\n\\tExiting now.\\n\\n" exit 1; fi - STATUS=$(curl -LO -w '%{http_code}' --connect-timeout 30 https://dl.bintray.com/boostorg/release/1.66.0/source/boost_1_66_0.tar.bz2) + STATUS=$(curl -LO -w '%{http_code}' --connect-timeout 30 https://dl.bintray.com/boostorg/release/1.67.0/source/boost_1_67_0.tar.bz2) if [ "${STATUS}" -ne 200 ]; then printf "\\tUnable to download Boost libraries at this time.\\n" printf "\\n\\tExiting now.\\n\\n" exit 1; fi - if ! tar xf "${TEMP_DIR}/boost_1_66_0.tar.bz2" + if ! tar xf "${TEMP_DIR}/boost_1_67_0.tar.bz2" then - printf "\\n\\tUnable to unarchive file %s/boost_1_66_0.tar.bz2.\\n" "${TEMP_DIR}" + printf "\\n\\tUnable to unarchive file %s/boost_1_67_0.tar.bz2.\\n" "${TEMP_DIR}" printf "\\n\\tExiting now.\\n\\n" exit 1; fi - if ! rm -f "${TEMP_DIR}/boost_1_66_0.tar.bz2" + if ! rm -f "${TEMP_DIR}/boost_1_67_0.tar.bz2" then - printf "\\n\\tUnable to remove file %s/boost_1_66_0.tar.bz2.\\n" "${TEMP_DIR}" + printf "\\n\\tUnable to remove file %s/boost_1_67_0.tar.bz2.\\n" "${TEMP_DIR}" printf "\\n\\tExiting now.\\n\\n" exit 1; fi - if ! cd "${TEMP_DIR}/boost_1_66_0/" + if ! cd "${TEMP_DIR}/boost_1_67_0/" then - printf "\\n\\tUnable to enter directory %s/boost_1_66_0.\\n" "${TEMP_DIR}" + printf "\\n\\tUnable to enter directory %s/boost_1_67_0.\\n" "${TEMP_DIR}" printf "\\n\\tExiting now.\\n\\n" exit 1; fi @@ -351,15 +351,15 @@ printf "\\n\\tExiting now.\\n\\n" exit 1; fi - if ! rm -rf "${TEMP_DIR}/boost_1_66_0/" + if ! rm -rf "${TEMP_DIR}/boost_1_67_0/" then - printf "\\n\\tUnable to remove directory %s/boost_1_66_0.\\n" "${TEMP_DIR}" + printf "\\n\\tUnable to remove directory %s/boost_1_67_0.\\n" "${TEMP_DIR}" printf "\\n\\tExiting now.\\n\\n" exit 1; fi - printf "\\tBoost 1.66.0 successfully installed @ %s/opt/boost_1_66_0.\\n\\n" "${HOME}" + printf "\\tBoost 1.67.0 successfully installed @ %s/opt/boost_1_67_0.\\n\\n" "${HOME}" else - printf "\\tBoost 1.66.0 found at %s/opt/boost_1_66_0.\\n\\n" "${HOME}" + printf "\\tBoost 1.67.0 found at %s/opt/boost_1_67_0.\\n\\n" "${HOME}" fi printf "\\n\\tChecking MongoDB installation.\\n" diff --git a/scripts/eosio_build_darwin.sh b/scripts/eosio_build_darwin.sh index c82d8cbb855..d2cb3ea71e4 100644 --- a/scripts/eosio_build_darwin.sh +++ b/scripts/eosio_build_darwin.sh @@ -180,7 +180,7 @@ if [ "${BVERSION}" != "106700" ]; then if [ ! -z "${BVERSION}" ]; then printf "\\tFound Boost Version %s.\\n" "${BVERSION}" - printf "\\tEOS.IO requires Boost version 1.66.\\n" + printf "\\tEOS.IO requires Boost version 1.67.\\n" printf "\\tWould you like to uninstall version %s and install Boost version 1.67.\\n" "${BVERSION}" select yn in "Yes" "No"; do case $yn in diff --git a/scripts/eosio_build_fedora.sh b/scripts/eosio_build_fedora.sh index c8cecb61c27..a24b49207f2 100644 --- a/scripts/eosio_build_fedora.sh +++ b/scripts/eosio_build_fedora.sh @@ -158,7 +158,7 @@ printf "\\n\\tChecking boost library installation.\\n" BVERSION=$( grep "BOOST_LIB_VERSION" "${BOOST_ROOT}/include/boost/version.hpp" 2>/dev/null \ | tail -1 | tr -s ' ' | cut -d\ -f3 | sed 's/[^0-9\._]//gI' ) - if [ "${BVERSION}" != "1_66" ]; then + if [ "${BVERSION}" != "1_67" ]; then printf "\\tRemoving existing boost libraries in %s/opt/boost* .\\n" "${HOME}" if ! rm -rf "${HOME}/opt/boost*" then @@ -173,51 +173,51 @@ printf "\\tExiting now.\\n\\n" exit 1; fi - STATUS=$( curl -LO -w '%{http_code}' --connect-timeout 30 https://dl.bintray.com/boostorg/release/1.66.0/source/boost_1_66_0.tar.bz2 ) + STATUS=$( curl -LO -w '%{http_code}' --connect-timeout 30 https://dl.bintray.com/boostorg/release/1.67.0/source/boost_1_67_0.tar.bz2 ) if [ "${STATUS}" -ne 200 ]; then printf "\\tUnable to download Boost libraries at this time.\\n" printf "\\tExiting now.\\n\\n" exit 1; fi - if ! tar xf "${TEMP_DIR}/boost_1_66_0.tar.bz2" + if ! tar xf "${TEMP_DIR}/boost_1_67_0.tar.bz2" then - printf "\\n\\tUnable to unarchive file %s/boost_1_66_0.tar.bz2.\\n" "${TEMP_DIR}" + printf "\\n\\tUnable to unarchive file %s/boost_1_67_0.tar.bz2.\\n" "${TEMP_DIR}" printf "\\tExiting now.\\n\\n" exit 1; fi - if ! rm -f "${TEMP_DIR}/boost_1_66_0.tar.bz2" + if ! rm -f "${TEMP_DIR}/boost_1_67_0.tar.bz2" then - printf "\\n\\tUnable to remove file %s/boost_1_66_0.tar.bz2.\\n" "${TEMP_DIR}" + printf "\\n\\tUnable to remove file %s/boost_1_67_0.tar.bz2.\\n" "${TEMP_DIR}" printf "\\tExiting now.\\n\\n" exit 1; fi - if ! cd "${TEMP_DIR}/boost_1_66_0/" + if ! cd "${TEMP_DIR}/boost_1_67_0/" then - printf "\\n\\tUnable to enter directory %s/boost_1_66_0.\\n" "${TEMP_DIR}" + printf "\\n\\tUnable to enter directory %s/boost_1_67_0.\\n" "${TEMP_DIR}" printf "\\tExiting now.\\n\\n" exit 1; fi - if ! "${TEMP_DIR}/boost_1_66_0/bootstrap.sh" "--prefix=$BOOST_ROOT" + if ! "${TEMP_DIR}/boost_1_67_0/bootstrap.sh" "--prefix=$BOOST_ROOT" then printf "\\n\\tInstallation of boost libraries failed. 0\\n" printf "\\tExiting now.\\n\\n" exit 1; fi - if ! "${TEMP_DIR}/boost_1_66_0/b2" install + if ! "${TEMP_DIR}/boost_1_67_0/b2" install then printf "\\n\\tInstallation of boost libraries failed. 1\\n" printf "\\tExiting now.\\n\\n" exit 1; fi - if ! rm -rf "${TEMP_DIR}/boost_1_66_0" + if ! rm -rf "${TEMP_DIR}/boost_1_67_0" then - printf "\\n\\tUnable to remove directory %s/boost_1_66_0. 1\\n" "${TEMP_DIR}" + printf "\\n\\tUnable to remove directory %s/boost_1_67_0. 1\\n" "${TEMP_DIR}" printf "\\tExiting now.\\n\\n" exit 1; fi - printf "\\n\\tBoost 1.66.0 successfully installed at %s/opt/boost_1_66_0.\\n\\n" "${HOME}" + printf "\\n\\tBoost 1.67.0 successfully installed at %s/opt/boost_1_67_0.\\n\\n" "${HOME}" else - printf "\\tBoost 1.66.0 found at %s/opt/boost_1_66_0.\\n" "${HOME}" + printf "\\tBoost 1.67.0 found at %s/opt/boost_1_67_0.\\n" "${HOME}" fi printf "\\n\\tChecking MongoDB C++ driver installation.\\n" From ab063f00dac0a1082ef154d51134343043741df4 Mon Sep 17 00:00:00 2001 From: Syed Jafri Date: Thu, 24 May 2018 23:25:38 -0600 Subject: [PATCH 22/22] Revert "Update boost 1_66 to 1_67" --- .buildkite/coverage.yml | 2 +- .gitignore | 1 - CMakeLists.txt | 2 +- Docker/builder/Dockerfile | 6 +++--- eosio_build.sh | 8 ++++---- scripts/eosio_build_amazon.sh | 22 +++++++++++----------- scripts/eosio_build_centos.sh | 22 +++++++++++----------- scripts/eosio_build_darwin.sh | 2 +- scripts/eosio_build_fedora.sh | 28 ++++++++++++++-------------- 9 files changed, 46 insertions(+), 47 deletions(-) diff --git a/.buildkite/coverage.yml b/.buildkite/coverage.yml index 8eda049bcbd..99c0e064c7a 100644 --- a/.buildkite/coverage.yml +++ b/.buildkite/coverage.yml @@ -21,7 +21,7 @@ steps: mounts: - /etc/buildkite-agent/config:/config environment: - - BOOST_ROOT=/root/opt/boost_1_67_0 + - BOOST_ROOT=/root/opt/boost_1_66_0 - OPENSSL_ROOT_DIR=/usr/include/openssl - WASM_ROOT=/root/opt/wasm - PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/root/opt/wasm/bin diff --git a/.gitignore b/.gitignore index 0e1176e8ad0..a1c8455f4ec 100644 --- a/.gitignore +++ b/.gitignore @@ -76,5 +76,4 @@ build-debug/* etc/eosio/node_* var/lib/node_* .vscode -.idea .DS_Store diff --git a/CMakeLists.txt b/CMakeLists.txt index 61444f9489a..092eac8cd54 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -85,7 +85,7 @@ 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 +FIND_PACKAGE(Boost 1.66 REQUIRED COMPONENTS thread date_time filesystem diff --git a/Docker/builder/Dockerfile b/Docker/builder/Dockerfile index a01cce4942f..c0bfec7aeae 100644 --- a/Docker/builder/Dockerfile +++ b/Docker/builder/Dockerfile @@ -26,13 +26,13 @@ RUN wget --no-check-certificate https://cmake.org/files/v3.9/cmake-3.9.6-Linux-x 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.66.0/source/boost_1_66_0.tar.bz2 -O - | tar -xj \ + && cd boost_1_66_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 + && cd .. && rm -rf boost_1_66_0 RUN wget https://github.com/mongodb/mongo-c-driver/releases/download/1.9.3/mongo-c-driver-1.9.3.tar.gz -O - | tar -xz \ && cd mongo-c-driver-1.9.3 \ diff --git a/eosio_build.sh b/eosio_build.sh index 50ae5126f2e..a11ee2f3df1 100755 --- a/eosio_build.sh +++ b/eosio_build.sh @@ -143,7 +143,7 @@ export LLVM_DIR=${HOME}/opt/wasm/lib/cmake/llvm export CMAKE=${HOME}/opt/cmake/bin/cmake export PATH=${HOME}/opt/mongodb/bin:$PATH - export BOOST_ROOT="${HOME}/opt/boost_1_67_0" + export BOOST_ROOT="${HOME}/opt/boost_1_66_0" ;; "CentOS Linux") FILE="${PWD}/scripts/eosio_build_centos.sh" @@ -153,7 +153,7 @@ export LLVM_DIR=${HOME}/opt/wasm/lib/cmake/llvm export CMAKE=${HOME}/opt/cmake/bin/cmake export PATH=${HOME}/opt/mongodb/bin:$PATH - export BOOST_ROOT="${HOME}/opt/boost_1_67_0" + export BOOST_ROOT="${HOME}/opt/boost_1_66_0" ;; "elementary OS") FILE="${PWD}/scripts/eosio_build_ubuntu.sh" @@ -161,7 +161,7 @@ C_COMPILER=clang-4.0 MONGOD_CONF=${HOME}/opt/mongodb/mongod.conf export PATH=${HOME}/opt/mongodb/bin:$PATH - export BOOST_ROOT="${HOME}/opt/boost_1_67_0" + export BOOST_ROOT="${HOME}/opt/boost_1_66_0" ;; "Fedora") FILE="${PWD}/scripts/eosio_build_fedora.sh" @@ -169,7 +169,7 @@ C_COMPILER=gcc MONGOD_CONF=/etc/mongod.conf export LLVM_DIR=${HOME}/opt/wasm/lib/cmake/llvm - export BOOST_ROOT="${HOME}/opt/boost_1_67_0" + export BOOST_ROOT="${HOME}/opt/boost_1_66_0" ;; "Linux Mint") FILE="${PWD}/scripts/eosio_build_ubuntu.sh" diff --git a/scripts/eosio_build_amazon.sh b/scripts/eosio_build_amazon.sh index cce0811a2be..5eb077cd6d0 100644 --- a/scripts/eosio_build_amazon.sh +++ b/scripts/eosio_build_amazon.sh @@ -214,7 +214,7 @@ printf "\\n\\tChecking boost library installation.\\n" BVERSION=$( grep "BOOST_LIB_VERSION" "${BOOST_ROOT}/include/boost/version.hpp" 2>/dev/null \ | tail -1 | tr -s ' ' | cut -d\ -f3 | sed 's/[^0-9\._]//gI' ) - if [ "${BVERSION}" != "1_67" ]; then + if [ "${BVERSION}" != "1_66" ]; then printf "\\tRemoving existing boost libraries in %s/opt/boost*.\\n" "${HOME}" if ! rm -rf "${HOME}/opt/boost*" then @@ -230,27 +230,27 @@ exit 1 fi STATUS=$(curl -LO -w '%{http_code}' --connect-timeout 30 \ - "https://dl.bintray.com/boostorg/release/1.67.0/source/boost_1_67_0.tar.bz2" ) + "https://dl.bintray.com/boostorg/release/1.66.0/source/boost_1_66_0.tar.bz2" ) if [ "${STATUS}" -ne 200 ]; then printf "\\tUnable to download Boost libraries at this time.\\n" printf "\\tExiting now.\\n\\n" exit 1; fi - if ! tar xf "${TEMP_DIR}/boost_1_67_0.tar.bz2" + if ! tar xf "${TEMP_DIR}/boost_1_66_0.tar.bz2" then - printf "\\tUnable to decompress Boost libraries @ %s/boost_1_67_0.tar.bz2 at this time.\\n" "${TEMP_DIR}" + printf "\\tUnable to decompress Boost libraries @ %s/boost_1_66_0.tar.bz2 at this time.\\n" "${TEMP_DIR}" printf "\\tExiting now.\\n\\n" exit 1; fi - if ! rm -f "${TEMP_DIR}/boost_1_67_0.tar.bz2" + if ! rm -f "${TEMP_DIR}/boost_1_66_0.tar.bz2" then - printf "\\tUnable to remove Boost libraries @ %s/boost_1_67_0.tar.bz2 at this time.\\n" "${TEMP_DIR}" + printf "\\tUnable to remove Boost libraries @ %s/boost_1_66_0.tar.bz2 at this time.\\n" "${TEMP_DIR}" printf "\\tExiting now.\\n\\n" exit 1; fi - if ! cd "${TEMP_DIR}/boost_1_67_0/" + if ! cd "${TEMP_DIR}/boost_1_66_0/" then - printf "\\tUnable to change directory into %s/boost_1_67_0/ at this time.\\n" "${TEMP_DIR}" + printf "\\tUnable to change directory into %s/boost_1_66_0/ at this time.\\n" "${TEMP_DIR}" printf "\\tExiting now.\\n\\n" exit 1; fi @@ -266,14 +266,14 @@ printf "\\n\\tExiting now.\\n" exit 1 fi - if ! rm -rf "${TEMP_DIR}/boost_1_67_0/" + if ! rm -rf "${TEMP_DIR}/boost_1_66_0/" then - printf "\\n\\tUnable to remove boost libraries directory @ %s/boost_1_67_0/.\\n" "${TEMP_DIR}" + printf "\\n\\tUnable to remove boost libraries directory @ %s/boost_1_66_0/.\\n" "${TEMP_DIR}" printf "\\n\\tExiting now.\\n" exit 1 fi else - printf "\\tBoost 1.67.0 found at %s/opt/boost_1_67_0.\\n" "${HOME}" + printf "\\tBoost 1.66.0 found at %s/opt/boost_1_66_0.\\n" "${HOME}" fi printf "\\n\\tChecking MongoDB installation.\\n" diff --git a/scripts/eosio_build_centos.sh b/scripts/eosio_build_centos.sh index 3a3f0f16751..eeeafc22cad 100644 --- a/scripts/eosio_build_centos.sh +++ b/scripts/eosio_build_centos.sh @@ -315,27 +315,27 @@ printf "\\n\\tExiting now.\\n\\n" exit 1; fi - STATUS=$(curl -LO -w '%{http_code}' --connect-timeout 30 https://dl.bintray.com/boostorg/release/1.67.0/source/boost_1_67_0.tar.bz2) + STATUS=$(curl -LO -w '%{http_code}' --connect-timeout 30 https://dl.bintray.com/boostorg/release/1.66.0/source/boost_1_66_0.tar.bz2) if [ "${STATUS}" -ne 200 ]; then printf "\\tUnable to download Boost libraries at this time.\\n" printf "\\n\\tExiting now.\\n\\n" exit 1; fi - if ! tar xf "${TEMP_DIR}/boost_1_67_0.tar.bz2" + if ! tar xf "${TEMP_DIR}/boost_1_66_0.tar.bz2" then - printf "\\n\\tUnable to unarchive file %s/boost_1_67_0.tar.bz2.\\n" "${TEMP_DIR}" + printf "\\n\\tUnable to unarchive file %s/boost_1_66_0.tar.bz2.\\n" "${TEMP_DIR}" printf "\\n\\tExiting now.\\n\\n" exit 1; fi - if ! rm -f "${TEMP_DIR}/boost_1_67_0.tar.bz2" + if ! rm -f "${TEMP_DIR}/boost_1_66_0.tar.bz2" then - printf "\\n\\tUnable to remove file %s/boost_1_67_0.tar.bz2.\\n" "${TEMP_DIR}" + printf "\\n\\tUnable to remove file %s/boost_1_66_0.tar.bz2.\\n" "${TEMP_DIR}" printf "\\n\\tExiting now.\\n\\n" exit 1; fi - if ! cd "${TEMP_DIR}/boost_1_67_0/" + if ! cd "${TEMP_DIR}/boost_1_66_0/" then - printf "\\n\\tUnable to enter directory %s/boost_1_67_0.\\n" "${TEMP_DIR}" + printf "\\n\\tUnable to enter directory %s/boost_1_66_0.\\n" "${TEMP_DIR}" printf "\\n\\tExiting now.\\n\\n" exit 1; fi @@ -351,15 +351,15 @@ printf "\\n\\tExiting now.\\n\\n" exit 1; fi - if ! rm -rf "${TEMP_DIR}/boost_1_67_0/" + if ! rm -rf "${TEMP_DIR}/boost_1_66_0/" then - printf "\\n\\tUnable to remove directory %s/boost_1_67_0.\\n" "${TEMP_DIR}" + printf "\\n\\tUnable to remove directory %s/boost_1_66_0.\\n" "${TEMP_DIR}" printf "\\n\\tExiting now.\\n\\n" exit 1; fi - printf "\\tBoost 1.67.0 successfully installed @ %s/opt/boost_1_67_0.\\n\\n" "${HOME}" + printf "\\tBoost 1.66.0 successfully installed @ %s/opt/boost_1_66_0.\\n\\n" "${HOME}" else - printf "\\tBoost 1.67.0 found at %s/opt/boost_1_67_0.\\n\\n" "${HOME}" + printf "\\tBoost 1.66.0 found at %s/opt/boost_1_66_0.\\n\\n" "${HOME}" fi printf "\\n\\tChecking MongoDB installation.\\n" diff --git a/scripts/eosio_build_darwin.sh b/scripts/eosio_build_darwin.sh index d2cb3ea71e4..c82d8cbb855 100644 --- a/scripts/eosio_build_darwin.sh +++ b/scripts/eosio_build_darwin.sh @@ -180,7 +180,7 @@ if [ "${BVERSION}" != "106700" ]; then if [ ! -z "${BVERSION}" ]; then printf "\\tFound Boost Version %s.\\n" "${BVERSION}" - printf "\\tEOS.IO requires Boost version 1.67.\\n" + printf "\\tEOS.IO requires Boost version 1.66.\\n" printf "\\tWould you like to uninstall version %s and install Boost version 1.67.\\n" "${BVERSION}" select yn in "Yes" "No"; do case $yn in diff --git a/scripts/eosio_build_fedora.sh b/scripts/eosio_build_fedora.sh index a24b49207f2..c8cecb61c27 100644 --- a/scripts/eosio_build_fedora.sh +++ b/scripts/eosio_build_fedora.sh @@ -158,7 +158,7 @@ printf "\\n\\tChecking boost library installation.\\n" BVERSION=$( grep "BOOST_LIB_VERSION" "${BOOST_ROOT}/include/boost/version.hpp" 2>/dev/null \ | tail -1 | tr -s ' ' | cut -d\ -f3 | sed 's/[^0-9\._]//gI' ) - if [ "${BVERSION}" != "1_67" ]; then + if [ "${BVERSION}" != "1_66" ]; then printf "\\tRemoving existing boost libraries in %s/opt/boost* .\\n" "${HOME}" if ! rm -rf "${HOME}/opt/boost*" then @@ -173,51 +173,51 @@ printf "\\tExiting now.\\n\\n" exit 1; fi - STATUS=$( curl -LO -w '%{http_code}' --connect-timeout 30 https://dl.bintray.com/boostorg/release/1.67.0/source/boost_1_67_0.tar.bz2 ) + STATUS=$( curl -LO -w '%{http_code}' --connect-timeout 30 https://dl.bintray.com/boostorg/release/1.66.0/source/boost_1_66_0.tar.bz2 ) if [ "${STATUS}" -ne 200 ]; then printf "\\tUnable to download Boost libraries at this time.\\n" printf "\\tExiting now.\\n\\n" exit 1; fi - if ! tar xf "${TEMP_DIR}/boost_1_67_0.tar.bz2" + if ! tar xf "${TEMP_DIR}/boost_1_66_0.tar.bz2" then - printf "\\n\\tUnable to unarchive file %s/boost_1_67_0.tar.bz2.\\n" "${TEMP_DIR}" + printf "\\n\\tUnable to unarchive file %s/boost_1_66_0.tar.bz2.\\n" "${TEMP_DIR}" printf "\\tExiting now.\\n\\n" exit 1; fi - if ! rm -f "${TEMP_DIR}/boost_1_67_0.tar.bz2" + if ! rm -f "${TEMP_DIR}/boost_1_66_0.tar.bz2" then - printf "\\n\\tUnable to remove file %s/boost_1_67_0.tar.bz2.\\n" "${TEMP_DIR}" + printf "\\n\\tUnable to remove file %s/boost_1_66_0.tar.bz2.\\n" "${TEMP_DIR}" printf "\\tExiting now.\\n\\n" exit 1; fi - if ! cd "${TEMP_DIR}/boost_1_67_0/" + if ! cd "${TEMP_DIR}/boost_1_66_0/" then - printf "\\n\\tUnable to enter directory %s/boost_1_67_0.\\n" "${TEMP_DIR}" + printf "\\n\\tUnable to enter directory %s/boost_1_66_0.\\n" "${TEMP_DIR}" printf "\\tExiting now.\\n\\n" exit 1; fi - if ! "${TEMP_DIR}/boost_1_67_0/bootstrap.sh" "--prefix=$BOOST_ROOT" + if ! "${TEMP_DIR}/boost_1_66_0/bootstrap.sh" "--prefix=$BOOST_ROOT" then printf "\\n\\tInstallation of boost libraries failed. 0\\n" printf "\\tExiting now.\\n\\n" exit 1; fi - if ! "${TEMP_DIR}/boost_1_67_0/b2" install + if ! "${TEMP_DIR}/boost_1_66_0/b2" install then printf "\\n\\tInstallation of boost libraries failed. 1\\n" printf "\\tExiting now.\\n\\n" exit 1; fi - if ! rm -rf "${TEMP_DIR}/boost_1_67_0" + if ! rm -rf "${TEMP_DIR}/boost_1_66_0" then - printf "\\n\\tUnable to remove directory %s/boost_1_67_0. 1\\n" "${TEMP_DIR}" + printf "\\n\\tUnable to remove directory %s/boost_1_66_0. 1\\n" "${TEMP_DIR}" printf "\\tExiting now.\\n\\n" exit 1; fi - printf "\\n\\tBoost 1.67.0 successfully installed at %s/opt/boost_1_67_0.\\n\\n" "${HOME}" + printf "\\n\\tBoost 1.66.0 successfully installed at %s/opt/boost_1_66_0.\\n\\n" "${HOME}" else - printf "\\tBoost 1.67.0 found at %s/opt/boost_1_67_0.\\n" "${HOME}" + printf "\\tBoost 1.66.0 found at %s/opt/boost_1_66_0.\\n" "${HOME}" fi printf "\\n\\tChecking MongoDB C++ driver installation.\\n"