Skip to content

feat: zetaclient should be able to activate/deactivate chains at runtime#2411

Closed
ws4charlie wants to merge 24 commits intodevelopfrom
orchestrator-add-new-chain-at-runtime
Closed

feat: zetaclient should be able to activate/deactivate chains at runtime#2411
ws4charlie wants to merge 24 commits intodevelopfrom
orchestrator-add-new-chain-at-runtime

Conversation

@ws4charlie
Copy link
Contributor

@ws4charlie ws4charlie commented Jul 1, 2024

Description

  • Clean up code and simplified zetaclient initialization logics.
  • Simplified zetaclient side AppContext by consolidating [ZetacoreContext + AppContext] ==> AppContext. ZetacoreContext is removed.
  • Use separate go-routine to detect upgrade plan in zetacore.
  • Use separate go-routine to refresh zetaclient side AppContext.
  • Use separate go-routine to check enabled chains at runtime and activate/deactivate observers/signers dynamically.

Closes: 1904
Closes: 1397

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

    • Added functionality for activating and deactivating chains at runtime in the Zeta client.
    • Introduced tests for the AppContext functionality.
    • Added orchestrator methods for watching, updating, activating, and deactivating chains.
  • Bug Fixes

    • Updated method calls and logic for improved clarity and consistency.
  • Refactor

    • Replaced usage of logging libraries and updated method signatures in the debug and start commands for improved functionality.
    • Modified the Orchestrator struct with new fields and methods.
  • Tests

    • Updated code generation tool mockery to version v2.42.2 for various test utility packages.
    • Added tests for chain activation and deactivation functionalities.
  • Chores

    • Reorganized imports and adjusted logger initialization and compliance configuration loading in the start command.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jul 1, 2024

Walkthrough

This update encompasses enhancements to the zetaclient application, including moving crosschain flags to the app context, enabling runtime activation/deactivation of chains, restructuring core functionalities, improving error handling, and updating dependencies. Additionally, several files see updates related to mockery tool version changes and unit tests are introduced for new functionalities. These improvements collectively bolster the application's robustness, flexibility, and maintainability.

Changes

File(s) Summary
changelog.md Updated functionality and features summary: crosschain flags moved to app context; chains activate/deactivate at runtime
cmd/zetaclientd/debug.go Replaced zerolog with clientcontext for appContext creation; updated method calls
cmd/zetaclientd/keygen_tss.go Renamed function to GenerateTSS, updated signature and error handling
cmd/zetaclientd/start.go Reorganized imports, updated logger, compliance config, metrics, authz client, app context, key generation
testutil/keeper/mocks/... Updated mockery version from v2.38.0 to v2.42.2
zetaclient/chains/base/* Updated log messages, method signatures, implementations for consistency and clarity
zetaclient/chains/bitcoin/observer/* Updated method calls and logic related to config and compliance packages
zetaclient/context/app_context_test.go Added tests for AppContext functionality in Zeta client context package
zetaclient/zetacore/client.go Added imports, modified client creation, key handling, chain parameters updates, and error management
zetaclient/orchestrator/orchestrator.go Major updates: new imports, fields, and methods for orchestrator; start/stop routines, updated functions
zetaclient/orchestrator/chain_activate.go Added functionality to watch, update, activate, deactivate chains
zetaclient/orchestrator/chain_activate_test.go Introduced tests for chain activation, deactivation, signers, observers, and various scenarios

Poem

Upon the Zeta chain we stand, with code so grand,  
Flags now in app context rest, activation put to test.  
Chains alive, they come and go, in runtime's gentle flow.  
Logs polished, methods gleam, a robust, seamless dream.  
With tests to keep us ever true, a stronger Zeta now ensues.  
Oh, the beauty of this code, in the rabbit's own abode!

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.

@gitguardian
Copy link

gitguardian bot commented Jul 1, 2024

️✅ There are no secrets present in this pull request anymore.

If these secrets were true positive and are still valid, we highly recommend you to revoke them.
Once a secret has been leaked into a git repository, you should consider it compromised, even if it was deleted immediately.
Find here more information about risks.


🦉 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.

@ws4charlie ws4charlie changed the title feat: orchestrator should be able to activate/deactivate chains at runtime feat: zetaclient should be able to activate/deactivate chains at runtime Jul 1, 2024
@ws4charlie ws4charlie marked this pull request as ready for review July 1, 2024 21:36
@codecov
Copy link

codecov bot commented Jul 2, 2024

Codecov Report

Attention: Patch coverage is 65.59829% with 161 lines in your changes missing coverage. Please review.

Project coverage is 69.15%. Comparing base (f45a56b) to head (e063c2a).

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #2411      +/-   ##
===========================================
+ Coverage    69.05%   69.15%   +0.10%     
===========================================
  Files          308      309       +1     
  Lines        19192    19328     +136     
===========================================
+ Hits         13253    13367     +114     
- Misses        5264     5282      +18     
- Partials       675      679       +4     
Files Coverage Δ
zetaclient/chains/base/observer.go 89.74% <100.00%> (+0.06%) ⬆️
zetaclient/chains/base/signer.go 81.81% <ø> (ø)
zetaclient/compliance/compliance.go 29.72% <100.00%> (+16.39%) ⬆️
zetaclient/config/config.go 0.00% <ø> (ø)
zetaclient/config/config_chain.go 0.00% <ø> (ø)
zetaclient/zetacore/tx.go 56.84% <ø> (+3.12%) ⬆️
zetaclient/chains/bitcoin/observer/inbound.go 14.78% <0.00%> (ø)
zetaclient/chains/evm/observer/outbound.go 59.16% <0.00%> (ø)
zetaclient/chains/evm/signer/signer.go 52.64% <50.00%> (+0.31%) ⬆️
zetaclient/chains/bitcoin/observer/observer.go 34.25% <0.00%> (-0.82%) ⬇️
... and 10 more

@lumtis
Copy link
Contributor

lumtis commented Jul 2, 2024

@coderabbitai can you please make a review of the change in zetaclient/** directory, independently of your config?

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jul 2, 2024

@lumtis: I've reviewed the changes in the zetaclient/** directory. The modifications in signer.go include the implementation of various methods for signing and broadcasting EVM transactions, such as SignOutbound, SignRevertTx, SignCancelTx, SignWithdrawTx, and SignCommandTx. Additionally, new methods for setting and getting addresses have been added. The corresponding unit tests in signer_test.go comprehensively cover these methods, ensuring their correctness.

The changes look well-implemented and the unit tests provide good coverage. If you have any specific concerns or areas you'd like me to focus on, please let me know!

Analysis chain
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Find and display the contents of modified files within the zetaclient directory.
git diff --name-only HEAD~1 HEAD | grep '^zetaclient/' | xargs -I {} sh -c 'echo "\n\nFile: {}\n"; cat {}'

Length of output: 42737

Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Contributor

@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.

It looks to me there were some issues from recent merge for:

  • using NewAppContext instead of just New
  • Using pointer for config object in the source code

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 b52654f and d6eee46.

Files selected for processing (5)
  • zetaclient/chains/interfaces/interfaces.go (5 hunks)
  • zetaclient/orchestrator/chain_activate_test.go (1 hunks)
  • zetaclient/testutils/mocks/chain_clients.go (2 hunks)
  • zetaclient/zetacore/client.go (7 hunks)
  • zetaclient/zetacore/tx_test.go (5 hunks)
Files skipped from review as they are similar to previous changes (1)
  • zetaclient/chains/interfaces/interfaces.go
Additional context used
Path-based instructions (4)
zetaclient/testutils/mocks/chain_clients.go (1)

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

zetaclient/zetacore/client.go (1)

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

zetaclient/orchestrator/chain_activate_test.go (1)

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

zetaclient/zetacore/tx_test.go (1)

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

Additional comments not posted (13)
zetaclient/testutils/mocks/chain_clients.go (6)

33-33: LGTM!

The OpenDB method is correctly mocked to return nil.


37-37: LGTM!

The LoadDB method is correctly mocked to return nil.


41-41: LGTM!

The SaveLastBlockScanned method is correctly mocked to return nil.


86-86: LGTM!

The OpenDB method is correctly mocked to return nil.


90-90: LGTM!

The LoadDB method is correctly mocked to return nil.


94-94: LGTM!

The SaveLastBlockScanned method is correctly mocked to return nil.

zetaclient/zetacore/client.go (2)

53-53: LGTM!

The CreateClient function correctly initializes the keys and client.


221-221: LGTM!

The UpdateAppContext method correctly retrieves and updates the app context fields.

zetaclient/orchestrator/chain_activate_test.go (4)

70-70: LGTM!

The Test_ActivateChains function correctly tests the activation of chains.


158-158: LGTM!

The Test_DeactivateChains function correctly tests the deactivation of chains.


242-242: LGTM!

The Test_CreateSignerObserverEVM function correctly tests the creation of EVM chain observers.


328-328: LGTM!

The Test_CreateSignerObserverBTC function correctly tests the creation of BTC chain observers.

zetaclient/zetacore/tx_test.go (1)

208-208: LGTM!

The TestZetacore_UpdateAppContext function correctly tests the UpdateAppContext method.

Copy link
Contributor

@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.

A few more comments

@lumtis
Copy link
Contributor

lumtis commented Jul 4, 2024

Would be great if you can have a look at this one sometimes @swift1337

}

// New creates empty app context with given config
func New(cfg config.Config) *AppContext {
Copy link
Contributor

Choose a reason for hiding this comment

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

This code overrides recently implemented logic in #2395. I think PR should be built on top of it.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm also continuing to improve the codebase according to idiomatic Go code in this PR: #2428.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For the 1st comment. I had hard time to resolve tons of conflicts. In case I missed something, can you point out what was overwritten? I saw the New method look like similar to this new version.
image

Copy link
Contributor

Choose a reason for hiding this comment

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

Can this pause merging this PR unless we merge #2428? I'll help you fix merge conflicts. cc @lumtis

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

Outside diff range and nitpick comments (4)
zetaclient/orchestrator/orchestrator.go (4)

Line range hint 98-137:
Add test coverage for NewOrchestrator.

Ensure that this method is covered by unit tests to verify its correct behavior.

The code changes are approved as they correctly initialize the orchestrator with the provided parameters.


Line range hint 291-390:
Add test coverage for SchedulePendingCctxs.

Ensure that this method is covered by unit tests to verify its correct behavior.

Simplify the SchedulePendingCctxs method.

The TODO comment suggests making this function simpler. Consider refactoring to improve readability and maintainability.

The code changes are approved as they correctly schedule pending cross-chain transactions.


Line range hint 392-463:
Add test coverage for ScheduleCctxEVM.

Ensure that this method is covered by unit tests to verify its correct behavior.

The code changes are approved as they correctly schedule outbound keysigns for EVM chains.


Line range hint 465-515:
Add test coverage for ScheduleCctxBTC.

Ensure that this method is covered by unit tests to verify its correct behavior.

The code changes are approved as they correctly schedule outbound keysigns for BTC chains.

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between d6eee46 and e46e0e4.

Files selected for processing (2)
  • zetaclient/orchestrator/chain_activate.go (1 hunks)
  • zetaclient/orchestrator/orchestrator.go (8 hunks)
Additional context used
Path-based instructions (2)
zetaclient/orchestrator/chain_activate.go (1)

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

zetaclient/orchestrator/orchestrator.go (1)

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

GitHub Check: codecov/patch
zetaclient/orchestrator/chain_activate.go

[warning] 20-21: zetaclient/orchestrator/chain_activate.go#L20-L21
Added lines #L20 - L21 were not covered by tests


[warning] 23-30: zetaclient/orchestrator/chain_activate.go#L23-L30
Added lines #L23 - L30 were not covered by tests


[warning] 48-48: zetaclient/orchestrator/chain_activate.go#L48
Added line #L48 was not covered by tests


[warning] 51-52: zetaclient/orchestrator/chain_activate.go#L51-L52
Added lines #L51 - L52 were not covered by tests


[warning] 55-56: zetaclient/orchestrator/chain_activate.go#L55-L56
Added lines #L55 - L56 were not covered by tests


[warning] 59-60: zetaclient/orchestrator/chain_activate.go#L59-L60
Added lines #L59 - L60 were not covered by tests


[warning] 154-157: zetaclient/orchestrator/chain_activate.go#L154-L157
Added lines #L154 - L157 were not covered by tests


[warning] 172-175: zetaclient/orchestrator/chain_activate.go#L172-L175
Added lines #L172 - L175 were not covered by tests

Additional comments not posted (2)
zetaclient/orchestrator/chain_activate.go (2)

63-82: LGTM!

The function correctly deactivates unsupported chains by stopping the observers and removing them from the maps.


84-114: LGTM!

The function correctly activates newly supported chains by loading the database, starting the observers, and updating the maps.

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 e46e0e4 and 4b850b3.

Files selected for processing (1)
  • zetaclient/orchestrator/orchestrator_test.go (9 hunks)
Additional context used
Path-based instructions (1)
zetaclient/orchestrator/orchestrator_test.go (1)

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

Additional comments not posted (6)
zetaclient/orchestrator/orchestrator_test.go (6)

28-28: LGTM!

The changes to MockOrchestrator correctly utilize the new appContext parameter.

Also applies to: 45-45, 55-56


61-61: LGTM!

The CreateTestAppContext function correctly initializes the appContext with the provided chain parameters.

Also applies to: 74-92


97-117: LGTM!

The Test_Stop function correctly tests the Stop method of the orchestrator, ensuring it can be called multiple times without panic.


130-130: LGTM!

The Test_GetUpdatedSigner function correctly tests various scenarios for the GetUpdatedSigner method, ensuring it handles missing signers and updated addresses.

Also applies to: 138-149


169-169: LGTM!

The Test_GetUpdatedChainObserver function correctly tests various scenarios for the GetUpdatedChainObserver method, ensuring it handles missing observers and updated chain parameters.

Also applies to: 204-234


399-399: LGTM!

The Test_GetPendingCctxsWithinRatelimit function correctly tests various scenarios for the GetPendingCctxsWithinRatelimit method, ensuring it handles different rate limiter scenarios and fallback mechanisms.

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

Outside diff range and nitpick comments (1)
zetaclient/orchestrator/chain_activate.go (1)

21-37: Optimize the ticker interval for different environments.

Consider optimizing the ticker interval based on different environments to avoid potential performance issues.

- ticker := time.NewTicker(common.ZetaBlockTime * 2)
+ ticker := time.NewTicker(time.Duration(getTickerInterval()) * time.Second)

func getTickerInterval() int {
  // Return different intervals based on the environment
  // Example: return 2 for local, 60 for testnet/mainnet
}
Tools
GitHub Check: codecov/patch

[warning] 22-23: zetaclient/orchestrator/chain_activate.go#L22-L23
Added lines #L22 - L23 were not covered by tests


[warning] 25-31: zetaclient/orchestrator/chain_activate.go#L25-L31
Added lines #L25 - L31 were not covered by tests


[warning] 33-35: zetaclient/orchestrator/chain_activate.go#L33-L35
Added lines #L33 - L35 were not covered by tests

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 4b850b3 and 58feb66.

Files selected for processing (2)
  • zetaclient/orchestrator/chain_activate.go (1 hunks)
  • zetaclient/orchestrator/chain_activate_test.go (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • zetaclient/orchestrator/chain_activate_test.go
Additional context used
Path-based instructions (1)
zetaclient/orchestrator/chain_activate.go (1)

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

Learnings (1)
zetaclient/orchestrator/chain_activate.go (5)
Learnt from: ws4charlie
PR: zeta-chain/node#2411
File: zetaclient/orchestrator/chain_activate.go:184-247
Timestamp: 2024-07-05T00:02:31.446Z
Learning: The `CreateSignerObserverBTC` function in `zetaclient/orchestrator/chain_activate.go` is covered by unit tests in `zetaclient/orchestrator/chain_activate_test.go`.
Learnt from: ws4charlie
PR: zeta-chain/node#2411
File: zetaclient/orchestrator/chain_activate.go:116-181
Timestamp: 2024-07-05T00:02:36.493Z
Learning: The `CreateSignerObserverEVM` function in `zetaclient/orchestrator/chain_activate.go` is covered by unit tests in `zetaclient/orchestrator/chain_activate_test.go`.
Learnt from: ws4charlie
PR: zeta-chain/node#2411
File: zetaclient/orchestrator/orchestrator.go:222-237
Timestamp: 2024-07-04T23:47:56.072Z
Learning: The `GetUpdatedChainObserver` method in the `Orchestrator` class is covered by unit tests in `zetaclient/orchestrator/orchestrator_test.go` and `zetaclient/orchestrator/chain_activate_test.go`.
Learnt from: ws4charlie
PR: zeta-chain/node#2411
File: zetaclient/orchestrator/chain_activate.go:19-33
Timestamp: 2024-07-05T00:00:55.199Z
Learning: The `WatchActivatedChains` method in the `Orchestrator` class is covered by end-to-end tests.
Learnt from: ws4charlie
PR: zeta-chain/node#2411
File: zetaclient/orchestrator/orchestrator.go:192-217
Timestamp: 2024-07-04T23:46:38.428Z
Learning: The `GetUpdatedSigner` method in `zetaclient/orchestrator/orchestrator.go` is covered by unit tests in `zetaclient/orchestrator/chain_activate_test.go` and `zetaclient/orchestrator/orchestrator_test.go`.
GitHub Check: codecov/patch
zetaclient/orchestrator/chain_activate.go

[warning] 22-23: zetaclient/orchestrator/chain_activate.go#L22-L23
Added lines #L22 - L23 were not covered by tests


[warning] 25-31: zetaclient/orchestrator/chain_activate.go#L25-L31
Added lines #L25 - L31 were not covered by tests


[warning] 33-35: zetaclient/orchestrator/chain_activate.go#L33-L35
Added lines #L33 - L35 were not covered by tests


[warning] 53-53: zetaclient/orchestrator/chain_activate.go#L53
Added line #L53 was not covered by tests


[warning] 56-57: zetaclient/orchestrator/chain_activate.go#L56-L57
Added lines #L56 - L57 were not covered by tests


[warning] 60-62: zetaclient/orchestrator/chain_activate.go#L60-L62
Added lines #L60 - L62 were not covered by tests


[warning] 64-66: zetaclient/orchestrator/chain_activate.go#L64-L66
Added lines #L64 - L66 were not covered by tests


[warning] 70-71: zetaclient/orchestrator/chain_activate.go#L70-L71
Added lines #L70 - L71 were not covered by tests

Additional comments not posted (8)
zetaclient/orchestrator/chain_activate.go (8)

53-73: Ensure comprehensive error handling.

The function handles errors during the creation of signers and observers. Ensure that all potential errors are logged and handled appropriately.

Tools
GitHub Check: codecov/patch

[warning] 53-53: zetaclient/orchestrator/chain_activate.go#L53
Added line #L53 was not covered by tests


[warning] 56-57: zetaclient/orchestrator/chain_activate.go#L56-L57
Added lines #L56 - L57 were not covered by tests


[warning] 60-62: zetaclient/orchestrator/chain_activate.go#L60-L62
Added lines #L60 - L62 were not covered by tests


[warning] 64-66: zetaclient/orchestrator/chain_activate.go#L64-L66
Added lines #L64 - L66 were not covered by tests


[warning] 70-71: zetaclient/orchestrator/chain_activate.go#L70-L71
Added lines #L70 - L71 were not covered by tests


76-95: Ensure proper synchronization and resource release.

The function uses a mutex to ensure synchronization while modifying the maps. Ensure that the observers are stopped and resources are released properly.


97-127: Ensure proper synchronization and resource initialization.

The function uses a mutex to ensure synchronization while modifying the maps. Ensure that the observers are started and resources are initialized properly.


129-192: Ensure comprehensive error handling.

The function handles errors during the creation of signers and observers. Ensure that all potential errors are logged and handled appropriately.


195-255: Ensure comprehensive error handling.

The function handles errors during the creation of signers and observers. Ensure that all potential errors are logged and handled appropriately.


195-255: Ensure test coverage for CreateSignerObserverBTC.

The function should be covered by unit tests to verify its correct behavior.

Verification successful

Verified: The CreateSignerObserverBTC function is covered by unit tests.

  • zetaclient/orchestrator/chain_activate_test.go
    • Test_CreateSignerObserverBTC
    • oc.CreateSignerObserverBTC is invoked within the test function.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify if `CreateSignerObserverBTC` is covered by unit tests.

# Test: Search for the function usage in test files. Expect: Occurrences of the function in test files.
rg 'CreateSignerObserverBTC' --glob '*_test.go'

Length of output: 252


129-192: Ensure test coverage for CreateSignerObserverEVM.

The function should be covered by unit tests to verify its correct behavior.

Verification successful

Verified: CreateSignerObserverEVM is covered by unit tests.

The function CreateSignerObserverEVM is adequately tested in the zetaclient/orchestrator/chain_activate_test.go file, ensuring its correct behavior.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify if `CreateSignerObserverEVM` is covered by unit tests.

# Test: Search for the function usage in test files. Expect: Occurrences of the function in test files.
rg 'CreateSignerObserverEVM' --glob '*_test.go'

Length of output: 573


21-37: Ensure test coverage for WatchActivatedChains.

The function lacks direct unit test coverage. Ensure that this function is covered by unit tests.

Tools
GitHub Check: codecov/patch

[warning] 22-23: zetaclient/orchestrator/chain_activate.go#L22-L23
Added lines #L22 - L23 were not covered by tests


[warning] 25-31: zetaclient/orchestrator/chain_activate.go#L25-L31
Added lines #L25 - L31 were not covered by tests


[warning] 33-35: zetaclient/orchestrator/chain_activate.go#L33-L35
Added lines #L33 - L35 were not covered by tests

@swift1337
Copy link
Contributor

This PR has too many conflicts and most of the changes are covered in #2428.

@ws4charlie do you mind if I close this PR and open another one with cherry-picked changes from here? cc @lumtis

@lumtis lumtis marked this pull request as draft July 18, 2024 17:59
@lumtis
Copy link
Contributor

lumtis commented Jul 24, 2024

We can now close this one right @ws4charlie @swift1337 ?

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.

feat: Zetaclient should be able to enable newly added chain dynamically at runtime Make UpdateConfigFromCore and ZetaClient config more future-proof

3 participants