Repository: 0xSpaceShard/starknet-devnet (language: python)

Issue:
UDC should be predeployed to the same address as on testnet
The address where it is currently deployed was calculated with `deploy_from_zero=TRUE`, but seems like the salt also should have been set to 0.

I only learned about this after the release of Devnet v0.3.5. I would call this a bug, since the plan was for all UDCs to be at the same address: https://community.starknet.io/t/universal-deployer-contract-proposal/1864#deployment-5


Discussion / hints:
I'm to blame. This was implied but not properly specified, sorry about that.
@martriay Well I am at least partly to blame :smiley: 
Anyway, my initial idea was to predeploy always to the same fixed address on Devnet. But I'm guessing that if devnet should follow testnet, it means that each time a new version of UDC is released, it will be deployed to a different address.

Fix patch:
diff --git a/page/docs/guide/udc.md b/page/docs/guide/udc.md
index 69af5af41..0d05b21c0 100644
--- a/page/docs/guide/udc.md
+++ b/page/docs/guide/udc.md
@@ -4,4 +4,4 @@ sidebar_position: 15
 
 # UDC
 
-Devnet comes with a [Universal Deployer Contract (UDC)](https://community.starknet.io/t/universal-deployer-contract-proposal/1864) predeployed at `0x25fcb74260022bd8ed7e8d542408941826b53345e478b8303d6f31744838a36`. The implementation used is [OpenZeppelin v0.5.0](https://github.com/OpenZeppelin/cairo-contracts/blob/v0.5.0/src/openzeppelin/utils/presets/UniversalDeployer.cairo)
+Devnet comes with a [Universal Deployer Contract (UDC)](https://community.starknet.io/t/universal-deployer-contract-proposal/1864) predeployed at `0x41a78e741e5af2fec34b695679bc6891742439f7afb8484ecd7766661ad02bf`. The implementation used is [OpenZeppelin v0.5.0](https://github.com/OpenZeppelin/cairo-contracts/blob/v0.5.0/src/openzeppelin/utils/presets/UniversalDeployer.cairo)
diff --git a/pyproject.toml b/pyproject.toml
index 0249a869f..5f0e3e62b 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -56,7 +56,11 @@ markers = [
     "timestamps",
     "transaction_trace",
     "tx_version",
-    "web3_messaging"
+    "web3_messaging",
 ]
 junit_family="xunit1"
 asyncio_mode="strict"
+filterwarnings=[
+    "ignore::DeprecationWarning:lark.*:",
+    "ignore::DeprecationWarning:frozendict.*:",
+]
diff --git a/starknet_devnet/fee_token.py b/starknet_devnet/fee_token.py
index 91906d24e..7df330814 100644
--- a/starknet_devnet/fee_token.py
+++ b/starknet_devnet/fee_token.py
@@ -27,9 +27,7 @@ class FeeToken:
     # Precalculated to fixed address
     # ADDRESS = calculate_contract_address_from_hash(salt=10, class_hash=HASH,
     # constructor_calldata=[], deployer_address=0)
-    ADDRESS = (
-        2774287484619332564597403632816768868845110259953541691709975889937073775752
-    )
+    ADDRESS = 0x62230EA046A9A5FBC261AC77D03C8D41E5D442DB2284587570AB46455FD2488
     SYMBOL = "ETH"
     NAME = "ether"
 
diff --git a/starknet_devnet/udc.py b/starknet_devnet/udc.py
index dfea5b327..d3ec12165 100644
--- a/starknet_devnet/udc.py
+++ b/starknet_devnet/udc.py
@@ -18,13 +18,9 @@ class UDC:
     HASH_BYTES = to_bytes(HASH)
 
     # Precalculated to fixed address
-    # ADDRESS = calculate_contract_address_from_hash(salt=10, class_hash=HASH,
+    # ADDRESS = calculate_contract_address_from_hash(salt=0, class_hash=HASH,
     # constructor_calldata=[], deployer_address=0)
-    ADDRESS = (
-        1073880354184614071153542798898672284640862493126523554954769603345737026102
-    )
-
-    contract: StarknetContract = None
+    ADDRESS = 0x41A78E741E5AF2FEC34B695679BC6891742439F7AFB8484ECD7766661AD02BF
 
     def __init__(self, starknet_wrapper):
         self.starknet_wrapper = starknet_wrapper
@@ -46,7 +42,7 @@ async def deploy(self):
         await starknet.state.state.set_contract_class(UDC.HASH_BYTES, contract_class)
         await starknet.state.state.deploy_contract(UDC.ADDRESS, UDC.HASH_BYTES)
 
-        self.contract = StarknetContract(
+        contract = StarknetContract(
             state=starknet.state,
             abi=contract_class.abi,
             contract_address=UDC.ADDRESS,
@@ -54,5 +50,5 @@ async def deploy(self):
         )
 
         await self.starknet_wrapper.store_contract(
-            UDC.ADDRESS, self.contract, contract_class
+            UDC.ADDRESS, contract, contract_class
         )


Test patch:
diff --git a/test/shared.py b/test/shared.py
index 5b71e4dd9..976d68b93 100644
--- a/test/shared.py
+++ b/test/shared.py
@@ -63,5 +63,5 @@
     "0x62230ea046a9a5fbc261ac77d03c8d41e5d442db2284587570ab46455fd2488"
 )
 EXPECTED_UDC_ADDRESS = (
-    "0x25fcb74260022bd8ed7e8d542408941826b53345e478b8303d6f31744838a36"
+    "0x41a78e741e5af2fec34b695679bc6891742439f7afb8484ecd7766661ad02bf"
 )
diff --git a/test/test_deploy.py b/test/test_deploy.py
index ab48a6841..1c37ce735 100644
--- a/test/test_deploy.py
+++ b/test/test_deploy.py
@@ -52,6 +52,7 @@
     get_class_by_hash,
     get_class_hash_at,
     get_transaction_receipt,
+    load_contract_class,
     mint,
     send_tx,
 )
@@ -269,6 +270,14 @@ def test_deploy_through_deployer_constructor():
 
 def test_precomputed_udc_address():
     """Test if the precomputed address of UDC is correct."""
+    udc_contract_class = load_contract_class("starknet_devnet/UDC_OZ_0.5.0.json")
+    calculated_address = calculate_contract_address(
+        salt=0,
+        contract_class=udc_contract_class,
+        constructor_calldata=[],
+        deployer_address=0,
+    )
+    assert_equal(UDC.ADDRESS, calculated_address)
     assert_equal(UDC.ADDRESS, int(EXPECTED_UDC_ADDRESS, 16))