I'm trying to simulate the DAO attack for a research project I'm working on. I have truffle and testrpc setup on my machine. I use the sample code given in this tutorial. I try calling the BankAttack and Bank contracts like this in my test:

Bank b = new Bank(); 
BankAttacker ba = new BankAttacker(b, true);

This results in the following error:

 Error: VM Exception while processing transaction: invalid JUMP at a83375170c16ea0d52be723b5199aa8f0586bf83a8a5b199e86f1b3f0f2af1a6/f61c4b7d1e355565abdfd25e23438aa8d48c93e2:276
  at Object.InvalidResponse (/usr/local/lib/node_modules/truffle/node_modules/truffle-contract/node_modules/web3/lib/web3/errors.js:38:16)
  at /usr/local/lib/node_modules/truffle/node_modules/truffle-contract/node_modules/web3/lib/web3/requestmanager.js:86:36
  at XMLHttpRequest.request.onreadystatechange (/usr/local/lib/node_modules/truffle/node_modules/web3/lib/web3/httpprovider.js:118:13)
  at XMLHttpRequestEventTarget.dispatchEvent (/usr/local/lib/node_modules/truffle/node_modules/xhr2/lib/xhr2.js:64:18)
  at XMLHttpRequest._setReadyState (/usr/local/lib/node_modules/truffle/node_modules/xhr2/lib/xhr2.js:354:12)
  at XMLHttpRequest._onHttpResponseEnd (/usr/local/lib/node_modules/truffle/node_modules/xhr2/lib/xhr2.js:509:12)
  at IncomingMessage.<anonymous> (/usr/local/lib/node_modules/truffle/node_modules/xhr2/lib/xhr2.js:469:24)
  at endReadableNT (_stream_readable.js:1054:12)

I've already spent hours trying to debug this. Any help would be appreciated.

1 Answer 1


I, and a lot of people on here, have been having issues when using “new()” to run tests with truffle.

I would use the truffle deployer, you might want to look up documentation for this, but here is something quick off my head:

deployer.deploy(Bank).then(function(){ deployer.deploy(BankAttacker,Bank.address, true).then(function(){ BankAttackerInstance.deposit(); }); });

That being said, I think your problem is with new BankAttacker(b, ...

I think you will want something like b.address, if you are passing the address to the BankAttacker function.

Hopefully this helps you out. It might help to post more code next time.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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