1

I am following along the tutorial on the EOS website at https://developers.eos.io/eosio-home/docs/your-first-contract

At the first smart contract development section, I cannot manage to publish the simplest hello world contract. Here is the error message I face:

[******** hello]$ cleos set contract hello . -p hello@active
Reading WASM from /home/*****/eos/contracts/hello/hello.wasm...
Publishing contract...
Error 3070003: Serialization Error Processing WASM
Error Details:
invalid index: localIndex>=locals.size()
pending console output:
[******** hello]$

My hello.cpp is as follows:

#include <eosio/eosio.hpp>

using namespace eosio;

class [[eosio::contract]] hello : public contract {
  public:
      using contract::contract;

      [[eosio::action]]
      void hi( name user ) {
         print( "Hello, ", name{user});
      }
};

(By the way, the tutorial website seems slightly unclear on whether it should be print( "Hello, ", name{user}); or print( "Hello, ", user);)

I have also noticed that eosio-cpp -abigen -o hello.wasm hello.cpp will hang forever and needs to be terminated manually with ctrl+c. This seems similar to https://github.com/EOSIO/eosio.cdt/issues/123

The suggested fixe mentions having a 2-core CPU, which I have set my VM to use already.

However, in my case, hello.abi and hello.wasm ARE generated, In which case I continue and then run into the error message mentioned at the beginning.

I have noticed that when I run cat hello.wasm, I can read the following among all the messy characters :

>A▒▒
                    !failed to allocate pagesHello, A▒▒

Here some info about my setup :

[*** hello]$ eosio-cpp --version
eosio-cpp version 1.6.0
[*** hello]$ eosio-abigen --version
eosio-abigen version 1.6.0
[*** hello]$ nodeos --version
v1.7.0
[*** hello]$ cat /etc/os-release
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"

CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"

How can I fix this and complete the EOS tutorial?

1 Answer 1

1

The problem you are describing definitely appears to be related to your VM only having one core. Please double check that your VM has 2 or more cores allocated to it, and that you have restarted your VM after making the necessary adjustment.

Additionally, eosio.cdt 1.6.0 has some issues that may cause problems, please upgrade to eosio.cdt 1.6.1 immediately.

3
  • My VM now does have two cores: "lscpu" outputs : ... " CPU(s): 2 On-line CPU(s) list: 0,1 Thread(s) per core: 1 Core(s) per socket: 2 Socket(s): 1 " ...and my cdt is upgraded to 1.6.1:" $ eosio-cpp --version" gives me "eosio-cpp version 1.6.1" The issue still persists however Commented May 7, 2019 at 1:57
  • PS: the problem IS solved now. I spoke too soon when I saw the compilation hanging several times, but once it decided to complete, the resulting .wasm was correct. Commented May 7, 2019 at 2:23
  • glad to hear it!!!!
    – Sandwich
    Commented May 7, 2019 at 16:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.