Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
135dad4
fix codes in order to support openssl 1.1
ElleryHao Jun 30, 2020
de2be1a
fix bugs for compiling
ElleryHao Jun 30, 2020
07afd3e
fix codes in order to pass the compile
ElleryHao Jun 30, 2020
91fdcb7
fix bugs
ElleryHao Jun 30, 2020
e603aae
fix bugs
ElleryHao Jun 30, 2020
a8a0b38
fix bugs in order to compile in ubuntu18.04
ElleryHao Jun 30, 2020
9c018cc
fix make cxx flags in order to compile on ubuntu 18.04
ElleryHao Jun 30, 2020
09b8041
add for seed node
Null-nil Jul 9, 2020
9fe830d
add seed node
Null-nil Jul 14, 2020
dfce88a
modify version
ElleryHao Jul 14, 2020
3ef4d11
fix bug
Null-nil Jul 15, 2020
73b9799
change smart_ref to shared_ptr
luckypickle Jul 15, 2020
694fd69
Merge branch 'master' of https://github.com/HyperExchange-project/Hyp…
luckypickle Jul 15, 2020
638dd59
remove smart_ref
luckypickle Jul 15, 2020
41c9740
remove \*
luckypickle Jul 16, 2020
5f5b3bb
fix mac build error
luckypickle Jul 20, 2020
8f5f19d
fix make build release bug
luckypickle Jul 20, 2020
5be69f0
fix mac build error
luckypickle Jul 20, 2020
ff8cfb2
fix mac release o3 bugs
luckypickle Jul 20, 2020
680b943
fix push_block undo bugs
luckypickle Jul 21, 2020
cf09e37
fix database serilize bugs which casuse always replay data
luckypickle Jul 23, 2020
0d7ad4f
prepare to release 1.3.3
luckypickle Jul 23, 2020
5583647
change check point
luckypickle Jul 31, 2020
844c198
add seednode
Null-nil Jul 31, 2020
a3dd89f
Merge branch 'master' of https://github.com/hyperexchange-project/Hyp…
Null-nil Jul 31, 2020
cb74e31
change version
Null-nil Aug 4, 2020
3f099c5
cointinue to sync when interrupt
ElleryHao Aug 6, 2020
3d35532
fix code for continue sync
ElleryHao Aug 6, 2020
f9b3fa1
add backup plugins
ElleryHao Aug 7, 2020
fd7aed8
fix bugs
ElleryHao Aug 11, 2020
389d17f
fix bugs
ElleryHao Aug 11, 2020
6512580
fix bugs
ElleryHao Aug 13, 2020
b57d4c6
fix bugs when exit exceptionally, to remove the file
ElleryHao Aug 17, 2020
40099af
fix bugs: need to backup when sync
ElleryHao Aug 18, 2020
653fa29
fix trx missing
Null-nil Aug 24, 2020
dd46633
add new features
ElleryHao Sep 18, 2020
8be9d08
add new wallet impl
Null-nil Sep 25, 2020
443b4b4
change for wallet new impl
Null-nil Sep 27, 2020
b3e2b8f
need to rollbackup some features
ElleryHao Oct 27, 2020
53be580
change midware
Null-nil Oct 26, 2021
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
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ else( WIN32 ) # Apple AND Linux
else( APPLE )
# Linux Specific Options Here
message( STATUS "Configuring BlockLinks on Linux" )
set( CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -std=c++11 -Wall" )
set( CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -std=c++11 -Wall -pthread" )
set( rt_library rt )
set( pthread_library pthread)
if ( NOT DEFINED crypto_library )
Expand Down Expand Up @@ -200,7 +200,7 @@ endif()

add_subdirectory( libraries )
add_subdirectory( programs )
add_subdirectory( tests )
#add_subdirectory( tests )


if (ENABLE_INSTALLER)
Expand Down
18 changes: 4 additions & 14 deletions libraries/app/api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
#include <graphene/chain/worker_object.hpp>
#include <iostream>
#include <fc/crypto/hex.hpp>
#include <fc/smart_ref_impl.hpp>

#include <fc/thread/future.hpp>
#include <graphene/crosschain/crosschain.hpp>
#include <graphene/chain/contract_object.hpp>
Expand Down Expand Up @@ -350,7 +350,9 @@ namespace graphene { namespace app {
{
return _app.p2p_node()->get_potential_peers();
}

void network_node_api::update_seed_node() {
_app.add_seed_node();
}
fc::variant_object network_node_api::get_advanced_node_parameters() const
{
return _app.p2p_node()->get_advanced_node_parameters();
Expand Down Expand Up @@ -705,19 +707,7 @@ namespace graphene { namespace app {

crypto_api::crypto_api(){};

blind_signature crypto_api::blind_sign( const extended_private_key_type& key, const blinded_hash& hash, int i )
{
return fc::ecc::extended_private_key( key ).blind_sign( hash, i );
}

signature_type crypto_api::unblind_signature( const extended_private_key_type& key,
const extended_public_key_type& bob,
const blind_signature& sig,
const fc::sha256& hash,
int i )
{
return fc::ecc::extended_private_key( key ).unblind_signature( extended_public_key( bob ), sig, hash, i );
}

commitment_type crypto_api::blind( const blind_factor_type& blind, uint64_t value )
{
Expand Down
59 changes: 53 additions & 6 deletions libraries/app/application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
#include <graphene/utilities/key_conversion.hpp>
#include <graphene/chain/worker_evaluator.hpp>

#include <fc/smart_ref_impl.hpp>


#include <fc/io/fstream.hpp>
#include <fc/rpc/api_connection.hpp>
Expand Down Expand Up @@ -84,7 +84,7 @@ namespace detail {
auto hyper_exchange_key = fc::ecc::private_key::regenerate(fc::sha256::hash(string("hyper-exchange")));
dlog("Allocating all stake to ${key}", ("key", utilities::key_to_wif(hyper_exchange_key)));
genesis_state_type initial_state;
initial_state.initial_parameters.current_fees = fee_schedule::get_default();//->set_all_fees(GRAPHENE_BLOCKCHAIN_PRECISION);
initial_state.initial_parameters.get_mutable_fees() = fee_schedule::get_default();//->set_all_fees(GRAPHENE_BLOCKCHAIN_PRECISION);
initial_state.initial_active_miners = GRAPHENE_DEFAULT_MIN_MINER_COUNT;
initial_state.initial_timestamp = time_point_sec(time_point::now().sec_since_epoch() /
initial_state.initial_parameters.block_interval *
Expand Down Expand Up @@ -193,13 +193,16 @@ namespace detail {
{
// https://blocklinkstalk.org/index.php/topic,23715.0.html
vector<string> seeds = {

"117.78.44.37:9034",
"47.74.2.123:9034",
"47.74.23.176:9034",
"47.74.37.107:9034",
"52.194.253.245:9034",
"36.152.8.188:9034",
"172.81.250.51:9034"
"172.81.250.51:9034",
"106.13.38.27:9034",
"119.45.188.146:9034"
/*
"104.236.144.84:1777", // puppies (USA)
"128.199.143.47:2015", // Harvey (Singapore)
Expand All @@ -220,6 +223,7 @@ namespace detail {
"seeds.blocklinks.eu:1776" // pc (http://seeds.quisquis.de/blocklinks.html)
*/
};

for( const string& endpoint_string : seeds )
{
try {
Expand Down Expand Up @@ -249,7 +253,48 @@ namespace detail {
std::vector<uint32_t>());

} FC_CAPTURE_AND_RETHROW() }
void add_seed_node() {
try {

fc::http::connection_sync conn;
crosschain_interface_btc temp;
bool bgetconnect = temp.connect_midware(conn, true);
if (bgetconnect)
{
std::ostringstream req_body;
req_body << "{ \"jsonrpc\": \"2.0\", \
\"id\" : \"45\", \
\"method\" : \"Zchain.Query.GetSeedNode\" ,\
\"params\" : {}}";
//_rpc_url = _rpc_url + _config["ip"].as_string() + ":" + std::string(_config["port"].as_string()) + "/api";
fc::http::headers _rpc_headers;
auto reply = conn.request("POST", "http://0.0.0.0:9999/api", req_body.str(), _rpc_headers);
//auto reply = conn.request("POST", string(eip), bodddy);
if (reply.status == fc::http::reply::OK)
{
auto resp = fc::json::from_string(std::string(reply.body.begin(), reply.body.end())).get_object();
//std::cout << std::string(reply.body.begin(), reply.body.end()) << std::endl;
if (resp.contains("result")) {
auto ret = resp["result"].get_array();
for (size_t i = 0; i < ret.size(); ++i)
{
std::vector<fc::ip::endpoint> endpoints = resolve_string_to_ip_endpoints(ret[i].as_string());
for (const fc::ip::endpoint& endpoint : endpoints)
{
_p2p_network->add_node(endpoint);
}
}
}
}
}

}
catch (const fc::exception& e) {
wlog("cant get seednode ${e} while adding seed node",
("e", e.to_detail_string()));
}

}
std::vector<fc::ip::endpoint> resolve_string_to_ip_endpoints(const std::string& endpoint_string)
{
try
Expand Down Expand Up @@ -410,7 +455,7 @@ namespace detail {
}
else
{
vector<fc::ip::endpoint> midware_sers = { fc::ip::endpoint::from_string("47.74.2.123:5005"),fc::ip::endpoint::from_string("47.74.23.176:5005") };
vector<fc::ip::endpoint> midware_sers = { fc::ip::endpoint::from_string("112.5.37.186:5005") };
abstract_crosschain_interface::set_midwares_backup(midware_sers);
}
if (chain_type_vector.size() < 8)
Expand Down Expand Up @@ -446,7 +491,7 @@ namespace detail {
abstract_crosschain_interface::set_midwares(abstract_crosschain_interface::midware_eps_backup);
else
{
vector<fc::ip::endpoint> midware_sers = { fc::ip::endpoint::from_string("47.74.2.123:5005"),fc::ip::endpoint::from_string("47.74.23.176:5005") };
vector<fc::ip::endpoint> midware_sers = { fc::ip::endpoint::from_string("112.5.37.186:5005") };
abstract_crosschain_interface::set_midwares(midware_sers);
}
}
Expand Down Expand Up @@ -1271,7 +1316,9 @@ void application::startup()
throw;
}
}

void application::add_seed_node() {
my->add_seed_node();
}
std::shared_ptr<abstract_plugin> application::get_plugin(const string& name) const
{
return my->_plugins[name];
Expand Down
18 changes: 9 additions & 9 deletions libraries/app/database_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#include <graphene/chain/get_config.hpp>

#include <fc/bloom_filter.hpp>
#include <fc/smart_ref_impl.hpp>


#include <fc/crypto/hex.hpp>

Expand Down Expand Up @@ -2949,9 +2949,9 @@ std::pair<asset, share_type> database_api::register_contract_testing(const strin

signed_transaction tx;
tx.operations.push_back(contract_register_op);
auto current_fees = get_global_properties().parameters.current_fees;
const auto current_fees = get_global_properties().parameters.get_current_fees();
for (auto& op : tx.operations)
current_fees->set_fee(op);
current_fees.set_fee(op);
signed_transaction signed_tx(tx);
auto dyn_props = get_dynamic_global_properties();
signed_tx.set_reference_block(dyn_props.head_block_id);
Expand Down Expand Up @@ -2998,9 +2998,9 @@ std::pair<asset, share_type> database_api::transfer_to_contract_testing(string p

signed_transaction tx;
tx.operations.push_back(transfer_to_contract_op);
auto current_fees = get_global_properties().parameters.current_fees;
const auto current_fees = get_global_properties().parameters.get_current_fees();
for (auto& op : tx.operations)
current_fees->set_fee(op);
current_fees.set_fee(op);


auto dyn_props = get_dynamic_global_properties();
Expand Down Expand Up @@ -3065,9 +3065,9 @@ execution_result database_api::invoke_contract_testing(const string & pubkey, co

signed_transaction tx;
tx.operations.push_back(contract_invoke_op);
auto current_fees = get_global_properties().parameters.current_fees;
auto current_fees = get_global_properties().parameters.get_current_fees();
for (auto& op : tx.operations)
current_fees->set_fee(op);
current_fees.set_fee(op);

auto dyn_props = get_dynamic_global_properties();
tx.set_reference_block(dyn_props.head_block_id);
Expand Down Expand Up @@ -3157,9 +3157,9 @@ string database_api::invoke_contract_offline(const string & caller_pubkey_str, c
//contract_invoke_op.guarantee_id = get_guarantee_id();
signed_transaction tx;
tx.operations.push_back(contract_invoke_op);
auto current_fees = get_global_properties().parameters.current_fees;
auto current_fees = get_global_properties().parameters.get_current_fees();
for (auto& op : tx.operations)
current_fees->set_fee(op);
current_fees.set_fee(op);

auto dyn_props = get_dynamic_global_properties();
tx.set_reference_block(dyn_props.head_block_id);
Expand Down
2 changes: 1 addition & 1 deletion libraries/app/impacted.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ struct get_impacted_account_visitor
add_authority_accounts( _impacted, op.owner );
add_authority_accounts( _impacted, op.active );
}

void operator() (const withdraw_limit_modify_operation& op) {}
void operator()( const account_update_operation& op )
{
_impacted.insert( op.account );
Expand Down
21 changes: 10 additions & 11 deletions libraries/app/include/graphene/app/api.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ namespace graphene { namespace app {
* @brief Return list of potential peers
*/
std::vector<net::potential_peer_record> get_potential_peers() const;

void update_seed_node();
private:
application& _app;
};
Expand All @@ -289,14 +289,14 @@ namespace graphene { namespace app {
{
public:
crypto_api();

fc::ecc::blind_signature blind_sign( const extended_private_key_type& key, const fc::ecc::blinded_hash& hash, int i );

signature_type unblind_signature( const extended_private_key_type& key,
const extended_public_key_type& bob,
const fc::ecc::blind_signature& sig,
const fc::sha256& hash,
int i );
/**
* @brief Generates a pedersen commitment: *commit = blind * G + value * G2.
* The commitment is 33 bytes, the blinding factor is 32 bytes.
* For more information about pederson commitment check url https://en.wikipedia.org/wiki/Commitment_scheme
* @param blind Sha-256 blind factor type
* @param value Positive 64-bit integer value
* @return A 33-byte pedersen commitment: *commit = blind * G + value * G2
*/

fc::ecc::commitment_type blind( const fc::ecc::blind_factor_type& blind, uint64_t value );

Expand Down Expand Up @@ -488,10 +488,9 @@ FC_API(graphene::app::network_node_api,
(get_potential_peers)
(get_advanced_node_parameters)
(set_advanced_node_parameters)
(update_seed_node)
)
FC_API(graphene::app::crypto_api,
(blind_sign)
(unblind_signature)
(blind)
(blind_sum)
(verify_sum)
Expand Down
1 change: 1 addition & 0 deletions libraries/app/include/graphene/app/application.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ namespace graphene { namespace app {
void shutdown_plugins();
void stop_block_processing();
void start_block_processing();
void add_seed_node();
template<typename PluginType>
std::shared_ptr<PluginType> register_plugin()
{
Expand Down
1 change: 1 addition & 0 deletions libraries/chain/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ add_library( graphene_chain
protocol/fee_schedule.cpp
protocol/confidential.cpp
protocol/vote.cpp
protocol/chain_parameters.cpp
eth_seri_record_evaluate.cpp
eth_seri_record.cpp
genesis_state.cpp
Expand Down
4 changes: 2 additions & 2 deletions libraries/chain/account_evaluator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* THE SOFTWARE.
*/

#include <fc/smart_ref_impl.hpp>


#include <graphene/chain/account_evaluator.hpp>
#include <graphene/chain/buyback.hpp>
Expand Down Expand Up @@ -169,7 +169,7 @@ object_id_type account_create_evaluator::do_apply( const account_create_operatio
if( dynamic_properties.accounts_registered_this_interval %
global_properties.parameters.accounts_per_fee_scale == 0 )
db().modify(global_properties, [&dynamic_properties](global_property_object& p) {
p.parameters.current_fees->get<account_create_operation>().basic_fee <<= p.parameters.account_fee_scale_bitshifts;
p.parameters.get_mutable_fees().get<account_create_operation>().basic_fee <<= p.parameters.account_fee_scale_bitshifts;
});

if( o.extensions.value.owner_special_authority.valid()
Expand Down
24 changes: 24 additions & 0 deletions libraries/chain/asset_evaluator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -764,6 +764,30 @@ void_result asset_fee_modification_evaluator::do_apply(const asset_fee_modificat
});
}FC_CAPTURE_AND_RETHROW((o))
}
void_result withdraw_limit_modify_evaluator::do_evaluate(const withdraw_limit_modify_operation& o)
{
try {
const auto & _db = db();
const auto& asset_indx = _db.get_index_type<asset_index>().indices().get<by_symbol>();
const auto iter = asset_indx.find(o.asset_symbol);
FC_ASSERT(iter != asset_indx.end());
const auto& dymic_asset_info = iter->dynamic_data(_db);
FC_ASSERT(dymic_asset_info.withdraw_limition != o.withdraw_limit);
}FC_CAPTURE_AND_RETHROW((o))
}
void_result withdraw_limit_modify_evaluator::do_apply(const withdraw_limit_modify_operation& o)
{
try {
auto& d = db();
const auto& asset_indx = d.get_index_type<asset_index>().indices().get<by_symbol>();
const auto iter = asset_indx.find(o.asset_symbol);
auto& dymic_asset_info = iter->dynamic_data(d);
d.modify(dymic_asset_info, [&](asset_dynamic_data_object& obj) {
obj.withdraw_limition = o.withdraw_limit;
});

}FC_CAPTURE_AND_RETHROW((o))
}

void_result guard_lock_balance_set_evaluator::do_evaluate(const set_guard_lockbalance_operation& o)
{
Expand Down
Loading