Closed stefek99 closed 6 years ago
Thanks, I merge.
Did you have the patience to run it?
I just ran it and it fails:
1) Contract: IICO Test case from the blog: AssertionError: Reimbursement amount not correct: expected 91821152005000000000 to be close to 91805038500000000000 +/- 10000000000000000 at Function.assert.closeTo (C:\Users\Clementine\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\chai\lib\chai\interface\assert.js:1223:1) at Context.it (test\IICO.js:899:12) at
at process._tickCallback (internal/process/next_tick.js:188:7) 2) Contract: IICO Should gracefull handle situation with many participants (over the block gas limit): Error: VM Exception while processing transaction: revert at Object.InvalidResponse (C:\Users\Clementine\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\web3\lib\web3\errors.js:38:1) at C:\Users\Clementine\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\web3\lib\web3\requestmanager.js:86:1 at C:\Users\Clementine\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\truffle-provider\wrapper.js:134:1 at XMLHttpRequest.request.onreadystatechange (C:\Users\Clementine\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\web3\lib\web3\httpprovider.js:128:1) at XMLHttpRequestEventTarget.dispatchEvent (C:\Users\Clementine\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\xhr2\lib\xhr2.js:64:1) at XMLHttpRequest._setReadyState (C:\Users\Clementine\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\xhr2\lib\xhr2.js:354:1) at XMLHttpRequest._onHttpResponseEnd (C:\Users\Clementine\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\xhr2\lib\xhr2.js:509:1) at IncomingMessage.
(C:\Users\Clementine\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\xhr2\lib\xhr2.js:469:1) at endReadableNT (_stream_readable.js:1054:12) at _combinedTickCallback (internal/process/next_tick.js:138:11) at process._tickCallback (internal/process/next_tick.js:180:9)
It may be because of truffle update which now count gas and make things slower.
@stefek99 Can you look at this?
truffle test ./test/StressFinalize.js
I'm running it now, will finish in about 30 minutes...
truffle version
Truffle v4.1.8 (core: 4.1.8)
Solidity v0.4.23 (solc-js)
(might be a good idea to increase closeTo
tolerance to 0.3 ether
maybe)
I'm with the new truffle version, that may be the difference.
No way, I've updated recently!
ganache-cli --verion
Ganache CLI v7.0.0-beta.0 (ganache-core: 3.0.0-beta.0)
Your screenshot still display ms. Mine now display the gas used.
Are you at "truffle@4.1.11" ?
No way, I've updated recently!
That's ganache
(testrpc
). You need to update truffle
too.
npm update -g truffle
/Users/zen/.nvm/versions/node/v9.5.0/bin/truffle -> /Users/zen/.nvm/versions/node/v9.5.0/lib/node_modules/truffle/build/cli.bundled.js
+ truffle@4.1.11
removed 11 packages and updated 10 packages in 4.335s
truffle version
Truffle v4.1.11 (core: 4.1.11)
Solidity v0.4.24 (solc-js)
Sh!t, it is failing now:
Yeah, it's seems that the new truffle version is breaking stuff.
truffle test ./test/StressFinalize.js
- works...
truffle test
- sometimes fails, sometimes works...
See #33
Moved to a new folder so that truffle test
does not take forever.
Intermittent failure, really tricky to debug.
@stefek99 @clesaege
I suggest using evm_increaseTime
to avoid having to wait so much.
It's not about increasing time.
It's about running 5000 * 2 transactions so that finalize takes more than gasLimit of the block.
@stefek99
You can set your own block gas limit. ganache-cli --gasLimit X
Cannot set gasLimit on the mainnet.
See #26
I know!
Set lower gasLimit, start testrpc manually.
Then we will hit it in 10 seconds, not half an hour...
Thanks for suggestions!
I won’t be investing more time on this issue unless explicitly instructed, I’m more interested in baking in affiliate / referral / commission to align incentives of participants as well as the core team when promoting the IICO.
Some new lessons learned:
Maybe there is a dynamic block gas limit somewhere, potentially?
testrpc -a 15 --gasLimit 6000000 --gasPrice 10000000000
StackOverflow question: https://ethereum.stackexchange.com/questions/48413/truffle-test-how-to-get-more-than-10-accounts
It needs to have matching truffle.js
config:
module.exports = {
networks: {
development: {
host: "localhost",
port: 8545,
network_id: "*", // Match any network id
gas: 6000000
}
}
};
Without gas: 6000000
it will complain:
Exceeds block gas limit
This issue was helpful - https://github.com/trufflesuite/truffle/issues/660 - figured out I need to explicitly define config.
eth_getTransactionByHash
vs eth_getTransactionReceipt
There is a difference if you want to get gas used by a transaction: https://ethereum.stackexchange.com/questions/8603/gas-and-gas-used-by-transaction-and-how-to-get-both-values-through-json-rpc
Added a helper for my personal use:
getTransaction: hash => {
console.log("getTransaction");
return web3.currentProvider.send({jsonrpc: "2.0", method: "eth_getTransactionReceipt", params: [hash]})
},
Output of the test: https://pastebin.com/XYQ51F0a
I left
console.log
statements on purpose so that it is possible to observe what's going on, feel free to remove as you see fit.It is send to a file, otherwise on error there were too many
Events
emitted and couldn't scroll the console.