diff --git a/.gitignore b/.gitignore index 32c2856e360ba20de5fdde0611436d5ca84e61a9..315a8bb2feb2d1aa0d5b5838a111630b4b7ae75e 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,7 @@ *.dot *.abi.hpp *.cmake +*.ninja \#* \.#* CMakeCache.txt @@ -29,6 +30,9 @@ libraries/egenesis/egenesis_full.cpp libraries/egenesis/embed_genesis libraries/types/type_generator libraries/types/types_test +libraries/fc/test/crypto/test_cypher_suites +libraries/testing/chain_tester + libraries/wallet/Doxyfile libraries/wallet/api_documentation.cpp @@ -39,26 +43,24 @@ libraries/wasm-jit/Source/Programs/Disassemble libraries/wasm-jit/Source/Programs/Test libraries/wasm-jit/Source/Programs/wavm -programs/cli_wallet/cli_wallet programs/cleos/cleos programs/js_operation_serializer/js_operation_serializer -programs/witness_node/witness_node programs/data-dir -programs/eos-walletd/eos-walletd -programs/eosiod/eosiod -programs/eosioc/eosioc -programs/launcher/launcher programs/eosio-abigen/eosio-abigen +programs/cleos/config.hpp +programs/eosio-applesedemo/eosio-applesedemo +programs/eosio-launcher/config.hpp +programs/eosio-launcher/eosio-launcher +programs/keosd/keosd +programs/nodeos/config.hpp +programs/nodeos/nodeos scripts/tn_init.sh -tests/app_test -tests/chain_bench -tests/chain_test -tests/intense_test -tests/performance_test +tests/plugin_test tests/config.hpp unittests/config.hpp +unittests/unit_test doxygen @@ -67,10 +69,6 @@ witness_node_data_dir *.wallet -programs/witness_node/object_database/* - -object_database/* - *.pyc *.pyo diff --git a/libraries/chain/include/eosio/chain/symbol.hpp b/libraries/chain/include/eosio/chain/symbol.hpp index 4dfbf378ac7052b1a0a20cc30b51e8299fb50c75..b6c47c90ed2300b39a6170df0685b6a72a60b00a 100644 --- a/libraries/chain/include/eosio/chain/symbol.hpp +++ b/libraries/chain/include/eosio/chain/symbol.hpp @@ -63,10 +63,10 @@ namespace eosio { static constexpr uint8_t max_precision = 18; explicit symbol(uint8_t p, const char* s): m_value(string_to_symbol(p, s)) { - FC_ASSERT(valid(), "invalid symbol", ("s",s)); + FC_ASSERT(valid(), "invalid symbol: ${s}", ("s",s)); } explicit symbol(uint64_t v = SY(4, EOS)): m_value(v) { - FC_ASSERT(valid(), "invalid symbol", ("name",name())); + FC_ASSERT(valid(), "invalid symbol: ${name}", ("name",name())); } static symbol from_string(const string& from) { diff --git a/programs/cleos/main.cpp b/programs/cleos/main.cpp index cc39d53925af87676dba2544835ea14fef644892..2f9afc85f9b0263a0277be52b1054b19cf53553e 100644 --- a/programs/cleos/main.cpp +++ b/programs/cleos/main.cpp @@ -401,6 +401,24 @@ chain::action create_action(const vector& authorization, const return chain::action{authorization, code, act, result.get_object()["binargs"].as()}; } +chain::action create_buyram(const name& creator, const name& newaccount, const asset& quantity) { + fc::variant act_payload = fc::mutable_variant_object() + ("payer", creator.to_string()) + ("receiver", newaccount.to_string()) + ("quant", quantity.to_string()); + return create_action(tx_permission.empty() ? vector{{creator,config::active_name}} : get_account_permissions(tx_permission), + config::system_account_name, N(buyram), act_payload); +} + +chain::action create_buyrambytes(const name& creator, const name& newaccount, uint32_t numbytes) { + fc::variant act_payload = fc::mutable_variant_object() + ("payer", creator.to_string()) + ("receiver", newaccount.to_string()) + ("bytes", numbytes); + return create_action(tx_permission.empty() ? vector{{creator,config::active_name}} : get_account_permissions(tx_permission), + config::system_account_name, N(buyrambytes), act_payload); +} + fc::variant regproducer_variant(const account_name& producer, public_key_type key, string url) { @@ -923,12 +941,18 @@ int main( int argc, char** argv ) { string account_name; string owner_key_str; string active_key_str; + uint32_t buy_ram_bytes_in_kbytes = 8; + string buy_ram_eos; auto createAccount = create->add_subcommand("account", localized("Create a new account on the blockchain"), false); createAccount->add_option("creator", creator, localized("The name of the account creating the new account"))->required(); createAccount->add_option("name", account_name, localized("The name of the new account"))->required(); createAccount->add_option("OwnerKey", owner_key_str, localized("The owner public key for the new account"))->required(); createAccount->add_option("ActiveKey", active_key_str, localized("The active public key for the new account"))->required(); + createAccount->add_option("--buy-ram-bytes", buy_ram_bytes_in_kbytes, + (localized("The amount of RAM bytes to purchase for the new account in kilobytes KiB, default is 8 KiB"))); + createAccount->add_option("--buy-ram-EOS", buy_ram_eos, + (localized("The amount of RAM bytes to purchase for the new account in EOS"))); add_standard_transaction_options(createAccount, "creator@active"); createAccount->set_callback([&] { public_key_type owner_key, active_key; @@ -938,7 +962,15 @@ int main( int argc, char** argv ) { try { active_key = public_key_type(active_key_str); } EOS_RETHROW_EXCEPTIONS(public_key_type_exception, "Invalid active public key: ${public_key}", ("public_key", active_key_str)) - send_actions({create_newaccount(creator, account_name, owner_key, active_key)}); + if( !buy_ram_eos.empty() ) { + action buyact = create_buyram(creator, account_name, asset::from_string(buy_ram_eos)); + send_actions({create_newaccount(creator, account_name, owner_key, active_key), buyact}); + } else if( buy_ram_bytes_in_kbytes > 0 ){ + action buyact = create_buyrambytes(creator, account_name, buy_ram_bytes_in_kbytes * 1024 * 1024); + send_actions({create_newaccount(creator, account_name, owner_key, active_key), buyact}); + } else { + send_actions({create_newaccount(creator, account_name, owner_key, active_key)}); + } }); // Get subcommand diff --git a/tests/testUtils.py b/tests/testUtils.py index 9fcdf83fd43a3b50f4f095f4749f03fd41f4459b..1c7824da0949094ce7921daf2892127f53807553 100755 --- a/tests/testUtils.py +++ b/tests/testUtils.py @@ -488,7 +488,7 @@ class Node(object): # Create account and return creation transactions. Return transaction json object # waitForTransBlock: wait on creation transaction id to appear in a block def createAccount(self, account, creatorAccount, stakedDeposit=1000, waitForTransBlock=False): - cmd="%s %s create account -j %s %s %s %s" % ( + cmd="%s %s create account -j --buy-ram-bytes 0 %s %s %s %s" % ( Utils.EosClientPath, self.endpointArgs, creatorAccount.name, account.name, account.ownerPublicKey, account.activePublicKey) diff --git a/unittests/currency_tests.cpp b/unittests/currency_tests.cpp index 181bdfcc1b9d97af895d4f92d569cdad56676732..4f45b3f310ac7672cd02f5a42a6f07f1660b410d 100644 --- a/unittests/currency_tests.cpp +++ b/unittests/currency_tests.cpp @@ -43,6 +43,7 @@ class currency_tester : public TESTER { signed_transaction trx; trx.actions.emplace_back(std::move(act)); + set_transaction_headers(trx); trx.sign(get_private_key(signer, "active"), chain_id_type()); return push_transaction(trx); @@ -316,7 +317,7 @@ BOOST_FIXTURE_TEST_CASE(test_symbol, TESTER) try { // invalid - contains lower case characters, no validation { BOOST_CHECK_EXCEPTION(symbol malformed(SY(6,EoS)), - fc::assert_exception, fc_assert_exception_message_is("invalid symbol")); + fc::assert_exception, fc_assert_exception_message_is("invalid symbol: EoS")); } // invalid - contains lower case characters, exception thrown