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

feat(zetaclient): converge AppContext with ZetaCoreContext #2395

Merged
merged 8 commits into from
Jul 1, 2024

Conversation

swift1337
Copy link
Contributor

@swift1337 swift1337 commented Jun 28, 2024

Description

This PR converges AppContext with ZetaCoreContext and adds an ability to embed them directly into ctx. Example:

import (
    "context"
    zctx "github.com/zeta-chain/zetacore/zetaclient/context"
)

func foobar(ctx context.Context) error {
  app, err := zctx.FromContext(ctx)
  if err != nil {
      return err
  }

  fmt.Println(appContext.GetEVMChainParams(1))

  // ...
}

This is a prerequisite for: #1160

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Include instructions and any relevant details so others can reproduce.

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

Checklist:

  • I have added unit tests that prove my fix feature works

Copy link
Contributor

coderabbitai bot commented Jun 28, 2024

Important

Review skipped

Review was skipped due to path filters

Files ignored due to path filters (35)
  • changelog.md is excluded by none and included by none
  • cmd/zetaclientd/debug.go is excluded by none and included by none
  • cmd/zetaclientd/keygen_tss.go is excluded by none and included by none
  • cmd/zetaclientd/start.go is excluded by none and included by none
  • cmd/zetaclientd/utils.go is excluded by none and included by none
  • zetaclient/chains/base/observer.go is excluded by none and included by none
  • zetaclient/chains/base/observer_test.go is excluded by none and included by none
  • zetaclient/chains/base/signer.go is excluded by none and included by none
  • zetaclient/chains/base/signer_test.go is excluded by none and included by none
  • zetaclient/chains/bitcoin/observer/inbound.go is excluded by none and included by none
  • zetaclient/chains/bitcoin/observer/observer.go is excluded by none and included by none
  • zetaclient/chains/bitcoin/observer/observer_test.go is excluded by none and included by none
  • zetaclient/chains/bitcoin/observer/outbound.go is excluded by none and included by none
  • zetaclient/chains/bitcoin/signer/signer.go is excluded by none and included by none
  • zetaclient/chains/evm/observer/inbound.go is excluded by none and included by none
  • zetaclient/chains/evm/observer/observer.go is excluded by none and included by none
  • zetaclient/chains/evm/observer/observer_test.go is excluded by none and included by none
  • zetaclient/chains/evm/observer/outbound.go is excluded by none and included by none
  • zetaclient/chains/evm/signer/signer.go is excluded by none and included by none
  • zetaclient/chains/evm/signer/signer_test.go is excluded by none and included by none
  • zetaclient/config/config_chain.go is excluded by none and included by none
  • zetaclient/context/app.go is excluded by none and included by none
  • zetaclient/context/app_context.go is excluded by none and included by none
  • zetaclient/context/app_context_test.go is excluded by none and included by none
  • zetaclient/context/app_test.go is excluded by none and included by none
  • zetaclient/context/context.go is excluded by none and included by none
  • zetaclient/context/context_test.go is excluded by none and included by none
  • zetaclient/context/zetacore_context.go is excluded by none and included by none
  • zetaclient/orchestrator/orchestrator.go is excluded by none and included by none
  • zetaclient/orchestrator/orchestrator_test.go is excluded by none and included by none
  • zetaclient/supplychecker/zeta_supply_checker.go is excluded by none and included by none
  • zetaclient/tss/tss_signer.go is excluded by none and included by none
  • zetaclient/zetacore/client.go is excluded by none and included by none
  • zetaclient/zetacore/tx.go is excluded by none and included by none
  • zetaclient/zetacore/tx_test.go is excluded by none and included by none

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


Tip

Early access features: enabled

We are currently testing the following features in early access:

  • OpenAI gpt-4o model for code reviews and chat: OpenAI claims that this model is better at understanding and generating code than the previous models. We seek your feedback over the next few weeks before making it generally available.

Note:

  • You can enable or disable early access features from the CodeRabbit UI or by updating the CodeRabbit configuration file.
  • Please join our Discord Community to provide feedback and report issues.
  • OSS projects are currently opted into early access features by default.

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.

@swift1337 swift1337 changed the title feat(zetaclient): use idiomatic go context.Context across services. feat(zetaclient): converge AppClient and ZetaCoreClient. Jun 28, 2024
@swift1337 swift1337 self-assigned this Jun 28, 2024
Copy link

codecov bot commented Jun 28, 2024

Codecov Report

Attention: Patch coverage is 83.33333% with 30 lines in your changes missing coverage. Please review.

Project coverage is 69.21%. Comparing base (0bcb422) to head (dd40900).

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #2395      +/-   ##
===========================================
+ Coverage    69.10%   69.21%   +0.10%     
===========================================
  Files          308      308              
  Lines        19221    19217       -4     
===========================================
+ Hits         13283    13301      +18     
+ Misses        5267     5247      -20     
+ Partials       671      669       -2     
Files Coverage Δ
zetaclient/chains/bitcoin/observer/observer.go 35.06% <100.00%> (ø)
zetaclient/chains/evm/observer/observer.go 45.41% <100.00%> (ø)
zetaclient/chains/evm/signer/signer.go 52.58% <100.00%> (ø)
zetaclient/context/context.go 100.00% <100.00%> (ø)
zetaclient/zetacore/client.go 41.77% <100.00%> (-0.37%) ⬇️
zetaclient/chains/bitcoin/observer/outbound.go 35.75% <0.00%> (ø)
zetaclient/chains/bitcoin/signer/signer.go 18.07% <50.00%> (ø)
zetaclient/chains/evm/observer/outbound.go 59.16% <0.00%> (ø)
zetaclient/config/config_chain.go 0.00% <0.00%> (ø)
zetaclient/tss/tss_signer.go 9.81% <0.00%> (ø)
... and 8 more

@swift1337 swift1337 changed the title feat(zetaclient): converge AppClient and ZetaCoreClient. feat(zetaclient): converge AppContext with ZetaCoreContext Jun 28, 2024
@swift1337 swift1337 marked this pull request as ready for review June 28, 2024 11:13
cmd/zetaclientd/start.go Outdated Show resolved Hide resolved
Copy link
Member

@lumtis lumtis left a comment

Choose a reason for hiding this comment

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

LGTM, small comments

zetaclient/context/app.go Show resolved Hide resolved
zetaclient/context/app.go Show resolved Hide resolved
@swift1337 swift1337 enabled auto-merge (squash) July 1, 2024 18:48
@swift1337 swift1337 requested a review from fbac as a code owner July 1, 2024 18:48
@swift1337 swift1337 merged commit 2d5519f into develop Jul 1, 2024
19 checks passed
@swift1337 swift1337 deleted the feat/zetaclient-zetacontext branch July 1, 2024 19:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants