Skip to content

Commit

Permalink
Don't allow "_logic" constructor param for proxy configuration.
Browse files Browse the repository at this point in the history
  • Loading branch information
derekpierre committed Oct 31, 2023
1 parent bd11f53 commit d3d3221
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions deployment/params.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,9 @@ class ProxyParameters:

CONTAINER_PROPERTY = "wrap_container"

class Invalid(Exception):
"""Raised when the constructor parameters are invalid"""

class ProxyInfo(typing.NamedTuple):
container_name: typing.Union[None, str]
constructor_params: OrderedDict
Expand Down Expand Up @@ -369,6 +372,12 @@ def _generate_proxy_info(cls, contract_data, contract_name) -> ProxyInfo:
constructor_data = cls._default_proxy_parameters(contract_name)
if CONTRACT_CONSTRUCTOR_KEY in proxy_data:
for name, value in proxy_data[CONTRACT_CONSTRUCTOR_KEY].items():
if name == "_logic":
raise cls.Invalid(
"'_logic' parameter cannot be specified: it is implicitly "
"the contract being proxied"
)

constructor_data.update({name: value})

proxy_info = cls.ProxyInfo(container_name=container, constructor_params=constructor_data)
Expand Down

0 comments on commit d3d3221

Please sign in to comment.