Skip to content

Commit

Permalink
Merge branch 'release' into testnet_release
Browse files Browse the repository at this point in the history
Resolved conflicts:
- sonar-project.properties
  • Loading branch information
abitmore committed Nov 9, 2022
2 parents c65a326 + 97cee1b commit 5bd4e2b
Show file tree
Hide file tree
Showing 26 changed files with 223 additions and 174 deletions.
2 changes: 1 addition & 1 deletion libraries/app/include/graphene/app/api.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -864,7 +864,7 @@ FC_API(graphene::app::crypto_api,
)
FC_API(graphene::app::asset_api,
(get_asset_holders)
(get_asset_holders_count)
(get_asset_holders_count)
(get_all_asset_holders)
)
FC_API(graphene::app::orders_api,
Expand Down
3 changes: 2 additions & 1 deletion libraries/app/include/graphene/app/api_objects.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,8 @@ FC_REFLECT( graphene::app::order, (price)(quote)(base)(id)(owner_id)(owner_name)
FC_REFLECT( graphene::app::order_book, (base)(quote)(bids)(asks) )
FC_REFLECT( graphene::app::market_ticker,
(time)(base)(quote)(latest)(lowest_ask)(lowest_ask_base_size)(lowest_ask_quote_size)
(highest_bid)(highest_bid_base_size)(highest_bid_quote_size)(percent_change)(base_volume)(quote_volume)(mto_id) )
(highest_bid)(highest_bid_base_size)(highest_bid_quote_size)(percent_change)(base_volume)(quote_volume)
(mto_id) )
FC_REFLECT( graphene::app::market_volume, (time)(base)(quote)(base_volume)(quote_volume) )
FC_REFLECT( graphene::app::market_trade, (sequence)(date)(price)(amount)(value)(type)
(side1_account_id)(side2_account_id) )
Expand Down
2 changes: 1 addition & 1 deletion libraries/chain/asset_evaluator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1211,7 +1211,7 @@ static extendable_operation_result pay_settle_from_gs_fund( database& d,

asset settled_amount = ( op.amount.amount == mia_dyn.current_supply )
? asset( bitasset.settlement_fund, bitasset.options.short_backing_asset )
: op.amount * bitasset.settlement_price; // round down, favors global settlement fund
: ( op.amount * bitasset.settlement_price ); // round down, favors global settlement fund
if( op.amount.amount != mia_dyn.current_supply )
{
// should be strictly < except for PM with zero outcome since in that case bitasset.settlement_fund is zero
Expand Down
11 changes: 5 additions & 6 deletions libraries/chain/db_debug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,12 +116,11 @@ void database::debug_dump()

void debug_apply_update( database& db, const fc::variant_object& vo )
{
static const uint8_t
db_action_nil = 0,
db_action_create = 1,
db_action_write = 2,
db_action_update = 3,
db_action_delete = 4;
constexpr uint8_t db_action_nil = 0;
constexpr uint8_t db_action_create = 1;
constexpr uint8_t db_action_write = 2;
constexpr uint8_t db_action_update = 3;
constexpr uint8_t db_action_delete = 4;

// "_action" : "create" object must not exist, unspecified fields take defaults
// "_action" : "write" object may exist, is replaced entirely, unspecified fields take defaults
Expand Down
18 changes: 11 additions & 7 deletions libraries/chain/include/graphene/chain/account_object.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,10 @@ namespace graphene { namespace chain {
uint64_t vp_committee = 0; ///< the final voting power for the committees.
uint64_t vp_witness = 0; ///< the final voting power for the witnesses.
uint64_t vp_worker = 0; ///< the final voting power for the workers.
/// timestamp of the last count of votes.
/// if there is no statistics, the date is less than `_db.get_dynamic_global_properties().last_vote_tally_time`.
time_point_sec vote_tally_time;
/// Timestamp of the last count of votes.
/// If there is no statistics,
/// the date is less than `_db.get_dynamic_global_properties().last_vote_tally_time`.
time_point_sec vote_tally_time;
///@}

/// Whether this account owns some CORE asset and is voting
Expand Down Expand Up @@ -160,7 +161,8 @@ namespace graphene { namespace chain {
account_id_type owner;
asset_id_type asset_type;
share_type balance;
bool maintenance_flag = false; ///< Whether need to process this balance object in maintenance interval
/// Whether need to process this balance object in maintenance interval
bool maintenance_flag = false;

asset get_balance()const { return asset(balance, asset_type); }
void adjust_balance(const asset& delta);
Expand Down Expand Up @@ -364,8 +366,10 @@ namespace graphene { namespace chain {
virtual void about_to_modify( const object& before ) override;
virtual void object_modified( const object& after ) override;

const map< asset_id_type, const account_balance_object* >& get_account_balances( const account_id_type& acct )const;
const account_balance_object* get_account_balance( const account_id_type& acct, const asset_id_type& asset )const;
const map< asset_id_type, const account_balance_object* >& get_account_balances(
const account_id_type& acct )const;
const account_balance_object* get_account_balance( const account_id_type& acct,
const asset_id_type& asset )const;

private:
static const uint8_t bits;
Expand Down Expand Up @@ -428,7 +432,7 @@ namespace graphene { namespace chain {

struct by_maintenance_seq;
struct by_voting_power_active;

/**
* @ingroup object_index
*/
Expand Down
2 changes: 1 addition & 1 deletion libraries/chain/include/graphene/chain/asset_object.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ namespace graphene { namespace chain {
{ return db.get(dynamic_asset_data_id); }

/**
* The total amount of an asset that is reserved for future issuance.
* The total amount of an asset that is reserved for future issuance.
*/
template<class DB>
share_type reserved( const DB& db )const
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,15 @@ struct by_commitment;
/**
* @ingroup object_index
*/
typedef multi_index_container<
using blinded_balance_obj_multi_idx = multi_index_container<
blinded_balance_object,
indexed_by<
ordered_unique< tag<by_id>, member< object, object_id_type, &object::id > >,
ordered_unique< tag<by_commitment>, member<blinded_balance_object, commitment_type, &blinded_balance_object::commitment> >
ordered_unique< tag<by_commitment>,
member<blinded_balance_object, commitment_type, &blinded_balance_object::commitment> >
>
> blinded_balance_object_multi_index_type;
typedef generic_index<blinded_balance_object, blinded_balance_object_multi_index_type> blinded_balance_index;
>;
using blinded_balance_index = generic_index<blinded_balance_object, blinded_balance_obj_multi_idx>;

} } // graphene::chain

Expand Down
2 changes: 1 addition & 1 deletion libraries/chain/include/graphene/chain/database.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ namespace graphene { namespace chain {
* to newly created VBID and return it.
*
* Otherwise, credit amount to ovbid.
*
*
* @return ID of newly created VBO, but only if VBO was created.
*/
optional< vesting_balance_id_type > deposit_lazy_vesting(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ namespace graphene { namespace chain {
time_point_sec time;
witness_id_type current_witness;
time_point_sec next_maintenance_time;
time_point_sec last_vote_tally_time;
time_point_sec last_vote_tally_time;
time_point_sec last_budget_time;
share_type witness_budget;
share_type total_pob;
Expand Down
70 changes: 37 additions & 33 deletions libraries/chain/include/graphene/chain/htlc_object.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,83 +33,87 @@ namespace graphene { namespace chain {

/**
* @brief database object to store HTLCs
*
*
* This object is stored in the database while an HTLC is active. The HTLC will
* become inactive at expiration or when unlocked via the preimage.
*/
class htlc_object : public graphene::db::abstract_object<htlc_object, protocol_ids, htlc_object_type>
{
public:
struct transfer_info {
account_id_type from;
account_id_type to;
share_type amount;
asset_id_type asset_id;
} transfer;
struct condition_info {
struct hash_lock_info {
htlc_hash preimage_hash;
uint16_t preimage_size;
} hash_lock;
struct time_lock_info {
fc::time_point_sec expiration;
} time_lock;
} conditions;
public:
struct transfer_info
{
account_id_type from;
account_id_type to;
share_type amount;
asset_id_type asset_id;
};
struct condition_info
{
struct hash_lock_info
{
htlc_hash preimage_hash;
uint16_t preimage_size;
};
struct time_lock_info
{
fc::time_point_sec expiration;
};
hash_lock_info hash_lock;
time_lock_info time_lock;
};

fc::optional<memo_data> memo;
transfer_info transfer;
condition_info conditions;
fc::optional<memo_data> memo;

/****
* Index helper for timelock
*/
struct timelock_extractor {
typedef fc::time_point_sec result_type;
using result_type = fc::time_point_sec;
const result_type& operator()(const htlc_object& o)const { return o.conditions.time_lock.expiration; }
};

/*****
* Index helper for from
*/
struct from_extractor {
typedef account_id_type result_type;
using result_type = account_id_type;
const result_type& operator()(const htlc_object& o)const { return o.transfer.from; }
};

/*****
* Index helper for to
*/
struct to_extractor {
typedef account_id_type result_type;
using result_type = account_id_type;
const result_type& operator()(const htlc_object& o)const { return o.transfer.to; }
};
};

struct by_from_id;
struct by_expiration;
struct by_to_id;
typedef multi_index_container<
using htlc_object_multi_index_type = multi_index_container<
htlc_object,
indexed_by<
ordered_unique< tag< by_id >, member< object, object_id_type, &object::id > >,

ordered_unique< tag< by_expiration >,
composite_key< htlc_object,
ordered_unique< tag< by_expiration >,
composite_key< htlc_object,
htlc_object::timelock_extractor,
member< object, object_id_type, &object::id > > >,

ordered_unique< tag< by_from_id >,
composite_key< htlc_object,
composite_key< htlc_object,
htlc_object::from_extractor,
member< object, object_id_type, &object::id > > >,

ordered_unique< tag< by_to_id >,
composite_key< htlc_object,
composite_key< htlc_object,
htlc_object::to_extractor,
member< object, object_id_type, &object::id > > >
>

> htlc_object_index_type;
>
>;

typedef generic_index< htlc_object, htlc_object_index_type > htlc_index;
using htlc_index = generic_index< htlc_object, htlc_object_multi_index_type >;

} } // namespace graphene::chain

Expand Down
5 changes: 2 additions & 3 deletions libraries/chain/include/graphene/chain/proposal_object.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ namespace graphene { namespace chain {
class database;

/**
* @brief tracks the approval of a partially approved transaction
* @brief tracks the approval of a partially approved transaction
* @ingroup object
* @ingroup protocol
*/
Expand All @@ -56,7 +56,7 @@ class proposal_object : public abstract_object<proposal_object, protocol_ids, pr

/**
* @brief tracks all of the proposal objects that requrie approval of
* an individual account.
* an individual account.
*
* @ingroup object
* @ingroup protocol
Expand Down Expand Up @@ -88,7 +88,6 @@ typedef boost::multi_index_container<
proposal_object,
indexed_by<
ordered_unique< tag< by_id >, member< object, object_id_type, &object::id > >,
//ordered_non_unique< tag< by_expiration >, member< proposal_object, time_point_sec, &proposal_object::expiration_time > >
ordered_unique<tag<by_expiration>,
composite_key<proposal_object,
member<proposal_object, time_point_sec, &proposal_object::expiration_time>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,16 @@ class special_authority_object : public graphene::db::abstract_object<special_au

struct by_account;

typedef multi_index_container<
using special_authority_multi_idx_typ = multi_index_container<
special_authority_object,
indexed_by<
ordered_unique< tag<by_id>, member< object, object_id_type, &object::id > >,
ordered_unique< tag<by_account>, member< special_authority_object, account_id_type, &special_authority_object::account> >
ordered_unique< tag<by_account>,
member< special_authority_object, account_id_type, &special_authority_object::account> >
>
> special_authority_multi_index_type;
>;

typedef generic_index< special_authority_object, special_authority_multi_index_type > special_authority_index;
using special_authority_index = generic_index< special_authority_object, special_authority_multi_idx_typ >;

} } // graphene::chain

Expand Down
4 changes: 2 additions & 2 deletions libraries/chain/include/graphene/chain/ticket_object.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ class ticket_object : public abstract_object<ticket_object, protocol_ids, ticket
return _seconds_to_downgrade[ static_cast<uint8_t>(i) ];
}
static uint8_t value_multiplier( ticket_type i, ticket_version version ) {
static constexpr uint32_t _value_multiplier_v1[] = { 1, 2, 4, 8, 8, 0 };
static constexpr uint32_t _value_multiplier_v2[] = { 0, 2, 4, 8, 8, 0 };
static constexpr uint8_t _value_multiplier_v1[] = { 1, 2, 4, 8, 8, 0 };
static constexpr uint8_t _value_multiplier_v2[] = { 0, 2, 4, 8, 8, 0 };
return ( version == ticket_v1 ? _value_multiplier_v1[ static_cast<uint8_t>(i) ]
: _value_multiplier_v2[ static_cast<uint8_t>(i) ] );
}
Expand Down
Loading

0 comments on commit 5bd4e2b

Please sign in to comment.