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 develop branch to hardfork branch #670

Merged
merged 32 commits into from
Feb 15, 2018
Merged
Show file tree
Hide file tree
Changes from 30 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
c570a73
Merge pull request #603 from bitshares/develop
oxarbitrage Jan 26, 2018
5defdb0
Fix error logging in push_proposal
abitmore Feb 2, 2018
73f1a93
Merge pull request #621 from bitshares/abitmore-patch-1
oxarbitrage Feb 2, 2018
4886364
#151 avoid using the cached version of account_object since it could …
Feb 2, 2018
c2d28be
Issue491 (#609)
oxarbitrage Feb 2, 2018
b5a1674
Fix Windows build
abitmore Feb 3, 2018
bd84271
Merge pull request #629 from bitshares/180202-fix-windows-build
abitmore Feb 3, 2018
5d94ad0
Merge pull request #631 from bitshares/release
abitmore Feb 3, 2018
1f719e5
add doxygen at support
oxarbitrage Feb 4, 2018
e2daabd
unused index.cpp file removed
Feb 5, 2018
91bdc9d
Merge pull request #634 from bitshares/oxarbitrage-patch-1
oxarbitrage Feb 5, 2018
bcfb9b4
Update Doxyfile
oxarbitrage Feb 6, 2018
7716e8c
Merge pull request #645 from oxarbitrage/updatedoxy
oxarbitrage Feb 6, 2018
3b0990c
Merge pull request #647 from bitshares/release
oxarbitrage Feb 6, 2018
49e8869
Merge pull request #640 from openledger/issue151
oxarbitrage Feb 7, 2018
f4dd0a9
Fix broken HTTP headers in elasticsearch requests
Feb 8, 2018
932fa6e
Removed unused index by_feed_expiration
jmjatlanta Feb 8, 2018
2cb3675
Merge pull request #653 from openledger/develop
oxarbitrage Feb 8, 2018
24aee5f
Merge pull request #638 from ihla/remove_unused_index_cpp
oxarbitrage Feb 8, 2018
97d86fe
Merge pull request #654 from jmjatlanta/Issue652_index_by_feed_expira…
oxarbitrage Feb 8, 2018
72ef525
Add broadcast_transaction method for broadcast transaction signed by …
Feb 9, 2018
bf27fb8
Update document for broadcast_transaction
Feb 9, 2018
cdb4307
removed TODO of broadcast_transaction function
Feb 10, 2018
a214d2b
Merge pull request #656 from zhuliting/develop
oxarbitrage Feb 10, 2018
88508da
Port plugin sanitization code from Steem to BitShares #468
marcialvieira Feb 11, 2018
1ebe97d
Merge pull request #661 from marcialvieira/468-plugin-sanitization
abitmore Feb 12, 2018
a34d4bd
remove "temp for testing" code using BTS string literal
Feb 13, 2018
d3f8560
remove "temporary for handling BTS snapshot" code
Feb 13, 2018
694f4b4
Merge pull request #666 from ihla/remove_temporary_code_for_handling_…
oxarbitrage Feb 13, 2018
10aac58
Merge pull request #665 from ihla/remove_temporary_for_testing_code
oxarbitrage Feb 13, 2018
98b0448
remove unused transaction_object.cpp
Feb 14, 2018
dfb3a49
Merge pull request #667 from ihla/remove_unused_transaction_object_cpp
oxarbitrage Feb 14, 2018
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
10 changes: 5 additions & 5 deletions Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,19 @@ DOXYFILE_ENCODING = UTF-8
# title of most generated pages and in a few other places.
# The default value is: My Project.

PROJECT_NAME = "Graphene"
PROJECT_NAME = "Bitshares-Core"

# The PROJECT_NUMBER tag can be used to enter a project or revision number. This
# could be handy for archiving the generated documentation or if some version
# control system is used.

PROJECT_NUMBER =
PROJECT_NUMBER = "2.0.180202"

# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
# quick idea about the purpose of the project. Keep the description short.

PROJECT_BRIEF =
PROJECT_BRIEF = "Your share in the Decentralized Exchange"

# With the PROJECT_LOGO tag one can specify a logo or an icon that is included
# in the documentation. The maximum height of the logo should not exceed 55
Expand Down Expand Up @@ -758,7 +758,7 @@ WARN_LOGFILE =
# spaces.
# Note: If this tag is empty the current directory is searched.

INPUT = doc/main.dox libraries/chain libraries/chain/db libraries/app libraries/wallet
INPUT = README.md doc/main.dox libraries/chain libraries/chain/db libraries/app libraries/wallet

# This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
Expand Down Expand Up @@ -894,7 +894,7 @@ FILTER_SOURCE_PATTERNS =
# (index.html). This can be useful if you have a project on for instance GitHub
# and want to reuse the introduction page also for the doxygen output.

USE_MDFILE_AS_MAINPAGE =
USE_MDFILE_AS_MAINPAGE = "README.md"

#---------------------------------------------------------------------------
# Configuration options related to source browsing
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ BitShares Core bugs can be reported directly to the [issue tracker](https://gith

BitShares UI bugs should be reported to the [UI issue tracker](https://github.com/bitshares/bitshares-ui/issues)

Up to date online Doxygen documentation can be found at [Doxygen](https://bitshares.org/doxygen/hierarchy.html)

Using the API
-------------

Expand Down
2 changes: 1 addition & 1 deletion libraries/app/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ fc::uint128 to_capped128( const u256& t )
string uint128_amount_to_string( const fc::uint128& amount, const uint8_t precision )
{ try {
string s = string( amount );
if( precision == 0 || amount == 0 )
if( precision == 0 || amount == fc::uint128() )
return s;

std::stringstream ss;
Expand Down
6 changes: 3 additions & 3 deletions libraries/chain/db_block.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ processed_transaction database::_push_transaction( const signed_transaction& trx
temp_session.merge();

// notify anyone listening to pending transactions
on_pending_transaction( trx );
notify_on_pending_transaction( trx );
return processed_trx;
}

Expand Down Expand Up @@ -286,7 +286,7 @@ processed_transaction database::push_proposal(const proposal_object& proposal)
{
_applied_ops.resize( old_applied_ops_size );
}
elog( "e", ("e",e.to_detail_string() ) );
elog( "${e}", ("e",e.to_detail_string() ) );
throw;
}

Expand Down Expand Up @@ -538,7 +538,7 @@ void database::_apply_block( const signed_block& next_block )
apply_debug_updates();

// notify observers that the block has been applied
applied_block( next_block ); //emit
notify_applied_block( next_block ); //emit
_applied_ops.clear();

notify_changed_objects();
Expand Down
5 changes: 0 additions & 5 deletions libraries/chain/db_init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -448,11 +448,6 @@ void database::init_genesis(const genesis_state_type& genesis_state)
const auto& assets_by_symbol = get_index_type<asset_index>().indices().get<by_symbol>();
const auto get_asset_id = [&assets_by_symbol](const string& symbol) {
auto itr = assets_by_symbol.find(symbol);

// TODO: This is temporary for handling BTS snapshot
if( symbol == "BTS" )
itr = assets_by_symbol.find(GRAPHENE_SYMBOL);

FC_ASSERT(itr != assets_by_symbol.end(),
"Unable to find asset '${sym}'. Did you forget to add a record for it to initial_assets?",
("sym", symbol));
Expand Down
16 changes: 13 additions & 3 deletions libraries/chain/db_notify.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,16 @@ static void get_relevant_accounts( const object* obj, flat_set<account_id_type>&

namespace graphene { namespace chain {

void database::notify_applied_block( const signed_block& block )
{
GRAPHENE_TRY_NOTIFY( applied_block, block )
}

void database::notify_on_pending_transaction( const signed_transaction& tx )
{
GRAPHENE_TRY_NOTIFY( on_pending_transaction, tx )
}

void database::notify_changed_objects()
{ try {
if( _undo_db.enabled() )
Expand All @@ -372,7 +382,7 @@ void database::notify_changed_objects()
get_relevant_accounts(obj, new_accounts_impacted);
}

new_objects(new_ids, new_accounts_impacted);
GRAPHENE_TRY_NOTIFY( new_objects, new_ids, new_accounts_impacted)
}

// Changed
Expand All @@ -386,7 +396,7 @@ void database::notify_changed_objects()
get_relevant_accounts(item.second.get(), changed_accounts_impacted);
}

changed_objects(changed_ids, changed_accounts_impacted);
GRAPHENE_TRY_NOTIFY( changed_objects, changed_ids, changed_accounts_impacted)
}

// Removed
Expand All @@ -403,7 +413,7 @@ void database::notify_changed_objects()
get_relevant_accounts(obj, removed_accounts_impacted);
}

removed_objects(removed_ids, removed, removed_accounts_impacted);
GRAPHENE_TRY_NOTIFY( removed_objects, removed_ids, removed, removed_accounts_impacted)
}
}
} FC_CAPTURE_AND_LOG( (0) ) }
Expand Down
6 changes: 1 addition & 5 deletions libraries/chain/include/graphene/chain/asset_object.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -217,14 +217,10 @@ namespace graphene { namespace chain {
void update_median_feeds(time_point_sec current_time);
};

struct by_feed_expiration;
typedef multi_index_container<
asset_bitasset_data_object,
indexed_by<
ordered_unique< tag<by_id>, member< object, object_id_type, &object::id > >,
ordered_non_unique< tag<by_feed_expiration>,
const_mem_fun< asset_bitasset_data_object, time_point_sec, &asset_bitasset_data_object::feed_expiration_time >
>
ordered_unique< tag<by_id>, member< object, object_id_type, &object::id > >
>
> asset_bitasset_data_object_multi_index_type;
typedef generic_index<asset_bitasset_data_object, asset_bitasset_data_object_multi_index_type> asset_bitasset_data_index;
Expand Down
2 changes: 2 additions & 0 deletions libraries/chain/include/graphene/chain/database.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,8 @@ namespace graphene { namespace chain {
protected:
//Mark pop_undo() as protected -- we do not want outside calling pop_undo(); it should call pop_block() instead
void pop_undo() { object_database::pop_undo(); }
void notify_applied_block( const signed_block& block );
void notify_on_pending_transaction( const signed_transaction& tx );
void notify_changed_objects();

private:
Expand Down
16 changes: 16 additions & 0 deletions libraries/chain/include/graphene/chain/exceptions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,21 @@
msg \
)

#define GRAPHENE_TRY_NOTIFY( signal, ... ) \
try \
{ \
signal( __VA_ARGS__ ); \
} \
catch( const graphene::chain::plugin_exception& e ) \
{ \
elog( "Caught plugin exception: ${e}", ("e", e.to_detail_string() ) ); \
throw; \
} \
catch( ... ) \
{ \
wlog( "Caught unexpected exception in plugin" ); \
}

namespace graphene { namespace chain {

FC_DECLARE_EXCEPTION( chain_exception, 3000000, "blockchain exception" )
Expand All @@ -77,6 +92,7 @@ namespace graphene { namespace chain {
FC_DECLARE_DERIVED_EXCEPTION( undo_database_exception, graphene::chain::chain_exception, 3070000, "undo database exception" )
FC_DECLARE_DERIVED_EXCEPTION( unlinkable_block_exception, graphene::chain::chain_exception, 3080000, "unlinkable block" )
FC_DECLARE_DERIVED_EXCEPTION( black_swan_exception, graphene::chain::chain_exception, 3090000, "black swan" )
FC_DECLARE_DERIVED_EXCEPTION( plugin_exception, graphene::chain::chain_exception, 3100000, "plugin exception" )

FC_DECLARE_DERIVED_EXCEPTION( tx_missing_active_auth, graphene::chain::transaction_exception, 3030001, "missing required active authority" )
FC_DECLARE_DERIVED_EXCEPTION( tx_missing_owner_auth, graphene::chain::transaction_exception, 3030002, "missing required owner authority" )
Expand Down
2 changes: 0 additions & 2 deletions libraries/chain/include/graphene/chain/protocol/types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -259,8 +259,6 @@ namespace graphene { namespace chain {
friend bool operator == ( const public_key_type& p1, const fc::ecc::public_key& p2);
friend bool operator == ( const public_key_type& p1, const public_key_type& p2);
friend bool operator != ( const public_key_type& p1, const public_key_type& p2);
// TODO: This is temporary for testing
bool is_valid_v1( const std::string& base58str );
};

struct extended_public_key_type
Expand Down
43 changes: 0 additions & 43 deletions libraries/chain/index.cpp

This file was deleted.

9 changes: 1 addition & 8 deletions libraries/chain/market_evaluator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,13 +147,6 @@ void_result call_order_update_evaluator::do_evaluate(const call_order_update_ope
else if( _bitasset_data->current_feed.settlement_price.is_null() )
FC_THROW_EXCEPTION(insufficient_feeds, "Cannot borrow asset with no price feed.");

if( o.delta_debt.amount < 0 )
{
FC_ASSERT( d.get_balance(*_paying_account, *_debt_asset) >= o.delta_debt,
"Cannot cover by ${c} when payer only has ${b}",
("c", o.delta_debt.amount)("b", d.get_balance(*_paying_account, *_debt_asset).amount) );
}

if( o.delta_collateral.amount > 0 )
{
FC_ASSERT( d.get_balance(*_paying_account, _bitasset_data->options.short_backing_asset(d)) >= o.delta_collateral,
Expand All @@ -176,7 +169,7 @@ void_result call_order_update_evaluator::do_apply(const call_order_update_operat
// Deduct the debt paid from the total supply of the debt asset.
d.modify(_debt_asset->dynamic_asset_data_id(d), [&](asset_dynamic_data_object& dynamic_asset) {
dynamic_asset.current_supply += o.delta_debt.amount;
assert(dynamic_asset.current_supply >= 0);
FC_ASSERT(dynamic_asset.current_supply >= 0);
});
}

Expand Down
25 changes: 0 additions & 25 deletions libraries/chain/protocol/types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,6 @@ namespace graphene { namespace chain {
// TODO: Refactor syntactic checks into static is_valid()
// to make public_key_type API more similar to address API
std::string prefix( GRAPHENE_ADDRESS_PREFIX );

// TODO: This is temporary for testing
try
{
if( is_valid_v1( base58str ) )
prefix = std::string( "BTS" );
}
catch( ... )
{
}

const size_t prefix_len = prefix.size();
FC_ASSERT( base58str.size() > prefix_len );
FC_ASSERT( base58str.substr( 0, prefix_len ) == prefix , "", ("base58str", base58str) );
Expand All @@ -64,20 +53,6 @@ namespace graphene { namespace chain {
FC_ASSERT( fc::ripemd160::hash( key_data.data, key_data.size() )._hash[0] == bin_key.check );
};

// TODO: This is temporary for testing
bool public_key_type::is_valid_v1( const std::string& base58str )
{
std::string prefix( "BTS" );
const size_t prefix_len = prefix.size();
FC_ASSERT( base58str.size() > prefix_len );
FC_ASSERT( base58str.substr( 0, prefix_len ) == prefix , "", ("base58str", base58str) );
auto bin = fc::from_base58( base58str.substr( prefix_len ) );
auto bin_key = fc::raw::unpack<binary_key>(bin);
fc::ecc::public_key_data key_data = bin_key.data;
FC_ASSERT( fc::ripemd160::hash( key_data.data, key_data.size() )._hash[0] == bin_key.check );
return true;
}

public_key_type::operator fc::ecc::public_key_data() const
{
return key_data;
Expand Down
2 changes: 1 addition & 1 deletion libraries/plugins/elasticsearch/elasticsearch_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ void elasticsearch_plugin_impl::sendBulk(std::string _elasticsearch_node_url, bo
//wlog((bulking));

struct curl_slist *headers = NULL;
curl_slist_append(headers, "Content-Type: application/json");
headers = curl_slist_append(headers, "Content-Type: application/json");
std::string url = _elasticsearch_node_url + "_bulk";
curl_easy_setopt(curl, CURLOPT_URL, url.c_str());
curl_easy_setopt(curl, CURLOPT_POST, true);
Expand Down
10 changes: 8 additions & 2 deletions libraries/wallet/include/graphene/wallet/wallet.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,13 @@ class wallet_api
* @ingroup Transaction Builder API
*/
signed_transaction sign_builder_transaction(transaction_handle_type transaction_handle, bool broadcast = true);

/** Broadcast signed transaction
* @param tx signed transaction
* @returns the transaction ID along with the signed transaction.
*/
pair<transaction_id_type,signed_transaction> broadcast_transaction(signed_transaction tx);

/**
* @ingroup Transaction Builder API
*/
Expand Down Expand Up @@ -660,8 +667,6 @@ class wallet_api
bool is_public_key_registered(string public_key) const;

/** Converts a signed_transaction in JSON form to its binary representation.
*
* TODO: I don't see a broadcast_transaction() function, do we need one?
*
* @param tx the transaction to serialize
* @returns the binary form of the transaction. It will not be hex encoded,
Expand Down Expand Up @@ -1628,6 +1633,7 @@ FC_API( graphene::wallet::wallet_api,
(set_fees_on_builder_transaction)
(preview_builder_transaction)
(sign_builder_transaction)
(broadcast_transaction)
(propose_builder_transaction)
(propose_builder_transaction2)
(remove_builder_transaction)
Expand Down
Loading