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

fix: constants #305

Merged
merged 4 commits into from
Oct 21, 2024
Merged

fix: constants #305

merged 4 commits into from
Oct 21, 2024

Conversation

ponderingdemocritus
Copy link
Contributor

@ponderingdemocritus ponderingdemocritus commented Oct 21, 2024

Summary by CodeRabbit

  • Bug Fixes

    • Updated constants for KATANA_PREFUNDED_ADDRESS, KATANA_PREFUNDED_PRIVATE_KEY, and KATANA_CLASS_HASH to enhance security and functionality.
  • Chores

    • Updated subproject commit identifier to reflect the latest version.
    • Enhanced Continuous Integration workflow by updating the dojoup command version and adding a step to update submodules.
  • Documentation

    • Updated migration command in README from sozo migrate to sozo migrate apply for clarity.
  • Improvements

    • Enhanced logging and error handling in entity management functions for better debugging and robustness.
    • Added comments to clarify the purpose of the useQuerySync hook in the application.

Copy link

coderabbitai bot commented Oct 21, 2024

Walkthrough

The changes involve updates to constant values in the packages/core/src/constants/index.ts file, specifically modifying the values of KATANA_PREFUNDED_ADDRESS, KATANA_PREFUNDED_PRIVATE_KEY, and KATANA_CLASS_HASH. Additionally, the commit identifier for the worlds/dojo-starter subproject has been updated, reflecting a new version state without altering any functionality or logic. The CI workflow configuration in .github/workflows/ci.yaml has also been updated to include a new submodule initialization step and an updated version of the dojoup command. The readme.md file has been modified to change the migration command for the Dojo starter application.

Changes

File Path Change Summary
packages/core/src/constants/index.ts Updated constants: KATANA_PREFUNDED_ADDRESS and KATANA_PREFUNDED_PRIVATE_KEY to "0x127fd5f1fe78a71f8bcd1fec63e3fe2f0486b6ecd5c86a0466c3a21fa5cfcec"; KATANA_CLASS_HASH changed to "0x07dc7899aa655b0aae51eadff6d801a58e97dd99cf4666ee59e704249e51adf2".
worlds/dojo-starter Subproject commit updated from 42b56b04436d895d7e76e16bfe50d3f1796cbd27 to 8e84a8b62815bafcac48fcff299db2dd124efb2c.
.github/workflows/ci.yaml Updated dojoup command version from v1.0.0-alpha.16 to v1.0.0-alpha.17 and added a step for submodule initialization.
readme.md Updated migration command from sozo migrate to sozo migrate apply in the Quick start section.

Possibly related PRs

  • feat: subscription clauses #235: The changes in packages/state/src/recs/index.ts regarding the getSyncEntities function are related to the main PR as both involve modifications to the same file and functions, specifically focusing on entity synchronization.
  • fix: error on getEntitiesQuery #262: The updates to the getEntitiesQuery function in packages/state/src/recs/index.ts are relevant as they also involve changes to the same file and function, enhancing the handling of entity queries.
  • fix: submodule #272: The modifications in the CI workflow file .github/workflows/ci.yaml include updates that may indirectly relate to the main PR's changes in constants, as both are part of the overall project structure and deployment process.
  • feat: Torii upgrade #303: The upgrade of the Torii library in the CI workflow may relate to the main PR's changes, as both involve updates that could affect the overall functionality and integration of the project.

Poem

In the code where constants play,
A rabbit hops and shouts hooray!
New values bright, like morning sun,
Our project leaps, it's time for fun!
With every change, we grow and thrive,
A joyful dance, our code's alive! 🐇✨


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?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a 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

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between b96afa3 and 6d347cd.

📒 Files selected for processing (2)
  • packages/core/src/constants/index.ts (1 hunks)
  • worlds/dojo-starter (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • worlds/dojo-starter
🧰 Additional context used
🔇 Additional comments (3)
packages/core/src/constants/index.ts (3)

4-5: Verify the new KATANA_PREFUNDED_ADDRESS value

The KATANA_PREFUNDED_ADDRESS has been updated. While the new value appears to be a valid Starknet address, please confirm:

  1. Is this the correct new address for the Katana prefunded account?
  2. Have all necessary systems been updated to use this new address?
  3. Are there any implications for existing tests or development environments?

To check for any hardcoded usage of the old address, run:


8-9: Verify the new KATANA_CLASS_HASH value

The KATANA_CLASS_HASH has been updated. While the new value appears to be a valid Starknet class hash, please confirm:

  1. Is this the correct new class hash for the Katana environment?
  2. What changes in the contract or compilation process led to this new class hash?
  3. Have all necessary systems been updated to use this new class hash?
  4. Are there any implications for existing contract deployments or interactions?

To check for any hardcoded usage of the old class hash, run:


4-9: Provide context for the overall changes to Katana constants

These changes to KATANA_PREFUNDED_ADDRESS, KATANA_PREFUNDED_PRIVATE_KEY, and KATANA_CLASS_HASH represent significant updates to core Katana constants. To ensure a smooth transition and prevent potential issues:

  1. Please provide context for why these changes were necessary. What issue does this "fix: constants" address?
  2. Has the Katana documentation been updated to reflect these new values?
  3. Are there any migration steps required for developers using these constants?
  4. How do these changes relate to the update in the worlds/dojo-starter subproject commit (8e84a8b62815bafcac48fcff299db2dd124efb2c)?

To check for any documentation or README files that might need updating, run:

✅ Verification successful

[/run_scripts]


[/run_scripts]


Katana constants have been successfully updated and old values removed

The KATANA_PREFUNDED_ADDRESS, KATANA_PREFUNDED_PRIVATE_KEY, and KATANA_CLASS_HASH constants have been correctly updated with new values, and all obsolete values have been removed from the codebase.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for files that might contain references to Katana constants
fd -e md -e txt | xargs rg -i "katana.*address|katana.*key|katana.*hash"

Length of output: 74


Script:

#!/bin/bash
# Search for references to Katana constants in TypeScript and JavaScript files
fd -e ts -e js | xargs rg -i "KATANA_PREFUNDED_ADDRESS|KATANA_PREFUNDED_PRIVATE_KEY|KATANA_CLASS_HASH"

Length of output: 1417


Script:

#!/bin/bash
# Retrieve git diff for lines 4-9 in packages/core/src/constants/index.ts
git diff HEAD~1 HEAD -- packages/core/src/constants/index.ts | sed -n '4,9p'

Length of output: 387

Comment on lines 6 to 7
export const KATANA_PREFUNDED_PRIVATE_KEY =
"0x2bbf4f9fd0bbb2e60b0316c1fe0b76cf7a4d0198bd493ced9b8df2a3a24d68a";
"0x127fd5f1fe78a71f8bcd1fec63e3fe2f0486b6ecd5c86a0466c3a21fa5cfcec";
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Critical: KATANA_PREFUNDED_PRIVATE_KEY matches KATANA_PREFUNDED_ADDRESS

The new value for KATANA_PREFUNDED_PRIVATE_KEY is identical to the new KATANA_PREFUNDED_ADDRESS. This is highly unusual and potentially a security risk. Private keys and addresses should be distinct in cryptographic systems. Please urgently clarify:

  1. Is this intentional? If so, what's the rationale?
  2. If not, what should the correct private key be?
  3. Has this been exposed in any public environments?

If this is unintentional, please update the private key to a distinct, secure value immediately.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (1)
readme.md (1)

49-49: LGTM. Consider adding version information.

The update to sozo migrate apply is correct and aligns with the more explicit command syntax. This change improves clarity for users following the quick start guide.

Consider adding a note about the minimum required Sozo version for this command, to ensure users have the compatible version installed. For example:

sozo build && sozo migrate apply  # Requires Sozo v0.X.X or higher

Also, it might be helpful to update any related documentation or guides that mention the sozo migrate command to maintain consistency across the project.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 2dbe619 and 640ec75.

📒 Files selected for processing (3)
  • examples/example-vite-react-app-recs/src/App.tsx (1 hunks)
  • packages/state/src/recs/index.ts (7 hunks)
  • readme.md (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • examples/example-vite-react-app-recs/src/App.tsx
🧰 Additional context used
🔇 Additional comments (6)
packages/state/src/recs/index.ts (6)

54-56: Improved logging in getSyncEntities function

The addition of the logging statement enhances debugging capabilities by providing more context about the function execution, including the clause parameter. This change will make it easier to track and understand the filtering applied during entity synchronization.


279-279: Approved: Minor formatting improvement

The addition of an empty line improves code readability by separating the logging statement from the setEntities call. This change doesn't affect functionality and is a good practice for maintaining clean, well-structured code.


325-334: Improved robustness in setEntities function

The new conditional logic enhances the function's robustness by handling edge cases:

  1. When there are no entities to set.
  2. When there's a single empty entity (with key "0x0").

This change prevents unnecessary processing in these scenarios and provides a helpful warning message. The added empty line also improves code readability by clearly separating this new logic from the rest of the function.

These improvements will help catch potential issues early and make debugging easier.


170-170: Verify impact of including hashed keys in event messages

The dont_include_hashed_keys parameter has been set to false for event messages as well. This change is consistent with the modification in the getEntities function. While it may provide more detailed information in event messages, it could also increase the data volume. Please ensure that this change is intentional and doesn't negatively impact performance or data processing for event handling.

To assess the impact of including hashed keys in event messages, you can run the following script:

This script will help identify all instances where client.getEventMessages is called and compare the results with and without hashed keys.


237-245: Verify impact of including hashed keys and improved logging in getEntitiesQuery

  1. The dont_include_hashed_keys parameter has been set to false, consistent with changes in other functions. This change will include hashed keys in the query results, potentially increasing the amount of data returned. Please verify that this change is intentional and doesn't negatively impact query performance or data processing.

  2. A new logging statement has been added to provide information about the number of fetched entities and the current cursor position. This improves visibility for debugging and monitoring the query progress. However, consider wrapping this log statement in a condition to only execute when logging is true, to avoid unnecessary logging in production environments.

To assess the impact of including hashed keys in entity queries, you can run the following script:

This script will help identify all instances where client.getEntities is called in queries and compare the results with and without hashed keys.


129-133: Verify impact of including hashed keys and additional logging

  1. The dont_include_hashed_keys parameter has been set to false. This change will include hashed keys in the retrieved entities, potentially increasing the amount of data returned. Please verify that this change is intentional and doesn't negatively impact performance or data processing.

  2. A new logging statement has been added to output the fetched entities. While this improves visibility for debugging, it may significantly increase log verbosity, especially with large datasets. Consider adding a condition to only log this information when logging is true.

To assess the impact of including hashed keys, you can run the following script:

This script will help identify all instances where client.getEntities is called and compare the results with and without hashed keys.

@ponderingdemocritus ponderingdemocritus merged commit b5fa315 into main Oct 21, 2024
3 checks passed
@ponderingdemocritus ponderingdemocritus deleted the feat/bump-17 branch October 21, 2024 20:05
@coderabbitai coderabbitai bot mentioned this pull request Oct 23, 2024
This was referenced Oct 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant