Skip to content

Commit

Permalink
Adaptions for HF 385
Browse files Browse the repository at this point in the history
  • Loading branch information
pmconrad committed Jul 28, 2017
1 parent 74c650d commit d970eec
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 13 deletions.
7 changes: 0 additions & 7 deletions libraries/chain/protocol/account.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,6 @@ bool is_valid_name( const string& name )
{ try {
const size_t len = name.size();

/** this condition will prevent witnesses from including new names before this time, but
* allow them after this time. This check can be removed from the code after HARDFORK_385_TIME
* has passed.
*/
if( fc::time_point::now() < fc::time_point(HARDFORK_385_TIME) )
FC_ASSERT( len >= 3 );

if( len < GRAPHENE_MIN_ACCOUNT_NAME_LENGTH )
{
ilog( ".");
Expand Down
12 changes: 6 additions & 6 deletions tests/tests/basic_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,22 +51,22 @@ BOOST_FIXTURE_TEST_SUITE( basic_tests, database_fixture )
*/
BOOST_AUTO_TEST_CASE( valid_name_test )
{
BOOST_CHECK( !is_valid_name( "a" ) );
BOOST_CHECK( is_valid_name( "a" ) );
BOOST_CHECK( !is_valid_name( "A" ) );
BOOST_CHECK( !is_valid_name( "0" ) );
BOOST_CHECK( !is_valid_name( "." ) );
BOOST_CHECK( !is_valid_name( "-" ) );

BOOST_CHECK( !is_valid_name( "aa" ) );
BOOST_CHECK( is_valid_name( "aa" ) );
BOOST_CHECK( !is_valid_name( "aA" ) );
BOOST_CHECK( !is_valid_name( "a0" ) );
BOOST_CHECK( is_valid_name( "a0" ) );
BOOST_CHECK( !is_valid_name( "a." ) );
BOOST_CHECK( !is_valid_name( "a-" ) );

BOOST_CHECK( is_valid_name( "aaa" ) );
BOOST_CHECK( !is_valid_name( "aAa" ) );
BOOST_CHECK( is_valid_name( "a0a" ) );
BOOST_CHECK( !is_valid_name( "a.a" ) );
BOOST_CHECK( is_valid_name( "a.a" ) );
BOOST_CHECK( is_valid_name( "a-a" ) );

BOOST_CHECK( is_valid_name( "aa0" ) );
Expand Down Expand Up @@ -97,9 +97,9 @@ BOOST_AUTO_TEST_CASE( valid_name_test )
BOOST_CHECK( is_valid_name( "aaa.bbb.ccc" ) );

BOOST_CHECK( is_valid_name( "aaa--bbb--ccc" ) );
BOOST_CHECK( !is_valid_name( "xn--sandmnnchen-p8a.de" ) );
BOOST_CHECK( is_valid_name( "xn--sandmnnchen-p8a.de" ) );
BOOST_CHECK( is_valid_name( "xn--sandmnnchen-p8a.dex" ) );
BOOST_CHECK( !is_valid_name( "xn-sandmnnchen-p8a.de" ) );
BOOST_CHECK( is_valid_name( "xn-sandmnnchen-p8a.de" ) );
BOOST_CHECK( is_valid_name( "xn-sandmnnchen-p8a.dex" ) );

BOOST_CHECK( is_valid_name( "this-label-has-less-than-64-char.acters-63-to-be-really-precise" ) );
Expand Down
3 changes: 3 additions & 0 deletions tests/tests/uia_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,9 @@ BOOST_AUTO_TEST_CASE( asset_name_test )
GRAPHENE_REQUIRE_THROW( create_user_issued_asset( "ALPHA", alice_id(db), 0 ), fc::exception );
BOOST_CHECK( has_asset("ALPHA") ); BOOST_CHECK( !has_asset("ALPHA.ONE") );

generate_blocks( HARDFORK_385_TIME );
generate_block();

// Bob can't create ALPHA.ONE
GRAPHENE_REQUIRE_THROW( create_user_issued_asset( "ALPHA.ONE", bob_id(db), 0 ), fc::exception );
BOOST_CHECK( has_asset("ALPHA") ); BOOST_CHECK( !has_asset("ALPHA.ONE") );
Expand Down

0 comments on commit d970eec

Please sign in to comment.