Repository: OpenZeppelin/nile (language: python)

Issue:
nile deploy command doesn't accept hex arguments in calldata
The `Account.deploy_contract()` method is not processing calldata (normalizing arguments) like send. Therefore calldata with hex values result in a python exception.


Discussion / hints:

Fix patch:
diff --git a/src/nile/core/account.py b/src/nile/core/account.py
index 5b635199..1fe0b93d 100644
--- a/src/nile/core/account.py
+++ b/src/nile/core/account.py
@@ -197,6 +197,8 @@ async def deploy_contract(
             deployer_address or UNIVERSAL_DEPLOYER_ADDRESS
         )
 
+        max_fee, _, calldata = await self._process_arguments(max_fee, 0, calldata)
+
         await deploy_with_deployer(
             self,
             contract_name,


Test patch:
diff --git a/tests/commands/test_account.py b/tests/commands/test_account.py
index 48359856..6f2cd0d2 100644
--- a/tests/commands/test_account.py
+++ b/tests/commands/test_account.py
@@ -151,6 +151,7 @@ async def test_declare(mock_declare, mock_get_class, mock_hash, mock_deploy):
 @pytest.mark.parametrize("deployer_address", [None, 0xDE0])
 @pytest.mark.parametrize("watch_mode", [None, "debug"])
 @pytest.mark.parametrize("abi", [None, "TEST_ABI"])
+@pytest.mark.parametrize("calldata", [["0x123", 456]])
 @pytest.mark.parametrize("overriding_path", [None, PATH])
 @patch("nile.core.account.deploy_account", return_value=(MOCK_ADDRESS, MOCK_INDEX))
 @patch("nile.core.deploy.get_class_hash", return_value=0x434343)
@@ -160,6 +161,7 @@ async def test_deploy_contract(
     mock_get_class,
     mock_deploy,
     overriding_path,
+    calldata,
     abi,
     watch_mode,
     deployer_address,
@@ -169,7 +171,6 @@ async def test_deploy_contract(
     contract_name = "contract"
     salt = 4
     unique = True
-    calldata = []
     alias = "my_contract"
     max_fee = 1
 
@@ -190,12 +191,14 @@ async def test_deploy_contract(
         deployer_address = normalize_number(UNIVERSAL_DEPLOYER_ADDRESS)
 
     # Check values are correctly passed to 'deploy_with_deployer'
+    exp_calldata = [normalize_number(x) for x in calldata]
+
     mock_deploy_contract.assert_called_with(
         account,
         contract_name,
         salt,
         unique,
-        calldata,
+        exp_calldata,
         alias,
         deployer_address,
         max_fee,