Skip to content

OverflowError: integer division result too large for a float in calls.py L194 #149

Description

@hitdavid

When I install and run starter demo, I put a tx hash : 0x4f378f91bf16a26cff104aea5eceaa66c72d128dade84ddb619d40426f9780a0 and got an error report like the output below:

Traceback (most recent call last):
  File "/home/ubuntu/.local/lib/python3.8/site-packages/ethtx/decoders/abi/decoder.py", line 171, in _decode_transaction
    full_decoded_transaction.calls = self.decode_calls(
  File "/home/ubuntu/.local/lib/python3.8/site-packages/ethtx/decoders/abi/decoder.py", line 68, in decode_calls
    return ABICallsDecoder(
  File "/home/ubuntu/.local/lib/python3.8/site-packages/ethtx/decoders/abi/calls.py", line 55, in decode
    calls_tree = self._decode_nested_calls(
  File "/home/ubuntu/.local/lib/python3.8/site-packages/ethtx/decoders/abi/calls.py", line 237, in _decode_nested_calls
    self._decode_nested_calls(
  File "/home/ubuntu/.local/lib/python3.8/site-packages/ethtx/decoders/abi/calls.py", line 237, in _decode_nested_calls
    self._decode_nested_calls(
  File "/home/ubuntu/.local/lib/python3.8/site-packages/ethtx/decoders/abi/calls.py", line 237, in _decode_nested_calls
    self._decode_nested_calls(
  File "/home/ubuntu/.local/lib/python3.8/site-packages/ethtx/decoders/abi/calls.py", line 224, in _decode_nested_calls
    decoded = self.decode_call(
  File "/home/ubuntu/.local/lib/python3.8/site-packages/ethtx/decoders/abi/calls.py", line 194, in decode_call
    value=call.call_value / 10**18,
OverflowError: integer division result too large for a float
Traceback (most recent call last):
  File "ethtxdemo.py", line 18, in <module>
    transaction: DecodedTransaction = ethtx.decoders.decode_transaction('0x4f378f91bf16a26cff104aea5eceaa66c72d128dade84ddb619d40426f9780a0')
  File "/home/ubuntu/.local/lib/python3.8/site-packages/ethtx/ethtx.py", line 67, in decode_transaction
    return self._decoder_service.decode_transaction(chain_id, tx_hash)
  File "/home/ubuntu/.local/lib/python3.8/site-packages/ethtx/decoders/decoder_service.py", line 63, in decode_transaction
    abi_decoded_tx = self.abi_decoder.decode_transaction(
  File "/home/ubuntu/.local/lib/python3.8/site-packages/ethtx/decoders/abi/decoder.py", line 54, in decode_transaction
    full_decoded_transaction = self._decode_transaction(
  File "/home/ubuntu/.local/lib/python3.8/site-packages/ethtx/decoders/abi/decoder.py", line 180, in _decode_transaction
    raise e
  File "/home/ubuntu/.local/lib/python3.8/site-packages/ethtx/decoders/abi/decoder.py", line 171, in _decode_transaction
    full_decoded_transaction.calls = self.decode_calls(
  File "/home/ubuntu/.local/lib/python3.8/site-packages/ethtx/decoders/abi/decoder.py", line 68, in decode_calls
    return ABICallsDecoder(
  File "/home/ubuntu/.local/lib/python3.8/site-packages/ethtx/decoders/abi/calls.py", line 55, in decode
    calls_tree = self._decode_nested_calls(
  File "/home/ubuntu/.local/lib/python3.8/site-packages/ethtx/decoders/abi/calls.py", line 237, in _decode_nested_calls
    self._decode_nested_calls(
  File "/home/ubuntu/.local/lib/python3.8/site-packages/ethtx/decoders/abi/calls.py", line 237, in _decode_nested_calls
    self._decode_nested_calls(
  File "/home/ubuntu/.local/lib/python3.8/site-packages/ethtx/decoders/abi/calls.py", line 237, in _decode_nested_calls
    self._decode_nested_calls(
  File "/home/ubuntu/.local/lib/python3.8/site-packages/ethtx/decoders/abi/calls.py", line 224, in _decode_nested_calls
    decoded = self.decode_call(
  File "/home/ubuntu/.local/lib/python3.8/site-packages/ethtx/decoders/abi/calls.py", line 194, in decode_call
    value=call.call_value / 10**18,
OverflowError: integer division result too large for a float

I think maybe L194

value=call.call_value / 10**18,

could be replaced by

value=Decimal(call.call_value) / 10**18,

and a import should also be added.

I will push a PR soon

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions