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

chore(backend): deploy to base sepolia #20

Merged
merged 5 commits into from
Jun 28, 2024
Merged

Conversation

jo-elimu
Copy link
Member

closes #16

@jo-elimu jo-elimu self-assigned this Jun 28, 2024
@jo-elimu jo-elimu requested a review from a team as a code owner June 28, 2024 09:56
Copy link

coderabbitai bot commented Jun 28, 2024

Warning

Rate limit exceeded

@jo-elimu has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 50 minutes and 35 seconds before requesting another review.

How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

Commits

Files that changed from the base of the PR and between 4408e4c and efac70d.

Walkthrough

The updates introduce new environment configurations, extend the Hardhat setup with additional network, Etherscan, and Sourcify configurations, and incorporate a new module and deployment journal for the SponsorshipQueue contract.

Changes

Files Change Summary
backend/.env.sample Added environment variables WALLET_KEY and ETHERSCAN_API_KEY.
backend/.gitignore Added directories related to different chains for deployments under ignition/deployments path.
.../hardhat.config.ts Enhanced network configurations, including URLs and wallet accounts, Etherscan API key setup, Sourcify enablement, and gasReporter configuration.
.../ignition/deployments/chain-84532/journal.jsonl Introduced deployment journal entries for SponsorshipQueue contract on chain 84532 detailing initialization, execution, and confirmation steps.
.../ignition/modules/SponsorshipQueue.ts Added SponsorshipQueueModule which builds a sponsorship queue contract, setting the groundwork for deployment utilizing the estimatedCost parameter.

Sequence Diagram(s)

sequenceDiagram
    participant Dev as Developer
    participant Env as .env.sample
    participant Config as hardhat.config.ts
    participant Gitignore as .gitignore
    participant Deploy as deployment
    participant Module as SponsorshipQueue Module

    Dev->>Env: Add WALLET_KEY and ETHERSCAN_API_KEY.
    Dev->>Gitignore: Add deployment directories to .gitignore.
    Dev->>Config: Configure networks, etherscan, gasReporter, and sourcify.
    Dev->>Module: Implement SponsorshipQueueModule.
    Module->>Deploy: Create and log deployment entries in journal.jsonl.
    Deploy-->>Dev: Confirm contract deployment.
Loading

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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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 as 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.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration 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

netlify bot commented Jun 28, 2024

Deploy Preview for web3-sponsors canceled.

Name Link
🔨 Latest commit efac70d
🔍 Latest deploy log https://app.netlify.com/sites/web3-sponsors/deploys/667ea0e2e233af00085fd16e

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

import { ethers } from "hardhat";

const SponsorshipQueueModule = buildModule("SponsorshipQueueModule", (m) => {
const estimatedCost = m.getParameter("estimatedCost", ethers.parseUnits("0.002"));
Copy link

Choose a reason for hiding this comment

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

Correct the method call for parsing units.

The method call to parse units should be ethers.utils.parseUnits instead of ethers.parseUnits.

- const estimatedCost = m.getParameter("estimatedCost", ethers.parseUnits("0.002"));
+ const estimatedCost = m.getParameter("estimatedCost", ethers.utils.parseUnits("0.002"));
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const estimatedCost = m.getParameter("estimatedCost", ethers.parseUnits("0.002"));
const estimatedCost = m.getParameter("estimatedCost", ethers.utils.parseUnits("0.002"));

@jo-elimu
Copy link
Member Author

@coderabbitai Why is npx hardhat clean failing with this error?:

HardhatError: HH8: There's one or more errors in your config file:

  * Invalid account: #0 for network: base_sepolia - Expected string, received undefined
  * Invalid account: #0 for network: base_mainnet - Expected string, received undefined

Copy link

coderabbitai bot commented Jun 28, 2024

Tip

For best results, initiate chat on the files or code changes.

@jo-elimu, the error you're encountering typically occurs when the environment variables expected in the hardhat.config.ts file (WALLET_KEY for the accounts) are not properly set or accessible in your environment. Here’s what you can check:

  1. Environment Variables: Ensure that the WALLET_KEY environment variable is correctly set in your environment or in a .env file. This variable should contain the private key for the wallet accounts used in the base_sepolia and base_mainnet networks.

  2. Loading Environment Variables: Make sure that your environment variables are being loaded into your Hardhat environment. If you are using a .env file, you should have something like require('dotenv').config() at the top of your hardhat.config.ts file to load the variables.

  3. Check Configuration: Review the networks section in your hardhat.config.ts to ensure it's correctly using the environment variables:

    networks: {
      base_sepolia: {
        url: 'https://sepolia.base.org',
        accounts: [process.env.WALLET_KEY]
      },
      base_mainnet: {
        url: 'https://mainnet.base.org',
        accounts: [process.env.WALLET_KEY]
      }
    }

Could you confirm if the above settings are in place? If they are and the issue persists, we might need to look deeper into the configuration or the way the environment is set up.

Bender-22
Bender-22 previously approved these changes Jun 28, 2024
backend/hardhat.config.ts Show resolved Hide resolved
backend/hardhat.config.ts Outdated Show resolved Hide resolved
backend/hardhat.config.ts Outdated Show resolved Hide resolved
@jo-elimu
Copy link
Member Author

  1. Environment Variables: Ensure that the WALLET_KEY environment variable is correctly set in your environment or in a .env file. This variable should contain the private key for the wallet accounts used in the base_sepolia and base_mainnet networks.

@coderabbitai Thanks. Fixed it by using an empty array, [], when the WALLET_KEY variable is missing.

Copy link

coderabbitai bot commented Jun 28, 2024

Tip

For best results, initiate chat on the files or code changes.

@jo-elimu, I'm glad to hear you've found a workaround by using an empty array [] when the WALLET_KEY variable is missing. This approach indeed prevents the configuration error from occurring.

However, it's important to ensure that the WALLET_KEY is appropriately set, especially for stages like production where real transactions might occur. Using an empty array might work for avoiding initial errors, but it won't be suitable for actual deployments or transactions. Here are a few suggestions:

  1. Environment Setup: Ensure that the WALLET_KEY is set in all environments where real transactions are expected. This could be managed through environment-specific .env files or CI/CD environment settings.

  2. Fallback Mechanism: While using an empty array as a fallback prevents errors, consider logging a warning or throwing an error in your deployment scripts if the WALLET_KEY is not set. This can prevent accidental deployments without the necessary keys.

  3. Documentation: Update your documentation or README to highlight the importance of setting these environment variables, and the implications of not setting them.

If you need further assistance with setting up your environment variables securely or any other configuration, feel free to ask!


Learnings added
User: jo-elimu
URL: https://github.com/elimu-ai/web3-sponsors/pull/20

Timestamp: 2024-06-28T11:40:59.330Z
Learning: User `jo-elimu` resolved an issue with missing `WALLET_KEY` by using an empty array `[]` in the `networks` configuration in `hardhat.config.ts` to avoid errors during the `npx hardhat clean` command. This is not suitable for production environments where real transactions occur.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.

@jo-elimu jo-elimu merged commit daae740 into main Jun 28, 2024
12 checks passed
@jo-elimu jo-elimu deleted the 16-deploy-base-sepolia branch June 28, 2024 11:46
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.

backend: Deploy to Base Sepolia
2 participants