Skip to content
This repository was archived by the owner on May 23, 2023. It is now read-only.

Commit 4303bde

Browse files
author
Jan Xie
committed
remove redundant type validation
1 parent 7d4cc3f commit 4303bde

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

ethereum/abi.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,8 @@ def process_type(typ):
255255
if base == 'string' or base == 'bytes':
256256
assert re.match('^[0-9]*$', sub), \
257257
"String type must have no suffix or numerical suffix"
258+
assert not sub or int(sub) <= 32, \
259+
"Maximum 32 bytes for fixed-length str or bytes"
258260
# Check validity of integer type
259261
elif base == 'uint' or base == 'int':
260262
assert re.match('^[0-9]+$', sub), \
@@ -263,12 +265,6 @@ def process_type(typ):
263265
"Integer size out of bounds"
264266
assert int(sub) % 8 == 0, \
265267
"Integer size must be multiple of 8"
266-
# Check validity of string type
267-
if base == 'string' or base == 'bytes':
268-
assert re.match('^[0-9]*$', sub), \
269-
"String type must have no suffix or numerical suffix"
270-
assert not sub or int(sub) <= 32, \
271-
"Maximum 32 bytes for fixed-length str or bytes"
272268
# Check validity of real type
273269
elif base == 'ureal' or base == 'real':
274270
assert re.match('^[0-9]+x[0-9]+$', sub), \

0 commit comments

Comments
 (0)