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); } }