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(e2e): update chain params if deployer account changes #2612

Merged
merged 2 commits into from
Aug 7, 2024

Conversation

gartnera
Copy link
Member

@gartnera gartnera commented Jul 31, 2024

Description

While I was working on #2238, I missed that I needed to update the EVM contract addresses in ChainParams. The GetDefaultGoerliLocalnetChainParams() only work if using the current localnet.yml deployer account.

It seems a zetaclient restart is required if this happens though. See #2005

Also fix double zetacored add-genesis-account call for policy operations accounts.

How Has This Been Tested?

  • Tested CCTX in localnet
  • Tested in development environment
  • Go unit tests
  • Go integration tests
  • Tested via GitHub Actions

Summary by CodeRabbit

  • New Features

    • Streamlined account initialization process for blockchain operations, focusing solely on user accounts.
    • Enhanced EVM setup process with dynamic updates to chain parameters based on the deployment context, improving adaptability and robustness.
  • Bug Fixes

    • Improved error handling for fetching and updating chain parameters during EVM setup to ensure more reliable operations.

@gartnera gartnera added no-changelog Skip changelog CI check ADMIN_TESTS Run make start-admin-tests labels Jul 31, 2024
Copy link
Contributor

coderabbitai bot commented Jul 31, 2024

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

Walkthrough

Recent changes focus on enhancing the blockchain initialization and EVM setup processes. The shell script for account initialization has been simplified, removing redundant policy account entries and streamlining user account management. Additionally, the EVM setup function has been improved to dynamically fetch and update chain parameters, ensuring alignment with deployment configurations. These updates aim to enhance system robustness and adaptability while minimizing complexity in account management.

Changes

File Path Change Summary
contrib/localnet/scripts/start-zetacored.sh Removed multiple calls for adding policy accounts during genesis account setup, retaining only user account initialization.
e2e/runner/setup_evm.go Enhanced the SetupEVM function to dynamically fetch and update chain parameters, adding error handling for robustness.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant EVM Setup
    participant Chain Params Service
    participant ZetaTxServer

    User->>EVM Setup: Initialize EVM
    EVM Setup->>Chain Params Service: Fetch current chain parameters
    Chain Params Service-->>EVM Setup: Return chain parameters
    alt Parameters need update
        EVM Setup->>ZetaTxServer: Broadcast parameter updates
        ZetaTxServer-->>EVM Setup: Confirm updates
    else No update needed
        EVM Setup->>User: Chain parameters are current
    end
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 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.

@gartnera gartnera force-pushed the fix-localnet-deployer branch from de3a509 to 73e598c Compare July 31, 2024 21:00
@gartnera gartnera marked this pull request as ready for review July 31, 2024 21:38
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: 0

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between aed7caa and 73e598c.

Files selected for processing (2)
  • contrib/localnet/scripts/start-zetacored.sh (2 hunks)
  • e2e/runner/setup_evm.go (2 hunks)
Files skipped from review due to trivial changes (1)
  • contrib/localnet/scripts/start-zetacored.sh
Additional context used
Path-based instructions (1)
e2e/runner/setup_evm.go (1)

Pattern **/*.go: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.

Additional comments not posted (5)
e2e/runner/setup_evm.go (5)

18-20: Imports look good.

The new imports for chains and constant are necessary for the added functionality.


172-181: Fetch chain parameters with appropriate error handling.

The logic for fetching chain parameters is well-implemented with appropriate error handling and logging.


182-196: Logic for identifying discrepancies in chain parameters is sound.

The conditions for setting the needsUpdate flag are comprehensive and accurately identify discrepancies in the chain parameters.


198-201: Early return if no updates are needed.

The early return when no updates are needed is a good practice to avoid unnecessary operations.


203-209: Broadcast updated chain parameters with appropriate error handling.

The logic for broadcasting the updated chain parameters is well-implemented with appropriate error handling and logging.

@gartnera gartnera force-pushed the fix-localnet-deployer branch from 5f3c3e3 to 2c42f12 Compare August 6, 2024 15:36
@gartnera gartnera requested a review from lumtis August 6, 2024 15:36
@gartnera gartnera enabled auto-merge August 6, 2024 15:36
@gartnera gartnera added this pull request to the merge queue Aug 7, 2024
Merged via the queue into develop with commit d8a23e3 Aug 7, 2024
28 checks passed
@gartnera gartnera deleted the fix-localnet-deployer branch August 7, 2024 16:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ADMIN_TESTS Run make start-admin-tests no-changelog Skip changelog CI check
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants