From b2835bc02d928113b6409415ecf4581a7259e3ef Mon Sep 17 00:00:00 2001 From: Nathan Hourt Date: Thu, 17 Mar 2016 17:08:27 -0500 Subject: [PATCH 1/8] Add headers to install targets --- libraries/app/CMakeLists.txt | 1 + libraries/chain/CMakeLists.txt | 1 + libraries/db/CMakeLists.txt | 1 + libraries/deterministic_openssl_rand/CMakeLists.txt | 1 + libraries/net/CMakeLists.txt | 1 + libraries/p2p/CMakeLists.txt | 1 + libraries/time/CMakeLists.txt | 1 + libraries/utilities/CMakeLists.txt | 1 + libraries/wallet/CMakeLists.txt | 1 + 9 files changed, 9 insertions(+) diff --git a/libraries/app/CMakeLists.txt b/libraries/app/CMakeLists.txt index 2dd91f630a..29d76fe87c 100644 --- a/libraries/app/CMakeLists.txt +++ b/libraries/app/CMakeLists.txt @@ -28,3 +28,4 @@ INSTALL( TARGETS LIBRARY DESTINATION lib ARCHIVE DESTINATION lib ) +INSTALL( FILES ${HEADERS} DESTINATION "include/graphene/app" ) diff --git a/libraries/chain/CMakeLists.txt b/libraries/chain/CMakeLists.txt index 9cc4285dd8..e8dddf811c 100644 --- a/libraries/chain/CMakeLists.txt +++ b/libraries/chain/CMakeLists.txt @@ -109,3 +109,4 @@ INSTALL( TARGETS LIBRARY DESTINATION lib ARCHIVE DESTINATION lib ) +INSTALL( FILES ${HEADERS} DESTINATION "include/graphene/chain" ) diff --git a/libraries/db/CMakeLists.txt b/libraries/db/CMakeLists.txt index 986fe9cbfc..6feb985c6f 100644 --- a/libraries/db/CMakeLists.txt +++ b/libraries/db/CMakeLists.txt @@ -10,3 +10,4 @@ install( TARGETS LIBRARY DESTINATION lib ARCHIVE DESTINATION lib ) +install( FILES ${HEADERS} DESTINATION "include/graphene/db" ) diff --git a/libraries/deterministic_openssl_rand/CMakeLists.txt b/libraries/deterministic_openssl_rand/CMakeLists.txt index 13ef69a077..1d9c5870c4 100644 --- a/libraries/deterministic_openssl_rand/CMakeLists.txt +++ b/libraries/deterministic_openssl_rand/CMakeLists.txt @@ -25,3 +25,4 @@ install( TARGETS LIBRARY DESTINATION lib ARCHIVE DESTINATION lib ) +install( FILES ${headers} DESTINATION "include/graphene/deterministic_openssl_rand" ) diff --git a/libraries/net/CMakeLists.txt b/libraries/net/CMakeLists.txt index cabf26a67e..4110098a1f 100644 --- a/libraries/net/CMakeLists.txt +++ b/libraries/net/CMakeLists.txt @@ -32,3 +32,4 @@ install( TARGETS LIBRARY DESTINATION lib ARCHIVE DESTINATION lib ) +install( FILES ${HEADERS} DESTINATION "include/graphene/net" ) diff --git a/libraries/p2p/CMakeLists.txt b/libraries/p2p/CMakeLists.txt index 6b5918d51a..5aa8d1f7fa 100644 --- a/libraries/p2p/CMakeLists.txt +++ b/libraries/p2p/CMakeLists.txt @@ -30,3 +30,4 @@ install( TARGETS LIBRARY DESTINATION lib ARCHIVE DESTINATION lib ) +install( FILES ${HEADERS} DESTINATION "include/graphene/p2p" ) diff --git a/libraries/time/CMakeLists.txt b/libraries/time/CMakeLists.txt index cc8a909d29..4c9b85c188 100644 --- a/libraries/time/CMakeLists.txt +++ b/libraries/time/CMakeLists.txt @@ -15,3 +15,4 @@ install( TARGETS LIBRARY DESTINATION lib ARCHIVE DESTINATION lib ) +install( FILES ${HEADERS} DESTINATION "include/graphene/time" ) diff --git a/libraries/utilities/CMakeLists.txt b/libraries/utilities/CMakeLists.txt index cce166446e..cc78f99702 100644 --- a/libraries/utilities/CMakeLists.txt +++ b/libraries/utilities/CMakeLists.txt @@ -37,3 +37,4 @@ install( TARGETS LIBRARY DESTINATION lib ARCHIVE DESTINATION lib ) +install( FILES ${HEADERS} DESTINATION "include/graphene/utilities" ) diff --git a/libraries/wallet/CMakeLists.txt b/libraries/wallet/CMakeLists.txt index 3d66c48e64..105073466c 100644 --- a/libraries/wallet/CMakeLists.txt +++ b/libraries/wallet/CMakeLists.txt @@ -37,3 +37,4 @@ install( TARGETS LIBRARY DESTINATION lib ARCHIVE DESTINATION lib ) +install( FILES ${HEADERS} DESTINATION "include/graphene/wallet" ) From 0525d1647777aba7ad6e13aca773812e3be3de9b Mon Sep 17 00:00:00 2001 From: Nathan Hourt Date: Thu, 17 Mar 2016 19:14:55 -0500 Subject: [PATCH 2/8] Fix install of chain/protocol headers --- libraries/chain/CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libraries/chain/CMakeLists.txt b/libraries/chain/CMakeLists.txt index e8dddf811c..72f4e7e950 100644 --- a/libraries/chain/CMakeLists.txt +++ b/libraries/chain/CMakeLists.txt @@ -6,6 +6,7 @@ set_source_files_properties( "${CMAKE_CURRENT_BINARY_DIR}/include/graphene/chain add_dependencies( build_hardfork_hpp cat-parts ) file(GLOB HEADERS "include/graphene/chain/*.hpp") +file(GLOB PROTOCOL_HEADERS "include/graphene/chain/protocol/*.hpp") if( GRAPHENE_DISABLE_UNITY_BUILD ) set( GRAPHENE_DB_FILES @@ -90,6 +91,7 @@ add_library( graphene_chain is_authorized_asset.cpp ${HEADERS} + ${PROTOCOL_HEADERS} "${CMAKE_CURRENT_BINARY_DIR}/include/graphene/chain/hardfork.hpp" ) @@ -110,3 +112,4 @@ INSTALL( TARGETS ARCHIVE DESTINATION lib ) INSTALL( FILES ${HEADERS} DESTINATION "include/graphene/chain" ) +INSTALL( FILES ${PROTOCOL_HEADERS} DESTINATION "include/graphene/chain/protocol" ) From 23b8843d2f4e23280e3a5e1db480297758c8c872 Mon Sep 17 00:00:00 2001 From: abitmore Date: Sun, 20 Mar 2016 01:21:13 +0100 Subject: [PATCH 3/8] check_authority(): fix #631 early end of recursion --- libraries/chain/protocol/transaction.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/chain/protocol/transaction.cpp b/libraries/chain/protocol/transaction.cpp index 5de878eadb..5faf1c0a10 100644 --- a/libraries/chain/protocol/transaction.cpp +++ b/libraries/chain/protocol/transaction.cpp @@ -193,7 +193,7 @@ struct sign_state if( approved_by.find(a.first) == approved_by.end() ) { if( depth == max_recursion ) - return false; + continue; if( check_authority( get_active( a.first ), depth+1 ) ) { approved_by.insert( a.first ); From 20f75ebaf054eb1f3f6f42ee34951f196e6586ac Mon Sep 17 00:00:00 2001 From: abitmore Date: Sun, 20 Mar 2016 15:34:10 +0100 Subject: [PATCH 4/8] Fix cli_wallet out-of-source builds #633 --- libraries/wallet/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/wallet/CMakeLists.txt b/libraries/wallet/CMakeLists.txt index 3d66c48e64..220b21a3dd 100644 --- a/libraries/wallet/CMakeLists.txt +++ b/libraries/wallet/CMakeLists.txt @@ -8,7 +8,7 @@ if( PERL_FOUND AND DOXYGEN_FOUND AND NOT "${CMAKE_GENERATOR}" STREQUAL "Ninja" ) add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/doxygen/perlmod/DoxyDocs.pm WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND ${DOXYGEN_EXECUTABLE} - DEPENDS Doxyfile include/graphene/wallet/wallet.hpp ) + DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile include/graphene/wallet/wallet.hpp ) add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/api_documentation.cpp COMMAND ${PERL_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/generate_api_documentation.pl ${CMAKE_CURRENT_BINARY_DIR}/api_documentation.cpp.new From d7316829bbabf5f4ba74bc6b82c7ccecfb1cad18 Mon Sep 17 00:00:00 2001 From: theoreticalbts Date: Tue, 22 Mar 2016 14:11:49 -0400 Subject: [PATCH 5/8] Bump fc --- libraries/fc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/fc b/libraries/fc index 622ff58039..31adee49d9 160000 --- a/libraries/fc +++ b/libraries/fc @@ -1 +1 @@ -Subproject commit 622ff58039f2388433272a44fe416f5b8025589a +Subproject commit 31adee49d91275cc63aa3a47b3a9e3c826baccca From 194186b63a8f3bfdc8d808994db7647c83ed1f1e Mon Sep 17 00:00:00 2001 From: theoreticalbts Date: Fri, 25 Mar 2016 12:41:08 -0400 Subject: [PATCH 6/8] Implement vbo_withdraw_different test #625 --- tests/tests/operation_tests2.cpp | 73 ++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) diff --git a/tests/tests/operation_tests2.cpp b/tests/tests/operation_tests2.cpp index 8cefec4e24..607f7a044d 100644 --- a/tests/tests/operation_tests2.cpp +++ b/tests/tests/operation_tests2.cpp @@ -1331,6 +1331,79 @@ BOOST_AUTO_TEST_CASE(zero_second_vbo) } FC_LOG_AND_RETHROW() } +BOOST_AUTO_TEST_CASE( vbo_withdraw_different ) +{ + try + { + ACTORS((alice)(izzy)); + // don't pay witnesses so we have some worker budget to work with + + // transfer(account_id_type(), alice_id, asset(1000)); + + asset_id_type stuff_id = create_user_issued_asset( "STUFF", izzy_id(db), 0 ).id; + issue_uia( alice_id, asset( 1000, stuff_id ) ); + + // deposit STUFF with linear vesting policy + vesting_balance_id_type vbid; + { + linear_vesting_policy_initializer pinit; + pinit.begin_timestamp = db.head_block_time(); + pinit.vesting_cliff_seconds = 30; + pinit.vesting_duration_seconds = 30; + + vesting_balance_create_operation create_op; + create_op.creator = alice_id; + create_op.owner = alice_id; + create_op.amount = asset(100, stuff_id); + create_op.policy = pinit; + + signed_transaction create_tx; + create_tx.operations.push_back( create_op ); + set_expiration( db, create_tx ); + sign(create_tx, alice_private_key); + + processed_transaction ptx = PUSH_TX( db, create_tx ); + vbid = ptx.operation_results[0].get(); + } + + // wait for VB to mature + generate_blocks( 30 ); + + BOOST_CHECK( vbid(db).get_allowed_withdraw( db.head_block_time() ) == asset(100, stuff_id) ); + + // bad withdrawal op (wrong asset) + { + vesting_balance_withdraw_operation op; + + op.vesting_balance = vbid; + op.amount = asset(100); + op.owner = alice_id; + + signed_transaction withdraw_tx; + withdraw_tx.operations.push_back(op); + set_expiration( db, withdraw_tx ); + sign( withdraw_tx, alice_private_key ); + GRAPHENE_CHECK_THROW( PUSH_TX( db, withdraw_tx ), fc::exception ); + } + + // good withdrawal op + { + vesting_balance_withdraw_operation op; + + op.vesting_balance = vbid; + op.amount = asset(100, stuff_id); + op.owner = alice_id; + + signed_transaction withdraw_tx; + withdraw_tx.operations.push_back(op); + set_expiration( db, withdraw_tx ); + sign( withdraw_tx, alice_private_key ); + PUSH_TX( db, withdraw_tx ); + } + } + FC_LOG_AND_RETHROW() +} + // TODO: Write linear VBO tests BOOST_AUTO_TEST_CASE( top_n_special ) From aeabad73643f74c3cc9c27ab572df3b9bbec2b76 Mon Sep 17 00:00:00 2001 From: theoreticalbts Date: Fri, 25 Mar 2016 13:19:44 -0400 Subject: [PATCH 7/8] database_fixture.cpp: Check asset supplies later in verify_asset_supplies() #639 --- tests/common/database_fixture.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/tests/common/database_fixture.cpp b/tests/common/database_fixture.cpp index 67e4dd0d20..ff98c423ab 100644 --- a/tests/common/database_fixture.cpp +++ b/tests/common/database_fixture.cpp @@ -184,15 +184,15 @@ void database_fixture::verify_asset_supplies( const database& db ) } for( const asset_object& asset_obj : db.get_index_type().indices() ) { - total_balances[asset_obj.id] += asset_obj.dynamic_asset_data_id(db).accumulated_fees; - if( asset_obj.id != asset_id_type() ) - BOOST_CHECK_EQUAL(total_balances[asset_obj.id].value, asset_obj.dynamic_asset_data_id(db).current_supply.value); - total_balances[asset_id_type()] += asset_obj.dynamic_asset_data_id(db).fee_pool; + const auto& dasset_obj = asset_obj.dynamic_asset_data_id(db); + total_balances[asset_obj.id] += dasset_obj.accumulated_fees; + total_balances[asset_id_type()] += dasset_obj.fee_pool; if( asset_obj.is_market_issued() ) { const auto& bad = asset_obj.bitasset_data(db); total_balances[bad.options.short_backing_asset] += bad.settlement_fund; } + total_balances[asset_obj.id] += dasset_obj.confidential_supply.value; } for( const vesting_balance_object& vbo : db.get_index_type< vesting_balance_index >().indices() ) total_balances[ vbo.balance.asset_id ] += vbo.balance.amount; @@ -206,8 +206,12 @@ void database_fixture::verify_asset_supplies( const database& db ) BOOST_CHECK_EQUAL(item.first(db).dynamic_asset_data_id(db).current_supply.value, item.second.value); } + for( const asset_object& asset_obj : db.get_index_type().indices() ) + { + BOOST_CHECK_EQUAL(total_balances[asset_obj.id].value, asset_obj.dynamic_asset_data_id(db).current_supply.value); + } + BOOST_CHECK_EQUAL( core_in_orders.value , reported_core_in_orders.value ); - BOOST_CHECK_EQUAL( total_balances[asset_id_type()].value , core_asset_data.current_supply.value - core_asset_data.confidential_supply.value); // wlog("*** End asset supply verification ***"); } From f049fce4e97154ce0d037ee2818a285ebffb944f Mon Sep 17 00:00:00 2001 From: theoreticalbts Date: Fri, 25 Mar 2016 13:09:19 -0400 Subject: [PATCH 8/8] Ignore ctx.amount in get_allowed_withdraw() #625 --- libraries/chain/vesting_balance_object.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/chain/vesting_balance_object.cpp b/libraries/chain/vesting_balance_object.cpp index 8414840c28..73448e04c8 100644 --- a/libraries/chain/vesting_balance_object.cpp +++ b/libraries/chain/vesting_balance_object.cpp @@ -64,7 +64,7 @@ asset linear_vesting_policy::get_allowed_withdraw( const vesting_policy_context& } } - return asset( allowed_withdraw, ctx.amount.asset_id ); + return asset( allowed_withdraw, ctx.balance.asset_id ); } void linear_vesting_policy::on_deposit(const vesting_policy_context& ctx)