From 1c0de74aa7d7ade30f09ba08fd7b1610bf02d866 Mon Sep 17 00:00:00 2001 From: Nathan Hourt Date: Fri, 21 Aug 2020 15:04:37 -0500 Subject: [PATCH] General fixes Fix warnings, build issues, unused code, etc. --- libraries/app/api.cpp | 2 +- libraries/app/application.cpp | 5 +- libraries/app/config_util.cpp | 4 +- libraries/app/database_api.cpp | 5 +- .../app/include/graphene/app/full_account.hpp | 1 - libraries/chain/account_evaluator.cpp | 2 +- libraries/chain/account_object.cpp | 2 +- libraries/chain/affiliate_payout.cpp | 10 +- libraries/chain/asset_evaluator.cpp | 1 - libraries/chain/asset_object.cpp | 2 +- libraries/chain/betting_market_object.cpp | 2 +- libraries/chain/db_bet.cpp | 12 +- libraries/chain/db_block.cpp | 6 +- libraries/chain/db_getter.cpp | 6 +- libraries/chain/db_init.cpp | 4 +- libraries/chain/db_maint.cpp | 31 +-- libraries/chain/db_market.cpp | 2 +- libraries/chain/db_update.cpp | 3 +- libraries/chain/db_witness_schedule.cpp | 6 +- libraries/chain/event_evaluator.cpp | 1 + libraries/chain/exceptions.cpp | 3 - libraries/chain/fork_database.cpp | 2 +- .../graphene/chain/affiliate_payout.hpp | 4 +- .../include/graphene/chain/asset_object.hpp | 9 +- .../chain/betting_market_evaluator.hpp | 2 +- .../graphene/chain/betting_market_object.hpp | 17 +- .../graphene/chain/block_summary_object.hpp | 3 +- .../graphene/chain/budget_record_object.hpp | 3 +- .../include/graphene/chain/buyback_object.hpp | 3 +- .../graphene/chain/chain_property_object.hpp | 1 + .../chain/committee_member_evaluator.hpp | 1 + .../chain/include/graphene/chain/config.hpp | 215 +----------------- .../chain/include/graphene/chain/database.hpp | 4 +- .../graphene/chain/event_evaluator.hpp | 4 +- .../graphene/chain/event_group_evaluator.hpp | 2 +- .../graphene/chain/event_group_object.hpp | 6 +- .../include/graphene/chain/event_object.hpp | 13 +- .../include/graphene/chain/exceptions.hpp | 3 - .../include/graphene/chain/game_object.hpp | 11 +- .../global_betting_statistics_object.hpp | 5 +- .../graphene/chain/global_property_object.hpp | 1 - .../chain/immutable_chain_parameters.hpp | 2 +- .../graphene/chain/lottery_evaluator.hpp | 2 +- .../include/graphene/chain/market_object.hpp | 1 - .../include/graphene/chain/match_object.hpp | 13 +- .../chain/operation_history_object.hpp | 136 +++++------ .../graphene/chain/rock_paper_scissors.hpp | 5 +- .../graphene/chain/sport_evaluator.hpp | 2 +- .../include/graphene/chain/sport_object.hpp | 5 +- .../graphene/chain/tournament_evaluator.hpp | 2 +- .../graphene/chain/tournament_object.hpp | 14 +- .../chain/transaction_evaluation_state.hpp | 2 +- .../chain/transaction_history_object.hpp | 3 + .../chain/include/graphene/chain/types.hpp | 14 +- .../graphene/chain/vesting_balance_object.hpp | 2 + .../chain/witness_schedule_object.hpp | 15 +- libraries/chain/proposal_evaluator.cpp | 8 +- libraries/chain/small_objects.cpp | 11 +- libraries/chain/tournament_evaluator.cpp | 5 +- libraries/chain/tournament_object.cpp | 9 +- libraries/chain/vesting_balance_evaluator.cpp | 1 + libraries/chain/vesting_balance_object.cpp | 2 +- libraries/net/include/graphene/net/node.hpp | 2 +- .../affiliate_stats/affiliate_stats_api.hpp | 4 +- .../affiliate_stats_objects.hpp | 4 +- libraries/plugins/bookie/bookie_api.cpp | 2 +- libraries/plugins/bookie/bookie_plugin.cpp | 3 +- .../include/graphene/bookie/bookie_api.hpp | 4 +- .../graphene/bookie/bookie_objects.hpp | 2 +- .../include/graphene/bookie/bookie_plugin.hpp | 4 +- .../delayed_node/delayed_node_plugin.cpp | 2 +- .../generate_genesis/generate_genesis.cpp | 10 +- .../include/graphene/witness/witness.hpp | 1 - libraries/protocol/account.cpp | 9 +- libraries/protocol/address.cpp | 2 +- libraries/protocol/betting_market.cpp | 6 +- libraries/protocol/block.cpp | 7 +- libraries/protocol/event.cpp | 6 +- libraries/protocol/event_group.cpp | 6 +- libraries/protocol/fee_schedule.cpp | 4 +- .../include/graphene/protocol/affiliate.hpp | 20 +- .../include/graphene/protocol/asset_ops.hpp | 61 +++-- .../graphene/protocol/betting_market.hpp | 71 +++--- .../graphene/protocol/chain_parameters.hpp | 10 +- .../include/graphene/protocol/config.hpp | 215 +++++++++++++----- .../include/graphene/protocol/event.hpp | 21 +- .../include/graphene/protocol/event_group.hpp | 19 +- .../include/graphene/protocol/exceptions.hpp | 18 +- .../graphene/protocol/fee_schedule.hpp | 4 - .../include/graphene/protocol/lottery_ops.hpp | 22 +- .../include/graphene/protocol/market.hpp | 3 +- .../include/graphene/protocol/protocol.hpp | 4 +- .../graphene/protocol/rock_paper_scissors.hpp | 22 +- .../include/graphene/protocol/sport.hpp | 19 +- .../include/graphene/protocol/tournament.hpp | 36 +-- .../include/graphene/protocol/transaction.hpp | 3 +- .../include/graphene/protocol/types.hpp | 36 +-- .../include/graphene/protocol/vesting.hpp | 1 - libraries/protocol/lottery_ops.cpp | 6 +- libraries/protocol/operations.cpp | 2 +- libraries/protocol/small_ops.cpp | 1 + libraries/protocol/sport.cpp | 6 +- libraries/protocol/tournament.cpp | 6 +- libraries/protocol/transaction.cpp | 4 +- libraries/protocol/witness.cpp | 1 - libraries/wallet/wallet.cpp | 2 +- programs/cli_wallet/main.cpp | 2 +- programs/js_operation_serializer/main.cpp | 17 +- tests/betting/betting_tests.cpp | 2 +- tests/common/database_fixture.hpp | 3 + tests/generate_empty_blocks/main.cpp | 2 +- tests/intense/block_tests.cpp | 2 +- tests/performance/performance_tests.cpp | 2 +- tests/tests/authority_tests.cpp | 2 +- tests/tests/basic_tests.cpp | 2 +- tests/tests/confidential_tests.cpp | 2 +- tests/tests/network_broadcast_api_tests.cpp | 5 +- tests/tournament/tournament_tests.cpp | 11 +- 118 files changed, 686 insertions(+), 730 deletions(-) diff --git a/libraries/app/api.cpp b/libraries/app/api.cpp index 0c78eb55..b4855e17 100644 --- a/libraries/app/api.cpp +++ b/libraries/app/api.cpp @@ -170,7 +170,7 @@ namespace graphene { namespace app { { auto block_num = b.block_num(); auto& callback = _callbacks.find(id)->second; - fc::async( [capture_this,this,id,block_num,trx_num,trx,callback]() { + fc::async( [capture_this,id,block_num,trx_num,trx,callback]() { callback( fc::variant( transaction_confirmation{ id, block_num, trx_num, trx }, GRAPHENE_MAX_NESTED_OBJECTS ) ); } ); diff --git a/libraries/app/application.cpp b/libraries/app/application.cpp index 4c83fe96..0ccb7ccb 100644 --- a/libraries/app/application.cpp +++ b/libraries/app/application.cpp @@ -226,7 +226,7 @@ namespace detail { void new_connection( const fc::http::websocket_connection_ptr& c ) { - auto wsc = std::make_shared(*c, GRAPHENE_MAX_NESTED_OBJECTS); + auto wsc = std::make_shared(c, GRAPHENE_MAX_NESTED_OBJECTS); auto login = std::make_shared( std::ref(*_self) ); login->enable_api("database_api"); @@ -380,7 +380,6 @@ namespace detail { _chain_db->enable_standby_votes_tracking( _options->at("enable-standby-votes-tracking").as() ); } - bool replay = false; std::string replay_reason = "reason not provided"; if( _options->count("replay-blockchain") ) @@ -554,7 +553,7 @@ namespace detail { _chain_db->push_transaction( transaction_message.trx ); } FC_CAPTURE_AND_RETHROW( (transaction_message) ) } - virtual void handle_message(const message& message_to_process) override + virtual void handle_message(const message&) override { // not a transaction, not a block FC_THROW( "Invalid Message Type" ); diff --git a/libraries/app/config_util.cpp b/libraries/app/config_util.cpp index f06291b7..75b73a53 100644 --- a/libraries/app/config_util.cpp +++ b/libraries/app/config_util.cpp @@ -210,7 +210,7 @@ static void load_config_file(const fc::path& config_ini_path, const bpo::options { deduplicator dedup; bpo::options_description unique_options("Graphene Witness Node"); - for( const boost::shared_ptr opt : cfg_options.options() ) + for( const boost::shared_ptr& opt : cfg_options.options() ) { const boost::shared_ptr od = dedup.next(opt); if( !od ) continue; @@ -259,7 +259,7 @@ static void create_new_config_file(const fc::path& config_ini_path, const fc::pa deduplicator dedup(modify_option_defaults); std::ofstream out_cfg(config_ini_path.preferred_string()); std::string plugin_header_surrounding( 78, '=' ); - for( const boost::shared_ptr opt : cfg_options.options() ) + for( const boost::shared_ptr& opt : cfg_options.options() ) { const boost::shared_ptr od = dedup.next(opt); if( !od ) continue; diff --git a/libraries/app/database_api.cpp b/libraries/app/database_api.cpp index 5cc6da24..0eef41ef 100644 --- a/libraries/app/database_api.cpp +++ b/libraries/app/database_api.cpp @@ -26,6 +26,8 @@ #include #include #include +#include + #include #include @@ -2330,10 +2332,9 @@ graphene::app::gpos_info database_api_impl::get_gpos_info(const account_id_type #endif vector account_vbos; - const time_point_sec now = _db.head_block_time(); auto vesting_range = _db.get_index_type().indices().get().equal_range(account); std::for_each(vesting_range.first, vesting_range.second, - [&account_vbos, now](const vesting_balance_object& balance) { + [&account_vbos](const vesting_balance_object& balance) { if(balance.balance.amount > 0 && balance.balance_type == vesting_balance_type::gpos && balance.balance.asset_id == asset_id_type()) account_vbos.emplace_back(balance); diff --git a/libraries/app/include/graphene/app/full_account.hpp b/libraries/app/include/graphene/app/full_account.hpp index d35c2b5c..7de9daf6 100644 --- a/libraries/app/include/graphene/app/full_account.hpp +++ b/libraries/app/include/graphene/app/full_account.hpp @@ -29,7 +29,6 @@ #include #include #include -#include namespace graphene { namespace app { using namespace graphene::chain; diff --git a/libraries/chain/account_evaluator.cpp b/libraries/chain/account_evaluator.cpp index 91e6f623..4ae8ec58 100644 --- a/libraries/chain/account_evaluator.cpp +++ b/libraries/chain/account_evaluator.cpp @@ -212,7 +212,7 @@ object_id_type account_create_evaluator::do_apply( const account_create_operatio if( dynamic_properties.accounts_registered_this_interval % global_properties.parameters.accounts_per_fee_scale == 0 && global_properties.parameters.account_fee_scale_bitshifts != 0 ) { - d.modify(global_properties, [&dynamic_properties](global_property_object& p) { + d.modify(global_properties, [](global_property_object& p) { p.parameters.current_fees->get().basic_fee <<= p.parameters.account_fee_scale_bitshifts; }); } diff --git a/libraries/chain/account_object.cpp b/libraries/chain/account_object.cpp index 30f3be14..15a41443 100644 --- a/libraries/chain/account_object.cpp +++ b/libraries/chain/account_object.cpp @@ -39,7 +39,7 @@ share_type cut_fee(share_type a, uint16_t p) fc::uint128_t r = a.value; r *= p; r /= GRAPHENE_100_PERCENT; - return r.convert_to(); + return r; } void account_balance_object::adjust_balance(const asset& delta) diff --git a/libraries/chain/affiliate_payout.cpp b/libraries/chain/affiliate_payout.cpp index 3138117c..9375f5b1 100644 --- a/libraries/chain/affiliate_payout.cpp +++ b/libraries/chain/affiliate_payout.cpp @@ -62,15 +62,15 @@ namespace graphene { namespace chain { //ilog("Paying ${p} of ${P} for ${s} of ${r}", ("p",payout.to_uint64())("P",to_pay.value)("s",share)("r",remaining) ); remaining -= share; } - FC_ASSERT( payout.to_uint64() <= to_pay ); + FC_ASSERT( payout <= to_pay ); if( payout > 0 ) { if ( accumulator.find(affiliate) == accumulator.end() ) - accumulator[affiliate] = payout.to_uint64(); + accumulator[affiliate] = payout; else - accumulator[affiliate] += payout.to_uint64(); - to_pay -= payout.to_uint64(); - paid += payout.to_uint64(); + accumulator[affiliate] += payout; + to_pay -= payout; + paid += payout; } } FC_ASSERT( to_pay == 0 ); diff --git a/libraries/chain/asset_evaluator.cpp b/libraries/chain/asset_evaluator.cpp index 7a26a2cb..cb90a89b 100644 --- a/libraries/chain/asset_evaluator.cpp +++ b/libraries/chain/asset_evaluator.cpp @@ -593,7 +593,6 @@ void_result asset_update_dividend_evaluator::do_apply( const asset_update_divide obj.referrer = op.issuer; obj.lifetime_referrer = op.issuer(db()).lifetime_referrer; - auto& params = db().get_global_properties().parameters; obj.network_fee_percentage = GRAPHENE_DEFAULT_NETWORK_PERCENT_OF_FEE; obj.lifetime_referrer_fee_percentage = GRAPHENE_DEFAULT_LIFETIME_REFERRER_PERCENT_OF_FEE; obj.referrer_rewards_percentage = GRAPHENE_DEFAULT_LIFETIME_REFERRER_PERCENT_OF_FEE; diff --git a/libraries/chain/asset_object.cpp b/libraries/chain/asset_object.cpp index b074775a..56a1d947 100644 --- a/libraries/chain/asset_object.cpp +++ b/libraries/chain/asset_object.cpp @@ -42,7 +42,7 @@ share_type asset_bitasset_data_object::max_force_settlement_volume(share_type cu volume += force_settled_volume.value; volume *= options.maximum_force_settlement_volume; volume /= GRAPHENE_100_PERCENT; - return volume.convert_to(); + return volume; } void asset_bitasset_data_object::update_median_feeds(time_point_sec current_time) diff --git a/libraries/chain/betting_market_object.cpp b/libraries/chain/betting_market_object.cpp index d5efd56c..75613233 100644 --- a/libraries/chain/betting_market_object.cpp +++ b/libraries/chain/betting_market_object.cpp @@ -75,7 +75,7 @@ namespace mpl = boost::mpl; amount_to_match_128 += backer_multiplier - GRAPHENE_BETTING_ODDS_PRECISION - 1; amount_to_match_128 /= backer_multiplier - GRAPHENE_BETTING_ODDS_PRECISION; } - return amount_to_match_128.to_uint64(); + return amount_to_match_128; } share_type bet_object::get_approximate_matching_amount(bool round_up /* = false */) const diff --git a/libraries/chain/db_bet.cpp b/libraries/chain/db_bet.cpp index 8c3e1357..f0557aeb 100644 --- a/libraries/chain/db_bet.cpp +++ b/libraries/chain/db_bet.cpp @@ -29,6 +29,8 @@ #include #include +#include + #include #include #include @@ -132,7 +134,7 @@ void database::resolve_betting_market_group(const betting_market_group_object& b bool group_was_canceled = resolutions.begin()->second == betting_market_resolution_type::cancel; if (group_was_canceled) - modify(betting_market_group, [group_was_canceled,this](betting_market_group_object& betting_market_group_obj) { + modify(betting_market_group, [this](betting_market_group_object& betting_market_group_obj) { betting_market_group_obj.on_canceled_event(*this, false); // this cancels the betting markets }); else { @@ -149,7 +151,7 @@ void database::resolve_betting_market_group(const betting_market_group_object& b }); } - modify(betting_market_group, [group_was_canceled,this](betting_market_group_object& betting_market_group_obj) { + modify(betting_market_group, [this](betting_market_group_object& betting_market_group_obj) { betting_market_group_obj.on_graded_event(*this); }); } @@ -263,7 +265,7 @@ void database::settle_betting_market_group(const betting_market_group_object& be share_type rake_amount; if (net_profits.value > 0 && rake_account_id) { - rake_amount = ((fc::uint128_t(net_profits.value) * rake_fee_percentage + GRAPHENE_100_PERCENT - 1) / GRAPHENE_100_PERCENT).to_uint64(); + rake_amount = ((fc::uint128_t(net_profits.value) * rake_fee_percentage + GRAPHENE_100_PERCENT - 1) / GRAPHENE_100_PERCENT); share_type affiliates_share; if (rake_amount.value) affiliates_share = payout_helper.payout( bettor_id, rake_amount ); @@ -303,7 +305,8 @@ void database::settle_betting_market_group(const betting_market_group_object& be remove(betting_market); } - const event_object& event = betting_market_group.event_id(*this); + // Fetch to check for existence + betting_market_group.event_id(*this); fc_dlog(fc::logger::get("betting"), "removing betting market group ${id}", ("id", betting_market_group.id)); remove(betting_market_group); @@ -537,7 +540,6 @@ int match_bet(database& db, const bet_object& taker_bet, const bet_object& maker // because we matched at the maker's odds and not the taker's odds, the remaining amount to match // may not be an even multiple of the taker's odds; round it down. share_type taker_remaining_factor = unrounded_taker_remaining_amount_to_match / takers_odds_maker_odds_ratio; - share_type taker_remaining_maker_amount_to_match = taker_remaining_factor * takers_odds_maker_odds_ratio; share_type taker_remaining_bet_amount = taker_remaining_factor * takers_odds_taker_odds_ratio; taker_refund_amount = taker_bet.amount_to_bet.amount - taker_amount_to_match - taker_remaining_bet_amount; diff --git a/libraries/chain/db_block.cpp b/libraries/chain/db_block.cpp index 8360149f..41821baf 100644 --- a/libraries/chain/db_block.cpp +++ b/libraries/chain/db_block.cpp @@ -26,9 +26,6 @@ #include #include -#include -#include - #include #include #include @@ -38,8 +35,11 @@ #include #include #include +#include #include +#include +#include namespace { diff --git a/libraries/chain/db_getter.cpp b/libraries/chain/db_getter.cpp index ac31d437..73705a81 100644 --- a/libraries/chain/db_getter.cpp +++ b/libraries/chain/db_getter.cpp @@ -110,13 +110,15 @@ std::vector database::get_seeds(asset_id_type for_asset, uint8_t count { FC_ASSERT( count_winners <= 64 ); std::string salted_string = std::string(_random_number_generator._seed) + std::to_string(for_asset.instance.value); - uint32_t* seeds = (uint32_t*)(fc::sha256::hash(salted_string)._hash); + auto seeds_hash = fc::sha256::hash(salted_string); + uint32_t* seeds = (uint32_t*)(seeds_hash._hash); std::vector result; result.reserve(64); for( int s = 0; s < 8; ++s ) { - uint32_t* sub_seeds = ( uint32_t* ) fc::sha256::hash( std::to_string( seeds[s] ) + std::to_string( for_asset.instance.value ) )._hash; + auto sub_seeds_hash = fc::sha256::hash(std::to_string(seeds[s]) + std::to_string(for_asset.instance.value)); + uint32_t* sub_seeds = (uint32_t*) sub_seeds_hash._hash; for( int ss = 0; ss < 8; ++ss ) { result.push_back(sub_seeds[ss]); } diff --git a/libraries/chain/db_init.cpp b/libraries/chain/db_init.cpp index 0de70a0b..5a744320 100644 --- a/libraries/chain/db_init.cpp +++ b/libraries/chain/db_init.cpp @@ -834,7 +834,7 @@ void database::init_genesis(const genesis_state_type& genesis_state) for( const auto& handout : genesis_state.initial_balances ) { const auto asset_id = get_asset_id(handout.asset_symbol); - create([&handout,&get_asset_id,total_allocation,asset_id](balance_object& b) { + create([&handout,total_allocation,asset_id](balance_object& b) { b.balance = asset(handout.amount, asset_id); b.owner = handout.owner; }); @@ -986,7 +986,7 @@ void database::init_genesis(const genesis_state_type& genesis_state) _wso.last_scheduling_block = 0; - _wso.recent_slots_filled = fc::uint128_t::max_value(); + _wso.recent_slots_filled = std::numeric_limits::max(); // for shuffled for( const witness_id_type& wid : get_global_properties().active_witnesses ) diff --git a/libraries/chain/db_maint.cpp b/libraries/chain/db_maint.cpp index dacb7c5c..c7d6c32a 100644 --- a/libraries/chain/db_maint.cpp +++ b/libraries/chain/db_maint.cpp @@ -22,10 +22,6 @@ * THE SOFTWARE. */ -#include - -#include - #include #include #include @@ -48,6 +44,12 @@ #include #include +#include + +#include + +#include + #define USE_VESTING_OBJECT_BY_ASSET_BALANCE_INDEX // vesting_balance_object by_asset_balance index needed namespace graphene { namespace chain { @@ -163,7 +165,7 @@ void database::pay_workers( share_type& budget ) // worker with more votes is preferred // if two workers exactly tie for votes, worker with lower ID is preferred - std::sort(active_workers.begin(), active_workers.end(), [this](const worker_object& wa, const worker_object& wb) { + std::sort(active_workers.begin(), active_workers.end(), [](const worker_object& wa, const worker_object& wb) { share_type wa_vote = wa.approving_stake(); share_type wb_vote = wb.approving_stake(); if( wa_vote != wb_vote ) @@ -186,7 +188,7 @@ void database::pay_workers( share_type& budget ) fc::uint128_t pay = requested_pay.value; pay *= passed_time_count; pay /= day_count; - requested_pay = pay.convert_to(); + requested_pay = pay; share_type actual_pay = std::min(budget, requested_pay); //ilog(" ==> Paying ${a} to worker ${w}", ("w", active_worker.id)("a", actual_pay)); @@ -435,7 +437,7 @@ void database::initialize_budget_record( fc::time_point_sec now, budget_record& budget_u128 >>= GRAPHENE_CORE_ASSET_CYCLE_RATE_BITS; share_type budget; if( budget_u128 < reserve.value ) - rec.total_budget = share_type(budget_u128.convert_to()); + rec.total_budget = share_type(budget_u128); else rec.total_budget = reserve; @@ -490,7 +492,7 @@ void database::process_budget() if( worker_budget_u128 >= available_funds.value ) worker_budget = available_funds; else - worker_budget = worker_budget_u128.convert_to(); + worker_budget = worker_budget_u128; rec.worker_budget = worker_budget; available_funds -= worker_budget; @@ -630,12 +632,12 @@ void split_fba_balance( fc::uint128_t buyback_amount_128 = fba.accumulated_fba_fees.value; buyback_amount_128 *= designated_asset_buyback_pct; buyback_amount_128 /= GRAPHENE_100_PERCENT; - share_type buyback_amount = buyback_amount_128.convert_to(); + share_type buyback_amount = buyback_amount_128; fc::uint128_t issuer_amount_128 = fba.accumulated_fba_fees.value; issuer_amount_128 *= designated_asset_issuer_pct; issuer_amount_128 /= GRAPHENE_100_PERCENT; - share_type issuer_amount = issuer_amount_128.convert_to(); + share_type issuer_amount = issuer_amount_128; // this assert should never fail FC_ASSERT( buyback_amount + issuer_amount <= fba.accumulated_fba_fees ); @@ -1121,7 +1123,7 @@ void schedule_pending_dividend_balances(database& db, minimum_amount_to_distribute *= 100 * GRAPHENE_1_PERCENT; minimum_amount_to_distribute /= dividend_data.options.minimum_fee_percentage; wdump((total_fee_per_asset_in_payout_asset)(dividend_data.options)); - minimum_shares_to_distribute = minimum_amount_to_distribute.to_uint64(); + minimum_shares_to_distribute = minimum_amount_to_distribute; } dlog("Processing dividend payments of asset type ${payout_asset_type}, delta balance is ${delta_balance}", ("payout_asset_type", payout_asset_type(db).symbol)("delta_balance", delta_balance)); @@ -1183,7 +1185,7 @@ void schedule_pending_dividend_balances(database& db, fc::uint128_t amount_to_credit(delta_balance.value); amount_to_credit *= holder_balance.amount.value; amount_to_credit /= total_balance_of_dividend_asset.value; - share_type full_shares_to_credit((int64_t) amount_to_credit.to_uint64()); + share_type full_shares_to_credit((int64_t) amount_to_credit); share_type shares_to_credit = (uint64_t) floor(full_shares_to_credit.value * vesting_factor); if (shares_to_credit < full_shares_to_credit) { @@ -1220,7 +1222,7 @@ void schedule_pending_dividend_balances(database& db, fc::uint128_t amount_to_credit(delta_balance.value); amount_to_credit *= holder_balance.value; amount_to_credit /= total_balance_of_dividend_asset.value; - share_type shares_to_credit((int64_t) amount_to_credit.to_uint64()); + share_type shares_to_credit((int64_t) amount_to_credit); remaining_amount_to_distribute = credit_account(db, holder_balance_object.owner, @@ -1280,7 +1282,7 @@ void schedule_pending_dividend_balances(database& db, fc::uint128_t amount_to_debit(remaining_amount_to_recover.value); amount_to_debit *= pending_balance_object.pending_balance.value; amount_to_debit /= remaining_pending_balances.value; - share_type shares_to_debit((int64_t)amount_to_debit.to_uint64()); + share_type shares_to_debit((int64_t)amount_to_debit); remaining_amount_to_recover -= shares_to_debit; remaining_pending_balances -= pending_balance_object.pending_balance; @@ -1466,7 +1468,6 @@ void process_dividend_assets(database& db) { // if there was a previous payout, make our next payment one interval uint32_t current_time_sec = current_head_block_time.sec_since_epoch(); - fc::time_point_sec reference_time = *dividend_data_obj.last_scheduled_payout_time; uint32_t next_possible_time_sec = dividend_data_obj.last_scheduled_payout_time->sec_since_epoch(); do next_possible_time_sec += *dividend_data_obj.options.payout_interval; diff --git a/libraries/chain/db_market.cpp b/libraries/chain/db_market.cpp index 49376f98..9f614815 100644 --- a/libraries/chain/db_market.cpp +++ b/libraries/chain/db_market.cpp @@ -578,7 +578,7 @@ asset database::calculate_market_fee( const asset_object& trade_asset, const ass fc::uint128_t a(trade_amount.amount.value); a *= trade_asset.options.market_fee_percent; a /= GRAPHENE_100_PERCENT; - asset percent_fee = trade_asset.amount(a.to_uint64()); + asset percent_fee = trade_asset.amount(a); if( percent_fee.amount > trade_asset.options.max_market_fee ) percent_fee.amount = trade_asset.options.max_market_fee; diff --git a/libraries/chain/db_update.cpp b/libraries/chain/db_update.cpp index acac1b91..21fdbc15 100644 --- a/libraries/chain/db_update.cpp +++ b/libraries/chain/db_update.cpp @@ -44,7 +44,6 @@ namespace graphene { namespace chain { void database::update_global_dynamic_data( const signed_block& b, const uint32_t missed_blocks ) { const dynamic_global_property_object& _dgp = get_dynamic_global_properties(); - const global_property_object& gpo = get_global_properties(); // dynamic global properties updating modify( _dgp, [&b,this,missed_blocks]( dynamic_global_property_object& dgp ){ @@ -424,7 +423,7 @@ void database::clear_expired_orders() auto& pays = order.balance; auto receives = (order.balance * mia.current_feed.settlement_price); receives.amount = (fc::uint128_t(receives.amount.value) * - (GRAPHENE_100_PERCENT - mia.options.force_settlement_offset_percent) / GRAPHENE_100_PERCENT).to_uint64(); + (GRAPHENE_100_PERCENT - mia.options.force_settlement_offset_percent) / GRAPHENE_100_PERCENT); assert(receives <= order.balance * mia.current_feed.settlement_price); price settlement_price = pays / receives; diff --git a/libraries/chain/db_witness_schedule.cpp b/libraries/chain/db_witness_schedule.cpp index 804fa46c..d70ea90b 100644 --- a/libraries/chain/db_witness_schedule.cpp +++ b/libraries/chain/db_witness_schedule.cpp @@ -191,7 +191,7 @@ void database::update_witness_schedule(const signed_block& next_block) modify(wso, [&](witness_schedule_object& _wso) { _wso.slots_since_genesis += schedule_slot; - witness_scheduler_rng rng(wso.rng_seed.data, _wso.slots_since_genesis); + witness_scheduler_rng rng(wso.rng_seed.data(), _wso.slots_since_genesis); _wso.scheduler._min_token_count = std::max(int(gpo.active_witnesses.size()) / 2, 1); @@ -250,12 +250,12 @@ uint32_t database::witness_participation_rate()const if (gpo.parameters.witness_schedule_algorithm == GRAPHENE_WITNESS_SHUFFLED_ALGORITHM) { const dynamic_global_property_object& dpo = get_dynamic_global_properties(); - return uint64_t(GRAPHENE_100_PERCENT) * dpo.recent_slots_filled.popcount() / 128; + return uint64_t(GRAPHENE_100_PERCENT) * fc::popcount(dpo.recent_slots_filled) / 128; } if (gpo.parameters.witness_schedule_algorithm == GRAPHENE_WITNESS_SCHEDULED_ALGORITHM) { const witness_schedule_object& wso = get_witness_schedule_object(); - return uint64_t(GRAPHENE_100_PERCENT) * wso.recent_slots_filled.popcount() / 128; + return uint64_t(GRAPHENE_100_PERCENT) * fc::popcount(wso.recent_slots_filled) / 128; } return 0; } diff --git a/libraries/chain/event_evaluator.cpp b/libraries/chain/event_evaluator.cpp index 28e7476d..9c2ba9f1 100644 --- a/libraries/chain/event_evaluator.cpp +++ b/libraries/chain/event_evaluator.cpp @@ -29,6 +29,7 @@ #include #include #include +#include namespace graphene { namespace chain { diff --git a/libraries/chain/exceptions.cpp b/libraries/chain/exceptions.cpp index 68606a91..9009a80c 100644 --- a/libraries/chain/exceptions.cpp +++ b/libraries/chain/exceptions.cpp @@ -127,9 +127,6 @@ namespace graphene { namespace chain { //GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS( bid_collateral_operation ) //GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS( asset_claim_pool_operation ) //GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS( asset_update_issuer_operation ) - //GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS( htlc_create_operation ) - //GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS( htlc_redeem_operation ) - //GRAPHENE_IMPLEMENT_OP_BASE_EXCEPTIONS( htlc_extend_operation ) #define GRAPHENE_RECODE_EXC( cause_type, effect_type ) \ catch( const cause_type& e ) \ diff --git a/libraries/chain/fork_database.cpp b/libraries/chain/fork_database.cpp index 1cb4f77b..b6c72221 100644 --- a/libraries/chain/fork_database.cpp +++ b/libraries/chain/fork_database.cpp @@ -23,7 +23,7 @@ */ #include #include -#include +#include namespace graphene { namespace chain { fork_database::fork_database() diff --git a/libraries/chain/include/graphene/chain/affiliate_payout.hpp b/libraries/chain/include/graphene/chain/affiliate_payout.hpp index 1c0ea703..d69d398b 100644 --- a/libraries/chain/include/graphene/chain/affiliate_payout.hpp +++ b/libraries/chain/include/graphene/chain/affiliate_payout.hpp @@ -23,8 +23,8 @@ */ #pragma once -#include -#include +#include +#include #include #include diff --git a/libraries/chain/include/graphene/chain/asset_object.hpp b/libraries/chain/include/graphene/chain/asset_object.hpp index 02a25db5..60741410 100644 --- a/libraries/chain/include/graphene/chain/asset_object.hpp +++ b/libraries/chain/include/graphene/chain/asset_object.hpp @@ -40,6 +40,7 @@ namespace graphene { namespace chain { class account_object; class asset_bitasset_data_object; + class asset_dividend_data_object; class database; class transaction_evaluation_state; using namespace graphene::db; @@ -371,7 +372,7 @@ namespace graphene { namespace chain { { public: static const uint8_t space_id = implementation_ids; - static const uint8_t type_id = impl_asset_dividend_data_type; + static const uint8_t type_id = impl_asset_dividend_data_object_type; /// The tunable options for Dividend-paying assets are stored in this field. dividend_asset_options options; @@ -415,7 +416,7 @@ namespace graphene { namespace chain { { public: static const uint8_t space_id = implementation_ids; - static const uint8_t type_id = impl_distributed_dividend_balance_data_type; + static const uint8_t type_id = impl_total_distributed_dividend_balance_object_type; asset_id_type dividend_holder_asset_type; asset_id_type dividend_payout_asset_type; @@ -517,6 +518,10 @@ namespace graphene { namespace chain { MAP_OBJECT_ID_TO_TYPE(graphene::chain::asset_object) MAP_OBJECT_ID_TO_TYPE(graphene::chain::asset_dynamic_data_object) MAP_OBJECT_ID_TO_TYPE(graphene::chain::asset_bitasset_data_object) +MAP_OBJECT_ID_TO_TYPE(graphene::chain::asset_dividend_data_object) +MAP_OBJECT_ID_TO_TYPE(graphene::chain::total_distributed_dividend_balance_object) +MAP_OBJECT_ID_TO_TYPE(graphene::chain::lottery_balance_object) +MAP_OBJECT_ID_TO_TYPE(graphene::chain::sweeps_vesting_balance_object) FC_REFLECT_DERIVED( graphene::chain::asset_dynamic_data_object, (graphene::db::object), (current_supply)(sweeps_tickets_sold)(confidential_supply)(accumulated_fees)(fee_pool) ) diff --git a/libraries/chain/include/graphene/chain/betting_market_evaluator.hpp b/libraries/chain/include/graphene/chain/betting_market_evaluator.hpp index eb245c4a..36a516d7 100644 --- a/libraries/chain/include/graphene/chain/betting_market_evaluator.hpp +++ b/libraries/chain/include/graphene/chain/betting_market_evaluator.hpp @@ -23,7 +23,7 @@ */ #pragma once -#include +#include #include #include diff --git a/libraries/chain/include/graphene/chain/betting_market_object.hpp b/libraries/chain/include/graphene/chain/betting_market_object.hpp index 36e8e664..bceb5863 100644 --- a/libraries/chain/include/graphene/chain/betting_market_object.hpp +++ b/libraries/chain/include/graphene/chain/betting_market_object.hpp @@ -23,14 +23,17 @@ */ #pragma once -#include +#include + +#include + #include #include -#include -#include #include +#include + namespace graphene { namespace chain { class betting_market_object; class betting_market_group_object; @@ -45,7 +48,7 @@ namespace fc { namespace graphene { namespace chain { -FC_DECLARE_EXCEPTION(no_transition, 100000, "Invalid state transition"); +FC_DECLARE_EXCEPTION(no_transition, 100000); class database; struct by_event_id; @@ -717,6 +720,12 @@ inline Stream& operator>>( Stream& s, betting_market_group_object& betting_marke } } // graphene::chain +MAP_OBJECT_ID_TO_TYPE(graphene::chain::betting_market_rules_object) +MAP_OBJECT_ID_TO_TYPE(graphene::chain::betting_market_group_object) +MAP_OBJECT_ID_TO_TYPE(graphene::chain::betting_market_object) +MAP_OBJECT_ID_TO_TYPE(graphene::chain::bet_object) +MAP_OBJECT_ID_TO_TYPE(graphene::chain::betting_market_position_object) + FC_REFLECT_DERIVED( graphene::chain::betting_market_rules_object, (graphene::db::object), (name)(description) ) FC_REFLECT_DERIVED( graphene::chain::betting_market_group_object, (graphene::db::object), (description) ) FC_REFLECT_DERIVED( graphene::chain::betting_market_object, (graphene::db::object), (group_id) ) diff --git a/libraries/chain/include/graphene/chain/block_summary_object.hpp b/libraries/chain/include/graphene/chain/block_summary_object.hpp index 62be251d..70fc5262 100644 --- a/libraries/chain/include/graphene/chain/block_summary_object.hpp +++ b/libraries/chain/include/graphene/chain/block_summary_object.hpp @@ -22,7 +22,8 @@ * THE SOFTWARE. */ #pragma once -#include +#include + #include namespace graphene { namespace chain { diff --git a/libraries/chain/include/graphene/chain/budget_record_object.hpp b/libraries/chain/include/graphene/chain/budget_record_object.hpp index 82cd8c76..607f589f 100644 --- a/libraries/chain/include/graphene/chain/budget_record_object.hpp +++ b/libraries/chain/include/graphene/chain/budget_record_object.hpp @@ -22,7 +22,8 @@ * THE SOFTWARE. */ #pragma once -#include +#include + #include #include diff --git a/libraries/chain/include/graphene/chain/buyback_object.hpp b/libraries/chain/include/graphene/chain/buyback_object.hpp index 3de8b039..fa673e3b 100644 --- a/libraries/chain/include/graphene/chain/buyback_object.hpp +++ b/libraries/chain/include/graphene/chain/buyback_object.hpp @@ -23,7 +23,8 @@ */ #pragma once -#include +#include + #include #include diff --git a/libraries/chain/include/graphene/chain/chain_property_object.hpp b/libraries/chain/include/graphene/chain/chain_property_object.hpp index d0c9e28d..e9b7dc8f 100644 --- a/libraries/chain/include/graphene/chain/chain_property_object.hpp +++ b/libraries/chain/include/graphene/chain/chain_property_object.hpp @@ -24,6 +24,7 @@ #pragma once #include +#include namespace graphene { namespace chain { diff --git a/libraries/chain/include/graphene/chain/committee_member_evaluator.hpp b/libraries/chain/include/graphene/chain/committee_member_evaluator.hpp index ec55b1d7..388a4364 100644 --- a/libraries/chain/include/graphene/chain/committee_member_evaluator.hpp +++ b/libraries/chain/include/graphene/chain/committee_member_evaluator.hpp @@ -24,6 +24,7 @@ #pragma once #include #include +#include namespace graphene { namespace chain { diff --git a/libraries/chain/include/graphene/chain/config.hpp b/libraries/chain/include/graphene/chain/config.hpp index 9b9b6dce..1aa5b86b 100644 --- a/libraries/chain/include/graphene/chain/config.hpp +++ b/libraries/chain/include/graphene/chain/config.hpp @@ -25,224 +25,13 @@ #include -#define GRAPHENE_SYMBOL "TEST" -#define GRAPHENE_ADDRESS_PREFIX "TEST" - -#define GRAPHENE_MIN_ACCOUNT_NAME_LENGTH 1 -#define GRAPHENE_MAX_ACCOUNT_NAME_LENGTH 63 - -#define GRAPHENE_MIN_ASSET_SYMBOL_LENGTH 3 -#define GRAPHENE_MAX_ASSET_SYMBOL_LENGTH 16 - -#define GRAPHENE_MAX_SHARE_SUPPLY int64_t(1000000000000000ll) -#define GRAPHENE_MAX_PAY_RATE 10000 /* 100% */ -#define GRAPHENE_MAX_SIG_CHECK_DEPTH 2 -/** - * Don't allow the committee_members to publish a limit that would - * make the network unable to operate. - */ -#define GRAPHENE_MIN_TRANSACTION_SIZE_LIMIT 1024 -#define GRAPHENE_MIN_BLOCK_INTERVAL 1 /* seconds */ -#define GRAPHENE_MAX_BLOCK_INTERVAL 30 /* seconds */ - -#define GRAPHENE_DEFAULT_BLOCK_INTERVAL 3 /* seconds */ -#define GRAPHENE_DEFAULT_MAX_TRANSACTION_SIZE 2048 -#define GRAPHENE_DEFAULT_MAX_BLOCK_SIZE (GRAPHENE_DEFAULT_MAX_TRANSACTION_SIZE*GRAPHENE_DEFAULT_BLOCK_INTERVAL*200000) -#define GRAPHENE_DEFAULT_MAX_TIME_UNTIL_EXPIRATION (60*60*24) // seconds, aka: 1 day -#define GRAPHENE_DEFAULT_MAINTENANCE_INTERVAL (60*60*24) // seconds, aka: 1 day -#define GRAPHENE_DEFAULT_MAINTENANCE_SKIP_SLOTS 3 // number of slots to skip for maintenance interval - #define GRAPHENE_MIN_UNDO_HISTORY 10 #define GRAPHENE_MAX_UNDO_HISTORY 10000 -#define GRAPHENE_MIN_BLOCK_SIZE_LIMIT (GRAPHENE_MIN_TRANSACTION_SIZE_LIMIT*5) // 5 transactions per block -#define GRAPHENE_MIN_TRANSACTION_EXPIRATION_LIMIT (GRAPHENE_MAX_BLOCK_INTERVAL * 5) // 5 transactions per block -#define GRAPHENE_BLOCKCHAIN_PRECISION uint64_t( 100000 ) +#define GRAPHENE_MAX_NESTED_OBJECTS (200) -#define GRAPHENE_BLOCKCHAIN_PRECISION_DIGITS 5 -#define GRAPHENE_DEFAULT_TRANSFER_FEE (1*GRAPHENE_BLOCKCHAIN_PRECISION) -#define GRAPHENE_MAX_INSTANCE_ID (uint64_t(-1)>>16) -/** percentage fields are fixed point with a denominator of 10,000 */ -#define GRAPHENE_100_PERCENT 10000 -#define GRAPHENE_1_PERCENT (GRAPHENE_100_PERCENT/100) -/** NOTE: making this a power of 2 (say 2^15) would greatly accelerate fee calcs */ -#define GRAPHENE_MAX_MARKET_FEE_PERCENT GRAPHENE_100_PERCENT -#define GRAPHENE_DEFAULT_FORCE_SETTLEMENT_DELAY (60*60*24) ///< 1 day -#define GRAPHENE_DEFAULT_FORCE_SETTLEMENT_OFFSET 0 ///< 1% -#define GRAPHENE_DEFAULT_FORCE_SETTLEMENT_MAX_VOLUME (20* GRAPHENE_1_PERCENT) ///< 20% -#define GRAPHENE_DEFAULT_PRICE_FEED_LIFETIME (60*60*24) ///< 1 day -#define GRAPHENE_MAX_FEED_PRODUCERS 200 -#define GRAPHENE_DEFAULT_MAX_AUTHORITY_MEMBERSHIP 10 -#define GRAPHENE_DEFAULT_MAX_ASSET_WHITELIST_AUTHORITIES 10 -#define GRAPHENE_DEFAULT_MAX_ASSET_FEED_PUBLISHERS 10 - -/** - * These ratios are fixed point numbers with a denominator of GRAPHENE_COLLATERAL_RATIO_DENOM, the - * minimum maitenance collateral is therefore 1.001x and the default - * maintenance ratio is 1.75x - */ -///@{ -#define GRAPHENE_COLLATERAL_RATIO_DENOM 1000 -#define GRAPHENE_MIN_COLLATERAL_RATIO 1001 ///< lower than this could result in divide by 0 -#define GRAPHENE_MAX_COLLATERAL_RATIO 32000 ///< higher than this is unnecessary and may exceed int16 storage -#define GRAPHENE_DEFAULT_MAINTENANCE_COLLATERAL_RATIO 1750 ///< Call when collateral only pays off 175% the debt -#define GRAPHENE_DEFAULT_MAX_SHORT_SQUEEZE_RATIO 1500 ///< Stop calling when collateral only pays off 150% of the debt -///@} -#define GRAPHENE_DEFAULT_MARGIN_PERIOD_SEC (30*60*60*24) - -#define GRAPHENE_DEFAULT_MIN_WITNESS_COUNT (11) -#define GRAPHENE_DEFAULT_MIN_COMMITTEE_MEMBER_COUNT (11) -#define GRAPHENE_DEFAULT_MAX_WITNESSES (1001) // SHOULD BE ODD -#define GRAPHENE_DEFAULT_MAX_COMMITTEE (1001) // SHOULD BE ODD -#define GRAPHENE_DEFAULT_MAX_PROPOSAL_LIFETIME_SEC (60*60*24*7*4) // Four weeks -#define GRAPHENE_DEFAULT_COMMITTEE_PROPOSAL_REVIEW_PERIOD_SEC (60*60*24*7*2) // Two weeks -#define GRAPHENE_DEFAULT_NETWORK_PERCENT_OF_FEE (20*GRAPHENE_1_PERCENT) -#define GRAPHENE_DEFAULT_LIFETIME_REFERRER_PERCENT_OF_FEE (30*GRAPHENE_1_PERCENT) -#define GRAPHENE_DEFAULT_MAX_BULK_DISCOUNT_PERCENT (50*GRAPHENE_1_PERCENT) -#define GRAPHENE_DEFAULT_BULK_DISCOUNT_THRESHOLD_MIN ( GRAPHENE_BLOCKCHAIN_PRECISION*int64_t(1000) ) -#define GRAPHENE_DEFAULT_BULK_DISCOUNT_THRESHOLD_MAX ( GRAPHENE_DEFAULT_BULK_DISCOUNT_THRESHOLD_MIN*int64_t(100) ) -#define GRAPHENE_DEFAULT_CASHBACK_VESTING_PERIOD_SEC (60*60*24*365) ///< 1 year -#define GRAPHENE_DEFAULT_CASHBACK_VESTING_THRESHOLD (GRAPHENE_BLOCKCHAIN_PRECISION*int64_t(100)) -#define GRAPHENE_DEFAULT_BURN_PERCENT_OF_FEE (20*GRAPHENE_1_PERCENT) -#define GRAPHENE_WITNESS_PAY_PERCENT_PRECISION (1000000000) -#define GRAPHENE_DEFAULT_MAX_ASSERT_OPCODE 1 -#define GRAPHENE_DEFAULT_FEE_LIQUIDATION_THRESHOLD GRAPHENE_BLOCKCHAIN_PRECISION * 100; -#define GRAPHENE_DEFAULT_ACCOUNTS_PER_FEE_SCALE 1000 -#define GRAPHENE_DEFAULT_ACCOUNT_FEE_SCALE_BITSHIFTS 4 -#define GRAPHENE_DEFAULT_MAX_BUYBACK_MARKETS 4 - -#define GRAPHENE_MAX_WORKER_NAME_LENGTH 63 - -#define GRAPHENE_MAX_URL_LENGTH 127 - -#define GRAPHENE_WITNESS_SHUFFLED_ALGORITHM 0 -#define GRAPHENE_WITNESS_SCHEDULED_ALGORITHM 1 - -// counter initialization values used to derive near and far future seeds for shuffling witnesses -// we use the fractional bits of sqrt(2) in hex -#define GRAPHENE_NEAR_SCHEDULE_CTR_IV ( (uint64_t( 0x6a09 ) << 0x30) \ - | (uint64_t( 0xe667 ) << 0x20) \ - | (uint64_t( 0xf3bc ) << 0x10) \ - | (uint64_t( 0xc908 ) ) ) - -// and the fractional bits of sqrt(3) in hex -#define GRAPHENE_FAR_SCHEDULE_CTR_IV ( (uint64_t( 0xbb67 ) << 0x30) \ - | (uint64_t( 0xae85 ) << 0x20) \ - | (uint64_t( 0x84ca ) << 0x10) \ - | (uint64_t( 0xa73b ) ) ) - -// counter used to determine bits of entropy -// must be less than or equal to secret_hash_type::data_length() -#define GRAPHENE_RNG_SEED_LENGTH (160 / 8) - -/** - * every second, the fraction of burned core asset which cycles is - * GRAPHENE_CORE_ASSET_CYCLE_RATE / (1 << GRAPHENE_CORE_ASSET_CYCLE_RATE_BITS) - */ -#define GRAPHENE_CORE_ASSET_CYCLE_RATE 17 -#define GRAPHENE_CORE_ASSET_CYCLE_RATE_BITS 32 - -#define GRAPHENE_DEFAULT_WITNESS_PAY_PER_BLOCK (GRAPHENE_BLOCKCHAIN_PRECISION * int64_t( 10) ) -#define GRAPHENE_DEFAULT_WITNESS_PAY_VESTING_SECONDS (60*60*24) -#define GRAPHENE_DEFAULT_WORKER_BUDGET_PER_DAY (GRAPHENE_BLOCKCHAIN_PRECISION * int64_t(500) * 1000 ) - -#define GRAPHENE_DEFAULT_MINIMUM_FEEDS 7 - -#define GRAPHENE_MAX_INTEREST_APR uint16_t( 10000 ) +#define GRAPHENE_CURRENT_DB_VERSION "PPY2.5" #define GRAPHENE_RECENTLY_MISSED_COUNT_INCREMENT 4 #define GRAPHENE_RECENTLY_MISSED_COUNT_DECREMENT 3 -#define GRAPHENE_CURRENT_DB_VERSION "PPY2.5" - -#define GRAPHENE_IRREVERSIBLE_THRESHOLD (70 * GRAPHENE_1_PERCENT) - -/** - * Reserved Account IDs with special meaning - */ -///@{ -/// Represents the current committee members, two-week review period -#define GRAPHENE_COMMITTEE_ACCOUNT (graphene::chain::account_id_type(0)) -/// Represents the current witnesses -#define GRAPHENE_WITNESS_ACCOUNT (graphene::chain::account_id_type(1)) -/// Represents the current committee members -#define GRAPHENE_RELAXED_COMMITTEE_ACCOUNT (graphene::chain::account_id_type(2)) -/// Represents the canonical account with NO authority (nobody can access funds in null account) -#define GRAPHENE_NULL_ACCOUNT (graphene::chain::account_id_type(3)) -/// Represents the canonical account with WILDCARD authority (anybody can access funds in temp account) -#define GRAPHENE_TEMP_ACCOUNT (graphene::chain::account_id_type(4)) -/// Represents the canonical account for specifying you will vote directly (as opposed to a proxy) -#define GRAPHENE_PROXY_TO_SELF_ACCOUNT (graphene::chain::account_id_type(5)) -/// -#define GRAPHENE_RAKE_FEE_ACCOUNT_ID (graphene::chain::account_id_type(6)) -/// Sentinel value used in the scheduler. -#define GRAPHENE_NULL_WITNESS (graphene::chain::witness_id_type(0)) -///@} - -#define GRAPHENE_FBA_STEALTH_DESIGNATED_ASSET (asset_id_type(743)) - -#define GRAPHENE_DEFAULT_RAKE_FEE_PERCENTAGE (3*GRAPHENE_1_PERCENT) - -/** - * Betting-related constants. - * - * We store bet multipliers as fixed-precision uint32_t. These values are - * the maximum power-of-ten bet we can have on a "symmetric" market: - * (decimal) 1.0001 - 10001 - * (fractional) 1:10000 - 10000:1 - */ -///@{ -/// betting odds (multipliers) are stored as fixed-precision, divide by this to get the actual multiplier -#define GRAPHENE_BETTING_ODDS_PRECISION 10000 -/// the smallest bet multiplier we will accept -#define GRAPHENE_BETTING_MIN_MULTIPLIER 10001 -/// the largest bet multiplier we will accept -#define GRAPHENE_BETTING_MAX_MULTIPLIER 100010000 -///@} -#define GRAPHENE_DEFAULT_MIN_BET_MULTIPLIER 10100 -#define GRAPHENE_DEFAULT_MAX_BET_MULTIPLIER 10000000 -#define GRAPHENE_DEFAULT_PERMITTED_BETTING_ODDS_INCREMENTS { { 20000, 100}, /* <= 2: 0.01 */ \ - { 30000, 200}, /* <= 3: 0.02 */ \ - { 40000, 500}, /* <= 4: 0.05 */ \ - { 60000, 1000}, /* <= 6: 0.10 */ \ - { 100000, 2000}, /* <= 10: 0.20 */ \ - { 200000, 5000}, /* <= 20: 0.50 */ \ - { 300000, 10000}, /* <= 30: 1.00 */ \ - { 500000, 20000}, /* <= 50: 2.00 */ \ - { 1000000, 50000}, /* <= 100: 5.00 */ \ - { 10000000, 100000} } /* <= 1000: 10.00 */ -#define GRAPHENE_DEFAULT_BETTING_PERCENT_FEE (2 * GRAPHENE_1_PERCENT) -#define GRAPHENE_DEFAULT_LIVE_BETTING_DELAY_TIME 5 // seconds -#define GRAPHENE_MAX_NESTED_OBJECTS (200) -#define TOURNAMENT_MIN_ROUND_DELAY 0 -#define TOURNAMENT_MAX_ROUND_DELAY 600 -#define TOURNAMENT_MIN_TIME_PER_COMMIT_MOVE 0 -#define TOURNAMENT_MAN_TIME_PER_COMMIT_MOVE 600 -#define TOURNAMENT_MIN_TIME_PER_REVEAL_MOVE 0 -#define TOURNAMENT_MAX_TIME_PER_REVEAL_MOVE 600 -#define TOURNAMENT_DEFAULT_RAKE_FEE_PERCENTAGE (3*GRAPHENE_1_PERCENT) -#define TOURNAMENT_MINIMAL_RAKE_FEE_PERCENTAGE (1*GRAPHENE_1_PERCENT) -#define TOURNAMENT_MAXIMAL_RAKE_FEE_PERCENTAGE (20*GRAPHENE_1_PERCENT) -#define TOURNAMENT_MAXIMAL_REGISTRATION_DEADLINE (60*60*24*30) // seconds, 30 days -#define TOURNAMENT_MAX_NUMBER_OF_WINS 100 -#define TOURNAMENT_MAX_PLAYERS_NUMBER 256 -#define TOURNAMENT_MAX_WHITELIST_LENGTH 1000 -#define TOURNAMENT_MAX_START_TIME_IN_FUTURE (60*60*24*7*4) // 1 month -#define TOURNAMENT_MAX_START_DELAY (60*60*24*7) // 1 week -#define SWEEPS_DEFAULT_DISTRIBUTION_PERCENTAGE (2*GRAPHENE_1_PERCENT) -#define SWEEPS_DEFAULT_DISTRIBUTION_ASSET (graphene::chain::asset_id_type(0)) -#define SWEEPS_VESTING_BALANCE_MULTIPLIER 100000000 -#define SWEEPS_ACCUMULATOR_ACCOUNT (graphene::chain::account_id_type(0)) -#define GPOS_PERIOD (60*60*24*30*6) // 6 months -#define GPOS_SUBPERIOD (60*60*24*30) // 1 month -#define GPOS_VESTING_LOCKIN_PERIOD (60*60*24*30) // 1 month - -#define RBAC_MIN_PERMISSION_NAME_LENGTH 3 -#define RBAC_MAX_PERMISSION_NAME_LENGTH 10 -#define RBAC_MAX_PERMISSIONS_PER_ACCOUNT 5 // 5 per account -#define RBAC_MAX_ACCOUNT_AUTHORITY_LIFETIME 180*24*60*60 // 6 months -#define RBAC_MAX_AUTHS_PER_PERMISSION 15 // 15 ops linked per permission - -#define NFT_TOKEN_MIN_LENGTH 3 -#define NFT_TOKEN_MAX_LENGTH 15 -#define NFT_URI_MAX_LENGTH GRAPHENE_MAX_URL_LENGTH diff --git a/libraries/chain/include/graphene/chain/database.hpp b/libraries/chain/include/graphene/chain/database.hpp index 7807f479..317054e3 100644 --- a/libraries/chain/include/graphene/chain/database.hpp +++ b/libraries/chain/include/graphene/chain/database.hpp @@ -33,6 +33,7 @@ #include #include #include +#include #include #include @@ -41,7 +42,7 @@ #include -#include +#include #include @@ -59,7 +60,6 @@ namespace graphene { namespace chain { class witness_object; class force_settlement_object; class limit_order_object; - class collateral_bid_object; class call_order_object; struct budget_record; diff --git a/libraries/chain/include/graphene/chain/event_evaluator.hpp b/libraries/chain/include/graphene/chain/event_evaluator.hpp index 876ee94d..4dfae857 100644 --- a/libraries/chain/include/graphene/chain/event_evaluator.hpp +++ b/libraries/chain/include/graphene/chain/event_evaluator.hpp @@ -23,9 +23,11 @@ */ #pragma once -#include #include #include +#include + +#include namespace graphene { namespace chain { diff --git a/libraries/chain/include/graphene/chain/event_group_evaluator.hpp b/libraries/chain/include/graphene/chain/event_group_evaluator.hpp index 65ff528e..2e529f66 100644 --- a/libraries/chain/include/graphene/chain/event_group_evaluator.hpp +++ b/libraries/chain/include/graphene/chain/event_group_evaluator.hpp @@ -23,7 +23,7 @@ */ #pragma once -#include +#include #include #include diff --git a/libraries/chain/include/graphene/chain/event_group_object.hpp b/libraries/chain/include/graphene/chain/event_group_object.hpp index 5f472e07..257cac21 100644 --- a/libraries/chain/include/graphene/chain/event_group_object.hpp +++ b/libraries/chain/include/graphene/chain/event_group_object.hpp @@ -23,9 +23,11 @@ */ #pragma once -#include +#include + #include #include + #include namespace graphene { namespace chain { @@ -58,4 +60,6 @@ typedef multi_index_container< typedef generic_index event_group_object_index; } } // graphene::chain +MAP_OBJECT_ID_TO_TYPE(graphene::chain::event_group_object) + FC_REFLECT_DERIVED( graphene::chain::event_group_object, (graphene::db::object), (name)(sport_id) ) diff --git a/libraries/chain/include/graphene/chain/event_object.hpp b/libraries/chain/include/graphene/chain/event_object.hpp index 4258cbb1..c00e3c6b 100644 --- a/libraries/chain/include/graphene/chain/event_object.hpp +++ b/libraries/chain/include/graphene/chain/event_object.hpp @@ -23,14 +23,17 @@ */ #pragma once -#include +#include + +#include + #include #include -#include -#include #include +#include + namespace graphene { namespace chain { class event_object; } } @@ -158,5 +161,7 @@ typedef generic_index event_object_ return s; } } } // graphene::chain -FC_REFLECT(graphene::chain::event_object, (name)) +MAP_OBJECT_ID_TO_TYPE(graphene::chain::event_object) + +FC_REFLECT(graphene::chain::event_object, (name)(season)(start_time)(event_group_id)(at_least_one_betting_market_group_settled)(scores)) diff --git a/libraries/chain/include/graphene/chain/exceptions.hpp b/libraries/chain/include/graphene/chain/exceptions.hpp index 8ae9edff..56d964a3 100644 --- a/libraries/chain/include/graphene/chain/exceptions.hpp +++ b/libraries/chain/include/graphene/chain/exceptions.hpp @@ -202,9 +202,6 @@ namespace graphene { namespace chain { //GRAPHENE_DECLARE_OP_BASE_EXCEPTIONS( bid_collateral_operation ) //GRAPHENE_DECLARE_OP_BASE_EXCEPTIONS( asset_claim_pool_operation ) //GRAPHENE_DECLARE_OP_BASE_EXCEPTIONS( asset_update_issuer_operation ) - //GRAPHENE_DECLARE_OP_BASE_EXCEPTIONS( htlc_create_operation ) - //GRAPHENE_DECLARE_OP_BASE_EXCEPTIONS( htlc_redeem_operation ) - //GRAPHENE_DECLARE_OP_BASE_EXCEPTIONS( htlc_extend_operation ) #define GRAPHENE_RECODE_EXC( cause_type, effect_type ) \ catch( const cause_type& e ) \ diff --git a/libraries/chain/include/graphene/chain/game_object.hpp b/libraries/chain/include/graphene/chain/game_object.hpp index abef1444..2a6f0b16 100644 --- a/libraries/chain/include/graphene/chain/game_object.hpp +++ b/libraries/chain/include/graphene/chain/game_object.hpp @@ -23,12 +23,17 @@ */ #pragma once -#include #include -#include + +#include + #include #include + #include + +#include + #include namespace graphene { namespace chain { @@ -159,6 +164,8 @@ namespace graphene { namespace chain { } } +MAP_OBJECT_ID_TO_TYPE(graphene::chain::game_object) + FC_REFLECT_ENUM(graphene::chain::game_state, (game_in_progress) (expecting_commit_moves) diff --git a/libraries/chain/include/graphene/chain/global_betting_statistics_object.hpp b/libraries/chain/include/graphene/chain/global_betting_statistics_object.hpp index 7c557be5..5bc95728 100644 --- a/libraries/chain/include/graphene/chain/global_betting_statistics_object.hpp +++ b/libraries/chain/include/graphene/chain/global_betting_statistics_object.hpp @@ -23,7 +23,8 @@ */ #pragma once -#include +#include + #include #include @@ -49,4 +50,6 @@ typedef generic_index #include -#include #include namespace graphene { namespace chain { diff --git a/libraries/chain/include/graphene/chain/immutable_chain_parameters.hpp b/libraries/chain/include/graphene/chain/immutable_chain_parameters.hpp index 6e18c079..293abe95 100644 --- a/libraries/chain/include/graphene/chain/immutable_chain_parameters.hpp +++ b/libraries/chain/include/graphene/chain/immutable_chain_parameters.hpp @@ -24,7 +24,7 @@ #pragma once #include -#include +#include namespace graphene { namespace chain { diff --git a/libraries/chain/include/graphene/chain/lottery_evaluator.hpp b/libraries/chain/include/graphene/chain/lottery_evaluator.hpp index 65c97d85..663d1321 100644 --- a/libraries/chain/include/graphene/chain/lottery_evaluator.hpp +++ b/libraries/chain/include/graphene/chain/lottery_evaluator.hpp @@ -22,7 +22,7 @@ * THE SOFTWARE. */ #pragma once -#include +#include #include #include diff --git a/libraries/chain/include/graphene/chain/market_object.hpp b/libraries/chain/include/graphene/chain/market_object.hpp index 9d058638..3da60243 100644 --- a/libraries/chain/include/graphene/chain/market_object.hpp +++ b/libraries/chain/include/graphene/chain/market_object.hpp @@ -207,7 +207,6 @@ typedef generic_index + #include -#include +#include + +#include + #include #include + #include + +#include + #include namespace graphene { namespace chain { @@ -157,6 +164,8 @@ namespace graphene { namespace chain { } } +MAP_OBJECT_ID_TO_TYPE(graphene::chain::match_object) + FC_REFLECT_ENUM(graphene::chain::match_state, (waiting_on_previous_matches) (match_in_progress) diff --git a/libraries/chain/include/graphene/chain/operation_history_object.hpp b/libraries/chain/include/graphene/chain/operation_history_object.hpp index c85bf3a4..b4538c60 100644 --- a/libraries/chain/include/graphene/chain/operation_history_object.hpp +++ b/libraries/chain/include/graphene/chain/operation_history_object.hpp @@ -22,82 +22,85 @@ * THE SOFTWARE. */ #pragma once + +#include + #include + #include #include namespace graphene { namespace chain { - /** - * @brief tracks the history of all logical operations on blockchain state - * @ingroup object - * @ingroup implementation - * - * All operations and virtual operations result in the creation of an - * operation_history_object that is maintained on disk as a stack. Each - * real or virtual operation is assigned a unique ID / sequence number that - * it can be referenced by. - * - * @note by default these objects are not tracked, the account_history_plugin must - * be loaded fore these objects to be maintained. - * - * @note this object is READ ONLY it can never be modified - */ - class operation_history_object : public abstract_object - { - public: - static const uint8_t space_id = protocol_ids; - static const uint8_t type_id = operation_history_object_type; +/** + * @brief tracks the history of all logical operations on blockchain state + * @ingroup object + * @ingroup implementation + * + * All operations and virtual operations result in the creation of an + * operation_history_object that is maintained on disk as a stack. Each + * real or virtual operation is assigned a unique ID / sequence number that + * it can be referenced by. + * + * @note by default these objects are not tracked, the account_history_plugin must + * be loaded fore these objects to be maintained. + * + * @note this object is READ ONLY it can never be modified + */ +class operation_history_object : public abstract_object +{ + public: + static const uint8_t space_id = protocol_ids; + static const uint8_t type_id = operation_history_object_type; - operation_history_object( const operation& o ):op(o){} - operation_history_object(){} + operation_history_object( const operation& o ):op(o){} + operation_history_object(){} - operation op; - operation_result result; - /** the block that caused this operation */ - uint32_t block_num = 0; - /** the transaction in the block */ - uint16_t trx_in_block = 0; - /** the operation within the transaction */ - uint16_t op_in_trx = 0; - /** any virtual operations implied by operation in block */ - uint32_t virtual_op = 0; - }; + operation op; + operation_result result; + /** the block that caused this operation */ + uint32_t block_num = 0; + /** the transaction in the block */ + uint16_t trx_in_block = 0; + /** the operation within the transaction */ + uint16_t op_in_trx = 0; + /** any virtual operations implied by operation in block */ + uint32_t virtual_op = 0; +}; + +/** + * @brief a node in a linked list of operation_history_objects + * @ingroup implementation + * @ingroup object + * + * Account history is important for users and wallets even though it is + * not part of "core validation". Account history is maintained as + * a linked list stored on disk in a stack. Each account will point to the + * most recent account history object by ID. When a new operation relativent + * to that account is processed a new account history object is allcoated at + * the end of the stack and intialized to point to the prior object. + * + * This data is never accessed as part of chain validation and therefore + * can be kept on disk as a memory mapped file. Using a memory mapped file + * will help the operating system better manage / cache / page files and + * also accelerates load time. + * + * When the transaction history for a particular account is requested the + * linked list can be traversed with relatively effecient disk access because + * of the use of a memory mapped stack. + */ +class account_transaction_history_object : public abstract_object +{ + public: + static const uint8_t space_id = implementation_ids; + static const uint8_t type_id = impl_account_transaction_history_object_type; + account_id_type account; /// the account this operation applies to + operation_history_id_type operation_id; + uint32_t sequence = 0; /// the operation position within the given account + account_transaction_history_id_type next; +}; - /** - * @brief a node in a linked list of operation_history_objects - * @ingroup implementation - * @ingroup object - * - * Account history is important for users and wallets even though it is - * not part of "core validation". Account history is maintained as - * a linked list stored on disk in a stack. Each account will point to the - * most recent account history object by ID. When a new operation relativent - * to that account is processed a new account history object is allcoated at - * the end of the stack and intialized to point to the prior object. - * - * This data is never accessed as part of chain validation and therefore - * can be kept on disk as a memory mapped file. Using a memory mapped file - * will help the operating system better manage / cache / page files and - * also accelerates load time. - * - * When the transaction history for a particular account is requested the - * linked list can be traversed with relatively effecient disk access because - * of the use of a memory mapped stack. - */ - class account_transaction_history_object : public abstract_object - { - public: - static const uint8_t space_id = implementation_ids; - static const uint8_t type_id = impl_account_transaction_history_object_type; - account_id_type account; /// the account this operation applies to - operation_history_id_type operation_id; - uint32_t sequence = 0; /// the operation position within the given account - account_transaction_history_id_type next; - }; - - struct by_id; struct by_seq; struct by_op; struct by_opid; @@ -135,7 +138,6 @@ typedef multi_index_container< typedef generic_index account_transaction_history_index; - } } // graphene::chain MAP_OBJECT_ID_TO_TYPE(graphene::chain::operation_history_object) diff --git a/libraries/chain/include/graphene/chain/rock_paper_scissors.hpp b/libraries/chain/include/graphene/chain/rock_paper_scissors.hpp index 23015e3e..f2b6c382 100644 --- a/libraries/chain/include/graphene/chain/rock_paper_scissors.hpp +++ b/libraries/chain/include/graphene/chain/rock_paper_scissors.hpp @@ -26,11 +26,14 @@ #include +#include + +#include + #include #include #include #include -#include namespace graphene { namespace chain { struct rock_paper_scissors_game_details diff --git a/libraries/chain/include/graphene/chain/sport_evaluator.hpp b/libraries/chain/include/graphene/chain/sport_evaluator.hpp index 4724e795..0f91305d 100644 --- a/libraries/chain/include/graphene/chain/sport_evaluator.hpp +++ b/libraries/chain/include/graphene/chain/sport_evaluator.hpp @@ -23,7 +23,7 @@ */ #pragma once -#include +#include #include #include diff --git a/libraries/chain/include/graphene/chain/sport_object.hpp b/libraries/chain/include/graphene/chain/sport_object.hpp index 4f3139d8..3da135b5 100644 --- a/libraries/chain/include/graphene/chain/sport_object.hpp +++ b/libraries/chain/include/graphene/chain/sport_object.hpp @@ -23,7 +23,8 @@ */ #pragma once -#include +#include + #include #include @@ -48,4 +49,6 @@ typedef multi_index_container< typedef generic_index sport_object_index; } } // graphene::chain +MAP_OBJECT_ID_TO_TYPE(graphene::chain::sport_object) + FC_REFLECT_DERIVED( graphene::chain::sport_object, (graphene::db::object), (name) ) diff --git a/libraries/chain/include/graphene/chain/tournament_evaluator.hpp b/libraries/chain/include/graphene/chain/tournament_evaluator.hpp index 18a0140d..9cce918d 100644 --- a/libraries/chain/include/graphene/chain/tournament_evaluator.hpp +++ b/libraries/chain/include/graphene/chain/tournament_evaluator.hpp @@ -1,5 +1,5 @@ #pragma once -#include +#include #include #include diff --git a/libraries/chain/include/graphene/chain/tournament_object.hpp b/libraries/chain/include/graphene/chain/tournament_object.hpp index 140770e2..b6ef883e 100644 --- a/libraries/chain/include/graphene/chain/tournament_object.hpp +++ b/libraries/chain/include/graphene/chain/tournament_object.hpp @@ -1,12 +1,19 @@ #pragma once -#include + +#include #include -#include +#include + +#include + #include #include + #include #include +#include + namespace graphene { namespace chain { class tournament_object; } } @@ -234,6 +241,9 @@ namespace graphene { namespace chain { } } +MAP_OBJECT_ID_TO_TYPE(graphene::chain::tournament_details_object) +MAP_OBJECT_ID_TO_TYPE(graphene::chain::tournament_object) + FC_REFLECT_DERIVED(graphene::chain::tournament_details_object, (graphene::db::object), (tournament_id) (registered_players) diff --git a/libraries/chain/include/graphene/chain/transaction_evaluation_state.hpp b/libraries/chain/include/graphene/chain/transaction_evaluation_state.hpp index 53c6f3eb..16958f35 100644 --- a/libraries/chain/include/graphene/chain/transaction_evaluation_state.hpp +++ b/libraries/chain/include/graphene/chain/transaction_evaluation_state.hpp @@ -25,7 +25,7 @@ #include namespace graphene { -namespace protocol { class signed_transaction; } +namespace protocol { struct signed_transaction; } namespace chain { class database; using protocol::signed_transaction; diff --git a/libraries/chain/include/graphene/chain/transaction_history_object.hpp b/libraries/chain/include/graphene/chain/transaction_history_object.hpp index 6bed7920..e1f5f337 100644 --- a/libraries/chain/include/graphene/chain/transaction_history_object.hpp +++ b/libraries/chain/include/graphene/chain/transaction_history_object.hpp @@ -23,7 +23,10 @@ */ #pragma once +#include + #include + #include #include diff --git a/libraries/chain/include/graphene/chain/types.hpp b/libraries/chain/include/graphene/chain/types.hpp index 050672ad..16158b80 100644 --- a/libraries/chain/include/graphene/chain/types.hpp +++ b/libraries/chain/include/graphene/chain/types.hpp @@ -46,10 +46,10 @@ GRAPHENE_DEFINE_IDS(chain, implementation_ids, impl_, (buyback) (fba_accumulator) (asset_dividend_data) - (pending_dividend_payout_balance_for_holder_object) - (distributed_dividend_balance_data) - (betting_market_position_object) - (global_betting_statistics_object) - (lottery_balance_object) - (sweeps_vesting_balance_object) - (offer_history_object)) + (pending_dividend_payout_balance_for_holder) + (total_distributed_dividend_balance) + (betting_market_position) + (global_betting_statistics) + (lottery_balance) + (sweeps_vesting_balance) + (offer_history)) diff --git a/libraries/chain/include/graphene/chain/vesting_balance_object.hpp b/libraries/chain/include/graphene/chain/vesting_balance_object.hpp index 11b689df..c6ecceb7 100644 --- a/libraries/chain/include/graphene/chain/vesting_balance_object.hpp +++ b/libraries/chain/include/graphene/chain/vesting_balance_object.hpp @@ -23,6 +23,8 @@ */ #pragma once +#include + #include #include #include diff --git a/libraries/chain/include/graphene/chain/witness_schedule_object.hpp b/libraries/chain/include/graphene/chain/witness_schedule_object.hpp index 2415f82f..dc32e1bc 100644 --- a/libraries/chain/include/graphene/chain/witness_schedule_object.hpp +++ b/libraries/chain/include/graphene/chain/witness_schedule_object.hpp @@ -22,11 +22,16 @@ * THE SOFTWARE. */ #pragma once -#include -#include -#include #include #include +#include + +#include + +#include +#include + +#include namespace graphene { namespace chain { @@ -62,13 +67,13 @@ class witness_schedule_object : public graphene::db::abstract_object rng_seed; + std::array< char, sizeof(secret_hash_type) > rng_seed = {}; /** * Not necessary for consensus, but used for figuring out the participation rate. * The nth bit is 0 if the nth slot was unfilled, else it is 1. */ - fc::uint128 recent_slots_filled; + fc::uint128_t recent_slots_filled; }; } } diff --git a/libraries/chain/proposal_evaluator.cpp b/libraries/chain/proposal_evaluator.cpp index 70066066..fa9d5868 100644 --- a/libraries/chain/proposal_evaluator.cpp +++ b/libraries/chain/proposal_evaluator.cpp @@ -25,9 +25,9 @@ #include #include #include -#include -#include -#include +#include +#include +#include #include #include @@ -314,7 +314,7 @@ void_result proposal_update_evaluator::do_apply(const proposal_update_operation& // Potential optimization: if _executed_proposal is true, we can skip the modify step and make push_proposal skip // signature checks. This isn't done now because I just wrote all the proposals code, and I'm not yet 100% sure the // required approvals are sufficient to authorize the transaction. - d.modify(*_proposal, [&o, &d](proposal_object& p) { + d.modify(*_proposal, [&o](proposal_object& p) { p.available_active_approvals.insert(o.active_approvals_to_add.begin(), o.active_approvals_to_add.end()); p.available_owner_approvals.insert(o.owner_approvals_to_add.begin(), o.owner_approvals_to_add.end()); for( account_id_type id : o.active_approvals_to_remove ) diff --git a/libraries/chain/small_objects.cpp b/libraries/chain/small_objects.cpp index 6b8af3d9..66812162 100644 --- a/libraries/chain/small_objects.cpp +++ b/libraries/chain/small_objects.cpp @@ -22,7 +22,7 @@ * THE SOFTWARE. */ -#include +#include #include #include @@ -36,15 +36,20 @@ #include #include #include -#include +#include #include #include #include #include #include +#include #include +namespace graphene { namespace chain { +FC_IMPLEMENT_EXCEPTION(no_transition, 100000, "Invalid state transition"); +} } + GRAPHENE_EXTERNAL_SERIALIZATION( /*not extern*/, graphene::chain::balance_object ) GRAPHENE_EXTERNAL_SERIALIZATION( /*not extern*/, graphene::chain::block_summary_object ) GRAPHENE_EXTERNAL_SERIALIZATION( /*not extern*/, graphene::chain::budget_record ) @@ -63,7 +68,7 @@ GRAPHENE_EXTERNAL_SERIALIZATION( /*not extern*/, graphene::chain::global_propert GRAPHENE_EXTERNAL_SERIALIZATION( /*not extern*/, graphene::chain::operation_history_object ) GRAPHENE_EXTERNAL_SERIALIZATION( /*not extern*/, graphene::chain::account_transaction_history_object ) GRAPHENE_EXTERNAL_SERIALIZATION( /*not extern*/, graphene::chain::special_authority_object ) -GRAPHENE_EXTERNAL_SERIALIZATION( /*not extern*/, graphene::chain::transaction_object ) +GRAPHENE_EXTERNAL_SERIALIZATION( /*not extern*/, graphene::chain::transaction_history_object ) GRAPHENE_EXTERNAL_SERIALIZATION( /*not extern*/, graphene::chain::withdraw_permission_object ) GRAPHENE_EXTERNAL_SERIALIZATION( /*not extern*/, graphene::chain::witness_object ) GRAPHENE_EXTERNAL_SERIALIZATION( /*not extern*/, graphene::chain::witness_scheduler ) diff --git a/libraries/chain/tournament_evaluator.cpp b/libraries/chain/tournament_evaluator.cpp index c90f5e10..d3c7acf7 100644 --- a/libraries/chain/tournament_evaluator.cpp +++ b/libraries/chain/tournament_evaluator.cpp @@ -1,4 +1,4 @@ -#include +#include #include #include #include @@ -106,8 +106,7 @@ namespace graphene { namespace chain { object_id_type tournament_create_evaluator::do_apply( const tournament_create_operation& op ) { try { const tournament_details_object& tournament_details = - db().create( [&]( tournament_details_object& a ) { - }); + db().create( [&]( tournament_details_object& ) { }); const tournament_object& new_tournament = db().create( [&]( tournament_object& t ) { diff --git a/libraries/chain/tournament_object.cpp b/libraries/chain/tournament_object.cpp index ad64b34f..715ef1d3 100644 --- a/libraries/chain/tournament_object.cpp +++ b/libraries/chain/tournament_object.cpp @@ -317,7 +317,7 @@ namespace graphene { namespace chain { share_type rake_amount = 0; if (dividend_id) - rake_amount = (fc::uint128_t(tournament_obj.prize_pool.value) * rake_fee_percentage / GRAPHENE_1_PERCENT / 100).to_uint64(); + rake_amount = (fc::uint128_t(tournament_obj.prize_pool.value) * rake_fee_percentage / GRAPHENE_1_PERCENT / 100); asset won_prize(tournament_obj.prize_pool - rake_amount, tournament_obj.options.buy_in.asset_id); tournament_payout_operation op; @@ -645,13 +645,6 @@ namespace graphene { namespace chain { } } - fc::sha256 rock_paper_scissors_throw::calculate_hash() const - { - std::vector full_throw_packed(fc::raw::pack(*this)); - return fc::sha256::hash(full_throw_packed.data(), full_throw_packed.size()); - } - - vector tournament_players_index::get_registered_tournaments_for_account( const account_id_type& a )const { auto iter = account_to_joined_tournaments.find(a); diff --git a/libraries/chain/vesting_balance_evaluator.cpp b/libraries/chain/vesting_balance_evaluator.cpp index e81383b6..78a0fcdf 100644 --- a/libraries/chain/vesting_balance_evaluator.cpp +++ b/libraries/chain/vesting_balance_evaluator.cpp @@ -26,6 +26,7 @@ #include #include #include +#include namespace graphene { namespace chain { diff --git a/libraries/chain/vesting_balance_object.cpp b/libraries/chain/vesting_balance_object.cpp index b9e99ae9..604281d0 100644 --- a/libraries/chain/vesting_balance_object.cpp +++ b/libraries/chain/vesting_balance_object.cpp @@ -59,7 +59,7 @@ asset linear_vesting_policy::get_allowed_withdraw( const vesting_policy_context& share_type total_vested = 0; if( elapsed_seconds < vesting_duration_seconds ) { - total_vested = (fc::uint128_t( begin_balance.value ) * elapsed_seconds / vesting_duration_seconds).to_uint64(); + total_vested = (fc::uint128_t( begin_balance.value ) * elapsed_seconds / vesting_duration_seconds); } else { diff --git a/libraries/net/include/graphene/net/node.hpp b/libraries/net/include/graphene/net/node.hpp index f68f3574..fe03ac0c 100644 --- a/libraries/net/include/graphene/net/node.hpp +++ b/libraries/net/include/graphene/net/node.hpp @@ -193,7 +193,7 @@ namespace graphene { namespace net { { public: node(const std::string& user_agent); - ~node(); + virtual ~node(); void close(); diff --git a/libraries/plugins/affiliate_stats/include/graphene/affiliate_stats/affiliate_stats_api.hpp b/libraries/plugins/affiliate_stats/include/graphene/affiliate_stats/affiliate_stats_api.hpp index 29c45d9f..b9f4ac64 100644 --- a/libraries/plugins/affiliate_stats/include/graphene/affiliate_stats/affiliate_stats_api.hpp +++ b/libraries/plugins/affiliate_stats/include/graphene/affiliate_stats/affiliate_stats_api.hpp @@ -27,8 +27,8 @@ #include #include -#include -#include +#include +#include #include #include diff --git a/libraries/plugins/affiliate_stats/include/graphene/affiliate_stats/affiliate_stats_objects.hpp b/libraries/plugins/affiliate_stats/include/graphene/affiliate_stats/affiliate_stats_objects.hpp index 1dc70276..a6d3a63c 100644 --- a/libraries/plugins/affiliate_stats/include/graphene/affiliate_stats/affiliate_stats_objects.hpp +++ b/libraries/plugins/affiliate_stats/include/graphene/affiliate_stats/affiliate_stats_objects.hpp @@ -48,7 +48,7 @@ public: inline asset_id_type get_asset_id()const { return total_payout.asset_id; } }; -typedef object_id app_reward_id_type; +typedef object_id app_reward_id_type; struct by_asset; struct by_app_asset; @@ -86,7 +86,7 @@ public: inline asset_id_type get_asset_id()const { return total_payout.asset_id; } }; -typedef object_id referral_reward_id_type; +typedef object_id referral_reward_id_type; struct by_referral_asset; typedef multi_index_container< diff --git a/libraries/plugins/bookie/bookie_api.cpp b/libraries/plugins/bookie/bookie_api.cpp index 9caa9c62..4269364d 100644 --- a/libraries/plugins/bookie/bookie_api.cpp +++ b/libraries/plugins/bookie/bookie_api.cpp @@ -152,7 +152,7 @@ fc::variants bookie_api_impl::get_objects(const vector& ids) con result.reserve(ids.size()); std::transform(ids.begin(), ids.end(), std::back_inserter(result), - [this, &db](object_id_type id) -> fc::variant { + [&db](object_id_type id) -> fc::variant { switch (id.type()) { case event_id_type::type_id: diff --git a/libraries/plugins/bookie/bookie_plugin.cpp b/libraries/plugins/bookie/bookie_plugin.cpp index 5bc31f14..3dd17d1b 100644 --- a/libraries/plugins/bookie/bookie_plugin.cpp +++ b/libraries/plugins/bookie/bookie_plugin.cpp @@ -519,7 +519,8 @@ asset bookie_plugin::get_total_matched_bet_amount_for_betting_market_group(betti } std::vector bookie_plugin::get_events_containing_sub_string(const std::string& sub_string, const std::string& language) { - ilog("bookie plugin: get_events_containing_sub_string(${sub_string}, ${language})", (sub_string)(language)); + ilog("bookie plugin: get_events_containing_sub_string(${sub_string}, ${language})", + ("sub_string", sub_string)("language", language)); return my->get_events_containing_sub_string(sub_string, language); } diff --git a/libraries/plugins/bookie/include/graphene/bookie/bookie_api.hpp b/libraries/plugins/bookie/include/graphene/bookie/bookie_api.hpp index 36c8a64b..0919fc62 100644 --- a/libraries/plugins/bookie/include/graphene/bookie/bookie_api.hpp +++ b/libraries/plugins/bookie/include/graphene/bookie/bookie_api.hpp @@ -29,8 +29,8 @@ #include #include -#include -#include +#include +#include #include using namespace graphene::chain; diff --git a/libraries/plugins/bookie/include/graphene/bookie/bookie_objects.hpp b/libraries/plugins/bookie/include/graphene/bookie/bookie_objects.hpp index 1166ced3..c9e20b8e 100644 --- a/libraries/plugins/bookie/include/graphene/bookie/bookie_objects.hpp +++ b/libraries/plugins/bookie/include/graphene/bookie/bookie_objects.hpp @@ -52,7 +52,7 @@ class persistent_event_object : public graphene::db::abstract_object persistent_event_id_type; +typedef object_id persistent_event_id_type; struct by_event_id; typedef multi_index_container< diff --git a/libraries/plugins/bookie/include/graphene/bookie/bookie_plugin.hpp b/libraries/plugins/bookie/include/graphene/bookie/bookie_plugin.hpp index 333b8bab..93889cb8 100644 --- a/libraries/plugins/bookie/include/graphene/bookie/bookie_plugin.hpp +++ b/libraries/plugins/bookie/include/graphene/bookie/bookie_plugin.hpp @@ -23,8 +23,10 @@ */ #pragma once -#include #include +#include + +#include #include diff --git a/libraries/plugins/delayed_node/delayed_node_plugin.cpp b/libraries/plugins/delayed_node/delayed_node_plugin.cpp index 413f6b9d..8ad490bc 100644 --- a/libraries/plugins/delayed_node/delayed_node_plugin.cpp +++ b/libraries/plugins/delayed_node/delayed_node_plugin.cpp @@ -63,7 +63,7 @@ void delayed_node_plugin::plugin_set_program_options(bpo::options_description& c void delayed_node_plugin::connect() { - my->client_connection = std::make_shared(*my->client.connect(my->remote_endpoint), GRAPHENE_MAX_NESTED_OBJECTS); + my->client_connection = std::make_shared(my->client.connect(my->remote_endpoint), GRAPHENE_MAX_NESTED_OBJECTS); my->database_api = my->client_connection->get_remote_api(0); my->client_connection_closed = my->client_connection->closed.connect([this] { connection_failed(); diff --git a/libraries/plugins/generate_genesis/generate_genesis.cpp b/libraries/plugins/generate_genesis/generate_genesis.cpp index 88da427e..c526611f 100644 --- a/libraries/plugins/generate_genesis/generate_genesis.cpp +++ b/libraries/plugins/generate_genesis/generate_genesis.cpp @@ -296,12 +296,12 @@ void generate_genesis_plugin::generate_snapshot() auto balance_iter = by_effective_balance_index.begin(); for (; balance_iter != by_effective_balance_index.end(); ++balance_iter) { - fc::uint128 share_drop_amount = total_amount_to_distribute.value; + fc::uint128_t share_drop_amount = total_amount_to_distribute.value; share_drop_amount *= balance_iter->get_effective_balance().value; share_drop_amount /= total_bts_balance.value; - if (!share_drop_amount.to_uint64()) + if (!share_drop_amount) break; // balances are decreasing, so every balance after will also round to zero - total_shares_dropped += share_drop_amount.to_uint64(); + total_shares_dropped += share_drop_amount; effective_total_bts_balance += balance_iter->get_effective_balance(); } @@ -312,10 +312,10 @@ void generate_genesis_plugin::generate_snapshot() do { --balance_iter; - fc::uint128 share_drop_amount = remaining_amount_to_distribute.value; + fc::uint128_t share_drop_amount = remaining_amount_to_distribute.value; share_drop_amount *= balance_iter->get_effective_balance().value; share_drop_amount /= bts_balance_remaining.value; - graphene::chain::share_type amount_distributed = share_drop_amount.to_uint64(); + graphene::chain::share_type amount_distributed = share_drop_amount; by_effective_balance_index.modify(balance_iter, [&](my_account_balance_object& balance_object) { balance_object.sharedrop += amount_distributed; diff --git a/libraries/plugins/witness/include/graphene/witness/witness.hpp b/libraries/plugins/witness/include/graphene/witness/witness.hpp index f0c3ece7..9ec5a02c 100644 --- a/libraries/plugins/witness/include/graphene/witness/witness.hpp +++ b/libraries/plugins/witness/include/graphene/witness/witness.hpp @@ -79,7 +79,6 @@ private: boost::program_options::variables_map _options; bool _production_enabled = false; - bool _consecutive_production_enabled = false; uint32_t _required_witness_participation = 33 * GRAPHENE_1_PERCENT; uint32_t _production_skip_flags = graphene::chain::database::skip_nothing; diff --git a/libraries/protocol/account.cpp b/libraries/protocol/account.cpp index b5180978..149270ee 100644 --- a/libraries/protocol/account.cpp +++ b/libraries/protocol/account.cpp @@ -23,6 +23,8 @@ */ #include +#include + namespace graphene { namespace protocol { /** @@ -59,13 +61,6 @@ bool is_valid_name( const string& name ) { try { const size_t len = name.size(); - /** this condition will prevent witnesses from including new names before this time, but - * allow them after this time. This check can be removed from the code after HARDFORK_385_TIME - * has passed. - */ - if( fc::time_point::now() < fc::time_point(HARDFORK_385_TIME) ) - FC_ASSERT( len >= 3 ); - if( len < GRAPHENE_MIN_ACCOUNT_NAME_LENGTH ) { ilog( "."); diff --git a/libraries/protocol/address.cpp b/libraries/protocol/address.cpp index 502960ac..4069f430 100644 --- a/libraries/protocol/address.cpp +++ b/libraries/protocol/address.cpp @@ -89,7 +89,7 @@ namespace graphene { namespace protocol { address::operator std::string()const { std::array bin_addr; - static_assert( bin_addr.size() >= sizeof(addr) + 4 ); + static_assert( bin_addr.size() >= sizeof(addr) + 4, "" ); memcpy( bin_addr.data(), addr.data(), sizeof(addr) ); auto checksum = fc::ripemd160::hash( addr.data(), sizeof(addr) ); memcpy( bin_addr.data() + 20, (char*)&checksum._hash[0], 4 ); diff --git a/libraries/protocol/betting_market.cpp b/libraries/protocol/betting_market.cpp index 99712f9c..a27b3dc7 100644 --- a/libraries/protocol/betting_market.cpp +++ b/libraries/protocol/betting_market.cpp @@ -21,9 +21,9 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ -#include +#include -namespace graphene { namespace chain { +namespace graphene { namespace protocol { void betting_market_rules_create_operation::validate() const { @@ -77,5 +77,5 @@ void bet_cancel_operation::validate() const -} } // graphene::chain +} } // graphene::protocol diff --git a/libraries/protocol/block.cpp b/libraries/protocol/block.cpp index ddf6ae6d..3b96579c 100644 --- a/libraries/protocol/block.cpp +++ b/libraries/protocol/block.cpp @@ -23,7 +23,6 @@ */ #include #include -#include #include namespace graphene { namespace protocol { @@ -91,6 +90,6 @@ namespace graphene { namespace protocol { } } -GRAPHENE_EXTERNAL_SERIALIZATION(/*not extern*/, graphene::chain::block_header) -GRAPHENE_EXTERNAL_SERIALIZATION(/*not extern*/, graphene::chain::signed_block_header) -GRAPHENE_EXTERNAL_SERIALIZATION(/*not extern*/, graphene::chain::signed_block) +GRAPHENE_EXTERNAL_SERIALIZATION(/*not extern*/, graphene::protocol::block_header) +GRAPHENE_EXTERNAL_SERIALIZATION(/*not extern*/, graphene::protocol::signed_block_header) +GRAPHENE_EXTERNAL_SERIALIZATION(/*not extern*/, graphene::protocol::signed_block) diff --git a/libraries/protocol/event.cpp b/libraries/protocol/event.cpp index 730e3fb6..7b492270 100644 --- a/libraries/protocol/event.cpp +++ b/libraries/protocol/event.cpp @@ -21,9 +21,9 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ -#include +#include -namespace graphene { namespace chain { +namespace graphene { namespace protocol { void event_create_operation::validate() const { @@ -40,5 +40,5 @@ void event_update_status_operation::validate() const FC_ASSERT( fee.amount >= 0 ); } -} } // graphene::chain +} } // graphene::protocol diff --git a/libraries/protocol/event_group.cpp b/libraries/protocol/event_group.cpp index 39fe0f3c..dfa0a904 100644 --- a/libraries/protocol/event_group.cpp +++ b/libraries/protocol/event_group.cpp @@ -21,9 +21,9 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ -#include +#include -namespace graphene { namespace chain { +namespace graphene { namespace protocol { void event_group_create_operation::validate() const { @@ -40,5 +40,5 @@ void event_group_delete_operation::validate() const FC_ASSERT( fee.amount >= 0 ); } -} } // graphene::chain +} } // graphene::protocol diff --git a/libraries/protocol/fee_schedule.cpp b/libraries/protocol/fee_schedule.cpp index 5375637b..3e333029 100644 --- a/libraries/protocol/fee_schedule.cpp +++ b/libraries/protocol/fee_schedule.cpp @@ -121,10 +121,10 @@ namespace graphene { namespace protocol { scaled /= GRAPHENE_100_PERCENT; FC_ASSERT( scaled <= GRAPHENE_MAX_SHARE_SUPPLY ); //idump( (base_value)(scaled)(core_exchange_rate) ); - auto result = asset( scaled.to_uint64(), asset_id_type(0) ) * core_exchange_rate; + auto result = asset( scaled, asset_id_type(0) ) * core_exchange_rate; //FC_ASSERT( result * core_exchange_rate >= asset( scaled.to_uint64()) ); - while( result * core_exchange_rate < asset( scaled.to_uint64()) ) + while( result * core_exchange_rate < asset(scaled) ) result.amount++; FC_ASSERT( result.amount <= GRAPHENE_MAX_SHARE_SUPPLY ); diff --git a/libraries/protocol/include/graphene/protocol/affiliate.hpp b/libraries/protocol/include/graphene/protocol/affiliate.hpp index b2c3ee88..15509ee0 100644 --- a/libraries/protocol/include/graphene/protocol/affiliate.hpp +++ b/libraries/protocol/include/graphene/protocol/affiliate.hpp @@ -22,11 +22,13 @@ * THE SOFTWARE. */ #pragma once -#include -#include -#include -namespace graphene { namespace chain { +#include +#include +#include +#include + +namespace graphene { namespace protocol { /** * Virtual op generated when an affiliate receives payout. @@ -83,10 +85,10 @@ namespace graphene { namespace chain { { return 0; } }; -} } // graphene::chain +} } // graphene::protocol -FC_REFLECT( graphene::chain::affiliate_payout_operation::fee_parameters_type, ) -FC_REFLECT( graphene::chain::affiliate_referral_payout_operation::fee_parameters_type, ) +FC_REFLECT( graphene::protocol::affiliate_payout_operation::fee_parameters_type, ) +FC_REFLECT( graphene::protocol::affiliate_referral_payout_operation::fee_parameters_type, ) -FC_REFLECT( graphene::chain::affiliate_payout_operation, (fee)(affiliate)(tag)(payout) ) -FC_REFLECT( graphene::chain::affiliate_referral_payout_operation, (fee)(player)(payout) ) +FC_REFLECT( graphene::protocol::affiliate_payout_operation, (fee)(affiliate)(tag)(payout) ) +FC_REFLECT( graphene::protocol::affiliate_referral_payout_operation, (fee)(player)(payout) ) diff --git a/libraries/protocol/include/graphene/protocol/asset_ops.hpp b/libraries/protocol/include/graphene/protocol/asset_ops.hpp index 7aa798c0..836f29d9 100644 --- a/libraries/protocol/include/graphene/protocol/asset_ops.hpp +++ b/libraries/protocol/include/graphene/protocol/asset_ops.hpp @@ -23,11 +23,10 @@ */ #pragma once #include -#include #include +#include -namespace graphene { namespace protocol { - +namespace graphene { namespace protocol { bool is_valid_symbol( const string& symbol ); struct benefactor { @@ -152,13 +151,13 @@ namespace graphene { namespace protocol { /// the options are updated again. fc::optional payout_interval; /// Each dividend distribution incurs a fee that is based on the number of accounts - /// that hold the dividend asset, not as a percentage of the amount paid out. + /// that hold the dividend asset, not as a percentage of the amount paid out. /// This parameter prevents assets from being distributed unless the fee is less than /// the percentage here, to prevent a slow trickle of deposits to the account from being /// completely consumed. /// In other words, if you set this parameter to 10% and the fees work out to 100 BTS /// to share out, balances in the dividend distribution accounts will not be shared out - /// if the balance is less than 10000 BTS. + /// if the balance is less than 10000 BTS. uint64_t minimum_fee_percentage; /// Normally, pending dividend payments are calculated each maintenance interval in @@ -171,7 +170,7 @@ namespace graphene { namespace protocol { /// /// Payouts will always occur at the next payout time whether or not it falls on a /// multiple of the distribution interval, and the timer on the distribution interval - /// are reset at payout time. So if you have the distribution interval at three days + /// are reset at payout time. So if you have the distribution interval at three days /// and the payout interval at one week, payouts will occur at days 3, 6, 7, 10, 13, 14... fc::optional minimum_distribution_interval; @@ -188,7 +187,7 @@ namespace graphene { namespace protocol { */ struct asset_create_operation : public base_operation { - struct fee_parameters_type { + struct fee_parameters_type { uint64_t symbol3 = 500000 * GRAPHENE_BLOCKCHAIN_PRECISION; uint64_t symbol4 = 300000 * GRAPHENE_BLOCKCHAIN_PRECISION; uint64_t long_symbol = 5000 * GRAPHENE_BLOCKCHAIN_PRECISION; @@ -225,7 +224,7 @@ namespace graphene { namespace protocol { ///Operation for creation of lottery struct lottery_asset_create_operation : public base_operation { - struct fee_parameters_type { + struct fee_parameters_type { uint64_t lottery_asset = 20 * GRAPHENE_BLOCKCHAIN_PRECISION; uint32_t price_per_kbyte = 10; /// only required for large lottery names. }; @@ -296,9 +295,9 @@ namespace graphene { namespace protocol { */ struct asset_settle_operation : public base_operation { - struct fee_parameters_type { + struct fee_parameters_type { /** this fee should be high to encourage small settlement requests to - * be performed on the market rather than via forced settlement. + * be performed on the market rather than via forced settlement. * * Note that in the event of a black swan or prediction market close out * everyone will have to pay this fee. @@ -367,7 +366,7 @@ namespace graphene { namespace protocol { * payments. */ uint64_t distribution_base_fee; - /** This fee is charged (in addition to the distribution_base_fee) for each + /** This fee is charged (in addition to the distribution_base_fee) for each * user the dividend payment is shared out amongst */ uint32_t distribution_fee_per_holder; @@ -429,7 +428,7 @@ namespace graphene { namespace protocol { */ struct asset_update_operation : public base_operation { - struct fee_parameters_type { + struct fee_parameters_type { uint64_t fee = 500 * GRAPHENE_BLOCKCHAIN_PRECISION; uint32_t price_per_kbyte = 10; }; @@ -482,9 +481,9 @@ namespace graphene { namespace protocol { * @brief Update options specific to dividend-paying assets * @ingroup operations * - * Dividend-paying assets have some options which are not relevant to other asset types. + * Dividend-paying assets have some options which are not relevant to other asset types. * This operation is used to update those options an an existing dividend-paying asset. - * This can also be used to convert a non-dividend-paying asset into a dividend-paying + * This can also be used to convert a non-dividend-paying asset into a dividend-paying * asset. * * @pre @ref issuer MUST be an existing account and MUST match asset_object::issuer on @ref asset_to_update @@ -573,8 +572,8 @@ namespace graphene { namespace protocol { */ struct asset_issue_operation : public base_operation { - struct fee_parameters_type { - uint64_t fee = 20 * GRAPHENE_BLOCKCHAIN_PRECISION; + struct fee_parameters_type { + uint64_t fee = 20 * GRAPHENE_BLOCKCHAIN_PRECISION; uint32_t price_per_kbyte = GRAPHENE_BLOCKCHAIN_PRECISION; }; @@ -629,19 +628,19 @@ namespace graphene { namespace protocol { account_id_type fee_payer()const { return issuer; } void validate()const; }; - + struct sweeps_vesting_claim_operation : public base_operation { struct fee_parameters_type { uint64_t fee = 20 * GRAPHENE_BLOCKCHAIN_PRECISION; }; - + asset fee; account_id_type account; asset amount_to_claim; extensions_type extensions; - - + + account_id_type fee_payer()const { return account; } void validate()const {}; }; @@ -691,6 +690,7 @@ FC_REFLECT( graphene::protocol::benefactor, (id)(share) ) FC_REFLECT( graphene::protocol::lottery_asset_options, (benefactors)(owner)(winning_tickets)(ticket_price)(end_date)(ending_on_soldout)(is_active) ) + FC_REFLECT( graphene::protocol::asset_create_operation::fee_parameters_type, (symbol3)(symbol4)(long_symbol)(price_per_kbyte) ) FC_REFLECT( graphene::protocol::lottery_asset_create_operation::fee_parameters_type, (lottery_asset)(price_per_kbyte) ) FC_REFLECT( graphene::protocol::asset_global_settle_operation::fee_parameters_type, (fee) ) @@ -734,20 +734,6 @@ FC_REFLECT( graphene::protocol::asset_update_operation, (new_options) (extensions) ) -FC_REFLECT( graphene::protocol::asset_update_issuer_operation, - (fee) - (issuer) - (asset_to_update) - (new_options) - (extensions) - ) -FC_REFLECT( graphene::chain::asset_update_dividend_operation, - (fee) - (issuer) - (asset_to_update) - (new_options) - (extensions) - ) FC_REFLECT( graphene::protocol::asset_update_bitasset_operation, (fee) (issuer) @@ -755,6 +741,13 @@ FC_REFLECT( graphene::protocol::asset_update_bitasset_operation, (new_options) (extensions) ) +FC_REFLECT( graphene::protocol::asset_update_dividend_operation, + (fee) + (issuer) + (asset_to_update) + (new_options) + (extensions) + ) FC_REFLECT( graphene::protocol::asset_update_feed_producers_operation, (fee)(issuer)(asset_to_update)(new_feed_producers)(extensions) ) diff --git a/libraries/protocol/include/graphene/protocol/betting_market.hpp b/libraries/protocol/include/graphene/protocol/betting_market.hpp index 26b6f263..306840ab 100644 --- a/libraries/protocol/include/graphene/protocol/betting_market.hpp +++ b/libraries/protocol/include/graphene/protocol/betting_market.hpp @@ -23,10 +23,11 @@ */ #pragma once -#include -#include +#include +#include +#include -namespace graphene { namespace chain { +namespace graphene { namespace protocol { struct betting_market_rules_create_operation : public base_operation { @@ -417,22 +418,22 @@ struct bet_adjusted_operation : public base_operation } } -FC_REFLECT( graphene::chain::betting_market_rules_create_operation::fee_parameters_type, (fee) ) -FC_REFLECT( graphene::chain::betting_market_rules_create_operation, +FC_REFLECT( graphene::protocol::betting_market_rules_create_operation::fee_parameters_type, (fee) ) +FC_REFLECT( graphene::protocol::betting_market_rules_create_operation, (fee)(name)(description)(extensions) ) -FC_REFLECT( graphene::chain::betting_market_rules_update_operation::fee_parameters_type, (fee) ) -FC_REFLECT( graphene::chain::betting_market_rules_update_operation, +FC_REFLECT( graphene::protocol::betting_market_rules_update_operation::fee_parameters_type, (fee) ) +FC_REFLECT( graphene::protocol::betting_market_rules_update_operation, (fee)(new_name)(new_description)(extensions)(betting_market_rules_id) ) -FC_REFLECT_ENUM( graphene::chain::betting_market_status, +FC_REFLECT_ENUM( graphene::protocol::betting_market_status, (unresolved) (frozen) (graded) (canceled) (settled) (BETTING_MARKET_STATUS_COUNT) ) -FC_REFLECT_ENUM( graphene::chain::betting_market_group_status, +FC_REFLECT_ENUM( graphene::protocol::betting_market_group_status, (upcoming) (in_play) (closed) @@ -443,51 +444,51 @@ FC_REFLECT_ENUM( graphene::chain::betting_market_group_status, (canceled) (BETTING_MARKET_GROUP_STATUS_COUNT) ) -FC_REFLECT( graphene::chain::betting_market_group_create_operation::fee_parameters_type, (fee) ) -FC_REFLECT( graphene::chain::betting_market_group_create_operation, +FC_REFLECT( graphene::protocol::betting_market_group_create_operation::fee_parameters_type, (fee) ) +FC_REFLECT( graphene::protocol::betting_market_group_create_operation, (fee)(description)(event_id)(rules_id)(asset_id) (never_in_play)(delay_before_settling) (extensions) ) -FC_REFLECT( graphene::chain::betting_market_group_update_operation::fee_parameters_type, (fee) ) -FC_REFLECT( graphene::chain::betting_market_group_update_operation, +FC_REFLECT( graphene::protocol::betting_market_group_update_operation::fee_parameters_type, (fee) ) +FC_REFLECT( graphene::protocol::betting_market_group_update_operation, (fee)(betting_market_group_id)(new_description)(new_rules_id)(status)(extensions) ) -FC_REFLECT( graphene::chain::betting_market_create_operation::fee_parameters_type, (fee) ) -FC_REFLECT( graphene::chain::betting_market_create_operation, +FC_REFLECT( graphene::protocol::betting_market_create_operation::fee_parameters_type, (fee) ) +FC_REFLECT( graphene::protocol::betting_market_create_operation, (fee)(group_id)(description)(payout_condition)(extensions) ) -FC_REFLECT( graphene::chain::betting_market_update_operation::fee_parameters_type, (fee) ) -FC_REFLECT( graphene::chain::betting_market_update_operation, +FC_REFLECT( graphene::protocol::betting_market_update_operation::fee_parameters_type, (fee) ) +FC_REFLECT( graphene::protocol::betting_market_update_operation, (fee)(betting_market_id)(new_group_id)(new_description)(new_payout_condition)(extensions) ) -FC_REFLECT_ENUM( graphene::chain::betting_market_resolution_type, (win)(not_win)(cancel)(BETTING_MARKET_RESOLUTION_COUNT) ) +FC_REFLECT_ENUM( graphene::protocol::betting_market_resolution_type, (win)(not_win)(cancel)(BETTING_MARKET_RESOLUTION_COUNT) ) -FC_REFLECT( graphene::chain::betting_market_group_resolve_operation::fee_parameters_type, (fee) ) -FC_REFLECT( graphene::chain::betting_market_group_resolve_operation, +FC_REFLECT( graphene::protocol::betting_market_group_resolve_operation::fee_parameters_type, (fee) ) +FC_REFLECT( graphene::protocol::betting_market_group_resolve_operation, (fee)(betting_market_group_id)(resolutions)(extensions) ) -FC_REFLECT( graphene::chain::betting_market_group_resolved_operation::fee_parameters_type, ) -FC_REFLECT( graphene::chain::betting_market_group_resolved_operation, +FC_REFLECT( graphene::protocol::betting_market_group_resolved_operation::fee_parameters_type, ) +FC_REFLECT( graphene::protocol::betting_market_group_resolved_operation, (bettor_id)(betting_market_group_id)(resolutions)(winnings)(fees_paid)(fee) ) -FC_REFLECT( graphene::chain::betting_market_group_cancel_unmatched_bets_operation::fee_parameters_type, (fee) ) -FC_REFLECT( graphene::chain::betting_market_group_cancel_unmatched_bets_operation, +FC_REFLECT( graphene::protocol::betting_market_group_cancel_unmatched_bets_operation::fee_parameters_type, (fee) ) +FC_REFLECT( graphene::protocol::betting_market_group_cancel_unmatched_bets_operation, (fee)(betting_market_group_id)(extensions) ) -FC_REFLECT_ENUM( graphene::chain::bet_type, (back)(lay) ) -FC_REFLECT( graphene::chain::bet_place_operation::fee_parameters_type, (fee) ) -FC_REFLECT( graphene::chain::bet_place_operation, +FC_REFLECT_ENUM( graphene::protocol::bet_type, (back)(lay) ) +FC_REFLECT( graphene::protocol::bet_place_operation::fee_parameters_type, (fee) ) +FC_REFLECT( graphene::protocol::bet_place_operation, (fee)(bettor_id)(betting_market_id)(amount_to_bet)(backer_multiplier)(back_or_lay)(extensions) ) -FC_REFLECT( graphene::chain::bet_matched_operation::fee_parameters_type, ) -FC_REFLECT( graphene::chain::bet_matched_operation, (bettor_id)(bet_id)(amount_bet)(backer_multiplier)(guaranteed_winnings_returned) ) +FC_REFLECT( graphene::protocol::bet_matched_operation::fee_parameters_type, ) +FC_REFLECT( graphene::protocol::bet_matched_operation, (fee)(bettor_id)(bet_id)(amount_bet)(backer_multiplier)(guaranteed_winnings_returned) ) -FC_REFLECT( graphene::chain::bet_cancel_operation::fee_parameters_type, (fee) ) -FC_REFLECT( graphene::chain::bet_cancel_operation, (fee) (bettor_id) (bet_to_cancel) (extensions) ) +FC_REFLECT( graphene::protocol::bet_cancel_operation::fee_parameters_type, (fee) ) +FC_REFLECT( graphene::protocol::bet_cancel_operation, (fee) (bettor_id) (bet_to_cancel) (extensions) ) -FC_REFLECT( graphene::chain::bet_canceled_operation::fee_parameters_type, ) -FC_REFLECT( graphene::chain::bet_canceled_operation, (bettor_id)(bet_id)(stake_returned) ) +FC_REFLECT( graphene::protocol::bet_canceled_operation::fee_parameters_type, ) +FC_REFLECT( graphene::protocol::bet_canceled_operation, (fee)(bettor_id)(bet_id)(stake_returned) ) -FC_REFLECT( graphene::chain::bet_adjusted_operation::fee_parameters_type, ) -FC_REFLECT( graphene::chain::bet_adjusted_operation, (bettor_id)(bet_id)(stake_returned) ) +FC_REFLECT( graphene::protocol::bet_adjusted_operation::fee_parameters_type, ) +FC_REFLECT( graphene::protocol::bet_adjusted_operation, (fee) (bettor_id)(bet_id)(stake_returned) ) diff --git a/libraries/protocol/include/graphene/protocol/chain_parameters.hpp b/libraries/protocol/include/graphene/protocol/chain_parameters.hpp index 8685349f..19022630 100644 --- a/libraries/protocol/include/graphene/protocol/chain_parameters.hpp +++ b/libraries/protocol/include/graphene/protocol/chain_parameters.hpp @@ -24,8 +24,8 @@ #pragma once #include -#include <../hardfork.d/GPOS.hf> -#include + +#include #include namespace graphene { namespace protocol { @@ -44,7 +44,7 @@ namespace graphene { namespace protocol { /* gpos parameters */ optional < uint32_t > gpos_period = GPOS_PERIOD; optional < uint32_t > gpos_subperiod = GPOS_SUBPERIOD; - optional < uint32_t > gpos_period_start = HARDFORK_GPOS_TIME.sec_since_epoch(); + optional < uint32_t > gpos_period_start = GPOS_PERIOD_START.sec_since_epoch(); optional < uint32_t > gpos_vesting_lockin_period = GPOS_VESTING_LOCKIN_PERIOD; /* rbac parameters */ optional < uint16_t > rbac_max_permissions_per_account = RBAC_MAX_PERMISSIONS_PER_ACCOUNT; @@ -101,6 +101,8 @@ namespace graphene { namespace protocol { extension extensions; + chain_parameters(); + /** defined in fee_schedule.cpp */ void validate()const; inline bet_multiplier_type min_bet_multiplier()const { @@ -135,7 +137,7 @@ namespace graphene { namespace protocol { return extensions.value.gpos_subperiod.valid() ? *extensions.value.gpos_subperiod : GPOS_SUBPERIOD; /// gpos_period % gpos_subperiod = 0 } inline uint32_t gpos_period_start()const { - return extensions.value.gpos_period_start.valid() ? *extensions.value.gpos_period_start : HARDFORK_GPOS_TIME.sec_since_epoch(); /// current period start date + return extensions.value.gpos_period_start.valid() ? *extensions.value.gpos_period_start : GPOS_PERIOD_START.sec_since_epoch(); /// current period start date } inline uint32_t gpos_vesting_lockin_period()const { return extensions.value.gpos_vesting_lockin_period.valid() ? *extensions.value.gpos_vesting_lockin_period : GPOS_VESTING_LOCKIN_PERIOD; /// GPOS vesting lockin period diff --git a/libraries/protocol/include/graphene/protocol/config.hpp b/libraries/protocol/include/graphene/protocol/config.hpp index 8ea4bcc5..fe18aa9a 100644 --- a/libraries/protocol/include/graphene/protocol/config.hpp +++ b/libraries/protocol/include/graphene/protocol/config.hpp @@ -23,11 +23,8 @@ */ #pragma once -#define GRAPHENE_SYMBOL "BTS" -#define GRAPHENE_ADDRESS_PREFIX "BTS" - -#define GRAPHENE_BLOCKCHAIN_PRECISION uint64_t( 100000 ) -#define GRAPHENE_BLOCKCHAIN_PRECISION_DIGITS 5 +#define GRAPHENE_SYMBOL "TEST" +#define GRAPHENE_ADDRESS_PREFIX "TEST" #define GRAPHENE_MIN_ACCOUNT_NAME_LENGTH 1 #define GRAPHENE_MAX_ACCOUNT_NAME_LENGTH 63 @@ -36,21 +33,8 @@ #define GRAPHENE_MAX_ASSET_SYMBOL_LENGTH 16 #define GRAPHENE_MAX_SHARE_SUPPLY int64_t(1000000000000000ll) - -#define GRAPHENE_MAX_WORKER_NAME_LENGTH 63 -#define GRAPHENE_MAX_URL_LENGTH 127 - +#define GRAPHENE_MAX_PAY_RATE 10000 /* 100% */ #define GRAPHENE_MAX_SIG_CHECK_DEPTH 2 - -#define GRAPHENE_IRREVERSIBLE_THRESHOLD (70 * GRAPHENE_1_PERCENT) - -/** - * every second, the fraction of burned core asset which cycles is - * GRAPHENE_CORE_ASSET_CYCLE_RATE / (1 << GRAPHENE_CORE_ASSET_CYCLE_RATE_BITS) - */ -#define GRAPHENE_CORE_ASSET_CYCLE_RATE 17 -#define GRAPHENE_CORE_ASSET_CYCLE_RATE_BITS 32 - /** * Don't allow the committee_members to publish a limit that would * make the network unable to operate. @@ -59,51 +43,34 @@ #define GRAPHENE_MIN_BLOCK_INTERVAL 1 /* seconds */ #define GRAPHENE_MAX_BLOCK_INTERVAL 30 /* seconds */ -#define GRAPHENE_DEFAULT_BLOCK_INTERVAL 5 /* seconds */ +#define GRAPHENE_DEFAULT_BLOCK_INTERVAL 3 /* seconds */ #define GRAPHENE_DEFAULT_MAX_TRANSACTION_SIZE 2048 -#define GRAPHENE_DEFAULT_MAX_BLOCK_SIZE (2*1000*1000) /* < 2 MiB (less than MAX_MESSAGE_SIZE in graphene/net/config.hpp) */ +#define GRAPHENE_DEFAULT_MAX_BLOCK_SIZE (GRAPHENE_DEFAULT_MAX_TRANSACTION_SIZE*GRAPHENE_DEFAULT_BLOCK_INTERVAL*200000) #define GRAPHENE_DEFAULT_MAX_TIME_UNTIL_EXPIRATION (60*60*24) // seconds, aka: 1 day #define GRAPHENE_DEFAULT_MAINTENANCE_INTERVAL (60*60*24) // seconds, aka: 1 day #define GRAPHENE_DEFAULT_MAINTENANCE_SKIP_SLOTS 3 // number of slots to skip for maintenance interval -#define GRAPHENE_DEFAULT_FORCE_SETTLEMENT_DELAY (60*60*24) ///< 1 day -#define GRAPHENE_DEFAULT_FORCE_SETTLEMENT_OFFSET 0 ///< 1% -#define GRAPHENE_DEFAULT_FORCE_SETTLEMENT_MAX_VOLUME (20* GRAPHENE_1_PERCENT) ///< 20% -#define GRAPHENE_DEFAULT_PRICE_FEED_LIFETIME (60*60*24) ///< 1 day -#define GRAPHENE_DEFAULT_MAX_AUTHORITY_MEMBERSHIP 10 -#define GRAPHENE_DEFAULT_MAX_ASSET_WHITELIST_AUTHORITIES 10 -#define GRAPHENE_DEFAULT_MAX_ASSET_FEED_PUBLISHERS 10 - -#define GRAPHENE_DEFAULT_MIN_WITNESS_COUNT (11) -#define GRAPHENE_DEFAULT_MIN_COMMITTEE_MEMBER_COUNT (11) -#define GRAPHENE_DEFAULT_MAX_WITNESSES (1001) // SHOULD BE ODD -#define GRAPHENE_DEFAULT_MAX_COMMITTEE (1001) // SHOULD BE ODD -#define GRAPHENE_DEFAULT_MAX_PROPOSAL_LIFETIME_SEC (60*60*24*7*4) // Four weeks -#define GRAPHENE_DEFAULT_COMMITTEE_PROPOSAL_REVIEW_PERIOD_SEC (60*60*24*7*2) // Two weeks -#define GRAPHENE_DEFAULT_NETWORK_PERCENT_OF_FEE (20*GRAPHENE_1_PERCENT) -#define GRAPHENE_DEFAULT_LIFETIME_REFERRER_PERCENT_OF_FEE (30*GRAPHENE_1_PERCENT) -#define GRAPHENE_DEFAULT_CASHBACK_VESTING_PERIOD_SEC (60*60*24*365) ///< 1 year -#define GRAPHENE_DEFAULT_CASHBACK_VESTING_THRESHOLD (GRAPHENE_BLOCKCHAIN_PRECISION*int64_t(100)) -#define GRAPHENE_DEFAULT_BURN_PERCENT_OF_FEE (20*GRAPHENE_1_PERCENT) -#define GRAPHENE_DEFAULT_MAX_ASSERT_OPCODE 1 -#define GRAPHENE_DEFAULT_FEE_LIQUIDATION_THRESHOLD GRAPHENE_BLOCKCHAIN_PRECISION * 100; -#define GRAPHENE_DEFAULT_ACCOUNTS_PER_FEE_SCALE 1000 -#define GRAPHENE_DEFAULT_ACCOUNT_FEE_SCALE_BITSHIFTS 4 -#define GRAPHENE_DEFAULT_MAX_BUYBACK_MARKETS 4 - -#define GRAPHENE_DEFAULT_WITNESS_PAY_PER_BLOCK (GRAPHENE_BLOCKCHAIN_PRECISION * int64_t( 10) ) -#define GRAPHENE_DEFAULT_WITNESS_PAY_VESTING_SECONDS (60*60*24) -#define GRAPHENE_DEFAULT_WORKER_BUDGET_PER_DAY (GRAPHENE_BLOCKCHAIN_PRECISION * int64_t(500) * 1000 ) -#define GRAPHENE_DEFAULT_MINIMUM_FEEDS 7 - #define GRAPHENE_MIN_BLOCK_SIZE_LIMIT (GRAPHENE_MIN_TRANSACTION_SIZE_LIMIT*5) // 5 transactions per block +#define GRAPHENE_MIN_TRANSACTION_EXPIRATION_LIMIT (GRAPHENE_MAX_BLOCK_INTERVAL * 5) // 5 transactions per block +#define GRAPHENE_BLOCKCHAIN_PRECISION uint64_t( 100000 ) +#define GRAPHENE_BLOCKCHAIN_PRECISION_DIGITS 5 +#define GRAPHENE_DEFAULT_TRANSFER_FEE (1*GRAPHENE_BLOCKCHAIN_PRECISION) +#define GRAPHENE_MAX_INSTANCE_ID (uint64_t(-1)>>16) /** percentage fields are fixed point with a denominator of 10,000 */ #define GRAPHENE_100_PERCENT 10000 #define GRAPHENE_1_PERCENT (GRAPHENE_100_PERCENT/100) /** NOTE: making this a power of 2 (say 2^15) would greatly accelerate fee calcs */ - #define GRAPHENE_MAX_MARKET_FEE_PERCENT GRAPHENE_100_PERCENT +#define GRAPHENE_DEFAULT_FORCE_SETTLEMENT_DELAY (60*60*24) ///< 1 day +#define GRAPHENE_DEFAULT_FORCE_SETTLEMENT_OFFSET 0 ///< 1% +#define GRAPHENE_DEFAULT_FORCE_SETTLEMENT_MAX_VOLUME (20* GRAPHENE_1_PERCENT) ///< 20% +#define GRAPHENE_DEFAULT_PRICE_FEED_LIFETIME (60*60*24) ///< 1 day +#define GRAPHENE_MAX_FEED_PRODUCERS 200 +#define GRAPHENE_DEFAULT_MAX_AUTHORITY_MEMBERSHIP 10 +#define GRAPHENE_DEFAULT_MAX_ASSET_WHITELIST_AUTHORITIES 10 +#define GRAPHENE_DEFAULT_MAX_ASSET_FEED_PUBLISHERS 10 + /** * These ratios are fixed point numbers with a denominator of GRAPHENE_COLLATERAL_RATIO_DENOM, the * minimum maitenance collateral is therefore 1.001x and the default @@ -116,25 +83,155 @@ #define GRAPHENE_DEFAULT_MAINTENANCE_COLLATERAL_RATIO 1750 ///< Call when collateral only pays off 175% the debt #define GRAPHENE_DEFAULT_MAX_SHORT_SQUEEZE_RATIO 1500 ///< Stop calling when collateral only pays off 150% of the debt ///@} +#define GRAPHENE_DEFAULT_MARGIN_PERIOD_SEC (30*60*60*24) + +#define GRAPHENE_DEFAULT_MIN_WITNESS_COUNT (11) +#define GRAPHENE_DEFAULT_MIN_COMMITTEE_MEMBER_COUNT (11) +#define GRAPHENE_DEFAULT_MAX_WITNESSES (1001) // SHOULD BE ODD +#define GRAPHENE_DEFAULT_MAX_COMMITTEE (1001) // SHOULD BE ODD +#define GRAPHENE_DEFAULT_MAX_PROPOSAL_LIFETIME_SEC (60*60*24*7*4) // Four weeks +#define GRAPHENE_DEFAULT_COMMITTEE_PROPOSAL_REVIEW_PERIOD_SEC (60*60*24*7*2) // Two weeks +#define GRAPHENE_DEFAULT_NETWORK_PERCENT_OF_FEE (20*GRAPHENE_1_PERCENT) +#define GRAPHENE_DEFAULT_LIFETIME_REFERRER_PERCENT_OF_FEE (30*GRAPHENE_1_PERCENT) +#define GRAPHENE_DEFAULT_MAX_BULK_DISCOUNT_PERCENT (50*GRAPHENE_1_PERCENT) +#define GRAPHENE_DEFAULT_BULK_DISCOUNT_THRESHOLD_MIN ( GRAPHENE_BLOCKCHAIN_PRECISION*int64_t(1000) ) +#define GRAPHENE_DEFAULT_BULK_DISCOUNT_THRESHOLD_MAX ( GRAPHENE_DEFAULT_BULK_DISCOUNT_THRESHOLD_MIN*int64_t(100) ) +#define GRAPHENE_DEFAULT_CASHBACK_VESTING_PERIOD_SEC (60*60*24*365) ///< 1 year +#define GRAPHENE_DEFAULT_CASHBACK_VESTING_THRESHOLD (GRAPHENE_BLOCKCHAIN_PRECISION*int64_t(100)) +#define GRAPHENE_DEFAULT_BURN_PERCENT_OF_FEE (20*GRAPHENE_1_PERCENT) +#define GRAPHENE_WITNESS_PAY_PERCENT_PRECISION (1000000000) +#define GRAPHENE_DEFAULT_MAX_ASSERT_OPCODE 1 +#define GRAPHENE_DEFAULT_FEE_LIQUIDATION_THRESHOLD GRAPHENE_BLOCKCHAIN_PRECISION * 100; +#define GRAPHENE_DEFAULT_ACCOUNTS_PER_FEE_SCALE 1000 +#define GRAPHENE_DEFAULT_ACCOUNT_FEE_SCALE_BITSHIFTS 4 +#define GRAPHENE_DEFAULT_MAX_BUYBACK_MARKETS 4 + +#define GRAPHENE_MAX_WORKER_NAME_LENGTH 63 + +#define GRAPHENE_MAX_URL_LENGTH 127 + +#define GRAPHENE_WITNESS_SHUFFLED_ALGORITHM 0 +#define GRAPHENE_WITNESS_SCHEDULED_ALGORITHM 1 + +// counter initialization values used to derive near and far future seeds for shuffling witnesses +// we use the fractional bits of sqrt(2) in hex +#define GRAPHENE_NEAR_SCHEDULE_CTR_IV ( (uint64_t( 0x6a09 ) << 0x30) \ + | (uint64_t( 0xe667 ) << 0x20) \ + | (uint64_t( 0xf3bc ) << 0x10) \ + | (uint64_t( 0xc908 ) ) ) + +// and the fractional bits of sqrt(3) in hex +#define GRAPHENE_FAR_SCHEDULE_CTR_IV ( (uint64_t( 0xbb67 ) << 0x30) \ + | (uint64_t( 0xae85 ) << 0x20) \ + | (uint64_t( 0x84ca ) << 0x10) \ + | (uint64_t( 0xa73b ) ) ) + +// counter used to determine bits of entropy +// must be less than or equal to secret_hash_type::data_length() +#define GRAPHENE_RNG_SEED_LENGTH (160 / 8) + +/** + * every second, the fraction of burned core asset which cycles is + * GRAPHENE_CORE_ASSET_CYCLE_RATE / (1 << GRAPHENE_CORE_ASSET_CYCLE_RATE_BITS) + */ +#define GRAPHENE_CORE_ASSET_CYCLE_RATE 17 +#define GRAPHENE_CORE_ASSET_CYCLE_RATE_BITS 32 + +#define GRAPHENE_DEFAULT_WITNESS_PAY_PER_BLOCK (GRAPHENE_BLOCKCHAIN_PRECISION * int64_t( 10) ) +#define GRAPHENE_DEFAULT_WITNESS_PAY_VESTING_SECONDS (60*60*24) +#define GRAPHENE_DEFAULT_WORKER_BUDGET_PER_DAY (GRAPHENE_BLOCKCHAIN_PRECISION * int64_t(500) * 1000 ) + +#define GRAPHENE_DEFAULT_MINIMUM_FEEDS 7 + +#define GRAPHENE_MAX_INTEREST_APR uint16_t( 10000 ) + +#define GRAPHENE_IRREVERSIBLE_THRESHOLD (70 * GRAPHENE_1_PERCENT) /** * Reserved Account IDs with special meaning */ ///@{ /// Represents the current committee members, two-week review period -#define GRAPHENE_COMMITTEE_ACCOUNT (graphene::protocol::account_id_type(0)) +#define GRAPHENE_COMMITTEE_ACCOUNT (graphene::chain::account_id_type(0)) /// Represents the current witnesses -#define GRAPHENE_WITNESS_ACCOUNT (graphene::protocol::account_id_type(1)) +#define GRAPHENE_WITNESS_ACCOUNT (graphene::chain::account_id_type(1)) /// Represents the current committee members -#define GRAPHENE_RELAXED_COMMITTEE_ACCOUNT (graphene::protocol::account_id_type(2)) +#define GRAPHENE_RELAXED_COMMITTEE_ACCOUNT (graphene::chain::account_id_type(2)) /// Represents the canonical account with NO authority (nobody can access funds in null account) -#define GRAPHENE_NULL_ACCOUNT (graphene::protocol::account_id_type(3)) +#define GRAPHENE_NULL_ACCOUNT (graphene::chain::account_id_type(3)) /// Represents the canonical account with WILDCARD authority (anybody can access funds in temp account) -#define GRAPHENE_TEMP_ACCOUNT (graphene::protocol::account_id_type(4)) +#define GRAPHENE_TEMP_ACCOUNT (graphene::chain::account_id_type(4)) /// Represents the canonical account for specifying you will vote directly (as opposed to a proxy) -#define GRAPHENE_PROXY_TO_SELF_ACCOUNT (graphene::protocol::account_id_type(5)) +#define GRAPHENE_PROXY_TO_SELF_ACCOUNT (graphene::chain::account_id_type(5)) +/// +#define GRAPHENE_RAKE_FEE_ACCOUNT_ID (graphene::chain::account_id_type(6)) /// Sentinel value used in the scheduler. -#define GRAPHENE_NULL_WITNESS (graphene::protocol::witness_id_type(0)) +#define GRAPHENE_NULL_WITNESS (graphene::chain::witness_id_type(0)) ///@} #define GRAPHENE_FBA_STEALTH_DESIGNATED_ASSET (asset_id_type(743)) + +#define GRAPHENE_DEFAULT_RAKE_FEE_PERCENTAGE (3*GRAPHENE_1_PERCENT) + +/** + * Betting-related constants. + * + * We store bet multipliers as fixed-precision uint32_t. These values are + * the maximum power-of-ten bet we can have on a "symmetric" market: + * (decimal) 1.0001 - 10001 + * (fractional) 1:10000 - 10000:1 + */ +///@{ +/// betting odds (multipliers) are stored as fixed-precision, divide by this to get the actual multiplier +#define GRAPHENE_BETTING_ODDS_PRECISION 10000 +/// the smallest bet multiplier we will accept +#define GRAPHENE_BETTING_MIN_MULTIPLIER 10001 +/// the largest bet multiplier we will accept +#define GRAPHENE_BETTING_MAX_MULTIPLIER 100010000 +///@} +#define GRAPHENE_DEFAULT_MIN_BET_MULTIPLIER 10100 +#define GRAPHENE_DEFAULT_MAX_BET_MULTIPLIER 10000000 +#define GRAPHENE_DEFAULT_PERMITTED_BETTING_ODDS_INCREMENTS { { 20000, 100}, /* <= 2: 0.01 */ \ + { 30000, 200}, /* <= 3: 0.02 */ \ + { 40000, 500}, /* <= 4: 0.05 */ \ + { 60000, 1000}, /* <= 6: 0.10 */ \ + { 100000, 2000}, /* <= 10: 0.20 */ \ + { 200000, 5000}, /* <= 20: 0.50 */ \ + { 300000, 10000}, /* <= 30: 1.00 */ \ + { 500000, 20000}, /* <= 50: 2.00 */ \ + { 1000000, 50000}, /* <= 100: 5.00 */ \ + { 10000000, 100000} } /* <= 1000: 10.00 */ +#define GRAPHENE_DEFAULT_BETTING_PERCENT_FEE (2 * GRAPHENE_1_PERCENT) +#define GRAPHENE_DEFAULT_LIVE_BETTING_DELAY_TIME 5 // seconds +#define TOURNAMENT_MIN_ROUND_DELAY 0 +#define TOURNAMENT_MAX_ROUND_DELAY 600 +#define TOURNAMENT_MIN_TIME_PER_COMMIT_MOVE 0 +#define TOURNAMENT_MAN_TIME_PER_COMMIT_MOVE 600 +#define TOURNAMENT_MIN_TIME_PER_REVEAL_MOVE 0 +#define TOURNAMENT_MAX_TIME_PER_REVEAL_MOVE 600 +#define TOURNAMENT_DEFAULT_RAKE_FEE_PERCENTAGE (3*GRAPHENE_1_PERCENT) +#define TOURNAMENT_MINIMAL_RAKE_FEE_PERCENTAGE (1*GRAPHENE_1_PERCENT) +#define TOURNAMENT_MAXIMAL_RAKE_FEE_PERCENTAGE (20*GRAPHENE_1_PERCENT) +#define TOURNAMENT_MAXIMAL_REGISTRATION_DEADLINE (60*60*24*30) // seconds, 30 days +#define TOURNAMENT_MAX_NUMBER_OF_WINS 100 +#define TOURNAMENT_MAX_PLAYERS_NUMBER 256 +#define TOURNAMENT_MAX_WHITELIST_LENGTH 1000 +#define TOURNAMENT_MAX_START_TIME_IN_FUTURE (60*60*24*7*4) // 1 month +#define TOURNAMENT_MAX_START_DELAY (60*60*24*7) // 1 week +#define SWEEPS_DEFAULT_DISTRIBUTION_PERCENTAGE (2*GRAPHENE_1_PERCENT) +#define SWEEPS_DEFAULT_DISTRIBUTION_ASSET (graphene::chain::asset_id_type(0)) +#define SWEEPS_VESTING_BALANCE_MULTIPLIER 100000000 +#define SWEEPS_ACCUMULATOR_ACCOUNT (graphene::chain::account_id_type(0)) +#define GPOS_PERIOD (60*60*24*30*6) // 6 months +#define GPOS_SUBPERIOD (60*60*24*30) // 1 month +#define GPOS_VESTING_LOCKIN_PERIOD (60*60*24*30) // 1 month + +#define RBAC_MIN_PERMISSION_NAME_LENGTH 3 +#define RBAC_MAX_PERMISSION_NAME_LENGTH 10 +#define RBAC_MAX_PERMISSIONS_PER_ACCOUNT 5 // 5 per account +#define RBAC_MAX_ACCOUNT_AUTHORITY_LIFETIME 180*24*60*60 // 6 months +#define RBAC_MAX_AUTHS_PER_PERMISSION 15 // 15 ops linked per permission + +#define NFT_TOKEN_MIN_LENGTH 3 +#define NFT_TOKEN_MAX_LENGTH 15 +#define NFT_URI_MAX_LENGTH GRAPHENE_MAX_URL_LENGTH diff --git a/libraries/protocol/include/graphene/protocol/event.hpp b/libraries/protocol/include/graphene/protocol/event.hpp index 5934ad89..fdf2e74d 100644 --- a/libraries/protocol/include/graphene/protocol/event.hpp +++ b/libraries/protocol/include/graphene/protocol/event.hpp @@ -23,10 +23,11 @@ */ #pragma once -#include -#include +#include +#include +#include -namespace graphene { namespace chain { +namespace graphene { namespace protocol { struct event_create_operation : public base_operation { @@ -132,16 +133,16 @@ struct event_update_status_operation : public base_operation } } -FC_REFLECT( graphene::chain::event_create_operation::fee_parameters_type, (fee) ) -FC_REFLECT( graphene::chain::event_create_operation, +FC_REFLECT( graphene::protocol::event_create_operation::fee_parameters_type, (fee) ) +FC_REFLECT( graphene::protocol::event_create_operation, (fee)(name)(season)(start_time)(event_group_id)(extensions) ) -FC_REFLECT( graphene::chain::event_update_operation::fee_parameters_type, (fee) ) -FC_REFLECT( graphene::chain::event_update_operation, +FC_REFLECT( graphene::protocol::event_update_operation::fee_parameters_type, (fee) ) +FC_REFLECT( graphene::protocol::event_update_operation, (fee)(event_id)(new_event_group_id)(new_name)(new_season)(new_start_time)(new_status)(extensions) ) -FC_REFLECT_ENUM( graphene::chain::event_status, (upcoming)(in_progress)(frozen)(finished)(canceled)(settled)(STATUS_COUNT) ) -FC_REFLECT( graphene::chain::event_update_status_operation::fee_parameters_type, (fee) ) -FC_REFLECT( graphene::chain::event_update_status_operation, +FC_REFLECT_ENUM( graphene::protocol::event_status, (upcoming)(in_progress)(frozen)(finished)(canceled)(settled)(STATUS_COUNT) ) +FC_REFLECT( graphene::protocol::event_update_status_operation::fee_parameters_type, (fee) ) +FC_REFLECT( graphene::protocol::event_update_status_operation, (fee)(event_id)(status)(scores)(extensions) ) diff --git a/libraries/protocol/include/graphene/protocol/event_group.hpp b/libraries/protocol/include/graphene/protocol/event_group.hpp index ad88ed35..9b21f057 100644 --- a/libraries/protocol/include/graphene/protocol/event_group.hpp +++ b/libraries/protocol/include/graphene/protocol/event_group.hpp @@ -23,10 +23,11 @@ */ #pragma once -#include -#include +#include +#include +#include -namespace graphene { namespace chain { +namespace graphene { namespace protocol { struct event_group_create_operation : public base_operation { @@ -86,14 +87,14 @@ struct event_group_delete_operation : public base_operation } } -FC_REFLECT( graphene::chain::event_group_create_operation::fee_parameters_type, (fee) ) -FC_REFLECT( graphene::chain::event_group_create_operation, +FC_REFLECT( graphene::protocol::event_group_create_operation::fee_parameters_type, (fee) ) +FC_REFLECT( graphene::protocol::event_group_create_operation, (fee)(name)(sport_id)(extensions) ) -FC_REFLECT( graphene::chain::event_group_update_operation::fee_parameters_type, (fee) ) -FC_REFLECT( graphene::chain::event_group_update_operation, +FC_REFLECT( graphene::protocol::event_group_update_operation::fee_parameters_type, (fee) ) +FC_REFLECT( graphene::protocol::event_group_update_operation, (fee)(new_sport_id)(new_name)(event_group_id)(extensions) ) -FC_REFLECT( graphene::chain::event_group_delete_operation::fee_parameters_type, (fee) ) -FC_REFLECT( graphene::chain::event_group_delete_operation, +FC_REFLECT( graphene::protocol::event_group_delete_operation::fee_parameters_type, (fee) ) +FC_REFLECT( graphene::protocol::event_group_delete_operation, (fee)(event_group_id)(extensions) ) diff --git a/libraries/protocol/include/graphene/protocol/exceptions.hpp b/libraries/protocol/include/graphene/protocol/exceptions.hpp index 5141151d..21a6e95b 100644 --- a/libraries/protocol/include/graphene/protocol/exceptions.hpp +++ b/libraries/protocol/include/graphene/protocol/exceptions.hpp @@ -33,16 +33,16 @@ namespace graphene { namespace protocol { - FC_DECLARE_EXCEPTION( protocol_exception, 4000000, "protocol exception" ) + FC_DECLARE_EXCEPTION( protocol_exception, 4000000 ) - FC_DECLARE_DERIVED_EXCEPTION( transaction_exception, graphene::protocol::protocol_exception, 4010000, "transaction validation exception" ) + FC_DECLARE_DERIVED_EXCEPTION( transaction_exception, graphene::protocol::protocol_exception, 4010000 ) - FC_DECLARE_DERIVED_EXCEPTION( tx_missing_active_auth, graphene::protocol::transaction_exception, 4010001, "missing required active authority" ) - FC_DECLARE_DERIVED_EXCEPTION( tx_missing_owner_auth, graphene::protocol::transaction_exception, 4010002, "missing required owner authority" ) - FC_DECLARE_DERIVED_EXCEPTION( tx_missing_other_auth, graphene::protocol::transaction_exception, 4010003, "missing required other authority" ) - FC_DECLARE_DERIVED_EXCEPTION( tx_irrelevant_sig, graphene::protocol::transaction_exception, 4010004, "irrelevant signature included" ) - FC_DECLARE_DERIVED_EXCEPTION( tx_duplicate_sig, graphene::protocol::transaction_exception, 4010005, "duplicate signature included" ) - FC_DECLARE_DERIVED_EXCEPTION( invalid_committee_approval, graphene::protocol::transaction_exception, 4010006, "committee account cannot directly approve transaction" ) - FC_DECLARE_DERIVED_EXCEPTION( insufficient_fee, graphene::protocol::transaction_exception, 4010007, "insufficient fee" ) + FC_DECLARE_DERIVED_EXCEPTION( tx_missing_active_auth, graphene::protocol::transaction_exception, 4010001 ) + FC_DECLARE_DERIVED_EXCEPTION( tx_missing_owner_auth, graphene::protocol::transaction_exception, 4010002 ) + FC_DECLARE_DERIVED_EXCEPTION( tx_missing_other_auth, graphene::protocol::transaction_exception, 4010003 ) + FC_DECLARE_DERIVED_EXCEPTION( tx_irrelevant_sig, graphene::protocol::transaction_exception, 4010004 ) + FC_DECLARE_DERIVED_EXCEPTION( tx_duplicate_sig, graphene::protocol::transaction_exception, 4010005 ) + FC_DECLARE_DERIVED_EXCEPTION( invalid_committee_approval, graphene::protocol::transaction_exception, 4010006 ) + FC_DECLARE_DERIVED_EXCEPTION( insufficient_fee, graphene::protocol::transaction_exception, 4010007 ) } } // graphene::protocol diff --git a/libraries/protocol/include/graphene/protocol/fee_schedule.hpp b/libraries/protocol/include/graphene/protocol/fee_schedule.hpp index deb5a087..3c523663 100644 --- a/libraries/protocol/include/graphene/protocol/fee_schedule.hpp +++ b/libraries/protocol/include/graphene/protocol/fee_schedule.hpp @@ -83,10 +83,6 @@ namespace graphene { namespace protocol { } } // graphene::protocol -namespace fc { - template<> struct get_typename> { static const char* name() { return "shared_ptr"; } }; -} - FC_REFLECT_TYPENAME( graphene::protocol::fee_parameters ) FC_REFLECT( graphene::protocol::fee_schedule, (parameters)(scale) ) diff --git a/libraries/protocol/include/graphene/protocol/lottery_ops.hpp b/libraries/protocol/include/graphene/protocol/lottery_ops.hpp index 4f512bce..4dc65632 100644 --- a/libraries/protocol/include/graphene/protocol/lottery_ops.hpp +++ b/libraries/protocol/include/graphene/protocol/lottery_ops.hpp @@ -22,10 +22,10 @@ * THE SOFTWARE. */ #pragma once -#include -#include +#include +#include -namespace graphene { namespace chain { +namespace graphene { namespace protocol { /** * @ingroup operations @@ -104,9 +104,9 @@ namespace graphene { namespace chain { share_type calculate_fee( const fee_parameters_type& k )const { return k.fee; } }; -} } // graphene::chain +} } // graphene::protocol -FC_REFLECT( graphene::chain::ticket_purchase_operation, +FC_REFLECT( graphene::protocol::ticket_purchase_operation, (fee) (lottery) (buyer) @@ -114,10 +114,10 @@ FC_REFLECT( graphene::chain::ticket_purchase_operation, (amount) (extensions) ) -FC_REFLECT( graphene::chain::ticket_purchase_operation::fee_parameters_type, (fee) ) +FC_REFLECT( graphene::protocol::ticket_purchase_operation::fee_parameters_type, (fee) ) -FC_REFLECT_TYPENAME( graphene::chain::ticket_num ) -FC_REFLECT( graphene::chain::lottery_reward_operation, +FC_REFLECT_TYPENAME( graphene::protocol::ticket_num ) +FC_REFLECT( graphene::protocol::lottery_reward_operation, (fee) (lottery) (winner) @@ -126,13 +126,13 @@ FC_REFLECT( graphene::chain::lottery_reward_operation, (is_benefactor_reward) (winner_ticket_id) ) -FC_REFLECT( graphene::chain::lottery_reward_operation::fee_parameters_type, (fee) ) +FC_REFLECT( graphene::protocol::lottery_reward_operation::fee_parameters_type, (fee) ) -FC_REFLECT( graphene::chain::lottery_end_operation, +FC_REFLECT( graphene::protocol::lottery_end_operation, (fee) (lottery) (participants) (extensions) ) -FC_REFLECT( graphene::chain::lottery_end_operation::fee_parameters_type, (fee) ) +FC_REFLECT( graphene::protocol::lottery_end_operation::fee_parameters_type, (fee) ) diff --git a/libraries/protocol/include/graphene/protocol/market.hpp b/libraries/protocol/include/graphene/protocol/market.hpp index 4c38b6fa..3e3b9c21 100644 --- a/libraries/protocol/include/graphene/protocol/market.hpp +++ b/libraries/protocol/include/graphene/protocol/market.hpp @@ -167,8 +167,7 @@ FC_REFLECT( graphene::protocol::fill_order_operation::fee_parameters_type, ) // FC_REFLECT( graphene::protocol::limit_order_create_operation,(fee)(seller)(amount_to_sell)(min_to_receive)(expiration)(fill_or_kill)(extensions)) FC_REFLECT( graphene::protocol::limit_order_cancel_operation,(fee)(fee_paying_account)(order)(extensions) ) FC_REFLECT( graphene::protocol::call_order_update_operation, (fee)(funding_account)(delta_collateral)(delta_debt)(extensions) ) -FC_REFLECT( graphene::protocol::fill_order_operation, (fee)(order_id)(account_id)(pays)(receives)(fill_price)(is_maker) ) -FC_REFLECT( graphene::chain::fill_order_operation, (fee)(order_id)(account_id)(pays)(receives) ) +FC_REFLECT( graphene::protocol::fill_order_operation, (fee)(order_id)(account_id)(pays)(receives) ) GRAPHENE_EXTERNAL_SERIALIZATION( extern, graphene::protocol::limit_order_create_operation::fee_parameters_type ) GRAPHENE_EXTERNAL_SERIALIZATION( extern, graphene::protocol::limit_order_cancel_operation::fee_parameters_type ) diff --git a/libraries/protocol/include/graphene/protocol/protocol.hpp b/libraries/protocol/include/graphene/protocol/protocol.hpp index faf6bdc2..3932639f 100644 --- a/libraries/protocol/include/graphene/protocol/protocol.hpp +++ b/libraries/protocol/include/graphene/protocol/protocol.hpp @@ -22,5 +22,5 @@ * THE SOFTWARE. */ #pragma once -#include -#include +#include +#include diff --git a/libraries/protocol/include/graphene/protocol/rock_paper_scissors.hpp b/libraries/protocol/include/graphene/protocol/rock_paper_scissors.hpp index 1dff56cc..0ed1b56c 100644 --- a/libraries/protocol/include/graphene/protocol/rock_paper_scissors.hpp +++ b/libraries/protocol/include/graphene/protocol/rock_paper_scissors.hpp @@ -30,8 +30,9 @@ #include #include +#include -namespace graphene { namespace chain { +namespace graphene { namespace protocol { struct rock_paper_scissors_game_options { @@ -69,14 +70,17 @@ namespace graphene { namespace chain { uint64_t nonce1; uint64_t nonce2; rock_paper_scissors_gesture gesture; - fc::sha256 calculate_hash() const; + fc::sha256 calculate_hash() const { + std::vector full_throw_packed(fc::raw::pack(*this)); + return fc::sha256::hash(full_throw_packed.data(), full_throw_packed.size()); + } }; struct rock_paper_scissors_throw_commit { uint64_t nonce1; fc::sha256 throw_hash; - bool operator<(const graphene::chain::rock_paper_scissors_throw_commit& rhs) const + bool operator<(const graphene::protocol::rock_paper_scissors_throw_commit& rhs) const { return std::tie(nonce1, throw_hash) < std::tie(rhs.nonce1, rhs.throw_hash); } @@ -92,25 +96,25 @@ namespace graphene { namespace chain { } } -FC_REFLECT( graphene::chain::rock_paper_scissors_game_options, (insurance_enabled)(time_per_commit_move)(time_per_reveal_move)(number_of_gestures) ) +FC_REFLECT( graphene::protocol::rock_paper_scissors_game_options, (insurance_enabled)(time_per_commit_move)(time_per_reveal_move)(number_of_gestures) ) -// FC_REFLECT_TYPENAME( graphene::chain::rock_paper_scissors_gesture) -FC_REFLECT_ENUM( graphene::chain::rock_paper_scissors_gesture, +// FC_REFLECT_TYPENAME( graphene::protocol::rock_paper_scissors_gesture) +FC_REFLECT_ENUM( graphene::protocol::rock_paper_scissors_gesture, (rock) (paper) (scissors) (spock) (lizard)) -FC_REFLECT( graphene::chain::rock_paper_scissors_throw, +FC_REFLECT( graphene::protocol::rock_paper_scissors_throw, (nonce1) (nonce2) (gesture) ) -FC_REFLECT( graphene::chain::rock_paper_scissors_throw_commit, +FC_REFLECT( graphene::protocol::rock_paper_scissors_throw_commit, (nonce1) (throw_hash) ) -FC_REFLECT( graphene::chain::rock_paper_scissors_throw_reveal, +FC_REFLECT( graphene::protocol::rock_paper_scissors_throw_reveal, (nonce2)(gesture) ) diff --git a/libraries/protocol/include/graphene/protocol/sport.hpp b/libraries/protocol/include/graphene/protocol/sport.hpp index a33e70e9..f0a644e1 100644 --- a/libraries/protocol/include/graphene/protocol/sport.hpp +++ b/libraries/protocol/include/graphene/protocol/sport.hpp @@ -23,10 +23,11 @@ */ #pragma once -#include -#include +#include +#include +#include -namespace graphene { namespace chain { +namespace graphene { namespace protocol { struct sport_create_operation : public base_operation { @@ -74,14 +75,14 @@ struct sport_delete_operation : public base_operation } } -FC_REFLECT( graphene::chain::sport_create_operation::fee_parameters_type, (fee) ) -FC_REFLECT( graphene::chain::sport_create_operation, +FC_REFLECT( graphene::protocol::sport_create_operation::fee_parameters_type, (fee) ) +FC_REFLECT( graphene::protocol::sport_create_operation, (fee)(name)(extensions) ) -FC_REFLECT( graphene::chain::sport_update_operation::fee_parameters_type, (fee) ) -FC_REFLECT( graphene::chain::sport_update_operation, +FC_REFLECT( graphene::protocol::sport_update_operation::fee_parameters_type, (fee) ) +FC_REFLECT( graphene::protocol::sport_update_operation, (fee)(sport_id)(new_name)(extensions) ) -FC_REFLECT( graphene::chain::sport_delete_operation::fee_parameters_type, (fee) ) -FC_REFLECT( graphene::chain::sport_delete_operation, +FC_REFLECT( graphene::protocol::sport_delete_operation::fee_parameters_type, (fee) ) +FC_REFLECT( graphene::protocol::sport_delete_operation, (fee)(sport_id)(extensions) ) diff --git a/libraries/protocol/include/graphene/protocol/tournament.hpp b/libraries/protocol/include/graphene/protocol/tournament.hpp index 5c9398d7..09b5d37a 100644 --- a/libraries/protocol/include/graphene/protocol/tournament.hpp +++ b/libraries/protocol/include/graphene/protocol/tournament.hpp @@ -30,11 +30,11 @@ #include #include -#include -#include -#include +#include +#include +#include -namespace graphene { namespace chain { +namespace graphene { namespace protocol { enum class payout_type { @@ -220,15 +220,15 @@ namespace graphene { namespace chain { } } -FC_REFLECT_ENUM(graphene::chain::payout_type, +FC_REFLECT_ENUM(graphene::protocol::payout_type, (prize_award) (buyin_refund) (rake_fee) ) -FC_REFLECT_TYPENAME( graphene::chain::game_specific_options ) -FC_REFLECT_TYPENAME( graphene::chain::game_specific_moves ) -FC_REFLECT( graphene::chain::tournament_options, +FC_REFLECT_TYPENAME( graphene::protocol::game_specific_options ) +FC_REFLECT_TYPENAME( graphene::protocol::game_specific_moves ) +FC_REFLECT( graphene::protocol::tournament_options, (registration_deadline) (number_of_players) (buy_in) @@ -239,31 +239,31 @@ FC_REFLECT( graphene::chain::tournament_options, (number_of_wins) (meta) (game_options)) -FC_REFLECT( graphene::chain::tournament_create_operation, +FC_REFLECT( graphene::protocol::tournament_create_operation, (fee) (creator) (options) (extensions)) -FC_REFLECT( graphene::chain::tournament_join_operation, +FC_REFLECT( graphene::protocol::tournament_join_operation, (fee) (payer_account_id) (player_account_id) (tournament_id) (buy_in) (extensions)) -FC_REFLECT( graphene::chain::tournament_leave_operation, +FC_REFLECT( graphene::protocol::tournament_leave_operation, (fee) (canceling_account_id) (player_account_id) (tournament_id) (extensions)) -FC_REFLECT( graphene::chain::game_move_operation, +FC_REFLECT( graphene::protocol::game_move_operation, (fee) (game_id) (player_account_id) (move) (extensions)) -FC_REFLECT( graphene::chain::tournament_payout_operation, +FC_REFLECT( graphene::protocol::tournament_payout_operation, (fee) (payout_account_id) (tournament_id) @@ -271,9 +271,9 @@ FC_REFLECT( graphene::chain::tournament_payout_operation, (type) (extensions)) -FC_REFLECT( graphene::chain::tournament_create_operation::fee_parameters_type, (fee) ) -FC_REFLECT( graphene::chain::tournament_join_operation::fee_parameters_type, (fee) ) -FC_REFLECT( graphene::chain::tournament_leave_operation::fee_parameters_type, (fee) ) -FC_REFLECT( graphene::chain::game_move_operation::fee_parameters_type, (fee) ) -FC_REFLECT( graphene::chain::tournament_payout_operation::fee_parameters_type, ) +FC_REFLECT( graphene::protocol::tournament_create_operation::fee_parameters_type, (fee) ) +FC_REFLECT( graphene::protocol::tournament_join_operation::fee_parameters_type, (fee) ) +FC_REFLECT( graphene::protocol::tournament_leave_operation::fee_parameters_type, (fee) ) +FC_REFLECT( graphene::protocol::game_move_operation::fee_parameters_type, (fee) ) +FC_REFLECT( graphene::protocol::tournament_payout_operation::fee_parameters_type, ) diff --git a/libraries/protocol/include/graphene/protocol/transaction.hpp b/libraries/protocol/include/graphene/protocol/transaction.hpp index c75ca522..cc226a72 100644 --- a/libraries/protocol/include/graphene/protocol/transaction.hpp +++ b/libraries/protocol/include/graphene/protocol/transaction.hpp @@ -230,7 +230,8 @@ namespace graphene { namespace protocol { FC_REFLECT( graphene::protocol::transaction, (ref_block_num)(ref_block_prefix)(expiration)(operations)(extensions) ) // Note: not reflecting signees field for backward compatibility; in addition, it should not be in p2p messages FC_REFLECT_DERIVED( graphene::protocol::signed_transaction, (graphene::protocol::transaction), (signatures) ) -FC_REFLECT_DERIVED( graphene::protocol::processed_transaction, (graphene::protocol::precomputable_transaction), (operation_results) ) +FC_REFLECT_DERIVED( graphene::protocol::processed_transaction, (graphene::protocol::signed_transaction), + (operation_results) ) GRAPHENE_EXTERNAL_SERIALIZATION(extern, graphene::protocol::transaction) diff --git a/libraries/protocol/include/graphene/protocol/types.hpp b/libraries/protocol/include/graphene/protocol/types.hpp index 122bc27a..94ea006e 100644 --- a/libraries/protocol/include/graphene/protocol/types.hpp +++ b/libraries/protocol/include/graphene/protocol/types.hpp @@ -177,6 +177,9 @@ using digest_type = fc::sha256; using signature_type = fc::ecc::compact_signature; using share_type = safe; using weight_type = uint16_t; +using secret_hash_type = fc::ripemd160; +using bet_multiplier_type = uint32_t; +using internationalized_string_type = flat_map; struct public_key_type { struct binary_key { @@ -195,6 +198,9 @@ struct public_key_type { friend bool operator == (const public_key_type& p1, const fc::ecc::public_key& p2); friend bool operator == (const public_key_type& p1, const public_key_type& p2); friend bool operator != (const public_key_type& p1, const public_key_type& p2); + // TODO: This is temporary for testing + bool is_valid_v1( const std::string& base58str ); + bool is_valid_muse( const std::string& base58str ); }; class pubkey_comparator { @@ -242,22 +248,22 @@ GRAPHENE_DEFINE_IDS(protocol, protocol_ids, /*protocol objects are not prefixed* (vesting_balance) (worker) (balance) - (tournament_object_type) - (tournament_details_object_type) - (match_object_type) - (game_object_type) - (sport_object_type) - (event_group_object_type) - (event_object_type) - (betting_market_rules_object_type) - (betting_market_group_object_type) - (betting_market_object_type) - (bet_object_type) - (custom_permission_object_type) - (custom_account_authority_object_type) - (offer_object_type) + (tournament) + (tournament_details) + (match) + (game) + (sport) + (event_group) + (event) + (betting_market_rules) + (betting_market_group) + (betting_market) + (bet) + (custom_permission) + (custom_account_authority) + (offer) (nft_metadata_type) - (nft_object_type)) + (nft)) FC_REFLECT(graphene::protocol::public_key_type, (key_data)) FC_REFLECT(graphene::protocol::public_key_type::binary_key, (data)(check)) diff --git a/libraries/protocol/include/graphene/protocol/vesting.hpp b/libraries/protocol/include/graphene/protocol/vesting.hpp index 98294716..ff388301 100644 --- a/libraries/protocol/include/graphene/protocol/vesting.hpp +++ b/libraries/protocol/include/graphene/protocol/vesting.hpp @@ -132,7 +132,6 @@ FC_REFLECT( graphene::protocol::vesting_balance_withdraw_operation, (fee)(vestin FC_REFLECT(graphene::protocol::linear_vesting_policy_initializer, (begin_timestamp)(vesting_cliff_seconds)(vesting_duration_seconds) ) FC_REFLECT(graphene::protocol::cdd_vesting_policy_initializer, (start_claim)(vesting_seconds) ) -FC_REFLECT_EMPTY( graphene::protocol::instant_vesting_policy_initializer ) FC_REFLECT_TYPENAME( graphene::protocol::vesting_policy_initializer ) FC_REFLECT_ENUM( graphene::protocol::vesting_balance_type, (normal)(gpos) ) diff --git a/libraries/protocol/lottery_ops.cpp b/libraries/protocol/lottery_ops.cpp index d4f11fc4..090ab556 100644 --- a/libraries/protocol/lottery_ops.cpp +++ b/libraries/protocol/lottery_ops.cpp @@ -21,9 +21,9 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ -#include +#include -namespace graphene { namespace chain { +namespace graphene { namespace protocol { void ticket_purchase_operation::validate() const { @@ -36,4 +36,4 @@ share_type ticket_purchase_operation::calculate_fee( const fee_parameters_type& return k.fee; } -} } // namespace graphene::chain +} } // namespace graphene::protocol diff --git a/libraries/protocol/operations.cpp b/libraries/protocol/operations.cpp index 4dac9c86..e525f73b 100644 --- a/libraries/protocol/operations.cpp +++ b/libraries/protocol/operations.cpp @@ -33,7 +33,7 @@ uint64_t base_operation::calculate_data_fee( uint64_t bytes, uint64_t price_per_ { auto result = (fc::uint128_t(bytes) * price_per_kbyte) / 1024; FC_ASSERT( result <= GRAPHENE_MAX_SHARE_SUPPLY ); - return result.convert_to(); + return result; } void balance_claim_operation::validate()const diff --git a/libraries/protocol/small_ops.cpp b/libraries/protocol/small_ops.cpp index 5dcf2ac9..c0ced431 100644 --- a/libraries/protocol/small_ops.cpp +++ b/libraries/protocol/small_ops.cpp @@ -22,6 +22,7 @@ * THE SOFTWARE. */ +#include #include #include #include diff --git a/libraries/protocol/sport.cpp b/libraries/protocol/sport.cpp index a8fdbf2a..a7d52f8d 100644 --- a/libraries/protocol/sport.cpp +++ b/libraries/protocol/sport.cpp @@ -21,9 +21,9 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ -#include +#include -namespace graphene { namespace chain { +namespace graphene { namespace protocol { void sport_create_operation::validate() const { @@ -40,5 +40,5 @@ void sport_delete_operation::validate() const FC_ASSERT( fee.amount >= 0 ); } -} } // graphene::chain +} } // graphene::protocol diff --git a/libraries/protocol/tournament.cpp b/libraries/protocol/tournament.cpp index 78ab4c01..33ca25de 100644 --- a/libraries/protocol/tournament.cpp +++ b/libraries/protocol/tournament.cpp @@ -21,10 +21,10 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ -#include +#include #include -namespace graphene { namespace chain { +namespace graphene { namespace protocol { void tournament_options::validate() const { @@ -73,4 +73,4 @@ void game_move_operation::validate()const { } -} } // namespace graphene::chain +} } // namespace graphene::protocol diff --git a/libraries/protocol/transaction.cpp b/libraries/protocol/transaction.cpp index c47e1e56..04549691 100644 --- a/libraries/protocol/transaction.cpp +++ b/libraries/protocol/transaction.cpp @@ -29,7 +29,6 @@ #include #include -#include #include #include @@ -64,7 +63,7 @@ void transaction::validate() const operation_validate(op); } -graphene::chain::transaction_id_type graphene::chain::transaction::id() const +graphene::protocol::transaction_id_type graphene::protocol::transaction::id() const { auto h = digest(); transaction_id_type result; @@ -448,4 +447,3 @@ void signed_transaction::verify_authority( GRAPHENE_EXTERNAL_SERIALIZATION(/*not extern*/, graphene::protocol::transaction) GRAPHENE_EXTERNAL_SERIALIZATION(/*not extern*/, graphene::protocol::signed_transaction) GRAPHENE_EXTERNAL_SERIALIZATION(/*not extern*/, graphene::protocol::processed_transaction) - diff --git a/libraries/protocol/witness.cpp b/libraries/protocol/witness.cpp index 484a1589..91915323 100644 --- a/libraries/protocol/witness.cpp +++ b/libraries/protocol/witness.cpp @@ -21,7 +21,6 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ -#include #include #include diff --git a/libraries/wallet/wallet.cpp b/libraries/wallet/wallet.cpp index b0b41051..e5d4ed66 100644 --- a/libraries/wallet/wallet.cpp +++ b/libraries/wallet/wallet.cpp @@ -74,7 +74,7 @@ #include #include #include -#include +#include #include #include diff --git a/programs/cli_wallet/main.cpp b/programs/cli_wallet/main.cpp index 98c68835..6c19406d 100644 --- a/programs/cli_wallet/main.cpp +++ b/programs/cli_wallet/main.cpp @@ -37,7 +37,7 @@ #include #include -#include +#include #include #include #include diff --git a/programs/js_operation_serializer/main.cpp b/programs/js_operation_serializer/main.cpp index 63a6d604..74d817ba 100644 --- a/programs/js_operation_serializer/main.cpp +++ b/programs/js_operation_serializer/main.cpp @@ -133,7 +133,6 @@ template<> struct js_name { static std::string name(){ retu template<> struct js_name { static std::string name(){ return "bytes 28"; } }; template<> struct js_name { static std::string name(){ return "bytes 32"; } }; template<> struct js_name { static std::string name(){ return "varuint32"; } }; -template<> struct js_name { static std::string name(){ return "varint32"; } }; template<> struct js_name< vote_id_type > { static std::string name(){ return "vote_id"; } }; template<> struct js_name< time_point_sec > { static std::string name(){ return "time_point_sec"; } }; @@ -141,12 +140,8 @@ template struct js_name > { static std::string name(){ -<<<<<<< HEAD - return "protocol_id_type \"" + remove_namespace(fc::get_typename::name()) + "\""; -======= return "protocol_id_type(\"" + remove_namespace(fc::get_typename>>::name()) + "\")"; ->>>>>>> eec1da5b... Ref #1506: Isolate chain/protocol to its own library }; }; @@ -351,14 +346,15 @@ class register_member_visitor } }; -template +template ()> struct serializer_init_helper { static void init() { auto name = js_name::name(); if( st.find(name) == st.end() ) { - fc::reflector::visit( register_member_visitor() ); + register_member_visitor visitor; + fc::reflector::visit( visitor ); register_serializer( name, [=](){ generate(); } ); } } @@ -370,14 +366,15 @@ struct serializer_init_helper { << " = new Serializer( \n" << " \"" + name + "\"\n"; - fc::reflector::visit( serialize_member_visitor() ); + serialize_member_visitor visitor; + fc::reflector::visit( visitor ); std::cout <<")\n\n"; } }; template -struct serializer_init_helper { +struct serializer_init_helper { static void init() { } @@ -390,7 +387,7 @@ struct serializer static void init() { - serializer_init_helper< T, typename fc::reflector::is_enum >::init(); + serializer_init_helper< T >::init(); } }; diff --git a/tests/betting/betting_tests.cpp b/tests/betting/betting_tests.cpp index 4befe25c..fe4134ec 100644 --- a/tests/betting/betting_tests.cpp +++ b/tests/betting/betting_tests.cpp @@ -35,7 +35,7 @@ #include #include -#include +#include #include #include diff --git a/tests/common/database_fixture.hpp b/tests/common/database_fixture.hpp index 5f1ebc16..7f29f7ee 100644 --- a/tests/common/database_fixture.hpp +++ b/tests/common/database_fixture.hpp @@ -31,6 +31,9 @@ #include #include #include +#include +#include +#include #include #include diff --git a/tests/generate_empty_blocks/main.cpp b/tests/generate_empty_blocks/main.cpp index 6e40e2cb..b3da426d 100644 --- a/tests/generate_empty_blocks/main.cpp +++ b/tests/generate_empty_blocks/main.cpp @@ -32,7 +32,7 @@ #include #include -#include +#include #include #include diff --git a/tests/intense/block_tests.cpp b/tests/intense/block_tests.cpp index 7004f13f..25134fce 100644 --- a/tests/intense/block_tests.cpp +++ b/tests/intense/block_tests.cpp @@ -28,7 +28,7 @@ #include #include -#include +#include #include #include #include diff --git a/tests/performance/performance_tests.cpp b/tests/performance/performance_tests.cpp index e7d0c98b..70824818 100644 --- a/tests/performance/performance_tests.cpp +++ b/tests/performance/performance_tests.cpp @@ -24,7 +24,7 @@ #include #include -#include +#include #include #include diff --git a/tests/tests/authority_tests.cpp b/tests/tests/authority_tests.cpp index a6169489..5d4edff1 100644 --- a/tests/tests/authority_tests.cpp +++ b/tests/tests/authority_tests.cpp @@ -25,7 +25,7 @@ #include #include -#include +#include #include #include diff --git a/tests/tests/basic_tests.cpp b/tests/tests/basic_tests.cpp index da608541..cb214ed8 100644 --- a/tests/tests/basic_tests.cpp +++ b/tests/tests/basic_tests.cpp @@ -25,7 +25,7 @@ #include #include -#include +#include #include #include diff --git a/tests/tests/confidential_tests.cpp b/tests/tests/confidential_tests.cpp index a6a19f06..b57f2625 100644 --- a/tests/tests/confidential_tests.cpp +++ b/tests/tests/confidential_tests.cpp @@ -25,7 +25,7 @@ #include #include -#include +#include #include #include diff --git a/tests/tests/network_broadcast_api_tests.cpp b/tests/tests/network_broadcast_api_tests.cpp index 4c3e7ed4..1b235c95 100644 --- a/tests/tests/network_broadcast_api_tests.cpp +++ b/tests/tests/network_broadcast_api_tests.cpp @@ -5,10 +5,11 @@ #include #include #include -#include +#include #include #include -#include +#include +#include #include #include diff --git a/tests/tournament/tournament_tests.cpp b/tests/tournament/tournament_tests.cpp index 8aa88479..1c5f51f7 100644 --- a/tests/tournament/tournament_tests.cpp +++ b/tests/tournament/tournament_tests.cpp @@ -273,7 +273,6 @@ BOOST_FIXTURE_TEST_CASE( whitelist_must_not_be_longer_than, database_fixture ) BOOST_CHECK(nathan.is_lifetime_member()); asset buy_in = asset(10000); - db.get_global_properties().parameters.maximum_tournament_whitelist_length; flat_set whitelist; for(uint16_t i = 0; i < db.get_global_properties().parameters.maximum_tournament_whitelist_length+1; ++i) { @@ -1611,7 +1610,7 @@ BOOST_FIXTURE_TEST_CASE( simple, database_fixture ) const account_object winner = winner_id(db); BOOST_TEST_MESSAGE( "The winner is " + winner.name ); - share_type rake_amount = (fc::uint128_t(tournament.prize_pool.value) * rake_fee_percentage / GRAPHENE_1_PERCENT / 100).to_uint64(); + share_type rake_amount = (fc::uint128_t(tournament.prize_pool.value) * rake_fee_percentage / GRAPHENE_1_PERCENT / 100); optional dividend_account = tournament_helper.get_asset_dividend_account(tournament.options.buy_in.asset_id); if (dividend_account.valid()) players_balances[*dividend_account][tournament.options.buy_in.asset_id] += rake_amount; @@ -1728,7 +1727,7 @@ BOOST_FIXTURE_TEST_CASE( ties, database_fixture ) assert(final_match.match_winners.size() == 1); const account_id_type& winner_id = *final_match.match_winners.begin(); BOOST_TEST_MESSAGE( "The winner of " + std::string(object_id_type(tournament_id)) + " is " + winner_id(db).name + " " + std::string(object_id_type(winner_id))); - share_type rake_amount = (fc::uint128_t(tournament.prize_pool.value) * rake_fee_percentage / GRAPHENE_1_PERCENT / 100).to_uint64(); + share_type rake_amount = (fc::uint128_t(tournament.prize_pool.value) * rake_fee_percentage / GRAPHENE_1_PERCENT / 100); optional dividend_account = tournament_helper.get_asset_dividend_account(tournament.options.buy_in.asset_id); if (dividend_account.valid()) players_balances[*dividend_account][tournament.options.buy_in.asset_id] += rake_amount; players_balances[winner_id][tournament.options.buy_in.asset_id] += tournament.prize_pool - rake_amount; @@ -1940,7 +1939,7 @@ BOOST_FIXTURE_TEST_CASE( assets, database_fixture ) assert(final_match.match_winners.size() == 1); const account_id_type& winner_id = *final_match.match_winners.begin(); BOOST_TEST_MESSAGE( "The winner of " + std::string(object_id_type(tournament_id)) + " is " + winner_id(db).name + " " + std::string(object_id_type(winner_id))); - share_type rake_amount = (fc::uint128_t(tournament.prize_pool.value) * rake_fee_percentage / GRAPHENE_1_PERCENT / 100).to_uint64(); + share_type rake_amount = (fc::uint128_t(tournament.prize_pool.value) * rake_fee_percentage / GRAPHENE_1_PERCENT / 100); optional dividend_account = tournament_helper.get_asset_dividend_account(tournament.options.buy_in.asset_id); if (dividend_account.valid()) players_balances[*dividend_account][tournament.options.buy_in.asset_id] += rake_amount; players_balances[winner_id][tournament.options.buy_in.asset_id] += tournament.prize_pool - rake_amount; @@ -2076,7 +2075,7 @@ BOOST_FIXTURE_TEST_CASE( basic, database_fixture ) assert(final_match.match_winners.size() == 1); const account_id_type& winner_id = *final_match.match_winners.begin(); BOOST_TEST_MESSAGE( "The winner of " + std::string(object_id_type(tournament_id)) + " is " + winner_id(db).name + " " + std::string(object_id_type(winner_id))); - share_type rake_amount = (fc::uint128_t(tournament.prize_pool.value) * rake_fee_percentage / GRAPHENE_1_PERCENT / 100).to_uint64(); + share_type rake_amount = (fc::uint128_t(tournament.prize_pool.value) * rake_fee_percentage / GRAPHENE_1_PERCENT / 100); optional dividend_account = tournament_helper.get_asset_dividend_account(tournament.options.buy_in.asset_id); if (dividend_account.valid()) players_initial_balances[*dividend_account][tournament.options.buy_in.asset_id] += rake_amount; @@ -2214,7 +2213,7 @@ BOOST_FIXTURE_TEST_CASE( massive, database_fixture ) assert(final_match.match_winners.size() == 1); const account_id_type& winner_id = *final_match.match_winners.begin(); BOOST_TEST_MESSAGE( "The winner of " + std::string(object_id_type(tournament_id)) + " is " + winner_id(db).name + " " + std::string(object_id_type(winner_id))); - share_type rake_amount = (fc::uint128_t(tournament.prize_pool.value) * rake_fee_percentage / GRAPHENE_1_PERCENT / 100).to_uint64(); + share_type rake_amount = (fc::uint128_t(tournament.prize_pool.value) * rake_fee_percentage / GRAPHENE_1_PERCENT / 100); optional dividend_account = tournament_helper.get_asset_dividend_account(tournament.options.buy_in.asset_id); if (dividend_account.valid()) players_balances[*dividend_account][tournament.options.buy_in.asset_id] += rake_amount;