Closed cwastche closed 3 months ago
The latest updates on your projects. Learn more about Vercel for Git βοΈ
Name | Status | Preview | Comments | Updated (UTC) |
---|---|---|---|---|
eternum | β Ready (Inspect) | Visit Preview | π¬ Add feedback | Jul 5, 2024 4:29pm |
β±οΈ Estimated effort to review [1-5] | 3 |
π§ͺ Relevant tests | No |
π Security concerns | No |
β‘ Key issues to review |
Possible Bug: Ensure that the removal of DonkeyFarm does not affect other dependencies or functionalities that might still be expecting this building type or its associated resources. |
Data Consistency: Verify that all references to DonkeyFarm across various files and configurations have been consistently and completely removed to avoid runtime errors or inconsistencies in the application's behavior. |
Category | Suggestion | Score |
Possible bug |
Update the
___
**Update the value of | 10 |
Verify and correct any mismatches in enum to string mappings___ **Ensure that the indices and values inBuildingStringToEnum match the updated BuildingType enum to maintain consistency and avoid potential mismatches or errors in mapping.** [sdk/packages/eternum/src/constants/structures.ts [90-96]](https://github.com/BibliothecaDAO/eternum/pull/1060/files#diff-13ebd7e505f23bb2b17f155849dcc315987a100a7cd1d9bba99237adc8b0ac98R90-R96) ```diff +TradingPost: 9, +WorkersHut: 10, +WatchTower: 11, +Walls: 12, +Storehouse: 13, +Bank: 14, +FragmentMine: 15, - ``` Suggestion importance[1-10]: 9Why: This suggestion addresses a potential bug by ensuring that the indices and values in `BuildingStringToEnum` match the updated `BuildingType` enum, maintaining consistency and preventing errors. | 9 | |
Ensure the
___
**The | 7 | |
Reintroduce the 'DonkeyFarm' to the building categories if it was removed by mistake___ **Ensure that all necessary building categories are included in the enum, as 'DonkeyFarm'was removed.** [contracts/src/models/buildings.cairo [58-63]](https://github.com/BibliothecaDAO/eternum/pull/1060/files#diff-d98a082b4990bd2f45a454b6fbeef40ee7acbd1650edbdcb1657071706a34ca7R58-R63) ```diff Market, ArcheryRange, Stable, +DonkeyFarm, TradingPost, WorkersHut, WatchTower, ``` Suggestion importance[1-10]: 6Why: The suggestion is valid if 'DonkeyFarm' was removed unintentionally. However, without context, it's unclear if the removal was deliberate, making this a lower priority. | 6 | |
Possible issue |
Correct the block number to match the intended current value___ **Ensure that theblock_number is updated to reflect the correct and current block number, as it seems to have been decreased.** [contracts/manifests/dev/manifest.toml [8]](https://github.com/BibliothecaDAO/eternum/pull/1060/files#diff-43499a9633d551acabe80100dc29d8995890cd62b12169122658233caea498b3R8-R8) ```diff -block_number = 17 +block_number = 19 ``` Suggestion importance[1-10]: 9Why: Ensuring the block number is correct is crucial for the integrity of the manifest. The suggestion addresses a potential issue where the block number was decreased, which could lead to inconsistencies. | 9 |
Verify and correct the
___
**The | 8 | |
Compatibility |
Consider the implications of removing "DonkeyFarm" from the ABI and ensure compatibility or provide migration paths___ **The removal of "DonkeyFarm" from the contract's ABI might lead to compatibility issues ifexisting clients or systems depend on this contract. If this is an intentional removal, consider versioning the ABI or providing migration paths for clients.** [contracts/manifests/dev/manifest.json [1804]](https://github.com/BibliothecaDAO/eternum/pull/1060/files#diff-bc6816b30ea64e261f152a070b6e767d29d900fcbacb95c684f1c14a82dff5a8R1804-R1804) ```diff +{ + "name": "DonkeyFarm", + "type": "()" +}, { "name": "TradingPost", "type": "()" ``` Suggestion importance[1-10]: 9Why: Removing "DonkeyFarm" from the ABI could lead to compatibility issues. This suggestion addresses a potential major issue by recommending careful consideration of the removal's impact. | 9 |
Maintainability |
Ensure consistent naming between enum and string mappings___ **Ensure consistency in naming conventions for the building types in theBuildingEnumToString mapping. The name "Shards Mine" should be updated to "Fragment Mine" to match the enum name in BuildingType .**
[sdk/packages/eternum/src/constants/structures.ts [77]](https://github.com/BibliothecaDAO/eternum/pull/1060/files#diff-13ebd7e505f23bb2b17f155849dcc315987a100a7cd1d9bba99237adc8b0ac98R77-R77)
```diff
-15: "Shards Mine",
+15: "Fragment Mine",
```
Suggestion importance[1-10]: 8Why: This suggestion improves maintainability by ensuring consistency in naming conventions, which helps avoid confusion and potential errors. | 8 |
Verify the updated
___
**The | 7 | |
Replace repeated literal strings with a variable for maintainability___ **Consider using a variable for the repeated base class hash to ensure consistency and easefuture updates.** [contracts/manifests/dev/manifest.toml [118]](https://github.com/BibliothecaDAO/eternum/pull/1060/files#diff-43499a9633d551acabe80100dc29d8995890cd62b12169122658233caea498b3R118-R118) ```diff -base_class_hash = "0x22f3e55b61d86c2ac5239fa3b3b8761f26b9a5c0b5f61ddbd5d756ced498b46" +base_class_hash = BASE_CLASS_HASH ``` Suggestion importance[1-10]: 7Why: Using a variable for the repeated base class hash improves maintainability and reduces the risk of errors during future updates. However, it is not a critical issue. | 7 | |
Enhancement |
Adjust enum indices to reflect the removal of an item for consistency___ **Update the enum indices to maintain the correct sequence after removing an item.** [contracts/src/models/buildings.cairo [80-84]](https://github.com/BibliothecaDAO/eternum/pull/1060/files#diff-d98a082b4990bd2f45a454b6fbeef40ee7acbd1650edbdcb1657071706a34ca7R80-R84) ```diff +BuildingCategory::TradingPost => 9, +BuildingCategory::WorkersHut => 10, +BuildingCategory::WatchTower => 11, +BuildingCategory::Walls => 12, +BuildingCategory::Storehouse => 13, - ```Suggestion importance[1-10]: 8Why: Updating the enum indices after removing an item ensures the correct sequence and prevents potential bugs related to incorrect indexing. | 8 |
Reorder enum values to maintain logical grouping and improve maintainability___ **Consider reordering the enum values inBuildingType to maintain a logical grouping or ordering, such as grouping all resource-related buildings together, which can improve readability and maintainability.** [sdk/packages/eternum/src/constants/structures.ts [18-27]](https://github.com/BibliothecaDAO/eternum/pull/1060/files#diff-13ebd7e505f23bb2b17f155849dcc315987a100a7cd1d9bba99237adc8b0ac98R18-R27) ```diff +Market = 6, +ArcheryRange = 7, +Stable = 8, +TradingPost = 9, +WorkersHut = 10, +WatchTower = 11, +Walls = 12, +Storehouse = 13, +Bank = 14, +FragmentMine = 15, - ``` Suggestion importance[1-10]: 6Why: While this suggestion can improve readability and maintainability, it is not crucial for the functionality of the code. It is more of an enhancement for better code organization. | 6 |
would be careful merging this rn, because it might have some unwanted consequences if we migrate this in the deployed eternum world. where people have been constructing buildings already.
maybe we can close this for for now or put is as a draft, and merge it end of the week when we create new world ?
PR Type
enhancement, configuration changes
Description
DonkeyFarm
from various building-related configurations and constants in the SDK.DonkeyFarm
and adjusted variousclass_hash
andoriginal_class_hash
values.block_number
in manifest files from 19 to 17.Changes walkthrough π
SelectPreviewBuilding.tsx
Remove `DonkeyFarm` from building selection menu
client/src/ui/components/construction/SelectPreviewBuilding.tsx - Removed `DonkeyFarm` from the list of building keys.
config.tsx
Remove `DonkeyFarm` from building images configuration
client/src/ui/config.tsx
DonkeyFarm
from theBUILDING_IMAGES_PATH
configuration.buildings.ts
Remove `DonkeyFarm` from building constants
sdk/packages/eternum/src/constants/buildings.ts - Removed `DonkeyFarm` from various building-related constants.
resources.ts
Remove `DonkeyFarm` from building costs configuration
sdk/packages/eternum/src/constants/resources.ts - Removed `DonkeyFarm` from the `BUILDING_COSTS` configuration.
structures.ts
Remove `DonkeyFarm` from building type definitions
sdk/packages/eternum/src/constants/structures.ts
DonkeyFarm
from theBuildingType
enum and related mappings.buildings.cairo
Remove `DonkeyFarm` from building category definitions
contracts/src/models/buildings.cairo
DonkeyFarm
from theBuildingCategory
enum and relatedimplementations.
manifest.json
Update manifest hashes and remove `DonkeyFarm`
contracts/manifests/dev/manifest.json
class_hash
andoriginal_class_hash
values.block_number
from 19 to 17.DonkeyFarm
related entries.manifest.toml
Update manifest hashes and remove `DonkeyFarm`
contracts/manifests/dev/manifest.toml
class_hash
andoriginal_class_hash
values.block_number
from 19 to 17.DonkeyFarm
related entries.