Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use u32 as primary entity type #1144

Merged
merged 5 commits into from
Jul 30, 2024
Merged

use u32 as primary entity type #1144

merged 5 commits into from
Jul 30, 2024

Conversation

credence0x
Copy link
Collaborator

@credence0x credence0x commented Jul 27, 2024

PR Type

enhancement, configuration changes


Description

  • Updated ADMIN_BANK_ENTITY_ID and WORLD_CONFIG_ID values across multiple files.
  • Changed ID type from u128 to u32 in Cairo and manifest files.
  • Updated environment variables and deployment paths in shell scripts.
  • Modified ABI definitions to reflect new interface names and types.
  • Updated deployment manifest with new class hashes, addresses, and base class hashes.

Changes walkthrough 📝

Relevant files
Enhancement
4 files
bankEventQueries.ts
Update `ADMIN_BANK_ENTITY_ID` value                                           

client/src/dojo/events/bankEventQueries.ts

  • Updated ADMIN_BANK_ENTITY_ID to a new value.
+1/-1     
index.ts
Update `ADMIN_BANK_ENTITY_ID` value                                           

config/bank/index.ts

  • Updated ADMIN_BANK_ENTITY_ID to a new value.
+1/-1     
global.ts
Update `WORLD_CONFIG_ID` value                                                     

sdk/packages/eternum/src/constants/global.ts

  • Updated WORLD_CONFIG_ID to a new value.
+1/-1     
alias.cairo
Change `ID` type from `u128` to `u32`                                       

contracts/src/alias.cairo

  • Changed ID type from u128 to u32.
+1/-1     
Configuration changes
5 files
env_variables.sh
Update environment variables for deployment paths               

contracts/scripts/env_variables.sh

  • Updated KATANA_TOML_PATH for both dev and prod environments.
  • Updated SOZO_WORLD for prod environment.
  • +3/-3     
    deploy.sh
    Update `SOZO_WORLD` address in deployment script                 

    scripts/deploy.sh

    • Updated SOZO_WORLD address in deployment script.
    +1/-1     
    indexer.sh
    Update `SOZO_WORLD` address in indexer script                       

    scripts/indexer.sh

    • Updated SOZO_WORLD address in indexer script.
    +2/-2     
    manifest.toml
    Update deployment manifest with new class hashes and addresses

    contracts/manifests/dev/deployment/manifest.toml

  • Updated various class_hash, address, and base_class_hash values.
  • Changed type from u128 to ID in multiple model definitions.
  • +324/-313
    eternum-dev_resource_systems-9f04ac8a.json
    Update ABI definitions with new interface names and types

    contracts/manifests/dev/deployment/abis/contracts/eternum-dev_resource_systems-9f04ac8a.json

    • Updated interface names and types in ABI definitions.
    +13/-13 
    Additional files (token-limit)
    160 files
    dojo-world.json
    ...                                                                                                           

    contracts/manifests/dev/deployment/abis/dojo-world.json

    ...

    +70/-70 
    contracts.cairo
    ...                                                                                                           

    contracts/src/systems/combat/contracts.cairo

    ...

    +33/-32 
    eternum-Battle-20295758.json
    ...                                                                                                           

    contracts/manifests/dev/deployment/abis/models/eternum-Battle-20295758.json

    ...

    +36/-36 
    eternum-Building-a3631d0a.json
    ...                                                                                                           

    contracts/manifests/dev/deployment/abis/models/eternum-Building-a3631d0a.json

    ...

    +38/-38 
    eternum-BuildingConfig-2050f944.json
    ...                                                                                                           

    contracts/manifests/dev/deployment/abis/models/eternum-BuildingConfig-2050f944.json

    ...

    +34/-34 
    eternum-CapacityConfig-620df1a7.json
    ...                                                                                                           

    contracts/manifests/dev/deployment/abis/models/eternum-CapacityConfig-620df1a7.json

    ...

    +35/-35 
    eternum-Army-5434a98b.json
    ...                                                                                                           

    contracts/manifests/dev/deployment/abis/models/eternum-Army-5434a98b.json

    ...

    +34/-34 
    eternum-LevelingConfig-1c0257fd.json
    ...                                                                                                           

    contracts/manifests/dev/deployment/abis/models/eternum-LevelingConfig-1c0257fd.json

    ...

    +36/-36 
    eternum-Trade-73cd5d50.json
    ...                                                                                                           

    contracts/manifests/dev/deployment/abis/models/eternum-Trade-73cd5d50.json

    ...

    +37/-37 
    eternum-EntityOwner-23cb1be3.json
    ...                                                                                                           

    contracts/manifests/dev/deployment/abis/models/eternum-EntityOwner-23cb1be3.json

    ...

    +34/-34 
    eternum-EntityMetadata-72b04193.json
    ...                                                                                                           

    contracts/manifests/dev/deployment/abis/models/eternum-EntityMetadata-72b04193.json

    ...

    +34/-34 
    eternum-Movable-68de8765.json
    ...                                                                                                           

    contracts/manifests/dev/deployment/abis/models/eternum-Movable-68de8765.json

    ...

    +37/-37 
    eternum-BuildingCategoryPopConfig-5804f847.json
    ...                                                                                                           

    contracts/manifests/dev/deployment/abis/models/eternum-BuildingCategoryPopConfig-5804f847.json

    ...

    +33/-33 
    eternum-BuildingQuantityv2-31cdaf07.json
    ...                                                                                                           

    contracts/manifests/dev/deployment/abis/models/eternum-BuildingQuantityv2-31cdaf07.json

    ...

    +33/-33 
    eternum-Contribution-5402ccc4.json
    ...                                                                                                           

    contracts/manifests/dev/deployment/abis/models/eternum-Contribution-5402ccc4.json

    ...

    +33/-33 
    eternum-ArrivalTime-4dedc6c3.json
    ...                                                                                                           

    contracts/manifests/dev/deployment/abis/models/eternum-ArrivalTime-4dedc6c3.json

    ...

    +33/-33 
    eternum-BattleConfig-60902e8b.json
    ...                                                                                                           

    contracts/manifests/dev/deployment/abis/models/eternum-BattleConfig-60902e8b.json

    ...

    +33/-33 
    eternum-DetachedResource-5ed63b97.json
    ...                                                                                                           

    contracts/manifests/dev/deployment/abis/models/eternum-DetachedResource-5ed63b97.json

    ...

    +33/-33 
    eternum-GuildWhitelist-54f9b15d.json
    ...                                                                                                           

    contracts/manifests/dev/deployment/abis/models/eternum-GuildWhitelist-54f9b15d.json

    ...

    +33/-33 
    eternum-Bank-522579aa.json
    ...                                                                                                           

    contracts/manifests/dev/deployment/abis/models/eternum-Bank-522579aa.json

    ...

    +33/-33 
    eternum-BankConfig-667de14b.json
    ...                                                                                                           

    contracts/manifests/dev/deployment/abis/models/eternum-BankConfig-667de14b.json

    ...

    +33/-33 
    eternum-Capacity-27d77858.json
    ...                                                                                                           

    contracts/manifests/dev/deployment/abis/models/eternum-Capacity-27d77858.json

    ...

    +33/-33 
    eternum-EntityName-8c850fbe.json
    ...                                                                                                           

    contracts/manifests/dev/deployment/abis/models/eternum-EntityName-8c850fbe.json

    ...

    +33/-33 
    eternum-Guild-22d294a4.json
    ...                                                                                                           

    contracts/manifests/dev/deployment/abis/models/eternum-Guild-22d294a4.json

    ...

    +33/-33 
    eternum-Tile-5dfdf226.json
    ...                                                                                                           

    contracts/manifests/dev/deployment/abis/models/eternum-Tile-5dfdf226.json

    ...

    +35/-43 
    eternum-GuildMember-20ae0ece.json
    ...                                                                                                           

    contracts/manifests/dev/deployment/abis/models/eternum-GuildMember-20ae0ece.json

    ...

    +33/-33 
    eternum-ForeignKey-42013ea4.json
    ...                                                                                                           

    contracts/manifests/dev/deployment/abis/models/eternum-ForeignKey-42013ea4.json

    ...

    +33/-33 
    eternum-Road-426df582.json
    ...                                                                                                           

    contracts/manifests/dev/deployment/abis/models/eternum-Road-426df582.json

    ...

    +36/-36 
    eternum-SpeedConfig-1e31ed6d.json
    ...                                                                                                           

    contracts/manifests/dev/deployment/abis/models/eternum-SpeedConfig-1e31ed6d.json

    ...

    +35/-35 
    eternum-WeightConfig-4762f37e.json
    ...                                                                                                           

    contracts/manifests/dev/deployment/abis/models/eternum-WeightConfig-4762f37e.json

    ...

    +35/-35 
    eternum-Position-421d605b.json
    ...                                                                                                           

    contracts/manifests/dev/deployment/abis/models/eternum-Position-421d605b.json

    ...

    +35/-35 
    eternum-AddressName-48fbe026.json
    ...                                                                                                           

    contracts/manifests/dev/deployment/abis/models/eternum-AddressName-48fbe026.json

    ...

    +32/-32 
    eternum-RealmFreeMintConfig-767aa72c.json
    ...                                                                                                           

    contracts/manifests/dev/deployment/abis/models/eternum-RealmFreeMintConfig-767aa72c.json

    ...

    +34/-34 
    eternum-ResourceAllowance-18a7f402.json
    ...                                                                                                           

    contracts/manifests/dev/deployment/abis/models/eternum-ResourceAllowance-18a7f402.json

    ...

    +34/-34 
    eternum-Realm-68a0f35d.json
    ...                                                                                                           

    contracts/manifests/dev/deployment/abis/models/eternum-Realm-68a0f35d.json

    ...

    +34/-34 
    eternum-RoadConfig-424e8ddc.json
    ...                                                                                                           

    contracts/manifests/dev/deployment/abis/models/eternum-RoadConfig-424e8ddc.json

    ...

    +34/-34 
    eternum-Protectee-6e671952.json
    ...                                                                                                           

    contracts/manifests/dev/deployment/abis/models/eternum-Protectee-6e671952.json

    ...

    +34/-34 
    eternum-Protector-177334e3.json
    ...                                                                                                           

    contracts/manifests/dev/deployment/abis/models/eternum-Protector-177334e3.json

    ...

    +34/-34 
    eternum-StructureCount-754e52f0.json
    ...                                                                                                           

    contracts/manifests/dev/deployment/abis/models/eternum-StructureCount-754e52f0.json

    ...

    +34/-34 
    eternum-combat_systems-27f37676.json
    ...                                                                                                           

    contracts/manifests/dev/deployment/abis/contracts/eternum-combat_systems-27f37676.json

    ...

    +30/-30 
    eternum-MapExploreConfig-58fbbfce.json
    ...                                                                                                           

    contracts/manifests/dev/deployment/abis/models/eternum-MapExploreConfig-58fbbfce.json

    ...

    +33/-33 
    eternum-HasClaimedStartingResources-636eaec7.json
    ...                                                                                                           

    contracts/manifests/dev/deployment/abis/models/eternum-HasClaimedStartingResources-636eaec7.json

    ...

    +33/-33 
    eternum-MercenariesConfig-4c7248d4.json
    ...                                                                                                           

    contracts/manifests/dev/deployment/abis/models/eternum-MercenariesConfig-4c7248d4.json

    ...

    +33/-33 
    eternum-ResourceTransferLock-6a7c4096.json
    ...                                                                                                           

    contracts/manifests/dev/deployment/abis/models/eternum-ResourceTransferLock-6a7c4096.json

    ...

    +33/-33 
    eternum-Liquidity-6c6683f5.json
    ...                                                                                                           

    contracts/manifests/dev/deployment/abis/models/eternum-Liquidity-6c6683f5.json

    ...

    +33/-33 
    eternum-PopulationConfig-8cead3bb.json
    ...                                                                                                           

    contracts/manifests/dev/deployment/abis/models/eternum-PopulationConfig-8cead3bb.json

    ...

    +33/-33 
    eternum-WorldConfig-7b79ae7c.json
    ...                                                                                                           

    contracts/manifests/dev/deployment/abis/models/eternum-WorldConfig-7b79ae7c.json

    ...

    +33/-33 
    eternum-HyperstructureResourceConfig-34106fab.json
    ...                                                                                                           

    contracts/manifests/dev/deployment/abis/models/eternum-HyperstructureResourceConfig-34106fab.json

    ...

    +33/-33 
    eternum-Orders-4423b5ef.json
    ...                                                                                                           

    contracts/manifests/dev/deployment/abis/models/eternum-Orders-4423b5ef.json

    ...

    +33/-33 
    eternum-Progress-87eb8002.json
    ...                                                                                                           

    contracts/manifests/dev/deployment/abis/models/eternum-Progress-87eb8002.json

    ...

    +33/-33 
    eternum-StaminaConfig-b6eb17a7.json
    ...                                                                                                           

    contracts/manifests/dev/deployment/abis/models/eternum-StaminaConfig-b6eb17a7.json

    ...

    +33/-33 
    eternum-TroopConfig-5b63d326.json
    ...                                                                                                           

    contracts/manifests/dev/deployment/abis/models/eternum-TroopConfig-5b63d326.json

    ...

    +33/-33 
    eternum-Market-6dd46062.json
    ...                                                                                                           

    contracts/manifests/dev/deployment/abis/models/eternum-Market-6dd46062.json

    ...

    +33/-33 
    eternum-OwnedResourcesTracker-660391c3.json
    ...                                                                                                           

    contracts/manifests/dev/deployment/abis/models/eternum-OwnedResourcesTracker-660391c3.json

    ...

    +33/-33 
    eternum-Population-28c60ba8.json
    ...                                                                                                           

    contracts/manifests/dev/deployment/abis/models/eternum-Population-28c60ba8.json

    ...

    +33/-33 
    eternum-Resource-6aa2c384.json
    ...                                                                                                           

    contracts/manifests/dev/deployment/abis/models/eternum-Resource-6aa2c384.json

    ...

    +33/-33 
    eternum-ResourceCost-11ae7f37.json
    ...                                                                                                           

    contracts/manifests/dev/deployment/abis/models/eternum-ResourceCost-11ae7f37.json

    ...

    +33/-33 
    eternum-TickConfig-611cf60f.json
    ...                                                                                                           

    contracts/manifests/dev/deployment/abis/models/eternum-TickConfig-611cf60f.json

    ...

    +33/-33 
    eternum-Health-3bf465a5.json
    ...                                                                                                           

    contracts/manifests/dev/deployment/abis/models/eternum-Health-3bf465a5.json

    ...

    +33/-33 
    eternum-Structure-1ccc0e57.json
    ...                                                                                                           

    contracts/manifests/dev/deployment/abis/models/eternum-Structure-1ccc0e57.json

    ...

    +33/-33 
    eternum-Weight-24cf9d66.json
    ...                                                                                                           

    contracts/manifests/dev/deployment/abis/models/eternum-Weight-24cf9d66.json

    ...

    +33/-33 
    eternum-Owner-7395b328.json
    ...                                                                                                           

    contracts/manifests/dev/deployment/abis/models/eternum-Owner-7395b328.json

    ...

    +33/-33 
    eternum-Production-30841685.json
    ...                                                                                                           

    contracts/manifests/dev/deployment/abis/models/eternum-Production-30841685.json

    ...

    +33/-33 
    eternum-Quantity-3adcab42.json
    ...                                                                                                           

    contracts/manifests/dev/deployment/abis/models/eternum-Quantity-3adcab42.json

    ...

    +33/-33 
    eternum-Stamina-64093ed8.json
    ...                                                                                                           

    contracts/manifests/dev/deployment/abis/models/eternum-Stamina-64093ed8.json

    ...

    +33/-33 
    eternum-Status-508b6172.json
    ...                                                                                                           

    contracts/manifests/dev/deployment/abis/models/eternum-Status-508b6172.json

    ...

    +33/-33 
    eternum-Level-12edd20f.json
    ...                                                                                                           

    contracts/manifests/dev/deployment/abis/models/eternum-Level-12edd20f.json

    ...

    +33/-33 
    eternum-ProductionInput-4aa7f2e2.json
    ...                                                                                                           

    contracts/manifests/dev/deployment/abis/models/eternum-ProductionInput-4aa7f2e2.json

    ...

    +32/-32 
    eternum-ProductionOutput-3fcdac94.json
    ...                                                                                                           

    contracts/manifests/dev/deployment/abis/models/eternum-ProductionOutput-3fcdac94.json

    ...

    +32/-32 
    eternum-QuantityTracker-1889ed7d.json
    ...                                                                                                           

    contracts/manifests/dev/deployment/abis/models/eternum-QuantityTracker-1889ed7d.json

    ...

    +32/-32 
    eternum-ProductionConfig-58cf51ed.json
    ...                                                                                                           

    contracts/manifests/dev/deployment/abis/models/eternum-ProductionConfig-58cf51ed.json

    ...

    +32/-32 
    config.cairo
    ...                                                                                                           

    contracts/src/models/config.cairo

    ...

    +33/-32 
    eternum-trade_systems-7f6765dd.json
    ...                                                                                                           

    contracts/manifests/dev/deployment/abis/contracts/eternum-trade_systems-7f6765dd.json

    ...

    +18/-18 
    resources.cairo
    ...                                                                                                           

    contracts/src/models/resources.cairo

    ...

    +15/-14 
    eternum-config_systems-5f8c7cdc.json
    ...                                                                                                           

    contracts/manifests/dev/deployment/abis/contracts/eternum-config_systems-5f8c7cdc.json

    ...

    +17/-17 
    eternum-realm_systems-2b08f0da.json
    ...                                                                                                           

    contracts/manifests/dev/deployment/abis/contracts/eternum-realm_systems-2b08f0da.json

    ...

    +19/-19 
    eternum-resource_systems-59b73d5a.json
    ...                                                                                                           

    contracts/manifests/dev/deployment/abis/contracts/eternum-resource_systems-59b73d5a.json

    ...

    +18/-18 
    eternum-guild_systems-38e127d4.json
    ...                                                                                                           

    contracts/manifests/dev/deployment/abis/contracts/eternum-guild_systems-38e127d4.json

    ...

    +17/-17 
    eternum-hyperstructure_systems-3660009a.json
    ...                                                                                                           

    contracts/manifests/dev/deployment/abis/contracts/eternum-hyperstructure_systems-3660009a.json

    ...

    +18/-18 
    contracts.cairo
    ...                                                                                                           

    contracts/src/systems/hyperstructure/contracts.cairo

    ...

    +16/-18 
    eternum-swap_systems-216e8d44.json
    ...                                                                                                           

    contracts/manifests/dev/deployment/abis/contracts/eternum-swap_systems-216e8d44.json

    ...

    +18/-18 
    eternum-bank_systems-85030190.json
    ...                                                                                                           

    contracts/manifests/dev/deployment/abis/contracts/eternum-bank_systems-85030190.json

    ...

    +17/-17 
    eternum-liquidity_systems-337d668f.json
    ...                                                                                                           

    contracts/manifests/dev/deployment/abis/contracts/eternum-liquidity_systems-337d668f.json

    ...

    +17/-17 
    eternum-travel_systems-4ec72d4c.json
    ...                                                                                                           

    contracts/manifests/dev/deployment/abis/contracts/eternum-travel_systems-4ec72d4c.json

    ...

    +16/-16 
    eternum-building_systems-4b0f3026.json
    ...                                                                                                           

    contracts/manifests/dev/deployment/abis/contracts/eternum-building_systems-4b0f3026.json

    ...

    +16/-16 
    eternum-road_systems-61d8f9c9.json
    ...                                                                                                           

    contracts/manifests/dev/deployment/abis/contracts/eternum-road_systems-61d8f9c9.json

    ...

    +15/-15 
    eternum-dev_bank_systems-7a630ec9.json
    ...                                                                                                           

    contracts/manifests/dev/deployment/abis/contracts/eternum-dev_bank_systems-7a630ec9.json

    ...

    +15/-15 
    contracts.cairo
    ...                                                                                                           

    contracts/src/systems/guild/contracts.cairo

    ...

    +13/-13 
    eternum-map_systems-5431b122.json
    ...                                                                                                           

    contracts/manifests/dev/deployment/abis/contracts/eternum-map_systems-5431b122.json

    ...

    +13/-13 
    eternum-leveling_systems-5606a1c3.json
    ...                                                                                                           

    contracts/manifests/dev/deployment/abis/contracts/eternum-leveling_systems-5606a1c3.json

    ...

    +13/-13 
    eternum-name_systems-bbb2e543.json
    ...                                                                                                           

    contracts/manifests/dev/deployment/abis/contracts/eternum-name_systems-bbb2e543.json

    ...

    +13/-13 
    contracts.cairo
    ...                                                                                                           

    contracts/src/systems/map/contracts.cairo

    ...

    +14/-15 
    eternum-donkey_systems-4851519d.json
    ...                                                                                                           

    contracts/manifests/dev/deployment/abis/contracts/eternum-donkey_systems-4851519d.json

    ...

    +12/-12 
    trade_systems.cairo
    ...                                                                                                           

    contracts/src/systems/trade/contracts/trade_systems.cairo

    ...

    +19/-19 
    contracts.cairo
    ...                                                                                                           

    contracts/src/systems/config/contracts.cairo

    ...

    +8/-9     
    combat.cairo
    ...                                                                                                           

    contracts/src/models/combat.cairo

    ...

    +14/-13 
    dojo-base.json
    ...                                                                                                           

    contracts/manifests/dev/deployment/abis/dojo-base.json

    ...

    +11/-11 
    resource_transfer_system_tests.cairo
    ...                                                                                                           

    contracts/src/systems/resources/tests/resource_transfer_system_tests.cairo

    ...

    +12/-11 
    general.cairo
    ...                                                                                                           

    contracts/src/utils/testing/general.cairo

    ...

    +10/-18 
    liquidity.cairo
    ...                                                                                                           

    contracts/src/systems/bank/contracts/liquidity.cairo

    ...

    +9/-16   
    swap.cairo
    ...                                                                                                           

    contracts/src/systems/bank/contracts/swap.cairo

    ...

    +7/-11   
    buildings.cairo
    ...                                                                                                           

    contracts/src/models/buildings.cairo

    ...

    +11/-10 
    battle_leave_test.cairo
    ...                                                                                                           

    contracts/src/systems/combat/tests/battle_leave_test.cairo

    ...

    +11/-10 
    position.cairo
    ...                                                                                                           

    contracts/src/models/position.cairo

    ...

    +12/-10 
    resource_approval_system_tests.cairo
    ...                                                                                                           

    contracts/src/systems/resources/tests/resource_approval_system_tests.cairo

    ...

    +11/-10 
    battle_start_test.cairo
    ...                                                                                                           

    contracts/src/systems/combat/tests/battle_start_test.cairo

    ...

    +11/-10 
    constants.cairo
    ...                                                                                                           

    contracts/src/constants.cairo

    ...

    +13/-13 
    travel_systems_tests.cairo
    ...                                                                                                           

    contracts/src/systems/transport/tests/travel_systems_tests.cairo

    ...

    +7/-6     
    accept_order.cairo
    ...                                                                                                           

    contracts/src/systems/trade/tests/trade_systems_tests/accept_order.cairo

    ...

    +4/-4     
    tests.cairo
    ...                                                                                                           

    contracts/src/systems/map/tests.cairo

    ...

    +5/-4     
    cancel_order.cairo
    ...                                                                                                           

    contracts/src/systems/trade/tests/trade_systems_tests/cancel_order.cairo

    ...

    +4/-4     
    army_buy_test.cairo
    ...                                                                                                           

    contracts/src/systems/combat/tests/army_buy_test.cairo

    ...

    +5/-3     
    contracts.cairo
    ...                                                                                                           

    contracts/src/systems/realm/contracts.cairo

    ...

    +7/-5     
    road_systems_tests.cairo
    ...                                                                                                           

    contracts/src/systems/transport/tests/road_systems_tests.cairo

    ...

    +5/-4     
    contracts.cairo
    ...                                                                                                           

    contracts/src/systems/buildings/contracts.cairo

    ...

    +7/-4     
    owner.cairo
    ...                                                                                                           

    contracts/src/models/owner.cairo

    ...

    +6/-4     
    movable.cairo
    ...                                                                                                           

    contracts/src/models/movable.cairo

    ...

    +8/-8     
    .env.production
    ...                                                                                                           

    client/.env.production

    ...

    +1/-1     
    bank.cairo
    ...                                                                                                           

    contracts/src/systems/bank/contracts/bank.cairo

    ...

    +3/-3     
    liquidity.cairo
    ...                                                                                                           

    contracts/src/systems/bank/tests/liquidity.cairo

    ...

    +7/-6     
    army_create_test.cairo
    ...                                                                                                           

    contracts/src/systems/combat/tests/army_create_test.cairo

    ...

    +4/-3     
    swap.cairo
    ...                                                                                                           

    contracts/src/systems/bank/tests/swap.cairo

    ...

    +6/-5     
    contracts.cairo
    ...                                                                                                           

    contracts/src/systems/name/contracts.cairo

    ...

    +5/-3     
    create_order.cairo
    ...                                                                                                           

    contracts/src/systems/trade/tests/trade_systems_tests/create_order.cairo

    ...

    +3/-3     
    Scarb.toml
    ...                                                                                                           

    contracts/Scarb.toml

    ...

    +2/-2     
    level.cairo
    ...                                                                                                           

    contracts/src/models/level.cairo

    ...

    +3/-1     
    stamina.cairo
    ...                                                                                                           

    contracts/src/models/stamina.cairo

    ...

    +3/-2     
    tests.cairo
    ...                                                                                                           

    contracts/src/systems/realm/tests.cairo

    ...

    +3/-3     
    package.json
    ...                                                                                                           

    client/package.json

    ...

    +1/-1     
    bank.cairo
    ...                                                                                                           

    contracts/src/systems/dev/contracts/bank.cairo

    ...

    +3/-3     
    resource.cairo
    ...                                                                                                           

    contracts/src/systems/dev/contracts/resource.cairo

    ...

    +3/-2     
    internal_leveling_tests.cairo
    ...                                                                                                           

    contracts/src/systems/leveling/tests/internal_leveling_tests.cairo

    ...

    +3/-2     
    trade.cairo
    ...                                                                                                           

    contracts/src/models/trade.cairo

    ...

    +6/-6     
    market.cairo
    ...                                                                                                           

    contracts/src/models/bank/market.cairo

    ...

    +3/-1     
    road_systems.cairo
    ...                                                                                                           

    contracts/src/systems/transport/contracts/road_systems.cairo

    ...

    +2/-1     
    road.cairo
    ...                                                                                                           

    contracts/src/models/road.cairo

    ...

    +5/-4     
    config.cairo
    ...                                                                                                           

    contracts/src/utils/testing/config.cairo

    ...

    +3/-3     
    guild.cairo
    ...                                                                                                           

    contracts/src/models/guild.cairo

    ...

    +4/-3     
    realm_leveling_tests.cairo
    ...                                                                                                           

    contracts/src/systems/leveling/tests/realm_leveling_tests.cairo

    ...

    +2/-1     
    tests.cairo
    ...                                                                                                           

    contracts/src/systems/hyperstructure/tests.cairo

    ...

    +2/-1     
    contracts.mdx
    ...                                                                                                           

    eternum-docs/docs/pages/development/contracts.mdx

    ...

    +2/-2     
    production.cairo
    ...                                                                                                           

    contracts/src/models/production.cairo

    ...

    +2/-1     
    bank.cairo
    ...                                                                                                           

    contracts/src/systems/bank/tests/bank.cairo

    ...

    +2/-1     
    hyperstructure.cairo
    ...                                                                                                           

    contracts/src/models/hyperstructure.cairo

    ...

    +3/-2     
    map.cairo
    ...                                                                                                           

    contracts/src/models/map.cairo

    ...

    +4/-5     
    liquidity.cairo
    ...                                                                                                           

    contracts/src/models/bank/liquidity.cairo

    ...

    +2/-1     
    travel_systems.cairo
    ...                                                                                                           

    contracts/src/systems/transport/contracts/travel_systems.cairo

    ...

    +3/-3     
    bank.cairo
    ...                                                                                                           

    contracts/src/models/bank/bank.cairo

    ...

    +2/-1     
    metadata.cairo
    ...                                                                                                           

    contracts/src/models/metadata.cairo

    ...

    +3/-3     
    constants.cairo
    ...                                                                                                           

    contracts/src/utils/testing/constants.cairo

    ...

    +1/-1     
    capacity.cairo
    ...                                                                                                           

    contracts/src/models/capacity.cairo

    ...

    +2/-1     
    contracts.cairo
    ...                                                                                                           

    contracts/src/systems/resources/contracts.cairo

    ...

    +3/-3     
    population.cairo
    ...                                                                                                           

    contracts/src/models/population.cairo

    ...

    +2/-1     
    weight.cairo
    ...                                                                                                           

    contracts/src/models/weight.cairo

    ...

    +3/-1     
    name.cairo
    ...                                                                                                           

    contracts/src/models/name.cairo

    ...

    +3/-1     
    contracts.cairo
    ...                                                                                                           

    contracts/src/systems/leveling/contracts.cairo

    ...

    +1/-1     
    realm.cairo
    ...                                                                                                           

    contracts/src/models/realm.cairo

    ...

    +2/-2     
    order.cairo
    ...                                                                                                           

    contracts/src/models/order.cairo

    ...

    +3/-1     
    quantity.cairo
    ...                                                                                                           

    contracts/src/models/quantity.cairo

    ...

    +1/-1     
    structure.cairo
    ...                                                                                                           

    contracts/src/models/structure.cairo

    ...

    +1/-1     

    💡 PR-Agent usage:
    Comment /help on the PR to get a list of all available PR-Agent tools and their descriptions

    Copy link

    vercel bot commented Jul 27, 2024

    The latest updates on your projects. Learn more about Vercel for Git ↗︎

    Name Status Preview Comments Updated (UTC)
    eternum ❌ Failed (Inspect) Jul 29, 2024 11:52pm

    Copy link

    PR Reviewer Guide 🔍

    ⏱️ Estimated effort to review: 4 🔵🔵🔵🔵⚪
    🧪 No relevant tests
    🔒 No security concerns identified
    ⚡ Key issues to review

    Type Change
    The type of entity_id has been changed from u128 to ID across various structs. Ensure that this change is compatible with all parts of the system that interact with these models, particularly focusing on serialization, storage, and retrieval aspects to avoid runtime issues.

    Type Change
    The type of entity_id in the Capacity struct has been changed from u128 to ID. Similar to other models, verify that all interactions with this model handle the new type correctly.

    Copy link

    github-actions bot commented Jul 27, 2024

    PR Code Suggestions ✨

    CategorySuggestion                                                                                                                                    Score
    Possible issue
    Update variable types to maintain consistency with the new primary entity type

    Update the type of 'army_owner_id' to match the new primary entity type 'u32' to
    ensure type consistency across the system.

    contracts/manifests/dev/deployment/abis/contracts/eternum-combat_systems-27f37676.json [194]

    -"type": "core::integer::u128"
    +"type": "core::integer::u32"
     
    Suggestion importance[1-10]: 10

    Why: This suggestion addresses a critical issue by ensuring type consistency across the system, which is crucial for preventing runtime errors and maintaining data integrity.

    10
    Verify that the new integer type is sufficient for the data it needs to handle

    Ensure that the type change from 'core::integer::u128' to 'core::integer::u32' for
    'realm_entity_id' does not cause underflow or overflow issues due to the reduced
    size.

    contracts/manifests/dev/deployment/abis/contracts/eternum-leveling_systems-5606a1c3.json [144]

    -"type": "core::integer::u32"
    +"type": "core::integer::u32"  # Ensure compatibility with existing data ranges
     
    Suggestion importance[1-10]: 9

    Why: This suggestion addresses a potential issue with data compatibility and integrity, ensuring that the change from 'u128' to 'u32' does not introduce underflow or overflow problems.

    9
    Consider using a larger integer type for 'entity_id' to ensure future scalability

    Update the type of 'entity_id' to a more suitable data type if 'u32' might not
    accommodate future scalability or expected range of values, considering the change
    from 'u128'.

    contracts/manifests/dev/deployment/abis/contracts/eternum-dev_resource_systems-9f04ac8a.json [154]

    -"type": "core::integer::u32"
    +"type": "core::integer::u64"
     
    Suggestion importance[1-10]: 7

    Why: The suggestion addresses a potential issue with future scalability by recommending a larger integer type. While not immediately critical, it is a prudent consideration for future-proofing the code.

    7
    Possible bug
    Correct the interface name to avoid potential integration issues

    Ensure that the new interface names are correctly referenced in all related fields
    to maintain consistency and avoid integration issues.

    contracts/manifests/dev/deployment/abis/contracts/eternum-dev_resource_systems-9f04ac8a.json [221]

    -"name": "dojo::contract::upgradeable::upgradeable::Event"
    +"name": "dojo::contract::upgradeable::Event"
     
    Suggestion importance[1-10]: 9

    Why: Ensuring consistency in interface names is crucial to avoid integration issues. This suggestion corrects a potential bug, making it highly valuable for maintaining functional integrity.

    9
    Update nested type references to match the new interface names for consistency

    Consider revising the nested type references to ensure they align with the newly
    updated interface names, avoiding discrepancies that could lead to runtime errors.

    contracts/manifests/dev/deployment/abis/contracts/eternum-dev_resource_systems-9f04ac8a.json [226]

    -"type": "dojo::contract::upgradeable::upgradeable::Upgraded"
    +"type": "dojo::contract::upgradeable::Upgraded"
     
    Suggestion importance[1-10]: 9

    Why: Aligning nested type references with updated interface names is essential to prevent runtime errors. This suggestion addresses a possible bug, ensuring consistency and reliability in the code.

    9
    Maintainability
    Replace hardcoded hexadecimal value with a global constant

    Replace the hardcoded hexadecimal value for ADMIN_BANK_ENTITY_ID with a constant
    that can be managed globally or configured externally. Hardcoding values can lead to
    maintenance issues and makes the code less flexible.

    client/src/dojo/events/bankEventQueries.ts [6]

    -export const ADMIN_BANK_ENTITY_ID = "0x3b9ac9fe"; //999999998n;
    +export const ADMIN_BANK_ENTITY_ID = GLOBAL_ADMIN_BANK_ENTITY_ID;
     
    Suggestion importance[1-10]: 8

    Why: Replacing hardcoded values with global constants improves maintainability and flexibility, reducing the risk of errors during updates.

    8
    Centralize the management of WORLD_CONFIG_ID to enhance consistency

    Since WORLD_CONFIG_ID is likely used as a unique identifier across different parts
    of the application, ensure that its value is consistent and managed from a single
    source to prevent discrepancies.

    sdk/packages/eternum/src/constants/global.ts [92]

    -export const WORLD_CONFIG_ID = 999999999n;
    +export const WORLD_CONFIG_ID = GLOBAL_WORLD_CONFIG_ID;
     
    Suggestion importance[1-10]: 8

    Why: Centralizing the management of unique identifiers like WORLD_CONFIG_ID enhances consistency and reduces the risk of discrepancies.

    8
    Simplify interface naming to enhance clarity

    Consider using a more consistent naming convention for interface types to ensure
    clarity and maintainability. The current naming with repeated segments like
    "contract::contract" and "upgradeable::upgradeable" might be confusing.

    contracts/manifests/dev/deployment/abis/contracts/eternum-dev_resource_systems-9f04ac8a.json [5]

    -"interface_name": "dojo::contract::contract::IContract"
    +"interface_name": "dojo::contract::IContract"
     
    Suggestion importance[1-10]: 8

    Why: The suggestion improves code maintainability by simplifying the naming convention, making it easier to understand and reducing potential confusion. This is a significant improvement for long-term code clarity.

    8
    Simplify the interface naming by removing redundant segments

    Consider using a more consistent naming convention for interface types. The current
    naming includes redundant segments like 'contract::contract' which could be
    simplified.

    contracts/manifests/dev/deployment/abis/contracts/eternum-leveling_systems-5606a1c3.json [5]

    -"interface_name": "dojo::contract::contract::IContract"
    +"interface_name": "dojo::contract::IContract"
     
    Suggestion importance[1-10]: 8

    Why: The suggestion improves maintainability by removing redundant segments in the interface name, making it more concise and easier to read without changing functionality.

    8
    Simplify the nested type naming by removing redundant segments

    The nested type 'dojo::contract::upgradeable::upgradeable::Event' in
    'UpgradeableEvent' also contains redundant naming. Consider simplifying it.

    contracts/manifests/dev/deployment/abis/contracts/eternum-leveling_systems-5606a1c3.json [224]

    -"type": "dojo::contract::upgradeable::upgradeable::Event"
    +"type": "dojo::contract::upgradeable::Event"
     
    Suggestion importance[1-10]: 8

    Why: This suggestion improves maintainability by simplifying the nested type naming, removing unnecessary redundancy and enhancing readability.

    8
    Standardize naming conventions for interfaces and their implementations

    Ensure consistent naming conventions across the interface and its implementations to
    facilitate easier maintenance and understanding.

    contracts/manifests/dev/deployment/abis/contracts/eternum-combat_systems-27f37676.json [100]

    -"interface_name": "dojo::world::world_contract::IWorldProvider"
    +"interface_name": "dojo::world::contract::IWorldProvider"
     
    Suggestion importance[1-10]: 7

    Why: Ensuring consistent naming conventions across interfaces and implementations facilitates easier maintenance and understanding, which is important for long-term code quality.

    7
    Enhancement
    Refine the namespace for interface names to enhance clarity and prevent conflicts

    Consider using a more specific namespace for the interface name to avoid potential
    conflicts and improve clarity.

    contracts/manifests/dev/deployment/abis/contracts/eternum-combat_systems-27f37676.json [5]

    -"interface_name": "dojo::contract::contract::IContract"
    +"interface_name": "dojo::contract::combat::ICombatContract"
     
    Suggestion importance[1-10]: 8

    Why: The suggestion improves clarity and prevents potential conflicts by using a more specific namespace. This is a significant enhancement for maintainability and readability.

    8
    Remove redundant segments in the event name for better clarity

    Update the event name 'dojo::contract::upgradeable::upgradeable::Upgraded' to remove
    the duplicate 'upgradeable' segment for clarity and consistency.

    contracts/manifests/dev/deployment/abis/contracts/eternum-leveling_systems-5606a1c3.json [195]

    -"name": "dojo::contract::upgradeable::upgradeable::Upgraded"
    +"name": "dojo::contract::upgradeable::Upgraded"
     
    Suggestion importance[1-10]: 8

    Why: The suggestion enhances clarity and consistency by removing redundant segments in the event name, making it more readable and maintainable.

    8
    Best practice
    Ensure consistent BigInt usage by using the BigInt constructor

    Use a BigInt notation directly for ADMIN_BANK_ENTITY_ID to ensure the value is
    treated as a BigInt throughout the application, avoiding potential type coercion
    issues in JavaScript.

    config/bank/index.ts [26]

    -const ADMIN_BANK_ENTITY_ID = 999999998n;
    +const ADMIN_BANK_ENTITY_ID = BigInt('999999998');
     
    Suggestion importance[1-10]: 7

    Why: Using the BigInt constructor ensures consistent handling of large integers, which is a best practice to avoid type coercion issues.

    7
    Align event types with interface names for consistent event handling

    Adjust the event type to align with the updated interface name to maintain
    consistency in event handling.

    contracts/manifests/dev/deployment/abis/contracts/eternum-combat_systems-27f37676.json [393]

    -"type": "dojo::contract::upgradeable::upgradeable::Upgraded"
    +"type": "dojo::contract::upgradeable::IUpgradedEvent"
     
    Suggestion importance[1-10]: 6

    Why: Adjusting the event type to align with the updated interface name is a good practice for consistency, although it is a minor improvement compared to other suggestions.

    6

    contracts/src/constants.cairo Outdated Show resolved Hide resolved
    Comment on lines +25 to +31
    outer_col: u32,
    #[key]
    outer_row: u128,
    outer_row: u32,
    #[key]
    inner_col: u128,
    inner_col: u32,
    #[key]
    inner_row: u128,
    inner_row: u32,
    Copy link
    Collaborator

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    Maybe we could use a type alias for these too: Coordinate ?

    contracts/src/models/config.cairo Outdated Show resolved Hide resolved
    #[dojo::model]
    pub struct Progress {
    #[key]
    hyperstructure_entity_id: u128,
    hyperstructure_entity_id: ID,
    #[key]
    resource_type: u8,
    Copy link
    Collaborator

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    Alias for this as well? It's used in a bunch of different places

    contracts/src/models/order.cairo Outdated Show resolved Hide resolved
    contracts/src/models/production.cairo Outdated Show resolved Hide resolved
    contracts/src/systems/combat/contracts.cairo Outdated Show resolved Hide resolved
    @credence0x credence0x merged commit 260cd21 into v1 Jul 30, 2024
    17 of 20 checks passed
    @credence0x credence0x deleted the u32-id branch July 30, 2024 09:51
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    2 participants