Skip to content

Commit

Permalink
chore: fix args passed to validate_call_args (#3568)
Browse files Browse the repository at this point in the history
`validate_call_args` takes kwargs, the list of valid keywords as an
argument and makes sure that when a call is made, the given keywords are
valid according to the passed kwargs. however, vyper does not allow
kwargs when calling internal functions, so we should actually pass no
kwargs to `validate_call_args`.

note that this PR does not actually introduce observed changes in
compiler behavior, as the later check in `fetch_call_return` correctly
validates there are no call site kwargs for internal functions.

chainsec june review 5.7
  • Loading branch information
charles-cooper authored Aug 31, 2023
1 parent 17e730a commit 6a819b1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion vyper/semantics/types/function.py
Original file line number Diff line number Diff line change
Expand Up @@ -488,8 +488,8 @@ def fetch_call_return(self, node: vy_ast.Call) -> Optional[VyperType]:
if node.get("func.value.id") == "self" and self.visibility == FunctionVisibility.EXTERNAL:
raise CallViolation("Cannot call external functions via 'self'", node)

kwarg_keys = []
# for external calls, include gas and value as optional kwargs
kwarg_keys = [arg.name for arg in self.keyword_args]
if not self.is_internal:
kwarg_keys += list(self.call_site_kwargs.keys())
validate_call_args(node, (self.n_positional_args, self.n_total_args), kwarg_keys)
Expand Down

1 comment on commit 6a819b1

@charles-cooper
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oops -- this should have been titled fix: instead of chore:

Please sign in to comment.