EOSIO / eos

An open source smart contract platform
https://developers.eos.io/manuals/eos
MIT License
11.27k stars 3.6k forks source link

wast file cannot be found #5914

Closed leventatbjss closed 5 years ago

leventatbjss commented 6 years ago

I am writing this to point out to some confusion in the documentation. I have chosen not to build from sources but used docker to set nodeos and keosd up. The documentation at some stage mentions deploying system contracts such as eosio.token and that is where it starts to become misleading. Since, I have not built them manually I don't have a cleos executable. Instead, I have the "cleos" alias which in fact connects to docker and runs the cleos within the container. So, when documentation says something like: cleos set contract eosio.token build/contracts/eosio.token -p eosio.token@active the build directory is not there on my host machine but in the container. As a workaround I tried mounting the container folder to host and getting a full absolute path to eosio.token. That way it gets me this

Error 3160009: No wast file found
Error Details:
no wasm file found /home/levent/eos/contracts/eosio.bios/eosio.bios.wasm

That eventually drove me crazy because the wasm file was right there sitting in that exact path! I tried manually compiling the contract, re-building the eosio_cdt from scratch etc. but was still getting the same error no matter. Then I realised the cleos was actually an alias in it was meant to run the command within the container and therefore what I pass as an absolute directory path from my host would not make any sense to the container. The directory path mentioned should have been an absolute path within container. Therefore I think, in general, the documentation within the developer portal assumes that the nodeos was built from source and this can be misleading for those who are running nodeos on docker. The docs should be revised and tutorials/statements should be rephrased with additional/alternative instructions for docker based users. Thanks.

taokayan commented 6 years ago

The issue is that /home/levent/eos/contracts/eosio.bios/eosio.bios.wasm is an invalid path as viewed inside your docker container. you can solve this by making mounting from the host to the docker (using -v).

leventatbjss commented 6 years ago

I know what the issue is. It just took me a day to understand what the issue was. What I am trying to say is that the documentation is not clear/complete about docker based setup and it should have notes for those who chose the docker path. After all, using docker, instead of building from source is supposed to be easier or for "most people" who does not necessarily want to go into details. The following excerpt is from https://developers.eos.io/eosio-nodeos/docs/docker-quickstart

This guide is best for most people, but advanced developers may prefer to build from source

eliquinox commented 6 years ago

I agree the documentation is not consistent with all boot versions. @leventatbjss how did you solve the problem?

tradexy commented 5 years ago

Also agree and I am stuck. Using Ubuntu and Docker. Has someone come across this problem found a solution?

blake@T5500:/eos/contracts/hello$ eosio-cpp -o hello.wasm hello.cpp --abigen blake@T5500:/eos/contracts/hello$ ls hello.abi hello.cpp hello.wasm

blake@T5500:~/eos/contracts$ cleos set contract hello /home/blake/eos/contracts/hello -p hello@active Reading WASM from /home/blake/eos/contracts/hello/hello.wasm... Error 3160009: No wast file found Error Details: no wasm file found /home/blake/eos/contracts/hello/hello.wasm

miguelmota commented 5 years ago

If you have cleos set as an alias for a docker container such as alias cleos='docker exec -it eosio /opt/eosio/bin/cleos, then the easiest way to deploy is to deploy from within the docker container (docker exec -it eosio bash) otherwise the path will not be found

andriantolie commented 5 years ago

@tradexy you should not put the host's path of your contracts, but you should put the mapped path of your contracts inside the docker container instead.

I agree that these things need to be emphasized more in the documentation. Things might be simpler for the developer who is not familiar with docker with the release of the binary now. Since the original issue is solved, I'm closing this issue.

ray-learn commented 5 years ago

Using the docker, cleos (version: f9a3d023). Without the alias of cleos. I run docker exec -it nodeos bash after start up the nodeos. I also encountered this problem. And the strange point is:

Still finding the solution to solve this~ Is anyone meet the same problem?

@taokayan Thanks! Put the contract directory in the docker volume can work

shikhars371 commented 5 years ago

I am facing the same issue, but as you suggested what do i do now? my cleos is on container and im accessing files from root

shikhars371 commented 5 years ago

can anyone provide me steps to deploy my contract? i been following https://developers.eos.io/eosio-home/docs/your-first-contract this guide but no luck the same error occurs over and over again

tradexy commented 5 years ago

I am still struggling. Getting the same 316009 error again and again. @miguelmota - using docker exec -it eosio bash also produces failed to connect to nodeos plus error 316009 @adriantolie - "with the release of the binary now" are you saying that docker should not be used?

andriantolie commented 5 years ago

You can still use docker if you like, you just have more options now :)

ray-learn commented 5 years ago

I am facing the same issue, but as you suggested what do i do now? my cleos is on container and im accessing files from root

The issue is that /home/levent/eos/contracts/eosio.bios/eosio.bios.wasm is an invalid path as viewed inside your docker container. you can solve this by making mounting from the host to the docker (using -v).

@shikhars371 Pay attention to the docker option -v, and put your contract source file in the local drive other than the container.

shikhars371 commented 5 years ago

@ray-learn my contract file is in my local drive, not in container , when i tried to use cleos set contract hello CONTRACTS_DIR/hello -p hello@active this command it tells me no wast file found

ray-learn commented 5 years ago

@ray-learn my contract file is in my local drive, not in container , when i tried to use cleos set contract hello CONTRACTS_DIR/hello -p hello@active this command it tells me no wast file found

Provide your step about the nodeos and cleos, do not alias the cleos first. Also you can check the .wasm and .abi file cause the compile tool may be affect.

tradexy commented 5 years ago

An update - I deleted the older version and uploaded the docker Ubuntu image $ docker pull eosio/eos:v1.4.0. Now following the developers tutorial https://developers.eos.io/eosio-home/docs/your-first-contract and I am not getting the error anymore :-)

However I am now stuck on "Step 5:Create the token" here https://developers.eos.io/eosio-home/docs/token-contract and getting the error below (note that I have followed the tutorial step by step).

Error 3015004: The type defined in the ABI is invalid Error Details: account

tradexy commented 5 years ago

Please disregard my last comment. For some reason the eosio.token.abi file was not being uploaded properly (or if it was it is incorrect). I fixed it manually and now I can create, issue and transfer tokens.