Skip to content

Commit

Permalink
Merge branch 'develop' into is-virtual-field-in-es
Browse files Browse the repository at this point in the history
  • Loading branch information
abitmore committed Mar 20, 2023
2 parents bfa0401 + d50e2db commit d226bd9
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 10 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build-and-test.mac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ jobs:
make -j 3 -C _build witness_node cli_wallet app_test cli_test chain_test
df -h
- name: Unit-Tests
timeout-minutes: 15
run: |
_build/tests/app_test -l test_suite
libraries/fc/tests/run-parallel-tests.sh _build/tests/chain_test -l test_suite
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/build-and-test.ubuntu-debug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ jobs:
du -hs _build/*
du -hs /_build/*
- name: Unit-Tests
timeout-minutes: 15
run: |
_build/tests/app_test -l test_suite
df -h
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/build-and-test.ubuntu-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ jobs:
make -j 2 -C _build
df -h
- name: Unit-Tests
timeout-minutes: 15
run: |
_build/tests/app_test -l test_suite
_build/tests/es_test -l test_suite
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/sonar-scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ jobs:
rm -rf _build/programs/genesis_util/get_dev_key
df -h
- name: Unit-Tests
timeout-minutes: 15
run: |
_build/tests/app_test -l test_suite
df -h
Expand Down
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2015-2022 Cryptonomex Inc. <[email protected]> and
Copyright (c) 2015-2023 Cryptonomex Inc. <[email protected]> and
contributors (see CONTRIBUTORS.txt)

The MIT License
Expand Down
5 changes: 4 additions & 1 deletion libraries/chain/db_market.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,10 @@ void database::cancel_limit_order( const limit_order_object& order, bool create_
}

if( create_virtual_op )
push_applied_operation( vop );
{
auto op_id = push_applied_operation( vop );
set_applied_operation_result( op_id, refunded );
}

remove(order);
}
Expand Down
2 changes: 1 addition & 1 deletion libraries/chain/include/graphene/chain/config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

#define GRAPHENE_MAX_NESTED_OBJECTS (200)

const std::string GRAPHENE_CURRENT_DB_VERSION = "20220930";
const std::string GRAPHENE_CURRENT_DB_VERSION = "20230319";

#define GRAPHENE_RECENTLY_MISSED_COUNT_INCREMENT 4
#define GRAPHENE_RECENTLY_MISSED_COUNT_DECREMENT 3
Expand Down
41 changes: 34 additions & 7 deletions tests/tests/history_api_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,8 @@ BOOST_AUTO_TEST_CASE(get_account_history) {
}
}

BOOST_AUTO_TEST_CASE(get_account_history_virtual_operation_test) {
try {
BOOST_AUTO_TEST_CASE(get_account_history_virtual_operation_test)
{ try {
graphene::app::history_api hist_api(app);

asset_id_type usd_id = create_user_issued_asset("USD").get_id();
Expand All @@ -164,11 +164,38 @@ BOOST_AUTO_TEST_CASE(get_account_history_virtual_operation_test) {
BOOST_CHECK( histories.front().block_time == db.head_block_time() );
BOOST_CHECK( histories.front().is_virtual );

} catch (fc::exception &e) {
edump((e.to_detail_string()));
throw;
}
}
// Create a limit order that expires in 300 seconds
create_sell_order( dan_id, asset(10, usd_id), asset(10), db.head_block_time() + 300 );

generate_block();
fc::usleep(fc::milliseconds(100));

auto order_create_op_id = operation::tag<limit_order_create_operation>::value;

histories = hist_api.get_account_history("dan", operation_history_id_type(),
100, operation_history_id_type());

BOOST_REQUIRE_GT( histories.size(), 0 );
BOOST_CHECK_EQUAL( histories.front().op.which(), order_create_op_id );
BOOST_CHECK( histories.front().block_time == db.head_block_time() );
BOOST_CHECK( !histories.front().is_virtual );

// Let the limit order expire
generate_blocks( db.head_block_time() + 300 );
generate_block();
fc::usleep(fc::milliseconds(100));

auto order_cancel_op_id = operation::tag<limit_order_cancel_operation>::value;

histories = hist_api.get_account_history("dan", operation_history_id_type(),
100, operation_history_id_type());

BOOST_REQUIRE_GT( histories.size(), 0 );
BOOST_CHECK_EQUAL( histories.front().op.which(), order_cancel_op_id );
BOOST_CHECK( histories.front().is_virtual );
BOOST_CHECK( histories.front().result.is_type<asset>() );

} FC_LOG_AND_RETHROW() }

BOOST_AUTO_TEST_CASE(get_account_history_notify_all_on_creation) {
try {
Expand Down

0 comments on commit d226bd9

Please sign in to comment.