functionalfoundry / ethereum-htlc

HTLC for doing cross-chain atomic swaps
MIT License
7 stars 2 forks source link

Error: Error: Exceeds block gas limit #6

Open drandreaskrueger opened 6 years ago

drandreaskrueger commented 6 years ago
git clone https://github.com/functionalfoundry/ethereum-htlc
cd ethereum-htlc/
sudo npm i -g ethereumjs-testrpc truffle

testrpc --account="0x22e2ba90f06cb8ba247347e2eff9a3488f71ff76c7110672e117ecb228be80b6,100000000000000000000" --account="0x1b79656d6bd43e7cfd1669885ff8826ba6fb8d8b5d5b16e7fc41c2812ccdbf8d,100000000000000000000"

then in 2nd terminal

npm install
truffle test

Compiling ./contracts/HTLC.sol...
Compiling ./contracts/Migrations.sol...
Compiling zeppelin-solidity/contracts/ReentrancyGuard.sol...

Compilation warnings encountered:

.../ethereum-htlc/contracts/HTLC.sol:35:5: Warning: No visibility specified. Defaulting to "public".
    function HTLC (address _recipient, bytes32 _image, uint _expirationTime) payable {
    ^
Spanning multiple lines.
,.../ethereum-htlc/contracts/Migrations.sol:14:5: Warning: No visibility specified. Defaulting to "public".
    function Migrations() {
    ^
Spanning multiple lines.
,.../ethereum-htlc/contracts/Migrations.sol:18:5: Warning: No visibility specified. Defaulting to "public".
    function setCompleted(uint completed) restricted {
    ^
Spanning multiple lines.
,.../ethereum-htlc/contracts/Migrations.sol:22:5: Warning: No visibility specified. Defaulting to "public".
    function upgrade(address newAddress) restricted {
    ^
Spanning multiple lines.
,.../ethereum-htlc/contracts/HTLC.sol:113:5: Warning: Function state mutability can be restricted to pure
    function hash (bytes32 _preimage) internal returns (bytes32 _image) {
    ^
Spanning multiple lines.

Error: Error: Exceeds block gas limit
    at StateManager.queueTransaction (/usr/lib/node_modules/ethereumjs-testrpc/build/cli.node.js:84915:21)
    at GethApiDouble.eth_sendTransaction (/usr/lib/node_modules/ethereumjs-testrpc/build/cli.node.js:84423:14)
    at GethApiDouble.handleRequest (/usr/lib/node_modules/ethereumjs-testrpc/build/cli.node.js:84222:10)
    at next (/usr/lib/node_modules/ethereumjs-testrpc/build/cli.node.js:53732:18)
    at GethDefaults.handleRequest (/usr/lib/node_modules/ethereumjs-testrpc/build/cli.node.js:84119:12)
    at next (/usr/lib/node_modules/ethereumjs-testrpc/build/cli.node.js:53732:18)
    at FilterSubprovider.handleRequest (/usr/lib/node_modules/ethereumjs-testrpc/build/cli.node.js:60186:7)
    at next (/usr/lib/node_modules/ethereumjs-testrpc/build/cli.node.js:53732:18)
    at DelayedBlockFilter.handleRequest (/usr/lib/node_modules/ethereumjs-testrpc/build/cli.node.js:83947:3)
    at next (/usr/lib/node_modules/ethereumjs-testrpc/build/cli.node.js:53732:18)
    at Object.InvalidResponse (/usr/lib/node_modules/truffle/build/cli.bundled.js:43303:16)
    at /usr/lib/node_modules/truffle/build/cli.bundled.js:331156:36
    at /usr/lib/node_modules/truffle/build/cli.bundled.js:175492:11
    at /usr/lib/node_modules/truffle/build/cli.bundled.js:314196:9
    at XMLHttpRequest.request.onreadystatechange (/usr/lib/node_modules/truffle/build/cli.bundled.js:315621:13)
    at XMLHttpRequestEventTarget.dispatchEvent (/usr/lib/node_modules/truffle/build/cli.bundled.js:70159:18)
    at XMLHttpRequest._setReadyState (/usr/lib/node_modules/truffle/build/cli.bundled.js:70449:12)
    at XMLHttpRequest._onHttpResponseEnd (/usr/lib/node_modules/truffle/build/cli.bundled.js:70604:12)
    at IncomingMessage.<anonymous> (/usr/lib/node_modules/truffle/build/cli.bundled.js:70564:24)
    at emitNone (events.js:91:20)

testrpc log shows this:

testrpc --account="0x22e2ba90f06cb8ba247347e2eff9a3488f71ff76c7110672e117ecb228be80b6,100000000000000000000" --account="0x1b79656d6bd43e7cfd1669885ff8826ba6fb8d8b5d5b16e7fc41c2812ccdbf8d,100000000000000000000"
EthereumJS TestRPC v6.0.1 (ganache-core: 2.0.0)

Available Accounts
==================
(0) 0x1a8846ed58ce1baa0e4e6d90db65cef69ec488b1
(1) 0x53789c18f50a025e65076dc6d95320f8bee544b1

Private Keys
==================
(0) 22e2ba90f06cb8ba247347e2eff9a3488f71ff76c7110672e117ecb228be80b6
(1) 1b79656d6bd43e7cfd1669885ff8826ba6fb8d8b5d5b16e7fc41c2812ccdbf8d

Listening on localhost:8545
net_version
eth_accounts
eth_accounts
eth_accounts
net_version
net_version
eth_sendTransaction

versions:

npm --version; node --version; truffle version; testrpc version | grep TestRPC
3.10.10
v6.11.4
Truffle v4.0.1 (core: 4.0.1)
Solidity v0.4.18 (solc-js)
EthereumJS TestRPC v6.0.1 (ganache-core: 2.0.0)
^C
drandreaskrueger commented 6 years ago

solved, by adding

, gas: 4600000

to truffle.js, as suggested here