Skip to content

Commit 319d7b9

Browse files
authored
Merge pull request #1599 from bitshares/release
merge release to master
2 parents 58c0c49 + a75531e commit 319d7b9

File tree

110 files changed

+2854
-2957
lines changed

Some content is hidden

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

110 files changed

+2854
-2957
lines changed

.travis.yml

+18-14
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,12 @@ cache: ccache
55
git:
66
depth: 1
77

8-
dist: trusty
8+
dist: xenial
99

1010
sudo: true
1111

1212
install:
13-
- echo "deb http://de.archive.ubuntu.com/ubuntu xenial main restricted universe multiverse" | sudo tee -a /etc/apt/sources.list
14-
- sudo apt-get update
15-
- sudo apt-get install --allow-unauthenticated g++ libboost-all-dev cmake libreadline-dev libssl-dev autoconf parallel ccache
13+
- sudo apt-get install --allow-unauthenticated libboost-thread-dev libboost-iostreams-dev libboost-date-time-dev libboost-system-dev libboost-filesystem-dev libboost-program-options-dev libboost-chrono-dev libboost-test-dev libboost-context-dev libboost-regex-dev libboost-coroutine-dev cmake parallel
1614

1715
addons:
1816
sonarcloud:
@@ -27,15 +25,21 @@ env:
2725
- CCACHE_SLOPPINESS=include_file_ctime,include_file_mtime,time_macros
2826

2927
script:
30-
- 'echo $((`date +%s` - 120)) >_start_time'
28+
- programs/build_helpers/buildstep -s 3500
3129
- ccache -s
32-
- '( [ `ccache -s | grep "files in cache" | cut -c 20-` = 0 ] && touch _empty_cache ) || true'
33-
- sed -i '/tests/d' libraries/fc/CMakeLists.txt
34-
- cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_FLAGS=--coverage -DCMAKE_CXX_FLAGS=--coverage -DBoost_USE_STATIC_LIBS=OFF -DCMAKE_CXX_OUTPUT_EXTENSION_REPLACE=ON .
35-
- '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'
30+
- programs/build_helpers/buildstep Prepare 1 "sed -i '/tests/d' libraries/fc/CMakeLists.txt"
31+
- 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"
3639
- set -o pipefail
37-
- '[ -r _empty_cache ] || tests/chain_test 2>&1 | cat'
38-
- '[ -r _empty_cache ] || tests/cli_test 2>&1 | cat'
39-
- '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'
40-
- '( [ -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 )'
41-
- '[ ! -r _empty_cache ] || ( echo "Please restart with populated cache" && false )'
40+
- 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"
44+
- programs/build_helpers/buildstep end 0
45+
- ccache -s

CMakeLists.txt

+1-4
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,9 @@ LIST(APPEND BOOST_COMPONENTS thread
4848
system
4949
filesystem
5050
program_options
51-
signals
52-
serialization
5351
chrono
5452
unit_test_framework
55-
context
56-
locale)
53+
context)
5754
SET( Boost_USE_STATIC_LIBS ON CACHE STRING "ON or OFF" )
5855

5956
IF( WIN32 )

Dockerfile

+16-6
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,25 @@ RUN \
1010
cmake \
1111
git \
1212
libbz2-dev \
13-
libreadline-dev \
14-
libboost-all-dev \
1513
libcurl4-openssl-dev \
1614
libssl-dev \
1715
libncurses-dev \
16+
libboost-thread-dev \
17+
libboost-iostreams-dev \
18+
libboost-date-time-dev \
19+
libboost-system-dev \
20+
libboost-filesystem-dev \
21+
libboost-program-options-dev \
22+
libboost-chrono-dev \
23+
libboost-test-dev \
24+
libboost-context-dev \
25+
libboost-regex-dev \
26+
libboost-coroutine-dev \
27+
libtool \
1828
doxygen \
1929
ca-certificates \
30+
fish \
2031
&& \
21-
apt-get update -y && \
22-
apt-get install -y fish && \
2332
apt-get clean && \
2433
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
2534

@@ -38,9 +47,10 @@ RUN \
3847
git submodule update --init --recursive && \
3948
cmake \
4049
-DCMAKE_BUILD_TYPE=Release \
50+
-DGRAPHENE_DISABLE_UNITY_BUILD=ON \
4151
. && \
42-
make witness_node cli_wallet && \
43-
install -s programs/witness_node/witness_node programs/cli_wallet/cli_wallet /usr/local/bin && \
52+
make witness_node cli_wallet get_dev_key && \
53+
install -s programs/witness_node/witness_node programs/genesis_util/get_dev_key programs/cli_wallet/cli_wallet /usr/local/bin && \
4454
#
4555
# Obtain version
4656
mkdir /etc/bitshares && \

README.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,9 @@ In order to run a full node with all the account history you need to remove `par
8080

8181
| Default | Full | Minimal | ElasticSearch
8282
| --- | --- | --- | ---
83-
| 100G HDD, 16G RAM | 200G HDD, 160G RAM | 80G HDD, 4G RAM | 500G SSD, 32G RAM
83+
| 100G HDD, 16G RAM | 640G SSD, 64G RAM * | 80G HDD, 4G RAM | 500G SSD, 32G RAM
84+
85+
\* For this setup, allocate at least 500GB of SSD as swap.
8486

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

gui_version

-1
This file was deleted.

libraries/README.md

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# BitShares Libraries
2+
3+
The libraries are the core of the project and defines everything where applications can build on top.
4+
5+
A **graphene** blockchain software will use the `app` library to define what the application will do, what services it will offer. The blockchain is defined by the `chain` library and include all the objects, types, operations, protocols that builds current consensus blockchain. The lowest level in memory database of Bitshares is developed at the `db` library. The `fc` is a helper module broadly used in the libraries code, `egenesis` will help with the genesis file, `plugins` will be loaded optionally to the application. Wallet software like the cli_wallet will benefit from the `wallet` library.
6+
7+
Code in libraries is the most important part of **bitshares-core** project and it is maintained by the Bitshares Core Team and contributors.
8+
# Available Libraries
9+
10+
Folder | Name | Description | Status
11+
---|---|---|---
12+
[app](app) | Application | Bundles component libraries (chain, network, plugins) into a useful application. Also provides API access. | Active
13+
[chain](chain) | Blockchain | Defines all objects, operations and types. This include the consensus protocol, defines the whole blockchain behaviour. | Active
14+
[db](db) | Database | Defines the internal database graphene uses. | Active
15+
[egenesis](egenesis) | Genesis | Hardcodes the `genesis.json` file into the `witness_node` executable.| Active
16+
[fc](fc) | Fast-compiling C++ library | https://github.com/bitshares/bitshares-fc | Active
17+
[net](net) | Network | The graphene p2p layer. | Active
18+
[plugins](plugins) | Plugins | Collection of singleton designed modules used for extending the bitshares-core. | Active
19+
[utilities](utilities) | Utilities | Common utility calls used in applications or other libraries. | Active
20+
[wallet](wallet) | Wallet | Wallet definition for the `cli_wallet` software. | Active

libraries/app/api.cpp

+35-22
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
#include <graphene/chain/worker_object.hpp>
3838

3939
#include <fc/crypto/hex.hpp>
40-
#include <fc/smart_ref_impl.hpp>
4140
#include <fc/thread/future.hpp>
4241

4342
namespace graphene { namespace app {
@@ -101,7 +100,7 @@ namespace graphene { namespace app {
101100
}
102101
else if( api_name == "asset_api" )
103102
{
104-
_asset_api = std::make_shared< asset_api >( std::ref( *_app.chain_database() ) );
103+
_asset_api = std::make_shared< asset_api >( _app );
105104
}
106105
else if( api_name == "orders_api" )
107106
{
@@ -159,18 +158,18 @@ namespace graphene { namespace app {
159158
}
160159
}
161160

162-
void network_broadcast_api::broadcast_transaction(const signed_transaction& trx)
161+
void network_broadcast_api::broadcast_transaction(const precomputable_transaction& trx)
163162
{
164-
trx.validate();
163+
_app.chain_database()->precompute_parallel( trx ).wait();
165164
_app.chain_database()->push_transaction(trx);
166165
if( _app.p2p_node() != nullptr )
167166
_app.p2p_node()->broadcast_transaction(trx);
168167
}
169168

170-
fc::variant network_broadcast_api::broadcast_transaction_synchronous(const signed_transaction& trx)
169+
fc::variant network_broadcast_api::broadcast_transaction_synchronous(const precomputable_transaction& trx)
171170
{
172171
fc::promise<fc::variant>::ptr prom( new fc::promise<fc::variant>() );
173-
broadcast_transaction_with_callback( [=]( const fc::variant& v ){
172+
broadcast_transaction_with_callback( [prom]( const fc::variant& v ){
174173
prom->set_value(v);
175174
}, trx );
176175

@@ -179,14 +178,15 @@ namespace graphene { namespace app {
179178

180179
void network_broadcast_api::broadcast_block( const signed_block& b )
181180
{
181+
_app.chain_database()->precompute_parallel( b ).wait();
182182
_app.chain_database()->push_block(b);
183183
if( _app.p2p_node() != nullptr )
184184
_app.p2p_node()->broadcast( net::block_message( b ));
185185
}
186186

187-
void network_broadcast_api::broadcast_transaction_with_callback(confirmation_callback cb, const signed_transaction& trx)
187+
void network_broadcast_api::broadcast_transaction_with_callback(confirmation_callback cb, const precomputable_transaction& trx)
188188
{
189-
trx.validate();
189+
_app.chain_database()->precompute_parallel( trx ).wait();
190190
_callbacks[trx.id()] = cb;
191191
_app.chain_database()->push_transaction(trx);
192192
if( _app.p2p_node() != nullptr )
@@ -283,10 +283,12 @@ namespace graphene { namespace app {
283283
return *_debug_api;
284284
}
285285

286-
vector<order_history_object> history_api::get_fill_order_history( asset_id_type a, asset_id_type b, uint32_t limit )const
286+
vector<order_history_object> history_api::get_fill_order_history( std::string asset_a, std::string asset_b, uint32_t limit )const
287287
{
288288
FC_ASSERT(_app.chain_database());
289289
const auto& db = *_app.chain_database();
290+
asset_id_type a = database_api.get_asset_id_from_string( asset_a );
291+
asset_id_type b = database_api.get_asset_id_from_string( asset_b );
290292
if( a > b ) std::swap(a,b);
291293
const auto& history_idx = db.get_index_type<graphene::market_history::history_index>().indices().get<by_key>();
292294
history_key hkey;
@@ -344,7 +346,7 @@ namespace graphene { namespace app {
344346
}
345347

346348
vector<operation_history_object> history_api::get_account_history_operations( const std::string account_id_or_name,
347-
int operation_id,
349+
int operation_type,
348350
operation_history_id_type start,
349351
operation_history_id_type stop,
350352
unsigned limit) const
@@ -367,17 +369,17 @@ namespace graphene { namespace app {
367369
{
368370
if( node->operation_id.instance.value <= start.instance.value ) {
369371

370-
if(node->operation_id(db).op.which() == operation_id)
372+
if(node->operation_id(db).op.which() == operation_type)
371373
result.push_back( node->operation_id(db) );
372-
}
374+
}
373375
if( node->next == account_transaction_history_id_type() )
374376
node = nullptr;
375377
else node = &node->next(db);
376378
}
377379
if( stop.instance.value == 0 && result.size() < limit ) {
378-
const account_transaction_history_object head = account_transaction_history_id_type()(db);
379-
if( head.account == account && head.operation_id(db).op.which() == operation_id )
380-
result.push_back(head.operation_id(db));
380+
auto head = db.find(account_transaction_history_id_type());
381+
if (head != nullptr && head->account == account && head->operation_id(db).op.which() == operation_type)
382+
result.push_back(head->operation_id(db));
381383
}
382384
return result;
383385
}
@@ -442,11 +444,13 @@ namespace graphene { namespace app {
442444
return result;
443445
}
444446

445-
vector<bucket_object> history_api::get_market_history( asset_id_type a, asset_id_type b,
447+
vector<bucket_object> history_api::get_market_history( std::string asset_a, std::string asset_b,
446448
uint32_t bucket_seconds, fc::time_point_sec start, fc::time_point_sec end )const
447449
{ try {
448450
FC_ASSERT(_app.chain_database());
449451
const auto& db = *_app.chain_database();
452+
asset_id_type a = database_api.get_asset_id_from_string( asset_a );
453+
asset_id_type b = database_api.get_asset_id_from_string( asset_b );
450454
vector<bucket_object> result;
451455
result.reserve(200);
452456

@@ -466,7 +470,7 @@ namespace graphene { namespace app {
466470
++itr;
467471
}
468472
return result;
469-
} FC_CAPTURE_AND_RETHROW( (a)(b)(bucket_seconds)(start)(end) ) }
473+
} FC_CAPTURE_AND_RETHROW( (asset_a)(asset_b)(bucket_seconds)(start)(end) ) }
470474

471475
crypto_api::crypto_api(){};
472476

@@ -525,12 +529,17 @@ namespace graphene { namespace app {
525529
}
526530

527531
// asset_api
528-
asset_api::asset_api(graphene::chain::database& db) : _db(db) { }
532+
asset_api::asset_api(graphene::app::application& app) :
533+
_db( *app.chain_database()),
534+
database_api( std::ref(*app.chain_database()), &(app.get_options())
535+
) { }
529536
asset_api::~asset_api() { }
530537

531-
vector<account_asset_balance> asset_api::get_asset_holders( asset_id_type asset_id, uint32_t start, uint32_t limit ) const {
538+
vector<account_asset_balance> asset_api::get_asset_holders( std::string asset, uint32_t start, uint32_t limit ) const {
532539
FC_ASSERT(limit <= 100);
533540

541+
asset_id_type asset_id = database_api.get_asset_id_from_string( asset );
542+
534543
const auto& bal_idx = _db.get_index_type< account_balance_index >().indices().get< by_asset_balance >();
535544
auto range = bal_idx.equal_range( boost::make_tuple( asset_id ) );
536545

@@ -561,9 +570,10 @@ namespace graphene { namespace app {
561570
return result;
562571
}
563572
// get number of asset holders.
564-
int asset_api::get_asset_holders_count( asset_id_type asset_id ) const {
573+
int asset_api::get_asset_holders_count( std::string asset ) const {
565574

566575
const auto& bal_idx = _db.get_index_type< account_balance_index >().indices().get< by_asset_balance >();
576+
asset_id_type asset_id = database_api.get_asset_id_from_string( asset );
567577
auto range = bal_idx.equal_range( boost::make_tuple( asset_id ) );
568578

569579
int count = boost::distance(range) - 1;
@@ -606,8 +616,8 @@ namespace graphene { namespace app {
606616
return plugin->tracked_groups();
607617
}
608618

609-
vector< limit_order_group > orders_api::get_grouped_limit_orders( asset_id_type base_asset_id,
610-
asset_id_type quote_asset_id,
619+
vector< limit_order_group > orders_api::get_grouped_limit_orders( std::string base_asset,
620+
std::string quote_asset,
611621
uint16_t group,
612622
optional<price> start,
613623
uint32_t limit )const
@@ -618,6 +628,9 @@ namespace graphene { namespace app {
618628
const auto& limit_groups = plugin->limit_order_groups();
619629
vector< limit_order_group > result;
620630

631+
asset_id_type base_asset_id = database_api.get_asset_id_from_string( base_asset );
632+
asset_id_type quote_asset_id = database_api.get_asset_id_from_string( quote_asset );
633+
621634
price max_price = price::max( base_asset_id, quote_asset_id );
622635
price min_price = price::min( base_asset_id, quote_asset_id );
623636
if( start.valid() && !start->is_null() )

0 commit comments

Comments
 (0)