@@ -359,23 +359,23 @@ For example, if an abi specifies a type of ``bytes4``, web3 will handle all of t
359359
360360.. code-block :: python
361361
362- - ' ' # valid - empty string that is less than 4 bytes and can be decoded as a hex string
363- - ' 0x' # valid - empty hex string
364- - b ' ' # valid - empty bytestring
365- - b ' ab' # valid - less than 4 bytes
366- - ' 0xab' # valid - hex string with less than 4 bytes
367- - ' 1234' # valid - string that can be decoded as a hex string
368- - ' 0xabcd ' # valid - hex string with exactly 4 bytes
369- - b ' 1234' # valid - bytestring with exactly 4 bytes
362+ - ' ' # valid - empty string less than 4 bytes and can be decoded as a hex string
363+ - ' 0x' # valid - empty hex string
364+ - b ' ' # valid - empty bytestring
365+ - b ' ab' # valid - less than 4 bytes
366+ - ' 0xab' # valid - hex string with less than 4 bytes
367+ - ' 1234' # valid - string that can be decoded as a hex string
368+ - ' 0x61626364 ' # valid - hex string with exactly 4 bytes
369+ - b ' 1234' # valid - bytestring with exactly 4 bytes
370370
371371 The following values will raise an error by default:
372372
373373.. code-block :: python
374374
375- - b ' abcde' # invalid - more than 4 bytes
376- - ' 0xabcde ' # invalid - hex string with more than 4 bytes
377- - 2 # invalid - wrong type
378- - ' ah' # invalid - string not valid hex
375+ - b ' abcde' # invalid - more than 4 bytes
376+ - ' 0x6162636423 ' # invalid - hex string with more than 4 bytes
377+ - 2 # invalid - wrong type
378+ - ' ah' # invalid - string not valid hex
379379
380380 However, you may want to be stricter with acceptable values for bytes types.
381381For this you can use the ``enable_strict_bytes_type_checking `` method,
@@ -386,17 +386,17 @@ specified byte size will raise an error. Using the same ``bytes4`` example:
386386
387387.. code-block :: python
388388
389- - ' 0xabcd ' # valid - hex string with exactly 4 bytes
390- - b ' 1234' # valid - bytestring with exactly 4 bytes
391- - b ' ab' # invalid - less than 4 bytes
392- - ' 0xab' # invalid - hex string with less than 4 bytes
393- - ' ' # invalid - needs a 0x to be interpreted as hex
394- - ' 1234' # invalid - needs a 0x to be interpreted as hex
395- - b ' ' # invalid - less than 4 bytes
396- - b ' abcde' # invalid - more than 4 bytes
397- - ' 0xabcde ' # invalid - hex string with more than 4 bytes
398- - 2 # invalid - wrong type
399- - ' ah' # invalid - string not valid hex
389+ - ' 0x61626364 ' # valid - hex string with exactly 4 bytes
390+ - b ' 1234' # valid - bytestring with exactly 4 bytes
391+ - b ' ab' # invalid - less than 4 bytes
392+ - ' 0xab' # invalid - hex string with less than 4 bytes
393+ - ' ' # invalid - needs a 0x to be interpreted as hex
394+ - ' 1234' # invalid - needs a 0x to be interpreted as hex
395+ - b ' ' # invalid - less than 4 bytes
396+ - b ' abcde' # invalid - more than 4 bytes
397+ - ' 0x6162636423 ' # invalid - hex string with more than 4 bytes
398+ - 2 # invalid - wrong type
399+ - ' ah' # invalid - string not valid hex
400400
401401
402402 For example, the following contract code will generate the abi below and some bytecode:
0 commit comments