Skip to content

Commit 10345cd

Browse files
committed
Update v6 migration guide for default strict bytes checking
1 parent e70e26b commit 10345cd

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

docs/v6_migration.rst

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,22 @@ project depends on Web3.py v6, then you'll probably need to make some changes.
99

1010
Breaking Changes:
1111

12+
Strict Bytes Checking by Default
13+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
14+
15+
Web3.py v6 moved to requiring strict bytes checking by default. This means that if an
16+
ABI specifies a ``bytes4`` argument, web3.py will invalidate any entry that is not
17+
encodable as a bytes type with length of 4. This means only 0x-prefixed hex strings with
18+
a length of 4 and bytes types with a length of 4 will be considered valid. This removes
19+
doubt that comes from inferring values and assuming they should be padded.
20+
21+
This behavior was previously available in via the ``w3.enable_strict_bytes_checking()``
22+
method. This is now, however, a toggleable flag on the ``Web3`` instance via the
23+
``w3.strict_bytes_type_checking`` property. As outlined above, this property is set to
24+
``True`` by default but can be toggled on and off via the property's setter
25+
(e.g. ``w3.strict_bytes_type_checking = False``).
26+
27+
1228
Snake Case
1329
~~~~~~~~~~
1430

0 commit comments

Comments
 (0)