dapple icon indicating copy to clipboard operation
dapple copied to clipboard

Error on Dapple Test

Open tjade273 opened this issue 8 years ago • 11 comments

Symptoms

$dapple test
Testing...
<stdin>:2:1: Warning: Source file does not specify required compiler version! Consider adding "pragma solidity ^0.4.1;".

^
Using local solc installation...
/home/tjaden/.npm-packages/lib/node_modules/dapple/node_modules/solc/soljson.js:1
(function (exports, require, module, __filename, __dirname) { var Module;if(!Module)Module=(typeof Module!=="undefined"?Module:null)||{};var moduleOverrides={};for(var key in Module){if(Module.hasOwnProperty(key)){moduleOverrides[key]=Module[key]}}var ENVIRONMENT_IS_WEB=typeof window==="object";var ENVIRONMENT_IS_WORKER=typeof importScripts==="function";var ENVIRONMENT_IS_NODE=typeof process==="object"&&typeof require==="function"&&!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_WORKER;var ENVIRONMENT_IS_SHELL=!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_NODE&&!ENVIRONMENT_IS_WORKER;if(ENVIRONMENT_IS_NODE){if(!Module["print"])Module["print"]=function print(x){process["stdout"].write(x+"\n")};if(!Module["printErr"])Module["printErr"]=function printErr(x){process["stderr"].write(x+"\n")};var nodeFS=require("fs");var nodePath=require("path");Module["read"]=function read(filename,binary){filename=nodePath["normalize"](filename);var ret=nodeFS["readF

TypeError: Cannot read property 'startsWith' of undefined
    at DestroyableTransform._transform (/home/tjaden/.npm-packages/lib/node_modules/dapple/lib/streams/linklibraries.js:20:50)
    at DestroyableTransform.Transform._read (/home/tjaden/.npm-packages/lib/node_modules/dapple/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:159:10)
    at DestroyableTransform.Transform._write (/home/tjaden/.npm-packages/lib/node_modules/dapple/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:147:83)
    at doWrite (/home/tjaden/.npm-packages/lib/node_modules/dapple/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:313:64)
    at writeOrBuffer (/home/tjaden/.npm-packages/lib/node_modules/dapple/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:302:5)
    at DestroyableTransform.Writable.write (/home/tjaden/.npm-packages/lib/node_modules/dapple/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:241:11)
    at Stream.method [as write] (/home/tjaden/.npm-packages/lib/node_modules/dapple/node_modules/duplexer/index.js:47:39)
    at DestroyableTransform.ondata (/home/tjaden/.npm-packages/lib/node_modules/dapple/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:531:20)
    at emitOne (events.js:101:20)
    at DestroyableTransform.emit (events.js:188:7)

The compiler is running, because I can compile each file individually without errors, and dapple test works correctly when I introduce syntax errors. The crash only occurs on successful compilation. This occurs regardless of the contract.

Details

Dappfile:

version: 1.0.0
tags: []
layout:
  sol_sources: contracts
  build_dir: build
dependencies: {}
ignore: []
name: myProject

Dapple Version 0.7.2 Solc version 0.4.1+commit.4fc6fc2.Linux.g++ Platform: Ubuntu 16.04

.dapplerc

  live:
    ethereum:
      host: localhost
      port: '8545'
      account: '0x5c8a5b4a6b08c69dad9f96e0ea5fb1b188abc2f8'
    ipfs:
      host: localhost
      port: '5001'
  default:
    ethereum:
      host: '127.0.0.1'
      port: '8545'
  internal:
    ethereum: 'internal'

tjade273 avatar Sep 09 '16 17:09 tjade273

Thanks for reporting! Although, this is a known issue. The new Solidity 0.4.1 introduced a new abi notation format which is incompatible with the dapple 0.7.2 version. Also If the contracts fallback function throws by default if not implemented. We currently work hard on a dapple 0.8 release where this problem is already solved, you can get it from the v0.8 branch. It could take a few days before we publish it over npm…

mhhf avatar Sep 09 '16 17:09 mhhf

Thanks, is there an easy way to build from source?

tjade273 avatar Sep 09 '16 18:09 tjade273

Dapple 0.8 is a big beast with a lot of new features with some of them might be unstable. If you want to try it, the best way to install is:

git clone [email protected]:nexusdev/dapple.git
cd dapple
git checkout v0.8
npm i
npm link

Remember to migrate your existing projects, with dapple migrate

mhhf avatar Sep 09 '16 18:09 mhhf

Thanks, I've updated to 0.8, but the migrate function gives

/home/tjaden/dapple/node_modules/dapple-core/state.js:143
    cb(null, this._global_state[key]);
                               ^

TypeError: Cannot read property 'networks' of undefined
    at State.getJSON (/home/tjaden/dapple/node_modules/dapple-core/state.js:143:32)
    at Object.module.exports.handler (/home/tjaden/dapple/node_modules/dapple-core/migrate.js:66:11)
    at State.migrate (/home/tjaden/dapple/node_modules/dapple-core/state.js:191:13)
    at Object.module.exports.cli (/home/tjaden/dapple/node_modules/dapple-core/controller.js:10:13)
    at state.initWorkspace (/home/tjaden/dapple/cmd/main.js:126:33)
    at State.initWorkspace (/home/tjaden/dapple/node_modules/dapple-core/state.js:28:27)
    at Object.<anonymous> (/home/tjaden/dapple/cmd/main.js:69:7)
    at Module._compile (module.js:541:32)
    at Object.Module._extensions..js (module.js:550:10)
    at Module.load (module.js:458:32)

Maybe I'll just roll back to solc <0.4 for now

tjade273 avatar Sep 09 '16 18:09 tjade273

Thanks for reporting! Fixed this, should work now after running git pull && npm i dapple-core from your dapple git directory

mhhf avatar Sep 09 '16 18:09 mhhf

downgrading solidity also work, although you have to use solc <= 0.3.6

mhhf avatar Sep 09 '16 18:09 mhhf

I updated, migrated successfully, but now it says

/home/tjaden/dapple/lib/workspace.js:41
      throw new Error('No Dappfile found!');
      ^

Error: No Dappfile found!
    at new Workspace (/home/tjaden/dapple/lib/workspace.js:41:13)
    at Function.atPackageRoot (/home/tjaden/dapple/lib/workspace.js:124:12)
    at Object.<anonymous> (/home/tjaden/dapple/cmd/main.js:65:25)
    at Module._compile (module.js:541:32)
    at Object.Module._extensions..js (module.js:550:10)
    at Module.load (module.js:458:32)
    at tryModuleLoad (module.js:417:12)
    at Function.Module._load (module.js:409:3)
    at Module.runMain (module.js:575:10)
    at run (bootstrap_node.js:352:7)

Even though I have a dappfile in the directory, as listed in the original issue.

tjade273 avatar Sep 09 '16 18:09 tjade273

Fixed it.

You changed the naming convention from dappfile to Dappfile

https://github.com/nexusdev/dapple/blob/e45e3cf239e8b5bb03e737ff4dc1665066a1d695/lib/workspace.js#L39

That should probably be fixed

tjade273 avatar Sep 09 '16 18:09 tjade273

migrate is supposed to do this for you, the name change was abused to help identify if a package has been migrated

nmushegian avatar Sep 09 '16 19:09 nmushegian

Ah, well migrate failed to do that

tjade273 avatar Sep 09 '16 19:09 tjade273

@nmushegian I feel this causes more problems than good -- with different fs systems have different behavior (some of them case sensitive, some of them not). Maybe it is better to support both: upper and lower case dappfiles and introduce a pragma property in the dappfile which indicates the latest dapple version which has produced this dappfile.

mhhf avatar Sep 09 '16 19:09 mhhf