Skip to content

Commit

Permalink
Fix merge conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
jmjatlanta committed Aug 23, 2018
2 parents d370b3f + d382ac8 commit e02ad1f
Show file tree
Hide file tree
Showing 140 changed files with 17,180 additions and 2,234 deletions.
31 changes: 27 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
language: c++

cache: ccache

git:
depth: 1

Expand All @@ -10,9 +12,30 @@ sudo: true
install:
- echo "deb http://de.archive.ubuntu.com/ubuntu xenial main restricted universe multiverse" | sudo tee -a /etc/apt/sources.list
- sudo apt-get update
- sudo apt-get install --allow-unauthenticated g++ libboost-all-dev cmake libreadline-dev libssl-dev autoconf
- sudo apt-get install --allow-unauthenticated g++ libboost-all-dev cmake libreadline-dev libssl-dev autoconf parallel ccache

addons:
sonarcloud:
organization: "flwyiq7go36p6lipr64tbesy5jayad3q"
token:
secure: "Ik4xQhs9imtsFIC1SMAPmdLId9lVadY/4PEgo5tM4M5cQRvyt4xeuMMV+CRIT6tGEEqF71ea74qVJTxT7qinWZ3kmHliFjbqDxk1FbjCpK6NGQDyTdfWMVJFIlk7WefvtGAwFBkf6pSTs553bKNNM0HbBYQGKe08waLwv7R+lOmVjTTKIRF/cCVw+C5QQZdXFnUMTg+mRuUqGk4WvNNPmcBfkX0ekHPrXwAD5ATVS1q0iloA0nzHq8CPNmPE+IyXdPw0EBp+fl3cL9MgrlwRbELxrnCKFy+ObdjhDj7z3FDIxDe+03gVlgd+6Fame+9EJCeeeNLF4G4qNR1sLEvHRqVz12/NYnRU9hQL0c/jJtiUquOJA5+HqrhhB9XUZjS1xbHV3aIU5PR0bdDP6MKatvIVwRhwxwhaDXh7VSimis8eL+LvXT7EO+rGjco0c17RuzZpFCsKmXCej4Q8iDBMdOIWwe2WuWi8zb6MFvnLyK2EcM53hAn2yMwU+nprbpHwzU5oJTFZLD+J78zCSGk7uu7vsF+EEnheMwfqafP9MpMEXGXaXZiq7QKy3KvxQTg+1ozPIu+fgxvY0xdyrjJHOSJlrvXN7osjD4IDTs6D5cLAZ04WGIKsulZDr7ZN5n3gmA9h4cfhJsIEia0uQzLmWnfF6RksxWElK1i1+xmse7E="

env:
global:
- CCACHE_COMPRESS=exists_means_true
- CCACHE_MAXSIZE=1Gi
- CCACHE_SLOPPINESS=include_file_ctime,include_file_mtime,time_macros

script:
- cmake -DCMAKE_BUILD_TYPE=Debug -DBoost_USE_STATIC_LIBS=OFF .
- make -j 2

- 'echo $((`date +%s` - 120)) >_start_time'
- ccache -s
- '( [ `ccache -s | grep "files in cache" | cut -c 20-` = 0 ] && touch _empty_cache ) || true'
- sed -i '/tests/d' libraries/fc/CMakeLists.txt
- cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_FLAGS=--coverage -DCMAKE_CXX_FLAGS=--coverage -DBoost_USE_STATIC_LIBS=OFF -DCMAKE_CXX_OUTPUT_EXTENSION_REPLACE=ON .
- 'which build-wrapper-linux-x86-64 && build-wrapper-linux-x86-64 --out-dir bw-output make -j 2 cli_wallet witness_node chain_test cli_test || make -j 2 cli_wallet witness_node chain_test cli_test'
- set -o pipefail
- '[ -r _empty_cache ] || tests/chain_test 2>&1 | cat'
- '[ -r _empty_cache ] || tests/cli_test 2>&1 | cat'
- 'find libraries/[acdenptuw]*/CMakeFiles/*.dir programs/[cdgjsw]*/CMakeFiles/*.dir -type d | while read d; do gcov -o "$d" "${d/CMakeFiles*.dir//}"/*.cpp; done >/dev/null'
- '( [ -r _empty_cache -o $((`date +%s` - `cat _start_time`)) -gt $((42 * 60)) ] && echo "WARNING! Skipping sonar scanner due to time constraints!" ) || ( which sonar-scanner && sonar-scanner || true )'
- '[ ! -r _empty_cache ] || ( echo "Please restart with populated cache" && false )'
9 changes: 9 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ if (USE_PCH)
include (cotire)
endif(USE_PCH)

option(USE_PROFILER "Build with GPROF support(Linux)." OFF)

IF( NOT WIN32 )
list( APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/libraries/fc/CMakeModules" )
ENDIF( NOT WIN32 )
Expand Down Expand Up @@ -112,6 +114,9 @@ else( WIN32 ) # Apple AND Linux
# Linux Specific Options Here
message( STATUS "Configuring BitShares on Linux" )
set( CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -std=c++11 -Wall" )
if(USE_PROFILER)
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pg" )
endif( USE_PROFILER )
set( rt_library rt )
set( pthread_library pthread)
if ( NOT DEFINED crypto_library )
Expand Down Expand Up @@ -203,3 +208,7 @@ endif(LINUX)

include(CPack)
endif(ENABLE_INSTALLER)

MESSAGE( STATUS "" )
MESSAGE( STATUS "PROFILER: ${USE_PROFILER}" )
MESSAGE( STATUS "" )
9 changes: 6 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ RUN \
-DCMAKE_BUILD_TYPE=Release \
. && \
make witness_node cli_wallet && \
make install && \
install -s programs/witness_node/witness_node programs/cli_wallet/cli_wallet /usr/local/bin && \
#
# Obtain version
mkdir /etc/bitshares && \
Expand All @@ -60,12 +60,15 @@ VOLUME ["/var/lib/bitshares", "/etc/bitshares"]
# rpc service:
EXPOSE 8090
# p2p service:
EXPOSE 2001
EXPOSE 1776

# default exec/config files
ADD docker/default_config.ini /etc/bitshares/config.ini
ADD docker/bitsharesentry.sh /usr/local/bin/bitsharesentry.sh
RUN chmod a+x /usr/local/bin/bitsharesentry.sh

# Make Docker send SIGINT instead of SIGTERM to the daemon
STOPSIGNAL SIGINT

# default execute entry
CMD /usr/local/bin/bitsharesentry.sh
CMD ["/usr/local/bin/bitsharesentry.sh"]
2 changes: 1 addition & 1 deletion Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ PROJECT_NAME = "Bitshares-Core"
# could be handy for archiving the generated documentation or if some version
# control system is used.

PROJECT_NUMBER = "2.0.180202"
PROJECT_NUMBER = "2.0.180612"

# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
Expand Down
4 changes: 2 additions & 2 deletions README-docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ containers. This README serves as documentation.

The `Dockerfile` performs the following steps:

1. Obtain base image (phusion/baseimage:0.9.19)
1. Obtain base image (phusion/baseimage:0.10.1)
2. Install required dependencies using `apt-get`
3. Add bitshares-core source code into container
4. Update git submodules
Expand All @@ -16,7 +16,7 @@ The `Dockerfile` performs the following steps:
7. Purge source code off the container
8. Add a local bitshares user and set `$HOME` to `/var/lib/bitshares`
9. Make `/var/lib/bitshares` and `/etc/bitshares` a docker *volume*
10. Expose ports `8090` and `2001`
10. Expose ports `8090` and `1776`
11. Add default config from `docker/default_config.ini` and entry point script
12. Run entry point script by default

Expand Down
50 changes: 30 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,42 +20,48 @@ The web wallet is [BitShares UI](https://github.com/bitshares/bitshares-ui).

Visit [BitShares.org](https://bitshares.org/) to learn about BitShares and join the community at [BitSharesTalk.org](https://bitsharestalk.org/).

**NOTE:** The official BitShares git repository location, default branch, and submodule remotes were recently changed. Existing
repositories can be updated with the following steps:

git remote set-url origin https://github.com/bitshares/bitshares-core.git
git checkout master
git remote set-head origin --auto
git pull
git submodule sync --recursive
git submodule update --init --recursive

Getting Started
---------------
Build instructions and additional documentation are available in the
[wiki](https://github.com/bitshares/bitshares-core/wiki).

We recommend building on Ubuntu 16.04 LTS, and the build dependencies may be installed with:
We recommend building on Ubuntu 16.04 LTS (64-bit)

**Build Dependencies**:

sudo apt-get update
sudo apt-get install autoconf cmake git libboost-all-dev libssl-dev g++ libcurl4-openssl-dev
sudo apt-get install autoconf cmake make automake libtool git libboost-all-dev libssl-dev g++ libcurl4-openssl-dev

To build after all dependencies are installed:
**Build Script:**

git clone https://github.com/bitshares/bitshares-core.git
cd bitshares-core
git checkout <LATEST_RELEASE_TAG>
git checkout master # may substitute "master" with current release tag
git submodule update --init --recursive
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo .
make

**NOTE:** BitShares requires an [OpenSSL](https://www.openssl.org/) version in the 1.0.x series. OpenSSL 1.1.0 and newer are NOT supported. If your system OpenSSL version is newer, then you will need to manually provide an older version of OpenSSL and specify it to CMake using `-DOPENSSL_INCLUDE_DIR`, `-DOPENSSL_SSL_LIBRARY`, and `-DOPENSSL_CRYPTO_LIBRARY`.
**Upgrade Script** (prepend to the Build Script above if you built a prior release):

git remote set-url origin https://github.com/bitshares/bitshares-core.git
git checkout master
git remote set-head origin --auto
git pull
git submodule update --init --recursive # this command may fail
git submodule sync --recursive
git submodule update --init --recursive

**NOTE:** BitShares requires a [Boost](http://www.boost.org/) version in the range [1.57, 1.63]. Versions earlier than
1.57 or newer than 1.63 are NOT supported. If your system Boost version is newer, then you will need to manually build
**NOTE:** BitShares requires a [Boost](http://www.boost.org/) version in the range [1.57 - 1.65.1]. Versions earlier than
1.57 or newer than 1.65.1 are NOT supported. If your system's Boost version is newer, then you will need to manually build
an older version of Boost and specify it to CMake using `DBOOST_ROOT`.

After building, the witness node can be launched with:
**NOTE:** BitShares requires a 64-bit operating system to build, and will not build on a 32-bit OS.

**NOTE:** BitShares now supports Ubuntu 18.04 LTS

**NOTE:** BitShares now supports OpenSSL 1.1.0

**After Building**, the `witness_node` can be launched with:

./programs/witness_node/witness_node

Expand All @@ -65,8 +71,12 @@ the blockchain. After syncing, you can exit the node using Ctrl+C and setup the

rpc-endpoint = 127.0.0.1:8090

**NOTE:** By default the witness node will start in reduced memory ram mode by using some of the commands detailed in [Memory reduction for nodes](https://github.com/bitshares/bitshares-core/wiki/Memory-reduction-for-nodes).
In order to run a full node with all the account history you need to remove `partial-operations` and `max-ops-per-account` from your config file. Please note that currently(2017-12-23) a full node need 54GB of RAM to operate and required memory is growing fast.
**IMPORTANT:** By default the witness node will start in reduced memory ram mode by using some of the commands detailed in [Memory reduction for nodes](https://github.com/bitshares/bitshares-core/wiki/Memory-reduction-for-nodes).
In order to run a full node with all the account history you need to remove `partial-operations` and `max-ops-per-account` from your config file. Please note that currently(2018-07-02) a full node will need more than 100GB of RAM to operate and required memory is growing fast. Consider the following table before running a node:

| Default | Full | Minimal | ElasticSearch
| --- | --- | --- | ---
| 16G RAM | 120G RAM | 4G RAM | 500G SSD HD, 32G RAM

After starting the witness node again, in a separate terminal you can run:

Expand Down
4 changes: 2 additions & 2 deletions docker/bitsharesentry.sh
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ ln -f -s /etc/bitshares/config.ini /var/lib/bitshares
# Plugins need to be provided in a space-separated list, which
# makes it necessary to write it like this
if [[ ! -z "$BITSHARESD_PLUGINS" ]]; then
$BITSHARESD --data-dir ${HOME} ${ARGS} ${BITSHARESD_ARGS} --plugins "${BITSHARESD_PLUGINS}"
exec $BITSHARESD --data-dir ${HOME} ${ARGS} ${BITSHARESD_ARGS} --plugins "${BITSHARESD_PLUGINS}"
else
$BITSHARESD --data-dir ${HOME} ${ARGS} ${BITSHARESD_ARGS}
exec $BITSHARESD --data-dir ${HOME} ${ARGS} ${BITSHARESD_ARGS}
fi
2 changes: 1 addition & 1 deletion docker/default_config.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Endpoint for P2P node to listen on
p2p-endpoint = 0.0.0.0:9090
p2p-endpoint = 0.0.0.0:1776

# P2P nodes to connect to on startup (may specify multiple times)
# seed-node =
Expand Down
2 changes: 1 addition & 1 deletion docs
Submodule docs updated from bd792d to 73a4f9
2 changes: 1 addition & 1 deletion libraries/app/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ add_library( graphene_app
application.cpp
util.cpp
database_api.cpp
impacted.cpp
plugin.cpp
config_util.cpp
${HEADERS}
${EGENESIS_HEADERS}
)
Expand Down
28 changes: 18 additions & 10 deletions libraries/app/api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
#include <graphene/app/api.hpp>
#include <graphene/app/api_access.hpp>
#include <graphene/app/application.hpp>
#include <graphene/app/impacted.hpp>
#include <graphene/chain/database.hpp>
#include <graphene/chain/get_config.hpp>
#include <graphene/utilities/key_conversion.hpp>
Expand Down Expand Up @@ -309,7 +308,7 @@ namespace graphene { namespace app {
return result;
}

vector<operation_history_object> history_api::get_account_history( account_id_type account,
vector<operation_history_object> history_api::get_account_history( const std::string account_id_or_name,
operation_history_id_type stop,
unsigned limit,
operation_history_id_type start ) const
Expand All @@ -318,7 +317,9 @@ namespace graphene { namespace app {
const auto& db = *_app.chain_database();
FC_ASSERT( limit <= 100 );
vector<operation_history_object> result;
account_id_type account;
try {
account = database_api.get_account_id_from_string(account_id_or_name);
const account_transaction_history_object& node = account(db).statistics(db).most_recent_op(db);
if(start == operation_history_id_type() || start.instance.value > node.operation_id.instance.value)
start = node.operation_id;
Expand All @@ -342,7 +343,7 @@ namespace graphene { namespace app {
return result;
}

vector<operation_history_object> history_api::get_account_history_operations( account_id_type account,
vector<operation_history_object> history_api::get_account_history_operations( const std::string account_id_or_name,
int operation_id,
operation_history_id_type start,
operation_history_id_type stop,
Expand All @@ -352,6 +353,10 @@ namespace graphene { namespace app {
const auto& db = *_app.chain_database();
FC_ASSERT( limit <= 100 );
vector<operation_history_object> result;
account_id_type account;
try {
account = database_api.get_account_id_from_string(account_id_or_name);
} catch(...) { return result; }
const auto& stats = account(db).statistics(db);
if( stats.most_recent_op == account_transaction_history_id_type() ) return result;
const account_transaction_history_object* node = &stats.most_recent_op(db);
Expand All @@ -378,7 +383,7 @@ namespace graphene { namespace app {
}


vector<operation_history_object> history_api::get_relative_account_history( account_id_type account,
vector<operation_history_object> history_api::get_relative_account_history( const std::string account_id_or_name,
uint32_t stop,
unsigned limit,
uint32_t start) const
Expand All @@ -387,13 +392,16 @@ namespace graphene { namespace app {
const auto& db = *_app.chain_database();
FC_ASSERT(limit <= 100);
vector<operation_history_object> result;
account_id_type account;
try {
account = database_api.get_account_id_from_string(account_id_or_name);
} catch(...) { return result; }
const auto& stats = account(db).statistics(db);
if( start == 0 )
start = stats.total_ops;
else
start = min( stats.total_ops, start );


if( start >= stop && start > stats.removed_ops && limit > 0 )
{
const auto& hist_idx = db.get_index_type<account_transaction_history_index>();
Expand All @@ -419,12 +427,12 @@ namespace graphene { namespace app {
return hist->tracked_buckets();
}

history_operation_detail history_api::get_account_history_by_operations(account_id_type account, vector<uint16_t> operation_types, uint32_t start, unsigned limit)
history_operation_detail history_api::get_account_history_by_operations(const std::string account_id_or_name, vector<uint16_t> operation_types, uint32_t start, unsigned limit)
{
FC_ASSERT(limit <= 100);
history_operation_detail result;
vector<operation_history_object> objs = get_relative_account_history(account, start, limit, limit + start - 1);
std::for_each(objs.begin(), objs.end(), [&](const operation_history_object &o) {
FC_ASSERT(limit <= 100);
history_operation_detail result;
vector<operation_history_object> objs = get_relative_account_history(account_id_or_name, start, limit, limit + start - 1);
std::for_each(objs.begin(), objs.end(), [&](const operation_history_object &o) {
if (operation_types.empty() || find(operation_types.begin(), operation_types.end(), o.op.which()) != operation_types.end()) {
result.operation_history_objs.push_back(o);
}
Expand Down
16 changes: 12 additions & 4 deletions libraries/app/application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,10 @@ void application_impl::reset_p2p_node(const fc::path& data_dir)
"seed.cubeconnex.com:1777", // cube (USA)
"seed.roelandp.nl:1776", // roelandp (Canada)
"seed04.bts-nodes.net:1776", // Thom (Australia)
"seed05.bts-nodes.net:1776", // Thom (USA)
"seed06.bts-nodes.net:1776", // Thom (USA)
"seed07.bts-nodes.net:1776", // Thom (Singapore)
"seed05.bts-nodes.net:1776", // Thom (USA)
"seed06.bts-nodes.net:1776", // Thom (USA)
"seed07.bts-nodes.net:1776", // Thom (Singapore)
"seed.bts.bangzi.info:55501", // Bangzi (Germany)
"seeds.bitshares.eu:1776" // pc (http://seeds.quisquis.de/bitshares.html)
};
for( const string& endpoint_string : seeds )
Expand Down Expand Up @@ -384,6 +385,11 @@ void application_impl::startup()
}
_chain_db->add_checkpoints( loaded_checkpoints );

if( _options->count("enable-standby-votes-tracking") )
{
_chain_db->enable_standby_votes_tracking( _options->at("enable-standby-votes-tracking").as<bool>() );
}

if( _options->count("replay-blockchain") )
_chain_db->wipe( _data_dir / "blockchain", false );

Expand Down Expand Up @@ -435,7 +441,6 @@ void application_impl::startup()
wild_access.allowed_apis.push_back( "database_api" );
wild_access.allowed_apis.push_back( "network_broadcast_api" );
wild_access.allowed_apis.push_back( "history_api" );
wild_access.allowed_apis.push_back( "crypto_api" );
wild_access.allowed_apis.push_back( "orders_api" );
_apiaccess.permission_map["*"] = wild_access;
}
Expand Down Expand Up @@ -939,6 +944,9 @@ void application::set_program_options(boost::program_options::options_descriptio
("io-threads", bpo::value<uint16_t>()->implicit_value(0), "Number of IO threads, default to 0 for auto-configuration")
("enable-subscribe-to-all", bpo::value<bool>()->implicit_value(false),
"Whether allow API clients to subscribe to universal object creation and removal events")
("enable-standby-votes-tracking", bpo::value<bool>()->implicit_value(true),
"Whether to enable tracking of votes of standby witnesses and committee members. "
"Set it to true to provide accurate data to API clients, set to false for slightly better performance.")
;
command_line_options.add(configuration_file_options);
command_line_options.add_options()
Expand Down
Loading

0 comments on commit e02ad1f

Please sign in to comment.