Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge 3.0.0 release to develop #1686

Merged
merged 209 commits into from
Mar 29, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
209 commits
Select commit Hold shift + click to select a range
84c7218
BitAsset obj: added maintenance_collateralization
abitmore Aug 31, 2018
6254076
Refactored feed_price::max_short_squeeze_price()
abitmore Aug 31, 2018
9b41a92
Updated comment in price::call_price()
abitmore Aug 31, 2018
5308ea0
Iterates by collateral in globally_settle_asset()
abitmore Aug 31, 2018
c912886
Iterate call orders by collateral in apply_order()
abitmore Aug 31, 2018
469a499
Iterate calls by collateral in check_call_orders()
abitmore Sep 1, 2018
cb7bd0c
db_market: stop using call_price after hf #1270
abitmore Sep 1, 2018
0ba6cb1
Do not update current_maint_collateral before hf
abitmore Sep 4, 2018
92a3b71
check revive: stop using call_price after hf #1270
abitmore Sep 4, 2018
077f4e0
update call: stop using call_price after hf #1270
abitmore Sep 4, 2018
68c702b
Update and match call orders at hf #1270
abitmore Sep 9, 2018
8bcf38d
Check for blackswan by collateral after hf #1270
abitmore Sep 9, 2018
fd1c091
get_call_orders() database API: use by_collateral
abitmore Sep 9, 2018
129e89c
Minor coding style update
abitmore Sep 13, 2018
9af57a8
Bump DB_VERSION due to call_order_object change
abitmore Sep 13, 2018
b5e63a3
Target CR: stop using call_price after hf #1270
abitmore Sep 22, 2018
c6ca2c8
Initial HTLC commit
jmjatlanta Sep 5, 2018
bab9fb7
Fix compile errors
jmjatlanta Sep 5, 2018
81996c4
Fix tests
jmjatlanta Sep 5, 2018
3afa87e
added signature test
jmjatlanta Sep 7, 2018
6e960ef
Intermediate commit for adding htlc to wallet api
jmjatlanta Sep 14, 2018
f470aa3
Improvements to cli_wallet test
jmjatlanta Sep 16, 2018
b5510ac
Added update_htlc to wallet api
jmjatlanta Sep 17, 2018
40d22aa
Removed debugging code
jmjatlanta Sep 17, 2018
eb1225e
add htlc to switch-case
jmjatlanta Sep 27, 2018
d367c2c
Change method names to match spec
jmjatlanta Oct 12, 2018
6ded688
Boost 1.58 compatibility
jmjatlanta Oct 13, 2018
9a502a3
add get_typename for enum
jmjatlanta Oct 15, 2018
dc82610
Addition of SHA1 and committee parameters
jmjatlanta Oct 15, 2018
49822e1
Refactor committee parameters
jmjatlanta Oct 24, 2018
3ac8323
Test cleanup. Hardfork protection still needed.
jmjatlanta Oct 24, 2018
a30df56
modified name of optional committee parameters
jmjatlanta Oct 26, 2018
b5dae57
beginning of hardfork protection
jmjatlanta Oct 26, 2018
bc48b36
Code cleanup and comments
jmjatlanta Oct 29, 2018
5c5a0d7
Beginning of fee implementation
jmjatlanta Oct 29, 2018
ac29e84
committee fee flexibility and bug fixes
jmjatlanta Oct 30, 2018
50f6584
Calculate fees based on # days
jmjatlanta Oct 30, 2018
b80feab
Distribute Asset Market Fees to Referral Program
OpenLedgerApp Nov 6, 2018
e8faf81
Added hardfork protection to proposal_create
jmjatlanta Nov 7, 2018
2c7f7f9
Removed debugging code
jmjatlanta Nov 7, 2018
558f1ec
- prepare vesting balance object for hardfork
OpenLedgerApp Nov 9, 2018
45e1159
Unit tests for asset
OpenLedgerApp Nov 12, 2018
44049b0
Apply market fee sharing whitelist
OpenLedgerApp Nov 16, 2018
b6a813a
Add instant_vesting_policy
OpenLedgerApp Nov 16, 2018
2429cb6
Add check for hf 1268 to proposal_create_evaluator
OpenLedgerApp Nov 16, 2018
c7d8a5b
Check accumulated fees before/after HF_1268
OpenLedgerApp Nov 20, 2018
b52ea71
Add hardfork protection to prevent vesting_balance_create operation w…
OpenLedgerApp Nov 20, 2018
7a52803
Remove function [get_mfs_vesting_balances]
OpenLedgerApp Nov 27, 2018
59b4190
Check asset restrictions
OpenLedgerApp Nov 27, 2018
3123003
Optimize vesting_balance_index
OpenLedgerApp Nov 27, 2018
c5a6835
Add perfomance benchmark
OpenLedgerApp Dec 6, 2018
68982ca
Added base16 to htlc hash for cli wallet
jmjatlanta Dec 11, 2018
44d4134
fix for redeem
jmjatlanta Dec 11, 2018
13926f5
Added details to history for HTLC create and redeem
jmjatlanta Dec 12, 2018
5103f7e
clearer text in account history
jmjatlanta Dec 12, 2018
2e5d74f
Adjust history lines
jmjatlanta Dec 13, 2018
d2dfa69
Modified wallet get_htlc to return pretty format
jmjatlanta Dec 13, 2018
4af8e6c
hash format fix
jmjatlanta Dec 13, 2018
5492797
Add pending info to HTLC in account history
jmjatlanta Dec 13, 2018
742f025
Fix htlc_prepare method signature
jmjatlanta Dec 13, 2018
b5b8dfc
Add virtual op for refund
jmjatlanta Dec 13, 2018
fe24161
Make refund appear in proper account
jmjatlanta Dec 13, 2018
27e2e75
Code cleanup pmconrad suggestions
jmjatlanta Dec 15, 2018
a56562a
update median feeds when crossing hf1270
oxarbitrage Dec 15, 2018
d7306ab
add testcases for mcr bug(hf1270)
oxarbitrage Dec 15, 2018
e563899
cleanup, consistent variable naming
jmjatlanta Dec 15, 2018
6239564
More consistent naming
jmjatlanta Dec 15, 2018
e914a37
Switch htlc object from implementation to protocol
jmjatlanta Dec 15, 2018
fa6b12e
Merge pull request #1469 from oxarbitrage/1270_testcases
abitmore Dec 15, 2018
c808e61
Move committee parameter hardfork validation to visitor
jmjatlanta Dec 15, 2018
fea41d7
htlc_prepare is now htlc_create, plus start of fee testing (wip)
jmjatlanta Dec 17, 2018
e2e571a
1 day and 1kb mins on fees
jmjatlanta Dec 17, 2018
5c7a9e8
still trying to get fees working
jmjatlanta Dec 18, 2018
a2192ec
fix htlc fee tests
jmjatlanta Dec 19, 2018
f7d7f5c
Making fees work with htlc tests
jmjatlanta Dec 19, 2018
96ec5f3
move hash_algoritm enum plus misc
jmjatlanta Dec 19, 2018
0244ff5
Added missing (?) includes
pmconrad Dec 19, 2018
5ffa2a0
Get rid of floating point calculations
pmconrad Dec 19, 2018
145d790
Added hf protection for htlc_operations in proposals
pmconrad Dec 19, 2018
e255f39
Validate that preimage hash length matches algorithm hash length
pmconrad Dec 19, 2018
da6fbef
Refactoring: use a static_variant instead of separate enum + hash vector
pmconrad Dec 19, 2018
793220e
added extend test + smaller misc
jmjatlanta Dec 20, 2018
57248da
handle fee multiplication overflow
jmjatlanta Dec 20, 2018
e8172e9
added messages to asserts
jmjatlanta Dec 20, 2018
2f08968
virtual op for notifications
jmjatlanta Dec 21, 2018
22ea563
More overflow protection + wording changes
jmjatlanta Dec 21, 2018
8e77fff
fix bug in fee calculation
jmjatlanta Dec 21, 2018
1195aef
Merge pull request #1370 from jmjatlanta/htlc2
pmconrad Dec 21, 2018
6809b8d
Merge pull request #1487 from bitshares/develop
pmconrad Dec 21, 2018
19375f7
Fixed build error
pmconrad Dec 21, 2018
a9606ef
Merge pull request #1488 from pmconrad/fix_hardfork_branch
pmconrad Dec 21, 2018
bf9537f
add support for existing tests after hf1270
oxarbitrage Dec 24, 2018
9f06364
print call orders instead of market in target_cr_test_limit_call
oxarbitrage Dec 25, 2018
8c0152c
Fix target CR calculation
abitmore Dec 25, 2018
613f414
Merge branch '1270-fix-call-price-cache' of https://github.com/bitsha…
oxarbitrage Dec 25, 2018
3aec53d
remove prints after fix
oxarbitrage Dec 25, 2018
46e2943
add hf1270 swan tests
oxarbitrage Dec 27, 2018
0cb1274
check max_supply before borrowing MPAs
jmjatlanta Dec 27, 2018
e003833
Remove unnecessary variable
jmjatlanta Dec 27, 2018
d58e523
Add hardfork protection
jmjatlanta Dec 31, 2018
52b6c7e
Add hard-fork maintenance logic. Test needed.
jmjatlanta Jan 3, 2019
bc45e8b
Included pre-hardfork test
jmjatlanta Jan 3, 2019
5928010
Added log message at hardfork, fixed test
jmjatlanta Jan 7, 2019
6c5e48f
fix old reference in test
jmjatlanta Jan 8, 2019
4e2514c
skip black_swan_issue_346 test after hf1270
oxarbitrage Jan 16, 2019
7abf7c5
update bitasset tests for hf1270
oxarbitrage Jan 17, 2019
60b25a0
Switch uin8_t for char for clearer serialization
jmjatlanta Jan 18, 2019
097799b
Save a ptr to asset_dynamic_data_object
jmjatlanta Jan 18, 2019
3e1e5b6
Move hardfork timestamp into the far future
OpenLedgerApp Jan 23, 2019
1b9f6c9
Merge with latest hardfork branch
OpenLedgerApp Jan 23, 2019
acab2a0
Modified hash function - vbo_mfs_hash()
OpenLedgerApp Jan 23, 2019
6b3d6ab
Merge branch 'hardfork' into 1268-market-fee-sharing
OpenLedgerApp Jan 23, 2019
a2d5fac
accurate block generation for hf1270 in market and swan tests
oxarbitrage Jan 24, 2019
aaf7701
Merge pull request #1535 from bitshares/jmj_uint8_switch
jmjatlanta Jan 24, 2019
8466e19
changes in bitasset_tests/hf_935_test
oxarbitrage Jan 25, 2019
ab4dfeb
use newly added member in all places
jmjatlanta Jan 25, 2019
0f10387
Merge pull request #1498 from bitshares/jmj_1465
jmjatlanta Jan 25, 2019
cce205c
Update hardfork date into far future
OpenLedgerApp Jan 28, 2019
8714026
Merge pull request #1419 from openledger/1268-market-fee-sharing
oxarbitrage Jan 29, 2019
b191bd7
Added allow_non_immediate_owner param to methods
abitmore Aug 14, 2018
a393c2a
Check owner authorities in sign_state
abitmore Aug 14, 2018
745a248
Added tests for non-immediate owner authorities
abitmore Aug 14, 2018
451ca3d
Added more tests for non-immediate owner authority
abitmore Aug 16, 2018
3d7904e
Proposal and hf tests for non-immediate owner auth
abitmore Aug 16, 2018
9a50898
Fixed test cases
abitmore Aug 16, 2018
7cac280
Updated coding style
abitmore Aug 19, 2018
f2c608e
Added database_api tests for non-immediate owner
abitmore Aug 19, 2018
ac310b1
Fixed test cases after rebase
abitmore Sep 13, 2018
ece99b6
workaround hf_935_test
oxarbitrage Jan 29, 2019
17b3894
Fix typo in docs
abitmore Jan 30, 2019
1aad691
use affected_by_hf_343 flag
oxarbitrage Jan 30, 2019
ca1e045
remove trailing white spaces
oxarbitrage Jan 30, 2019
6b22b91
Merge pull request #1493 from oxarbitrage/1270_existing_testcases
abitmore Jan 30, 2019
54c4c02
Merge hardfork branch
abitmore Jan 30, 2019
b494609
Revert to by_price index when globally settling
abitmore Feb 1, 2019
a22f92e
Simplify lambda
abitmore Feb 4, 2019
aff1751
Merge pull request #1324 from bitshares/1270-fix-call-price-cache
abitmore Feb 5, 2019
bdcb0ea
Fixed typos
pmconrad Feb 6, 2019
a8da5f1
merged in softfork code
jmjatlanta Feb 9, 2019
dfbb508
syntax error
jmjatlanta Feb 9, 2019
2e69219
Merge softfork & hardfork 1479
jmjatlanta Feb 9, 2019
c042e68
Merge pull request #1259 from bitshares/584-non-immediate-owner
pmconrad Feb 10, 2019
dc90123
Added missing softfork code
jmjatlanta Feb 11, 2019
8727a3c
Remove dates as this assert always applies
jmjatlanta Feb 11, 2019
a71f373
reverse ASSERT logic
jmjatlanta Feb 11, 2019
ff65ab7
fix test
jmjatlanta Feb 11, 2019
805aca3
Merge pull request #1572 from bitshares/jmj_1479b
jmjatlanta Feb 11, 2019
d046340
Added softfork window
jmjatlanta Feb 11, 2019
2f66535
Merge pull request #1571 from bitshares/jmj_1465b
jmjatlanta Feb 12, 2019
8047742
Merge 'develop' into develop-to-hardfork
abitmore Feb 12, 2019
50fd492
Reduce number of db queries in get_call_orders API
abitmore Feb 12, 2019
bedc84a
Merge branch 'develop' into develop-to-hardfork
abitmore Feb 13, 2019
085dc1a
Merge pull request #1577 from bitshares/develop-to-hardfork
abitmore Feb 14, 2019
edf1d05
Prevent transactions with size over the set limit
jmjatlanta Feb 14, 2019
959ef67
crlf to end file
jmjatlanta Feb 14, 2019
8aa19af
precompute transaction size
jmjatlanta Feb 15, 2019
19c9d73
use platform agnostic int
jmjatlanta Feb 15, 2019
e410a8a
Merge pull request #1589 from bitshares/jmj_mac_sizet
jmjatlanta Feb 16, 2019
f5db37d
fix failing tests in testnet
oxarbitrage Feb 16, 2019
71641eb
incorrect sign on log message
jmjatlanta Feb 16, 2019
a9115fb
Merge pull request #1595 from bitshares/jmj_logfix
abitmore Feb 16, 2019
db1699c
remove feed is expired checks
oxarbitrage Feb 17, 2019
b0c55b2
increase number of witnesses to hf_935_test
oxarbitrage Feb 17, 2019
81de0c5
Call get_packed_size at appropriate time.
jmjatlanta Feb 18, 2019
7d51919
wrap lines
oxarbitrage Feb 18, 2019
78aca20
Merge pull request #1594 from oxarbitrage/testnet_failing_testcases
oxarbitrage Feb 18, 2019
3846151
Merge pull request #1586 from bitshares/jmj_1573
jmjatlanta Feb 19, 2019
c8ba1f2
fix HTLC tests
jmjatlanta Feb 20, 2019
1376dd8
Merge pull request #1603 from bitshares/jmj_fixtest
oxarbitrage Feb 21, 2019
ba05bd0
bump database in hardfork
oxarbitrage Feb 25, 2019
e373cd2
Merge pull request #1616 from bitshares/oxarbitrage-patch-1
abitmore Feb 25, 2019
cfdb40c
support for Boost 1.69
jmjatlanta Feb 15, 2019
25125b1
change boost verbiage
jmjatlanta Feb 15, 2019
f50a0ef
fix formatting
jmjatlanta Feb 15, 2019
7544ea8
fix plugins option in config file
oxarbitrage Mar 8, 2019
b9339c3
move help and version sections up
oxarbitrage Mar 9, 2019
68fad47
move plugins option position in config
oxarbitrage Mar 9, 2019
78ec916
add plugins option fix in config to delayed node
oxarbitrage Mar 10, 2019
d29377b
force plugin defaults to config.ini
oxarbitrage Mar 12, 2019
69bc55a
Bump docs submodule
abitmore Mar 13, 2019
3c5105e
Merge pull request #1587 from bitshares/jmj_1557
jmjatlanta Mar 13, 2019
964aacd
Merge pull request #1648 from bitshares/bump-doc
abitmore Mar 13, 2019
de22e99
add plugin options to help
oxarbitrage Mar 13, 2019
37dfb24
parse command line after plugins
oxarbitrage Mar 13, 2019
234bddb
fix duplicated arguments in help
oxarbitrage Mar 14, 2019
7cd6e31
Look at white/blacklists on htlc_create
jmjatlanta Mar 15, 2019
ef6dc13
Fix spacing
jmjatlanta Mar 15, 2019
11f9f1b
Change format of get_htlc output
jmjatlanta Mar 15, 2019
bd7d012
allow for no results
jmjatlanta Mar 15, 2019
4ca72d8
fix long to int compiler warning
jmjatlanta Mar 15, 2019
8cb390c
Merge pull request #1647 from oxarbitrage/issue1637_2
oxarbitrage Mar 16, 2019
cfba7ad
adjust htlc_object struct
jmjatlanta Mar 16, 2019
5b5e6ad
Prove bob redeems although blacklisted
jmjatlanta Mar 17, 2019
c63d21d
Pretty-format HTLC output
jmjatlanta Mar 18, 2019
2f84da6
Merge pull request #1655 from bitshares/jmj_htlc_blacklist
jmjatlanta Mar 18, 2019
5f0e400
format of amount to include decimal
jmjatlanta Mar 19, 2019
db13838
bump DB_VERSION
jmjatlanta Mar 19, 2019
c51220b
Added time left to data returned from get_htlc
jmjatlanta Mar 20, 2019
07d10cb
using the more expresive optional<>.valid()
jmjatlanta Mar 21, 2019
de73829
Increase max_trx_size for confidential_tx test
jmjatlanta Mar 21, 2019
db045a2
Fixed spacing
jmjatlanta Mar 21, 2019
1a1ba7e
Merge pull request #1665 from bitshares/jmj_confidential_tx_test
jmjatlanta Mar 22, 2019
11432f3
Merge pull request #1656 from bitshares/jmj_1645
jmjatlanta Mar 22, 2019
3eae654
Merge branch 'hardfork' into preliminary_hf_release
pmconrad Mar 23, 2019
8dcb644
Set mainnet hardfork date
pmconrad Mar 13, 2019
80ed86d
Provide control for testing max_supply
jmjatlanta Mar 26, 2019
768e318
Merge pull request #1651 from bitshares/preliminary_hf_release
pmconrad Mar 26, 2019
fb657f6
Fix conflicts merging release to develop
jmjatlanta Mar 28, 2019
b225f96
Final cr/lf
jmjatlanta Mar 28, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,11 @@ We recommend building on Ubuntu 16.04 LTS (64-bit)
git submodule sync --recursive
git submodule update --init --recursive

**NOTE:** BitShares requires a [Boost](http://www.boost.org/) version in the range [1.57 - 1.65.1]. Versions earlier than
1.57 or newer than 1.65.1 are NOT supported. If your system's Boost version is newer, then you will need to manually build
an older version of Boost and specify it to CMake using `DBOOST_ROOT`.
**NOTE:** Versions of [Boost](http://www.boost.org/) 1.57 through 1.69 are supported. Newer versions may work, but
have not been tested. If your system came pre-installed with a version of Boost that you do not wish to use, you may
manually build your preferred version and use it with BitShares by specifying it on the CMake command line.

Example: ``cmake -DBOOST_ROOT=/path/to/boost .``

**NOTE:** BitShares requires a 64-bit operating system to build, and will not build on a 32-bit OS.

Expand Down
2 changes: 1 addition & 1 deletion docs
Submodule docs updated from 00bd50 to 0271e7
23 changes: 15 additions & 8 deletions libraries/app/database_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include <graphene/app/database_api.hpp>
#include <graphene/app/util.hpp>
#include <graphene/chain/get_config.hpp>
#include <graphene/chain/hardfork.hpp>

#include <fc/bloom_filter.hpp>

Expand Down Expand Up @@ -1291,14 +1292,13 @@ vector<call_order_object> database_api_impl::get_call_orders(const std::string&
{
FC_ASSERT( limit <= 300 );

const asset_id_type asset_a_id = get_asset_from_string(a)->id;
const auto& call_index = _db.get_index_type<call_order_index>().indices().get<by_price>();
const asset_object& mia = _db.get(asset_a_id);
price index_price = price::min(mia.bitasset_data(_db).options.short_backing_asset, mia.get_id());
const asset_object* mia = get_asset_from_string(a);
const auto& call_index = _db.get_index_type<call_order_index>().indices().get<by_collateral>();
price index_price = price::min( mia->bitasset_data(_db).options.short_backing_asset, mia->get_id() );

vector< call_order_object> result;
auto itr_min = call_index.lower_bound(index_price.min());
auto itr_max = call_index.lower_bound(index_price.max());
auto itr_min = call_index.lower_bound(index_price);
auto itr_max = call_index.upper_bound(index_price.max());
while( itr_min != itr_max && result.size() < limit )
{
result.emplace_back(*itr_min);
Expand Down Expand Up @@ -2058,10 +2058,12 @@ set<public_key_type> database_api::get_required_signatures( const signed_transac

set<public_key_type> database_api_impl::get_required_signatures( const signed_transaction& trx, const flat_set<public_key_type>& available_keys )const
{
bool allow_non_immediate_owner = ( _db.head_block_time() >= HARDFORK_CORE_584_TIME );
auto result = trx.get_required_signatures( _db.get_chain_id(),
available_keys,
[&]( account_id_type id ){ return &id(_db).active; },
[&]( account_id_type id ){ return &id(_db).owner; },
allow_non_immediate_owner,
_db.get_global_properties().parameters.max_authority_depth );
return result;
}
Expand All @@ -2077,6 +2079,7 @@ set<address> database_api::get_potential_address_signatures( const signed_transa

set<public_key_type> database_api_impl::get_potential_signatures( const signed_transaction& trx )const
{
bool allow_non_immediate_owner = ( _db.head_block_time() >= HARDFORK_CORE_584_TIME );
set<public_key_type> result;
trx.get_required_signatures(
_db.get_chain_id(),
Expand All @@ -2095,6 +2098,7 @@ set<public_key_type> database_api_impl::get_potential_signatures( const signed_t
result.insert(k);
return &auth;
},
allow_non_immediate_owner,
_db.get_global_properties().parameters.max_authority_depth
);

Expand Down Expand Up @@ -2142,10 +2146,12 @@ bool database_api::verify_authority( const signed_transaction& trx )const

bool database_api_impl::verify_authority( const signed_transaction& trx )const
{
bool allow_non_immediate_owner = ( _db.head_block_time() >= HARDFORK_CORE_584_TIME );
trx.verify_authority( _db.get_chain_id(),
[this]( account_id_type id ){ return &id(_db).active; },
[this]( account_id_type id ){ return &id(_db).owner; },
_db.get_global_properties().parameters.max_authority_depth );
allow_non_immediate_owner,
_db.get_global_properties().parameters.max_authority_depth );
return true;
}

Expand All @@ -2167,7 +2173,8 @@ bool database_api_impl::verify_account_authority( const string& account_name_or_
{
graphene::chain::verify_authority(ops, keys,
[this]( account_id_type id ){ return &id(_db).active; },
[this]( account_id_type id ){ return &id(_db).owner; } );
[this]( account_id_type id ){ return &id(_db).owner; },
true );
}
catch (fc::exception& ex)
{
Expand Down
3 changes: 2 additions & 1 deletion libraries/chain/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ add_library( graphene_chain
protocol/fee_schedule.cpp
protocol/confidential.cpp
protocol/vote.cpp

protocol/htlc.cpp
genesis_state.cpp
get_config.cpp

Expand All @@ -78,6 +78,7 @@ add_library( graphene_chain
vesting_balance_evaluator.cpp
withdraw_permission_evaluator.cpp
worker_evaluator.cpp
htlc_evaluator.cpp
confidential_evaluator.cpp
special_authority.cpp
buyback.cpp
Expand Down
66 changes: 53 additions & 13 deletions libraries/chain/asset_evaluator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,20 @@
#include <locale>

namespace graphene { namespace chain {
namespace detail {
// TODO review and remove code below and links to it after hf_1268
void check_asset_options_hf_1268(const fc::time_point_sec& block_time, const asset_options& options)
{
if( block_time < HARDFORK_1268_TIME )
{
FC_ASSERT( !options.extensions.value.reward_percent.valid(),
"Asset extension reward percent is only available after HARDFORK_1268_TIME!");

FC_ASSERT( !options.extensions.value.whitelist_market_fee_sharing.valid(),
"Asset extension whitelist_market_fee_sharing is only available after HARDFORK_1268_TIME!");
}
}
}

void_result asset_create_evaluator::do_evaluate( const asset_create_operation& op )
{ try {
Expand All @@ -45,6 +59,8 @@ void_result asset_create_evaluator::do_evaluate( const asset_create_operation& o
FC_ASSERT( op.common_options.whitelist_authorities.size() <= chain_parameters.maximum_asset_whitelist_authorities );
FC_ASSERT( op.common_options.blacklist_authorities.size() <= chain_parameters.maximum_asset_whitelist_authorities );

detail::check_asset_options_hf_1268(d.head_block_time(), op.common_options);

// Check that all authorities do exist
for( auto id : op.common_options.whitelist_authorities )
d.get_object(id);
Expand Down Expand Up @@ -277,6 +293,8 @@ void_result asset_update_evaluator::do_evaluate(const asset_update_operation& o)
validate_new_issuer( d, a, *o.new_issuer );
}

detail::check_asset_options_hf_1268(d.head_block_time(), o.new_options);

if( (d.head_block_time() < HARDFORK_572_TIME) || (a.dynamic_asset_data_id(d).current_supply != 0) )
{
// new issuer_permissions must be subset of old issuer permissions
Expand Down Expand Up @@ -638,7 +656,7 @@ static bool update_bitasset_object_options(
const asset_update_bitasset_operation& op, database& db,
asset_bitasset_data_object& bdo, const asset_object& asset_to_update )
{
const fc::time_point_sec& next_maint_time = db.get_dynamic_global_properties().next_maintenance_time;
const fc::time_point_sec next_maint_time = db.get_dynamic_global_properties().next_maintenance_time;
bool after_hf_core_868_890 = ( next_maint_time > HARDFORK_CORE_868_890_TIME );

// If the minimum number of feeds to calculate a median has changed, we need to recalculate the median
Expand Down Expand Up @@ -689,7 +707,7 @@ static bool update_bitasset_object_options(
if( should_update_feeds )
{
const auto old_feed = bdo.current_feed;
bdo.update_median_feeds( db.head_block_time() );
bdo.update_median_feeds( db.head_block_time(), next_maint_time );

// TODO review and refactor / cleanup after hard fork:
// 1. if hf_core_868_890 and core-935 occurred at same time
Expand Down Expand Up @@ -766,8 +784,9 @@ void_result asset_update_feed_producers_evaluator::do_apply(const asset_update_f
{ try {
database& d = db();
const auto head_time = d.head_block_time();
const auto next_maint_time = d.get_dynamic_global_properties().next_maintenance_time;
const asset_bitasset_data_object& bitasset_to_update = asset_to_update->bitasset_data(d);
d.modify( bitasset_to_update, [&o,head_time](asset_bitasset_data_object& a) {
d.modify( bitasset_to_update, [&o,head_time,next_maint_time](asset_bitasset_data_object& a) {
//This is tricky because I have a set of publishers coming in, but a map of publisher to feed is stored.
//I need to update the map such that the keys match the new publishers, but not munge the old price feeds from
//publishers who are being kept.
Expand All @@ -791,7 +810,7 @@ void_result asset_update_feed_producers_evaluator::do_apply(const asset_update_f
{
a.feeds[acc];
}
a.update_median_feeds( head_time );
a.update_median_feeds( head_time, next_maint_time );
});
// Process margin calls, allow black swan, not for a new limit order
d.check_call_orders( *asset_to_update, true, false, &bitasset_to_update );
Expand Down Expand Up @@ -969,27 +988,48 @@ void_result asset_publish_feeds_evaluator::do_apply(const asset_publish_feed_ope
{ try {

database& d = db();
const auto head_time = d.head_block_time();
const auto next_maint_time = d.get_dynamic_global_properties().next_maintenance_time;

const asset_object& base = *asset_ptr;
const asset_bitasset_data_object& bad = *bitasset_ptr;

auto old_feed = bad.current_feed;
// Store medians for this asset
d.modify(bad , [&o,&d](asset_bitasset_data_object& a) {
a.feeds[o.publisher] = make_pair(d.head_block_time(), o.feed);
a.update_median_feeds(d.head_block_time());
d.modify( bad , [&o,head_time,next_maint_time](asset_bitasset_data_object& a) {
a.feeds[o.publisher] = make_pair( head_time, o.feed );
a.update_median_feeds( head_time, next_maint_time );
});

if( !(old_feed == bad.current_feed) )
{
if( bad.has_settlement() ) // implies head_block_time > HARDFORK_CORE_216_TIME
// Check whether need to revive the asset and proceed if need
if( bad.has_settlement() // has globally settled, implies head_block_time > HARDFORK_CORE_216_TIME
&& !bad.current_feed.settlement_price.is_null() ) // has a valid feed
{
bool should_revive = false;
const auto& mia_dyn = base.dynamic_asset_data_id(d);
if( !bad.current_feed.settlement_price.is_null()
&& ( mia_dyn.current_supply == 0
|| ~price::call_price(asset(mia_dyn.current_supply, o.asset_id),
asset(bad.settlement_fund, bad.options.short_backing_asset),
bad.current_feed.maintenance_collateral_ratio ) < bad.current_feed.settlement_price ) )
if( mia_dyn.current_supply == 0 ) // if current supply is zero, revive the asset
should_revive = true;
else // if current supply is not zero, when collateral ratio of settlement fund is greater than MCR, revive the asset
{
if( next_maint_time <= HARDFORK_CORE_1270_TIME )
{
// before core-1270 hard fork, calculate call_price and compare to median feed
if( ~price::call_price( asset(mia_dyn.current_supply, o.asset_id),
asset(bad.settlement_fund, bad.options.short_backing_asset),
bad.current_feed.maintenance_collateral_ratio ) < bad.current_feed.settlement_price )
should_revive = true;
}
else
{
// after core-1270 hard fork, calculate collateralization and compare to maintenance_collateralization
if( price( asset( bad.settlement_fund, bad.options.short_backing_asset ),
asset( mia_dyn.current_supply, o.asset_id ) ) > bad.current_maintenance_collateralization )
should_revive = true;
}
}
if( should_revive )
d.revive_bitasset(base);
}
// Process margin calls, allow black swan, not for a new limit order
Expand Down
25 changes: 14 additions & 11 deletions libraries/chain/asset_object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
*/
#include <graphene/chain/asset_object.hpp>
#include <graphene/chain/database.hpp>
#include <graphene/chain/hardfork.hpp>

#include <fc/uint128.hpp>

Expand All @@ -43,16 +44,10 @@ share_type asset_bitasset_data_object::max_force_settlement_volume(share_type cu
return volume.to_uint64();
}

/******
* @brief calculate the median feed
*
* This calculates the median feed. It sets the current_feed_publication_time
* and current_feed member variables
*
* @param current_time the time to use in the calculations
*/
void graphene::chain::asset_bitasset_data_object::update_median_feeds(time_point_sec current_time)
void graphene::chain::asset_bitasset_data_object::update_median_feeds( time_point_sec current_time,
time_point_sec next_maintenance_time )
{
bool after_core_hardfork_1270 = ( next_maintenance_time > HARDFORK_CORE_1270_TIME ); // call price caching issue
current_feed_publication_time = current_time;
vector<std::reference_wrapper<const price_feed>> current_feeds;
// find feeds that were alive at current_time
Expand All @@ -73,13 +68,18 @@ void graphene::chain::asset_bitasset_data_object::update_median_feeds(time_point
feed_cer_updated = false; // new median cer is null, won't update asset_object anyway, set to false for better performance
current_feed_publication_time = current_time;
current_feed = price_feed();
if( after_core_hardfork_1270 )
current_maintenance_collateralization = price();
return;
}
if( current_feeds.size() == 1 )
{
if( current_feed.core_exchange_rate != current_feeds.front().get().core_exchange_rate )
feed_cer_updated = true;
current_feed = std::move(current_feeds.front());
current_feed = current_feeds.front();
// Note: perhaps can defer updating current_maintenance_collateralization for better performance
if( after_core_hardfork_1270 )
current_maintenance_collateralization = current_feed.maintenance_collateralization();
return;
}

Expand All @@ -100,6 +100,9 @@ void graphene::chain::asset_bitasset_data_object::update_median_feeds(time_point
if( current_feed.core_exchange_rate != median_feed.core_exchange_rate )
feed_cer_updated = true;
current_feed = median_feed;
// Note: perhaps can defer updating current_maintenance_collateralization for better performance
if( after_core_hardfork_1270 )
current_maintenance_collateralization = current_feed.maintenance_collateralization();
}


Expand Down Expand Up @@ -157,7 +160,7 @@ asset asset_object::amount_from_string(string amount_string) const
satoshis *= -1;

return amount(satoshis);
} FC_CAPTURE_AND_RETHROW( (amount_string) ) }
} FC_CAPTURE_AND_RETHROW( (amount_string) ) }

string asset_object::amount_to_string(share_type amount) const
{
Expand Down
4 changes: 4 additions & 0 deletions libraries/chain/committee_member_evaluator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include <graphene/chain/committee_member_evaluator.hpp>
#include <graphene/chain/committee_member_object.hpp>
#include <graphene/chain/database.hpp>
#include <graphene/chain/hardfork.hpp>
#include <graphene/chain/account_object.hpp>
#include <graphene/chain/protocol/fee_schedule.hpp>
#include <graphene/chain/protocol/vote.hpp>
Expand Down Expand Up @@ -75,6 +76,9 @@ void_result committee_member_update_global_parameters_evaluator::do_evaluate(con
{ try {
FC_ASSERT(trx_state->_is_proposed_trx);

FC_ASSERT( db().head_block_time() > HARDFORK_CORE_1468_TIME || !o.new_parameters.extensions.value.updatable_htlc_options.valid(),
"Unable to set HTLC parameters until hardfork." );

return void_result();
} FC_CAPTURE_AND_RETHROW( (o) ) }

Expand Down
Loading