-
Notifications
You must be signed in to change notification settings - Fork 51
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
Update policies #2658
Update policies #2658
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Skipped Deployment
|
Hi @bob0005! You need to be added as a user to interact with me. Please ask @ponderingdemocritus to add you on the settings page. You are receiving this comment because I am set to review all PRs. That is configurable here. |
Warning There were issues while running some tools. Please review the errors and either fix the tool’s configuration or disable the tool if it’s a critical failure. 🔧 eslint
client/apps/game/src/hooks/context/policies.tsOops! Something went wrong! :( ESLint: 9.18.0 ESLint couldn't find an eslint.config.(js|mjs|cjs) file. From ESLint v9.0.0, the default configuration file is now eslint.config.js. https://eslint.org/docs/latest/use/configure/migration-guide If you still have problems after following the migration guide, please stop by WalkthroughThis pull request introduces significant changes to the game's contract policies and development-related functionality. The modifications involve updating multiple contract addresses in the policies configuration, removing development-specific realm creation methods, and introducing a new contract address with building-related methods. The changes appear to streamline the contract interactions and remove some development-specific features, potentially preparing the codebase for a more production-ready state. Changes
Possibly related PRs
Suggested reviewers
Poem
✨ Finishing Touches
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Failed to generate code suggestions for PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (4)
client/update-policies.js (3)
27-27
: Simplify conditional check using optional chainingAt line 27, you can simplify the conditional check by utilizing optional chaining. Replace
if (contract.systems && contract.systems.includes(systemName))
withif (contract.systems?.includes(systemName))
for cleaner and more concise code.Apply this diff to simplify the conditional check:
- if (contract.systems && contract.systems.includes(systemName)) { + if (contract.systems?.includes(systemName)) {🧰 Tools
🪛 Biome (1.9.4)
[error] 27-27: Change to an optional chain.
Unsafe fix: Change to an optional chain.
(lint/complexity/useOptionalChain)
🪛 GitHub Actions: lint
[warning] Code formatting does not match Prettier standards. Run 'prettier --write' to fix formatting issues.
103-103
: Set default network to 'sepolia' when no argument is providedCurrently, if no network argument is provided, the
network
variable will beundefined
, and the script will throw an error. To default to 'sepolia' as indicated in the comment, setnetwork
to 'sepolia' whenprocess.argv[2]
is not provided.Apply this diff to set the default network:
- const network = process.argv[2]; + const network = process.argv[2] || 'sepolia';🧰 Tools
🪛 GitHub Actions: lint
[warning] Code formatting does not match Prettier standards. Run 'prettier --write' to fix formatting issues.
1-105
: Fix code formatting to match Prettier standardsThe code formatting in this file does not match Prettier standards. Please run
prettier --write
to fix formatting issues.🧰 Tools
🪛 Biome (1.9.4)
[error] 27-27: Change to an optional chain.
Unsafe fix: Change to an optional chain.
(lint/complexity/useOptionalChain)
🪛 GitHub Actions: lint
[warning] Code formatting does not match Prettier standards. Run 'prettier --write' to fix formatting issues.
client/apps/game/src/hooks/context/policies.ts (1)
Line range hint
1-720
: Fix code formatting to match Prettier standardsThe code formatting in this file does not match Prettier standards. Please run
prettier --write
to fix formatting issues.🧰 Tools
🪛 GitHub Actions: lint
[warning] Code formatting does not match Prettier standards. Run 'prettier --write' to fix formatting issues.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (6)
client/apps/game/src/hooks/context/policies.ts
(23 hunks)client/apps/game/src/ui/layouts/onboarding.tsx
(0 hunks)client/update-policies.js
(1 hunks)contracts/game/src/systems/dev/contracts/realm.cairo
(0 hunks)contracts/game/src/utils/testing/world.cairo
(0 hunks)packages/core/src/provider/index.ts
(0 hunks)
💤 Files with no reviewable changes (4)
- contracts/game/src/utils/testing/world.cairo
- contracts/game/src/systems/dev/contracts/realm.cairo
- packages/core/src/provider/index.ts
- client/apps/game/src/ui/layouts/onboarding.tsx
🧰 Additional context used
🪛 Biome (1.9.4)
client/update-policies.js
[error] 27-27: Change to an optional chain.
Unsafe fix: Change to an optional chain.
(lint/complexity/useOptionalChain)
🪛 GitHub Actions: lint
client/update-policies.js
[warning] Code formatting does not match Prettier standards. Run 'prettier --write' to fix formatting issues.
client/apps/game/src/hooks/context/policies.ts
[warning] Code formatting does not match Prettier standards. Run 'prettier --write' to fix formatting issues.
🔇 Additional comments (1)
client/apps/game/src/hooks/context/policies.ts (1)
Line range hint
13-717
: Updated policies appear correct and consistentThe updated contract addresses and associated methods in the
policies
object reflect the latest configurations. The addition of the new contract address0x47773b52867c0867b40b26408e3ff84fca0b1a9afe55c0cb0fe284c1a18c3d8
with its methods is consistent with the existing structure.🧰 Tools
🪛 GitHub Actions: lint
[warning] Code formatting does not match Prettier standards. Run 'prettier --write' to fix formatting issues.
console.log(` New address: ${newAddress}`); | ||
|
||
// Replace the old address with the new one | ||
updatedContent = updatedContent.replace(`"${currentAddress}":`, `"${newAddress}":`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Ensure safe replacement of addresses without unintended side effects
Using updatedContent.replace(...)
might unintentionally replace occurrences of the address elsewhere in the file. It's safer to modify the AST nodes directly to update the addresses without risking accidental replacements.
Apply this diff to update the address using the TypeScript AST:
- updatedContent = updatedContent.replace(`"${currentAddress}":`, `"${newAddress}":`);
+ // Modify the property name directly
+ const newPropName = ts.factory.createStringLiteral(newAddress);
+ updatedContent = updatedContent.slice(0, prop.name.pos) + `"${newAddress}"` + updatedContent.slice(prop.name.end);
Alternatively, consider rewriting the logic to update the AST nodes directly and then regenerate the file content from the modified AST.
Committable suggestion skipped: line range outside the PR's diff.
🧰 Tools
🪛 GitHub Actions: lint
[warning] Code formatting does not match Prettier standards. Run 'prettier --write' to fix formatting issues.
Summary by CodeRabbit
New Features
Refactor
Chores