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

deploy new world #1156

Merged
merged 2 commits into from
Aug 6, 2024
Merged

deploy new world #1156

merged 2 commits into from
Aug 6, 2024

Conversation

aymericdelab
Copy link
Collaborator

@aymericdelab aymericdelab commented Aug 6, 2024

PR Type

enhancement, configuration changes


Description

  • Updated deployment slots from eternum-24 to eternum-25 in scripts/deploy.sh.
  • Removed --name eternum from the sozo migrate apply command in scripts/deploy.sh.
  • Updated STARKNET_RPC_URL, DOJO_ACCOUNT_ADDRESS, and DOJO_PRIVATE_KEY in contracts/scripts/env_variables.sh.
  • Changed profile name from dev to prod and updated RPC URL to eternum-25 in contracts/manifests/prod/deployment/manifest.toml.
  • Updated various class hashes and ABI paths to production versions in contracts/manifests/prod/deployment/manifest.toml.
  • Added new ABI definitions for dojo-world in contracts/manifests/prod/deployment/abis/dojo-world.json.
  • Added new ABI definitions for eternum-bank_systems in contracts/manifests/prod/deployment/abis/contracts/eternum-bank_systems-85030190.json.

Changes walkthrough 📝

Relevant files
Configuration changes
3 files
deploy.sh
Update deployment slots and migration command                       

scripts/deploy.sh

  • Updated deployment slots from eternum-24 to eternum-25.
  • Removed --name eternum from the sozo migrate apply command.
  • +5/-5     
    env_variables.sh
    Update environment variables for production                           

    contracts/scripts/env_variables.sh

  • Updated STARKNET_RPC_URL to point to eternum-25.
  • Updated DOJO_ACCOUNT_ADDRESS and DOJO_PRIVATE_KEY.
  • +3/-3     
    manifest.toml
    Update manifest for production deployment                               

    contracts/manifests/prod/deployment/manifest.toml

  • Changed profile name from dev to prod.
  • Updated RPC URL to eternum-25.
  • Updated various class hashes and ABI paths to production versions.
  • +102/-102
    Enhancement
    2 files
    dojo-world.json
    Add ABI definitions for dojo-world                                             

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

    • Added new ABI definitions for dojo-world.
    +1186/-0
    eternum-bank_systems-85030190.json
    Add ABI definitions for eternum-bank systems                         

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

    • Added new ABI definitions for eternum-bank_systems.
    +279/-0 
    Additional files (token-limit)
    90 files
    eternum-config_systems-5f8c7cdc.json
    ...                                                                                                           

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

    ...

    +865/-0 
    eternum-Battle-20295758.json
    ...                                                                                                           

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

    ...

    +519/-0 
    eternum-Building-a3631d0a.json
    ...                                                                                                           

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

    ...

    +497/-0 
    eternum-Tile-5dfdf226.json
    ...                                                                                                           

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

    ...

    +489/-0 
    eternum-BuildingConfig-2050f944.json
    ...                                                                                                           

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

    ...

    +481/-0 
    eternum-BuildingCategoryPopConfig-5804f847.json
    ...                                                                                                           

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

    ...

    +477/-0 
    eternum-BuildingQuantityv2-31cdaf07.json
    ...                                                                                                           

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

    ...

    +473/-0 
    eternum-LevelingConfig-1c0257fd.json
    ...                                                                                                           

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

    ...

    +455/-0 
    eternum-Army-5434a98b.json
    ...                                                                                                           

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

    ...

    +451/-0 
    eternum-MercenariesConfig-4c7248d4.json
    ...                                                                                                           

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

    ...

    +439/-0 
    eternum-Market-6dd46062.json
    ...                                                                                                           

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

    ...

    +447/-0 
    eternum-Liquidity-6c6683f5.json
    ...                                                                                                           

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

    ...

    +443/-0 
    eternum-TroopConfig-5b63d326.json
    ...                                                                                                           

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

    ...

    +439/-0 
    eternum-Movable-68de8765.json
    ...                                                                                                           

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

    ...

    +445/-0 
    eternum-Trade-73cd5d50.json
    ...                                                                                                           

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

    ...

    +439/-0 
    eternum-Realm-68a0f35d.json
    ...                                                                                                           

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

    ...

    +439/-0 
    eternum-Structure-1ccc0e57.json
    ...                                                                                                           

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

    ...

    +433/-0 
    eternum-Production-30841685.json
    ...                                                                                                           

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

    ...

    +427/-0 
    eternum-Bank-522579aa.json
    ...                                                                                                           

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

    ...

    +429/-0 
    eternum-HasClaimedStartingResources-636eaec7.json
    ...                                                                                                           

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

    ...

    +425/-0 
    eternum-GuildWhitelist-54f9b15d.json
    ...                                                                                                           

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

    ...

    +425/-0 
    eternum-MapExploreConfig-58fbbfce.json
    ...                                                                                                           

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

    ...

    +419/-0 
    eternum-OwnedResourcesTracker-660391c3.json
    ...                                                                                                           

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

    ...

    +421/-0 
    eternum-StructureCount-754e52f0.json
    ...                                                                                                           

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

    ...

    +421/-0 
    eternum-Guild-22d294a4.json
    ...                                                                                                           

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

    ...

    +425/-0 
    eternum-Road-426df582.json
    ...                                                                                                           

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

    ...

    +419/-0 
    eternum-combat_systems-27f37676.json
    ...                                                                                                           

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

    ...

    +427/-0 
    eternum-ResourceAllowance-18a7f402.json
    ...                                                                                                           

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

    ...

    +415/-0 
    eternum-Contribution-5402ccc4.json
    ...                                                                                                           

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

    ...

    +415/-0 
    eternum-DetachedResource-5ed63b97.json
    ...                                                                                                           

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

    ...

    +415/-0 
    eternum-CapacityConfig-620df1a7.json
    ...                                                                                                           

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

    ...

    +415/-0 
    eternum-ProductionInput-4aa7f2e2.json
    ...                                                                                                           

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

    ...

    +415/-0 
    eternum-RoadConfig-424e8ddc.json
    ...                                                                                                           

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

    ...

    +415/-0 
    eternum-BankConfig-667de14b.json
    ...                                                                                                           

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

    ...

    +415/-0 
    eternum-SpeedConfig-1e31ed6d.json
    ...                                                                                                           

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

    ...

    +415/-0 
    eternum-WeightConfig-4762f37e.json
    ...                                                                                                           

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

    ...

    +415/-0 
    eternum-ProductionConfig-58cf51ed.json
    ...                                                                                                           

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

    ...

    +415/-0 
    eternum-ResourceCost-11ae7f37.json
    ...                                                                                                           

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

    ...

    +415/-0 
    eternum-RealmFreeMintConfig-767aa72c.json
    ...                                                                                                           

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

    ...

    +411/-0 
    eternum-HyperstructureResourceConfig-34106fab.json
    ...                                                                                                           

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

    ...

    +411/-0 
    eternum-WorldConfig-7b79ae7c.json
    ...                                                                                                           

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

    ...

    +411/-0 
    eternum-StaminaConfig-b6eb17a7.json
    ...                                                                                                           

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

    ...

    +411/-0 
    eternum-Stamina-64093ed8.json
    ...                                                                                                           

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

    ...

    +411/-0 
    eternum-ProductionOutput-3fcdac94.json
    ...                                                                                                           

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

    ...

    +411/-0 
    eternum-TickConfig-611cf60f.json
    ...                                                                                                           

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

    ...

    +411/-0 
    eternum-Progress-87eb8002.json
    ...                                                                                                           

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

    ...

    +411/-0 
    eternum-Population-28c60ba8.json
    ...                                                                                                           

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

    ...

    +411/-0 
    eternum-Resource-6aa2c384.json
    ...                                                                                                           

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

    ...

    +411/-0 
    eternum-Health-3bf465a5.json
    ...                                                                                                           

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

    ...

    +411/-0 
    eternum-Level-12edd20f.json
    ...                                                                                                           

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

    ...

    +411/-0 
    eternum-Position-421d605b.json
    ...                                                                                                           

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

    ...

    +411/-0 
    eternum-ArrivalTime-4dedc6c3.json
    ...                                                                                                           

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

    ...

    +407/-0 
    eternum-ResourceTransferLock-6a7c4096.json
    ...                                                                                                           

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

    ...

    +407/-0 
    eternum-GuildMember-20ae0ece.json
    ...                                                                                                           

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

    ...

    +407/-0 
    eternum-BattleConfig-60902e8b.json
    ...                                                                                                           

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

    ...

    +407/-0 
    eternum-EntityOwner-23cb1be3.json
    ...                                                                                                           

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

    ...

    +407/-0 
    eternum-PopulationConfig-8cead3bb.json
    ...                                                                                                           

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

    ...

    +407/-0 
    eternum-Protectee-6e671952.json
    ...                                                                                                           

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

    ...

    +407/-0 
    eternum-Protector-177334e3.json
    ...                                                                                                           

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

    ...

    +407/-0 
    eternum-EntityMetadata-72b04193.json
    ...                                                                                                           

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

    ...

    +407/-0 
    eternum-QuantityTracker-1889ed7d.json
    ...                                                                                                           

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

    ...

    +407/-0 
    eternum-EntityName-8c850fbe.json
    ...                                                                                                           

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

    ...

    +407/-0 
    eternum-Owner-7395b328.json
    ...                                                                                                           

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

    ...

    +407/-0 
    eternum-ForeignKey-42013ea4.json
    ...                                                                                                           

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

    ...

    +407/-0 
    eternum-Capacity-27d77858.json
    ...                                                                                                           

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

    ...

    +407/-0 
    eternum-Orders-4423b5ef.json
    ...                                                                                                           

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

    ...

    +407/-0 
    eternum-AddressName-48fbe026.json
    ...                                                                                                           

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

    ...

    +407/-0 
    eternum-Weight-24cf9d66.json
    ...                                                                                                           

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

    ...

    +407/-0 
    eternum-Quantity-3adcab42.json
    ...                                                                                                           

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

    ...

    +407/-0 
    eternum-Status-508b6172.json
    ...                                                                                                           

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

    ...

    +407/-0 
    eternum-building_systems-4b0f3026.json
    ...                                                                                                           

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

    ...

    +347/-0 
    eternum-guild_systems-38e127d4.json
    ...                                                                                                           

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

    ...

    +330/-0 
    eternum-trade_systems-7f6765dd.json
    ...                                                                                                           

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

    ...

    +299/-0 
    eternum-realm_systems-2b08f0da.json
    ...                                                                                                           

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

    ...

    +307/-0 
    eternum-travel_systems-4ec72d4c.json
    ...                                                                                                           

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

    ...

    +303/-0 
    eternum-liquidity_systems-337d668f.json
    ...                                                                                                           

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

    ...

    +301/-0 
    eternum-resource_systems-59b73d5a.json
    ...                                                                                                           

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

    ...

    +287/-0 
    eternum-hyperstructure_systems-3660009a.json
    ...                                                                                                           

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

    ...

    +281/-0 
    eternum-swap_systems-216e8d44.json
    ...                                                                                                           

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

    ...

    +273/-0 
    eternum-road_systems-61d8f9c9.json
    ...                                                                                                           

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

    ...

    +255/-0 
    eternum-map_systems-5431b122.json
    ...                                                                                                           

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

    ...

    +263/-0 
    eternum-dev_bank_systems-7a630ec9.json
    ...                                                                                                           

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

    ...

    +255/-0 
    eternum-dev_resource_systems-9f04ac8a.json
    ...                                                                                                           

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

    ...

    +243/-0 
    eternum-name_systems-bbb2e543.json
    ...                                                                                                           

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

    ...

    +245/-0 
    manifest.json
    ...                                                                                                           

    contracts/manifests/prod/deployment/manifest.json

    ...

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

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

    ...

    +229/-0 
    eternum-donkey_systems-4851519d.json
    ...                                                                                                           

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

    ...

    +206/-0 
    dojo-base.json
    ...                                                                                                           

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

    ...

    +98/-0   
    .env.production
    ...                                                                                                           

    client/.env.production

    ...

    +7/-8     
    Scarb.toml
    ...                                                                                                           

    contracts/Scarb.toml

    ...

    +13/-3   

    💡 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 Aug 6, 2024

    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 Aug 6, 2024 8:55pm

    Copy link

    github-actions bot commented Aug 6, 2024

    PR Reviewer Guide 🔍

    ⏱️ Estimated effort to review: 4 🔵🔵🔵🔵⚪
    🧪 No relevant tests
    🔒 Security concerns

    Sensitive Data Exposure:
    The PR includes hard-coded sensitive information (DOJO_ACCOUNT_ADDRESS and DOJO_PRIVATE_KEY) in contracts/scripts/env_variables.sh. This could lead to security vulnerabilities if the repository is public or compromised. It is recommended to manage sensitive data through environment variables or secure secrets management tools to avoid exposure.

    ⚡ Key issues to review

    Sensitive Data Exposure
    The PR exposes sensitive data such as DOJO_ACCOUNT_ADDRESS and DOJO_PRIVATE_KEY directly in the script file. This poses a security risk as it can lead to unauthorized access if the repository is public or becomes compromised. It's recommended to use environment variables or secure vaults to handle sensitive data.

    Copy link

    github-actions bot commented Aug 6, 2024

    PR Code Suggestions ✨

    CategorySuggestion                                                                                                                                    Score
    Security
    Replace hardcoded sensitive information with environment variables

    Avoid hardcoding sensitive information such as private keys and account addresses
    directly in scripts. Use environment variables or secure vaults instead.

    contracts/scripts/env_variables.sh [14-16]

    -STARKNET_RPC_URL="https://api.cartridge.gg/x/eternum-25/katana/"
    -DOJO_ACCOUNT_ADDRESS="0x55367f30b4bf2b32a11fd4e3c663d5b34ecade2a19845c942de742c5905dd3e"
    -DOJO_PRIVATE_KEY="0x3791d238d54d62a2f98cb2fc1309112321ceb6cd628606f062ab0a004576c7e"
    +STARKNET_RPC_URL="$STARKNET_RPC_URL"
    +DOJO_ACCOUNT_ADDRESS="$DOJO_ACCOUNT_ADDRESS"
    +DOJO_PRIVATE_KEY="$DOJO_PRIVATE_KEY"
     
    Suggestion importance[1-10]: 10

    Why: Hardcoding sensitive information such as private keys and account addresses directly in scripts is a significant security risk. Using environment variables or secure vaults instead is a best practice to enhance security.

    10
    Replace hardcoded private keys with environment variable references

    Avoid storing private keys in environment files, which can be exposed in version
    control. Use a secure vault or environment variable management system.

    client/.env.production [2]

    -VITE_PUBLIC_MASTER_PRIVATE_KEY="0x3791d238d54d62a2f98cb2fc1309112321ceb6cd628606f062ab0a004576c7e"
    +VITE_PUBLIC_MASTER_PRIVATE_KEY="$VITE_PUBLIC_MASTER_PRIVATE_KEY"
     
    Suggestion importance[1-10]: 10

    Why: Storing private keys in environment files can expose them in version control, posing a security risk. Using a secure vault or environment variable management system is a safer alternative.

    10
    Correct the state mutability settings to reflect actual function behavior

    The state_mutability property is consistently set to "view" for several functions
    that do not modify state. However, for functions that clearly change the state (like
    set_world_config), it is set to "external". Ensure that the state_mutability
    accurately reflects the function's interaction with the contract's state, as
    incorrect settings can lead to security vulnerabilities.

    contracts/manifests/prod/deployment/abis/contracts/eternum-config_systems-5f8c7cdc.json [152]

    -"state_mutability": "external"
    +"state_mutability": "nonpayable"
     
    Suggestion importance[1-10]: 9

    Why: Ensuring that state_mutability accurately reflects the function's interaction with the contract's state is crucial for security. Incorrect settings can lead to vulnerabilities, making this suggestion highly important.

    9
    Implement input validation for numerical fields to prevent overflow and ensure data integrity

    To avoid potential overflow issues and ensure data integrity, validate the input
    ranges for all functions accepting numerical inputs, especially where large integers
    (core::integer::u128) are used. Implement checks either in the smart contract
    functions or in the calling client application to prevent values that exceed the
    business logic's expected range.

    contracts/manifests/prod/deployment/abis/contracts/eternum-config_systems-5f8c7cdc.json [208]

    -"type": "core::integer::u128"
    +"type": "core::integer::u128",
    +"validateRange": "0 to 1000000"
     
    Suggestion importance[1-10]: 8

    Why: Adding input validation for numerical fields is a significant improvement for security and data integrity. This helps prevent potential overflow issues and ensures that inputs adhere to expected ranges, which is critical for maintaining robust and secure contracts.

    8
    Enhancement
    Add output to battle_claim to indicate operation success

    Add a return type to the battle_claim function to provide feedback about the
    operation's success or result, improving the function's usability and debuggability.

    contracts/manifests/prod/deployment/abis/contracts/eternum-combat_systems-27f37676.json [334-345]

     {
       "name": "battle_claim",
       "inputs": [...],
    -  "outputs": [],
    +  "outputs": [
    +    {
    +      "name": "success",
    +      "type": "core::bool"
    +    }
    +  ],
       "state_mutability": "external"
     }
     
    Suggestion importance[1-10]: 9

    Why: Providing feedback on the success of the battle_claim operation enhances usability and debuggability, making it easier to handle and diagnose issues.

    9
    Improve data integrity by using a larger integer type for entity_id

    Consider using a more specific type than core::integer::u32 for entity_id in the
    create function to ensure data integrity and prevent potential overflow issues.

    contracts/manifests/prod/deployment/abis/contracts/eternum-building_systems-4b0f3026.json [233-234]

     {
       "name": "entity_id",
    -  "type": "core::integer::u32"
    +  "type": "core::integer::u64"
     }
     
    Suggestion importance[1-10]: 7

    Why: Using a larger integer type can help prevent overflow issues and improve data integrity, but it may not be necessary if u32 is sufficient for the expected range of entity_id values.

    7
    Enhance the BuildingCategory enum to include associated data for scalability

    Refactor the BuildingCategory enum to use associated data for each variant to allow
    future extensibility and additional metadata per category.

    contracts/manifests/prod/deployment/abis/contracts/eternum-building_systems-4b0f3026.json [157-158]

     {
       "name": "Castle",
    -  "type": "()"
    +  "type": "{ capacity: core::integer::u32 }"
     }
     
    Suggestion importance[1-10]: 6

    Why: Adding associated data to enum variants can improve extensibility, but it may add unnecessary complexity if the additional metadata is not currently needed.

    6
    Maintainability
    Use a descriptive enum type for is_defensive_army to improve code clarity

    Replace the core::bool type with a more descriptive enum for is_defensive_army to
    enhance readability and maintainability of the code.

    contracts/manifests/prod/deployment/abis/contracts/eternum-combat_systems-27f37676.json [197-198]

     {
       "name": "is_defensive_army",
    -  "type": "core::bool"
    +  "type": "eternum::models::combat::ArmyType"
     }
     
    Suggestion importance[1-10]: 8

    Why: Replacing core::bool with a more descriptive enum enhances readability and maintainability, making the code more self-explanatory and reducing the risk of misinterpretation.

    8
    Modify namespace to avoid potential conflicts between different environments

    Ensure that the namespace configuration under different profiles does not lead to
    conflicts or unintended behavior by maintaining unique namespaces or handling them
    conditionally in the code.

    contracts/Scarb.toml [20-22]

     [profile.prod.tool.dojo.world.namespace]
    -default = "eternum"
    +default = "prod_eternum"
     
    Suggestion importance[1-10]: 7

    Why: Ensuring unique namespaces for different profiles can prevent conflicts and unintended behavior, improving maintainability. However, this change is not as critical as security-related suggestions.

    7
    Group related functions for better structure and readability

    For better organization and readability, consider grouping related functions under a
    common parent in the JSON structure. For example, all functions related to
    configuration settings (set_world_config, set_mint_config, etc.) could be nested
    under a configurations key. This would make the structure more navigable and
    logical.

    contracts/manifests/prod/deployment/abis/contracts/eternum-config_systems-5f8c7cdc.json [139-178]

    -"type": "function",
    -"name": "set_world_config",
    -...
    -"type": "function",
    -"name": "set_mint_config",
    +"configurations": {
    +  "type": "function",
    +  "name": "set_world_config",
    +  ...
    +  "type": "function",
    +  "name": "set_mint_config",
    +}
     
    Suggestion importance[1-10]: 7

    Why: Grouping related functions under a common parent key improves the organization and readability of the JSON structure. This enhances maintainability and makes the structure more logical, which is beneficial for developers navigating the code.

    7
    Best practice
    Add error handling to deployment commands to improve robustness

    Consider adding error handling for deployment commands to manage failures
    gracefully, such as checking the exit status of each command.

    scripts/deploy.sh [14]

    -slot deployments create eternum-25 katana --version v1.0.0-alpha.3 --invoke-max-steps 25000000 --disable-fee true --block-time 1000
    +if ! slot deployments create eternum-25 katana --version v1.0.0-alpha.3 --invoke-max-steps 25000000 --disable-fee true --block-time 1000; then
    +    echo "Deployment failed"
    +    exit 1
    +fi
     
    Suggestion importance[1-10]: 8

    Why: Adding error handling for deployment commands ensures that failures are managed gracefully, improving the robustness and reliability of the deployment process.

    8
    Standardize integer types for consistency and clarity

    It's recommended to use consistent naming conventions for types across your JSON
    schema. The type core::integer::u128 is used in multiple places, but similar types
    like core::integer::u8 and core::integer::u32 are also used. Consider using a
    consistent size for integer types where applicable, or clearly document the reason
    for using different sizes to avoid confusion and potential errors in data handling.

    contracts/manifests/prod/deployment/abis/contracts/eternum-config_systems-5f8c7cdc.json [208]

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

    Why: The suggestion to standardize integer types is valid for consistency, but changing core::integer::u128 to core::integer::u64 might not be appropriate without understanding the specific requirements for each field. This suggestion addresses a minor issue related to code readability and maintainability.

    5

    @aymericdelab aymericdelab merged commit db83eec into main Aug 6, 2024
    21 checks passed
    @aymericdelab aymericdelab deleted the deploy-prod branch August 6, 2024 20:56
    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