2

When I am testing the withdraw() method from "WithdrawalContract" from http://solidity.readthedocs.io/en/develop/common-patterns.html using Remix and testrpc, it reported the following error. Testrpc gas limit is set to 0xffffff. Any hint on why does this problem appear?

callback contain no result Error: Error: base fee exceeds gas limit at runCall (/home/chankh/anaconda3/lib/node_modules/ethereumjs-testrpc/build/cli.node.js:88096:17) at /home/chankh/anaconda3/lib/node_modules/ethereumjs-testrpc/build/cli.node.js:11855:24 at replenish (/home/chankh/anaconda3/lib/node_modules/ethereumjs-testrpc/build/cli.node.js:8948:17) at iterateeCallback (/home/chankh/anaconda3/lib/node_modules/ethereumjs-testrpc/build/cli.node.js:8933:17) at /home/chankh/anaconda3/lib/node_modules/ethereumjs-testrpc/build/cli.node.js:8908:16 at /home/chankh/anaconda3/lib/node_modules/ethereumjs-testrpc/build/cli.node.js:11860:13 at /home/chankh/anaconda3/lib/node_modules/ethereumjs-testrpc/build/cli.node.js:74400:16 at replenish (/home/chankh/anaconda3/lib/node_modules/ethereumjs-testrpc/build/cli.node.js:74347:25) at /home/chankh/anaconda3/lib/node_modules/ethereumjs-testrpc/build/cli.node.js:74356:9 at eachLimit (/home/chankh/anaconda3/lib/node_modules/ethereumjs-testrpc/build/cli.node.js:74280:36) at /home/chankh/anaconda3/lib/node_modules/ethereumjs-testrpc/build/cli.node.js:75460:16 at VM.AsyncEventEmitter.emit (/home/chankh/anaconda3/lib/node_modules/ethereumjs-testrpc/build/cli.node.js:74051:3) 

FYI The contract code is

pragma solidity ^0.4.11; contract WithdrawalContract { address public richest; uint public mostSent; mapping (address => uint) pendingWithdrawals; function WithdrawalContract() payable { richest = msg.sender; mostSent = msg.value; } function becomeRichest() payable returns (bool) { if (msg.value > mostSent) { pendingWithdrawals[richest] += msg.value; richest = msg.sender; mostSent = msg.value; return true; } else { return false; } } function withdraw() { uint amount = pendingWithdrawals[msg.sender]; // Remember to zero the pending refund before // sending to prevent re-entrancy attacks pendingWithdrawals[msg.sender] = 0; msg.sender.transfer(amount); } } 

1 Answer 1

2

Have you read this "callback contain no result Error: Error: base fee exceeds gas limit" when call selfdestruct function (using Remix IDE) ?

I suggest to test your contract using MyEtherWallet. The setup is quite simple:

  1. visit https://www.myetherwallet.com/
  2. on the top-right corner, select the dropdown menu and choose "Add Custom Node"
  3. add the IP address and port number where testrpc is running (tipically is http://127.0.0.1:8545)
  4. go to contract tab and insert the contract address (deployed with Remix) and its ABI interface

Now you can interact with your contract.

In your example, I called the witdraw() function with gas limit 30000 and it works.

1
  • Yes it works like a charm. Commented Jul 24, 2017 at 18:00

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.