EtherSim icon indicating copy to clipboard operation
EtherSim copied to clipboard

EtherSim exception thrown during based truffle test

Open taoeffect opened this issue 8 years ago • 4 comments

Copied from: https://github.com/ConsenSys/truffle/issues/54#issuecomment-156587306


@tcoulter EtherSim from npm still tries to install an outdated secp256k1, causing it to fail:

ethersim/node_modules/ethereumjs-block/node_modules/secp256k1

> [email protected] install /usr/local/lib/node_modules/ethersim/node_modules/ethereumjs-vm/node_modules/secp256k1

The develop copy per your instructions has the correct version and therefore installed, but running truffle test caused it to throw an exception:

-> % ./bin/ethersim -p 8545
EtherSim v0.1.6

Available Accounts
==================
0x1a9dc2ad31f3fdf575479760980b242d073ee149
0xd13493e9d590ba763c202ab4fbe4ab17978cda32
0xbce16ecae7407ac3e852b8d8ea088746e357dc82
0x6d17d3b407ff990279cd852c5fe4805523cdc293
0xba88351daf7a545becf4fccd1555e2750b445c9c
0x7ab301af6a5d37c09b1264d46a42c78288a339ff
0xe0c1976e9e9350986aa942b1176f6d23e0db90f8
0xfb61aa6b35754d8779f989e50e616b0ab4d11662
0x52e18c7cda62b91cbeafd52fbd0561720e2bd804
0xa2d916f6f7490ab9f1aa5e444ef078eb7478b23b

Listening on localhost:8545
eth_accounts
eth_coinbase
eth_sendTransaction
eth_newBlockFilter
eth_getFilterChanges
/Users/greg/Ethereum/frameworks/EtherSim/lib/blockchain.js:313
    queued.callback(err, result);
           ^

TypeError: queued.callback is not a function
    at intermediary (/Users/greg/Ethereum/frameworks/EtherSim/lib/blockchain.js:313:12)
    at /Users/greg/Ethereum/frameworks/EtherSim/lib/blockchain.js:418:7
    at Object.async.eachSeries (/Users/greg/Ethereum/frameworks/EtherSim/node_modules/async-eventemitter/node_modules/async/lib/async.js:130:20)
    at VM.AsyncEventEmitter.emit (/Users/greg/Ethereum/frameworks/EtherSim/node_modules/async-eventemitter/lib/AsyncEventEmitter.js:42:9)
    at afterBlock (/Users/greg/Ethereum/frameworks/EtherSim/node_modules/ethereumjs-vm/lib/runBlock.js:55:10)
    at /Users/greg/Ethereum/frameworks/EtherSim/node_modules/ethereumjs-vm/lib/runBlock.js:179:9
    at /Users/greg/Ethereum/frameworks/EtherSim/node_modules/ethereumjs-vm/lib/cache.js:136:7
    at /Users/greg/Ethereum/frameworks/EtherSim/node_modules/async/lib/async.js:52:16
    at iterate (/Users/greg/Ethereum/frameworks/EtherSim/node_modules/async/lib/async.js:260:24)
    at Object.async.forEachOfSeries.async.eachOfSeries (/Users/greg/Ethereum/frameworks/EtherSim/node_modules/async/lib/async.js:281:9)

truffle test got as far as:

-> % truffle test
Using environment test.
Compiling contracts...


  Contract: Example

taoeffect avatar Nov 14 '15 22:11 taoeffect

@taoeffect I'm not sure why this bug happens, but someone else had the same issue. I've apparently fixed it in the updated version of my branch: https://github.com/tcoulter/EtherSim

tcoulter avatar Nov 18 '15 17:11 tcoulter

@tcoulter Your repo worked! :+1:

-> % ./bin/ethersim -p 8545
EtherSim v0.1.6

Available Accounts
==================
0xfa5a4c531779ba0618771505c006eb13486871d7
0xfe7bfeb846b436b8834f36fdab2aa7ea3c739c00
0x3181d22e19324c839986317335bb635fac944e66
0x63d7263e8eaba5c7dce63a7ae16aebb8631c9cb2
0x87c8a25190af930be1b5ae6a1681359723fa4658
0x9f6fd8409fc85031921040a05acebfabb62372f1
0xe51803062bbba04c287e93c9c67547acddf28231
0x03e4524f27d8183903659407143475f69623af65
0xbb4153beef5db5739c773a1c7ca8753569e55ad5
0x9680a12843f65f273bf7f9853be4ff778ffc1df6

Listening on localhost:8545
eth_accounts
eth_coinbase
eth_sendTransaction

  Contract created: 0x8df8ffd0d296feb9955888e837e9de126a1aaa0d
  Gas usage: 23543

eth_newBlockFilter
eth_getFilterChanges
eth_getTransactionReceipt
eth_getCode
eth_uninstallFilter

Now just to have your changes merged into the official branch. :)

taoeffect avatar Nov 19 '15 23:11 taoeffect

released 0.2.0 with the latest changes

iurimatias avatar Nov 20 '15 03:11 iurimatias

contract.txt

Getting the same error in 0.2.0 using the multiply contract (I ported the test code to nodejs but that shouldn't matter). Test code attached. Output below.

Possibly using a later version of web3 than you?

name: 'ethereum:web3', version: '0.15.1',

eth_newBlockFilter
eth_getFilterChanges
eth_getTransactionReceipt
eth_getCode

  Contract created: 0x07474e1c765fa7e2c190b4a3918176b7e9d8f9a2
  Gas usage: 50579


/home/barkthins/npm-global/lib/node_modules/ethersim/lib/blockchain.js:325
    queued.callback(err, result);
           ^
TypeError: Property 'callback' of object #<Object> is not a function
    at intermediary (/home/barkthins/npm-global/lib/node_modules/ethersim/lib/blockchain.js:325:12)
    at /home/barkthins/npm-global/lib/node_modules/ethersim/lib/blockchain.js:443:7
    at Object.async.eachSeries (/home/barkthins/npm-global/lib/node_modules/ethersim/node_modules/ethereumjs-vm/node_modules/async-eventemitter/node_modules/async/lib/async.js:130:20)
    at VM.AsyncEventEmitter.emit (/home/barkthins/npm-global/lib/node_modules/ethersim/node_modules/ethereumjs-vm/node_modules/async-eventemitter/lib/AsyncEventEmitter.js:42:9)
    at afterBlock (/home/barkthins/npm-global/lib/node_modules/ethersim/node_modules/ethereumjs-vm/lib/runBlock.js:55:10)
    at /home/barkthins/npm-global/lib/node_modules/ethersim/node_modules/ethereumjs-vm/lib/runBlock.js:179:9
[snip]

barkthins avatar Dec 03 '15 22:12 barkthins