Skip to content

Commit

Permalink
Merge pull request #1843 from bitshares/release
Browse files Browse the repository at this point in the history
merge release to master for 3.2.0
  • Loading branch information
oxarbitrage authored Jul 16, 2019
2 parents e3d1226 + 89fdcae commit e8567d0
Show file tree
Hide file tree
Showing 224 changed files with 4,552 additions and 2,741 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Set the default behavior of genesis.json, in case core.autocrlf is set incorrectly
genesis.json eol=lf
17 changes: 7 additions & 10 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,14 @@ script:
- ccache -s
- programs/build_helpers/buildstep Prepare 1 "sed -i '/tests/d' libraries/fc/CMakeLists.txt"
- programs/build_helpers/buildstep cmake 5 "cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_FLAGS=--coverage -DCMAKE_CXX_FLAGS=--coverage -DBoost_USE_STATIC_LIBS=OFF -DCMAKE_CXX_OUTPUT_EXTENSION_REPLACE=ON ."
- programs/build_helpers/buildstep make.cli_wallet 1600 "programs/build_helpers/make_with_sonar bw-output -j 2 cli_wallet"
- programs/build_helpers/buildstep make.witness_node 300 "programs/build_helpers/make_with_sonar bw-output -j 2 witness_node"
- programs/build_helpers/buildstep make.serializer 45 "programs/build_helpers/make_with_sonar bw-output -j 2 js_operation_serializer"
- programs/build_helpers/buildstep make.get_dev_key 10 "programs/build_helpers/make_with_sonar bw-output -j 2 get_dev_key"
- programs/build_helpers/buildstep make.chain_test 900 "programs/build_helpers/make_with_sonar bw-output -j 2 chain_test"
- programs/build_helpers/buildstep make.cli_test 200 "programs/build_helpers/make_with_sonar bw-output -j 2 cli_test"
- programs/build_helpers/buildstep make.perf_test 120 "programs/build_helpers/make_with_sonar bw-output -j 2 performance_test"
- programs/build_helpers/buildstep make.cli_wallet 2200 "programs/build_helpers/make_with_sonar bw-output -j 2 cli_wallet witness_node js_operation_serializer get_dev_key network_mapper"
- programs/build_helpers/buildstep make.chain_test 1000 "make -j 2 chain_test"
- programs/build_helpers/buildstep make.cli_test 200 "make -j 2 cli_test"
- programs/build_helpers/buildstep make.perf_test 120 "make -j 2 performance_test"
- set -o pipefail
- programs/build_helpers/buildstep run.chain_test 240 "libraries/fc/tests/run-parallel-tests.sh tests/chain_test"
- programs/build_helpers/buildstep run.cli_test 30 "libraries/fc/tests/run-parallel-tests.sh tests/cli_test"
- programs/build_helpers/buildstep prepare.sonar 20 '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'
- programs/build_helpers/buildstep run.sonar 400 "which sonar-scanner && sonar-scanner || true"
- programs/build_helpers/buildstep run.cli_test 60 "libraries/fc/tests/run-parallel-tests.sh tests/cli_test"
- 'programs/build_helpers/buildstep prepare.sonar 20 "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; programs/build_helpers/set_sonar_branch sonar-project.properties" || true'
- 'programs/build_helpers/buildstep run.sonar 1200 "which sonar-scanner && sonar-scanner" || true'
- programs/build_helpers/buildstep end 0
- ccache -s
11 changes: 8 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Defines BitShares library target.
project( BitShares )
cmake_minimum_required( VERSION 2.8.12 )
cmake_minimum_required( VERSION 3.1 )

set( BLOCKCHAIN_NAME "BitShares" )

Expand All @@ -9,6 +9,10 @@ set( GUI_CLIENT_EXECUTABLE_NAME BitShares )
set( CUSTOM_URL_SCHEME "gcs" )
set( INSTALLER_APP_ID "68ad7005-8eee-49c9-95ce-9eed97e5b347" )

set( CMAKE_CXX_STANDARD 14 )
set( CMAKE_CXX_STANDARD_REQUIRED ON )
set( CMAKE_CXX_EXTENSIONS OFF )

# http://stackoverflow.com/a/18369825
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8)
Expand Down Expand Up @@ -51,6 +55,7 @@ LIST(APPEND BOOST_COMPONENTS thread
chrono
unit_test_framework
context)
# boost::endian is also required, but FindBoost can't handle header-only libs
SET( Boost_USE_STATIC_LIBS ON CACHE STRING "ON or OFF" )

IF( WIN32 )
Expand Down Expand Up @@ -109,11 +114,11 @@ else( WIN32 ) # Apple AND Linux
if( APPLE )
# Apple Specific Options Here
message( STATUS "Configuring BitShares on OS X" )
set( CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -std=c++11 -stdlib=libc++ -Wall" )
set( CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -stdlib=libc++ -Wall" )
else( APPLE )
# Linux Specific Options Here
message( STATUS "Configuring BitShares on Linux" )
set( CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -std=c++11 -Wall" )
set( CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -Wall" )
if(USE_PROFILER)
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pg" )
endif( USE_PROFILER )
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM phusion/baseimage:0.10.1
FROM phusion/baseimage:0.11
MAINTAINER The bitshares decentralized organisation

ENV LANG=en_US.UTF-8
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ We recommend building on Ubuntu 16.04 LTS (64-bit)
git submodule sync --recursive
git submodule update --init --recursive

**NOTE:** Versions of [Boost](http://www.boost.org/) 1.57 through 1.69 are supported. Newer versions may work, but
**NOTE:** Versions of [Boost](http://www.boost.org/) 1.58 through 1.69 are supported. Newer versions may work, but
have not been tested. If your system came pre-installed with a version of Boost that you do not wish to use, you may
manually build your preferred version and use it with BitShares by specifying it on the CMake command line.

Expand Down
5 changes: 5 additions & 0 deletions docker/bitsharesentry.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ VERSION=`cat /etc/bitshares/version`
# * $BITSHARESD_PARTIAL_OPERATIONS
# * $BITSHARESD_MAX_OPS_PER_ACCOUNT
# * $BITSHARESD_ES_NODE_URL
# * $BITSHARESD_ES_START_AFTER_BLOCK
# * $BITSHARESD_TRUSTED_NODE
#

Expand Down Expand Up @@ -70,6 +71,10 @@ if [[ ! -z "$BITSHARESD_ES_NODE_URL" ]]; then
ARGS+=" --elasticsearch-node-url=${BITSHARESD_ES_NODE_URL}"
fi

if [[ ! -z "$BITSHARESD_ES_START_AFTER_BLOCK" ]]; then
ARGS+=" --elasticsearch-start-es-after-block=${BITSHARESD_ES_START_AFTER_BLOCK}"
fi

if [[ ! -z "$BITSHARESD_TRUSTED_NODE" ]]; then
ARGS+=" --trusted-node=${BITSHARESD_TRUSTED_NODE}"
fi
Expand Down
2 changes: 1 addition & 1 deletion docker/default_config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ rpc-endpoint = 0.0.0.0:8090
enable-stale-production = false

# Percent of witnesses (0-99) that must be participating in order to produce blocks
required-participation = false
# required-participation = 33

# ID of witness controlled by this node (e.g. "1.6.5", quotes are required, may specify multiple times)
# witness-id =
Expand Down
2 changes: 1 addition & 1 deletion docs
Submodule docs updated from 0271e7 to 3d7152
1 change: 1 addition & 0 deletions libraries/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ add_subdirectory( utilities )
add_subdirectory( app )
add_subdirectory( plugins )
add_subdirectory( wallet )
add_subdirectory( protocol )
114 changes: 63 additions & 51 deletions libraries/app/api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,28 @@
#include <graphene/chain/database.hpp>
#include <graphene/chain/get_config.hpp>
#include <graphene/utilities/key_conversion.hpp>
#include <graphene/chain/protocol/fee_schedule.hpp>
#include <graphene/protocol/fee_schedule.hpp>
#include <graphene/chain/confidential_object.hpp>
#include <graphene/chain/market_object.hpp>
#include <graphene/chain/transaction_object.hpp>
#include <graphene/chain/transaction_history_object.hpp>
#include <graphene/chain/withdraw_permission_object.hpp>
#include <graphene/chain/worker_object.hpp>

#include <fc/crypto/hex.hpp>
#include <fc/rpc/api_connection.hpp>
#include <fc/thread/future.hpp>

template class fc::api<graphene::app::block_api>;
template class fc::api<graphene::app::network_broadcast_api>;
template class fc::api<graphene::app::network_node_api>;
template class fc::api<graphene::app::history_api>;
template class fc::api<graphene::app::crypto_api>;
template class fc::api<graphene::app::asset_api>;
template class fc::api<graphene::app::orders_api>;
template class fc::api<graphene::debug_witness::debug_api>;
template class fc::api<graphene::app::login_api>;


namespace graphene { namespace app {

login_api::login_api(application& a)
Expand Down Expand Up @@ -405,7 +417,7 @@ namespace graphene { namespace app {
if( start == 0 )
start = stats.total_ops;
else
start = min( stats.total_ops, start );
start = std::min( stats.total_ops, start );

if( start >= stop && start > stats.removed_ops && limit > 0 )
{
Expand Down Expand Up @@ -534,79 +546,79 @@ namespace graphene { namespace app {

// asset_api
asset_api::asset_api(graphene::app::application& app) :
_app(app),
_db( *app.chain_database()),
database_api( std::ref(*app.chain_database()), &(app.get_options())
) { }
_app(app),
_db( *app.chain_database()),
database_api( std::ref(*app.chain_database()), &(app.get_options())
) { }
asset_api::~asset_api() { }

vector<account_asset_balance> asset_api::get_asset_holders( std::string asset, uint32_t start, uint32_t limit ) const {
uint64_t api_limit_get_asset_holders=_app.get_options().api_limit_get_asset_holders;
FC_ASSERT(limit <= api_limit_get_asset_holders);
asset_id_type asset_id = database_api.get_asset_id_from_string( asset );
const auto& bal_idx = _db.get_index_type< account_balance_index >().indices().get< by_asset_balance >();
auto range = bal_idx.equal_range( boost::make_tuple( asset_id ) );
uint64_t api_limit_get_asset_holders=_app.get_options().api_limit_get_asset_holders;
FC_ASSERT(limit <= api_limit_get_asset_holders);
asset_id_type asset_id = database_api.get_asset_id_from_string( asset );
const auto& bal_idx = _db.get_index_type< account_balance_index >().indices().get< by_asset_balance >();
auto range = bal_idx.equal_range( boost::make_tuple( asset_id ) );

vector<account_asset_balance> result;
vector<account_asset_balance> result;

uint32_t index = 0;
for( const account_balance_object& bal : boost::make_iterator_range( range.first, range.second ) )
{
if( result.size() >= limit )
break;
uint32_t index = 0;
for( const account_balance_object& bal : boost::make_iterator_range( range.first, range.second ) )
{
if( result.size() >= limit )
break;

if( bal.balance.value == 0 )
continue;
if( bal.balance.value == 0 )
continue;

if( index++ < start )
continue;
if( index++ < start )
continue;

const auto account = _db.find(bal.owner);
const auto account = _db.find(bal.owner);

account_asset_balance aab;
aab.name = account->name;
aab.account_id = account->id;
aab.amount = bal.balance.value;
account_asset_balance aab;
aab.name = account->name;
aab.account_id = account->id;
aab.amount = bal.balance.value;

result.push_back(aab);
}
result.push_back(aab);
}

return result;
return result;
}
// get number of asset holders.
int asset_api::get_asset_holders_count( std::string asset ) const {
const auto& bal_idx = _db.get_index_type< account_balance_index >().indices().get< by_asset_balance >();
asset_id_type asset_id = database_api.get_asset_id_from_string( asset );
auto range = bal_idx.equal_range( boost::make_tuple( asset_id ) );
const auto& bal_idx = _db.get_index_type< account_balance_index >().indices().get< by_asset_balance >();
asset_id_type asset_id = database_api.get_asset_id_from_string( asset );
auto range = bal_idx.equal_range( boost::make_tuple( asset_id ) );

int count = boost::distance(range) - 1;
int count = boost::distance(range) - 1;

return count;
return count;
}
// function to get vector of system assets with holders count.
vector<asset_holders> asset_api::get_all_asset_holders() const {
vector<asset_holders> result;
vector<asset_id_type> total_assets;
for( const asset_object& asset_obj : _db.get_index_type<asset_index>().indices() )
{
const auto& dasset_obj = asset_obj.dynamic_asset_data_id(_db);
vector<asset_holders> result;
vector<asset_id_type> total_assets;
for( const asset_object& asset_obj : _db.get_index_type<asset_index>().indices() )
{
const auto& dasset_obj = asset_obj.dynamic_asset_data_id(_db);

asset_id_type asset_id;
asset_id = dasset_obj.id;
asset_id_type asset_id;
asset_id = dasset_obj.id;

const auto& bal_idx = _db.get_index_type< account_balance_index >().indices().get< by_asset_balance >();
auto range = bal_idx.equal_range( boost::make_tuple( asset_id ) );
const auto& bal_idx = _db.get_index_type< account_balance_index >().indices().get< by_asset_balance >();
auto range = bal_idx.equal_range( boost::make_tuple( asset_id ) );

int count = boost::distance(range) - 1;
int count = boost::distance(range) - 1;

asset_holders ah;
ah.asset_id = asset_id;
ah.count = count;
asset_holders ah;
ah.asset_id = asset_id;
ah.count = count;

result.push_back(ah);
}
result.push_back(ah);
}

return result;
return result;
}

// orders_api
Expand Down
53 changes: 45 additions & 8 deletions libraries/app/application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@

#include <graphene/chain/db_with.hpp>
#include <graphene/chain/genesis_state.hpp>
#include <graphene/chain/protocol/fee_schedule.hpp>
#include <graphene/chain/protocol/types.hpp>
#include <graphene/protocol/fee_schedule.hpp>
#include <graphene/protocol/types.hpp>

#include <graphene/egenesis/egenesis.hpp>

Expand Down Expand Up @@ -246,7 +246,7 @@ std::vector<fc::ip::endpoint> application_impl::resolve_string_to_ip_endpoints(c

void application_impl::new_connection( const fc::http::websocket_connection_ptr& c )
{
auto wsc = std::make_shared<fc::rpc::websocket_api_connection>(*c, GRAPHENE_NET_MAX_NESTED_OBJECTS);
auto wsc = std::make_shared<fc::rpc::websocket_api_connection>(c, GRAPHENE_NET_MAX_NESTED_OBJECTS);
auto login = std::make_shared<graphene::app::login_api>( std::ref(*_self) );
login->enable_api("database_api");

Expand Down Expand Up @@ -337,12 +337,33 @@ void application_impl::set_api_limit() {
if(_options->count("api-limit-get-asset-holders")){
_app_options.api_limit_get_asset_holders = _options->at("api-limit-get-asset-holders").as<uint64_t>();
}
if(_options->count("api-limit-get-key-references")){
_app_options.api_limit_get_key_references = _options->at("api-limit-get-key-references").as<uint64_t>();
}
if(_options->count("api-limit-get-key-references")){
_app_options.api_limit_get_key_references = _options->at("api-limit-get-key-references").as<uint64_t>();
}
if(_options->count("api-limit-get-htlc-by")) {
_app_options.api_limit_get_htlc_by = _options->at("api-limit-get-htlc-by").as<uint64_t>();
}
if(_options->count("api-limit-get-full-accounts")) {
_app_options.api_limit_get_full_accounts = _options->at("api-limit-get-full-accounts").as<uint64_t>();
}
if(_options->count("api-limit-get-full-accounts-lists")) {
_app_options.api_limit_get_full_accounts_lists = _options->at("api-limit-get-full-accounts-lists").as<uint64_t>();
}
if(_options->count("api-limit-get-call-orders")) {
_app_options.api_limit_get_call_orders = _options->at("api-limit-get-call-orders").as<uint64_t>();
}
if(_options->count("api-limit-get-settle-orders")) {
_app_options.api_limit_get_settle_orders = _options->at("api-limit-get-settle-orders").as<uint64_t>();
}
if(_options->count("api-limit-get-assets")) {
_app_options.api_limit_get_assets = _options->at("api-limit-get-assets").as<uint64_t>();
}
if(_options->count("api-limit-get-limit-orders")){
_app_options.api_limit_get_limit_orders = _options->at("api-limit-get-limit-orders").as<uint64_t>();
}
if(_options->count("api-limit-get-order-book")){
_app_options.api_limit_get_order_book = _options->at("api-limit-get-order-book").as<uint64_t>();
}
}

void application_impl::startup()
Expand Down Expand Up @@ -1018,8 +1039,24 @@ void application::set_program_options(boost::program_options::options_descriptio
"For history_api::get_account_history_by_operations to set its default limit value as 100")
("api-limit-get-asset-holders",boost::program_options::value<uint64_t>()->default_value(100),
"For asset_api::get_asset_holders to set its default limit value as 100")
("api-limit-get-key-references",boost::program_options::value<uint64_t>()->default_value(100),
"For database_api_impl::get_key_references to set its default limit value as 100")
("api-limit-get-key-references",boost::program_options::value<uint64_t>()->default_value(100),
"For database_api_impl::get_key_references to set its default limit value as 100")
("api-limit-get-htlc-by",boost::program_options::value<uint64_t>()->default_value(100),
"For database_api_impl::get_htlc_by_from and get_htlc_by_to to set its default limit value as 100")
("api-limit-get-full-accounts",boost::program_options::value<uint64_t>()->default_value(10),
"For database_api_impl::get_full_accounts to set its account default limit values as 10")
("api-limit-get-full-accounts-lists",boost::program_options::value<uint64_t>()->default_value(100),
"For database_api_impl::get_full_accounts to set its lists default limit values as 100")
("api-limit-get-call-orders",boost::program_options::value<uint64_t>()->default_value(300),
"For database_api_impl::get_call_orders and get_call_orders_by_account to set its default limit values as 300")
("api-limit-get-settle-orders",boost::program_options::value<uint64_t>()->default_value(300),
"For database_api_impl::get_settle_orders and get_settle_orders_by_account to set its default limit values as 300")
("api-limit-get-assets",boost::program_options::value<uint64_t>()->default_value(101),
"For database_api_impl::list_assets and get_assets_by_issuer to set its default limit values as 101")
("api-limit-get-limit-orders",boost::program_options::value<uint64_t>()->default_value(300),
"For database_api_impl::get_limit_orders to set its default limit value as 300")
("api-limit-get-order-book",boost::program_options::value<uint64_t>()->default_value(50),
"For database_api_impl::get_order_book to set its default limit value as 50")
;
command_line_options.add(configuration_file_options);
command_line_options.add_options()
Expand Down
2 changes: 1 addition & 1 deletion libraries/app/application_impl.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include <graphene/app/application.hpp>
#include <graphene/app/api_access.hpp>
#include <graphene/chain/genesis_state.hpp>
#include <graphene/chain/protocol/types.hpp>
#include <graphene/protocol/types.hpp>
#include <graphene/net/message.hpp>

namespace graphene { namespace app { namespace detail {
Expand Down
Loading

0 comments on commit e8567d0

Please sign in to comment.