1

I am using testrpc & truffle to build a test local blockchain. I am getting below exception while I run 'truffle test'.

I even tried to manually set the gas_limit variable in tester.py to 4712388 but still getting the same error.

Could you please help me to resolve this.

Thanks,

BlockGasLimitReached: : 'gaslimit' actual:4712388 target:3141592
ERROR:jsonrpc.manager:API Exception: {'message': ": 'gaslimit' actual:4712388 target:3141592", 'args': (": 'gaslimit' actual:4712388 target:3141592",), 'type': 'BlockGasLimitReached'} 
Traceback (most recent call last):
  File "/home/sarath/.local/lib/python2.7/site-packages/jsonrpc/manager.py", line 108, in _get_responses
    result = method(*request.args, **request.kwargs)
  File "/home/sarath/.local/lib/python2.7/site-packages/testrpc/server.py", line 33, in inner
    return rpc_fn(*args, **kwargs)
  File "/home/sarath/.local/lib/python2.7/site-packages/testrpc/testrpc.py", line 89, in eth_sendTransaction
    return tester_client.send_transaction(**formatted_transaction)
  File "/home/sarath/.local/lib/python2.7/site-packages/eth_tester_client/client.py", line 251, in send_transaction
    self._send_transaction(*args, **kwargs)
  File "/home/sarath/.local/lib/python2.7/site-packages/eth_tester_client/client.py", line 55, in inner
    return client_method(self, *args, **kwargs)
  File "/home/sarath/.local/lib/python2.7/site-packages/eth_tester_client/utils.py", line 119, in inner
    return fn(*bytes_args, **bytes_kwargs)
  File "/home/sarath/.local/lib/python2.7/site-packages/eth_tester_client/client.py", line 213, in _send_transaction
    output = self.evm.send(sender=sender, to=to, value=value, evmdata=data)
  File "/home/sarath/.local/lib/python2.7/site-packages/ethereum/tester.py", line 341, in send
    return self._send(*args, **kwargs)["output"]
  File "/home/sarath/.local/lib/python2.7/site-packages/ethereum/tester.py", line 296, in _send
    (success, output) = processblock.apply_transaction(self.block, transaction)
  File "/home/sarath/.local/lib/python2.7/site-packages/ethereum/processblock.py", line 142, in apply_transaction
    validate_transaction(block, tx)
  File "/home/sarath/.local/lib/python2.7/site-packages/ethereum/processblock.py", line 112, in validate_transaction
    raise BlockGasLimitReached(rp('gaslimit', block.gas_used + tx.startgas, block.gas_limit))
BlockGasLimitReached: : 'gaslimit' actual:4712388 target:3141592

  • For updating the gaslimit in tester.py this might help: ethereum.stackexchange.com/questions/2272/… – eth Nov 21 '16 at 3:48
  • Thanks for your help . I added the below line apply_transaction(block, tx) method in Processor.py, which worked for me. block.gas_limit = 4712388 – Gunner Nov 21 '16 at 16:24
  • Glad it helped. I tried to make the answer clear and feel free to edit it or post your own (and then mark one of them as accepted). Thanks – eth Nov 21 '16 at 21:53
0

The solution was to add

block.gas_limit = 4712388

below the apply_transaction(block, tx) method line in processblock.py.

Like this:

def apply_transaction(block, tx):
    block.gas_limit = 4712388
    validate_transaction(block, tx)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.