0

I have a setup of multi-node of 4 peers blockchain. Blockchain is running, few days before I deployed the smart contract and using it to save data on the blockchain. Now, I did some changes to the smart contract by changing the multi-index table name. Trying to compile and deploy this smart contract again. On the local machine, it gets compiled successfully. But on the server-side, the compilation is not getting finished with no error. It looks stuck (blinking cursor). What may be the reason? Let me know if anybody needs more information. Compilation command:

eosio-cpp --abigen commoncontract.cpp -o commoncontract.wasm

And

EOSIO.CDT 1.6.3

Smart contracts are in hpp files saved in /usr/opt/eosio.cdt/1.6.3/include/contracts/ and included in smart contract as header files. Smart contract is:

#include "contracts/group.hpp"
#include "contracts/user.hpp"
#include "contracts/document.hpp"

extern "C" {

        [[eosio::wasm_entry]]
                void apply(uint64_t receiver, uint64_t code, uint64_t action) {
                        if (code == receiver) {
                                switch (action) {
                                        EOSIO_DISPATCH_HELPER(group, (upsertgroup)(erasegroup))
                                        EOSIO_DISPATCH_HELPER(user, (upsertuser)(eraseuser))
                                        EOSIO_DISPATCH_HELPER(document, (upsertdoc)(erasedoc))
                                }
                        }
                }
}

Also when I tried multiple times, temporary wasm files get generated like commoncontract.wasm.tmp3f5048b. Please help.

1

a few things to consider:

  1. it is not advisable to compile on your servers. you need tbe full blown dev environment to be set up correctly (all dependencies) in order to compile successfuly; when eosio-ccp was reported as hanging in the past it was because there was some dependencies missing or not version aligned (clang, submodules, etc). if you try to compile the samples that are part of eosio.cdt is is working or still hanging?

  2. if it compiles on the local machine you can deploy the contract from that machine.

  3. I am not sure if you are aware of the problem you might have if you change the multi-index definition, rebuild and the re-deploy the contract; if you are not doing it right you might have unexpected behaviour. please take a look on this developers portal for more details: https://developers.eos.io/manuals/eosio.cdt/latest/best-practices/data-design-and-migration

7
  • Hey, the second option works. But still, till now I always compile and deploy the smart contract where my blockchain is. So, why not on the server? Can you elaborate on the first option?
    – Varsh
    Apr 19 at 10:25
  • the servers should be lean and mean and have the minimum required to run the nodeos + the plugins needed.
    – ovi
    Apr 19 at 12:19
  • Probably not the solution to the problem but as a side-note: There's a bug where eosio-cdt/eosio-cpp needs at least two cores to compile the code and freezes when there's only one core available.
    – cmadh
    Apr 19 at 12:33
  • I hit enter too early and did not finish editing my previous comment: the servers, running in production and even in staging, should be lean and mean and have the minimum required dependencies installed to run the nodeos + the plugins needed. if you install a development env on it then you risk to bloat it and even expose it to risks.
    – ovi
    Apr 19 at 13:28
  • @cmadh, yes I checked this. Serve have 2 cores.
    – Varsh
    Apr 20 at 8:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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