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

Commit a1658d1

Browse files
authored
Merge pull request #1359 from GolosChain/golos-v0.21.0
Golos v0.21.0
2 parents 56e388a + 6e34c66 commit a1658d1

42 files changed

Lines changed: 1681 additions & 67 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

libraries/api/include/golos/api/witness_api_object.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ namespace golos { namespace api {
3232
version running_version;
3333
hardfork_version hardfork_version_vote;
3434
time_point_sec hardfork_time_vote;
35+
time_point_sec transit_to_cyberway_vote = STEEMIT_GENESIS_TIME;
3536
};
3637

3738
} } // golos::api
@@ -42,4 +43,4 @@ FC_REFLECT(
4243
(id)(owner)(created)(url)(votes)(virtual_last_update)(virtual_position)(virtual_scheduled_time)
4344
(total_missed)(last_aslot)(last_confirmed_block_num)(pow_worker)(signing_key)(props)
4445
(sbd_exchange_rate)(last_sbd_exchange_update)(last_work)(running_version)(hardfork_version_vote)
45-
(hardfork_time_vote))
46+
(hardfork_time_vote)(transit_to_cyberway_vote))

libraries/api/witness_api_object.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ namespace golos { namespace api {
1010
virtual_last_update(w.virtual_last_update), virtual_position(w.virtual_position),
1111
virtual_scheduled_time(w.virtual_scheduled_time), last_work(w.last_work),
1212
running_version(w.running_version), hardfork_version_vote(w.hardfork_version_vote),
13-
hardfork_time_vote(w.hardfork_time_vote) {
13+
hardfork_time_vote(w.hardfork_time_vote), transit_to_cyberway_vote(w.transit_to_cyberway_vote) {
1414
}
1515
} } // golos::api

libraries/chain/chain_properties_evaluators.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,4 +79,24 @@ namespace golos { namespace chain {
7979
}
8080
}
8181

82+
void transit_to_cyberway_evaluator::do_apply(const transit_to_cyberway_operation& o) {
83+
ASSERT_REQ_HF(STEEMIT_HARDFORK_0_21__1348, "transit_to_cyberway");
84+
85+
_db.get_account(o.owner); // verify owner exists
86+
auto& witness = _db.get_witness(o.owner);
87+
88+
GOLOS_CHECK_OP_PARAM(o, vote_to_transit, {
89+
GOLOS_CHECK_VALUE(o.vote_to_transit != (witness.transit_to_cyberway_vote != STEEMIT_GENESIS_TIME),
90+
"You should change your vote.");
91+
});
92+
93+
_db.modify(witness, [&](witness_object& w) {
94+
if (o.vote_to_transit) {
95+
w.transit_to_cyberway_vote = _db.head_block_time();
96+
} else {
97+
w.transit_to_cyberway_vote = STEEMIT_GENESIS_TIME;
98+
}
99+
});
100+
}
101+
82102
} } // golos::chain

libraries/chain/database.cpp

Lines changed: 125 additions & 33 deletions
Large diffs are not rendered by default.

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 20
54+
#define STEEMIT_NUM_HARDFORKS 21

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#ifndef STEEMIT_HARDFORK_0_21
2+
#define STEEMIT_HARDFORK_0_21 21
3+
4+
#define STEEMIT_HARDFORK_0_21__1348 (STEEMIT_HARDFORK_0_21) // Transit to CyberWay
5+
6+
7+
#ifdef STEEMIT_BUILD_TESTNET
8+
#define STEEMIT_HARDFORK_0_21_TIME 1563613200 // 20 jul 2019 12:00:00 MSK
9+
#else
10+
#define STEEMIT_HARDFORK_0_21_TIME 1565600400 // 12 aug 2019 12:00:00 MSK
11+
#endif
12+
13+
#define STEEMIT_HARDFORK_0_21_VERSION hardfork_version( 0, 21 )
14+
15+
#endif

libraries/chain/include/golos/chain/database.hpp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,13 @@ namespace golos { namespace chain {
5858
_is_generating = p;
5959
}
6060

61+
bool is_transit_enabled() const;
62+
6163
bool _is_producing = false;
6264
bool _is_generating = false;
6365
bool _is_testing = false; ///< set for tests to avoid low free memory spam
6466
bool _log_hardforks = true;
67+
uint32_t _fixed_irreversible_block_num = UINT32_MAX;
6568

6669
enum validation_steps {
6770
skip_nothing = 0,
@@ -328,6 +331,11 @@ namespace golos { namespace chain {
328331
*/
329332
fc::signal<void(const signed_transaction &)> on_applied_transaction;
330333

334+
/**
335+
* This signal is emitted when required number of votes is reached to transit to CyberWay
336+
*/
337+
fc::signal<void(const uint32_t, const uint32_t)> transit_to_cyberway;
338+
331339
/**
332340
* Emitted After a block has been applied and committed. The callback
333341
* should not yield and should execute quickly.
@@ -429,7 +437,7 @@ namespace golos { namespace chain {
429437

430438
uint64_t pay_delegators(const account_object& delegatee, const comment_vote_object& cvo, uint64_t claim);
431439

432-
share_type pay_curators(const comment_curation_info& c, share_type max_rewards);
440+
share_type pay_curators(const comment_curation_info& c, share_type max_rewards, share_type& actual_rewards);
433441

434442
void cashout_comment_helper(const comment_object &comment);
435443

@@ -581,6 +589,8 @@ namespace golos { namespace chain {
581589

582590
void update_witness_schedule4();
583591

592+
void process_transit_to_cyberway(const signed_block& b, uint32_t skip);
593+
584594
void update_median_witness_props();
585595

586596
void clear_null_account_balance();
@@ -607,7 +617,7 @@ namespace golos { namespace chain {
607617

608618
bool _resize(uint32_t block_num);
609619

610-
void pay_curator(const comment_vote_object& cvo, const uint64_t& claim, const account_name_type& author, const std::string& permlink);
620+
uint64_t pay_curator(const comment_vote_object& cvo, const uint64_t& claim, const account_name_type& author, const std::string& permlink);
611621

612622
void adjust_sbd_balance(const account_object &a, const asset &delta);
613623

libraries/chain/include/golos/chain/global_property_object.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,9 @@ namespace golos {
144144
uint32_t vote_regeneration_per_day = 40;
145145

146146
uint16_t custom_ops_bandwidth_multiplier = STEEMIT_CUSTOM_OPS_BANDWIDTH_MULTIPLIER;
147+
148+
uint32_t transit_block_num = UINT32_MAX;
149+
fc::array<account_name_type, STEEMIT_MAX_WITNESSES> transit_witnesses;
147150
};
148151

149152
typedef multi_index_container <
@@ -189,5 +192,7 @@ FC_REFLECT((golos::chain::dynamic_global_property_object),
189192
(vote_regeneration_per_day)
190193
(custom_ops_bandwidth_multiplier)
191194
(is_forced_min_price)
195+
(transit_block_num)
196+
(transit_witnesses)
192197
)
193198
CHAINBASE_SET_INDEX_TYPE(golos::chain::dynamic_global_property_object, golos::chain::dynamic_global_property_index)

libraries/chain/include/golos/chain/steem_evaluator.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ namespace golos { namespace chain {
5555
DEFINE_EVALUATOR(break_free_referral)
5656
DEFINE_EVALUATOR(delegate_vesting_shares_with_interest)
5757
DEFINE_EVALUATOR(reject_vesting_shares_delegation)
58+
DEFINE_EVALUATOR(transit_to_cyberway)
5859

5960
class proposal_create_evaluator: public evaluator_impl<proposal_create_evaluator> {
6061
public:

libraries/chain/include/golos/chain/steem_object_types.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@ namespace golos { namespace chain {
102102
class vesting_delegation_object;
103103
class vesting_delegation_expiration_object;
104104
class account_metadata_object;
105-
class proposal_object;
106105

107106
typedef object_id<dynamic_global_property_object> dynamic_global_property_id_type;
108107
typedef object_id<account_object> account_id_type;

0 commit comments

Comments
 (0)