AntelopeIO / cdt

Contract Development Toolkit (CDT) is a suite of tools to facilitate C/C++ development of contracts for Antelope blockchains
Other
30 stars 30 forks source link

env.sha3 unresolveable #16

Closed NatPDeveloper closed 2 years ago

NatPDeveloper commented 2 years ago

Description of error:

When you run leap with the new cdt without enabling the crypto feature you get env.sha3 unresolveable, even when not using the feature.

Steps to reproduce:

Try and deploy a new cdt contract without enabling the crypto feature.

Desired behavior:

No error and when the feature is being used, a better error code perhaps that specifies the feature that needs to be enabled.

stephenpdeos commented 2 years ago

For now, we will include the crypto primitive host functions in a separate header file so this error doesn't occur for those not trying to use this feature.

linh2931 commented 2 years ago

@NatPDeveloper I started Leap release 3.1 without enabling crypto protocol feature, and pushed a simple contract compiled by CDT release/3.0's cdt-cpp; but I could not reproduce the problem. Could you share your contract and exact steps to reproduce the problem?

NatPDeveloper commented 2 years ago

unable to reproduce at this time, not sure what changed will reopen if necessary

benjiewheeler commented 2 years ago

I'm facing this issue as well

Steps to reproduce:

On a fresh Ubuntu 18.04 VM

#include <eosio/crypto.hpp>
#include <eosio/eosio.hpp>
using namespace eosio;

CONTRACT dummy : public contract
{
public:
    using contract::contract;

    ACTION hi(name nm);

    using hi_action = action_wrapper<"hi"_n, &dummy::hi>;
};
#include "dummy.hpp"

ACTION dummy::hi(name nm)
{
    sha256("abc", 3);
}

If I comment this line sha256("abc", 3); and recompile and deploy, it works just fine

linh2931 commented 2 years ago

This should be fixed by https://github.com/AntelopeIO/cdt/pull/21. Not sure if you could build a CDT on https://github.com/AntelopeIO/cdt/tree/expose_crypto_primitives to give it a try before it is officially released.

marijnbent commented 1 year ago

where can I find cleos?