From 579649db8469cdd69d508a8dbb7f6e30759a053c Mon Sep 17 00:00:00 2001 From: mejutandrew Date: Sat, 5 May 2018 17:51:58 +0300 Subject: [PATCH 1/4] Changed the value of STEEM_MIN_REPLY_INTERVAL to 3. Adjusted the assert message to match the new value. --- libraries/chain/steem_evaluator.cpp | 4 ++-- libraries/protocol/include/steem/protocol/config.hpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libraries/chain/steem_evaluator.cpp b/libraries/chain/steem_evaluator.cpp index 7c60069104..eb9cb8ca3c 100644 --- a/libraries/chain/steem_evaluator.cpp +++ b/libraries/chain/steem_evaluator.cpp @@ -605,14 +605,14 @@ void comment_evaluator::do_apply( const comment_operation& o ) if( o.parent_author == STEEM_ROOT_POST_PARENT ) FC_ASSERT( ( now - auth.last_root_post ) > STEEM_MIN_ROOT_COMMENT_INTERVAL, "You may only post once every 5 minutes.", ("now",now)("last_root_post", auth.last_root_post) ); else - FC_ASSERT( (now - auth.last_post) > STEEM_MIN_REPLY_INTERVAL, "You may only comment once every 20 seconds.", ("now",now)("auth.last_post",auth.last_post) ); + FC_ASSERT( (now - auth.last_post) > STEEM_MIN_REPLY_INTERVAL, "You may only comment once every 3 seconds.", ("now",now)("auth.last_post",auth.last_post) ); } else if( _db.has_hardfork( STEEM_HARDFORK_0_6__113 ) ) { if( o.parent_author == STEEM_ROOT_POST_PARENT ) FC_ASSERT( (now - auth.last_post) > STEEM_MIN_ROOT_COMMENT_INTERVAL, "You may only post once every 5 minutes.", ("now",now)("auth.last_post",auth.last_post) ); else - FC_ASSERT( (now - auth.last_post) > STEEM_MIN_REPLY_INTERVAL, "You may only comment once every 20 seconds.", ("now",now)("auth.last_post",auth.last_post) ); + FC_ASSERT( (now - auth.last_post) > STEEM_MIN_REPLY_INTERVAL, "You may only comment once every 3 seconds.", ("now",now)("auth.last_post",auth.last_post) ); } else { diff --git a/libraries/protocol/include/steem/protocol/config.hpp b/libraries/protocol/include/steem/protocol/config.hpp index 3c48d9d376..9b9e7e46b6 100644 --- a/libraries/protocol/include/steem/protocol/config.hpp +++ b/libraries/protocol/include/steem/protocol/config.hpp @@ -113,7 +113,7 @@ #define STEEM_VOTE_DUST_THRESHOLD (50000000) #define STEEM_MIN_ROOT_COMMENT_INTERVAL (fc::seconds(60*5)) // 5 minutes -#define STEEM_MIN_REPLY_INTERVAL (fc::seconds(20)) // 20 seconds +#define STEEM_MIN_REPLY_INTERVAL (fc::seconds(3)) // 3 seconds #define STEEM_POST_AVERAGE_WINDOW (60*60*24u) // 1 day #define STEEM_POST_WEIGHT_CONSTANT (uint64_t(4*STEEM_100_PERCENT) * (4*STEEM_100_PERCENT))// (4*STEEM_100_PERCENT) -> 2 posts per 1 days, average 1 every 12 hours From 896e7ed05609e228b2a4efec7f629eea06a5074c Mon Sep 17 00:00:00 2001 From: mejutandrew Date: Wed, 9 May 2018 02:48:54 +0300 Subject: [PATCH 2/4] Modified back the value of STEEM_MIN_REPLY_INTERVAL to 20 seconds. Made a new define STEEM_MIN_REPLY_INTERVAL_HF20 with the 3 seconds value. Checking for STEEM_HARDFORK_0_20__2019 define before changing the assert message. --- libraries/chain/steem_evaluator.cpp | 13 ++++++++++--- libraries/protocol/get_config.cpp | 1 + libraries/protocol/hardfork.d/0_20.hf | 1 + .../protocol/include/steem/protocol/config.hpp | 3 ++- 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/libraries/chain/steem_evaluator.cpp b/libraries/chain/steem_evaluator.cpp index eb9cb8ca3c..4e887f271a 100644 --- a/libraries/chain/steem_evaluator.cpp +++ b/libraries/chain/steem_evaluator.cpp @@ -600,19 +600,26 @@ void comment_evaluator::do_apply( const comment_operation& o ) FC_ASSERT( _db.calculate_discussion_payout_time( *parent ) != fc::time_point_sec::maximum(), "Discussion is frozen." ); } - if( _db.has_hardfork( STEEM_HARDFORK_0_12__176 ) ) + if( _db.has_hardfork( STEEM_HARDFORK_0_20__2019 ) ) { if( o.parent_author == STEEM_ROOT_POST_PARENT ) FC_ASSERT( ( now - auth.last_root_post ) > STEEM_MIN_ROOT_COMMENT_INTERVAL, "You may only post once every 5 minutes.", ("now",now)("last_root_post", auth.last_root_post) ); else - FC_ASSERT( (now - auth.last_post) > STEEM_MIN_REPLY_INTERVAL, "You may only comment once every 3 seconds.", ("now",now)("auth.last_post",auth.last_post) ); + FC_ASSERT( (now - auth.last_post) > STEEM_MIN_REPLY_INTERVAL_HF20, "You may only comment once every 3 seconds.", ("now",now)("auth.last_post",auth.last_post) ); + } + else if( _db.has_hardfork( STEEM_HARDFORK_0_12__176 ) ) + { + if( o.parent_author == STEEM_ROOT_POST_PARENT ) + FC_ASSERT( ( now - auth.last_root_post ) > STEEM_MIN_ROOT_COMMENT_INTERVAL, "You may only post once every 5 minutes.", ("now",now)("last_root_post", auth.last_root_post) ); + else + FC_ASSERT( (now - auth.last_post) > STEEM_MIN_REPLY_INTERVAL, "You may only comment once every 20 seconds.", ("now",now)("auth.last_post",auth.last_post) ); } else if( _db.has_hardfork( STEEM_HARDFORK_0_6__113 ) ) { if( o.parent_author == STEEM_ROOT_POST_PARENT ) FC_ASSERT( (now - auth.last_post) > STEEM_MIN_ROOT_COMMENT_INTERVAL, "You may only post once every 5 minutes.", ("now",now)("auth.last_post",auth.last_post) ); else - FC_ASSERT( (now - auth.last_post) > STEEM_MIN_REPLY_INTERVAL, "You may only comment once every 3 seconds.", ("now",now)("auth.last_post",auth.last_post) ); + FC_ASSERT( (now - auth.last_post) > STEEM_MIN_REPLY_INTERVAL, "You may only comment once every 20 seconds.", ("now",now)("auth.last_post",auth.last_post) ); } else { diff --git a/libraries/protocol/get_config.cpp b/libraries/protocol/get_config.cpp index 179c5b4e32..25018a36c6 100644 --- a/libraries/protocol/get_config.cpp +++ b/libraries/protocol/get_config.cpp @@ -131,6 +131,7 @@ fc::variant_object get_config() result["STEEM_MIN_CURATE_REWARD"] = STEEM_MIN_CURATE_REWARD; result["STEEM_MIN_PERMLINK_LENGTH"] = STEEM_MIN_PERMLINK_LENGTH; result["STEEM_MIN_REPLY_INTERVAL"] = STEEM_MIN_REPLY_INTERVAL; + result["STEEM_MIN_REPLY_INTERVAL_HF20"] = STEEM_MIN_REPLY_INTERVAL_HF20; result["STEEM_MIN_ROOT_COMMENT_INTERVAL"] = STEEM_MIN_ROOT_COMMENT_INTERVAL; result["STEEM_MIN_VOTE_INTERVAL_SEC"] = STEEM_MIN_VOTE_INTERVAL_SEC; result["STEEM_MINER_ACCOUNT"] = STEEM_MINER_ACCOUNT; diff --git a/libraries/protocol/hardfork.d/0_20.hf b/libraries/protocol/hardfork.d/0_20.hf index d82c2eb200..31c02f765f 100644 --- a/libraries/protocol/hardfork.d/0_20.hf +++ b/libraries/protocol/hardfork.d/0_20.hf @@ -10,6 +10,7 @@ #define STEEM_HARDFORK_0_20__1765 (STEEM_HARDFORK_0_20) #define STEEM_HARDFORK_0_20__1811 (STEEM_HARDFORK_0_20) #define STEEM_HARDFORK_0_20__1815 (STEEM_HARDFORK_0_20) +#define STEEM_HARDFORK_0_20__2019 (STEEM_HARDFORK_0_20) #define STEEM_HARDFORK_0_20_VERSION hardfork_version( 0, 20 ) diff --git a/libraries/protocol/include/steem/protocol/config.hpp b/libraries/protocol/include/steem/protocol/config.hpp index 9b9e7e46b6..3efe44398e 100644 --- a/libraries/protocol/include/steem/protocol/config.hpp +++ b/libraries/protocol/include/steem/protocol/config.hpp @@ -113,7 +113,8 @@ #define STEEM_VOTE_DUST_THRESHOLD (50000000) #define STEEM_MIN_ROOT_COMMENT_INTERVAL (fc::seconds(60*5)) // 5 minutes -#define STEEM_MIN_REPLY_INTERVAL (fc::seconds(3)) // 3 seconds +#define STEEM_MIN_REPLY_INTERVAL (fc::seconds(20)) // 20 seconds +#define STEEM_MIN_REPLY_INTERVAL_HF20 (fc::seconds(3)) // 3 seconds #define STEEM_POST_AVERAGE_WINDOW (60*60*24u) // 1 day #define STEEM_POST_WEIGHT_CONSTANT (uint64_t(4*STEEM_100_PERCENT) * (4*STEEM_100_PERCENT))// (4*STEEM_100_PERCENT) -> 2 posts per 1 days, average 1 every 12 hours From bf290da5a9a57fb3e599030612b8d0be3497de90 Mon Sep 17 00:00:00 2001 From: mejutandrew Date: Thu, 10 May 2018 23:02:39 +0300 Subject: [PATCH 3/4] Made comparison for greater or equal than minimum reply interval. --- libraries/chain/steem_evaluator.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/chain/steem_evaluator.cpp b/libraries/chain/steem_evaluator.cpp index 4e887f271a..4cb9d422d6 100644 --- a/libraries/chain/steem_evaluator.cpp +++ b/libraries/chain/steem_evaluator.cpp @@ -605,7 +605,7 @@ void comment_evaluator::do_apply( const comment_operation& o ) if( o.parent_author == STEEM_ROOT_POST_PARENT ) FC_ASSERT( ( now - auth.last_root_post ) > STEEM_MIN_ROOT_COMMENT_INTERVAL, "You may only post once every 5 minutes.", ("now",now)("last_root_post", auth.last_root_post) ); else - FC_ASSERT( (now - auth.last_post) > STEEM_MIN_REPLY_INTERVAL_HF20, "You may only comment once every 3 seconds.", ("now",now)("auth.last_post",auth.last_post) ); + FC_ASSERT( (now - auth.last_post) >= STEEM_MIN_REPLY_INTERVAL_HF20, "You may only comment once every 3 seconds.", ("now",now)("auth.last_post",auth.last_post) ); } else if( _db.has_hardfork( STEEM_HARDFORK_0_12__176 ) ) { From 4e0c6be3504995cbf6619c8c487e15aace87e57b Mon Sep 17 00:00:00 2001 From: Michael Vandeberg Date: Mon, 21 May 2018 12:43:50 -0700 Subject: [PATCH 4/4] Add TODO for cleanup --- libraries/chain/steem_evaluator.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/libraries/chain/steem_evaluator.cpp b/libraries/chain/steem_evaluator.cpp index 7806dd2ebd..48694c2cbe 100644 --- a/libraries/chain/steem_evaluator.cpp +++ b/libraries/chain/steem_evaluator.cpp @@ -621,6 +621,7 @@ void comment_evaluator::do_apply( const comment_operation& o ) FC_ASSERT( _db.calculate_discussion_payout_time( *parent ) != fc::time_point_sec::maximum(), "Discussion is frozen." ); } + FC_TODO( "Cleanup this logic after HF 20. Old ops don't need to check pre-hf20 times." ) if( _db.has_hardfork( STEEM_HARDFORK_0_20__2019 ) ) { if( o.parent_author == STEEM_ROOT_POST_PARENT )