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

Commit 44a533a

Browse files
authored
Merge pull request #1366 from GolosChain/master-with-22-hardfork
Golos v0.22.0 - add HF-21 commits
2 parents be5a552 + 3e0f7ea commit 44a533a

46 files changed

Lines changed: 1715 additions & 83 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
@@ -94,4 +94,24 @@ namespace golos { namespace chain {
9494
}
9595
}
9696

97+
void transit_to_cyberway_evaluator::do_apply(const transit_to_cyberway_operation& o) {
98+
ASSERT_REQ_HF(STEEMIT_HARDFORK_0_21__1348, "transit_to_cyberway");
99+
100+
_db.get_account(o.owner); // verify owner exists
101+
auto& witness = _db.get_witness(o.owner);
102+
103+
GOLOS_CHECK_OP_PARAM(o, vote_to_transit, {
104+
GOLOS_CHECK_VALUE(o.vote_to_transit != (witness.transit_to_cyberway_vote != STEEMIT_GENESIS_TIME),
105+
"You should change your vote.");
106+
});
107+
108+
_db.modify(witness, [&](witness_object& w) {
109+
if (o.vote_to_transit) {
110+
w.transit_to_cyberway_vote = _db.head_block_time();
111+
} else {
112+
w.transit_to_cyberway_vote = STEEMIT_GENESIS_TIME;
113+
}
114+
});
115+
}
116+
97117
} } // golos::chain

libraries/chain/database.cpp

Lines changed: 122 additions & 35 deletions
Large diffs are not rendered by default.

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,5 +52,3 @@ FC_REFLECT((golos::chain::hardfork_property_object),
5252
CHAINBASE_SET_INDEX_TYPE( golos::chain::hardfork_property_object, golos::chain::hardfork_property_index)
5353

5454
#define STEEMIT_NUM_HARDFORKS 22
55-
56-

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
#ifndef STEEMIT_HARDFORK_0_21
22
#define STEEMIT_HARDFORK_0_21 21
33

4+
#define STEEMIT_HARDFORK_0_21__1348 (STEEMIT_HARDFORK_0_21) // Transit to CyberWay
5+
6+
47
#ifdef STEEMIT_BUILD_TESTNET
5-
#define STEEMIT_HARDFORK_0_21_TIME 1563613200 // 20 jul 2019 12:00:00 MSK
8+
#define STEEMIT_HARDFORK_0_21_TIME 1563958800 // 24 jul 2019 12:00:00 MSK
69
#else
7-
#define STEEMIT_HARDFORK_0_21_TIME 1565254800 // 08 aug 2019 12:00:00 MSK
10+
#define STEEMIT_HARDFORK_0_21_TIME 1565859600 // 15 aug 2019 12:00:00 MSK
811
#endif
912

1013
#define STEEMIT_HARDFORK_0_21_VERSION hardfork_version( 0, 21 )

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
#define STEEMIT_HARDFORK_0_22__820 (STEEMIT_HARDFORK_0_22) // Voting with stake for witnesses
1212

1313
#ifdef STEEMIT_BUILD_TESTNET
14-
#define STEEMIT_HARDFORK_0_22_TIME 1547787600 // 18 jan 2019 12:00:00 MSK
14+
#define STEEMIT_HARDFORK_0_22_TIME 1563958800 // 24 jul 2019 12:00:00 MSK
1515
#else
16-
#define STEEMIT_HARDFORK_0_22_TIME 1565254800 // 08 aug 2019 12:00:00 MSK
16+
#define STEEMIT_HARDFORK_0_22_TIME 1565859600 // 15 aug 2019 12:00:00 MSK
1717
#endif
1818

1919
#define STEEMIT_HARDFORK_0_22_VERSION hardfork_version( 0, 22 )

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

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

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

6770
enum validation_steps {
6871
skip_nothing = 0,
@@ -346,6 +349,11 @@ namespace golos { namespace chain {
346349
*/
347350
fc::signal<void(const signed_transaction &)> on_applied_transaction;
348351

352+
/**
353+
* This signal is emitted when required number of votes is reached to transit to CyberWay
354+
*/
355+
fc::signal<void(const uint32_t, const uint32_t)> transit_to_cyberway;
356+
349357
/**
350358
* Emitted After a block has been applied and committed. The callback
351359
* should not yield and should execute quickly.
@@ -447,7 +455,7 @@ namespace golos { namespace chain {
447455

448456
uint64_t pay_delegators(const account_object& delegatee, const comment_vote_object& cvo, uint64_t claim);
449457

450-
share_type pay_curators(const comment_curation_info& c, share_type max_rewards);
458+
share_type pay_curators(const comment_curation_info& c, share_type max_rewards, share_type& actual_rewards);
451459

452460
void cashout_comment_helper(const comment_object &comment);
453461

@@ -606,6 +614,8 @@ namespace golos { namespace chain {
606614

607615
void update_witness_schedule4();
608616

617+
void process_transit_to_cyberway(const signed_block& b, uint32_t skip);
618+
609619
void update_median_witness_props();
610620

611621
void clear_null_account_balance();
@@ -632,7 +642,7 @@ namespace golos { namespace chain {
632642

633643
bool _resize(uint32_t block_num);
634644

635-
void pay_curator(const comment_vote_object& cvo, uint64_t claim, const account_name_type& author, const std::string& permlink);
645+
uint64_t pay_curator(const comment_vote_object& cvo, uint64_t claim, const account_name_type& author, const std::string& permlink);
636646

637647
void adjust_sbd_balance(const account_object &a, const asset &delta);
638648

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,9 @@ namespace golos {
146146

147147
uint16_t custom_ops_bandwidth_multiplier = STEEMIT_CUSTOM_OPS_BANDWIDTH_MULTIPLIER;
148148

149+
uint32_t transit_block_num = UINT32_MAX;
150+
fc::array<account_name_type, STEEMIT_MAX_WITNESSES> transit_witnesses;
151+
149152
asset worker_revenue_per_day = asset(0, STEEM_SYMBOL);
150153
asset worker_consumption_per_day = asset(0, STEEM_SYMBOL);
151154
};
@@ -194,6 +197,8 @@ FC_REFLECT((golos::chain::dynamic_global_property_object),
194197
(vote_regeneration_per_day)
195198
(custom_ops_bandwidth_multiplier)
196199
(is_forced_min_price)
200+
(transit_block_num)
201+
(transit_witnesses)
197202
(worker_revenue_per_day)
198203
(worker_consumption_per_day)
199204
)

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
DEFINE_EVALUATOR(vote_options)
5960

6061
class proposal_create_evaluator: public evaluator_impl<proposal_create_evaluator> {

0 commit comments

Comments
 (0)