diff --git a/CMakeLists.txt b/CMakeLists.txt index 57d29bc0f4d..7b8b286846b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -27,7 +27,7 @@ set( CXX_STANDARD_REQUIRED ON) set(VERSION_MAJOR 1) set(VERSION_MINOR 2) -set(VERSION_PATCH 4) +set(VERSION_PATCH 5) set( CLI_CLIENT_EXECUTABLE_NAME cleos ) set( NODE_EXECUTABLE_NAME nodeos ) diff --git a/Docker/README.md b/Docker/README.md index 50f0ec09268..82eee59c523 100644 --- a/Docker/README.md +++ b/Docker/README.md @@ -20,10 +20,10 @@ cd eos/Docker docker build . -t eosio/eos ``` -The above will build off the most recent commit to the master branch by default. If you would like to target a specific branch/tag, you may use a build argument. For example, if you wished to generate a docker image based off of the v1.2.4 tag, you could do the following: +The above will build off the most recent commit to the master branch by default. If you would like to target a specific branch/tag, you may use a build argument. For example, if you wished to generate a docker image based off of the v1.2.5 tag, you could do the following: ```bash -docker build -t eosio/eos:v1.2.4 --build-arg branch=v1.2.4 . +docker build -t eosio/eos:v1.2.5 --build-arg branch=v1.2.5 . ``` By default, the symbol in eosio.system is set to SYS. You can override this using the symbol argument while building the docker image. diff --git a/Docker/builder/Dockerfile b/Docker/builder/Dockerfile index 3eec3d9f601..ddb281099e7 100644 --- a/Docker/builder/Dockerfile +++ b/Docker/builder/Dockerfile @@ -50,12 +50,6 @@ RUN git clone --depth 1 --single-branch --branch release_40 https://github.com/l && cmake --build build --target install \ && cd .. && rm -rf llvm -RUN wget https://github.com/WebAssembly/binaryen/archive/1.37.21.tar.gz -O - | tar -xz \ - && cd binaryen-1.37.21 \ - && cmake -H. -Bbuild -GNinja -DCMAKE_BUILD_TYPE=Release \ - && cmake --build build --target install \ - && cd .. && rm -rf binaryen-1.37.21 - RUN git clone --depth 1 https://github.com/cryptonomex/secp256k1-zkp \ && cd secp256k1-zkp \ && ./autogen.sh \ @@ -69,11 +63,3 @@ RUN git clone --depth 1 -b releases/v3.3 https://github.com/mongodb/mongo-cxx-dr && make -j$(nproc) \ && make install \ && cd ../../ && rm -rf mongo-cxx-driver - -RUN git clone --depth 1 --single-branch --branch master https://github.com/ucb-bar/berkeley-softfloat-3.git \ - && cd berkeley-softfloat-3/build/Linux-x86_64-GCC \ - && make -j${nproc} SPECIALIZE_TYPE="8086-SSE" SOFTFLOAT_OPS="-DSOFTFLOAT_ROUND_EVEN -DINLINE_LEVEL=5 -DSOFTFLOAT_FAST_DIV32TO16 -DSOFTFLOAT_FAST_DIV64TO32" \ - && mkdir -p /opt/berkeley-softfloat-3 && cp softfloat.a /opt/berkeley-softfloat-3/libsoftfloat.a \ - && mv ../../source/include /opt/berkeley-softfloat-3/include && cd - && rm -rf berkeley-softfloat-3 - -ENV SOFTFLOAT_ROOT /opt/berkeley-softfloat-3 diff --git a/libraries/chain/controller.cpp b/libraries/chain/controller.cpp index 26d54d7da70..b6f461af984 100644 --- a/libraries/chain/controller.cpp +++ b/libraries/chain/controller.cpp @@ -1744,6 +1744,10 @@ void controller::drop_unapplied_transaction(const transaction_metadata_ptr& trx) my->unapplied_transactions.erase(trx->signed_id); } +void controller::drop_all_unapplied_transactions() { + my->unapplied_transactions.clear(); +} + vector controller::get_scheduled_transactions() const { const auto& idx = db().get_index(); diff --git a/libraries/chain/include/eosio/chain/controller.hpp b/libraries/chain/include/eosio/chain/controller.hpp index 21b9e5a6f9f..539072ad785 100644 --- a/libraries/chain/include/eosio/chain/controller.hpp +++ b/libraries/chain/include/eosio/chain/controller.hpp @@ -107,6 +107,7 @@ namespace eosio { namespace chain { */ vector get_unapplied_transactions() const; void drop_unapplied_transaction(const transaction_metadata_ptr& trx); + void drop_all_unapplied_transactions(); /** * These transaction IDs represent transactions available in the head chain state as scheduled diff --git a/libraries/chainbase b/libraries/chainbase index 315ef1b8f97..959cb4ddffe 160000 --- a/libraries/chainbase +++ b/libraries/chainbase @@ -1 +1 @@ -Subproject commit 315ef1b8f973667599fc599695a50cb14eafcf58 +Subproject commit 959cb4ddffe4316b8f6d7c1f9290400a52ae40c4 diff --git a/plugins/producer_plugin/producer_plugin.cpp b/plugins/producer_plugin/producer_plugin.cpp index 544d13a5d7a..da5d2ff0fb6 100644 --- a/plugins/producer_plugin/producer_plugin.cpp +++ b/plugins/producer_plugin/producer_plugin.cpp @@ -80,8 +80,6 @@ using transaction_id_with_expiry_index = multi_index_container< > >; - - enum class pending_block_mode { producing, speculating @@ -878,6 +876,13 @@ fc::time_point producer_plugin_impl::calculate_pending_block_time() const { return block_time; } +enum class tx_category { + PERSISTED, + UNEXPIRED_UNPERSISTED, + EXPIRED, +}; + + producer_plugin_impl::start_block_result producer_plugin_impl::start_block(bool &last_block) { chain::controller& chain = app().get_plugin().chain(); @@ -978,71 +983,66 @@ producer_plugin_impl::start_block_result producer_plugin_impl::start_block(bool try { size_t orig_pending_txn_size = _pending_incoming_transactions.size(); - if (!persisted_by_expiry.empty() || _pending_block_mode == pending_block_mode::producing) { - auto unapplied_trxs = chain.get_unapplied_transactions(); - - if (!persisted_by_expiry.empty()) { - for (auto itr = unapplied_trxs.begin(); itr != unapplied_trxs.end(); ++itr) { - const auto& trx = *itr; - if (persisted_by_id.find(trx->id) != persisted_by_id.end()) { - // this is a persisted transaction, push it into the block (even if we are speculating) with - // no deadline as it has already passed the subjective deadlines once and we want to represent - // the state of the chain including this transaction - try { - chain.push_transaction(trx, fc::time_point::maximum()); - } catch ( const guard_exception& e ) { - app().get_plugin().handle_guard_exception(e); - return start_block_result::failed; - } FC_LOG_AND_DROP(); - - // remove it from further consideration as it is applied - *itr = nullptr; - } - } - } - - if (_pending_block_mode == pending_block_mode::producing) { - for (const auto& trx : unapplied_trxs) { - if (block_time <= fc::time_point::now()) exhausted = true; - if (exhausted) { - break; - } + // Processing unapplied transactions... + // + if (_producers.empty() && persisted_by_id.empty()) { + // if this node can never produce and has no persisted transactions, + // there is no need for unapplied transactions they can be dropped + chain.drop_all_unapplied_transactions(); + } else { + std::vector apply_trxs; + { // derive appliable transactions from unapplied_transactions and drop droppable transactions + auto unapplied_trxs = chain.get_unapplied_transactions(); + apply_trxs.reserve(unapplied_trxs.size()); - if (!trx) { - // nulled in the loop above, skip it - continue; + auto calculate_transaction_category = [&](const transaction_metadata_ptr& trx) { + if (trx->packed_trx.expiration() < pbs->header.timestamp.to_time_point()) { + return tx_category::EXPIRED; + } else if (persisted_by_id.find(trx->id) != persisted_by_id.end()) { + return tx_category::PERSISTED; + } else { + return tx_category::UNEXPIRED_UNPERSISTED; } + }; - if (trx->packed_trx.expiration() < pbs->header.timestamp.to_time_point()) { - // expired, drop it + for (auto& trx: unapplied_trxs) { + auto category = calculate_transaction_category(trx); + if (category == tx_category::EXPIRED || (category == tx_category::UNEXPIRED_UNPERSISTED && _producers.empty())) { chain.drop_unapplied_transaction(trx); - continue; + } else if (category == tx_category::PERSISTED || (category == tx_category::UNEXPIRED_UNPERSISTED && _pending_block_mode == pending_block_mode::producing)) { + apply_trxs.emplace_back(std::move(trx)); } + } + } - try { - auto deadline = fc::time_point::now() + fc::milliseconds(_max_transaction_time_ms); - bool deadline_is_subjective = false; - if (_max_transaction_time_ms < 0 || (_pending_block_mode == pending_block_mode::producing && block_time < deadline)) { - deadline_is_subjective = true; - deadline = block_time; - } + for (const auto& trx: apply_trxs) { + if (block_time <= fc::time_point::now()) exhausted = true; + if (exhausted) { + break; + } - auto trace = chain.push_transaction(trx, deadline); - if (trace->except) { - if (failure_is_subjective(*trace->except, deadline_is_subjective)) { - exhausted = true; - } else { - // this failed our configured maximum transaction time, we don't want to replay it - chain.drop_unapplied_transaction(trx); - } + try { + auto deadline = fc::time_point::now() + fc::milliseconds(_max_transaction_time_ms); + bool deadline_is_subjective = false; + if (_max_transaction_time_ms < 0 || (_pending_block_mode == pending_block_mode::producing && block_time < deadline)) { + deadline_is_subjective = true; + deadline = block_time; + } + + auto trace = chain.push_transaction(trx, deadline); + if (trace->except) { + if (failure_is_subjective(*trace->except, deadline_is_subjective)) { + exhausted = true; + } else { + // this failed our configured maximum transaction time, we don't want to replay it + chain.drop_unapplied_transaction(trx); } - } catch ( const guard_exception& e ) { - app().get_plugin().handle_guard_exception(e); - return start_block_result::failed; - } FC_LOG_AND_DROP(); - } + } + } catch ( const guard_exception& e ) { + app().get_plugin().handle_guard_exception(e); + return start_block_result::failed; + } FC_LOG_AND_DROP(); } - } if (_pending_block_mode == pending_block_mode::producing) {