2

I'm writing a contract for arbitrary-length integer arithmetic, for use in a larger project.

The problem is that once the contract gets above a certain size, the Python ethereum.tester.state().abi_contract() test environment begins giving this stack trace:

Traceback (most recent call last):
  File "se_bigint.py", line 5, in <module>
    bigint = s.abi_contract('bigint.se')
  File "/home/ada/mypy/local/lib/python2.7/site-packages/ethereum/tester.py", line 166, in abi_contract
    assert len(self.block.get_code(address), "Contract code empty")
AssertionError: Contract code empty

Here's a pastebin of code that works: http://pastebin.com/1KppMmRx

And here's a pastebin that reproduces the error: http://pastebin.com/qq7mcLeM

Note that the only difference between them is some meaningless busywork added to one of the contract functions. Also note that both contracts successfully compile via "serpent compile bigint.se". I see this both on the PyPI release and on the current github develop branch.

I'd have asked this on the ethereum forum, but I seem to be stuck in account verification over there.

Does anyone know what might be causing this, or how to get around it?

1

Are you supplying enough gas for deployment? Before homestead, contracts can deploy without code if you run out of gas during deployment.

  • 1
    Ah, that's what I was missing. For those of you who read this in the future: try state.abi_contract("script.se",gas=10000000). If that doesn't work, try increasing the gas further. – Ada Merriweather Mar 5 '16 at 0:40
  • A similar option is: ethereum.tester.gas_limit = 3000000 When increasing the gas, it's still good to stay under the block gas limit, otherwise the test contract as is will not be deployable to mainnet. – eth Mar 5 '16 at 17:28

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.