Skip to content

Commit

Permalink
Merge branch 'release' into testnet
Browse files Browse the repository at this point in the history
  • Loading branch information
abitmore committed Jun 12, 2020
2 parents 4c01a1b + 222e6c4 commit bf72fe9
Show file tree
Hide file tree
Showing 27 changed files with 443 additions and 132 deletions.
12 changes: 8 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,12 @@ env:
jobs:
include:
- stage: build for cache
script: ./programs/build_helpers/build_protocol
- stage: build, test and scan partly with sonar
script: ./programs/build_helpers/build_for_cache
- stage: build and test
script: ./programs/build_helpers/build_and_test
- stage: scan fully with sonar
script: ./programs/build_helpers/scan_with_sonar
- stage: scan with sonar, step 1
script: ./programs/build_helpers/scan_with_sonar_step_1
- stage: scan with sonar, step 2
script: ./programs/build_helpers/scan_with_sonar_step_2
- stage: scan with sonar, step 3
script: ./programs/build_helpers/scan_with_sonar_step_3
8 changes: 4 additions & 4 deletions docker/default_config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,11 @@ rpc-endpoint = 0.0.0.0:8091
# For database_api_impl::get_htlc_by_from and get_htlc_by_to to set max limit value
# api-limit-get-htlc-by = 100

# For database_api_impl::get_full_accounts to set max limit value
# api-limit-get-full-accounts = 10
# For database_api_impl::get_full_accounts to set max accounts to query at once
# api-limit-get-full-accounts = 50

# For database_api_impl::get_full_accounts to set max limit value
# api-limit-get-full-accounts-lists = 100
# For database_api_impl::get_full_accounts to set max items to return in the lists
# api-limit-get-full-accounts-lists = 500

# For database_api_impl::get_call_orders and get_call_orders_by_account to set max limit value
# api-limit-get-call-orders = 300
Expand Down
8 changes: 4 additions & 4 deletions libraries/app/application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1000,10 +1000,10 @@ void application::set_program_options(boost::program_options::options_descriptio
"For database_api_impl::get_key_references to set max limit value")
("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 max limit value")
("api-limit-get-full-accounts",boost::program_options::value<uint64_t>()->default_value(10),
"For database_api_impl::get_full_accounts to set max limit value")
("api-limit-get-full-accounts-lists",boost::program_options::value<uint64_t>()->default_value(100),
"For database_api_impl::get_full_accounts to set max limit value")
("api-limit-get-full-accounts",boost::program_options::value<uint64_t>()->default_value(50),
"For database_api_impl::get_full_accounts to set max accounts to query at once")
("api-limit-get-full-accounts-lists",boost::program_options::value<uint64_t>()->default_value(500),
"For database_api_impl::get_full_accounts to set max items to return in the lists")
("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 max limit value")
("api-limit-get-settle-orders",boost::program_options::value<uint64_t>()->default_value(300),
Expand Down
4 changes: 2 additions & 2 deletions libraries/app/include/graphene/app/application.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ namespace graphene { namespace app {
uint64_t api_limit_get_asset_holders = 100;
uint64_t api_limit_get_key_references = 100;
uint64_t api_limit_get_htlc_by = 100;
uint64_t api_limit_get_full_accounts = 10;
uint64_t api_limit_get_full_accounts_lists = 100;
uint64_t api_limit_get_full_accounts = 50;
uint64_t api_limit_get_full_accounts_lists = 500;
uint64_t api_limit_get_call_orders = 300;
uint64_t api_limit_get_settle_orders = 300;
uint64_t api_limit_get_assets = 101;
Expand Down
21 changes: 20 additions & 1 deletion libraries/chain/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,27 @@ target_link_libraries( graphene_chain fc graphene_db graphene_protocol )
target_include_directories( graphene_chain
PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" "${CMAKE_CURRENT_BINARY_DIR}/include" )

set( GRAPHENE_CHAIN_BIG_FILES
db_init.cpp
db_block.cpp
db_maint.cpp
db_market.cpp
database.cpp
block_database.cpp
)

if(MSVC)
set_source_files_properties( db_init.cpp db_block.cpp database.cpp block_database.cpp PROPERTIES COMPILE_FLAGS "/bigobj" )
set_source_files_properties( ${GRAPHENE_CHAIN_BIG_FILES} PROPERTIES COMPILE_FLAGS "/bigobj" )
else( MSVC )
if( MINGW )
set_source_files_properties( ${GRAPHENE_CHAIN_BIG_FILES} PROPERTIES COMPILE_FLAGS -Wa,-mbig-obj )
if( (CMAKE_BUILD_TYPE MATCHES Release) OR (CMAKE_BUILD_TYPE MATCHES RelWithDebInfo) )
# Use -Os to avoid string table overflow
set_source_files_properties( database.cpp PROPERTIES COMPILE_FLAGS -Os )
set_source_files_properties( database.cpp PROPERTIES LINK_FLAGS -Os )
set_source_files_properties( database.cpp PROPERTIES STATIC_LIBRARY_FLAGS -Os )
endif( CMAKE_BUILD_TYPE )
endif( MINGW )
endif(MSVC)

# Support for CMake < 3.4
Expand Down
7 changes: 6 additions & 1 deletion libraries/chain/db_update.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -602,8 +602,9 @@ void database::clear_expired_htlcs()
}
}

void database::process_tickets()
generic_operation_result database::process_tickets()
{
generic_operation_result result;
share_type total_delta_pob;
share_type total_delta_inactive;
auto& idx = get_index_type<ticket_index>().indices().get<by_next_update>();
Expand All @@ -619,6 +620,7 @@ void database::process_tickets()
aso.total_core_pol -= ticket.amount.amount;
aso.total_pol_value -= ticket.value;
});
result.removed_objects.insert( ticket.id );
remove( ticket );
}
else
Expand All @@ -628,6 +630,7 @@ void database::process_tickets()
modify( ticket, []( ticket_object& o ) {
o.auto_update();
});
result.updated_objects.insert( ticket.id );

share_type delta_inactive_amount;
share_type delta_forever_amount;
Expand Down Expand Up @@ -687,6 +690,8 @@ void database::process_tickets()
dgp.total_inactive += total_delta_inactive;
});
}

return result;
}

} }
6 changes: 5 additions & 1 deletion libraries/chain/include/graphene/chain/asset_object.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,11 @@ namespace graphene { namespace chain {
/// Fixed point between 1.000 and 10.000, implied fixed point denominator is GRAPHENE_COLLATERAL_RATIO_DENOM
uint16_t initial_collateral_ratio = GRAPHENE_DEFAULT_MAINTENANCE_COLLATERAL_RATIO;

price_feed_with_icr( const price_feed& pf = {}, const optional<uint16_t>& icr = {} )
price_feed_with_icr()
: price_feed(), initial_collateral_ratio( maintenance_collateral_ratio )
{}

price_feed_with_icr( const price_feed& pf, const optional<uint16_t>& icr = {} )
: price_feed( pf ), initial_collateral_ratio( icr.valid() ? *icr : pf.maintenance_collateral_ratio )
{}

Expand Down
6 changes: 4 additions & 2 deletions libraries/chain/include/graphene/chain/database.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,7 @@ namespace graphene { namespace chain {

//////////////////// db_block.cpp ////////////////////

public:
public:
// these were formerly private, but they have a fairly well-defined API, so let's make them public
void apply_block( const signed_block& next_block, uint32_t skip = skip_nothing );
processed_transaction apply_transaction( const signed_transaction& trx, uint32_t skip = skip_nothing );
Expand All @@ -581,6 +581,9 @@ namespace graphene { namespace chain {
uint32_t update_witness_missed_blocks( const signed_block& b );

//////////////////// db_update.cpp ////////////////////
public:
generic_operation_result process_tickets();
private:
void update_global_dynamic_data( const signed_block& b, const uint32_t missed_blocks );
void update_signing_witness(const witness_object& signing_witness, const signed_block& new_block);
void update_last_irreversible_block();
Expand All @@ -591,7 +594,6 @@ namespace graphene { namespace chain {
void update_core_exchange_rates();
void update_maintenance_flag( bool new_maintenance_flag );
void update_withdraw_permissions();
void process_tickets();
bool check_for_blackswan( const asset_object& mia, bool enable_black_swan = true,
const asset_bitasset_data_object* bitasset_ptr = nullptr );
void clear_expired_htlcs();
Expand Down
15 changes: 13 additions & 2 deletions libraries/chain/ticket_evaluator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ void_result ticket_update_evaluator::do_evaluate(const ticket_update_operation&

FC_ASSERT( _ticket->current_type != lock_forever, "Can not to update a ticket that is locked forever" );

FC_ASSERT( _ticket->target_type != op.target_type, "Target type does not change" );
FC_ASSERT( static_cast<uint64_t>(_ticket->target_type) != op.target_type, "Target type does not change" );

if( op.amount_for_new_target.valid() )
{
Expand Down Expand Up @@ -123,9 +123,20 @@ generic_operation_result ticket_update_evaluator::do_apply(const ticket_update_o
d.modify( stat, [delta_value](account_statistics_object& aso) {
aso.total_pol_value += delta_value;
});
result.updated_objects.insert( stat.id );
}

// Do auto-update now.
// Note: calling process_tickets() here won't affect other tickets,
// since head_block_time is not updated after last call,
// even when called via a proposal this time or last time
generic_operation_result process_result = d.process_tickets();
result.removed_objects.insert( process_result.removed_objects.begin(), process_result.removed_objects.end() );
result.updated_objects.insert( process_result.updated_objects.begin(), process_result.updated_objects.end() );
for( const auto id : result.new_objects )
result.updated_objects.erase( id );
for( const auto id : result.removed_objects )
result.updated_objects.erase( id );

return result;
} FC_CAPTURE_AND_RETHROW( (op) ) }

Expand Down
16 changes: 9 additions & 7 deletions libraries/egenesis/seed-nodes.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
// https://bitsharestalk.org/index.php/topic,23715.0.html
"seed01.liondani.com:1776", // liondani (GERMANY)
"45.35.12.22:1776", // sahkan (USA)
"bts.lafona.net:1776", // lafona (France)
"bts-seed1.abit-more.com:62015", // abit (China)
"node.blckchnd.com:4243", // blckchnd (Germany)
"seed.roelandp.nl:1776", // roelandp (Canada)
"seed.bts.bangzi.info:55501", // Bangzi (Germany)
"seed01.liondani.com:1776", // liondani (Germany)
"bts.lafona.net:1776", // lafona (France)
"bts-seed1.abit-more.com:62015", // abit (China)
"seed.blckchnd.com:4243", // blckchnd (Germany)
"seed.roelandp.nl:1776", // roelandp (Canada)
"seed.bts.bangzi.info:55501", // Bangzi (Germany)
"seed1.xbts.io:1776", // xbts.io (Germany)
"seed2.xbts.io:1776", // xbts.io (Germany)
"seed.bitshares.org:666", // bitshares.org (France)
"seeds.btsnodes.com:1776", // Community
5 changes: 4 additions & 1 deletion libraries/protocol/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,10 @@ list(APPEND CUSTOM_AUTHS_FILES
custom_authorities/list_6.cpp
custom_authorities/list_7.cpp
custom_authorities/list_8.cpp
custom_authorities/list_9.cpp)
custom_authorities/list_9.cpp
custom_authorities/list_10.cpp
custom_authorities/list_11.cpp
custom_authorities/list_12.cpp)

file(GLOB CUSTOM_AUTHS_HEADERS "custom_authorities/*.hxx")

Expand Down
41 changes: 41 additions & 0 deletions libraries/protocol/custom_authorities/list_10.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* Copyright (c) 2019 Contributors.
*
* The MIT License
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/

#include "restriction_predicate.hxx"
#include "sliced_lists.hxx"

namespace graphene { namespace protocol {
using result_type = object_restriction_predicate<operation>;

result_type get_restriction_predicate_list_10(size_t idx, vector<restriction> rs) {
return typelist::runtime::dispatch(operation_list_10::list(), idx, [&rs] (auto t) -> result_type {
using Op = typename decltype(t)::type;
return [p=restrictions_to_predicate<Op>(std::move(rs), true)] (const operation& op) {
FC_ASSERT(op.which() == operation::tag<Op>::value,
"Supplied operation is incorrect type for restriction predicate");
return p(op.get<Op>());
};
});
}
} }
41 changes: 41 additions & 0 deletions libraries/protocol/custom_authorities/list_11.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* Copyright (c) 2019 Contributors.
*
* The MIT License
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/

#include "restriction_predicate.hxx"
#include "sliced_lists.hxx"

namespace graphene { namespace protocol {
using result_type = object_restriction_predicate<operation>;

result_type get_restriction_predicate_list_11(size_t idx, vector<restriction> rs) {
return typelist::runtime::dispatch(operation_list_11::list(), idx, [&rs] (auto t) -> result_type {
using Op = typename decltype(t)::type;
return [p=restrictions_to_predicate<Op>(std::move(rs), true)] (const operation& op) {
FC_ASSERT(op.which() == operation::tag<Op>::value,
"Supplied operation is incorrect type for restriction predicate");
return p(op.get<Op>());
};
});
}
} }
41 changes: 41 additions & 0 deletions libraries/protocol/custom_authorities/list_12.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* Copyright (c) 2019 Contributors.
*
* The MIT License
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/

#include "restriction_predicate.hxx"
#include "sliced_lists.hxx"

namespace graphene { namespace protocol {
using result_type = object_restriction_predicate<operation>;

result_type get_restriction_predicate_list_12(size_t idx, vector<restriction> rs) {
return typelist::runtime::dispatch(operation_list_12::list(), idx, [&rs] (auto t) -> result_type {
using Op = typename decltype(t)::type;
return [p=restrictions_to_predicate<Op>(std::move(rs), true)] (const operation& op) {
FC_ASSERT(op.which() == operation::tag<Op>::value,
"Supplied operation is incorrect type for restriction predicate");
return p(op.get<Op>());
};
});
}
} }
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ restriction_predicate_function get_restriction_predicate(vector<restriction> rs,
return get_restriction_predicate_list_8(typelist::index_of<operation_list_8::list, Op>(), std::move(rs));
if (typelist::contains<operation_list_9::list, Op>())
return get_restriction_predicate_list_9(typelist::index_of<operation_list_9::list, Op>(), std::move(rs));
if (typelist::contains<operation_list_10::list, Op>())
return get_restriction_predicate_list_10(typelist::index_of<operation_list_10::list, Op>(), std::move(rs));
if (typelist::contains<operation_list_11::list, Op>())
return get_restriction_predicate_list_11(typelist::index_of<operation_list_11::list, Op>(), std::move(rs));
if (typelist::contains<operation_list_12::list, Op>())
return get_restriction_predicate_list_12(typelist::index_of<operation_list_12::list, Op>(), std::move(rs));
if (typelist::contains<virtual_operations_list::list, Op>())
FC_THROW_EXCEPTION( fc::assert_exception, "Virtual operations not allowed!" );

Expand All @@ -58,7 +64,8 @@ restriction_predicate_function get_restriction_predicate(vector<restriction> rs,
operation_list_3::list, operation_list_4::list,
operation_list_5::list, operation_list_6::list,
operation_list_7::list, operation_list_8::list,
operation_list_9::list,
operation_list_9::list, operation_list_10::list,
operation_list_11::list, operation_list_12::list,
virtual_operations_list::list>,
Op>(), "");
FC_THROW_EXCEPTION(fc::assert_exception,
Expand Down
Loading

0 comments on commit bf72fe9

Please sign in to comment.