-
Notifications
You must be signed in to change notification settings - Fork 116
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 should be able to activate/deactivate chains at runtime #2411
Conversation
…hestrator-add-new-chain-at-runtime
…om TSS and use BTC network params instead; cleanup and simplified methods
WalkthroughThis update encompasses enhancements to the Changes
Poem
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? TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Additionally, you can add CodeRabbit Configration File (
|
️✅ 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. 🦉 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. |
…y when activating new observers
…hestrator-add-new-chain-at-runtime
…hestrator-add-new-chain-at-runtime
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ 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
|
@coderabbitai can you please make a review of the change in |
@lumtis: I've reviewed the changes in the 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 chainScripts executedThe 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 performedReview triggered.
|
There was a problem hiding this 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 justNew
- Using pointer for config object in the source code
@coderabbitai you don't have any review comments to provide to the files in |
Tip For best results, initiate chat on the files or code changes. @lumtis: I've reviewed the changes in the
Overall, the changes are well-implemented and improve the code's clarity and efficiency. The updates to the test cases ensure that the modifications are thoroughly tested. If you have any specific areas you would like me to focus on or further concerns, please let me know! Analysis chainScripts executedThe following scripts were executed for the analysis: Script: #!/bin/bash
# Get the diffs of the files in the zetaclient directory for detailed analysis.
git diff HEAD~1 HEAD zetaclient/
Length of output: 2041 |
…onfig with non-pointer config and improve thread safety by deep clone
…hestrator-add-new-chain-at-runtime
There was a problem hiding this 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 (7)
zetaclient/config/types_test.go (1)
15-21
: Ensure comprehensive testing of theClone
method.The test for the
Clone
method is good, but consider adding more test cases to cover edge cases, such as:
- Config with empty fields.
- Config with maximum possible values.
- Config with nested structures.
func Test_Clone_EmptyConfig(t *testing.T) { cfg := config.Config{} clone := cfg.Clone() require.Equal(t, cfg, clone) } func Test_Clone_MaxValues(t *testing.T) { // Add a config with maximum possible values cfg := config.Config{ // populate fields with max values } clone := cfg.Clone() require.Equal(t, cfg, clone) }zetaclient/compliance/compliance_test.go (1)
26-26
: Ensure comprehensive testing of compliance functions.The tests for compliance functions are well-structured. Consider adding more test cases to cover edge cases, such as:
- Empty compliance config.
- Multiple restricted addresses.
- Non-string address formats.
t.Run("should return false for empty compliance config", func(t *testing.T) { cfg.ComplianceConfig.RestrictedAddresses = []string{} LoadComplianceConfig(cfg) require.False(t, IsCctxRestricted(cctx)) }) t.Run("should return true for multiple restricted addresses", func(t *testing.T) { cfg.ComplianceConfig.RestrictedAddresses = []string{"address1", "address2", cctx.InboundParams.Sender} LoadComplianceConfig(cfg) require.True(t, IsCctxRestricted(cctx)) }) t.Run("should handle non-string address formats", func(t *testing.T) { cfg.ComplianceConfig.RestrictedAddresses = []string{"0x123", "0x456"} LoadComplianceConfig(cfg) require.False(t, IsCctxRestricted(cctx)) })Also applies to: 31-31, 37-37, 42-42, 48-48
zetaclient/chains/bitcoin/observer/observer.go (5)
Line range hint
1-1
: Add a package-level comment.Consider adding a package-level comment to describe the purpose and functionality of the
observer
package.// Package observer implements the Bitcoin chain observer.
Line range hint
1-1
: Add import grouping.Group imports into standard library, third-party, and local imports for better readability.
import ( "bytes" "encoding/hex" "fmt" "math" "math/big" "sort" "time" "github.com/btcsuite/btcd/btcjson" "github.com/btcsuite/btcd/chaincfg" "github.com/btcsuite/btcd/chaincfg/chainhash" "github.com/btcsuite/btcd/wire" "github.com/btcsuite/btcutil" "github.com/pkg/errors" "github.com/rs/zerolog" "github.com/zeta-chain/zetacore/pkg/chains" "github.com/zeta-chain/zetacore/pkg/proofs" observertypes "github.com/zeta-chain/zetacore/x/observer/types" "github.com/zeta-chain/zetacore/zetaclient/chains/base" "github.com/zeta-chain/zetacore/zetaclient/chains/bitcoin" "github.com/zeta-chain/zetacore/zetaclient/chains/interfaces" "github.com/zeta-chain/zetacore/zetaclient/context" "github.com/zeta-chain/zetacore/zetaclient/metrics" clienttypes "github.com/zeta-chain/zetacore/zetaclient/types" )
Line range hint
1-1
: Add documentation for constants.Consider adding comments to describe the purpose of each constant.
const ( // btcBlocksPerDay represents Bitcoin blocks per days for LRU block cache size btcBlocksPerDay = 144 // RegnetStartBlock is the hardcoded start block for regnet RegnetStartBlock = 100 // BigValueSats contains the threshold to determine a big value in Bitcoin represents 2 BTC BigValueSats = 200000000 // BigValueConfirmationCount represents the number of confirmation necessary for bigger values: 6 confirmations BigValueConfirmationCount = 6 )
Line range hint
1-1
: Add documentation for Logger struct.Consider adding comments to describe the purpose of each field in the
Logger
struct.// Logger contains list of loggers used by Bitcoin chain observer type Logger struct { // base.Logger contains a list of base observer loggers base.ObserverLogger // UTXOs is the logger for UTXOs management UTXOs zerolog.Logger }
Line range hint
1-1
: Add documentation for Observer struct.Consider adding comments to describe the purpose of each field in the
Observer
struct.// Observer is the Bitcoin chain observer type Observer struct { // base.Observer implements the base chain observer base.Observer // netParams contains the Bitcoin network parameters netParams *chaincfg.Params // btcClient is the Bitcoin RPC client that interacts with the Bitcoin node btcClient interfaces.BTCRPCClient // pendingNonce is the outbound artificial pending nonce pendingNonce uint64 // utxos contains the UTXOs owned by the TSS address utxos []btcjson.ListUnspentResult // includedTxHashes indexes included tx with tx hash includedTxHashes map[string]bool // includedTxResults indexes tx results with the outbound tx identifier includedTxResults map[string]*btcjson.GetTransactionResult // broadcastedTx indexes the outbound hash with the outbound tx identifier broadcastedTx map[string]string // logger contains the loggers used by the bitcoin observer logger Logger }
Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Files selected for processing (56)
- changelog.md (2 hunks)
- cmd/zetaclientd/debug.go (3 hunks)
- cmd/zetaclientd/keygen_tss.go (4 hunks)
- cmd/zetaclientd/start.go (10 hunks)
- testutil/keeper/mocks/crosschain/account.go (1 hunks)
- testutil/keeper/mocks/crosschain/authority.go (1 hunks)
- testutil/keeper/mocks/crosschain/bank.go (1 hunks)
- testutil/keeper/mocks/crosschain/fungible.go (1 hunks)
- testutil/keeper/mocks/crosschain/ibccrosschain.go (1 hunks)
- testutil/keeper/mocks/crosschain/lightclient.go (1 hunks)
- testutil/keeper/mocks/crosschain/observer.go (1 hunks)
- testutil/keeper/mocks/crosschain/staking.go (1 hunks)
- testutil/keeper/mocks/emissions/account.go (1 hunks)
- testutil/keeper/mocks/emissions/bank.go (1 hunks)
- testutil/keeper/mocks/emissions/observer.go (1 hunks)
- testutil/keeper/mocks/emissions/staking.go (1 hunks)
- testutil/keeper/mocks/fungible/account.go (1 hunks)
- testutil/keeper/mocks/fungible/authority.go (1 hunks)
- testutil/keeper/mocks/fungible/bank.go (1 hunks)
- testutil/keeper/mocks/fungible/evm.go (1 hunks)
- testutil/keeper/mocks/fungible/observer.go (1 hunks)
- testutil/keeper/mocks/ibccrosschain/crosschain.go (1 hunks)
- testutil/keeper/mocks/ibccrosschain/transfer.go (1 hunks)
- testutil/keeper/mocks/lightclient/authority.go (1 hunks)
- testutil/keeper/mocks/observer/authority.go (1 hunks)
- testutil/keeper/mocks/observer/lightclient.go (1 hunks)
- testutil/keeper/mocks/observer/slashing.go (1 hunks)
- testutil/keeper/mocks/observer/staking.go (1 hunks)
- zetaclient/chains/base/observer.go (3 hunks)
- zetaclient/chains/base/observer_test.go (4 hunks)
- zetaclient/chains/base/signer.go (2 hunks)
- zetaclient/chains/base/signer_test.go (2 hunks)
- zetaclient/chains/bitcoin/observer/inbound.go (2 hunks)
- zetaclient/chains/bitcoin/observer/observer.go (5 hunks)
- zetaclient/chains/bitcoin/observer/observer_test.go (6 hunks)
- zetaclient/chains/bitcoin/observer/outbound_test.go (1 hunks)
- zetaclient/chains/bitcoin/rpc/rpc_live_test.go (1 hunks)
- zetaclient/chains/evm/constant.go (1 hunks)
- zetaclient/chains/evm/observer/inbound.go (4 hunks)
- zetaclient/chains/evm/observer/inbound_test.go (23 hunks)
- zetaclient/chains/evm/observer/observer.go (5 hunks)
- zetaclient/chains/evm/observer/observer_test.go (12 hunks)
- zetaclient/chains/evm/observer/outbound.go (1 hunks)
- zetaclient/chains/evm/observer/outbound_test.go (6 hunks)
- zetaclient/chains/evm/signer/signer.go (4 hunks)
- zetaclient/chains/evm/signer/signer_test.go (4 hunks)
- zetaclient/chains/interfaces/interfaces.go (5 hunks)
- zetaclient/common/constant.go (1 hunks)
- zetaclient/compliance/compliance.go (1 hunks)
- zetaclient/compliance/compliance_test.go (1 hunks)
- zetaclient/config/config.go (3 hunks)
- zetaclient/config/config_chain.go (2 hunks)
- zetaclient/config/types.go (5 hunks)
- zetaclient/config/types_test.go (1 hunks)
- zetaclient/context/app_context.go (1 hunks)
- zetaclient/context/app_context_test.go (1 hunks)
Files not processed due to max files limit (19)
- zetaclient/context/app_test.go
- zetaclient/context/context.go
- zetaclient/context/context_test.go
- zetaclient/orchestrator/app_context_update.go
- zetaclient/orchestrator/app_context_update_test.go
- zetaclient/orchestrator/chain_activate.go
- zetaclient/orchestrator/chain_activate_test.go
- zetaclient/orchestrator/orchestrator.go
- zetaclient/orchestrator/orchestrator_test.go
- zetaclient/supplychecker/zeta_supply_checker.go
- zetaclient/testdata/config/zetaclient_config.json
- zetaclient/testutils/mocks/chain_clients.go
- zetaclient/testutils/mocks/zetacore_client.go
- zetaclient/testutils/testdata.go
- zetaclient/testutils/testdata_naming.go
- zetaclient/tss/tss_signer.go
- zetaclient/zetacore/client.go
- zetaclient/zetacore/tx.go
- zetaclient/zetacore/tx_test.go
Files skipped from review due to trivial changes (30)
- testutil/keeper/mocks/crosschain/account.go
- testutil/keeper/mocks/crosschain/authority.go
- testutil/keeper/mocks/crosschain/bank.go
- testutil/keeper/mocks/crosschain/fungible.go
- testutil/keeper/mocks/crosschain/ibccrosschain.go
- testutil/keeper/mocks/crosschain/lightclient.go
- testutil/keeper/mocks/crosschain/observer.go
- testutil/keeper/mocks/crosschain/staking.go
- testutil/keeper/mocks/emissions/account.go
- testutil/keeper/mocks/emissions/bank.go
- testutil/keeper/mocks/emissions/observer.go
- testutil/keeper/mocks/emissions/staking.go
- testutil/keeper/mocks/fungible/account.go
- testutil/keeper/mocks/fungible/authority.go
- testutil/keeper/mocks/fungible/bank.go
- testutil/keeper/mocks/fungible/evm.go
- testutil/keeper/mocks/fungible/observer.go
- testutil/keeper/mocks/ibccrosschain/crosschain.go
- testutil/keeper/mocks/ibccrosschain/transfer.go
- testutil/keeper/mocks/lightclient/authority.go
- testutil/keeper/mocks/observer/authority.go
- testutil/keeper/mocks/observer/lightclient.go
- testutil/keeper/mocks/observer/slashing.go
- testutil/keeper/mocks/observer/staking.go
- zetaclient/chains/base/signer_test.go
- zetaclient/chains/bitcoin/rpc/rpc_live_test.go
- zetaclient/chains/evm/constant.go
- zetaclient/common/constant.go
- zetaclient/config/config.go
- zetaclient/config/config_chain.go
Additional context used
Path-based instructions (25)
zetaclient/config/types_test.go (1)
Pattern
**/*.go
: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.zetaclient/compliance/compliance_test.go (1)
Pattern
**/*.go
: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.zetaclient/chains/base/signer.go (1)
Pattern
**/*.go
: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.zetaclient/compliance/compliance.go (1)
Pattern
**/*.go
: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.zetaclient/config/types.go (1)
Pattern
**/*.go
: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.cmd/zetaclientd/debug.go (1)
Pattern
**/*.go
: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.zetaclient/chains/interfaces/interfaces.go (1)
Pattern
**/*.go
: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.zetaclient/context/app_context.go (1)
Pattern
**/*.go
: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.cmd/zetaclientd/keygen_tss.go (1)
Pattern
**/*.go
: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.zetaclient/context/app_context_test.go (1)
Pattern
**/*.go
: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.zetaclient/chains/bitcoin/observer/observer_test.go (1)
Pattern
**/*.go
: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.cmd/zetaclientd/start.go (1)
Pattern
**/*.go
: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.zetaclient/chains/base/observer_test.go (1)
Pattern
**/*.go
: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.zetaclient/chains/base/observer.go (1)
Pattern
**/*.go
: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.zetaclient/chains/evm/observer/observer_test.go (1)
Pattern
**/*.go
: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.zetaclient/chains/bitcoin/observer/inbound.go (1)
Pattern
**/*.go
: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.zetaclient/chains/evm/observer/outbound.go (1)
Pattern
**/*.go
: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.zetaclient/chains/evm/signer/signer_test.go (1)
Pattern
**/*.go
: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.zetaclient/chains/evm/observer/observer.go (1)
Pattern
**/*.go
: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.zetaclient/chains/bitcoin/observer/outbound_test.go (1)
Pattern
**/*.go
: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.zetaclient/chains/evm/observer/inbound_test.go (1)
Pattern
**/*.go
: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.zetaclient/chains/bitcoin/observer/observer.go (1)
Pattern
**/*.go
: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.zetaclient/chains/evm/observer/outbound_test.go (1)
Pattern
**/*.go
: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.zetaclient/chains/evm/signer/signer.go (1)
Pattern
**/*.go
: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.zetaclient/chains/evm/observer/inbound.go (1)
Pattern
**/*.go
: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.
Additional comments not posted (90)
zetaclient/chains/base/signer.go (2)
18-18
: Ensure proper initialization ofappContext
.The
appContext
field in theSigner
struct should be properly initialized to avoid potential nil pointer dereferences.Ensure that the
appContext
is always initialized before being used.
66-68
: LGTM! Ensure theAppContext
method is correctly used.The
AppContext
method is correctly implemented. Ensure that all usages of this method are updated to reflect the changes.zetaclient/config/types.go (1)
133-155
: LGTM! Ensure theClone
method is thoroughly tested.The
Clone
method is correctly implemented and performs a deep copy of theConfig
struct.Ensure that the
Clone
method is thoroughly tested to cover all edge cases.cmd/zetaclientd/debug.go (2)
59-59
: Update initialization to useclientcontext.New
The initialization of
appContext
has been updated to useclientcontext.New(cfg)
. This change is consistent with the updated context handling approach.
133-133
: Ensure consistency withGetExternalChainParams
methodThe method
GetExternalChainParams
is used to retrieve chain parameters. Ensure this change is consistent with the rest of the codebase where chain parameters are accessed.Verification successful
Consistent usage of
GetExternalChainParams
methodThe method
GetExternalChainParams
is used consistently across the codebase. The method's return values are uniformly checked, and the retrieved parameters are handled in a similar manner.
zetaclient/context/app_context_test.go
zetaclient/context/app_context.go
zetaclient/supplychecker/zeta_supply_checker.go
zetaclient/orchestrator/chain_activate.go
zetaclient/orchestrator/orchestrator.go
zetaclient/chains/evm/observer/inbound.go
cmd/zetaclientd/debug.go
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the usage of `GetExternalChainParams` method in the codebase. # Test: Search for the method usage. Expect: Consistent usage of `GetExternalChainParams`. rg --type go $'GetExternalChainParams'Length of output: 1321
Script:
#!/bin/bash # Description: Extract context around the usage of `GetExternalChainParams` method in the identified files to verify consistency. # Extract 5 lines before and after the usage of the method for context. rg --type go -C 5 'GetExternalChainParams' zetaclient/context/app_context_test.go zetaclient/context/app_context.go zetaclient/supplychecker/zeta_supply_checker.go zetaclient/orchestrator/chain_activate.go zetaclient/orchestrator/orchestrator.go zetaclient/chains/evm/observer/inbound.go cmd/zetaclientd/debug.goLength of output: 9169
zetaclient/chains/interfaces/interfaces.go (2)
28-28
: Add import forclientcontext
The
clientcontext
package is imported to support the newUpdateAppContext
method in theZetacoreClient
interface.
71-71
: IntroduceUpdateAppContext
methodThe
UpdateAppContext
method is added to theZetacoreClient
interface. This method updates the application context with a newAppContext
and logger.zetaclient/context/app_context.go (6)
1-2
: Update package documentationThe package documentation is updated to reflect the global app context for
ZetaClient
.
17-18
: DocumentAppContext
structThe
AppContext
struct is documented to indicate that it contains the application context forzetaclient
and is updated at runtime periodically.
28-30
: AddadditionalChain
fieldThe
additionalChain
field is added to store additional static chain information for dynamic support without requiring an upgrade.
32-34
: AddblockHeaderEnabledChains
fieldThe
blockHeaderEnabledChains
field is added to store the list of chains with block header verification enabled.
40-50
: UpdateNew
functionThe
New
function is updated to initialize the new fields in theAppContext
struct.
183-194
: UpdateUpdate
methodThe
Update
method is updated to include the new fields (additionalChains
andblockHeaderEnabledChains
) in theAppContext
struct.cmd/zetaclientd/keygen_tss.go (3)
25-26
: UpdateGenerateTSS
function documentationThe function documentation is updated to reflect the new parameter and provide a detailed explanation of the function's behavior.
35-36
: AddhotkeyPassword
parameterThe
hotkeyPassword
parameter is added to theGenerateTSS
function to enhance security and flexibility.
69-69
: Improve error handling inGenerateTSS
The error handling in the
GenerateTSS
function is improved to provide more detailed logging and error messages.zetaclient/context/app_context_test.go (7)
1-2
: Add package documentationThe package documentation is added to indicate that the tests are for the
context
package.
19-47
: AddTest_NewAppContext
test caseThe
Test_NewAppContext
test case is added to ensure theAppContext
is created correctly with an empty config.
50-65
: AddTest_SetGetConfig
test caseThe
Test_SetGetConfig
test case is added to ensure the config can be set and retrieved correctly in theAppContext
.
68-150
: AddTest_UpdateAndGetters
test caseThe
Test_UpdateAndGetters
test case is added to ensure theAppContext
fields are updated and retrieved correctly.
152-180
: AddTestIsOutboundObservationEnabled
test caseThe
TestIsOutboundObservationEnabled
test case is added to ensure the outbound observation flag is checked correctly.
182-211
: AddTestIsInboundObservationEnabled
test caseThe
TestIsInboundObservationEnabled
test case is added to ensure the inbound observation flag is checked correctly.
214-245
: AddmakeAppContext
helper functionThe
makeAppContext
helper function is added to create a testAppContext
with provided parameters.zetaclient/chains/bitcoin/observer/observer_test.go (2)
101-104
: LGTM!The changes to load the database within the
MockBTCObserver
function ensure that the mock observer is properly initialized with the database.
242-242
: LGTM!The changes to create a new observer without the
dbpath
parameter align with the updated function signature.cmd/zetaclientd/start.go (5)
23-30
: LGTM!The new imports for
authzclient
,compliance
, andzetacore
packages are necessary to support the updated functionalities in thestart
function.
35-38
: LGTM!The new constant
ObserverDBPath
defines the path to the observer database, improving code readability and maintainability.
Line range hint
64-170
: LGTM!The updates to the
start
function ensure that the necessary configurations and services are initialized and started correctly. The changes improve the overall structure and readability of the function.
204-210
: LGTM!The updates to the code for generating the TSS key ensure that the key is generated correctly using the updated function signature.
295-305
: LGTM!The updates to the code for initializing the orchestrator improve code readability and maintainability by using the defined constant for the observer database path.
zetaclient/chains/base/observer_test.go (2)
28-28
: LGTM!The changes to use the new
appContext
parameter ensure that the observer is created with the updated function signature.
54-54
: LGTM!The changes to use the new
appContext
parameter ensure that the observer is created with the updated function signature.zetaclient/chains/base/observer.go (2)
Line range hint
132-143
: LGTM!The updates to the
Stop
method ensure that the stopping process is logged and the database is properly set tonil
after closing it, preventing potential issues with accessing a closed database.
168-168
: LGTM!The changes to the
AppContext
method ensure that it returns the correct context, aligning with the updated field in the Observer struct.zetaclient/chains/evm/observer/observer_test.go (3)
Line range hint
36-72
: LGTM!The changes to the
getAppContext
function ensure that the app context is created and updated correctly with the new parameters, aligning with the updated function signature.
99-100
: LGTM!The changes to create the app context using the
getAppContext
function ensure that the mock observer is created with the updated function signature.
146-155
: LGTM!The changes to create the app context using the
getAppContext
function ensure that the observer is created with the updated function signature.zetaclient/chains/bitcoin/observer/inbound.go (1)
375-375
: Update compliance check to use new packageThe compliance check for restricted addresses now uses the
compliance
package.zetaclient/chains/evm/observer/outbound.go (1)
92-92
: Update log message for consistencyThe log message for stopping the outbound watcher is updated for consistency with other log messages.
zetaclient/chains/evm/signer/signer_test.go (3)
50-50
: UpdategetNewEvmSigner
function to use the newAppContext
The
getNewEvmSigner
function now initializesAppContext
using the updated context.
74-74
: UpdategetNewEvmChainObserver
function to use the newAppContext
The
getNewEvmChainObserver
function now initializesAppContext
using the updated context.
485-485
: Add test case forgetEVMRPC
functionThe test case for the
getEVMRPC
function now includes an error scenario for invalid endpoints.zetaclient/chains/evm/observer/observer.go (3)
Line range hint
185-219
: LGTM! Improved logging messages.The changes improve the logging messages by including the chain ID, providing more context.
324-324
: LGTM! Improved logging messages.The changes improve the logging messages by including the chain ID, providing more context.
61-71
: Ensure proper initialization of AppContext.The
appContext
parameter has been added to theNewObserver
function. Ensure thatappContext
is properly initialized and passed in from the calling code.Verification successful
Ensure proper initialization of AppContext.
The
appContext
parameter is passed to theNewObserver
function in multiple instances. Ensure thatappContext
is properly initialized before being passed.
File:
zetaclient/orchestrator/chain_activate.go
- Snippet:
observer, err := evmobserver.NewObserver( evmConfig, evmClient, *chainParams, oc.appContext, oc.zetacoreClient, oc.ts, )File:
zetaclient/chains/base/observer_test.go
- Snippet:
ob, err := base.NewObserver( chain, chainParams, appContext, zetacoreClient, tss, )File:
zetaclient/chains/evm/observer/observer_test.go
- Snippet:
ob, err := observer.NewObserver(evmCfg, evmClient, params, appCtx, zetacoreClient, tss, base.Logger{}, nil)File:
zetaclient/chains/evm/signer/signer_test.go
- Snippet:
return observer.NewObserver( evmcfg, evmClient, params, appContext, mocks.NewMockZetacoreClient(), )File:
zetaclient/chains/bitcoin/observer/observer_test.go
- Snippet:
ob, err := observer.NewObserver( chain, btcClient, params, nil, nil, tss, base.Logger{}, nil, )File:
zetaclient/chains/bitcoin/observer/outbound_test.go
- Snippet:
ob, err := NewObserver(chain, btcClient, params, nil, nil, tss, base.Logger{}, nil)These snippets indicate that
appContext
is being passed to theNewObserver
function. We need to ensure thatappContext
is properly initialized in these instances.
Proper initialization of AppContext verified.
The
appContext
parameter is properly initialized before being passed to theNewObserver
function.
- File:
zetaclient/orchestrator/chain_activate.go
- File:
zetaclient/chains/base/observer_test.go
- File:
zetaclient/chains/evm/observer/observer_test.go
- File:
zetaclient/chains/evm/signer/signer_test.go
- File:
zetaclient/chains/bitcoin/observer/observer_test.go
- File:
zetaclient/chains/bitcoin/observer/outbound_test.go
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify that `appContext` is properly initialized and passed to the `NewObserver` function. # Test: Search for the `NewObserver` function calls. Expect: Proper initialization and passing of `appContext`. rg --type go 'NewObserver' --context 5Length of output: 49323
Script:
#!/bin/bash # Description: Verify that `appContext` is properly initialized before being passed to `NewObserver`. # Test: Search for the initialization of `appContext`. Expect: Proper initialization. rg --type go 'appContext := ' --context 5Length of output: 10853
zetaclient/chains/bitcoin/observer/outbound_test.go (1)
30-30
: Ensure proper handling of database paths.The
dbpath
parameter has been removed from theNewObserver
function call. Ensure that the database path is handled properly in the updated implementation.zetaclient/chains/evm/observer/inbound_test.go (25)
44-44
: Ensure MockEVMObserver initialization is consistent.The
MockEVMObserver
is initialized multiple times withnil
parameters. Ensure that this initialization is consistent with the method's requirements.
60-60
: Ensure MockEVMObserver initialization is consistent.The
MockEVMObserver
is initialized multiple times withnil
parameters. Ensure that this initialization is consistent with the method's requirements.
76-76
: Ensure MockEVMObserver initialization is consistent.The
MockEVMObserver
is initialized multiple times withnil
parameters. Ensure that this initialization is consistent with the method's requirements.
128-128
: Ensure MockEVMObserver initialization is consistent.The
MockEVMObserver
is initialized multiple times withnil
parameters. Ensure that this initialization is consistent with the method's requirements.
144-144
: Ensure MockEVMObserver initialization is consistent.The
MockEVMObserver
is initialized multiple times withnil
parameters. Ensure that this initialization is consistent with the method's requirements.
160-160
: Ensure MockEVMObserver initialization is consistent.The
MockEVMObserver
is initialized multiple times withnil
parameters. Ensure that this initialization is consistent with the method's requirements.
212-212
: Ensure MockEVMObserver initialization is consistent.The
MockEVMObserver
is initialized multiple times withnil
parameters. Ensure that this initialization is consistent with the method's requirements.
222-222
: Ensure MockEVMObserver initialization is consistent.The
MockEVMObserver
is initialized multiple times withnil
parameters. Ensure that this initialization is consistent with the method's requirements.
232-232
: Ensure MockEVMObserver initialization is consistent.The
MockEVMObserver
is initialized multiple times withnil
parameters. Ensure that this initialization is consistent with the method's requirements.
243-243
: Ensure MockEVMObserver initialization is consistent.The
MockEVMObserver
is initialized multiple times withnil
parameters. Ensure that this initialization is consistent with the method's requirements.
254-254
: Ensure MockEVMObserver initialization is consistent.The
MockEVMObserver
is initialized multiple times withnil
parameters. Ensure that this initialization is consistent with the method's requirements.
271-271
: Ensure MockEVMObserver initialization is consistent.The
MockEVMObserver
is initialized withnil
parameters. Ensure that this initialization is consistent with the method's requirements.
288-288
: Ensure compliance configuration is loaded correctly.The compliance configuration is loaded within the test. Ensure that this configuration is correctly set up and does not affect other tests.
295-295
: Ensure compliance configuration is loaded correctly.The compliance configuration is loaded within the test. Ensure that this configuration is correctly set up and does not affect other tests.
302-302
: Ensure compliance configuration is loaded correctly.The compliance configuration is loaded within the test. Ensure that this configuration is correctly set up and does not affect other tests.
318-318
: Ensure MockEVMObserver initialization is consistent.The
MockEVMObserver
is initialized withnil
parameters. Ensure that this initialization is consistent with the method's requirements.
335-335
: Ensure compliance configuration is loaded correctly.The compliance configuration is loaded within the test. Ensure that this configuration is correctly set up and does not affect other tests.
342-342
: Ensure compliance configuration is loaded correctly.The compliance configuration is loaded within the test. Ensure that this configuration is correctly set up and does not affect other tests.
376-376
: Ensure MockEVMObserver initialization is consistent.The
MockEVMObserver
is initialized withnil
parameters. Ensure that this initialization is consistent with the method's requirements.
392-392
: Ensure compliance configuration is loaded correctly.The compliance configuration is loaded within the test. Ensure that this configuration is correctly set up and does not affect other tests.
406-406
: Ensure compliance configuration is loaded correctly.The compliance configuration is loaded within the test. Ensure that this configuration is correctly set up and does not affect other tests.
446-446
: Ensure MockEVMObserver initialization is consistent.The
MockEVMObserver
is initialized multiple times withnil
parameters. Ensure that this initialization is consistent with the method's requirements.
455-455
: Ensure MockEVMObserver initialization is consistent.The
MockEVMObserver
is initialized multiple times withnil
parameters. Ensure that this initialization is consistent with the method's requirements.
461-461
: Ensure MockEVMObserver initialization is consistent.The
MockEVMObserver
is initialized multiple times withnil
parameters. Ensure that this initialization is consistent with the method's requirements.
468-468
: Ensure MockEVMObserver initialization is consistent.The
MockEVMObserver
is initialized multiple times withnil
parameters. Ensure that this initialization is consistent with the method's requirements.zetaclient/chains/bitcoin/observer/observer.go (6)
Line range hint
1-1
: Ensure consistent error handling.Ensure that the error handling logic in
NewObserver
is consistent and follows best practices.
215-215
: Ensure consistent logging format.Ensure that the logging format is consistent across the method.
270-270
: Ensure proper resource cleanup.Ensure that the ticker is stopped and resources are cleaned up when the method exits.
Line range hint
1-1
: Ensure consistent error handling.Ensure that the error handling logic in
WatchGasPrice
is consistent and follows best practices.
434-434
: Ensure consistent logging format.Ensure that the logging format is consistent across the method.
Line range hint
1-1
: Ensure consistent error handling.Ensure that the error handling logic in
FetchUTXOs
is consistent and follows best practices.zetaclient/chains/evm/observer/outbound_test.go (6)
17-17
: Update import paths to use the compliance package.The import statements have been updated to use the
compliance
package instead ofconfig
.
62-62
: Update MockEVMObserver function call.The
MockEVMObserver
function call has been updated with new parameters to align with the updated function signature.
79-79
: Update MockEVMObserver function call.The
MockEVMObserver
function call has been updated with new parameters to align with the updated function signature.
87-87
: Update compliance configuration loading.The compliance configuration is now being loaded using the
compliance
package instead ofconfig
.
97-97
: Update MockEVMObserver function call.The
MockEVMObserver
function call has been updated with new parameters to align with the updated function signature.
105-105
: Update MockEVMObserver function call.The
MockEVMObserver
function call has been updated with new parameters to align with the updated function signature.zetaclient/chains/evm/signer/signer.go (2)
33-33
: Update import paths to use the compliance package.The import statements have been updated to use the
compliance
package instead ofconfig
.
Line range hint
830-843
: Update getEVMRPC function to accept chainID parameter.The
getEVMRPC
function has been updated to accept achainID
parameter, ensuring that the EVM client and signer are initialized with the correct chain ID.zetaclient/chains/evm/observer/inbound.go (4)
85-85
: Enhanced Logging for WatchInboundTrackerLogging the start of the tracker with chain ID improves traceability and debugging.
597-597
: Updated Compliance Check for Deposited EventThe compliance check has been updated to use the
compliance
package, enhancing modularity and maintainability.
657-657
: Updated Compliance Check for ZetaSent EventThe compliance check has been updated to use the
compliance
package, enhancing modularity and maintainability.
664-667
: Retrieve External Chain Parameters from AppContextThe function now retrieves external chain parameters from the
AppContext
, improving consistency and maintainability.changelog.md (1)
180-180
: LGTM!The added line documenting the new feature for runtime chain activation/deactivation is clear and correctly formatted.
There was a problem hiding this 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
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 returnnil
.
37-37
: LGTM!The
LoadDB
method is correctly mocked to returnnil
.
41-41
: LGTM!The
SaveLastBlockScanned
method is correctly mocked to returnnil
.
86-86
: LGTM!The
OpenDB
method is correctly mocked to returnnil
.
90-90
: LGTM!The
LoadDB
method is correctly mocked to returnnil
.
94-94
: LGTM!The
SaveLastBlockScanned
method is correctly mocked to returnnil
.zetaclient/zetacore/client.go (2)
53-53
: LGTM!The
CreateClient
function correctly initializes thekeys
andclient
.
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 theUpdateAppContext
method.
…hestrator-add-new-chain-at-runtime
There was a problem hiding this 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
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 { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this 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 forNewOrchestrator
.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 forSchedulePendingCctxs
.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 forScheduleCctxEVM
.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 forScheduleCctxBTC
.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
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.
There was a problem hiding this 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
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 newappContext
parameter.Also applies to: 45-45, 55-56
61-61
: LGTM!The
CreateTestAppContext
function correctly initializes theappContext
with the provided chain parameters.Also applies to: 74-92
97-117
: LGTM!The
Test_Stop
function correctly tests theStop
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 theGetUpdatedSigner
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 theGetUpdatedChainObserver
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 theGetPendingCctxsWithinRatelimit
method, ensuring it handles different rate limiter scenarios and fallback mechanisms.
…oint connection failure
There was a problem hiding this 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
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 forCreateSignerObserverBTC
.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 forCreateSignerObserverEVM
.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 thezetaclient/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 forWatchActivatedChains
.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
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 |
We can now close this one right @ws4charlie @swift1337 ? |
Description
zetaclient
initialization logics.AppContext
by consolidating[ZetacoreContext + AppContext] ==> AppContext
.ZetacoreContext
is removed.AppContext
.Closes: 1904
Closes: 1397
How Has This Been Tested?
Summary by CodeRabbit
New Features
AppContext
functionality.Bug Fixes
Refactor
Orchestrator
struct with new fields and methods.Tests
mockery
to versionv2.42.2
for various test utility packages.Chores