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: Refactor contrib/rpc and contrib/docker-scripts to use snapshots API #2724

Merged
merged 2 commits into from
Aug 16, 2024

Conversation

julianrubino
Copy link
Member

@julianrubino julianrubino commented Aug 15, 2024

Description

Actually contrib/rpc and contrib/docker-scripts are using our old snapshots API.

  • Refactored contrib/rpc and contrib/docker-scripts to use the new snapshots API.

How Has This Been Tested?

Not tested yet

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

Summary by CodeRabbit

  • New Features

    • Updated the snapshot API endpoint to enhance reliability and data retrieval for snapshots.
  • Bug Fixes

    • Corrected the snapshot API URL across multiple configurations to ensure consistent access to snapshot data.
  • Documentation

    • Revised documentation to reflect the new snapshot API endpoint for clarity and accuracy.

Copy link
Contributor

coderabbitai bot commented Aug 15, 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

The update encompasses a series of modifications aimed at enhancing the snapshot retrieval process across various components of the ZetaChain ecosystem. Key changes include the replacement of outdated snapshot API URLs with new endpoints that return structured JSON data. This transition aims to improve the reliability and flexibility of snapshot management for both mainnet and testnet environments, ensuring that the latest snapshot data is accessible and effectively utilized.

Changes

File Path Change Summary
contrib/docker-scripts/start.sh Updated URLs in setup_restore_type to new structured API endpoints for fetching snapshot data.
contrib/rpc/zetacored/docker-compose.yml Changed SNAPSHOT_API from https://snapshots.zetachain.com to https://snapshots.rpc.zetachain.com.
contrib/rpc/zetacored/networks/.athens3 Updated SNAPSHOT_API from https://snapshots.zetachain.com to https://snapshots.rpc.zetachain.com.
contrib/rpc/zetacored/networks/.athens3-localbuild Changed SNAPSHOT_API from https://snapshots.zetachain.com to https://snapshots.rpc.zetachain.com.
contrib/rpc/zetacored/networks/.mainnet Updated SNAPSHOT_API from https://snapshots.zetachain.com to https://snapshots.rpc.zetachain.com.
contrib/rpc/zetacored/networks/.mainnet-localbuild Changed SNAPSHOT_API from https://snapshots.zetachain.com to https://snapshots.rpc.zetachain.com.
docs/development/DEPLOY_NODES.md Updated documentation to reflect the new SNAPSHOT_API URL: from https://snapshots.zetachain.com to https://snapshots.rpc.zetachain.com.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Script
    participant SnapshotAPI

    User->>Script: Request to fetch snapshot
    Script->>SnapshotAPI: Call new endpoint
    SnapshotAPI-->>Script: Return structured JSON data
    Script->>User: Provide latest snapshot information
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.

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: 3

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 7039dcc and 48d58bf.

Files selected for processing (7)
  • contrib/docker-scripts/start.sh (6 hunks)
  • contrib/rpc/zetacored/docker-compose.yml (1 hunks)
  • contrib/rpc/zetacored/networks/.athens3 (2 hunks)
  • contrib/rpc/zetacored/networks/.athens3-localbuild (2 hunks)
  • contrib/rpc/zetacored/networks/.mainnet (1 hunks)
  • contrib/rpc/zetacored/networks/.mainnet-localbuild (1 hunks)
  • docs/development/DEPLOY_NODES.md (1 hunks)
Files skipped from review due to trivial changes (3)
  • contrib/rpc/zetacored/networks/.athens3-localbuild
  • contrib/rpc/zetacored/networks/.mainnet-localbuild
  • docs/development/DEPLOY_NODES.md
Additional context used
Path-based instructions (1)
contrib/docker-scripts/start.sh (1)

Pattern **/*.sh: Review the shell scripts, point out issues relative to security, performance, and maintainability.

Additional comments not posted (4)
contrib/rpc/zetacored/networks/.mainnet (1)

4-4: Approved: Update of SNAPSHOT_API URL.

The change to update the SNAPSHOT_API URL to https://snapshots.rpc.zetachain.com is correct and aligns with the objective of using the new snapshots API.

contrib/rpc/zetacored/networks/.athens3 (1)

4-4: Approved: Update of SNAPSHOT_API URL.

The update to the SNAPSHOT_API URL to https://snapshots.rpc.zetachain.com is appropriate and maintains consistency with the mainnet configuration.

contrib/rpc/zetacored/docker-compose.yml (1)

11-11: Approved: Update of SNAPSHOT_API default value.

The modification to set the SNAPSHOT_API default value to https://snapshots.rpc.zetachain.com is correct and ensures consistency with the updated API usage.

contrib/docker-scripts/start.sh (1)

13-13: Environment variable for SNAPSHOT_API is well-defined.

The use of an environment variable for the snapshot API endpoint is a good practice, allowing for flexibility and easy configuration changes.

contrib/docker-scripts/start.sh Show resolved Hide resolved
contrib/docker-scripts/start.sh Show resolved Hide resolved
contrib/docker-scripts/start.sh Show resolved Hide resolved
Copy link

gitguardian bot commented Aug 15, 2024

⚠️ GitGuardian has uncovered 3 secrets following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

🔎 Detected hardcoded secrets in your pull request
GitGuardian id GitGuardian status Secret Commit Filename
13340122 Triggered Generic High Entropy Secret 8285c5f zetaclient/chains/solana/signer/signer_test.go View secret
13340122 Triggered Generic High Entropy Secret 8285c5f zetaclient/chains/solana/signer/signer_test.go View secret
13392123 Triggered Generic High Entropy Secret 8285c5f zetaclient/chains/solana/signer/signer_test.go View secret
🛠 Guidelines to remediate hardcoded secrets
  1. Understand the implications of revoking this secret by investigating where it is used in your code.
  2. Replace and store your secret safely. Learn here the best practices.
  3. Revoke and rotate this secret.
  4. If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.

To avoid such incidents in the future consider


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

@gartnera gartnera added this pull request to the merge queue Aug 16, 2024
Merged via the queue into develop with commit a4c1b18 Aug 16, 2024
26 of 28 checks passed
@gartnera gartnera deleted the 2723-change-snapshots-api branch August 16, 2024 15:13
gartnera pushed a commit that referenced this pull request Aug 16, 2024
…2724)

Co-authored-by: Julian Rubino <julian@zetachain.com>
gartnera added a commit that referenced this pull request Aug 16, 2024
* feat: parse inscription like witness data (#2524)

* parse inscription like witness data

* more comment

* remove unused code

* Update zetaclient/chains/bitcoin/tx_script.go

Co-authored-by: Dmitry S <11892559+swift1337@users.noreply.github.com>

* Update zetaclient/chains/bitcoin/observer/inbound.go

Co-authored-by: Dmitry S <11892559+swift1337@users.noreply.github.com>

* Update zetaclient/chains/bitcoin/tx_script.go

Co-authored-by: Dmitry S <11892559+swift1337@users.noreply.github.com>

* Update zetaclient/chains/bitcoin/tx_script.go

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* pull origin

* Update zetaclient/chains/bitcoin/observer/inbound.go

Co-authored-by: Dmitry S <11892559+swift1337@users.noreply.github.com>

* review feedbacks

* update review feedbacks

* update make generate

* fix linter

* remove over flow

* Update zetaclient/chains/bitcoin/observer/inbound.go

Co-authored-by: Francisco de Borja Aranda Castillejo <me@fbac.dev>

* Update zetaclient/chains/bitcoin/tokenizer.go

Co-authored-by: Francisco de Borja Aranda Castillejo <me@fbac.dev>

* Update zetaclient/chains/bitcoin/tokenizer.go

Co-authored-by: Francisco de Borja Aranda Castillejo <me@fbac.dev>

* Update zetaclient/chains/bitcoin/tokenizer.go

Co-authored-by: Francisco de Borja Aranda Castillejo <me@fbac.dev>

* Update zetaclient/chains/bitcoin/tokenizer.go

Co-authored-by: Francisco de Borja Aranda Castillejo <me@fbac.dev>

* update review feedback

* update code commnet

* update comment

* more comments

* Update changelog.md

---------

Co-authored-by: Dmitry S <11892559+swift1337@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: Francisco de Borja Aranda Castillejo <me@fbac.dev>

fix version

* feat: detect memo in btc txn from OP_RETURN and inscription (#2533)

* parse inscription like witness data

* more comment

* remove unused code

* parse inscription

* Update zetaclient/chains/bitcoin/tx_script.go

Co-authored-by: Dmitry S <11892559+swift1337@users.noreply.github.com>

* Update zetaclient/chains/bitcoin/observer/inbound.go

Co-authored-by: Dmitry S <11892559+swift1337@users.noreply.github.com>

* Update zetaclient/chains/bitcoin/tx_script.go

Co-authored-by: Dmitry S <11892559+swift1337@users.noreply.github.com>

* Update zetaclient/chains/bitcoin/tx_script.go

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* pull origin

* Update zetaclient/chains/bitcoin/observer/inbound.go

Co-authored-by: Dmitry S <11892559+swift1337@users.noreply.github.com>

* review feedbacks

* update review feedbacks

* add mainnet txn

* Update zetaclient/chains/bitcoin/tx_script.go

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* parse inscription like witness data

* more comment

* remove unused code

* Update zetaclient/chains/bitcoin/tx_script.go

Co-authored-by: Dmitry S <11892559+swift1337@users.noreply.github.com>

* Update zetaclient/chains/bitcoin/observer/inbound.go

Co-authored-by: Dmitry S <11892559+swift1337@users.noreply.github.com>

* Update zetaclient/chains/bitcoin/tx_script.go

Co-authored-by: Dmitry S <11892559+swift1337@users.noreply.github.com>

* Update zetaclient/chains/bitcoin/tx_script.go

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* pull origin

* Update zetaclient/chains/bitcoin/observer/inbound.go

Co-authored-by: Dmitry S <11892559+swift1337@users.noreply.github.com>

* review feedbacks

* update review feedbacks

* update make generate

* fix linter

* remove over flow

* Update zetaclient/chains/bitcoin/observer/inbound.go

Co-authored-by: Francisco de Borja Aranda Castillejo <me@fbac.dev>

* Update zetaclient/chains/bitcoin/tokenizer.go

Co-authored-by: Francisco de Borja Aranda Castillejo <me@fbac.dev>

* Update zetaclient/chains/bitcoin/tokenizer.go

Co-authored-by: Francisco de Borja Aranda Castillejo <me@fbac.dev>

* Update zetaclient/chains/bitcoin/tokenizer.go

Co-authored-by: Francisco de Borja Aranda Castillejo <me@fbac.dev>

* Update zetaclient/chains/bitcoin/tokenizer.go

Co-authored-by: Francisco de Borja Aranda Castillejo <me@fbac.dev>

* update review feedback

* update code commnet

* update comment

* more comments

* Update changelog.md

* Update zetaclient/chains/bitcoin/observer/inbound.go

Co-authored-by: Francisco de Borja Aranda Castillejo <me@fbac.dev>

* Update zetaclient/chains/bitcoin/observer/inbound.go

Co-authored-by: Francisco de Borja Aranda Castillejo <me@fbac.dev>

* clean up

* format code

---------

Co-authored-by: Dmitry S <11892559+swift1337@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: Francisco de Borja Aranda Castillejo <me@fbac.dev>

* refactor(zetaclient)!: improve AppContext (#2568)

* Implement chain registry

* Rewrite test-cases for AppContext

* Drop `supplychecker`

* Refactor app ctx Update worker

* Refactor orchestrator

* Refactor observer&signer; DROP postBlockHeaders

* Fix test cases [1]

* Update changelog

* Allow Zeta Chain in appContext; address PR comments [1]

* Fix app context update

* Check for `chain.IsZeta()`

* Add AppContext.FilterChains

* Fix test cases [2]

* Fix test cases [3]

* Address PR comments [1]

* Address PR comments [2]

* Add tests for `slices`

* Fix e2e tests [1]

* Fix e2e tests [2]

* Resolve conflicts, converge codebase between PRs

* Add lodash; remove slices pkg

* Address PR comments

* Minor logging fix

* Address PR comments

tmp

* feat(zetaclient): add generic rpc metrics (#2597)

* feat(zetaclient): add generic rpc metrics

* feedback

* changelog

* fmt

* fix(zetaclient): use name in pending tx metric (#2642)

* feat(pkg): add `ticker` package (#2617)

* Add `pkg/ticker`

* Sample ticker usage in evm observer

* Change naming

* Address PR comments

* Address PR comments

* feat(zetaclient)!: Add support for EIP-1559 gas fees (#2634)

* Add Gas struct

* Add EIP-1559 fees

* Update changelog

* Add test cases for legacy vs dynamicFee txs

* Fix typo; Add E2E coverage

* Address PR comments

* Address PR comments

* Use gasFeeCap formula

* Revert "Use gasFeeCap formula"

This reverts commit 2260925.

* Address PR comments

* Fix e2e upgrade tests

* fix: adjust evm outbound tracker reporter to avoid submitting invalid hashes (#2628)

* refactor and fix evm outbound tracker reporter to avoid invalid hashes; print log when outbound tracker is full of invalid hashes

* add changelog entry

* used predefined log fields

* remove repeated fields information from log message; Devops team would configure Datadog to show the fields

* remove redundant fields in log message; unified logs

* remove pending transaction map from observer; the outbound tracker reporter will no longer report pending hash

* use bg.Work() to launch outbound tracker reporter goroutines

* bring the checking EnsureNoTrackers() back

* add more rationale to EVM outbound tracker submission

* sync observer and signers without wait on startup

* try fixing tss migration E2E failure by increase timeout

* feat: Solana relayer (fee payer) key importer, encryption and decryption (#2673)

* configure observer relayer key for Solana; remove hardcoded solana test key from zetaclient code

* implementation of relayer key importer, encryption and decryption

* integrate relayer key into E2E and Solana signer

* add relayer_key_balance metrics and unit tests

* use TrimSpace to trim password

* add changelog entry

* use relayer account array in E2E config; a few renaming; add private key validation when importing

* fix linter

* remove GetNetworkName method for simplification

* added PromptPassword method to prompt single password

* use network name as map index to store relayer key passwords

* moved relayer passwords to chain registry

* airdrop SOL token only if solana local node is available

---------

Co-authored-by: Lucas Bertrand <lucas.bertrand.22@gmail.com>

* ci: Set Docker Workflow to use Go 1.22 (#2722)

* Set go 1.22.2

* Set go 1.22.2

* Set go 1.22

* Set go 1.22

* Refactor contrib/rpc and contrib/docker-scripts to use snapshots API (#2724)

Co-authored-by: Julian Rubino <julian@zetachain.com>

---------

Co-authored-by: dev-bitSmiley <153714963+bitSmiley@users.noreply.github.com>
Co-authored-by: Dmitry S <11892559+swift1337@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: Francisco de Borja Aranda Castillejo <me@fbac.dev>
Co-authored-by: Charlie Chen <34498985+ws4charlie@users.noreply.github.com>
Co-authored-by: Lucas Bertrand <lucas.bertrand.22@gmail.com>
Co-authored-by: Charlie <31941002+CharlieMc0@users.noreply.github.com>
Co-authored-by: Julian Rubino <julian.rubino0@gmail.com>
Co-authored-by: Julian Rubino <julian@zetachain.com>
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.

3 participants