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

Change VITE_PUBLIC_SLOT for landing #2627

Merged
merged 1 commit into from
Jan 7, 2025
Merged

Conversation

bob0005
Copy link
Collaborator

@bob0005 bob0005 commented Jan 7, 2025

Summary by CodeRabbit

  • Configuration

    • Added new environment variable VITE_PUBLIC_SLOT across multiple environment configuration files
    • Updated StarknetProvider to dynamically use the VITE_PUBLIC_SLOT value instead of a hardcoded slot
  • Environment

    • Introduced environment-specific configurations for preview, production, sample, and sepolia environments

Copy link
Contributor

mentatbot bot commented Jan 7, 2025

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.

Copy link

vercel bot commented Jan 7, 2025

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 Jan 7, 2025 2:16pm
eternum-docs ❌ Failed (Inspect) Jan 7, 2025 2:16pm
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
eternum-landing ⬜️ Ignored (Inspect) Visit Preview Jan 7, 2025 2:16pm

Copy link
Contributor

coderabbitai bot commented Jan 7, 2025

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

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

client/apps/landing/env.ts

Oops! Something went wrong! :(

ESLint: 9.17.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.
If you are using a .eslintrc.* file, please follow the migration guide
to update your configuration file to the new format:

https://eslint.org/docs/latest/use/configure/migration-guide

If you still have problems after following the migration guide, please stop by
https://eslint.org/chat/help to chat with the team.

Walkthrough

The pull request introduces a new environment variable VITE_PUBLIC_SLOT across multiple configuration files for different environments. This variable is added to .env.preview, .env.production, .env.sample, and .env.sepolia. In the starknet-provider.tsx file, the hardcoded slot value is replaced with the new environment variable, allowing dynamic slot configuration based on the environment.

Changes

File Change Summary
client/apps/landing/.env.* Added new environment variable VITE_PUBLIC_SLOT
- .env.preview: Uninitialized
- .env.production: Set to eternum-prod
- .env.sample: Uninitialized
- .env.sepolia: Empty value
client/apps/landing/env.ts Added VITE_PUBLIC_SLOT: z.string() to envSchema for validation
client/apps/landing/src/components/providers/starknet-provider.tsx Replaced hardcoded slot value "realms-world-04" with env.VITE_PUBLIC_SLOT

Sequence Diagram

sequenceDiagram
    participant Env as Environment Config
    participant Provider as StarknetProvider
    participant App as Application

    Env->>Provider: Provide VITE_PUBLIC_SLOT
    Provider->>App: Use dynamic slot value
Loading

Poem

🐰 A rabbit's tale of slots so bright,
Environment configs taking flight!
From hardcoded strings to dynamic might,
VITE_PUBLIC_SLOT shines with delight,
Flexibility dancing in pure white! 🌟


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 generate docstrings to generate docstrings for this PR. (Beta)
  • @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

github-actions bot commented Jan 7, 2025

Failed to generate code suggestions for PR

Copy link
Contributor

@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: 2

🔭 Outside diff range comments (1)
client/apps/landing/.env.production (1)

Line range hint 1-5: ⚠️ Security: Sensitive data exposed in version control

This file contains sensitive information that should not be in version control:

  • Private keys (VITE_PUBLIC_MASTER_PRIVATE_KEY)
  • Contract addresses
  • Account class hashes

Consider:

  1. Moving sensitive data to a secure secret management system
  2. Using placeholder values in the committed file
  3. Adding the file to .gitignore
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e789617 and 148f866.

📒 Files selected for processing (6)
  • client/apps/landing/.env.preview (1 hunks)
  • client/apps/landing/.env.production (1 hunks)
  • client/apps/landing/.env.sample (1 hunks)
  • client/apps/landing/.env.sepolia (1 hunks)
  • client/apps/landing/env.ts (1 hunks)
  • client/apps/landing/src/components/providers/starknet-provider.tsx (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • client/apps/landing/.env.preview
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Run pr agent on every pull request, respond to user comments
🔇 Additional comments (3)
client/apps/landing/src/components/providers/starknet-provider.tsx (1)

18-18: Verify the impact of dynamic slot configuration.

The change from hardcoded value to environment variable is correct. However, since this affects the cartridge controller configuration:

  1. Ensure all environments have appropriate slot values configured
  2. Verify that the cartridge controller handles empty slot values gracefully

Let's verify the cartridge controller's usage of this slot value:

client/apps/landing/.env.sample (1)

18-18: LGTM! Sample environment variable added correctly.

The addition of VITE_PUBLIC_SLOT to the sample environment file is appropriate, allowing developers to configure their own slot value.

client/apps/landing/.env.production (1)

19-19: LGTM! Variable addition follows conventions.

The new VITE_PUBLIC_SLOT variable is properly configured for the production environment and follows the existing naming conventions.

Comment on lines +36 to +37

VITE_PUBLIC_SLOT: z.string(),
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Codebase verification

Environment template files missing for new VITE_PUBLIC_SLOT variable

The new environment variable has been added to the schema, but there are no template files or documentation to guide its setup. This could cause issues for:

  • New developer onboarding
  • CI/CD pipeline configuration
  • Environment setup across different stages (development, production)

Please:

  • Create a .env.example file in client/apps/landing with the expected format
  • Document the required value and its purpose in the README.md
  • Ensure all deployment environments are updated with this new variable
🔗 Analysis chain

LGTM! Verify environment configuration.

The addition of VITE_PUBLIC_SLOT to the schema is correct. Let's verify its presence across all environment files:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check if VITE_PUBLIC_SLOT is present in all environment files
# Expected: VITE_PUBLIC_SLOT should be present in all .env files

echo "Checking .env files for VITE_PUBLIC_SLOT:"
fd -e env -e env.sample -e env.preview -e env.production -e env.sepolia . client/apps/landing --exec grep -l "VITE_PUBLIC_SLOT" {} \;

Length of output: 229


Script:

#!/bin/bash
# First, let's see what environment files actually exist
echo "Listing all environment files:"
fd -e env -e env.sample -e env.preview -e env.production -e env.sepolia . client/apps/landing

# Then, let's look at their content (excluding any sensitive values)
echo -e "\nChecking environment file contents (showing only VITE_ variables):"
fd -e env -e env.sample -e env.preview -e env.production -e env.sepolia . client/apps/landing --exec sh -c 'echo "\n=== {} ==="; grep "^VITE_" {} || true' \;

Length of output: 476


Script:

#!/bin/bash
# Look for environment template files and documentation
echo "Searching for environment templates and setup instructions:"
fd -e example -e template -e sample . client/apps/landing

echo -e "\nChecking for README files that might contain setup instructions:"
fd README -e md . client/apps/landing

echo -e "\nIf README exists, checking its content for environment setup instructions:"
fd README -e md . client/apps/landing --exec sh -c 'echo "\n=== {} ==="; cat {} | grep -A 5 -i "env" || true' \;

Length of output: 1148

@@ -17,7 +17,7 @@ VITE_REALMS_ADDRESS=0xd2674cc335684896f2b1f942e6929611acab4dc07aa03d0371226812bb
VITE_LORDS_ADDRESS=0x342ad5cc14002c005a5cedcfce2bd3af98d5e7fb79e9bf949b3a91cf145d72e

VITE_PUBLIC_CHAIN=sepolia

VITE_PUBLIC_SLOT=
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Codebase verification

⚠️ Potential issue

Empty VITE_PUBLIC_SLOT values need attention

The verification confirms that VITE_PUBLIC_SLOT is empty in multiple environments:

  • .env.sepolia: empty value
  • .env.preview: empty value
  • .env.sample: empty value

For reference, production uses the value eternum-prod, suggesting a naming pattern that could be followed (e.g., eternum-sepolia for Sepolia environment).

🔗 Analysis chain

Provide a default slot value for Sepolia environment.

The VITE_PUBLIC_SLOT is currently empty in the Sepolia environment configuration. Since this value is required for the cartridge controller configuration, please provide an appropriate default value.

Let's check the slot values across different environments:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Compare slot values across different environments
# Expected: Each environment should have an appropriate slot value

echo "Checking slot values across environments:"
fd -e env.sepolia -e env.production -e env.preview . client/apps/landing --exec sh -c 'echo "=== {} ==="; grep "VITE_PUBLIC_SLOT" {} || echo "Not found"'

Length of output: 248


Script:

#!/bin/bash
# First, find all environment-related files
echo "=== Finding environment files ==="
fd -t f "^\.env" client/apps/landing

# Then, check content of each file for any SLOT-related variables
echo -e "\n=== Checking SLOT-related variables ==="
fd -t f "^\.env" client/apps/landing --exec sh -c 'echo "=== {} ==="; grep -i "slot" {} || echo "No SLOT variables found"'

Length of output: 751


Script:

#!/bin/bash
# Search for environment files including hidden ones
echo "=== Finding environment files ==="
fd -H -t f "^\.env" client/apps/landing

# Check content with improved error handling
echo -e "\n=== Checking SLOT-related variables ==="
fd -H -t f "^\.env" client/apps/landing --exec sh -c '
  echo "=== {} ===";
  if [ -f "{}" ]; then
    grep -i "slot" "{}" 2>/dev/null || echo "No SLOT variables found"
  else
    echo "File not readable"
  fi
'

Length of output: 811

@aymericdelab aymericdelab merged commit 7acc2dd into next Jan 7, 2025
5 of 9 checks passed
@aymericdelab aymericdelab deleted the fix/landing-public-slot branch January 7, 2025 15:08
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.

2 participants