Closed credence0x closed 1 month 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 | Jun 12, 2024 3:23pm |
โฑ๏ธ Estimated effort to review [1-5] | 3 |
๐งช Relevant tests | No |
๐ Security concerns | No |
โก Key issues to review |
Possible Bug: The replacement of specific class method calls with `Self` might not always be contextually appropriate. Ensure that `Self` refers correctly in all contexts where it's used. |
Refactoring Scope: The changes in method signatures and formatting in the combat systems file need a thorough review to ensure they don't introduce new bugs or alter the logic unintentionally. |
Category | Suggestion | Score |
Possible bug |
Add bounds check for the
___
**Consider checking the validity of the | 9 |
Add nullity check to prevent potential runtime errors___ **Ensure that theroad variable is checked for nullity or existence before accessing its usage_count property to prevent potential runtime errors.**
[contracts/src/models/road.cairo [40-41]](https://github.com/BibliothecaDAO/eternum/pull/912/files#diff-05e16e54ff8f1d4467e3c3df2f01c8c3379f6aadf2ab2bf413a9e98b20a39934R40-R41)
```diff
let mut road = Self::get(world, start_coord, end_coord);
-if road.usage_count > 0 {
+if road is not None and road.usage_count > 0 {
```
Suggestion importance[1-10]: 8Why: Adding a nullity check for the `road` variable before accessing its `usage_count` property is a good practice to prevent potential runtime errors, making the code more robust. | 8 | |
Security |
Add validation for
___
**Ensure that the | 7 |
Maintainability |
Improve variable naming for better readability___ **Consider using a more descriptive variable name instead ofq for the array that holds the hash components. This will improve code readability and maintainability.** [contracts/src/models/buildings.cairo [98-99]](https://github.com/BibliothecaDAO/eternum/pull/912/files#diff-d98a082b4990bd2f45a454b6fbeef40ee7acbd1650edbdcb1657071706a34ca7R98-R99) ```diff -let q: Array Suggestion importance[1-10]: 6Why: The suggestion improves code readability and maintainability by using a more descriptive variable name. However, it does not address any critical issues or bugs. | 6 |
User description
should resolve #897 but there are still warnings from external libs
PR Type
Bug fix
Description
Self
in method calls across multiple files to fix internal compiler warnings.Changes walkthrough ๐
8 files
buildings.cairo
Fix internal compiler warnings by using `Self` in method calls.
contracts/src/models/buildings.cairo
BuildingQuantityv2TrackerImpl
withSelf
for method call.level.cairo
Fix internal compiler warnings by using `Self` in method calls.
contracts/src/models/level.cairo - Replaced `LevelTrait` with `Self` for method call.
resources.cairo
Fix internal compiler warnings by using `Self` in method calls.
contracts/src/models/resources.cairo - Replaced `ResourceFoodImpl` with `Self` for method call.
road.cairo
Fix internal compiler warnings by using `Self` in method calls.
contracts/src/models/road.cairo - Replaced `RoadImpl` with `Self` for method call.
contracts.cairo
Fix internal compiler warnings and improve readability.
contracts/src/systems/combat/contracts.cairo
CombatContractImpl
withSelf
for method call.contracts.cairo
Fix internal compiler warnings by using `Self` in method calls.
contracts/src/systems/resources/contracts.cairo
InternalResourceSystemsImpl
withSelf
for method call.donkey_systems.cairo
Fix internal compiler warnings by using `Self` in method calls.
contracts/src/systems/transport/contracts/donkey_systems.cairo - Replaced `InternalDonkeySystemsImpl` with `Self` for method calls.
travel_systems.cairo
Fix internal compiler warnings by using `Self` in method calls.
contracts/src/systems/transport/contracts/travel_systems.cairo - Replaced `InternalTravelSystemsImpl` with `Self` for method calls.
1 files
tests.cairo
Reorder imports and improve code readability.
contracts/src/systems/map/tests.cairo