From d7f61be71720f6145adcc9832595ffe90a7ccaa5 Mon Sep 17 00:00:00 2001 From: Tarrence van As Date: Thu, 22 Feb 2024 13:40:53 -0500 Subject: [PATCH] fix(dojo): dont assign ownership to ResourceMetadata on world creation (#1566) --- crates/dojo-core/src/base_test.cairo | 6 ++++-- crates/dojo-core/src/test_utils.cairo | 3 --- crates/dojo-core/src/world.cairo | 3 --- crates/dojo-lang/src/manifest_test_data/cairo_v240 | 2 +- crates/dojo-lang/src/manifest_test_data/manifest | 2 +- 5 files changed, 6 insertions(+), 10 deletions(-) diff --git a/crates/dojo-core/src/base_test.cairo b/crates/dojo-core/src/base_test.cairo index 2fe4a4ce1c..314dd01817 100644 --- a/crates/dojo-core/src/base_test.cairo +++ b/crates/dojo-core/src/base_test.cairo @@ -68,7 +68,9 @@ fn test_upgrade_from_world() { #[test] #[available_gas(6000000)] -#[should_panic(expected: ('class_hash not world provider', 'ENTRYPOINT_FAILED', 'ENTRYPOINT_FAILED'))] +#[should_panic( + expected: ('class_hash not world provider', 'ENTRYPOINT_FAILED', 'ENTRYPOINT_FAILED') +)] fn test_upgrade_from_world_not_world_provider() { let world = deploy_world(); @@ -105,7 +107,7 @@ mod invalid_model { impl InvalidModelName of super::INameOnly { fn name(self: @ContractState) -> felt252 { // Pre-computed address of a contract deployed through the world. - 0x34534b116332dd9459bfde65280822d84c130e3f1faeb63af8455f83e733f4f + 0x742c3d09472a40914dedcbd609788fd547bde613d6c4d4c2f15d41f4e241f25 } } } diff --git a/crates/dojo-core/src/test_utils.cairo b/crates/dojo-core/src/test_utils.cairo index 6ffbedb98e..6a83bcdda7 100644 --- a/crates/dojo-core/src/test_utils.cairo +++ b/crates/dojo-core/src/test_utils.cairo @@ -54,9 +54,6 @@ fn spawn_test_world(models: Array) -> IWorldDispatcher { let world = IWorldDispatcher { contract_address: world_address }; - // Register the resource metadata. - world.register_model(resource_metadata::TEST_CLASS_HASH.try_into().unwrap()); - // register models let mut index = 0; loop { diff --git a/crates/dojo-core/src/world.cairo b/crates/dojo-core/src/world.cairo index 0abb895426..e6de33f0dd 100644 --- a/crates/dojo-core/src/world.cairo +++ b/crates/dojo-core/src/world.cairo @@ -185,9 +185,6 @@ mod world { let creator = starknet::get_tx_info().unbox().account_contract_address; self.contract_base.write(contract_base); self.owners.write((WORLD, creator), true); - - // Ensure the creator of the world is the owner of the resource metadata model. - self.owners.write((RESOURCE_METADATA_MODEL, creator), true); self.models.write( RESOURCE_METADATA_MODEL, (resource_metadata::initial_class_hash(), resource_metadata::initial_address()) diff --git a/crates/dojo-lang/src/manifest_test_data/cairo_v240 b/crates/dojo-lang/src/manifest_test_data/cairo_v240 index 0a9e895b3f..e5d36f9aaf 100644 --- a/crates/dojo-lang/src/manifest_test_data/cairo_v240 +++ b/crates/dojo-lang/src/manifest_test_data/cairo_v240 @@ -8,7 +8,7 @@ test_compiler_cairo_v240 "world": { "name": "dojo::world::world", "address": null, - "class_hash": "0x6c0c550736dd694219f1a3d0a8ac95fbc8b17382f1f02dc09422451bfa30376", + "class_hash": "0x5ad96ceea29160aa7305bb078d1ade41f73b487363ae12778dbea6393cc00b2", "abi": [ { "type": "impl", diff --git a/crates/dojo-lang/src/manifest_test_data/manifest b/crates/dojo-lang/src/manifest_test_data/manifest index 5d15e0659c..ec01eb64d0 100644 --- a/crates/dojo-lang/src/manifest_test_data/manifest +++ b/crates/dojo-lang/src/manifest_test_data/manifest @@ -8,7 +8,7 @@ test_manifest_file "world": { "name": "dojo::world::world", "address": null, - "class_hash": "0x6c0c550736dd694219f1a3d0a8ac95fbc8b17382f1f02dc09422451bfa30376", + "class_hash": "0x5ad96ceea29160aa7305bb078d1ade41f73b487363ae12778dbea6393cc00b2", "abi": [ { "type": "impl",