Repository: ethereum/web3.py (python)

Issue:
construct_event_filter_params improperly formats addresses as lists of lists
### What happened?

called `event.get_logs(from_block=from_block, to_block=block_current)` with the instantiated parent contract having `address` set to a list of addresses. 

This raised an exception about address validity. It shouldn't have.

### Code that produced the error

```python
contract = contract_factory.ServiceNodeContribution(address[0])
NewContribution = contract.events.NewContribution
NewContribution.address = address
for recent in await NewContribution.get_logs(from_block=from_block, to_block=block_current):
    print(recent)
```

### Full error output

```shell
Traceback (most recent call last):
  File "src/app_events.py", line 19, in <module>
    init_ws_event_scanner(config)
  File "/home/aerilym/git/ssb/src/web3client/event_ws.py", line 516, in init_ws_event_scanner
    asyncio.run(start(config))
  File "/usr/lib/python3.12/asyncio/runners.py", line 194, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/asyncio/runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/asyncio/base_events.py", line 687, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/home/aerilym/git/ssb/src/web3client/event_ws.py", line 512, in start
    await monitor
  File "/home/aerilym/git/ssb/src/web3client/event_ws.py", line 472, in monitor_events
    await scan_past_queued_events(w3)
  File "/home/aerilym/git/ssb/src/web3client/event_ws.py", line 420, in scan_past_queued_events
    for recent in await past_event.event.get_logs(from_block=from_block, to_block=block_current):
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/aerilym/git/sent-staking-backend/.venv/lib/python3.12/site-packages/web3/contract/async_contract.py", line 181, in get_logs
    _filter_params = self._get_event_filter_params(
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/aerilym/git/sent-staking-backend/.venv/lib/python3.12/site-packages/eth_utils/decorators.py", line 29, in _wrapper
    return self.method(obj, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/aerilym/git/sent-staking-backend/.venv/lib/python3.12/site-packages/web3/contract/base_contract.py", line 311, in _get_event_filter_params
    _, event_filter_params = construct_event_filter_params(
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/aerilym/git/sent-staking-backend/.venv/lib/python3.12/site-packages/web3/_utils/filters.py", line 117, in construct_event_filter_params
    for addr in filter_params["address"]:
        ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/aerilym/git/sent-staking-backend/.venv/lib/python3.12/site-packages/web3/_utils/validation.py", line 179, in validate_address
    raise Web3TypeError(f"Address {value} must be provided as a string")
web3.exceptions.Web3TypeError: Address ['0xdA5ba...6763e', '0xFC7880C60...2295122F', '0x36eeDdB5...a71a0698E5B462f299Dec', '0xC212293A2d8255...813cC3FDd7a3ee'] must be provided as a string
```

### Fill this section in if you know how this could or should be fixed

This suggestion is implemented in #3618 

This method internally calls `_get_event_filter_params` which calls `construct_event_filter_params` as such:
contract/base_contract.py:308
```py
_, event_filter_params = construct_event_filter_params(
            abi,
            self.w3.codec,
            contract_address=self.address,
            argument_filters=_filters,
            from_block=from_block,
            to_block=to_block,
            address=self.address,
        )
``` 
By setting `contract_address` and `address` to `self.address` the following code block in `construct_event_filter_params` is executed:
_utils/filters.py:97
```py
if address and contract_address:
        if is_list_like(address):
            filter_params["address"] = [address] + [contract_address]
```

This then causes this later block to raise an exception:
```py
    if "address" not in filter_params:
        pass
    elif is_list_like(filter_params["address"]):
        for addr in filter_params["address"]:
            validate_address(addr)
    else:
        validate_address(filter_params["address"])
```

As `is_list_like` is true, but `filter_params["address"]` has been incorrectly turned into a list of lists:
```py
filter_params["address"] = [["0x...","0x..."]] + ["0x...","0x..."]
```

The simplest fix is to correct `_utils/filters.py:97` to create a list instead of a list of lists, this should probably be de-duplicated because in the code path I'm using above `address` and `contract_address` are the same. (Not sure if this should be the case)

### web3 Version

7.8.0

### Python Version

3.12.3

### Operating System

linux

### Output from `pip freeze`

```shell
aiodns==3.1.1
aiohappyeyeballs==2.4.4
aiohttp==3.10.11
aiosignal==1.3.1
annotated-types==0.7.0
async-timeout==4.0.3
attrs==24.2.0
bitarray==3.0.0
black==24.8.0
blinker==1.7.0
certifi==2023.11.17
cffi==1.17.1
chardet==5.2.0
charset-normalizer==3.3.2
ckzg==2.0.1
click==8.1.7
colorama==0.4.6
coloredlogs==15.0.1
cryptography==40.0.2
cytoolz==1.0.1
distro==1.9.0
eth-account==0.13.4
eth-hash==0.7.0
eth-keyfile==0.8.1
eth-keys==0.6.1
eth-rlp==2.1.0
eth-typing==5.0.0
eth-utils==5.0.0
eth_abi==5.1.0
Flask==3.0.3
frozenlist==1.5.0
hexbytes==1.2.1
humanfriendly==10.0
idna==3.8
iniconfig==2.0.0
itsdangerous==2.1.2
Jinja2==3.1.4
MarkupSafe==2.1.5
multidict==6.1.0
mypy-extensions==1.0.0
oxenc @ file:///home/aerilym/git/ssb/dep-tmp/oxenc
oxenmq @ file:///home/aerilym/git/ssb/dep-tmp/oxenmq
packaging==23.2
parsimonious==0.10.0
pathspec==0.12.1
pillow==10.2.0
platformdirs==4.2.2
pluggy==1.5.0
propcache==0.2.1
protobuf==4.21.12
psycopg==3.2.4
psycopg-pool==3.2.4
py-solc-x==2.0.3
pycares==4.5.0
pycparser==2.22
pycryptodome==3.21.0
pycryptodomex==3.20.0
pydantic==2.9.2
pydantic_core==2.23.4
PyNaCl==1.5.0
pyOpenSSL==23.2.0
pytest==8.3.4
pyunormalize==16.0.0
regex==2024.9.11
requests==2.32.3
rlp==4.0.1
setuptools==68.1.2
simplejson==3.19.3
toolz==1.0.0
types-requests==2.32.0.20240905
typing_extensions==4.10.0
urllib3==2.0.7
uWSGI==2.0.28
web3==7.8.0
websockets==13.1
Werkzeug==3.0.4
wheel==0.42.0
yarl==1.16.0
```

Pull request description:
fix: correctly combine address and contract address list in event filter param construction
### What was wrong?

Related to Issue #3617 
Closes #3617 

### How was it fixed?
See description of #3617 

### Todo:

- [x] Clean up commit history
- [x] Add or update documentation related to these changes
- [x] Add entry to the [release notes](https://github.com/ethereum/web3.py/blob/main/newsfragments/README.md)

#### Cute Animal Picture

![Put a link to a cute animal picture inside the parenthesis-->](https://github.com/user-attachments/assets/7ed5e4a0-48b4-408a-aca1-a37e0d2a3f98)


Patch:
diff --git a/newsfragments/3618.bugfix.rst b/newsfragments/3618.bugfix.rst
new file mode 100644
index 00000000..b0eb2f10
--- /dev/null
+++ b/newsfragments/3618.bugfix.rst
@@ -0,0 +1,1 @@
+Fix contract event ``FilterParams`` to validate and normalize ``address`` parameters.
diff --git a/web3/_utils/filters.py b/web3/_utils/filters.py
index 374eae88..e93513ee 100644
--- a/web3/_utils/filters.py
+++ b/web3/_utils/filters.py
@@ -8,6 +8,7 @@ from typing import (
     List,
     Optional,
     Sequence,
+    Set,
     Tuple,
     Union,
 )
@@ -26,7 +27,6 @@ from eth_typing import (
 )
 from eth_utils import (
     is_hex,
-    is_list_like,
     is_string,
     is_text,
 )
@@ -67,15 +67,48 @@ if TYPE_CHECKING:
     from web3.eth import Eth  # noqa: F401
 
 
+def _sanitize_addresses(
+    *address: Union[ChecksumAddress, List[ChecksumAddress]],
+) -> Union[ChecksumAddress, List[ChecksumAddress]]:
+    """
+    Validates an address or list of addresses and returns a single
+    ChecksumAddress or a list of ChecksumAddresses.
+    Raises Web3ValueError if the address is not valid.
+
+    :param address: A single address or a list of addresses.
+    :return: A list of ChecksumAddress.
+    """
+    address_set: Set[ChecksumAddress] = set()
+    for arg in address:
+        if not arg:
+            continue
+        elif isinstance(arg, str) or isinstance(arg, bytes):
+            address_set.add(arg)
+        elif isinstance(arg, list):
+            address_set.update(arg)
+        else:
+            raise Web3ValueError(
+                f"Unsupported type for `address` parameter: {type(address)}"
+            )
+
+    if not address_set:
+        return []
+    else:
+        for addr in address_set:
+            validate_address(addr)
+
+        return list(address_set) if len(address_set) > 1 else address_set.pop()
+
+
 def construct_event_filter_params(
     event_abi: ABIEvent,
     abi_codec: ABICodec,
-    contract_address: Optional[ChecksumAddress] = None,
+    contract_address: Optional[Union[ChecksumAddress, List[ChecksumAddress]]] = None,
     argument_filters: Optional[Dict[str, Any]] = None,
     topics: Optional[Sequence[HexStr]] = None,
     from_block: Optional[BlockIdentifier] = None,
     to_block: Optional[BlockIdentifier] = None,
-    address: Optional[ChecksumAddress] = None,
+    address: Optional[Union[ChecksumAddress, List[ChecksumAddress]]] = None,
 ) -> Tuple[List[List[Optional[HexStr]]], FilterParams]:
     filter_params: FilterParams = {}
     topic_set: Sequence[HexStr] = construct_event_topic_set(
@@ -92,31 +125,9 @@ def construct_event_filter_params(
 
     filter_params["topics"] = topic_set
 
-    if address and contract_address:
-        if is_list_like(address):
-            filter_params["address"] = [address] + [contract_address]
-        elif is_string(address):
-            filter_params["address"] = (
-                [address, contract_address]
-                if address != contract_address
-                else [address]
-            )
-        else:
-            raise Web3ValueError(
-                f"Unsupported type for `address` parameter: {type(address)}"
-            )
-    elif address:
-        filter_params["address"] = address
-    elif contract_address:
-        filter_params["address"] = contract_address
-
-    if "address" not in filter_params:
-        pass
-    elif is_list_like(filter_params["address"]):
-        for addr in filter_params["address"]:
-            validate_address(addr)
-    else:
-        validate_address(filter_params["address"])
+    sanitized_addresses = _sanitize_addresses(address, contract_address)
+    if sanitized_addresses:
+        filter_params["address"] = sanitized_addresses
 
     if from_block is not None:
         filter_params["fromBlock"] = from_block


Test patch:
diff --git a/tests/core/utilities/test_construct_event_filter_params.py b/tests/core/utilities/test_construct_event_filter_params.py
index ae93cfe6..87dec156 100644
--- a/tests/core/utilities/test_construct_event_filter_params.py
+++ b/tests/core/utilities/test_construct_event_filter_params.py
@@ -3,37 +3,57 @@ import pytest
 from web3._utils.filters import (
     construct_event_filter_params,
 )
+from web3.exceptions import (
+    InvalidAddress,
+    Web3ValueError,
+)
 
-EVENT_1_ABI = {
-    "anonymous": False,
-    "inputs": [
-        {"indexed": False, "name": "arg0", "type": "uint256"},
-        {"indexed": True, "name": "arg1", "type": "uint256"},
-    ],
-    "name": "Event_1",
-    "type": "event",
-}
+
+def hex_and_pad(i):
+    unpadded_hex_value = hex(i).rstrip("L")
+    return "0x" + unpadded_hex_value[2:].zfill(64)
+
+
+@pytest.fixture
+def event_abi():
+    return {
+        "anonymous": False,
+        "inputs": [
+            {"indexed": False, "name": "arg0", "type": "uint256"},
+            {"indexed": True, "name": "arg1", "type": "uint256"},
+        ],
+        "name": "Event_1",
+        "type": "event",
+    }
 
 
 @pytest.mark.parametrize(
-    "event_abi,fn_kwargs,expected",
+    "fn_kwargs,expected",
     (
-        (
-            EVENT_1_ABI,
+        pytest.param(
             {},
             {
                 "topics": [
                     "0xb470a829ed7792f06947f0ca3730a570cb378329ddcf09f2b4efabd6326f51f6"
                 ],
             },
+            id="no-args",
         ),
-        (
-            EVENT_1_ABI,
+        pytest.param(
             {"topics": ["should-overwrite-topics"]},
             {"topics": ["should-overwrite-topics"]},
+            id="overwrite-topics",
         ),
-        (
-            EVENT_1_ABI,
+        pytest.param(
+            {"address": None},
+            {
+                "topics": [
+                    "0xb470a829ed7792f06947f0ca3730a570cb378329ddcf09f2b4efabd6326f51f6"
+                ],
+            },
+            id="no-address",
+        ),
+        pytest.param(
             {"contract_address": "0xd3CdA913deB6f67967B99D67aCDFa1712C293601"},
             {
                 "topics": [
@@ -41,9 +61,9 @@ EVENT_1_ABI = {
                 ],
                 "address": "0xd3CdA913deB6f67967B99D67aCDFa1712C293601",
             },
+            id="contract_address-string",
         ),
-        (
-            EVENT_1_ABI,
+        pytest.param(
             {
                 "contract_address": "0xd3CdA913deB6f67967B99D67aCDFa1712C293601",
                 "address": "0xBB9bc244D798123fDe783fCc1C72d3Bb8C189413",
@@ -57,9 +77,25 @@ EVENT_1_ABI = {
                     "0xd3CdA913deB6f67967B99D67aCDFa1712C293601",
                 ],
             },
+            id="address-with-contract_address",
         ),
-        (
-            EVENT_1_ABI,
+        pytest.param(
+            {
+                "contract_address": ["0xd3CdA913deB6f67967B99D67aCDFa1712C293601"],
+                "address": ["0xBB9bc244D798123fDe783fCc1C72d3Bb8C189413"],
+            },
+            {
+                "topics": [
+                    "0xb470a829ed7792f06947f0ca3730a570cb378329ddcf09f2b4efabd6326f51f6"
+                ],
+                "address": [
+                    "0xBB9bc244D798123fDe783fCc1C72d3Bb8C189413",
+                    "0xd3CdA913deB6f67967B99D67aCDFa1712C293601",
+                ],
+            },
+            id="single-item-address-list-with-contract_address-list",
+        ),
+        pytest.param(
             {"address": "0xd3CdA913deB6f67967B99D67aCDFa1712C293601"},
             {
                 "topics": [
@@ -67,27 +103,217 @@ EVENT_1_ABI = {
                 ],
                 "address": "0xd3CdA913deB6f67967B99D67aCDFa1712C293601",
             },
+            id="address-string",
+        ),
+        pytest.param(
+            {"address": b"\xf2\xe2F\xbbv\xdf\x87l\xef\x8b8\xae\x84\x13\x0fOU\xde9["},
+            {
+                "topics": [
+                    "0xb470a829ed7792f06947f0ca3730a570cb378329ddcf09f2b4efabd6326f51f6"
+                ],
+                "address": b"\xf2\xe2F\xbbv\xdf\x87l\xef\x8b8\xae\x84\x13\x0fOU\xde9[",
+            },
+            id="address-bytes",
+        ),
+        pytest.param(
+            {
+                "contract_address": b"\xf2\xe2F\xbbv\xdf\x87l\xef\x8b8\xae\x84\x13\x0fOU\xde9[",  # noqa: E501
+                "address": [
+                    b"\xf2\xe2F\xbbv\xdf\x87l\xef\x8b8\xae\x84\x13\x0fOU\xde9[",
+                    b"\xf2\xe2F\xbbv\xdf\x87l\xef\x8b8\xae\x84\x13\x0fOU\xde9[",
+                ],
+            },
+            {
+                "topics": [
+                    "0xb470a829ed7792f06947f0ca3730a570cb378329ddcf09f2b4efabd6326f51f6"
+                ],
+                "address": b"\xf2\xe2F\xbbv\xdf\x87l\xef\x8b8\xae\x84\x13\x0fOU\xde9[",
+            },
+            id="address-bytes-list",
+        ),
+        pytest.param(
+            {"address": ["0xd3CdA913deB6f67967B99D67aCDFa1712C293601"]},
+            {
+                "topics": [
+                    "0xb470a829ed7792f06947f0ca3730a570cb378329ddcf09f2b4efabd6326f51f6"
+                ],
+                "address": "0xd3CdA913deB6f67967B99D67aCDFa1712C293601",
+            },
+            id="address-list",
+        ),
+        pytest.param(
+            {
+                "address": [
+                    "0xd3CdA913deB6f67967B99D67aCDFa1712C293601",
+                    "0x1234567890123456789012345678901234567890",
+                ]
+            },
+            {
+                "topics": [
+                    "0xb470a829ed7792f06947f0ca3730a570cb378329ddcf09f2b4efabd6326f51f6"
+                ],
+                "address": [
+                    "0xd3CdA913deB6f67967B99D67aCDFa1712C293601",
+                    "0x1234567890123456789012345678901234567890",
+                ],
+            },
+            id="multiple-address",
+        ),
+        pytest.param(
+            {
+                "address": "0xd3CdA913deB6f67967B99D67aCDFa1712C293601",
+                "contract_address": ["0xBB9bc244D798123fDe783fCc1C72d3Bb8C189413"],
+            },
+            {
+                "topics": [
+                    "0xb470a829ed7792f06947f0ca3730a570cb378329ddcf09f2b4efabd6326f51f6"
+                ],
+                "address": [
+                    "0xd3CdA913deB6f67967B99D67aCDFa1712C293601",
+                    "0xBB9bc244D798123fDe783fCc1C72d3Bb8C189413",
+                ],
+            },
+            id="one-address-with-multiple-contract_address",
+        ),
+        pytest.param(
+            {
+                "address": [
+                    "0xd3CdA913deB6f67967B99D67aCDFa1712C293601",
+                    "0x1234567890123456789012345678901234567890",
+                ],
+                "contract_address": "0xBB9bc244D798123fDe783fCc1C72d3Bb8C189413",
+            },
+            {
+                "topics": [
+                    "0xb470a829ed7792f06947f0ca3730a570cb378329ddcf09f2b4efabd6326f51f6"
+                ],
+                "address": [
+                    "0xd3CdA913deB6f67967B99D67aCDFa1712C293601",
+                    "0x1234567890123456789012345678901234567890",
+                    "0xBB9bc244D798123fDe783fCc1C72d3Bb8C189413",
+                ],
+            },
+            id="multiple-address-with-one-contract_address",
+        ),
+        pytest.param(
+            {
+                "address": [
+                    "0xd3CdA913deB6f67967B99D67aCDFa1712C293601",
+                    "0x1234567890123456789012345678901234567890",
+                ],
+                "contract_address": [
+                    "0xBB9bc244D798123fDe783fCc1C72d3Bb8C189413",
+                    "0x1234567890123456789012345678901234567890",
+                ],
+            },
+            {
+                "topics": [
+                    "0xb470a829ed7792f06947f0ca3730a570cb378329ddcf09f2b4efabd6326f51f6"
+                ],
+                "address": [
+                    "0xd3CdA913deB6f67967B99D67aCDFa1712C293601",
+                    "0x1234567890123456789012345678901234567890",
+                    "0xBB9bc244D798123fDe783fCc1C72d3Bb8C189413",
+                ],
+            },
+            id="multiple-address-with-multiple-contract_address",
+        ),
+        pytest.param(
+            {
+                "contract_address": "0xBB9bc244D798123fDe783fCc1C72d3Bb8C189413",
+                "topics": [
+                    "0xb470a829ed7792f06947f0ca3730a570cb378329ddcf09f2b4efabd6326f51f6"
+                ],
+                "from_block": "latest",
+                "to_block": "latest",
+                "address": [
+                    "0xd3CdA913deB6f67967B99D67aCDFa1712C293601",
+                    "0x1234567890123456789012345678901234567890",
+                    "0xBB9bc244D798123fDe783fCc1C72d3Bb8C189413",
+                ],
+            },
+            {
+                "topics": [
+                    "0xb470a829ed7792f06947f0ca3730a570cb378329ddcf09f2b4efabd6326f51f6"
+                ],
+                "address": [
+                    "0xd3CdA913deB6f67967B99D67aCDFa1712C293601",
+                    "0x1234567890123456789012345678901234567890",
+                    "0xBB9bc244D798123fDe783fCc1C72d3Bb8C189413",
+                ],
+                "fromBlock": "latest",
+                "toBlock": "latest",
+            },
+            id="all-arguments-with-address-list",
         ),
     ),
 )
 def test_construct_event_filter_params(w3, event_abi, fn_kwargs, expected):
-    _, actual = construct_event_filter_params(event_abi, w3.codec, **fn_kwargs)
-    assert actual == expected
+    _, filter_params = construct_event_filter_params(event_abi, w3.codec, **fn_kwargs)
+    # Ensure that the filter_params contains the expected keys
+    assert (
+        filter_params.keys() == expected.keys()
+    ), f"Keys don't match. Expected {set(expected.keys())}, got {set(filter_params.keys())}"  # noqa: E501
+    # Verify all values in filter_params match the expected values
+    for key, value in expected.items():
+        if isinstance(value, list) and isinstance(filter_params[key], list):
+            assert sorted(filter_params[key]) == sorted(
+                value
+            ), f"Expected {key}={value}, got {key}={filter_params.get(key)}"
+        else:
+            assert (
+                filter_params[key] == value
+            ), f"Expected {key}={value}, got {key}={filter_params.get(key)}"
 
 
-def hex_and_pad(i):
-    unpadded_hex_value = hex(i).rstrip("L")
-    return "0x" + unpadded_hex_value[2:].zfill(64)
+@pytest.mark.parametrize(
+    "fn_kwargs, expected_exception",
+    [
+        pytest.param(
+            {
+                "contract_address": "0xbb9bc244d798123fde783fcc1c72d3bb8c189413",
+                "topics": [
+                    "0xb470a829ed7792f06947f0ca3730a570cb378329ddcf09f2b4efabd6326f51f6"
+                ],
+                "address": [
+                    "0xd3cda913deb6f67967b99d67acdfa1712c293601",
+                    "0x1234567890123456789012345678901234567890",
+                    "0xBB9bc244D798123fDe783fCc1C72d3Bb8C189413",
+                ],
+                "from_block": 1,
+                "to_block": 2,
+            },
+            InvalidAddress,
+            id="invalid-checksum-address",
+        ),
+        pytest.param(
+            {
+                "contract_address": "0xbb9bc244d798123fde783fcc1c72d3bb8c189413",
+            },
+            InvalidAddress,
+            id="invalid-checksum-contract-address",
+        ),
+        pytest.param(
+            {"address": {"invalid": "0x1234567890123456789012345678901234567890"}},
+            Web3ValueError,
+            id="unsupported-type-exception",
+        ),
+    ],
+)
+def test_construct_event_filter_params_exceptions(
+    w3, event_abi, fn_kwargs, expected_exception
+):
+    with pytest.raises(expected_exception):
+        construct_event_filter_params(event_abi, w3.codec, **fn_kwargs)
 
 
 @pytest.mark.parametrize(
-    "event_abi,fn_kwargs,expected",
+    "fn_kwargs,expected",
     (
-        (EVENT_1_ABI, {}, [[]]),
-        (EVENT_1_ABI, {"argument_filters": {"arg0": 1}}, [[hex_and_pad(1)]]),
-        (EVENT_1_ABI, {"argument_filters": {"arg0": [1]}}, [[hex_and_pad(1)]]),
+        ({}, [[]]),
+        ({"argument_filters": {"arg0": 1}}, [[hex_and_pad(1)]]),
+        ({"argument_filters": {"arg0": [1]}}, [[hex_and_pad(1)]]),
         (
-            EVENT_1_ABI,
             {"argument_filters": {"arg0": [1, 2]}},
             [
                 [hex_and_pad(1)],
@@ -97,7 +323,7 @@ def hex_and_pad(i):
     ),
 )
 def test_construct_event_filter_params_for_data_filters(
-    event_abi, w3, fn_kwargs, expected
+    w3, event_abi, fn_kwargs, expected
 ):
     actual, _ = construct_event_filter_params(event_abi, w3.codec, **fn_kwargs)
     assert actual == expected