diff --git a/programs/cleos/main.cpp b/programs/cleos/main.cpp index 56c3b67143e..f1ff21d3f02 100644 --- a/programs/cleos/main.cpp +++ b/programs/cleos/main.cpp @@ -114,7 +114,6 @@ Usage: ./cleos create account [OPTIONS] creator name OwnerKey ActiveKey #include #include #include -#include #include #include @@ -2133,55 +2132,42 @@ int main( int argc, char** argv ) { // set contract subcommand string account; string contractPath; - string wastPath; + string wasmPath; string abiPath; bool shouldSend = true; auto codeSubcommand = setSubcommand->add_subcommand("code", localized("Create or update the code on an account")); codeSubcommand->add_option("account", account, localized("The account to set code for"))->required(); - codeSubcommand->add_option("code-file", wastPath, localized("The fullpath containing the contract WAST or WASM"))->required(); + codeSubcommand->add_option("code-file", wasmPath, localized("The fullpath containing the contract WASM"))->required(); auto abiSubcommand = setSubcommand->add_subcommand("abi", localized("Create or update the abi on an account")); abiSubcommand->add_option("account", account, localized("The account to set the ABI for"))->required(); - abiSubcommand->add_option("abi-file", abiPath, localized("The fullpath containing the contract WAST or WASM"))->required(); + abiSubcommand->add_option("abi-file", abiPath, localized("The fullpath containing the contract ABI"))->required(); auto contractSubcommand = setSubcommand->add_subcommand("contract", localized("Create or update the contract on an account")); contractSubcommand->add_option("account", account, localized("The account to publish a contract for")) ->required(); - contractSubcommand->add_option("contract-dir", contractPath, localized("The path containing the .wast and .abi")) + contractSubcommand->add_option("contract-dir", contractPath, localized("The path containing the .wasm and .abi")) ->required(); - contractSubcommand->add_option("wast-file", wastPath, localized("The file containing the contract WAST or WASM relative to contract-dir")); + contractSubcommand->add_option("wasm-file", wasmPath, localized("The file containing the contract WASM relative to contract-dir")); // ->check(CLI::ExistingFile); auto abi = contractSubcommand->add_option("abi-file,-a,--abi", abiPath, localized("The ABI for the contract relative to contract-dir")); // ->check(CLI::ExistingFile); std::vector actions; auto set_code_callback = [&]() { - std::string wast; + std::string wasm; fc::path cpath(contractPath); if( cpath.filename().generic_string() == "." ) cpath = cpath.parent_path(); - if( wastPath.empty() ) { - wastPath = (cpath / (cpath.filename().generic_string()+".wasm")).generic_string(); - if (!fc::exists(wastPath)) - wastPath = (cpath / (cpath.filename().generic_string()+".wast")).generic_string(); - } else { - wastPath = (cpath / wastPath).generic_string(); - } + if( wasmPath.empty() ) + wasmPath = (cpath / (cpath.filename().generic_string()+".wasm")).generic_string(); + else + wasmPath = (cpath / wasmPath).generic_string(); - std::cerr << localized(("Reading WAST/WASM from " + wastPath + "...").c_str()) << std::endl; - fc::read_file_contents(wastPath, wast); - EOS_ASSERT( !wast.empty(), wast_file_not_found, "no wast file found ${f}", ("f", wastPath) ); - vector wasm; - const string binary_wasm_header("\x00\x61\x73\x6d", 4); - if(wast.compare(0, 4, binary_wasm_header) == 0) { - std::cerr << localized("Using already assembled WASM...") << std::endl; - wasm = vector(wast.begin(), wast.end()); - } - else { - std::cerr << localized("Assembling WASM...") << std::endl; - wasm = wast_to_wasm(wast); - } + std::cerr << localized(("Reading WASM from " + wasmPath + "...").c_str()) << std::endl; + fc::read_file_contents(wasmPath, wasm); + EOS_ASSERT( !wasm.empty(), wast_file_not_found, "no wasm file found ${f}", ("f", wasmPath) ); actions.emplace_back( create_setcode(account, bytes(wasm.begin(), wasm.end()) ) ); if ( shouldSend ) { diff --git a/testnet.template b/testnet.template index 12e49a799fc..7a7593cc83a 100644 --- a/testnet.template +++ b/testnet.template @@ -75,7 +75,7 @@ wcmd create -n ignition # ------ DO NOT ALTER THE NEXT LINE ------- ###INSERT prodkeys -ecmd set contract eosio contracts/eosio.bios eosio.bios.wast eosio.bios.abi +ecmd set contract eosio contracts/eosio.bios eosio.bios.wasm eosio.bios.abi # Create required system accounts ecmd create key diff --git a/tests/Cluster.py b/tests/Cluster.py index fde8dde4c0d..3df4ccff04d 100644 --- a/tests/Cluster.py +++ b/tests/Cluster.py @@ -726,10 +726,10 @@ def bootstrap(totalNodes, prodCount, biosHost, biosPort, dontKill=False, onlyBio contract="eosio.bios" contractDir="contracts/%s" % (contract) - wastFile="%s.wast" % (contract) + wasmFile="%s.wasm" % (contract) abiFile="%s.abi" % (contract) Utils.Print("Publish %s contract" % (contract)) - trans=biosNode.publishContract(eosioAccount.name, contractDir, wastFile, abiFile, waitForTransBlock=True) + trans=biosNode.publishContract(eosioAccount.name, contractDir, wasmFile, abiFile, waitForTransBlock=True) if trans is None: Utils.Print("ERROR: Failed to publish contract %s." % (contract)) return None @@ -850,10 +850,10 @@ def bootstrap(totalNodes, prodCount, biosHost, biosPort, dontKill=False, onlyBio contract="eosio.token" contractDir="contracts/%s" % (contract) - wastFile="%s.wast" % (contract) + wasmFile="%s.wasm" % (contract) abiFile="%s.abi" % (contract) Utils.Print("Publish %s contract" % (contract)) - trans=biosNode.publishContract(eosioTokenAccount.name, contractDir, wastFile, abiFile, waitForTransBlock=True) + trans=biosNode.publishContract(eosioTokenAccount.name, contractDir, wasmFile, abiFile, waitForTransBlock=True) if trans is None: Utils.Print("ERROR: Failed to publish contract %s." % (contract)) return None @@ -905,10 +905,10 @@ def bootstrap(totalNodes, prodCount, biosHost, biosPort, dontKill=False, onlyBio contract="eosio.system" contractDir="contracts/%s" % (contract) - wastFile="%s.wast" % (contract) + wasmFile="%s.wasm" % (contract) abiFile="%s.abi" % (contract) Utils.Print("Publish %s contract" % (contract)) - trans=biosNode.publishContract(eosioAccount.name, contractDir, wastFile, abiFile, waitForTransBlock=True) + trans=biosNode.publishContract(eosioAccount.name, contractDir, wasmFile, abiFile, waitForTransBlock=True) if trans is None: Utils.Print("ERROR: Failed to publish contract %s." % (contract)) return None diff --git a/tests/Node.py b/tests/Node.py index 89cbba5df60..3f50bfbce4f 100644 --- a/tests/Node.py +++ b/tests/Node.py @@ -757,9 +757,9 @@ def getAccountCodeHash(self, account): return None # publish contract and return transaction as json object - def publishContract(self, account, contractDir, wastFile, abiFile, waitForTransBlock=False, shouldFail=False): + def publishContract(self, account, contractDir, wasmFile, abiFile, waitForTransBlock=False, shouldFail=False): cmd="%s %s -v set contract -j %s %s" % (Utils.EosClientPath, self.endpointArgs, account, contractDir) - cmd += "" if wastFile is None else (" "+ wastFile) + cmd += "" if wasmFile is None else (" "+ wasmFile) cmd += "" if abiFile is None else (" " + abiFile) if Utils.Debug: Utils.Print("cmd: %s" % (cmd)) trans=None diff --git a/tests/consensus-validation-malicious-producers.py b/tests/consensus-validation-malicious-producers.py index 95357196e92..67d7722ed82 100755 --- a/tests/consensus-validation-malicious-producers.py +++ b/tests/consensus-validation-malicious-producers.py @@ -288,10 +288,10 @@ def myTest(transWillEnterBlock): error("Failed to create account %s" % (currencyAccount.name)) return False - wastFile="currency.wast" + wasmFile="currency.wasm" abiFile="currency.abi" Print("Publish contract") - trans=node.publishContract(currencyAccount.name, wastFile, abiFile, waitForTransBlock=True) + trans=node.publishContract(currencyAccount.name, wasmFile, abiFile, waitForTransBlock=True) if trans is None: error("Failed to publish contract.") return False diff --git a/tests/nodeos_run_test.py b/tests/nodeos_run_test.py index 40d5d8b5072..85be1bd940b 100755 --- a/tests/nodeos_run_test.py +++ b/tests/nodeos_run_test.py @@ -319,10 +319,10 @@ errorExit("FAILURE - get code currency1111 failed", raw=True) contractDir="contracts/eosio.token" - wastFile="eosio.token.wast" + wasmFile="eosio.token.wasm" abiFile="eosio.token.abi" Print("Publish contract") - trans=node.publishContract(currencyAccount.name, contractDir, wastFile, abiFile, waitForTransBlock=True) + trans=node.publishContract(currencyAccount.name, contractDir, wasmFile, abiFile, waitForTransBlock=True) if trans is None: cmdError("%s set contract currency1111" % (ClientName)) errorExit("Failed to publish contract.") @@ -605,20 +605,20 @@ Print("upload exchange contract") contractDir="contracts/exchange" - wastFile="exchange.wast" + wasmFile="exchange.wasm" abiFile="exchange.abi" Print("Publish exchange contract") - trans=node.publishContract(exchangeAccount.name, contractDir, wastFile, abiFile, waitForTransBlock=True) + trans=node.publishContract(exchangeAccount.name, contractDir, wasmFile, abiFile, waitForTransBlock=True) if trans is None: cmdError("%s set contract exchange" % (ClientName)) errorExit("Failed to publish contract.") contractDir="contracts/simpledb" - wastFile="simpledb.wast" + wasmFile="simpledb.wasm" abiFile="simpledb.abi" Print("Setting simpledb contract without simpledb account was causing core dump in %s." % (ClientName)) Print("Verify %s generates an error, but does not core dump." % (ClientName)) - retMap=node.publishContract("simpledb", contractDir, wastFile, abiFile, shouldFail=True) + retMap=node.publishContract("simpledb", contractDir, wasmFile, abiFile, shouldFail=True) if retMap is None: errorExit("Failed to publish, but should have returned a details map") if retMap["returncode"] == 0 or retMap["returncode"] == 139: # 139 SIGSEGV diff --git a/tests/nodeos_under_min_avail_ram.py b/tests/nodeos_under_min_avail_ram.py index 3b3b4a167f5..2fe356f68b5 100755 --- a/tests/nodeos_under_min_avail_ram.py +++ b/tests/nodeos_under_min_avail_ram.py @@ -138,10 +138,10 @@ def setName(self, num): trans=nodes[0].delegatebw(contractAccount, 1000000.0000, 88000000.0000, exitOnError=True) contractDir="contracts/integration_test" - wastFile="integration_test.wast" + wasmFile="integration_test.wasm" abiFile="integration_test.abi" Print("Publish contract") - trans=nodes[0].publishContract(contractAccount.name, contractDir, wastFile, abiFile, waitForTransBlock=True) + trans=nodes[0].publishContract(contractAccount.name, contractDir, wasmFile, abiFile, waitForTransBlock=True) if trans is None: cmdError("%s set contract %s" % (ClientName, contractAccount.name)) errorExit("Failed to publish contract.") diff --git a/tests/p2p_network_test.py b/tests/p2p_network_test.py index 4d03526424e..bdd7ed16f00 100755 --- a/tests/p2p_network_test.py +++ b/tests/p2p_network_test.py @@ -144,10 +144,10 @@ Print("host %s: %s" % (hosts[i], trans)) -wastFile="eosio.system.wast" +wasmFile="eosio.system.wasm" abiFile="eosio.system.abi" -Print("\nPush system contract %s %s" % (wastFile, abiFile)) -trans=node0.publishContract(eosio.name, wastFile, abiFile, waitForTransBlock=True) +Print("\nPush system contract %s %s" % (wasmFile, abiFile)) +trans=node0.publishContract(eosio.name, wasmFile, abiFile, waitForTransBlock=True) if trans is None: Utils.errorExit("Failed to publish eosio.system.") else: