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

Commit

Permalink
Merge pull request #1079 from GolosChain/golos-v0.20.0
Browse files Browse the repository at this point in the history
Golos v0.20.0
  • Loading branch information
afalaleev authored Jan 17, 2019
2 parents a88d70e + 824cab7 commit 82edada
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 10 deletions.
10 changes: 9 additions & 1 deletion libraries/chain/database.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2290,8 +2290,11 @@ namespace golos { namespace chain {
uint64_t delegators_reward = 0;
const auto& vdo_idx = get_index<vesting_delegation_index>().indices().get<by_received>();
for (auto& dvir : cvo.delegator_vote_interest_rates) {
if (dvir.interest_rate > STEEMIT_100_PERCENT) {
wlog("Skip bad delegator's interest rate: ${r}", ("r", dvir.interest_rate));
continue;
}
auto delegator_claim = claim * dvir.interest_rate / STEEMIT_100_PERCENT;

if (delegator_claim == 0) {
continue;
}
Expand Down Expand Up @@ -4506,6 +4509,9 @@ namespace golos { namespace chain {
FC_ASSERT(STEEMIT_HARDFORK_0_19 == 19, "Invalid hardfork configuration");
_hardfork_times[STEEMIT_HARDFORK_0_19] = fc::time_point_sec(STEEMIT_HARDFORK_0_19_TIME);
_hardfork_versions[STEEMIT_HARDFORK_0_19] = STEEMIT_HARDFORK_0_19_VERSION;
FC_ASSERT(STEEMIT_HARDFORK_0_20 == 20, "Invalid hardfork configuration");
_hardfork_times[STEEMIT_HARDFORK_0_20] = fc::time_point_sec(STEEMIT_HARDFORK_0_20_TIME);
_hardfork_versions[STEEMIT_HARDFORK_0_20] = STEEMIT_HARDFORK_0_20_VERSION;

const auto &hardforks = get_hardfork_property_object();
FC_ASSERT(
Expand Down Expand Up @@ -4761,6 +4767,8 @@ namespace golos { namespace chain {
break;
case STEEMIT_HARDFORK_0_19:
break;
case STEEMIT_HARDFORK_0_20:
break;
default:
break;
}
Expand Down
2 changes: 1 addition & 1 deletion libraries/chain/hardfork.d/0-preamble.hf
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,4 @@ FC_REFLECT((golos::chain::hardfork_property_object),
(next_hardfork)(next_hardfork_time))
CHAINBASE_SET_INDEX_TYPE( golos::chain::hardfork_property_object, golos::chain::hardfork_property_index)

#define STEEMIT_NUM_HARDFORKS 19
#define STEEMIT_NUM_HARDFORKS 20
14 changes: 14 additions & 0 deletions libraries/chain/hardfork.d/0_20.hf
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#ifndef STEEMIT_HARDFORK_0_20
#define STEEMIT_HARDFORK_0_20 20
#define STEEMIT_HARDFORK_0_20__1074 (STEEMIT_HARDFORK_0_20) // Blockchain stopped due to negative payment of curator reward
#define STEEMIT_HARDFORK_0_20__1075 (STEEMIT_HARDFORK_0_20) // Author can change curation percent after voting on post

#ifdef STEEMIT_BUILD_TESTNET
#define STEEMIT_HARDFORK_0_20_TIME 1547701200 // 17 jan 2019 12:00:00 MSK
#else
#define STEEMIT_HARDFORK_0_20_TIME 1547787600 // 18 jan 2019 12:00:00 MSK
#endif

#define STEEMIT_HARDFORK_0_20_VERSION hardfork_version( 0, 20 )

#endif
21 changes: 19 additions & 2 deletions libraries/chain/steem_evaluator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -543,6 +543,12 @@ namespace golos { namespace chain {

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

if (_db.has_hardfork(STEEMIT_HARDFORK_0_20__1075)) {
GOLOS_CHECK_LOGIC(_c.abs_rshares == 0,
logic_exception::comment_must_not_have_been_voted,
"Comment must not have been voted on changing auction window reward destination.");
}

GOLOS_CHECK_PARAM(cawrd.destination, {
GOLOS_CHECK_VALUE(cawrd.destination != to_reward_fund || mprops.allow_return_auction_reward_to_fund,
"Returning to reward fund is disallowed."
Expand All @@ -566,6 +572,12 @@ namespace golos { namespace chain {
const auto& mprops = _db.get_witness_schedule_object().median_props;

auto percent = ccrp.percent; // Workaround for correct param name in GOLOS_CHECK_PARAM

if (_db.has_hardfork(STEEMIT_HARDFORK_0_20__1075)) {
GOLOS_CHECK_LOGIC(_c.abs_rshares == 0,
logic_exception::comment_must_not_have_been_voted,
"Comment must not have been voted on changing curation rewards percent.");
}

GOLOS_CHECK_PARAM(percent, {
GOLOS_CHECK_VALUE(mprops.min_curation_percent <= ccrp.percent && ccrp.percent <= mprops.max_curation_percent,
Expand Down Expand Up @@ -1516,8 +1528,13 @@ namespace golos { namespace chain {
for (; vdo_itr != vdo_idx.end() && vdo_itr->delegatee == voter.name; ++vdo_itr) {
delegator_vote_interest_rate dvir;
dvir.account = vdo_itr->delegator;
dvir.interest_rate = vdo_itr->vesting_shares.amount.value * vdo_itr->interest_rate
/ voter.effective_vesting_shares().amount.value;
if (_db.head_block_num() < GOLOS_BUG1074_BLOCK && !_db.has_hardfork(STEEMIT_HARDFORK_0_20__1074)) {
dvir.interest_rate = vdo_itr->vesting_shares.amount.value * vdo_itr->interest_rate /
voter.effective_vesting_shares().amount.value;
} else {
dvir.interest_rate = (uint128_t(vdo_itr->vesting_shares.amount.value) *
vdo_itr->interest_rate / voter.effective_vesting_shares().amount.value).to_uint64();
}
dvir.payout_strategy = vdo_itr->payout_strategy;
if (dvir.interest_rate > 0) {
delegator_vote_interest_rates.emplace_back(std::move(dvir));
Expand Down
6 changes: 5 additions & 1 deletion libraries/protocol/include/golos/protocol/config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,13 @@
*/
#pragma once

#define STEEMIT_BLOCKCHAIN_VERSION (version(0, 19, 1))

#define STEEMIT_BLOCKCHAIN_VERSION (version(0, 20, 0))
#define STEEMIT_BLOCKCHAIN_HARDFORK_VERSION (hardfork_version(STEEMIT_BLOCKCHAIN_VERSION))


#define GOLOS_BUG1074_BLOCK 23569125

#ifdef STEEMIT_BUILD_TESTNET
#define BLOCKCHAIN_NAME "GOLOSTEST"

Expand Down
2 changes: 1 addition & 1 deletion libraries/protocol/steem_operations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ namespace golos { namespace protocol {

void chain_properties_19::validate() const {
chain_properties_18::validate();
GOLOS_CHECK_VALUE_LE(auction_window_size, STEEMIT_MAX_AUCTION_WINDOW_SIZE_SECONDS);
// GOLOS_CHECK_VALUE_LE(auction_window_size, STEEMIT_MAX_AUCTION_WINDOW_SIZE_SECONDS); // auction_window_size is limited by 16bit
GOLOS_CHECK_VALUE_LE(max_referral_interest_rate, GOLOS_MAX_REFERRAL_INTEREST_RATE);
GOLOS_CHECK_VALUE_LE(max_referral_term_sec, GOLOS_MAX_REFERRAL_TERM_SEC);

Expand Down
4 changes: 0 additions & 4 deletions libraries/wallet/wallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2204,12 +2204,8 @@ fc::ecc::private_key wallet_api::derive_private_key(const std::string& prefix_st
) {
WALLET_CHECK_UNLOCKED();

const auto hf = my->_remote_database_api->get_hardfork_version();
const auto has_hf18 = hf >= hardfork_version(0, STEEMIT_HARDFORK_0_18__673);

signed_transaction tx;
witness_update_operation op;

if (url.empty()) {
auto wit = my->_remote_witness_api->get_witness_by_account(witness_account_name);
if (wit.valid()) {
Expand Down

0 comments on commit 82edada

Please sign in to comment.