Skip to content

Commit e8567d0

Browse files
authored
Merge pull request #1843 from bitshares/release
merge release to master for 3.2.0
2 parents e3d1226 + 89fdcae commit e8567d0

File tree

224 files changed

+4552
-2741
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

224 files changed

+4552
-2741
lines changed

.gitattributes

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Set the default behavior of genesis.json, in case core.autocrlf is set incorrectly
2+
genesis.json eol=lf

.travis.yml

+7-10
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,14 @@ script:
2929
- ccache -s
3030
- programs/build_helpers/buildstep Prepare 1 "sed -i '/tests/d' libraries/fc/CMakeLists.txt"
3131
- 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 ."
32-
- programs/build_helpers/buildstep make.cli_wallet 1600 "programs/build_helpers/make_with_sonar bw-output -j 2 cli_wallet"
33-
- programs/build_helpers/buildstep make.witness_node 300 "programs/build_helpers/make_with_sonar bw-output -j 2 witness_node"
34-
- programs/build_helpers/buildstep make.serializer 45 "programs/build_helpers/make_with_sonar bw-output -j 2 js_operation_serializer"
35-
- programs/build_helpers/buildstep make.get_dev_key 10 "programs/build_helpers/make_with_sonar bw-output -j 2 get_dev_key"
36-
- programs/build_helpers/buildstep make.chain_test 900 "programs/build_helpers/make_with_sonar bw-output -j 2 chain_test"
37-
- programs/build_helpers/buildstep make.cli_test 200 "programs/build_helpers/make_with_sonar bw-output -j 2 cli_test"
38-
- programs/build_helpers/buildstep make.perf_test 120 "programs/build_helpers/make_with_sonar bw-output -j 2 performance_test"
32+
- 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"
33+
- programs/build_helpers/buildstep make.chain_test 1000 "make -j 2 chain_test"
34+
- programs/build_helpers/buildstep make.cli_test 200 "make -j 2 cli_test"
35+
- programs/build_helpers/buildstep make.perf_test 120 "make -j 2 performance_test"
3936
- set -o pipefail
4037
- programs/build_helpers/buildstep run.chain_test 240 "libraries/fc/tests/run-parallel-tests.sh tests/chain_test"
41-
- programs/build_helpers/buildstep run.cli_test 30 "libraries/fc/tests/run-parallel-tests.sh tests/cli_test"
42-
- 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'
43-
- programs/build_helpers/buildstep run.sonar 400 "which sonar-scanner && sonar-scanner || true"
38+
- programs/build_helpers/buildstep run.cli_test 60 "libraries/fc/tests/run-parallel-tests.sh tests/cli_test"
39+
- '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'
40+
- 'programs/build_helpers/buildstep run.sonar 1200 "which sonar-scanner && sonar-scanner" || true'
4441
- programs/build_helpers/buildstep end 0
4542
- ccache -s

CMakeLists.txt

+8-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Defines BitShares library target.
22
project( BitShares )
3-
cmake_minimum_required( VERSION 2.8.12 )
3+
cmake_minimum_required( VERSION 3.1 )
44

55
set( BLOCKCHAIN_NAME "BitShares" )
66

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

12+
set( CMAKE_CXX_STANDARD 14 )
13+
set( CMAKE_CXX_STANDARD_REQUIRED ON )
14+
set( CMAKE_CXX_EXTENSIONS OFF )
15+
1216
# http://stackoverflow.com/a/18369825
1317
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
1418
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8)
@@ -51,6 +55,7 @@ LIST(APPEND BOOST_COMPONENTS thread
5155
chrono
5256
unit_test_framework
5357
context)
58+
# boost::endian is also required, but FindBoost can't handle header-only libs
5459
SET( Boost_USE_STATIC_LIBS ON CACHE STRING "ON or OFF" )
5560

5661
IF( WIN32 )
@@ -109,11 +114,11 @@ else( WIN32 ) # Apple AND Linux
109114
if( APPLE )
110115
# Apple Specific Options Here
111116
message( STATUS "Configuring BitShares on OS X" )
112-
set( CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -std=c++11 -stdlib=libc++ -Wall" )
117+
set( CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -stdlib=libc++ -Wall" )
113118
else( APPLE )
114119
# Linux Specific Options Here
115120
message( STATUS "Configuring BitShares on Linux" )
116-
set( CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -std=c++11 -Wall" )
121+
set( CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -Wall" )
117122
if(USE_PROFILER)
118123
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pg" )
119124
endif( USE_PROFILER )

Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM phusion/baseimage:0.10.1
1+
FROM phusion/baseimage:0.11
22
MAINTAINER The bitshares decentralized organisation
33

44
ENV LANG=en_US.UTF-8

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ We recommend building on Ubuntu 16.04 LTS (64-bit)
5555
git submodule sync --recursive
5656
git submodule update --init --recursive
5757

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

docker/bitsharesentry.sh

+5
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ VERSION=`cat /etc/bitshares/version`
1818
# * $BITSHARESD_PARTIAL_OPERATIONS
1919
# * $BITSHARESD_MAX_OPS_PER_ACCOUNT
2020
# * $BITSHARESD_ES_NODE_URL
21+
# * $BITSHARESD_ES_START_AFTER_BLOCK
2122
# * $BITSHARESD_TRUSTED_NODE
2223
#
2324

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

74+
if [[ ! -z "$BITSHARESD_ES_START_AFTER_BLOCK" ]]; then
75+
ARGS+=" --elasticsearch-start-es-after-block=${BITSHARESD_ES_START_AFTER_BLOCK}"
76+
fi
77+
7378
if [[ ! -z "$BITSHARESD_TRUSTED_NODE" ]]; then
7479
ARGS+=" --trusted-node=${BITSHARESD_TRUSTED_NODE}"
7580
fi

docker/default_config.ini

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ rpc-endpoint = 0.0.0.0:8090
3535
enable-stale-production = false
3636

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

4040
# ID of witness controlled by this node (e.g. "1.6.5", quotes are required, may specify multiple times)
4141
# witness-id =

docs

Submodule docs updated from 0271e72 to 3d71528

libraries/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ add_subdirectory( utilities )
77
add_subdirectory( app )
88
add_subdirectory( plugins )
99
add_subdirectory( wallet )
10+
add_subdirectory( protocol )

libraries/app/api.cpp

+63-51
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,28 @@
2929
#include <graphene/chain/database.hpp>
3030
#include <graphene/chain/get_config.hpp>
3131
#include <graphene/utilities/key_conversion.hpp>
32-
#include <graphene/chain/protocol/fee_schedule.hpp>
32+
#include <graphene/protocol/fee_schedule.hpp>
3333
#include <graphene/chain/confidential_object.hpp>
3434
#include <graphene/chain/market_object.hpp>
35-
#include <graphene/chain/transaction_object.hpp>
35+
#include <graphene/chain/transaction_history_object.hpp>
3636
#include <graphene/chain/withdraw_permission_object.hpp>
3737
#include <graphene/chain/worker_object.hpp>
3838

3939
#include <fc/crypto/hex.hpp>
40+
#include <fc/rpc/api_connection.hpp>
4041
#include <fc/thread/future.hpp>
4142

43+
template class fc::api<graphene::app::block_api>;
44+
template class fc::api<graphene::app::network_broadcast_api>;
45+
template class fc::api<graphene::app::network_node_api>;
46+
template class fc::api<graphene::app::history_api>;
47+
template class fc::api<graphene::app::crypto_api>;
48+
template class fc::api<graphene::app::asset_api>;
49+
template class fc::api<graphene::app::orders_api>;
50+
template class fc::api<graphene::debug_witness::debug_api>;
51+
template class fc::api<graphene::app::login_api>;
52+
53+
4254
namespace graphene { namespace app {
4355

4456
login_api::login_api(application& a)
@@ -405,7 +417,7 @@ namespace graphene { namespace app {
405417
if( start == 0 )
406418
start = stats.total_ops;
407419
else
408-
start = min( stats.total_ops, start );
420+
start = std::min( stats.total_ops, start );
409421

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

535547
// asset_api
536548
asset_api::asset_api(graphene::app::application& app) :
537-
_app(app),
538-
_db( *app.chain_database()),
539-
database_api( std::ref(*app.chain_database()), &(app.get_options())
540-
) { }
549+
_app(app),
550+
_db( *app.chain_database()),
551+
database_api( std::ref(*app.chain_database()), &(app.get_options())
552+
) { }
541553
asset_api::~asset_api() { }
542554

543555
vector<account_asset_balance> asset_api::get_asset_holders( std::string asset, uint32_t start, uint32_t limit ) const {
544-
uint64_t api_limit_get_asset_holders=_app.get_options().api_limit_get_asset_holders;
545-
FC_ASSERT(limit <= api_limit_get_asset_holders);
546-
asset_id_type asset_id = database_api.get_asset_id_from_string( asset );
547-
const auto& bal_idx = _db.get_index_type< account_balance_index >().indices().get< by_asset_balance >();
548-
auto range = bal_idx.equal_range( boost::make_tuple( asset_id ) );
556+
uint64_t api_limit_get_asset_holders=_app.get_options().api_limit_get_asset_holders;
557+
FC_ASSERT(limit <= api_limit_get_asset_holders);
558+
asset_id_type asset_id = database_api.get_asset_id_from_string( asset );
559+
const auto& bal_idx = _db.get_index_type< account_balance_index >().indices().get< by_asset_balance >();
560+
auto range = bal_idx.equal_range( boost::make_tuple( asset_id ) );
549561

550-
vector<account_asset_balance> result;
562+
vector<account_asset_balance> result;
551563

552-
uint32_t index = 0;
553-
for( const account_balance_object& bal : boost::make_iterator_range( range.first, range.second ) )
554-
{
555-
if( result.size() >= limit )
556-
break;
564+
uint32_t index = 0;
565+
for( const account_balance_object& bal : boost::make_iterator_range( range.first, range.second ) )
566+
{
567+
if( result.size() >= limit )
568+
break;
557569

558-
if( bal.balance.value == 0 )
559-
continue;
570+
if( bal.balance.value == 0 )
571+
continue;
560572

561-
if( index++ < start )
562-
continue;
573+
if( index++ < start )
574+
continue;
563575

564-
const auto account = _db.find(bal.owner);
576+
const auto account = _db.find(bal.owner);
565577

566-
account_asset_balance aab;
567-
aab.name = account->name;
568-
aab.account_id = account->id;
569-
aab.amount = bal.balance.value;
578+
account_asset_balance aab;
579+
aab.name = account->name;
580+
aab.account_id = account->id;
581+
aab.amount = bal.balance.value;
570582

571-
result.push_back(aab);
572-
}
583+
result.push_back(aab);
584+
}
573585

574-
return result;
586+
return result;
575587
}
576588
// get number of asset holders.
577589
int asset_api::get_asset_holders_count( std::string asset ) const {
578-
const auto& bal_idx = _db.get_index_type< account_balance_index >().indices().get< by_asset_balance >();
579-
asset_id_type asset_id = database_api.get_asset_id_from_string( asset );
580-
auto range = bal_idx.equal_range( boost::make_tuple( asset_id ) );
590+
const auto& bal_idx = _db.get_index_type< account_balance_index >().indices().get< by_asset_balance >();
591+
asset_id_type asset_id = database_api.get_asset_id_from_string( asset );
592+
auto range = bal_idx.equal_range( boost::make_tuple( asset_id ) );
581593

582-
int count = boost::distance(range) - 1;
594+
int count = boost::distance(range) - 1;
583595

584-
return count;
596+
return count;
585597
}
586598
// function to get vector of system assets with holders count.
587599
vector<asset_holders> asset_api::get_all_asset_holders() const {
588-
vector<asset_holders> result;
589-
vector<asset_id_type> total_assets;
590-
for( const asset_object& asset_obj : _db.get_index_type<asset_index>().indices() )
591-
{
592-
const auto& dasset_obj = asset_obj.dynamic_asset_data_id(_db);
600+
vector<asset_holders> result;
601+
vector<asset_id_type> total_assets;
602+
for( const asset_object& asset_obj : _db.get_index_type<asset_index>().indices() )
603+
{
604+
const auto& dasset_obj = asset_obj.dynamic_asset_data_id(_db);
593605

594-
asset_id_type asset_id;
595-
asset_id = dasset_obj.id;
606+
asset_id_type asset_id;
607+
asset_id = dasset_obj.id;
596608

597-
const auto& bal_idx = _db.get_index_type< account_balance_index >().indices().get< by_asset_balance >();
598-
auto range = bal_idx.equal_range( boost::make_tuple( asset_id ) );
609+
const auto& bal_idx = _db.get_index_type< account_balance_index >().indices().get< by_asset_balance >();
610+
auto range = bal_idx.equal_range( boost::make_tuple( asset_id ) );
599611

600-
int count = boost::distance(range) - 1;
612+
int count = boost::distance(range) - 1;
601613

602-
asset_holders ah;
603-
ah.asset_id = asset_id;
604-
ah.count = count;
614+
asset_holders ah;
615+
ah.asset_id = asset_id;
616+
ah.count = count;
605617

606-
result.push_back(ah);
607-
}
618+
result.push_back(ah);
619+
}
608620

609-
return result;
621+
return result;
610622
}
611623

612624
// orders_api

libraries/app/application.cpp

+45-8
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
2828

2929
#include <graphene/chain/db_with.hpp>
3030
#include <graphene/chain/genesis_state.hpp>
31-
#include <graphene/chain/protocol/fee_schedule.hpp>
32-
#include <graphene/chain/protocol/types.hpp>
31+
#include <graphene/protocol/fee_schedule.hpp>
32+
#include <graphene/protocol/types.hpp>
3333

3434
#include <graphene/egenesis/egenesis.hpp>
3535

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

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

@@ -337,12 +337,33 @@ void application_impl::set_api_limit() {
337337
if(_options->count("api-limit-get-asset-holders")){
338338
_app_options.api_limit_get_asset_holders = _options->at("api-limit-get-asset-holders").as<uint64_t>();
339339
}
340-
if(_options->count("api-limit-get-key-references")){
341-
_app_options.api_limit_get_key_references = _options->at("api-limit-get-key-references").as<uint64_t>();
342-
}
340+
if(_options->count("api-limit-get-key-references")){
341+
_app_options.api_limit_get_key_references = _options->at("api-limit-get-key-references").as<uint64_t>();
342+
}
343343
if(_options->count("api-limit-get-htlc-by")) {
344344
_app_options.api_limit_get_htlc_by = _options->at("api-limit-get-htlc-by").as<uint64_t>();
345345
}
346+
if(_options->count("api-limit-get-full-accounts")) {
347+
_app_options.api_limit_get_full_accounts = _options->at("api-limit-get-full-accounts").as<uint64_t>();
348+
}
349+
if(_options->count("api-limit-get-full-accounts-lists")) {
350+
_app_options.api_limit_get_full_accounts_lists = _options->at("api-limit-get-full-accounts-lists").as<uint64_t>();
351+
}
352+
if(_options->count("api-limit-get-call-orders")) {
353+
_app_options.api_limit_get_call_orders = _options->at("api-limit-get-call-orders").as<uint64_t>();
354+
}
355+
if(_options->count("api-limit-get-settle-orders")) {
356+
_app_options.api_limit_get_settle_orders = _options->at("api-limit-get-settle-orders").as<uint64_t>();
357+
}
358+
if(_options->count("api-limit-get-assets")) {
359+
_app_options.api_limit_get_assets = _options->at("api-limit-get-assets").as<uint64_t>();
360+
}
361+
if(_options->count("api-limit-get-limit-orders")){
362+
_app_options.api_limit_get_limit_orders = _options->at("api-limit-get-limit-orders").as<uint64_t>();
363+
}
364+
if(_options->count("api-limit-get-order-book")){
365+
_app_options.api_limit_get_order_book = _options->at("api-limit-get-order-book").as<uint64_t>();
366+
}
346367
}
347368

348369
void application_impl::startup()
@@ -1018,8 +1039,24 @@ void application::set_program_options(boost::program_options::options_descriptio
10181039
"For history_api::get_account_history_by_operations to set its default limit value as 100")
10191040
("api-limit-get-asset-holders",boost::program_options::value<uint64_t>()->default_value(100),
10201041
"For asset_api::get_asset_holders to set its default limit value as 100")
1021-
("api-limit-get-key-references",boost::program_options::value<uint64_t>()->default_value(100),
1022-
"For database_api_impl::get_key_references to set its default limit value as 100")
1042+
("api-limit-get-key-references",boost::program_options::value<uint64_t>()->default_value(100),
1043+
"For database_api_impl::get_key_references to set its default limit value as 100")
1044+
("api-limit-get-htlc-by",boost::program_options::value<uint64_t>()->default_value(100),
1045+
"For database_api_impl::get_htlc_by_from and get_htlc_by_to to set its default limit value as 100")
1046+
("api-limit-get-full-accounts",boost::program_options::value<uint64_t>()->default_value(10),
1047+
"For database_api_impl::get_full_accounts to set its account default limit values as 10")
1048+
("api-limit-get-full-accounts-lists",boost::program_options::value<uint64_t>()->default_value(100),
1049+
"For database_api_impl::get_full_accounts to set its lists default limit values as 100")
1050+
("api-limit-get-call-orders",boost::program_options::value<uint64_t>()->default_value(300),
1051+
"For database_api_impl::get_call_orders and get_call_orders_by_account to set its default limit values as 300")
1052+
("api-limit-get-settle-orders",boost::program_options::value<uint64_t>()->default_value(300),
1053+
"For database_api_impl::get_settle_orders and get_settle_orders_by_account to set its default limit values as 300")
1054+
("api-limit-get-assets",boost::program_options::value<uint64_t>()->default_value(101),
1055+
"For database_api_impl::list_assets and get_assets_by_issuer to set its default limit values as 101")
1056+
("api-limit-get-limit-orders",boost::program_options::value<uint64_t>()->default_value(300),
1057+
"For database_api_impl::get_limit_orders to set its default limit value as 300")
1058+
("api-limit-get-order-book",boost::program_options::value<uint64_t>()->default_value(50),
1059+
"For database_api_impl::get_order_book to set its default limit value as 50")
10231060
;
10241061
command_line_options.add(configuration_file_options);
10251062
command_line_options.add_options()

libraries/app/application_impl.hxx

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#include <graphene/app/application.hpp>
77
#include <graphene/app/api_access.hpp>
88
#include <graphene/chain/genesis_state.hpp>
9-
#include <graphene/chain/protocol/types.hpp>
9+
#include <graphene/protocol/types.hpp>
1010
#include <graphene/net/message.hpp>
1111

1212
namespace graphene { namespace app { namespace detail {

0 commit comments

Comments
 (0)