Merge branch 'master' into beatrice
This commit is contained in:
commit
4eaef1c171
6 changed files with 33 additions and 7 deletions
|
|
@ -42,8 +42,7 @@ void_result asset_create_evaluator::do_evaluate( const asset_create_operation& o
|
|||
|
||||
database& d = db();
|
||||
|
||||
if (d.head_block_time() < HARDFORK_SON_TIME)
|
||||
FC_ASSERT(op.symbol != "BTC", "BTC asset creation before SON hardfork");
|
||||
FC_ASSERT(d.is_asset_creation_allowed(op.symbol), "Asset creation not allowed at current time");
|
||||
|
||||
const auto& chain_parameters = d.get_global_properties().parameters;
|
||||
FC_ASSERT( op.common_options.whitelist_authorities.size() <= chain_parameters.maximum_asset_whitelist_authorities );
|
||||
|
|
@ -191,6 +190,8 @@ void_result lottery_asset_create_evaluator::do_evaluate( const lottery_asset_cre
|
|||
|
||||
database& d = db();
|
||||
|
||||
FC_ASSERT(d.is_asset_creation_allowed(op.symbol), "Lottery asset creation not allowed at current time");
|
||||
|
||||
const auto& chain_parameters = d.get_global_properties().parameters;
|
||||
FC_ASSERT( op.common_options.whitelist_authorities.size() <= chain_parameters.maximum_asset_whitelist_authorities );
|
||||
FC_ASSERT( op.common_options.blacklist_authorities.size() <= chain_parameters.maximum_asset_whitelist_authorities );
|
||||
|
|
|
|||
|
|
@ -347,4 +347,25 @@ vector<uint64_t> database::get_random_numbers(uint64_t minimum, uint64_t maximum
|
|||
return v;
|
||||
}
|
||||
|
||||
bool database::is_asset_creation_allowed(const string &symbol)
|
||||
{
|
||||
time_point_sec now = head_block_time();
|
||||
std::unordered_set<std::string> post_son_hf_symbols = {"ETH", "USDT", "BNB", "ADA", "DOGE", "XRP", "USDC", "DOT", "UNI", "BUSD", "BCH", "LTC", "SOL", "LINK", "MATIC", "THETA",
|
||||
"WBTC", "XLM", "ICP", "DAI", "VET", "ETC", "TRX", "FIL", "XMR", "EGR", "EOS", "SHIB", "AAVE", "CRO", "ALGO", "AMP", "BTCB",
|
||||
"BSV", "KLAY", "CAKE", "FTT", "LEO", "XTZ", "TFUEL", "MIOTA", "LUNA", "NEO", "ATOM", "MKR", "FEI", "WBNB", "UST", "AVAX",
|
||||
"STEEM", "HIVE", "HBD", "SBD", "BTS"};
|
||||
if (symbol == "BTC")
|
||||
{
|
||||
if (now < HARDFORK_SON_TIME)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (post_son_hf_symbols.find(symbol) != post_son_hf_symbols.end())
|
||||
{
|
||||
if (now >= HARDFORK_SON_TIME)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
} }
|
||||
|
|
|
|||
|
|
@ -1955,7 +1955,7 @@ void database::perform_son_tasks()
|
|||
}
|
||||
}
|
||||
|
||||
void update_son_asset(database& db)
|
||||
void update_son_params(database& db)
|
||||
{
|
||||
if( db.head_block_time() >= HARDFORK_SON2_TIME )
|
||||
{
|
||||
|
|
@ -1967,6 +1967,9 @@ void update_son_asset(database& db)
|
|||
asset_issuer_permission_flags::override_authority;
|
||||
});
|
||||
}
|
||||
db.modify( gpo, []( global_property_object& gpo ) {
|
||||
gpo.parameters.extensions.value.maximum_son_count = 7;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1981,7 +1984,7 @@ void database::perform_chain_maintenance(const signed_block& next_block, const g
|
|||
|
||||
rolling_period_start(*this);
|
||||
|
||||
update_son_asset(*this);
|
||||
update_son_params(*this);
|
||||
|
||||
struct vote_tally_helper {
|
||||
database& d;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// SON2 HARDFORK Friday, June 11, 2021 00:00:00 GMT
|
||||
// SON2 HARDFORK Saturday, July 31, 2021 00:00:00 GMT
|
||||
#ifndef HARDFORK_SON2_TIME
|
||||
#define HARDFORK_SON2_TIME (fc::time_point_sec( 1623369600 ))
|
||||
#define HARDFORK_SON2_TIME (fc::time_point_sec( 1627689600 ))
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -312,6 +312,7 @@ namespace graphene { namespace chain {
|
|||
signed_transaction create_signed_transaction( const fc::ecc::private_key& signing_private_key, const operation& op );
|
||||
bool is_son_dereg_valid( son_id_type son_id );
|
||||
bool is_son_active( son_id_type son_id );
|
||||
bool is_asset_creation_allowed(const string& symbol);
|
||||
|
||||
time_point_sec head_block_time()const;
|
||||
uint32_t head_block_num()const;
|
||||
|
|
|
|||
|
|
@ -345,7 +345,7 @@ BOOST_FIXTURE_TEST_CASE( select_top_fifteen_sons, cli_fixture )
|
|||
BOOST_TEST_MESSAGE("gpo: " << gpo.active_sons.size());
|
||||
BOOST_CHECK(generate_maintenance_block());
|
||||
|
||||
BOOST_CHECK(gpo.active_sons.size() == 15);
|
||||
BOOST_CHECK(gpo.active_sons.size() == gpo.parameters.maximum_son_count());
|
||||
|
||||
} catch( fc::exception& e ) {
|
||||
BOOST_TEST_MESSAGE("SON cli wallet tests exception");
|
||||
|
|
|
|||
Loading…
Reference in a new issue