From a90b5dfb3e5e32c5e134c0868664fc4fc6d60b42 Mon Sep 17 00:00:00 2001 From: Daniel Larimer Date: Tue, 28 Jun 2016 18:04:29 -0400 Subject: [PATCH 1/5] test code --- .../include/steemit/sidechain/sidechain.hpp | 69 +++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 libraries/sidechain/include/steemit/sidechain/sidechain.hpp diff --git a/libraries/sidechain/include/steemit/sidechain/sidechain.hpp b/libraries/sidechain/include/steemit/sidechain/sidechain.hpp new file mode 100644 index 0000000000..5db0964278 --- /dev/null +++ b/libraries/sidechain/include/steemit/sidechain/sidechain.hpp @@ -0,0 +1,69 @@ +#pragma once + +namespace steemit { namespace sidechain { + using std::string; + +#define side_ids 10 + + typedef side_object_types { + side_account_type = 1, + pending_transaction_object = 2 + }; + + + /** This operation can be used for internal transfers and withdraw requests */ + struct sidechain_transfer_operation { + string sidechain; + string from; /// must be in required active signatures + string to; + asset amount; + string memo; + }; + + /** This operation can be used for broadcasting signatures to apply to pending + * sidechain transactions. + */ + struct sidechain_sign_operation { + string sidechain; + string signer; ///< must be in required active signatures + transaction_id_type trx_id; + set signatures; + }; + + FC_REFLECT( sidechain_transfer_operation, (sidechain)(from)(to)(amount)(memo) ) + + class side_account_object : public abstract_object { + public: + static const uint8_t space_id = side_ids; + static const uint8_t type_id = side_account_type; + + string sidechain; ///< name of the sidechain account + string name; /// sub account within the side chain + + asset steem_balance; + asset dollar_balance; + }; + + FC_REFLECT_DERIVED( steemit::sidechain::side_account, (graphene::db::object), + (sidechain)(name)(steem_balance)(dollar_balance) + ); + + + /** + * This index maintains a database of transactions that are + */ + class pending_transaction_object : public abstract_object { + public: + static const uint8_t space_id = side_ids; + static const uint8_t type_id = side_account_type; + + string sidechain; ///< name of the sidechain account + bool approved; ///< whether or not the transaction has been confirmed + time_point_sec expiration; ///< when the transaction expires + transaction_id_type trx_id; + signed_transaction trx; + }; + + + +} } From 914c840baa072c7a232b8d78528fc8a685b2fe48 Mon Sep 17 00:00:00 2001 From: Daniel Larimer Date: Wed, 29 Jun 2016 06:05:59 -0400 Subject: [PATCH 2/5] Small Changes to Hardfork 1. no voting after first cashout 2. no discussion rewards at this time (require more discussion) 3. update version number --- libraries/chain/database.cpp | 5 ++++- libraries/chain/include/steemit/chain/config.hpp | 2 +- libraries/chain/steem_evaluator.cpp | 5 ++++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/libraries/chain/database.cpp b/libraries/chain/database.cpp index 7ed1a2f5e3..7c7132d7f1 100644 --- a/libraries/chain/database.cpp +++ b/libraries/chain/database.cpp @@ -1771,6 +1771,7 @@ void database::cashout_comment_helper( const comment_object& comment ) share_type author_tokens = reward_tokens.to_uint64() - discussion_tokens - curation_tokens; author_tokens += pay_curators( comment, curation_tokens ); + if( discussion_tokens > 0 ) author_tokens += pay_discussions( comment, discussion_tokens ); @@ -2054,10 +2055,12 @@ uint16_t database::get_activity_rewards_percent() const uint16_t database::get_discussion_rewards_percent() const { + /* if( has_hardfork( STEEMIT_HARDFORK_0_8__116 ) ) return STEEMIT_1_PERCENT * 25; else - return 0; + */ + return 0; } uint16_t database::get_curation_rewards_percent() const diff --git a/libraries/chain/include/steemit/chain/config.hpp b/libraries/chain/include/steemit/chain/config.hpp index 3b09a48817..32b6b7a9bc 100644 --- a/libraries/chain/include/steemit/chain/config.hpp +++ b/libraries/chain/include/steemit/chain/config.hpp @@ -3,7 +3,7 @@ */ #pragma once -#define STEEMIT_BLOCKCHAIN_VERSION ( version(0, 8, 1) ) +#define STEEMIT_BLOCKCHAIN_VERSION ( version(0, 8, 2) ) #define STEEMIT_BLOCKCHAIN_HARDFORK_VERSION ( hardfork_version( STEEMIT_BLOCKCHAIN_VERSION ) ) #ifdef IS_TEST_NET diff --git a/libraries/chain/steem_evaluator.cpp b/libraries/chain/steem_evaluator.cpp index 75222af7dd..95862771af 100644 --- a/libraries/chain/steem_evaluator.cpp +++ b/libraries/chain/steem_evaluator.cpp @@ -662,6 +662,9 @@ void vote_evaluator::do_apply( const vote_operation& o ) const auto& comment = db().get_comment( o.author, o.permlink ); const auto& voter = db().get_account( o.voter ); + /// no new votes after payout + FC_ASSERT( comment.last_payout == fc::time_point_sec() ); + if( o.weight > 0 ) FC_ASSERT( comment.allow_votes ); const auto& comment_vote_idx = db().get_index_type< comment_vote_index >().indices().get< by_comment_voter >(); @@ -780,7 +783,7 @@ void vote_evaluator::do_apply( const vote_operation& o ) cv.vote_percent = o.weight; cv.last_update = db().head_block_time(); - if( rshares > 0 && comment.last_payout.sec_since_epoch() == 0 && comment.allow_curation_rewards ) + if( rshares > 0 && (comment.last_payout == fc::time_point_sec()) && comment.allow_curation_rewards ) { // cv.weight = W(R_1) - W(R_0) if( db().has_hardfork( STEEMIT_HARDFORK_0_1 ) ) From a78eddeffb1c5bb39095bd624810cf10cf6fe3c7 Mon Sep 17 00:00:00 2001 From: Michael Vandeberg Date: Wed, 29 Jun 2016 09:11:47 -0400 Subject: [PATCH 3/5] Add git guidelines --- doc/git-guildelines.md | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 doc/git-guildelines.md diff --git a/doc/git-guildelines.md b/doc/git-guildelines.md new file mode 100644 index 0000000000..3af2877644 --- /dev/null +++ b/doc/git-guildelines.md @@ -0,0 +1,37 @@ +The git guidelines for Steemit are influenced by the [Graphene](https://github.com/cryptonomex/graphene/wiki/How-we-use-version-control) git guidelines as well as [Git Flow](http://nvie.com/posts/a-successful-git-branching-model/) and [this blog post](http://www.draconianoverlord.com/2013/09/07/no-cherry-picking.html). + +### Branches + +- `origin/master` : Contains releases of Steem. `origin/master` and `origin/HEAD` should always be at the most recent release. All witnesses should be running this branch. +- `origin/staging` : Staging branch for new releases. Release candidates of develop will be merged into staging for review. Witnesses wanting to run the latest builds and test new features and bug fixes should be on this branch. +- `origin/develop` : The development branch. Develop should always build but may contain bugs. This branch is only for developers. + +### Patch Branches + +All issues should be developed against their own branch. These branches should have the most recent staging branch as a working parent and then merged into develop when they are tested and ready to be deployed. +If an issue needs another issue as a dependency, branch from `staging`, merge the dependent issue branch into the new branch, and begin development. The naming scheme we use is the issue number, then a dash, followed by a shorthand description of the issue. For example, issue 22 is to allow the removal of an upvote. Branch `22-undo-vote` was used to devlop the patch for this issue. + +### Non-Issue Branches + +Some changes are so minor as to not require an issue, e.g. changes to logging. If in doubt, create an issue for the change and follow the guidelines above. Issues serve as documentation for many changes. These should still be done against `staging` where possible (or the earliest commit they depend on, where not possible) and merged into `develop`. In practice you may develop such patches against `master`; then rebase against `develop` before pushing. + +##Policies + +### Force-push policy + +- `origin/master` should never be force pushed. +- `origin/staging` should rarely be force pushed. Exceptions to this policy may be made on a case-by-case basis. +- `origin/develop` should rarely be force pushed. It may be force-pushed to kill patches that are prematurely merged. Force pushing beyond this is likely an idication development should have occured on an issue branch. +- Individual patch branches may be force-pushed at any time, at the discretion of the developer or team working on the patch. + +### Tagging Policy + +- Tags are reserved for releases. The version scheme is `vMajor.Hardfork.Release` (Ex. v0.5.0 is the version for the Hardfork 5 release). Releases should be made only on `master`. + +### Code review policy + +- Two developers *must* review *every* consensus-breaking change before it moves into `graphene/master`. +- Two developers *should* review *every* patch before it moves into `graphene/master`. +- One of the reviewers may be the author of the change. +- This policy is designed to encourage you to take off your "writer hat" and put on your "critic/reviewer hat." If this was a patch from an unfamiliar community contributor, would you accept it? Can you understand what the patch does and check its correctness based only on its commit message and diff? Does it break any existing tests, or need new tests to be written? Is it stylistically sloppy -- trailing whitespace, multiple unrelated changes in a single patch, mixing bugfixes and features, or overly verbose debug logging? +- Having multiple people look at a patch reduces the probability it will contain bugs. \ No newline at end of file From b6abe271a7512f2bd79e8e5732b98277ca01cb3a Mon Sep 17 00:00:00 2001 From: Michael Vandeberg Date: Wed, 29 Jun 2016 10:06:08 -0400 Subject: [PATCH 4/5] Add withdraw vesting route cli command #78 --- .../wallet/include/steemit/wallet/wallet.hpp | 15 ++++++++++ libraries/wallet/wallet.cpp | 28 +++++++++++++++---- 2 files changed, 37 insertions(+), 6 deletions(-) diff --git a/libraries/wallet/include/steemit/wallet/wallet.hpp b/libraries/wallet/include/steemit/wallet/wallet.hpp index 5a99c231a9..3c7d951be4 100644 --- a/libraries/wallet/include/steemit/wallet/wallet.hpp +++ b/libraries/wallet/include/steemit/wallet/wallet.hpp @@ -582,6 +582,20 @@ class wallet_api */ annotated_signed_transaction withdraw_vesting( string from, asset vesting_shares, bool broadcast = false ); + /** + * Set up a vesting withdraw route. When vesting shares are withdrawn, they will be routed to these accounts + * based on the specified weights. + * + * @param from The account the VESTS are withdrawn from. + * @param to The account receiving either VESTS or STEEM. + * @param percent The percent of the withdraw to go to the 'to' account. This is denoted in hundreths of a percent. + * i.e. 100 is 1% and 10000 is 100%. This value must be between 1 and 100000 + * @param auto_vest Set to true if the from account should receive the VESTS as VESTS, or false if it should receive + * them as STEEM. + * @param broadcast true if you wish to broadcast the transaction. + */ + annotated_signed_transaction set_withdraw_vesting_route( string from, string to, uint16_t percent, bool auto_vest, bool broadcast = false ); + /** * This method will convert SBD to STEEM at the current_median_history price one * week from the time it is executed. This method depends upon there being a valid price feed. @@ -786,6 +800,7 @@ FC_API( steemit::wallet::wallet_api, (transfer) (transfer_to_vesting) (withdraw_vesting) + (set_withdraw_vesting_route) (convert_sbd) (publish_feed) (get_order_book) diff --git a/libraries/wallet/wallet.cpp b/libraries/wallet/wallet.cpp index 8819603fed..d8ccbaa347 100644 --- a/libraries/wallet/wallet.cpp +++ b/libraries/wallet/wallet.cpp @@ -773,12 +773,12 @@ class wallet_api_impl ss << setiosflags( ios::fixed ) << setiosflags( ios::left ) ; ss << ' ' << setw( ( spacing * 4 ) + 6 ) << "Bids" << "Asks\n" - << ' ' + << ' ' << setw( spacing + 3 ) << "Sum(SBD)" - << setw( spacing + 1) << "SBD" + << setw( spacing + 1) << "SBD" << setw( spacing + 1 ) << "STEEM" - << setw( spacing + 1 ) << "Price" - << setw( spacing + 1 ) << "Price" + << setw( spacing + 1 ) << "Price" + << setw( spacing + 1 ) << "Price" << setw( spacing + 1 ) << "STEEM " << setw( spacing + 1 ) << "SBD " << "Sum(SBD)" << "\n=====================================================================================================" @@ -789,7 +789,7 @@ class wallet_api_impl if ( i < orders.bids.size() ) { bid_sum += asset( orders.bids[i].sbd, SBD_SYMBOL ); - ss + ss << ' ' << setw( spacing ) << bid_sum.to_string() << ' ' << setw( spacing ) << asset( orders.bids[i].sbd, SBD_SYMBOL ).to_string() << ' ' << setw( spacing ) << asset( orders.bids[i].steem, STEEM_SYMBOL ).to_string() @@ -1626,6 +1626,22 @@ annotated_signed_transaction wallet_api::withdraw_vesting(string from, asset ves return my->sign_transaction( tx, broadcast ); } +annotated_signed_transaction wallet_api::set_withdraw_vesting_route( string from, string to, uint16_t percent, bool auto_vest, bool broadcast ) +{ + FC_ASSERT( !is_locked() ); + set_withdraw_vesting_route_operation op; + op.from_account = from; + op.to_account = to; + op.percent = percent; + op.auto_vest = auto_vest; + + signed_transaction tx; + tx.operations.push_back( op ); + tx.validate(); + + return my->sign_transaction( tx, broadcast ); +} + annotated_signed_transaction wallet_api::convert_sbd(string from, asset amount, bool broadcast ) { FC_ASSERT( !is_locked() ); @@ -1793,7 +1809,7 @@ annotated_signed_transaction wallet_api::follow( string follower, string followi get_account( following.substr(1) ); } FC_ASSERT( following.size() > 1 ); - + follow::follow_operation fop; fop.follower = follower; fop.following = following; From b70ba94cc951b99c6d8ecfb36b282f52a7e42161 Mon Sep 17 00:00:00 2001 From: Michael Vandeberg Date: Wed, 29 Jun 2016 10:34:08 -0400 Subject: [PATCH 5/5] For now, allow voting after payouts for moderation. --- libraries/chain/steem_evaluator.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/libraries/chain/steem_evaluator.cpp b/libraries/chain/steem_evaluator.cpp index 95862771af..c7006926d7 100644 --- a/libraries/chain/steem_evaluator.cpp +++ b/libraries/chain/steem_evaluator.cpp @@ -662,9 +662,6 @@ void vote_evaluator::do_apply( const vote_operation& o ) const auto& comment = db().get_comment( o.author, o.permlink ); const auto& voter = db().get_account( o.voter ); - /// no new votes after payout - FC_ASSERT( comment.last_payout == fc::time_point_sec() ); - if( o.weight > 0 ) FC_ASSERT( comment.allow_votes ); const auto& comment_vote_idx = db().get_index_type< comment_vote_index >().indices().get< by_comment_voter >();