Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge Master to Beatrice 20201203 #407

Merged
merged 27 commits into from
Dec 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
2716202
Update issue templates
bobinson Sep 3, 2019
f25cee8
updating the issue template - bug report
bobinson Sep 3, 2019
145624d
github issue templates
bobinson Sep 3, 2019
bec5918
update hardfork date for 18.04 upgrade + 50/50 dApp
pbattu123 Sep 3, 2019
a029784
update to fc path(pointed to peerplays-network
pbattu123 Sep 3, 2019
651e781
Merge pull request #75 from peerplays-network/beatrice
pbattu123 Sep 3, 2019
a50da70
Merge pull request #107 from peerplays-network/hardfork-50/50
pbattu123 Sep 3, 2019
f998c46
bring back all review fixes that were deleted with 50/50 merge
pbattu123 Sep 4, 2019
d28f9b0
missing things
pbattu123 Sep 4, 2019
7ce73ae
update
pbattu123 Sep 4, 2019
e82a3db
Hardfork date updated to Sep12-10pm EST
pbattu123 Sep 6, 2019
62ddd67
Merge pull request #114 from peerplays-network/review-fixes
pbattu123 Sep 6, 2019
c7164bd
issue and PR template
bobinson Sep 8, 2019
1d7e4fc
Merge pull request #103 from peerplays-network/github-issue-template1
bobinson Sep 10, 2019
5d43b28
Update README.md (#132)
pbsa-github Sep 17, 2019
a0f7939
updates to PR template
bobinson Sep 26, 2019
709c745
Update README.md
pbsa-github Dec 4, 2019
434837f
Update README.md
pbsa-github Jan 6, 2020
b8d03b8
Update README.md
pbsa-github Jan 20, 2020
9b0fb50
Update README.md
pbsa-github Jan 20, 2020
7a8026d
Update README.md
pbsa-github Jan 20, 2020
54c66b2
Update README.md
pbsa-github Jan 20, 2020
0b28088
Merge beatrice(GPOS changes) with master (#270)
pbattu123 Feb 7, 2020
c0b57fc
resync/replay issues addressed (#283)
pbattu123 Feb 10, 2020
be14592
Merge Plugins and graphene update changes from beatrice TESTNET to ma…
pbattu123 Apr 15, 2020
e69d35d
Chain crash/corruption due to bad check (#363)
sierra19XX May 8, 2020
c34c004
Merge branch 'master' into merge/master-to-beatrice-20201203
serkixenos Dec 5, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs
Submodule docs updated from 8d8b69 to 8df8f6
4 changes: 2 additions & 2 deletions libraries/app/api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,15 +181,15 @@ namespace graphene { namespace app {
void network_broadcast_api::broadcast_transaction(const signed_transaction& trx)
{
trx.validate();
_app.chain_database()->check_tansaction_for_duplicated_operations(trx);
_app.chain_database()->check_transaction_for_duplicated_operations(trx);
_app.chain_database()->push_transaction(trx);
if( _app.p2p_node() != nullptr )
_app.p2p_node()->broadcast_transaction(trx);
}

fc::variant network_broadcast_api::broadcast_transaction_synchronous(const signed_transaction& trx)
{
_app.chain_database()->check_tansaction_for_duplicated_operations(trx);
_app.chain_database()->check_transaction_for_duplicated_operations(trx);

fc::promise<fc::variant>::ptr prom( new fc::promise<fc::variant>() );
broadcast_transaction_with_callback( [=]( const fc::variant& v ){
Expand Down
2 changes: 1 addition & 1 deletion libraries/app/database_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class database_api_impl : public std::enable_shared_from_this<database_api_impl>

// Keys
vector<vector<account_id_type>> get_key_references( vector<public_key_type> key )const;
bool is_public_key_registered(string public_key) const;
bool is_public_key_registered(string public_key) const;

// Accounts
account_id_type get_account_id_from_string(const std::string& name_or_id)const;
Expand Down
2 changes: 1 addition & 1 deletion libraries/chain/db_block.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ std::vector<block_id_type> database::get_block_ids_on_fork(block_id_type head_of
return result;
}

void database::check_tansaction_for_duplicated_operations(const signed_transaction& trx)
void database::check_transaction_for_duplicated_operations(const signed_transaction& trx)
{
const auto& proposal_index = get_index<proposal_object>();
std::set<fc::sha256> existed_operations_digests;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -718,8 +718,8 @@ inline Stream& operator>>( Stream& s, betting_market_group_object& betting_marke
} } // graphene::chain

FC_REFLECT_DERIVED( graphene::chain::betting_market_rules_object, (graphene::db::object), (name)(description) )
FC_REFLECT_DERIVED( graphene::chain::betting_market_group_object, (graphene::db::object), (description) )
FC_REFLECT_DERIVED( graphene::chain::betting_market_object, (graphene::db::object), (group_id) )
FC_REFLECT_DERIVED( graphene::chain::betting_market_group_object, (graphene::db::object), (description)(event_id)(rules_id)(asset_id)(total_matched_bets_amount)(never_in_play)(delay_before_settling)(settling_time) )
FC_REFLECT_DERIVED( graphene::chain::betting_market_object, (graphene::db::object), (group_id)(description)(payout_condition)(resolution) )
FC_REFLECT_DERIVED( graphene::chain::bet_object, (graphene::db::object), (bettor_id)(betting_market_id)(amount_to_bet)(backer_multiplier)(back_or_lay)(end_of_delay) )

FC_REFLECT_DERIVED( graphene::chain::betting_market_position_object, (graphene::db::object), (bettor_id)(betting_market_id)(pay_if_payout_condition)(pay_if_not_payout_condition)(pay_if_canceled)(pay_if_not_canceled)(fees_collected) )
4 changes: 2 additions & 2 deletions libraries/chain/include/graphene/chain/database.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,8 @@ namespace graphene { namespace chain {
void add_checkpoints( const flat_map<uint32_t,block_id_type>& checkpts );
const flat_map<uint32_t,block_id_type> get_checkpoints()const { return _checkpoints; }
bool before_last_checkpoint()const;
void check_tansaction_for_duplicated_operations(const signed_transaction& trx);

void check_transaction_for_duplicated_operations(const signed_transaction& trx);

bool push_block( const signed_block& b, uint32_t skip = skip_nothing );
processed_transaction push_transaction( const signed_transaction& trx, uint32_t skip = skip_nothing );
Expand Down
3 changes: 2 additions & 1 deletion libraries/chain/include/graphene/chain/event_object.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,5 +158,6 @@ typedef generic_index<event_object, event_object_multi_index_type> event_object_
return s;
}
} } // graphene::chain
FC_REFLECT(graphene::chain::event_object, (name))
FC_REFLECT(graphene::chain::event_object, (name)(season)(start_time)(event_group_id)(at_least_one_betting_market_group_settled)(scores))


2 changes: 1 addition & 1 deletion libraries/chain/include/graphene/chain/impacted.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ void transaction_get_impacted_accounts( const graphene::chain::transaction& tx,
fc::flat_set<graphene::chain::account_id_type>& result,
bool ignore_custom_operation_required_auths );

} } // graphene::app
} } // graphene::app
Original file line number Diff line number Diff line change
Expand Up @@ -481,13 +481,13 @@ FC_REFLECT( graphene::chain::bet_place_operation,
(fee)(bettor_id)(betting_market_id)(amount_to_bet)(backer_multiplier)(back_or_lay)(extensions) )

FC_REFLECT( graphene::chain::bet_matched_operation::fee_parameters_type, )
FC_REFLECT( graphene::chain::bet_matched_operation, (bettor_id)(bet_id)(amount_bet)(backer_multiplier)(guaranteed_winnings_returned) )
FC_REFLECT( graphene::chain::bet_matched_operation, (fee)(bettor_id)(bet_id)(amount_bet)(backer_multiplier)(guaranteed_winnings_returned) )

FC_REFLECT( graphene::chain::bet_cancel_operation::fee_parameters_type, (fee) )
FC_REFLECT( graphene::chain::bet_cancel_operation, (fee) (bettor_id) (bet_to_cancel) (extensions) )

FC_REFLECT( graphene::chain::bet_canceled_operation::fee_parameters_type, )
FC_REFLECT( graphene::chain::bet_canceled_operation, (bettor_id)(bet_id)(stake_returned) )
FC_REFLECT( graphene::chain::bet_canceled_operation, (fee)(bettor_id)(bet_id)(stake_returned) )

FC_REFLECT( graphene::chain::bet_adjusted_operation::fee_parameters_type, )
FC_REFLECT( graphene::chain::bet_adjusted_operation, (bettor_id)(bet_id)(stake_returned) )
FC_REFLECT( graphene::chain::bet_adjusted_operation, (fee) (bettor_id)(bet_id)(stake_returned) )
14 changes: 13 additions & 1 deletion libraries/chain/proposal_evaluator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,18 @@ struct proposal_operation_hardfork_visitor
FC_ASSERT( !aco.extensions.value.affiliate_distributions.valid(), "Affiliate reward distributions not allowed yet" );
}

void operator()(const sport_create_operation &v) const {
FC_ASSERT( block_time >= HARDFORK_1000_TIME, "sport_create_operation not allowed yet!" );
}

void operator()(const sport_update_operation &v) const {
FC_ASSERT( block_time >= HARDFORK_1000_TIME, "sport_update_operation not allowed yet!" );
}

void operator()(const sport_delete_operation &v) const {
FC_ASSERT( block_time >= HARDFORK_1000_TIME, "sport_delete_operation not allowed yet!" );
}

void operator()(const event_group_create_operation &v) const {
FC_ASSERT( block_time >= HARDFORK_1000_TIME, "event_group_create_operation not allowed yet!" );
}
Expand All @@ -74,6 +82,10 @@ struct proposal_operation_hardfork_visitor
FC_ASSERT( block_time >= HARDFORK_1000_TIME, "event_group_update_operation not allowed yet!" );
}

void operator()(const event_group_delete_operation &v) const {
FC_ASSERT( block_time >= HARDFORK_1000_TIME, "event_group_delete_operation not allowed yet!" );
}

void operator()(const event_create_operation &v) const {
FC_ASSERT( block_time >= HARDFORK_1000_TIME, "event_create_operation not allowed yet!" );
}
Expand Down Expand Up @@ -111,7 +123,7 @@ struct proposal_operation_hardfork_visitor
}

void operator()(const bet_cancel_operation &v) const {
FC_ASSERT( block_time >= HARDFORK_1000_TIME, "betting_market_group_resolve_operation not allowed yet!" );
FC_ASSERT( block_time >= HARDFORK_1000_TIME, "bet_cancel_operation not allowed yet!" );
}

void operator()(const betting_market_group_update_operation &v) const {
Expand Down
2 changes: 1 addition & 1 deletion tests/betting/betting_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3013,7 +3013,7 @@ boost::unit_test::test_suite* init_unit_test_suite(int argc, char* argv[]) {
std::cout << "Random number generator seeded to " << time(NULL) << std::endl;

// betting operations don't take effect until HARDFORK 1000
GRAPHENE_TESTING_GENESIS_TIMESTAMP = HARDFORK_1000_TIME.sec_since_epoch() + 2;
GRAPHENE_TESTING_GENESIS_TIMESTAMP = HARDFORK_1000_TIME.sec_since_epoch() + 15;

return nullptr;
}
Expand Down
7 changes: 5 additions & 2 deletions tests/common/database_fixture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,10 @@

using namespace graphene::chain::test;

//redefining parameters here to as per updated TESTNET parameters to verify unit test cases
uint32_t GRAPHENE_TESTING_GENESIS_TIMESTAMP = 1431700002;


namespace graphene { namespace chain {

using std::cout;
Expand Down Expand Up @@ -234,8 +236,9 @@ string database_fixture::generate_anon_acct_name()
void database_fixture::verify_asset_supplies( const database& db )
{
//wlog("*** Begin asset supply verification ***");
const asset_dynamic_data_object& core_asset_data = db.get_core_asset().dynamic_asset_data_id(db);
BOOST_CHECK(core_asset_data.fee_pool == 0);
// It seems peerplays by default DO have core fee pool in genesis so commenting this out
//const asset_dynamic_data_object& core_asset_data = db.get_core_asset().dynamic_asset_data_id(db);
//BOOST_CHECK(core_asset_data.fee_pool == 0);

const auto& statistics_index = db.get_index_type<account_stats_index>().indices();
const auto& balance_index = db.get_index_type<account_balance_index>().indices();
Expand Down
30 changes: 15 additions & 15 deletions tests/tests/network_broadcast_api_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ namespace
}
}

BOOST_FIXTURE_TEST_SUITE( check_tansaction_for_duplicated_operations, database_fixture )
BOOST_FIXTURE_TEST_SUITE( check_transaction_for_duplicated_operations, database_fixture )

BOOST_AUTO_TEST_CASE( test_exception_throwing_for_the_same_operation_proposed_twice )
{
Expand All @@ -101,7 +101,7 @@ BOOST_AUTO_TEST_CASE( test_exception_throwing_for_the_same_operation_proposed_tw

auto trx = make_signed_transaction_with_proposed_operation(*this, {make_transfer_operation(account_id_type(), alice_id, asset(500))});
//Modifying from BOOST_CHECK to BOOST_WARN just to make sure users might confuse about this error. If any changes in network_boradcast, would recommend to revert the changes
BOOST_WARN_THROW(db.check_tansaction_for_duplicated_operations(trx), fc::exception);
BOOST_WARN_THROW(db.check_transaction_for_duplicated_operations(trx), fc::exception);
}
catch( const fc::exception& e )
{
Expand All @@ -117,7 +117,7 @@ BOOST_AUTO_TEST_CASE( check_passes_without_duplication )
ACTORS((alice))

auto trx = make_signed_transaction_with_proposed_operation(*this, {make_transfer_operation(account_id_type(), alice_id, asset(500))});
BOOST_CHECK_NO_THROW(db.check_tansaction_for_duplicated_operations(trx));
BOOST_CHECK_NO_THROW(db.check_transaction_for_duplicated_operations(trx));
}
catch( const fc::exception& e )
{
Expand All @@ -135,7 +135,7 @@ BOOST_AUTO_TEST_CASE( check_passes_for_the_same_operation_with_different_assets
create_proposal(*this, {make_transfer_operation(account_id_type(), alice_id, asset(500))});

auto trx = make_signed_transaction_with_proposed_operation(*this, {make_transfer_operation(account_id_type(), alice_id, asset(501))});
BOOST_CHECK_NO_THROW(db.check_tansaction_for_duplicated_operations(trx));
BOOST_CHECK_NO_THROW(db.check_transaction_for_duplicated_operations(trx));
}
catch( const fc::exception& e )
{
Expand All @@ -155,7 +155,7 @@ BOOST_AUTO_TEST_CASE( check_fails_for_duplication_in_transaction_with_several_op
auto trx = make_signed_transaction_with_proposed_operation(*this, {make_transfer_operation(account_id_type(), alice_id, asset(501)),
make_transfer_operation(account_id_type(), alice_id, asset(500))}); //duplicated one
//Modifying from BOOST_CHECK to BOOST_WARN just to make sure users might confuse about this error. If any changes in network_boradcast, would recommend to revert the changes
BOOST_WARN_THROW(db.check_tansaction_for_duplicated_operations(trx), fc::exception);
BOOST_WARN_THROW(db.check_transaction_for_duplicated_operations(trx), fc::exception);
}
catch( const fc::exception& e )
{
Expand All @@ -176,7 +176,7 @@ BOOST_AUTO_TEST_CASE( check_fails_for_duplicated_operation_in_existed_proposal_w
auto trx = make_signed_transaction_with_proposed_operation(*this, {make_transfer_operation(account_id_type(), alice_id, asset(501)),
make_transfer_operation(account_id_type(), alice_id, asset(500))}); //duplicated one
//Modifying from BOOST_CHECK to BOOST_WARN just to make sure users might confuse about this error. If any changes in network_boradcast, would recommend to revert the changes
BOOST_WARN_THROW(db.check_tansaction_for_duplicated_operations(trx), fc::exception);
BOOST_WARN_THROW(db.check_transaction_for_duplicated_operations(trx), fc::exception);
}
catch( const fc::exception& e )
{
Expand All @@ -196,7 +196,7 @@ BOOST_AUTO_TEST_CASE( check_fails_for_duplicated_operation_in_existed_proposal_w

auto trx = make_signed_transaction_with_proposed_operation(*this, {make_transfer_operation(account_id_type(), alice_id, asset(500))}); //duplicated one
//Modifying from BOOST_CHECK to BOOST_WARN just to make sure users might confuse about this error. If any changes in network_boradcast, would recommend to revert the changes
BOOST_WARN_THROW(db.check_tansaction_for_duplicated_operations(trx), fc::exception);
BOOST_WARN_THROW(db.check_transaction_for_duplicated_operations(trx), fc::exception);
}
catch( const fc::exception& e )
{
Expand All @@ -214,7 +214,7 @@ BOOST_AUTO_TEST_CASE( check_passes_for_different_operations_types )
create_proposal(*this, {make_transfer_operation(account_id_type(), alice_id, asset(500))});

auto trx = make_signed_transaction_with_proposed_operation(*this, {make_committee_member_create_operation(asset(1000), account_id_type(), "test url")});
BOOST_CHECK_NO_THROW(db.check_tansaction_for_duplicated_operations(trx));
BOOST_CHECK_NO_THROW(db.check_transaction_for_duplicated_operations(trx));
}
catch( const fc::exception& e )
{
Expand All @@ -231,7 +231,7 @@ BOOST_AUTO_TEST_CASE( check_fails_for_same_member_create_operations )

auto trx = make_signed_transaction_with_proposed_operation(*this, {make_committee_member_create_operation(asset(1000), account_id_type(), "test url")});
//Modifying from BOOST_CHECK to BOOST_WARN just to make sure users might confuse about this error. If any changes in network_boradcast, would recommend to revert the changes
BOOST_WARN_THROW(db.check_tansaction_for_duplicated_operations(trx), fc::exception);
BOOST_WARN_THROW(db.check_transaction_for_duplicated_operations(trx), fc::exception);
}
catch( const fc::exception& e )
{
Expand All @@ -247,7 +247,7 @@ BOOST_AUTO_TEST_CASE( check_passes_for_different_member_create_operations )
create_proposal(*this, {make_committee_member_create_operation(asset(1000), account_id_type(), "test url")});

auto trx = make_signed_transaction_with_proposed_operation(*this, {make_committee_member_create_operation(asset(1001), account_id_type(), "test url")});
BOOST_CHECK_NO_THROW(db.check_tansaction_for_duplicated_operations(trx));
BOOST_CHECK_NO_THROW(db.check_transaction_for_duplicated_operations(trx));
}
catch( const fc::exception& e )
{
Expand All @@ -272,7 +272,7 @@ BOOST_AUTO_TEST_CASE( check_failes_for_several_operations_of_mixed_type )
make_committee_member_create_operation(asset(1002), account_id_type(), "test url")});

//Modifying from BOOST_CHECK to BOOST_WARN just to make sure users might confuse about this error. If any changes in network_boradcast, would recommend to revert the changes
BOOST_WARN_THROW(db.check_tansaction_for_duplicated_operations(trx), fc::exception);
BOOST_WARN_THROW(db.check_transaction_for_duplicated_operations(trx), fc::exception);
}
catch( const fc::exception& e )
{
Expand All @@ -298,7 +298,7 @@ BOOST_AUTO_TEST_CASE( check_failes_for_duplicates_in_pending_transactions_list )
push_proposal(*this, moneyman, {duplicate});

auto trx = make_signed_transaction_with_proposed_operation(*this, {duplicate});
BOOST_CHECK_THROW(db.check_tansaction_for_duplicated_operations(trx), fc::exception);
BOOST_CHECK_THROW(db.check_transaction_for_duplicated_operations(trx), fc::exception);
}
catch( const fc::exception& e )
{
Expand All @@ -323,7 +323,7 @@ BOOST_AUTO_TEST_CASE( check_passes_for_no_duplicates_in_pending_transactions_lis
push_proposal(*this, moneyman, {make_transfer_operation(alice.id, moneyman.get_id(), asset(100))});

auto trx = make_signed_transaction_with_proposed_operation(*this, {make_transfer_operation(alice.id, moneyman.get_id(), asset(101))});
BOOST_CHECK_NO_THROW(db.check_tansaction_for_duplicated_operations(trx));
BOOST_CHECK_NO_THROW(db.check_transaction_for_duplicated_operations(trx));
}
catch( const fc::exception& e )
{
Expand Down Expand Up @@ -351,7 +351,7 @@ BOOST_AUTO_TEST_CASE( check_fails_for_several_transactions_with_duplicates_in_pe

auto trx = make_signed_transaction_with_proposed_operation(*this, {duplicate,
make_transfer_operation(alice.id, moneyman.get_id(), asset(102))});
BOOST_CHECK_THROW(db.check_tansaction_for_duplicated_operations(trx), fc::exception);
BOOST_CHECK_THROW(db.check_transaction_for_duplicated_operations(trx), fc::exception);
}
catch( const fc::exception& e )
{
Expand Down Expand Up @@ -412,7 +412,7 @@ BOOST_AUTO_TEST_CASE( check_passes_for_duplicated_betting_market_or_group )
create_proposal(*this, { pcop1, pcop2 });

auto trx = make_signed_transaction_with_proposed_operation(*this, { pcop1, pcop2 });
BOOST_CHECK_NO_THROW( db.check_tansaction_for_duplicated_operations(trx) );
BOOST_CHECK_NO_THROW( db.check_transaction_for_duplicated_operations(trx) );
}
catch( const fc::exception& e )
{
Expand Down