Skip to content

eth_call formatter breaks when supplying third argument #1921

@banteg

Description

@banteg

What was wrong?

eth_call supports a third optional argument which overrides state prior to a call. web3.py makes an incorrect assumption there should only be two arguments.

  File "web3/middleware/formatting.py", line 74, in apply_formatters
    response = make_request(method, formatted_params)
  File "web3/middleware/attrdict.py", line 33, in middleware
    response = make_request(method, params)
  File "cytoolz/functoolz.pyx", line 250, in cytoolz.functoolz.curry.__call__
  File "web3/middleware/formatting.py", line 73, in apply_formatters
    formatted_params = formatter(params)
  File "cytoolz/functoolz.pyx", line 250, in cytoolz.functoolz.curry.__call__
  File "eth_utils/decorators.py", line 91, in wrapper
    return ReturnType(result)
  File "eth_utils/applicators.py", line 58, in apply_formatters_to_sequence
    raise IndexError(
IndexError: Too few formatters for sequence: 2 formatters for […]

How can it be fixed?

Make formatter aware of the third option argument for eth_call.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions