From 8ac9d206f48d860fad90c72e8e638a628cfccb68 Mon Sep 17 00:00:00 2001 From: abitmore Date: Sat, 1 Jul 2023 22:55:23 +0000 Subject: [PATCH 1/3] Add missing reflection for limit_order_update_op --- libraries/protocol/include/graphene/protocol/market.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/protocol/include/graphene/protocol/market.hpp b/libraries/protocol/include/graphene/protocol/market.hpp index 21dc2cd2a..b84e00219 100644 --- a/libraries/protocol/include/graphene/protocol/market.hpp +++ b/libraries/protocol/include/graphene/protocol/market.hpp @@ -297,7 +297,7 @@ FC_REFLECT( graphene::protocol::call_order_update_operation::options_type, (targ FC_REFLECT( graphene::protocol::limit_order_create_operation, (fee)(seller)(amount_to_sell)(min_to_receive)(expiration)(fill_or_kill)(extensions)) FC_REFLECT( graphene::protocol::limit_order_update_operation, - (fee)(seller)(order)(new_price)(delta_amount_to_sell)(new_expiration)(extensions)) + (fee)(seller)(order)(new_price)(delta_amount_to_sell)(new_expiration)(on_fill)(extensions)) FC_REFLECT( graphene::protocol::limit_order_cancel_operation, (fee)(fee_paying_account)(order)(extensions) ) FC_REFLECT( graphene::protocol::call_order_update_operation, From 34134abb9d9698bc7c0452d196dcd0685051e6c2 Mon Sep 17 00:00:00 2001 From: abitmore Date: Sun, 2 Jul 2023 08:18:46 +0000 Subject: [PATCH 2/3] Fix fee_change_test --- tests/tests/fee_tests.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/tests/fee_tests.cpp b/tests/tests/fee_tests.cpp index 2d28d8aa7..49a3cd69e 100644 --- a/tests/tests/fee_tests.cpp +++ b/tests/tests/fee_tests.cpp @@ -4240,8 +4240,9 @@ BOOST_AUTO_TEST_CASE( fee_change_test ) // The fee schedule is still all zero check_zero_fees(); - // Pass the BSIP-40 hardfork - generate_blocks( HARDFORK_BSIP_40_TIME ); + // Proceed to a time in the far future + generate_blocks( fc::time_point_sec::maximum() - 86400 + - db.get_global_properties().parameters.maximum_proposal_lifetime ); set_expiration( db, trx ); // The fee schedule is still all zero From 12cd517e669f38c5a8b833a0d4670f3fc04d95cc Mon Sep 17 00:00:00 2001 From: abitmore Date: Sun, 2 Jul 2023 12:43:16 +0000 Subject: [PATCH 3/3] Add OSO tests for ES --- tests/elasticsearch/main.cpp | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/tests/elasticsearch/main.cpp b/tests/elasticsearch/main.cpp index 5794d7f43..e3c6ca7da 100644 --- a/tests/elasticsearch/main.cpp +++ b/tests/elasticsearch/main.cpp @@ -230,6 +230,10 @@ BOOST_AUTO_TEST_CASE(elasticsearch_objects) { // The head block number is 1 BOOST_CHECK_EQUAL( db.head_block_num(), 1u ); + generate_blocks( HARDFORK_CORE_2535_TIME ); // For Order-Sends-Take-Profit-Order + generate_block(); + set_expiration( db, trx ); + // delete all first, this will delete genesis data and data inserted at block 1 auto delete_objects = graphene::utilities::deleteAll(es); BOOST_REQUIRE(delete_objects); // require successful deletion @@ -272,9 +276,13 @@ BOOST_AUTO_TEST_CASE(elasticsearch_objects) { auto bitasset_object_id = j["hits"]["hits"][size_t(0)]["_source"]["object_id"].as_string(); BOOST_CHECK_EQUAL(bitasset_object_id, bitasset_data_id); + // fee_asset, spread, size, expiration, repeat + create_take_profit_order_action tpa1 { asset_id_type(), 300, 9900, 86400, true }; + vector on_fill_1 { tpa1 }; // create a limit order that expires at the next maintenance time create_sell_order( account_id_type(), asset(1), asset(1, usd_id), - db.get_dynamic_global_properties().next_maintenance_time ); + db.get_dynamic_global_properties().next_maintenance_time, + price::unit_price(), on_fill_1 ); generate_block(); es.endpoint = es.index_prefix + "limitorder/_count"; @@ -342,6 +350,10 @@ BOOST_AUTO_TEST_CASE(elasticsearch_history_api) { es.elasticsearch_url = GRAPHENE_TESTING_ES_URL; es.index_prefix = es_index_prefix; + generate_blocks( HARDFORK_CORE_2535_TIME ); // For Order-Sends-Take-Profit-Order + generate_block(); + set_expiration( db, trx ); + auto delete_account_history = graphene::utilities::deleteAll(es); BOOST_REQUIRE(delete_account_history); // require successful deletion @@ -673,8 +685,12 @@ BOOST_AUTO_TEST_CASE(elasticsearch_history_api) { // Prepare funds transfer( account_id_type()(db), alice_id(db), asset(100) ); + // fee_asset, spread, size, expiration, repeat + create_take_profit_order_action tpa1 { asset_id_type(), 100, 10000, 86400, false }; + vector on_fill_1 { tpa1 }; // Create a limit order that expires in 300 seconds - create_sell_order( alice_id, asset(1), asset(1, asset_id_type(1)), db.head_block_time() + 300 ); + create_sell_order( alice_id, asset(1), asset(1, asset_id_type(1)), db.head_block_time() + 300, + price::unit_price(), on_fill_1 ); generate_block();