Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Port v1.2.4 and v1.2.5 #5720

Merged
merged 39 commits into from
Sep 18, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
042a341
-full to delete directories with configs on uninstall
NorseGaud Aug 22, 2018
5353a8a
Added sudo check for build and install
NorseGaud Aug 22, 2018
0af151a
Update eosio_build.sh
NorseGaud Aug 24, 2018
312a295
Removed redundancy
NorseGaud Aug 24, 2018
3947e68
Apply all pending incoming transactions, even if not producing.
heifner Aug 29, 2018
9a56222
Merge pull request #5481 from EOSIO/gh#5447-hang
heifner Aug 30, 2018
37ac4fd
Trivial wallet directory locking for keosd
spoonincode Aug 29, 2018
8ede212
5523 fix abi serialization exception in get block
taokayan Sep 4, 2018
9cf65f7
4904 add hint if launcher fails, more reliable port available check
taokayan Sep 4, 2018
71d4b83
Merge pull request #5495 from EOSIO/trivial_wallet_dir_lock_12x
spoonincode Sep 4, 2018
0135a2f
Merge pull request #5525 from taokayan/testscript
heifner Sep 4, 2018
4c51fed
add unitest cases for chain_plugin get_block
taokayan Sep 5, 2018
4c93f42
Merge pull request #5383 from NorseGaud/master
heifner Sep 5, 2018
47804e4
(chainbase sync) Fix chainbase's mlock() to work on subsequent launches
spoonincode Sep 5, 2018
d7ac9aa
Merge pull request #5546 from EOSIO/12x_chainbase_mlock
heifner Sep 5, 2018
914341d
Merge branch 'blk_abi' of https://github.com/taokayan/eos into taokay…
heifner Sep 5, 2018
be0c2be
fix ambiguous command line option for filter-on/out
spoonincode Sep 5, 2018
b727733
Move chain_plugin_tests from unittests to tests
heifner Sep 5, 2018
9c81c86
Merge pull request #5548 from EOSIO/taokayan-blk_abi
heifner Sep 5, 2018
2a41a4a
Merge pull request #5547 from EOSIO/filter_onoff_opt_fix
b1bart Sep 5, 2018
bafec79
bump version to 1.2.4
b1bart Sep 5, 2018
0e8dd01
Merge pull request #5549 from EOSIO/feature/bump-version-to-1.2.4
b1bart Sep 5, 2018
cc9decf
Merge pull request #5550 from EOSIO/release/1.2.x
b1bart Sep 5, 2018
71248bb
Remove unneeded libs from docker build
spoonincode Sep 6, 2018
45deb95
Fix unchecked unapplied transaction growth on relays
b1bart Sep 11, 2018
653b0c0
controller already held the invariant that READ_ONLY nodes would have…
b1bart Sep 11, 2018
587d9c6
simplify out the lazy fetch of unapplied transactions as once all cas…
b1bart Sep 11, 2018
fa33444
clean up error maintaining vector
b1bart Sep 11, 2018
5edcd93
(chainbase sync) Remove chainbase mlock()
spoonincode Sep 11, 2018
ab8278b
refactor for cleanliness and deduplication of code
b1bart Sep 11, 2018
80e400d
refactor for clarity and less data manipulation
b1bart Sep 11, 2018
9edfe9a
change enum to class
b1bart Sep 11, 2018
e4958d9
Merge pull request #5559 from EOSIO/unused_docker_libs
b1bart Sep 11, 2018
00b0d93
Merge pull request #5618 from EOSIO/remove_mlock
b1bart Sep 11, 2018
85e9524
bump version to 1.2.5
b1bart Sep 11, 2018
56e858b
Merge pull request #5617 from EOSIO/feature/fix-unapplied-trx-leak
b1bart Sep 11, 2018
d9e874e
Merge pull request #5621 from EOSIO/feature/bump-version-to-1.2.5
b1bart Sep 11, 2018
08819aa
Merge pull request #5622 from EOSIO/release/1.2.x
b1bart Sep 11, 2018
2516366
Merge tag 'v1.2.5' into port/v1.2.4-and-v1.2.5
b1bart Sep 18, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ set( CXX_STANDARD_REQUIRED ON)

set(VERSION_MAJOR 1)
set(VERSION_MINOR 2)
set(VERSION_PATCH 3)
set(VERSION_PATCH 5)

set( CLI_CLIENT_EXECUTABLE_NAME cleos )
set( NODE_EXECUTABLE_NAME nodeos )
Expand Down
4 changes: 2 additions & 2 deletions Docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.3 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.3 --build-arg branch=v1.2.3 .
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.
Expand Down
14 changes: 0 additions & 14 deletions Docker/builder/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -50,23 +50,9 @@ 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 -b releases/v3.3 https://github.com/mongodb/mongo-cxx-driver \
&& cd mongo-cxx-driver/build \
&& cmake -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local .. \
&& 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
6 changes: 5 additions & 1 deletion eosio_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@
#
# https://github.com/EOSIO/eos/blob/master/LICENSE.txt
##########################################################################


if [ "$(id -u)" -ne 0 ]; then
printf "\n\tThis requires sudo. Please run with sudo.\n\n"
exit -1
fi

CWD="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
if [ "${CWD}" != "${PWD}" ]; then
Expand Down
7 changes: 6 additions & 1 deletion eosio_uninstall.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,14 @@ if [ -d "/usr/local/eosio" ]; then
for binary in ${binaries[@]}; do
rm ${binary}
done
# Handle cleanup of directories created from installation
if [ "$1" == "--full" ]; then
if [ -d ~/Library/Application\ Support/eosio ]; then rm -rf ~/Library/Application\ Support/eosio; fi # Mac OS
if [ -d ~/.local/share/eosio ]; then rm -rf ~/.local/share/eosio; fi # Linux
fi
popd &> /dev/null
break;;
[Nn]* )
[Nn]* )
printf "\tAborting uninstall\n\n"
exit -1;;
esac
Expand Down
4 changes: 4 additions & 0 deletions libraries/chain/controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1768,6 +1768,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<transaction_id_type> controller::get_scheduled_transactions() const {
const auto& idx = db().get_index<generated_transaction_multi_index,by_delay>();

Expand Down
24 changes: 14 additions & 10 deletions libraries/chain/include/eosio/chain/abi_serializer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -288,21 +288,25 @@ namespace impl {
mvo("name", act.name);
mvo("authorization", act.authorization);

auto abi = resolver(act.account);
if (abi.valid()) {
auto type = abi->get_action_type(act.name);
if (!type.empty()) {
try {
mvo( "data", abi->_binary_to_variant( type, act.data, recursion_depth, deadline, max_serialization_time ));
mvo("hex_data", act.data);
} catch(...) {
// any failure to serialize data, then leave as not serailzed
try {
auto abi = resolver(act.account);
if (abi.valid()) {
auto type = abi->get_action_type(act.name);
if (!type.empty()) {
try {
mvo( "data", abi->_binary_to_variant( type, act.data, recursion_depth, deadline, max_serialization_time ));
mvo("hex_data", act.data);
} catch(...) {
// any failure to serialize data, then leave as not serailzed
mvo("data", act.data);
}
} else {
mvo("data", act.data);
}
} else {
mvo("data", act.data);
}
} else {
} catch(...) {
mvo("data", act.data);
}
out(name, std::move(mvo));
Expand Down
1 change: 1 addition & 0 deletions libraries/chain/include/eosio/chain/controller.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ namespace eosio { namespace chain {
*/
vector<transaction_metadata_ptr> 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
Expand Down
2 changes: 1 addition & 1 deletion plugins/history_plugin/history_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ namespace eosio {
"Track actions which match receiver:action:actor. Actor may be blank to include all. Action and Actor both blank allows all from Recieiver. Receiver may not be blank.")
;
cfg.add_options()
("filter-out,f", bpo::value<vector<string>>()->composing(),
("filter-out,F", bpo::value<vector<string>>()->composing(),
"Do not track actions which match receiver:action:actor. Action and Actor both blank excludes all from Reciever. Actor blank excludes all from reciever:action. Receiver may not be blank.")
;
}
Expand Down
118 changes: 59 additions & 59 deletions plugins/producer_plugin/producer_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,6 @@ using transaction_id_with_expiry_index = multi_index_container<
>
>;



enum class pending_block_mode {
producing,
speculating
Expand Down Expand Up @@ -885,6 +883,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_plugin>().chain();

Expand Down Expand Up @@ -985,71 +990,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<chain_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<transaction_metadata_ptr> 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<chain_plugin>().handle_guard_exception(e);
return start_block_result::failed;
} FC_LOG_AND_DROP();
}
}
} catch ( const guard_exception& e ) {
app().get_plugin<chain_plugin>().handle_guard_exception(e);
return start_block_result::failed;
} FC_LOG_AND_DROP();
}

}

if (_pending_block_mode == pending_block_mode::producing) {
Expand Down Expand Up @@ -1119,7 +1119,7 @@ producer_plugin_impl::start_block_result producer_plugin_impl::start_block(bool
} else {
// attempt to apply any pending incoming transactions
_incoming_trx_weight = 0.0;
if (orig_pending_txn_size && _pending_incoming_transactions.size()) {
while (orig_pending_txn_size && _pending_incoming_transactions.size()) {
auto e = _pending_incoming_transactions.front();
_pending_incoming_transactions.pop_front();
--orig_pending_txn_size;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <eosio/chain/transaction.hpp>
#include <eosio/wallet_plugin/wallet_api.hpp>
#include <boost/filesystem/path.hpp>
#include <boost/interprocess/sync/file_lock.hpp>
#include <chrono>

namespace fc { class variant; }
Expand All @@ -24,11 +25,14 @@ class wallet_manager {
wallet_manager(wallet_manager&&) = delete;
wallet_manager& operator=(const wallet_manager&) = delete;
wallet_manager& operator=(wallet_manager&&) = delete;
~wallet_manager() = default;
~wallet_manager();

/// Set the path for location of wallet files.
/// @param p path to override default ./ location of wallet files.
void set_dir(const boost::filesystem::path& p) { dir = p; }
void set_dir(const boost::filesystem::path& p) {
dir = p;
initialize_lock();
}

/// Set the timeout for locking all wallets.
/// If set then after t seconds of inactivity then lock_all().
Expand Down Expand Up @@ -135,6 +139,10 @@ class wallet_manager {
std::chrono::seconds timeout = std::chrono::seconds::max(); ///< how long to wait before calling lock_all()
mutable timepoint_t timeout_time = timepoint_t::max(); ///< when to call lock_all()
boost::filesystem::path dir = ".";
boost::filesystem::path lock_path = dir / "wallet.lock";
std::unique_ptr<boost::interprocess::file_lock> wallet_dir_lock;

void initialize_lock();
};

} // namespace wallet
Expand Down
21 changes: 21 additions & 0 deletions plugins/wallet_plugin/wallet_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ wallet_manager::wallet_manager() {
#endif
}

wallet_manager::~wallet_manager() {
//not really required, but may spook users
if(wallet_dir_lock)
boost::filesystem::remove(lock_path);
}

void wallet_manager::set_timeout(const std::chrono::seconds& t) {
timeout = t;
auto now = std::chrono::system_clock::now();
Expand Down Expand Up @@ -269,5 +275,20 @@ void wallet_manager::own_and_use_wallet(const string& name, std::unique_ptr<wall
wallets.emplace(name, std::move(wallet));
}

void wallet_manager::initialize_lock() {
//This is technically somewhat racy in here -- if multiple keosd are in this function at once.
//I've considered that an acceptable tradeoff to maintain cross-platform boost constructs here
lock_path = dir / "wallet.lock";
{
std::ofstream x(lock_path.string());
EOS_ASSERT(!x.fail(), wallet_exception, "Failed to open wallet lock file at ${f}", ("f", lock_path.string()));
}
wallet_dir_lock = std::make_unique<boost::interprocess::file_lock>(lock_path.string().c_str());
if(!wallet_dir_lock->try_lock()) {
wallet_dir_lock.reset();
EOS_THROW(wallet_exception, "Failed to lock access to wallet directory; is another keosd running?");
}
}

} // namespace wallet
} // namespace eosio
2 changes: 1 addition & 1 deletion programs/eosio-launcher/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,7 @@ launcher_def::initialize (const variables_map &vmap) {

stage = bfs::path(erd);
if (!bfs::exists(stage)) {
cerr << erd << " is not a valid path" << endl;
cerr << "\"" << erd << "\" is not a valid path. Please ensure environment variable EOSIO_HOME is set to the build path." << endl;
exit (-1);
}
stage /= bfs::path("staging");
Expand Down
6 changes: 4 additions & 2 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@ include_directories("${CMAKE_SOURCE_DIR}/plugins/wallet_plugin/include")

file(GLOB UNIT_TESTS "*.cpp")

add_executable( plugin_test ${UNIT_TESTS} ${WASM_UNIT_TESTS} main.cpp)
add_executable( plugin_test ${UNIT_TESTS} ${WASM_UNIT_TESTS} )
target_link_libraries( plugin_test eosio_testing eosio_chain chainbase eos_utilities chain_plugin wallet_plugin abi_generator fc ${PLATFORM_SPECIFIC_LIBS} )

target_include_directories( plugin_test PUBLIC ${CMAKE_SOURCE_DIR}/plugins/net_plugin/include )
target_include_directories( plugin_test PUBLIC
${CMAKE_SOURCE_DIR}/plugins/net_plugin/include
${CMAKE_SOURCE_DIR}/plugins/chain_plugin/include )
add_dependencies(plugin_test asserter test_api test_api_mem test_api_db test_api_multi_index proxy identity identity_test stltest infinite eosio.system eosio.token eosio.bios test.inline multi_index_test noop dice eosio.msig)

#
Expand Down
Loading