eos icon indicating copy to clipboard operation
eos copied to clipboard

new cleos set contract params don't seem to behave as documented

Open spoonincode opened this issue 8 years ago • 6 comments

$ ./cleos set contract --help
Create or update the contract on an account
Usage: ./cleos set contract [OPTIONS] account contract-dir [wast-file] [abi-file]

Positionals:
  account TEXT                The account to publish a contract for
  contract-dir TEXT           The the path containing the .wast and .abi
  wast-file TEXT              The file containing the contract WAST or WASM relative to contract-dir
  abi-file TEXT               The ABI for the contract relative to contract-dir

I would have expected this to work..

$ ls ~/eos/build/contracts/eosio.bios
CMakeFiles		Makefile		eosio.bios.abi		eosio.bios.bc		eosio.bios.s		eosio.bios.wast.hpp
CTestTestfile.cmake	cmake_install.cmake	eosio.bios.abi.hpp	eosio.bios.cpp.bc	eosio.bios.wast

$ ./cleos set contract eosio ~/eos/build/contracts/eosio.bios eosio.bios.wast eosio.bios.abi
Reading WAST...
Assembling WASM...
1941681ms thread-0   main.cpp:1186                 main                 ] Failed with error: Assert Exception (10)
!"error parsing wast": Error parsing WebAssembly text file:
:1:1: expected '('

^

spoonincode avatar Apr 02 '18 13:04 spoonincode

same error here on Mac / master using the "currency" contract I'm trying to follow the tutorial steps: https://github.com/EOSIO/eos#singlenode

I also tried by using eosiocpp to generate the .wast file from the source code in /contracts/currency but it throws exactly the same error.

$ cleos set contract currency currency.wast currency.abi

Reading WAST...
Assembling WASM...
2370762ms thread-0   main.cpp:1186                 main                 ] Failed with error: Assert Exception (10)
!"error parsing wast": Error parsing WebAssembly text file:
:1:1: expected '('
{
^

drwaldo avatar Apr 03 '18 03:04 drwaldo

cleos set contract currency ./currency -p currency ./currency is a contract directory.

xnfy520 avatar Apr 03 '18 08:04 xnfy520

that worked like a charm! thanks!

drwaldo avatar Apr 03 '18 23:04 drwaldo

when I typed that commands, error has occured like

File is actually a directory: ../../contracts/currency ERROR: ValidationError: wast-file=../../contracts/currency Create or update the contract on an account Usage: cleos set contract [OPTIONS] account wast-file [abi-file]

I'm using mac and the branch is f6f8c66505cb6469e0c2e6027a03f72f1c9fd1a9.

realcom avatar Apr 04 '18 01:04 realcom

Furthermore, if the filenames of the ABI and WAST don't match their parent directory's name, cleos won't find them.

Repro:

  1. mkdir /cleosIssue
  2. put myContract.wast and myContract.abi into /cleosIssue
  3. cleos set contract foo /cleosIssue myContract.wast myContract.abi Expected: Cleos would find the wast and abi just fine Actual: Cleos cannot find them, the only resolution is to rename /cleosIssue to /myContract (which is fine in practice, but the -h message implies that this is not supposed to be necessary)

csandwith avatar Jun 29 '18 16:06 csandwith

Seems like for the wast file and abi file, it's relative path to current dir instead of contract dir, because the following works:

./cleos set contract eosio ~/eos/build/contracts/eosio.bios ~/eos/build/contracts/eosio.bios /eosio.bios.wast ~/eos/build/contracts/eosio.bios /eosio.bios.abi

andriantolie avatar Jul 18 '18 07:07 andriantolie