Skip to content

Commit

Permalink
Refactor checking basic type names
Browse files Browse the repository at this point in the history
  • Loading branch information
franciszekjob committed Jul 5, 2024
1 parent 6209096 commit 7f5798f
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions starknet_py/utils/typed_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,12 +260,6 @@ def _verify_types(self):
if self.domain.separator_name not in self.types:
raise ValueError(f"Types must contain '{self.domain.separator_name}'.")

basic_type_names = _get_basic_type_names(self.domain.resolved_revision)

for type_name in basic_type_names:
if type_name in self.types:
raise ValueError(f"Reserved type name: {type_name}")

referenced_types = set()
for type_name in self.types:
for ref_type in self.types[type_name]:
Expand All @@ -280,10 +274,15 @@ def _verify_types(self):

referenced_types.update([self.domain.separator_name, self.primary_type])

basic_type_names = _get_basic_type_names(self.domain.resolved_revision)

for type_name in self.types:
if not type_name:
raise ValueError("Type names cannot be empty.")

if type_name in basic_type_names:
raise ValueError(f"Reserved type name: {type_name}")

if is_pointer(type_name):
raise ValueError(
f"Type names cannot end in *. [{type_name}] was found."
Expand Down

0 comments on commit 7f5798f

Please sign in to comment.