GithubHelp home page GithubHelp logo

dapp's People

Contributors

apmilen avatar dbrock avatar eiabea avatar gbalabasquer avatar jumutc avatar mbrock avatar mrchico avatar nanexcool avatar nmushegian avatar rainbreak avatar rstormsf avatar snario avatar travs avatar wjmelements avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dapp's Issues

-r doesn't seem to work

With sai, there's no difference when I run dapp test and when I run dapp test -r testCascade.

To prevent regression, there should probably be a test for this bug added to the selftest.

`dapp test` fails on OS X with: `mktemp: illegal option -- -`

High Sierra, dapp 0.7.6

Output from clean dapp init:

+ dapp clean
+ rm -rf out
+ solc --overwrite ds-test/=lib/ds-test/src/ ds-test=lib/ds-test/src/index.sol --libraries '' --abi --bin --bin-runtime = -o out/ src/Dapp.sol
+ solc --overwrite ds-test/=lib/ds-test/src/ ds-test=lib/ds-test/src/index.sol --libraries '' --combined-json=abi,bin,bin-runtime,srcmap,srcmap-runtime,ast = src/Dapp.sol
+ solc --overwrite ds-test/=lib/ds-test/src/ ds-test=lib/ds-test/src/index.sol --libraries '' --abi --bin --bin-runtime = -o out/ src/Dapp.t.sol
+ solc --overwrite ds-test/=lib/ds-test/src/ ds-test=lib/ds-test/src/index.sol --libraries '' --combined-json=abi,bin,bin-runtime,srcmap,srcmap-runtime,ast = src/Dapp.t.sol
mktemp: illegal option -- -
usage: mktemp [-d] [-q] [-t prefix] [-u] template ...
       mktemp [-d] [-q] [-u] -t prefix

make link causes Makefile:10: recipe for target 'link' failed error

OS: Linux Mint 18
Dapp Initialization
Make Link

Since I get 'file exists' should I just ignore this and move on to dapp init?:

''''
~/Downloads/dapp-master $ make link
mkdir -p /usr/local/{bin,libexec}
for x in bin/dapp libexec/dapp; do ln -s pwd/$x /usr/local/$x; done
ln: failed to create symbolic link '/usr/local/bin/dapp': File exists
ln: failed to create symbolic link '/usr/local/libexec/dapp/dapp': File exists
Makefile:10: recipe for target 'link' failed
make: *** [link] Error 1

''''
or should something be fixed first?

function call with bytes parameters cannot pass the quicktest

Following code is in the solidity contract, where the "_data" is type of bytes.

receiver.call.value(0)(bytes4(keccak256(_custom_fallback)), msg.sender, _amount, _data);

Fail when running "dapp test" with tests run this code.

/Users/user/github.com/dapphub/dapp/libexec/dapp/node_modules/bn.js/lib/bn.js:6
    if (!val) throw new Error(msg || 'Assertion failed');
              ^

Error: Number can only safely store up to 53 bits
    at assert (/Users/user/github.com/dapphub/dapp/libexec/dapp/node_modules/bn.js/lib/bn.js:6:21)
    at BN.toNumber (/Users/user/github.com/dapphub/dapp/libexec/dapp/node_modules/bn.js/lib/bn.js:506:7)
    at decodeSingle (/Users/user/github.com/dapphub/dapp/libexec/dapp/node_modules/ethereumjs-abi/lib/index.js:250:54)
    at Function.ABI.rawDecode (/Users/user/github.com/dapphub/dapp/libexec/dapp/node_modules/ethereumjs-abi/lib/index.js:367:14)
    at formatMethodCall (/Users/user/github.com/dapphub/dapp/libexec/dapp/dapp-quicktest:277:44)
    at formatTrace (/Users/user/github.com/dapphub/dapp/libexec/dapp/dapp-quicktest:292:152)
    at Array.forEach (<anonymous>)
    at failedTest.results.forEach.x (/Users/user/github.com/dapphub/dapp/libexec/dapp/dapp-quicktest:214:43)
    at Array.forEach (<anonymous>)
    at printFailure (/Users/user/github.com/dapphub/dapp/libexec/dapp/dapp-quicktest:214:22)
make: *** [test] Error 1

UnrecognizedOpcode 253

In ds-prism, running dapp test results in the following output (compiler warnings excised because there are a ridiculous number of them):

Running 3 tests for src/prism.t.sol:DSPrismTest
F    ("pc", 2242)
    [0, 0, 164, 2835717307,
     298192886521647882987772407183235585632235479407, 164, 177362148]
    Just (OpUnknown 253)
    fromList []
    0
    Just "token.transfer(uLarge, 400 ether)"
Just (VMFailure (UnrecognizedOpcode 253))
F    ("pc", 2242)
    [0, 0, 164, 2835717307,
     298192886521647882987772407183235585632235479407, 164, 177362148]
    Just (OpUnknown 253)
    fromList []
    0
    Just "token.transfer(uLarge, 400 ether)"
Just (VMFailure (UnrecognizedOpcode 253))
F    ("pc", 2242)
    [0, 0, 164, 2835717307,
     298192886521647882987772407183235585632235479407, 164, 177362148]
    Just (OpUnknown 253)
    fromList []
    0
    Just "token.transfer(uLarge, 400 ether)"
Just (VMFailure (UnrecognizedOpcode 253))

+ solc --link --libraries '' out/DSAuth.bin out/DSAuthEvents.bin out/DSAuthority.bin out/DSMath.bin out/DSNote.bin out/DSPrism.bin out/DSPrismTest.bin out/DSStop.bin out/DSTest.bin out/DSThing.bin out/DSTokenBase.bin out/DSToken.bin out/ERC20.bin out/PrismUser.bin
+ dapp quicktest out
Secp256k1 bindings are not compiled. Pure JS implementation will be used.
Trying DSPrismTest...
F.

  [CRASH] test_basic_sanity
                       -> <DSPrismTest#d289>.setUp() => BadInstruction
    <DSPrismTest#d289> ->   new DSToken(...) => <DSToken#f0b2>
    <DSPrismTest#d289> ->   <DSToken#f0b2>.mint(100 ether) => ()
    <DSPrismTest#d289> ->   new DSPrism(...) => <DSPrism#b48c>
    <DSPrismTest#d289> ->   new PrismUser(...) => <PrismUser#01a3>
    <DSPrismTest#d289> ->   new PrismUser(...) => <PrismUser#3cc7>
    <DSPrismTest#d289> ->   new PrismUser(...) => <PrismUser#523b>
    <DSPrismTest#d289> ->   <DSToken#f0b2>.transfer(<1a3d>, 400 ether) => BadInstruction

1 tests passed, 1 failed
Took 0.111s

This is with solc 0.4.13+commit.0fb4cb1a.Linux.g++ and using the version of dapp in Nix.

"dapp build" outputs bin/abi files in many subdirectories, not just one

Source directory structure

dapp build

Output directory structure

As you can see, there are many files that are repeated over and over in many subdirs of the output directory, but not so in the source directory.

My guess is that this happens when a contract in a subdir imports a file from another directory, but this could be wrong.

I suppose the relevant code is here?

One way to fix this is to just prune the extra files in out/ afterwards, so that the trees look identical (dropping the .bin, .sol, etc. suffix, of course).

Let me know what you guys think!

create single .sol file

Compile all libs / sources into a single .sol file. Would be useful for e.g. etherscan verification and anything else that can't deal with multi-file sources.

Unable to run tests when unused library in subdirectory

If I have a library in a subdirectory of src (e.g. src/exchange/adapters/fakeLib.sol) that I do not import anywhere else, then when running dapp test it fails.

Output:

+ dapp quicktest out out/FakeLib.bin out/simpleAdapter.bin out/rewards.bin out/safeMath.bin
Secp256k1 bindings are not compiled. Pure JS implementation will be used.
fs.js:652
  return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
                 ^

Error: ENOENT: no such file or directory, open 'out/FakeLib.bin'
    at Object.fs.openSync (fs.js:652:18)
    at Object.fs.readFileSync (fs.js:553:33)
    at readBytes (/home/travis/prg/dapp/libexec/dapp/dapp-quicktest:103:29)
    at Array.map (<anonymous>)
    at Object.<anonymous> (/home/travis/prg/dapp/libexec/dapp/dapp-quicktest:104:39)
    at Module._compile (module.js:573:30)
    at Object.Module._extensions..js (module.js:584:10)
    at Module.load (module.js:507:32)
    at tryModuleLoad (module.js:470:12)
    at Function.Module._load (module.js:462:3)

For now the easiest thing for me to do is just move the unused library to another directory, but we will want it back at some point.

I'm guessing this happens because the build step doesn't put the library in the root out/ directory?

Importing contracts from OpenZeppelin

My contract imports from Open Zeppelin's StandardToken.sol

I managed to install zeppelin-solidity with:

$ dapp install OpenZeppelin/zeppelin-solidity

I does create a git submodule under the lib directory. But dapp test fails:

dapp test
fatal: Cannot change to 'lib/zeppelin-solidity/src': No such file or directory
child_process.js:495
    throw err;
    ^

Error: Command failed: git -C lib/zeppelin-solidity/src rev-parse HEAD
fatal: Cannot change to 'lib/zeppelin-solidity/src': No such file or directory

    at checkExecSyncError (child_process.js:472:13)
    at Object.execFileSync (child_process.js:492:13)
    at run (/nix/store/5brad209b8d92y2cv32fy72pklx4q2qw-dapp-0.7.9/libexec/dapp/dapp-remappings:57:35)
    at ls.forEach.name (/nix/store/5brad209b8d92y2cv32fy72pklx4q2qw-dapp-0.7.9/libexec/dapp/dapp-remappings:28:16)
    at Array.forEach (native)
    at findRemappings (/nix/store/5brad209b8d92y2cv32fy72pklx4q2qw-dapp-0.7.9/libexec/dapp/dapp-remappings:18:50)
    at Object.<anonymous> (/nix/store/5brad209b8d92y2cv32fy72pklx4q2qw-dapp-0.7.9/libexec/dapp/dapp-remappings:5:1)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)

I seems to expect a src directory inside zeppelin-solidity but it doesn't exist.

is there a way to make this work or do I have to go back to Truffle?

FR: Add Event Listener

An event listener this is necessary for dapp to be "feature complete."
It would be nice to be able to do this from dapp rather than having to flip to a different cli window to run my own event listener.

dh init - not very helpful printout

cat cat cat, pwd

ipfs-rent-contracts nikolai$ dh init
+ git init
Initialized empty Git repository in /Users/nikolai/ipfs-rent-contracts/.git/
+ cat
+ cat
+ cat
+++ pwd
++ basename /Users/nikolai/ipfs-rent-contracts
+ mkdir -p lib src
+ dh save /usr/local/libexec/dh/dh-init
+ git add -A
+ git commit -m 'dh-init '

package doesn't exist

In the docs, it says to install dapp install apmilen/my-cool-package. However, that repo does not exist.

More `dapp help`

It'd be nice if dapp could give the the user some idea of how to use it. Right now dapp help just prints

Usage: dapp <command> [<args>...]

Having something more in line with git help would be nice.

Solc version is old

Hi,

I have the following problem with compiling my *.sol files under dockerized dapp coming from the master branch:

+ dapp clean
+ rm -rf out
+ solc --overwrite ds-test/=lib/ds-test/src/ ds-test=lib/ds-test/src/index.sol ds-token/=lib/ds-token/src/ ds-token=lib/ds-token/src/index.sol erc20/=lib/ds-token/lib/erc20/src/ erc20=lib/ds-token/lib/erc20/src/index.sol ds-math/=lib/ds-token/lib/ds-math/src/ ds-math=lib/ds-token/lib/ds-math/src/index.sol ds-stop/=lib/ds-token/lib/ds-stop/src/ ds-stop=lib/ds-token/lib/ds-stop/src/index.sol ds-auth/=lib/ds-token/lib/ds-stop/lib/ds-auth/src/ ds-auth=lib/ds-token/lib/ds-stop/lib/ds-auth/src/index.sol ds-note/=lib/ds-token/lib/ds-stop/lib/ds-note/src/ ds-note=lib/ds-token/lib/ds-stop/lib/ds-note/src/index.sol --abi --bin --bin-runtime = -o out src/Token.sol
lib/ds-token/lib/ds-math/src/math.sol:12:1: Error: Source file requires different compiler version (current compiler is 0.4.11+commit.68ef5810.Linux.g++ - note that nightly builds are considered to be strictly less than the released version
pragma solidity ^0.4.13;
^----------------------^
lib/ds-token/lib/ds-stop/lib/ds-auth/src/auth.sol:12:1: Error: Source file requires different compiler version (current compiler is 0.4.11+commit.68ef5810.Linux.g++ - note that nightly builds are considered to be strictly less than the released version
pragma solidity ^0.4.13;
^----------------------^
lib/ds-token/lib/ds-stop/lib/ds-note/src/note.sol:12:1: Error: Source file requires different compiler version (current compiler is 0.4.11+commit.68ef5810.Linux.g++ - note that nightly builds are considered to be strictly less than the released version
pragma solidity ^0.4.13;
^----------------------^
lib/ds-token/lib/ds-stop/src/stop.sol:12:1: Error: Source file requires different compiler version (current compiler is 0.4.11+commit.68ef5810.Linux.g++ - note that nightly builds are considered to be strictly less than the released version
pragma solidity ^0.4.13;
^----------------------^
lib/ds-token/src/base.sol:12:1: Error: Source file requires different compiler version (current compiler is 0.4.11+commit.68ef5810.Linux.g++ - note that nightly builds are considered to be strictly less than the released version
pragma solidity ^0.4.13;
^----------------------^
lib/ds-token/src/token.sol:12:1: Error: Source file requires different compiler version (current compiler is 0.4.11+commit.68ef5810.Linux.g++ - note that nightly builds are considered to be strictly less than the released version
pragma solidity ^0.4.13;
^----------------------^
src/TrustToken.sol:1:1: Error: Source file requires different compiler version (current compiler is 0.4.11+commit.68ef5810.Linux.g++ - note that nightly builds are considered to be strictly less than the released version
pragma solidity ^0.4.13;
^----------------------^

dapp clone only uses git protocol

dapp clone is only useful if you have an ssh key configured for github. Maybe a param to use https? or default to https if ssh fails?

Ability to choose different Solidity versions

I'm working on this already!

Why we should have this feature

It's often useful to switch between versions of environments, which is why other languages have tools like rbenv and virtualenv.

One obvious use is to build and test one's library or program with several different versions, which gives useful information.

E.g. when making a change to Dappsys, we would want to check for compiler compatibility.

So I imagine doing for example

$ dapp use solc:0.4.9 -- build test

where dapp use takes a number of package specifications and another subcommand, and runs the latter with the former in its environment.

It would also be easy to allow

$ dapp version-matrix

which would generate an output like

solc v0.4.9 fail
solc v0.4.10 pass
solc v0.4.11 pass

etc.

Why we should use Nix

Nix makes it easy to define many versions of packages, because you can define a function that returns a package, and then you just make the version a parameter.

Nix is also a robust, clean, and beautiful system! If any system has a claim on being a possible solution to the problem of package management, I think it's Nix.

We're maintaining the Solidity compiler package in Nix, and I've just defined packages for all solc versions from 0.4.9 to 0.4.16. They all compiled on Linux and are in the binary cache, so users won't have to compile them. I'm compiling them on OS X right now, but I think it will take all night.

Nix handles external dependencies extremely well. For example, it was trivial to add z3 to the environment of solc when they added this integration in 0.4.16, and this dependency is invisible to the end-user, unless they choose to install z3 explicitly. So if future Solidity versions get other dependencies, we'll be able to handle it in a clean way that doesn't leave junk on the user's system at all.

(The entire Nix system can be nuked from a (non-NixOS) computer by doing rm -rf /nix.)

Which versions to support

The version 0.4.9 is the first one with a particular input/output syntax that hsevm assumes for loading the .sol.json files. I'm not sure if dapp itself would work with previous versions. Anyway, at some point in the 0.3 versions the build system changed, and I don't think there's any reasonable need to compile with such old versions, so a 0.4.9 cutoff seems reasonable.

Design of dapp feature

Technically, it might look like

  • a Nix check that can
    • check that Nix is installed and
    • ask about running the automatic Nix installer;
  • a Nix subcommand that can run dapp recursively inside of a nix-shell; and
  • a Nix helper that can
    • update the DappHub Nix channel and
    • upgrade all installed DappHub packages.

dapp create errors when contract in src/subdir

Calling something like:

# dapp create SimpleMarket --from $ADDRESS_1                   # this can't find anything
dapp create exchange/thirdparty/SimpleMarket --from $ADDRESS_1 # this is my 2nd guess

gives:

+ seth send --create out/exchange/thirdparty/SimpleMarket.bin 'exchange/thirdparty/SimpleMarket
()' --from 0x0015248b433a62fb2d17e19163449616510926b6                                          
seth-send: warning: `ETH_GAS' not set; using default gas amount                                
<stdin>:1:55: Error: Expected token LParen got 'Div'                                           
pragma solidity ^0.4.8; contract A { function exchange/thirdparty/SimpleMarket() public; } 

which seems to be due to the / delimiter.
My first guess is to do something like this, and find the contract by its filename. Does this make sense?

"working changes" detection doesn't work w/ submodules

You can commit your submodules and then git stash, and you'll still be blocked due to untracked content:

On branch master
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)
  (commit or discard the untracked or modified content in submodules)

	modified:   lib/ds-auth (untracked content)

nix install error

nikolai@thinkpod:~$ nix-env -iA dapphub.{dapp,seth,hevm,evmdis}
error: getting status of ‘/nix/store/i2h5pblgj748adny10bqhz3y060rnkrv-dapphub/dapphub/overlay/upstream/stable/dapp.nix’: No such file or directory

The directory exists all the way up to stable, the .nix just isn't there after following instructions on dapp.tools

testFail doesn't pass on throw

Hi all. I'm really sorry if this is pilot error. I'm brand new to using dapp. I just installed it and planned to test a few sample contracts.

I'm on:

  • Lubuntu 16.04.2 LTS (64-bit)
  • node v7.9.0
  • dapp (commit a75a4bd)
  • ethrun v0.2.1

Basically, everything is brand new.. and there were no problems installing dapp or any of its dependencies.

dapp init includes a test contract, and performs a sanity check:

pragma solidity ^0.4.8;

import "ds-test/test.sol";

contract Test is DSTest {
    function test_basic_sanity() {
        assert(true);
    }

    function testFail_basic_sanity() {
        assert(false);
    }
}

..but I'm seeing testFail_basic_sanity fail:

$ cd ~/my_dapp
$ dapp init

+ git init
Initialized empty Git repository in ~/my_dapp/.git/
+ mkdir -p lib src
+ git add .gitignore
+ git add Makefile
+ git add Dappfile
+ git add src/test.sol
+ git commit -m 'dapp-init my_dapp'
[master (root-commit) 60d0b52] dapp-init my_dapp
 4 files changed, 22 insertions(+)
 create mode 100644 .gitignore
 create mode 100644 Dappfile
 create mode 100644 Makefile
 create mode 100644 src/test.sol
+ dapp install ds-test
+ git submodule add --force https://github.com/dapphub/ds-test lib/ds-test
Cloning into 'lib/ds-test'...
+ git submodule update --init --recursive
+ git commit -m 'dapp-install dapphub/ds-test'
[master 4e28a0e] dapp-install dapphub/ds-test
 2 files changed, 4 insertions(+)
 create mode 100644 .gitmodules
 create mode 160000 lib/ds-test
+ make test
dapp test
+ dapp clean
+ rm -rf out
+ solc --overwrite --abi --bin --bin-runtime = -o out ds-test=lib/ds-test/src src/test.sol
Trying Test...
.F

  [NOFAIL] testFail_basic_sanity
    (no details)

1 tests passed, 1 failed
Took 0.507s
Makefile:2: recipe for target 'test' failed
make: *** [test] Error 1

Test with ETH

Hi, I am wondering: anyways to test a function requiring a fee to be paid?
Thanks.

Kernel freeze on OS X High Sierra (Nix)

Sadly, Nix breaks the kernel on High Sierra, because of a bug Apple introduced and will hopefully fix.

This results in freezes and kernel panics when installing Nix packages!

The workaround is to use Nix in "single user mode" rather than using the Nix daemon.

Here's how to switch, after you've installed Nix:

sudo launchctl unload /Library/LaunchDaemons/org.nixos.nix-daemon.plist
sudo launchctl stop org.nixos.nix-daemon
sudo chown -R $(whoami) /nix
sudo sed -i /build-users-group/d /etc/nix/nix.conf
echo "export NIX_REMOTE=" >> ~/.bashrc

After that, the Nix commands should work again.

'dapp' workflow for moving from Solidity to frontend (web3.js) development..

@nmushegian
@dbrock
@apmilen

Hi all. Not sure if this would be of any interest to you..

Quick bit of context,
I've recently begun experimenting with the available tools for Dapp development.
Imho, when developing Solidity contracts.. the test harness in dapp is absolutely the best tool to use.

There seemed (to me) to be a bit of a gap in the dapp toolchain..
when one wants to move from developing Solidity contracts,
to using those compiled contracts to develop a frontend Dapp (ui).

I was playing around and experimenting over the past few days, and in doing so..
I kind of accidentally wrote 2 tools that compliment the dapp toolchain quite nicely,
and help to bridge that gap.

Today, I released the code for both projects to both github and npm.

github:

npm:

I have no idea if either of these tools would be of any interest or benefit to anyone else.
But, I just wanted to quickly make you all aware of their existence.
Hope you like!

  • Warren :)

Infinite loop if libexec/seth is not available

Recreate:

mkdir thing && cd thing
dapp init
make all
make deploy # just calls "dapp create Thing"

Output:

bash: warning: shell level (1000) too high, resetting to 1

(over and over)

Running:

linux 4.12.8-2-ARCH
zsh (inside tmux)

"out" subdirectories not getting created

you need a -p flag (or equivalent for create) somewhere...

ds-token nikolai$ dapp make
+ solc --abi --bin --bin-runtime = -o src.out ds-auth=lib/ds-auth/src erc20=lib/erc20/src src/base.sol
Exception during output generation: /tmp/solidity-20170131-42632-cnr5do/solidity_0.4.9/solc/CommandLineInterface.cpp(469): Throw in function void dev::solidity::CommandLineInterface::createFile(const string &, const string &)
Dynamic exception type: boost::exception_detail::clone_impl<dev::FileError>
std::exception::what: FileError
[dev::tag_comment*] = Could not write to file: src.out/lib/erc20/src/erc20.sol:ERC20.bin-runtime

tests fail with "Bad Instruction" error.

I ran into this while writing tests for ds-proxy. One of the tests for ds-proxy looks like this.

 function test_DSProxyExecuteProc() {

	//test contract bytecode
	bytes memory testCode = hex"60606040523415600b57fe5b5b609e8061001a6000396000f30060606040526000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630bcd3b3314603a575bfe5b3415604157fe5b60476065565b60405180826000191660001916815260200191505060405180910390f35b6000600160010290505b905600a165627a7a72305820cd1ba858674bd634c7ab2f54a43d025c7a9beedd22fc041d57777bb481c6a23e0029";

	//function identifier for getBytes()(bytes32)
	bytes memory calldata = hex"0bcd3b33";

	bytes32 response = proxy.execute(testCode, calldata);

	assertEq(response, bytes32(0x1));
}

Running dapp test:

[CRASH] test_DSProxyExecuteProc Dapple -> <DSProxyTest#d289>.test_DSProxyExecuteProc() => BadInstruction

However then I create this test as a function in its own contract.

pragma solidity ^0.4.8;
import "./proxy.sol";
contract foo {

function trigger(address p) returns (bytes32) {

	DSProxy proxy = DSProxy(p);

	//test contract bytecode
	bytes memory testCode = hex"60606040523415600b57fe5b5b609e8061001a6000396000f30060606040526000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630bcd3b3314603a575bfe5b3415604157fe5b60476065565b60405180826000191660001916815260200191505060405180910390f35b6000600160010290505b905600a165627a7a72305820cd1ba858674bd634c7ab2f54a43d025c7a9beedd22fc041d57777bb481c6a23e0029";

	//function identifier for getBytes()(bytes32)
	bytes memory callData = hex"0bcd3b33";
	
	bytes32 response = proxy.execute(testCode, callData);
	return response;
}
}

Now when I call: seth send <FooContractAddr> "trigger(address)(bytes32)" <ProxyContractAddr>

It works and returns 0x1 correctly. You can also check the foo contract on etherscan to see that the transaction ran successfully.

How to test modifiers?

lets say I have:

    modifier onlyOwner {
        if (msg.sender != owner) throw;
        _;
    }

How do I test it with ds-test framework?

Add dapp --help

Every *nix tool usually has --help option to see how to use it without going into the internet.

solc not finding sources

ds-token nikolai$ dapp build
+ solc --abi --bin --bin-runtime = -o out ds-auth=lib/ds-auth/src ds-test=lib/ds-test/src erc20=lib/erc20/src src/base.sol
Skipping non-existent input file ""src/base.sol""
+ solc --abi --bin --bin-runtime = -o out ds-auth=lib/ds-auth/src ds-test=lib/ds-test/src erc20=lib/erc20/src src/base.t.sol
Skipping non-existent input file ""src/base.t.sol""
+ solc --abi --bin --bin-runtime = -o out ds-auth=lib/ds-auth/src ds-test=lib/ds-test/src erc20=lib/erc20/src src/rules.sol
Skipping non-existent input file ""src/rules.sol""
+ solc --abi --bin --bin-runtime = -o out ds-auth=lib/ds-auth/src ds-test=lib/ds-test/src erc20=lib/erc20/src src/token.sol
Skipping non-existent input file ""src/token.sol""

ds-token nikolai$ solc --version
solc, the solidity compiler commandline interface
Version: 0.4.8+commit.60cc1668.mod.Linux.g++

Multiple dependencies causing remappings error

Hi, I found a small bug while installing multiple ds- dependencies.
Please find here the commands to deploy a testing repo:

cd <directory>
dapp init
dapp install ds-math
dapp install ds-token
dapp install ds-auth

And now, here is the bug:

dapp test

Which gives

+ dapp clean
+ rm -rf out
dapp-remappings: error: mismatching packages:
dapp-remappings: error: (1) lib/ds-auth/lib/ds-test/src
dapp-remappings: error: (2) lib/ds-math/lib/ds-test/src

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.