liquidapps-io / zeus-sdk

EOSIO & EVM smart contract unit testing suite and API provider
51 stars 24 forks source link

atomictokenpeg not compiling #37

Closed Dewald928 closed 2 years ago

Dewald928 commented 2 years ago

I'm trying to test out the eosio <> evm nft bridge, namely atomictokenpeg

But when I try to compile it, the cdt is giving issues. Have the CDT issues still not been fixed? It's such a good service, I'd love to use it.

Any ideas of how to fix it? Will this be fixed in the future?

NatPDeveloper commented 2 years ago

Hello @Dewald928, I'm glad you like it. With the fix below, it works fine for me.

You will either need to update zeus to the latest version (as I patched this recently) or you will need to update the compiler version for eth in ./atomictokenpeg/truffle-config.js to 0.8.13 and you can compile ETH specifically with zeus compile --phase eth.

Please share what version of the CDT you are using as well as the complete error message.

I'm also unaware of any existing CDT issues outside of the vCPU compilation issues which block one never addressed.

Commands I'm using:
``` mkdir atomictokenpeg cd atomictokenpeg zeus box create zeus unbox atomictokenpeg zeus compile zeus test atomictokenpeg --enable-features --services="ipfs,cron,sign,oracle" --single-chain ```
Output from unbox command:
``` zeus test atomictokenpeg -c --enable-features --services="ipfs,cron,sign,oracle" --single-chain ⚗️ Generating ./contracts/eos/dappservices/auth.hpp auth ⚗️ Generating ./contracts/eos/dappservices/cron.hpp cron ⚗️ Generating ./contracts/eos/dappservices/_dns_impl.hpp dns ⚗️ Generating ./contracts/eos/dappservices/history.hpp history ⚗️ Generating ./contracts/eos/dappservices/ipfs.hpp ipfs ⚗️ Generating ./contracts/eos/dappservices/log.hpp log ⚗️ Generating ./contracts/eos/dappservices/oracle.hpp oracle ⚗️ Generating ./contracts/eos/dappservices/readfn.hpp readfn ⚗️ Generating ./contracts/eos/dappservices/sign.hpp sign ⚗️ Generating ./contracts/eos/dappservices/_storage_impl.hpp storage ⚗️ Generating ./contracts/eos/dappservices/vaccounts.hpp vaccounts ⚗️ Generating ./contracts/eos/dappservices/_vcpu_impl.hpp vcpu ⚗️ Generating ./zeus_boxes/dns-dapp-service/services/dns-dapp-service-node/index.js dns ⚗️ Generating ./zeus_boxes/storage-dapp-service/services/storage-dapp-service-node/index.js storage ⚗️ Generating ./zeus_boxes/vcpu-dapp-service/services/vcpu-dapp-service-node/index.js vcpu ⚗️ Generating ./contracts/eos/dappservices/dns.hpp dns ⚗️ Generating ./contracts/eos/dappservices/storage.hpp storage ⚗️ Generating ./contracts/eos/dappservices/vcpu.hpp vcpu ⚡ EOSIO CONTRACT COMPILING -- Setting up Eosio Wasm Toolchain 1.8.0 at /usr -- Configuring done -- Generating done -- Build files have been written to: /home/ubuntu/environment/atomictokenpeg/contracts/eos ⚫ Scanning dependencies of target atomictokenpeg ◼️ [ 0%] Performing build step for 'atomictokenpeg' ⚫ Scanning dependencies of target atomictokenpeg ◼️ [ 50%] Building CXX object CMakeFiles/atomictokenpeg.dir/atomictokenpeg.cpp.obj Warning, action does not have a ricardian contract Warning, action does not have a ricardian contract Warning, action does not have a ricardian contract Warning, action does not have a ricardian contract Warning, action does not have a ricardian contract Warning, action does not have a ricardian contract Warning, action does not have a ricardian contract Warning, action does not have a ricardian contract Warning, action does not have a ricardian contract Warning, action does not have a ricardian contract Warning, action does not have a ricardian contract Warning, action does not have a ricardian contract Warning, action does not have a ricardian contract Warning, action does not have a ricardian contract Warning, action does not have a ricardian contract Warning, action does not have a ricardian contract Warning, action does not have a ricardian contract Warning, action does not have a ricardian contract Warning, action does not have a ricardian contract Warning, action does not have a ricardian contract Warning, action does not have a ricardian contract Warning, action does not have a ricardian contract Warning, action does not have a ricardian contract Warning, action does not have a ricardian contract Warning, action does not have a ricardian contract ◼️ [100%] Linking CXX executable atomictokenpeg.wasm ◼️ [100%] Built target atomictokenpeg ◼️ [ 0%] No install step for 'atomictokenpeg' ◼️ [ 0%] No test step for 'atomictokenpeg' ◼️ [ 33%] Completed 'atomictokenpeg' ◼️ [100%] Built target atomictokenpeg ◼️ [ 0%] Performing build step for 'atomictokenpeg' ◼️ [100%] Built target atomictokenpeg ◼️ [ 0%] No install step for 'atomictokenpeg' ◼️ [ 0%] No test step for 'atomictokenpeg' ◼️ [ 33%] Completed 'atomictokenpeg' ◼️ [100%] Built target atomictokenpeg ⚡ ETH CONTRACT COMPILING Compiling your contracts... =========================== > Compiling ./contracts/eth/atomictokenpeg/IOwned.sol > Compiling ./contracts/eth/atomictokenpeg/atomictokenpeg.sol > Artifacts written to /home/ubuntu/environment/atomictokenpeg/build/contracts > Compiled successfully using: - solc: 0.8.13+commit.abaa5c0e.Emscripten.clang ⚓ Setup environment 01-dapp-client.js ⚓ Setup environment 02-a-eos-local-nodeos.js ⚓ Setup environment 02-b-eos-eosio-chains-nodeos.js ⚓ Setup environment 03-a-ganache-cli.js ⚓ Setup environment 03-b-ganache-cli.js ⚓ Setup environment 05-a-eos-local-bios.js ⚡ uploaded contract old_eosio.bios to account eosio ⚡ uploaded contract eosio.token to account eosio.token ⚡ uploaded contract eosio.msig to account eosio.msig ⚡ uploaded contract eosio.boot to account eosio ⚡ enabling: KV_DATABASE ⚡ enabling: ACTION_RETURN_VALUE ⚡ enabling: CONFIGURABLE_WASM_LIMITS ⚡ enabling: BLOCKCHAIN_PARAMETERS ⚡ enabling: ONLY_BILL_FIRST_AUTHORIZER ⚡ enabling: DISALLOW_EMPTY_PRODUCER_SCHEDULE ⚡ enabling: ONLY_LINK_TO_EXISTING_PERMISSION ⚡ enabling: FIX_LINKAUTH_RESTRICTION ⚡ enabling: RAM_RESTRICTIONS ⚡ enabling: WTMSIG_BLOCK_SIGNATURES ⚡ uploaded contract eosio.system to account eosio ⚡ setting up system token 4,SYS ⚓ Setup environment 05-b-eos-eosio-chains-bios.js ⚓ Setup environment 10-remove-local-sqllite.js ⚓ Setup environment 15-a-eos-demux.js ☁️ Running service: demux port: 3195 ☁️ Running service: demux port: 6390 ⚓ Setup environment 15-b-eos-eosio-chains-demux.js ⚓ Setup environment 15-ipfs-dameon.js ☁️ Running service: ipfs-daemon port: 3199 ⚓ Setup environment 20-a-eos-local-dapp-services.js ⚡ uploaded contract dappservices to account dappservices ☁️ Running service: dapp-services-node port: 13015 ☁️ Running service: dapp-services-node port: 26030 ⚓ Setup environment 20-b-eos-eosio-chains-dapp-services.js ⚓ Setup environment 21-a-eos-local-services-all-dapp-services.js ⚡ uploaded contract dappservices to account dappservices ☁️ Running service: cron-dapp-service-node port: 13131 ☁️ Running service: cron-dapp-service-node port: 26262 ☁️ Running service: ipfs-dapp-service-node port: 13115 ☁️ Running service: ipfs-dapp-service-node port: 26230 ☁️ Running service: oracle-dapp-service-node port: 13112 ☁️ Running service: oracle-dapp-service-node port: 26224 ☁️ Running service: sign-dapp-service-node port: 13128 ☁️ Running service: sign-dapp-service-node port: 26256 ⚓ Setup environment 21-b-eos-eosio-chains-services-all-dapp-services.js ⚡ Running tests > atomictokenpeg@1.0.0 test > mocha --require=dotenv/config --exit --timeout 1000000 --color "test/atomictokenpeg.spec.js" Atomic NFT Token bridge Test EOSIO <> EVM ⚡ uploaded contract atomictokenpeg to account atomictknpeg ⚡ uploaded contract atomicassets to account atomicassets ✔ Transfers nft from eos to eth (14356ms) ✔ Manual refund to sender when eos account doesn't exist (142961ms) ✔ transfers nft from eth to eos (49271ms) ✔ Auto refund to sender when eth address doesn't exist (44901ms) ✔ register new NFT, try double register, and transfer (13824ms) ✔ Token peg mainnet/sidechain stop intervals (2505ms) 6 passing (5m) ✔️ tests ok ```
Updated Truffle Config File:
``` /** * Use this file to configure your truffle project. It's seeded with some * common settings for different networks and features like migrations, * compilation and testing. Uncomment the ones you need or modify * them to suit your project as necessary. * * More information about configuration can be found at: * * truffleframework.com/docs/advanced/configuration * * To deploy via Infura you'll need a wallet provider (like truffle-hdwallet-provider) * to sign your transactions before they're sent to a remote public node. Infura accounts * are available for free at: infura.io/register. * * You'll also need a mnemonic - the twelve word phrase the wallet uses to generate * public/private key pairs. If you're publishing your code to GitHub make sure you load this * phrase from a file you've .gitignored so it doesn't accidentally become public. * */ // const HDWalletProvider = require('truffle-hdwallet-provider'); // const infuraKey = "fj4jll3k....."; // // const fs = require('fs'); // const mnemonic = fs.readFileSync(".secret").toString().trim(); module.exports = { /** * Networks define how you connect to your ethereum client and let you set the * defaults web3 uses to send transactions. If you don't specify one truffle * will spin up a development blockchain for you on port 9545 when you * run `develop` or `test`. You can ask a truffle command to use a specific * network from the command line, e.g * * $ truffle test --network */ networks: { // Useful for testing. The `development` name is special - truffle uses it by default // if it's defined here and no other network is specified at the command line. // You should run a client (like ganache-cli, geth or parity) in a separate terminal // tab if you use this network and you must also set the `host`, `port` and `network_id` // options below to some value. // development: { host: "127.0.0.1", // Localhost (default: none) port: 8545, // Standard Ethereum port (default: none) network_id: "*", // Any network (default: none) }, }, // Set default mocha options here, use special reporters etc. mocha: { // timeout: 100000 }, // Configure your compilers compilers: { solc: { version: "0.8.13", // ***UPDATE HERE*** docker: false, // Use "0.5.1" you've installed locally with docker (default: false) settings: { // See the solidity docs for advice about optimization and evmVersion optimizer: { enabled: true, runs: 200 } } } } } ```

Additional Details:

Zeus Version:
``` zeus --version 2.1.7962 ```
OS Version:
``` lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 18.04.6 LTS Release: 18.04 Codename: bionic ```
NPM Version:
``` npm -v 8.5.0 ```
NodeJS Version:
``` node -v v16.14.2 ```
Nodeos Version:
``` nodeos -v v2.1.0 ```
CDT Version:
``` eosio-cpp -v clang version 9.0.1 (https://github.com/eosio/clang.git 65c99a019ef4cffed9c5f68bdfd8079ab35f4289) (https://github.com/eosio/llvm 423a4ac7a7074e139c4f4c2f786d6b71d1b0965e) Target: x86_64-unknown-linux-gnu Thread model: posix InstalledDir: /home/ubuntu/environment Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7 Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7.5.0 Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/8 Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7.5.0 Candidate multilib: .;@m64 Selected multilib: .;@m64 ``` i.e. eosio.cdt_1.8.0-1-ubuntu-18.04_amd64.deb
Dewald928 commented 2 years ago

Aha!

So my first issue was that the current zeus-cmd installs cdt 1.7.0 by default. I just installed CDT 1.8.0 and now the contracts compile.

Then I also got the eth error. Even though I did update to the version you listed above. But when I changed the config to 0.8.13 it worked like you said.

Now I'll do a bit of a dive. But I am keen to make use of this bridge. Are there any active instances of this bridge somewhere?

NatPDeveloper commented 2 years ago

Aha!

So my first issue was that the current zeus-cmd installs cdt 1.7.0 by default. I just installed CDT 1.8.0 and now the contracts compile.

Then I also got the eth error. Even though I did update to the version you listed above. But when I changed the config to 0.8.13 it worked like you said.

Now I'll do a bit of a dive. But I am keen to make use of this bridge. Are there any active instances of this bridge somewhere?

Glad it works.