Skip to content
This repository was archived by the owner on Oct 4, 2019. It is now read-only.

Commit 82edada

Browse files
authored
Merge pull request #1079 from GolosChain/golos-v0.20.0
Golos v0.20.0
2 parents a88d70e + 824cab7 commit 82edada

7 files changed

Lines changed: 49 additions & 10 deletions

File tree

libraries/chain/database.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2290,8 +2290,11 @@ namespace golos { namespace chain {
22902290
uint64_t delegators_reward = 0;
22912291
const auto& vdo_idx = get_index<vesting_delegation_index>().indices().get<by_received>();
22922292
for (auto& dvir : cvo.delegator_vote_interest_rates) {
2293+
if (dvir.interest_rate > STEEMIT_100_PERCENT) {
2294+
wlog("Skip bad delegator's interest rate: ${r}", ("r", dvir.interest_rate));
2295+
continue;
2296+
}
22932297
auto delegator_claim = claim * dvir.interest_rate / STEEMIT_100_PERCENT;
2294-
22952298
if (delegator_claim == 0) {
22962299
continue;
22972300
}
@@ -4506,6 +4509,9 @@ namespace golos { namespace chain {
45064509
FC_ASSERT(STEEMIT_HARDFORK_0_19 == 19, "Invalid hardfork configuration");
45074510
_hardfork_times[STEEMIT_HARDFORK_0_19] = fc::time_point_sec(STEEMIT_HARDFORK_0_19_TIME);
45084511
_hardfork_versions[STEEMIT_HARDFORK_0_19] = STEEMIT_HARDFORK_0_19_VERSION;
4512+
FC_ASSERT(STEEMIT_HARDFORK_0_20 == 20, "Invalid hardfork configuration");
4513+
_hardfork_times[STEEMIT_HARDFORK_0_20] = fc::time_point_sec(STEEMIT_HARDFORK_0_20_TIME);
4514+
_hardfork_versions[STEEMIT_HARDFORK_0_20] = STEEMIT_HARDFORK_0_20_VERSION;
45094515

45104516
const auto &hardforks = get_hardfork_property_object();
45114517
FC_ASSERT(
@@ -4761,6 +4767,8 @@ namespace golos { namespace chain {
47614767
break;
47624768
case STEEMIT_HARDFORK_0_19:
47634769
break;
4770+
case STEEMIT_HARDFORK_0_20:
4771+
break;
47644772
default:
47654773
break;
47664774
}

libraries/chain/hardfork.d/0-preamble.hf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,4 @@ FC_REFLECT((golos::chain::hardfork_property_object),
5151
(next_hardfork)(next_hardfork_time))
5252
CHAINBASE_SET_INDEX_TYPE( golos::chain::hardfork_property_object, golos::chain::hardfork_property_index)
5353

54-
#define STEEMIT_NUM_HARDFORKS 19
54+
#define STEEMIT_NUM_HARDFORKS 20

libraries/chain/hardfork.d/0_20.hf

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#ifndef STEEMIT_HARDFORK_0_20
2+
#define STEEMIT_HARDFORK_0_20 20
3+
#define STEEMIT_HARDFORK_0_20__1074 (STEEMIT_HARDFORK_0_20) // Blockchain stopped due to negative payment of curator reward
4+
#define STEEMIT_HARDFORK_0_20__1075 (STEEMIT_HARDFORK_0_20) // Author can change curation percent after voting on post
5+
6+
#ifdef STEEMIT_BUILD_TESTNET
7+
#define STEEMIT_HARDFORK_0_20_TIME 1547701200 // 17 jan 2019 12:00:00 MSK
8+
#else
9+
#define STEEMIT_HARDFORK_0_20_TIME 1547787600 // 18 jan 2019 12:00:00 MSK
10+
#endif
11+
12+
#define STEEMIT_HARDFORK_0_20_VERSION hardfork_version( 0, 20 )
13+
14+
#endif

libraries/chain/steem_evaluator.cpp

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -543,6 +543,12 @@ namespace golos { namespace chain {
543543

544544
const auto& mprops = _db.get_witness_schedule_object().median_props;
545545

546+
if (_db.has_hardfork(STEEMIT_HARDFORK_0_20__1075)) {
547+
GOLOS_CHECK_LOGIC(_c.abs_rshares == 0,
548+
logic_exception::comment_must_not_have_been_voted,
549+
"Comment must not have been voted on changing auction window reward destination.");
550+
}
551+
546552
GOLOS_CHECK_PARAM(cawrd.destination, {
547553
GOLOS_CHECK_VALUE(cawrd.destination != to_reward_fund || mprops.allow_return_auction_reward_to_fund,
548554
"Returning to reward fund is disallowed."
@@ -566,6 +572,12 @@ namespace golos { namespace chain {
566572
const auto& mprops = _db.get_witness_schedule_object().median_props;
567573

568574
auto percent = ccrp.percent; // Workaround for correct param name in GOLOS_CHECK_PARAM
575+
576+
if (_db.has_hardfork(STEEMIT_HARDFORK_0_20__1075)) {
577+
GOLOS_CHECK_LOGIC(_c.abs_rshares == 0,
578+
logic_exception::comment_must_not_have_been_voted,
579+
"Comment must not have been voted on changing curation rewards percent.");
580+
}
569581

570582
GOLOS_CHECK_PARAM(percent, {
571583
GOLOS_CHECK_VALUE(mprops.min_curation_percent <= ccrp.percent && ccrp.percent <= mprops.max_curation_percent,
@@ -1516,8 +1528,13 @@ namespace golos { namespace chain {
15161528
for (; vdo_itr != vdo_idx.end() && vdo_itr->delegatee == voter.name; ++vdo_itr) {
15171529
delegator_vote_interest_rate dvir;
15181530
dvir.account = vdo_itr->delegator;
1519-
dvir.interest_rate = vdo_itr->vesting_shares.amount.value * vdo_itr->interest_rate
1520-
/ voter.effective_vesting_shares().amount.value;
1531+
if (_db.head_block_num() < GOLOS_BUG1074_BLOCK && !_db.has_hardfork(STEEMIT_HARDFORK_0_20__1074)) {
1532+
dvir.interest_rate = vdo_itr->vesting_shares.amount.value * vdo_itr->interest_rate /
1533+
voter.effective_vesting_shares().amount.value;
1534+
} else {
1535+
dvir.interest_rate = (uint128_t(vdo_itr->vesting_shares.amount.value) *
1536+
vdo_itr->interest_rate / voter.effective_vesting_shares().amount.value).to_uint64();
1537+
}
15211538
dvir.payout_strategy = vdo_itr->payout_strategy;
15221539
if (dvir.interest_rate > 0) {
15231540
delegator_vote_interest_rates.emplace_back(std::move(dvir));

libraries/protocol/include/golos/protocol/config.hpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,13 @@
33
*/
44
#pragma once
55

6-
#define STEEMIT_BLOCKCHAIN_VERSION (version(0, 19, 1))
6+
7+
#define STEEMIT_BLOCKCHAIN_VERSION (version(0, 20, 0))
78
#define STEEMIT_BLOCKCHAIN_HARDFORK_VERSION (hardfork_version(STEEMIT_BLOCKCHAIN_VERSION))
89

10+
11+
#define GOLOS_BUG1074_BLOCK 23569125
12+
913
#ifdef STEEMIT_BUILD_TESTNET
1014
#define BLOCKCHAIN_NAME "GOLOSTEST"
1115

libraries/protocol/steem_operations.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ namespace golos { namespace protocol {
276276

277277
void chain_properties_19::validate() const {
278278
chain_properties_18::validate();
279-
GOLOS_CHECK_VALUE_LE(auction_window_size, STEEMIT_MAX_AUCTION_WINDOW_SIZE_SECONDS);
279+
// GOLOS_CHECK_VALUE_LE(auction_window_size, STEEMIT_MAX_AUCTION_WINDOW_SIZE_SECONDS); // auction_window_size is limited by 16bit
280280
GOLOS_CHECK_VALUE_LE(max_referral_interest_rate, GOLOS_MAX_REFERRAL_INTEREST_RATE);
281281
GOLOS_CHECK_VALUE_LE(max_referral_term_sec, GOLOS_MAX_REFERRAL_TERM_SEC);
282282

libraries/wallet/wallet.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2204,12 +2204,8 @@ fc::ecc::private_key wallet_api::derive_private_key(const std::string& prefix_st
22042204
) {
22052205
WALLET_CHECK_UNLOCKED();
22062206

2207-
const auto hf = my->_remote_database_api->get_hardfork_version();
2208-
const auto has_hf18 = hf >= hardfork_version(0, STEEMIT_HARDFORK_0_18__673);
2209-
22102207
signed_transaction tx;
22112208
witness_update_operation op;
2212-
22132209
if (url.empty()) {
22142210
auto wit = my->_remote_witness_api->get_witness_by_account(witness_account_name);
22152211
if (wit.valid()) {

0 commit comments

Comments
 (0)