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

refactor(pkg/chains): deprecate ChainName field in Chain object #2541

Merged
merged 11 commits into from
Jul 26, 2024

Conversation

lumtis
Copy link
Member

@lumtis lumtis commented Jul 24, 2024

Description

Closes: #1407

  • Replace the enum type ChainName with a string Name defining the name of the chain
  • Make Name compatible with ChainName usage

Related: #2005 -- will allow adding new chain info entirely dynamically

Summary by CodeRabbit

  • New Features

    • Introduced a Name field for blockchain configurations, enhancing clarity and usability.
    • Updated API specifications to reflect deprecation of the ChainName field in favor of Name.
  • Bug Fixes

    • Improved validation logic to ensure all chains have a non-empty Name.
  • Documentation

    • Revised breaking changes documentation to reflect updates on ChainName deprecation and new naming conventions.
  • Tests

    • Added new tests for the Name field and updated existing tests to ensure consistency with new structures.
  • Chores

    • Removed outdated references to ChainName across various code files for better code quality and consistency.

Copy link
Contributor

coderabbitai bot commented Jul 24, 2024

Important

Review skipped

Auto incremental reviews are disabled on this repository.

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

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

Walkthrough

Walkthrough

The recent changes to the Chain object and related structures streamline the identification and representation of blockchain chains within the codebase. The ChainName enum has been deprecated in favor of a simpler Name field, enhancing code clarity and reducing complexity. This refactoring supports better consistency across the code while maintaining the unique identification provided by chainID.

Changes

Files Change Summary
changelog.md, docs/releases/v19_breaking_changes.md Deprecated ChainName field in favor of Name. Updated documentation to reflect changes in naming conventions.
pkg/chains/chain.go, pkg/chains/chain_test.go Removed validation for ChainName, added validation for non-empty Name. Updated tests to reflect new structure.
proto/zetachain/zetacore/pkg/chains/chains.proto Marked ChainName enum as deprecated, replaced with a string field name.
testutil/sample/sample.go Removed ChainName assignment, added random string assignment for Name.
zetaclient/* Changed instances of ChainName to Name across various functions and tests for consistency and clarity.

Assessment against linked issues

Objective Addressed Explanation
Consider simplifying or removing Chain object (1407)
Use unique chain ID to infer chain name instead of storing
Create a function getChainName(chainID int64) No implementation for this function exists in the changes.
Maintain clarity in chain identification

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

codecov bot commented Jul 24, 2024

Codecov Report

Attention: Patch coverage is 44.44444% with 25 lines in your changes missing coverage. Please review.

Project coverage is 46.63%. Comparing base (5cd5f5a) to head (052685d).

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #2541      +/-   ##
===========================================
- Coverage    46.65%   46.63%   -0.03%     
===========================================
  Files          464      464              
  Lines        30834    30843       +9     
===========================================
- Hits         14385    14383       -2     
- Misses       15595    15604       +9     
- Partials       854      856       +2     
Files Coverage Δ
pkg/chains/chain.go 94.00% <100.00%> (ø)
pkg/chains/chains.go 93.18% <ø> (ø)
x/crosschain/keeper/cctx_utils.go 100.00% <100.00%> (ø)
x/crosschain/migrations/v5/migrate.go 83.07% <100.00%> (ø)
zetaclient/chains/base/observer.go 85.71% <100.00%> (ø)
zetaclient/context/app.go 85.00% <0.00%> (ø)
zetaclient/metrics/telemetry.go 0.00% <0.00%> (ø)
zetaclient/orchestrator/orchestrator.go 24.37% <0.00%> (ø)
zetaclient/chains/evm/observer/inbound.go 37.14% <0.00%> (ø)
zetaclient/chains/bitcoin/signer/signer.go 17.57% <0.00%> (ø)
... and 2 more

@lumtis lumtis marked this pull request as ready for review July 24, 2024 13:14
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: 7

Outside diff range, codebase verification and nitpick comments (3)
zetaclient/chains/bitcoin/signer/signer.go (3)

444-444: Add test coverage for this log statement.

The log statement referencing chain.Name in the TryProcessOutbound function of the Bitcoin signer is not covered by tests. Ensure this scenario is tested to maintain comprehensive test coverage.

  • File: zetaclient/chains/bitcoin/signer/signer.go
  • Function: TryProcessOutbound
Analysis chain

Add test coverage for this log statement.

The log statement referencing chain.Name is not covered by tests. Ensure this scenario is tested to maintain comprehensive test coverage.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify test coverage for the log statement.

# Test: Search for test cases covering `TryProcessOutbound` function. Expect: Test cases covering the log statement.
rg --type go -A 10 'TryProcessOutbound'

Length of output: 11166


Script:

#!/bin/bash
# Description: Verify test coverage for the TryProcessOutbound function in the Bitcoin signer.

# Test: Search for test cases covering the TryProcessOutbound function in the Bitcoin signer.
rg --type go -A 10 'TryProcessOutbound' | rg 'zetaclient/chains/bitcoin/signer/signer.go'

Length of output: 3556

Tools
GitHub Check: codecov/patch

[warning] 444-444: zetaclient/chains/bitcoin/signer/signer.go#L444
Added line #L444 was not covered by tests


432-432: Add test coverage for the Bitcoin signer's TryProcessOutbound function.

The log statement referencing chain.Name in the TryProcessOutbound function of the Bitcoin signer is not covered by tests. Ensure this scenario is tested to maintain comprehensive test coverage.

  • File: zetaclient/chains/bitcoin/signer/signer.go
  • Line: 432
Analysis chain

Add test coverage for this log statement.

The log statement referencing chain.Name is not covered by tests. Ensure this scenario is tested to maintain comprehensive test coverage.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify test coverage for the log statement.

# Test: Search for test cases covering `TryProcessOutbound` function. Expect: Test cases covering the log statement.
rg --type go -A 10 'TryProcessOutbound'

Length of output: 11166


Script:

#!/bin/bash
# Description: Verify test coverage for the log statement in Bitcoin signer.

# Test: Search for test files related to Bitcoin signer.
fd --type f --name '*signer_test.go' | grep 'bitcoin'

Length of output: 304


Script:

#!/bin/bash
# Description: Verify test coverage for the log statement in Bitcoin signer.

# Test: Search for test files related to Bitcoin signer.
fd --type f --glob '*bitcoin*signer_test.go'

Length of output: 46


Script:

#!/bin/bash
# Description: Verify test coverage for the log statement in Bitcoin signer.

# Test: Search for references to the Bitcoin signer's TryProcessOutbound function in test files.
rg --type go 'TryProcessOutbound' --glob '*_test.go'

Length of output: 277

Tools
GitHub Check: codecov/patch

[warning] 432-432: zetaclient/chains/bitcoin/signer/signer.go#L432
Added line #L432 was not covered by tests


471-471: Add test coverage for the log statement.

The log statement referencing chain.Name in the TryProcessOutbound function within zetaclient/chains/bitcoin/signer/signer.go is not covered by any tests. Ensure this scenario is tested to maintain comprehensive test coverage.

  • File: zetaclient/chains/bitcoin/signer/signer.go
  • Line: 471
  • Log Statement: Msgf("Unable to add to tracker on zetacore: nonce %d chain %s outboundHash %s", outboundTssNonce, chain.Name, outboundHash)

Please add appropriate test cases to cover this log statement.

Analysis chain

Add test coverage for this log statement.

The log statement referencing chain.Name is not covered by tests. Ensure this scenario is tested to maintain comprehensive test coverage.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify test coverage for the log statement.

# Test: Search for test cases covering `TryProcessOutbound` function. Expect: Test cases covering the log statement.
rg --type go -A 10 'TryProcessOutbound'

Length of output: 11166


Script:

#!/bin/bash
# Search for test files related to the Bitcoin signer
fd --type f --name '*signer_test.go' | xargs rg --type go -A 10 'chain.Name'

Length of output: 15995


Script:

#!/bin/bash
# Search for test files specifically in the zetaclient/chains/bitcoin/signer directory
fd --type f --name '*_test.go' zetaclient/chains/bitcoin/signer | xargs rg --type go 'TryProcessOutbound'

Length of output: 2139


Script:

#!/bin/bash
# Corrected script to search for test files specifically in the zetaclient/chains/bitcoin/signer directory
fd . --type f -e go | grep 'signer_test.go' | xargs rg --type go 'TryProcessOutbound'

Length of output: 308

Tools
GitHub Check: codecov/patch

[warning] 471-471: zetaclient/chains/bitcoin/signer/signer.go#L471
Added line #L471 was 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 5c39726 and 35fc312.

Files ignored due to path filters (2)
  • pkg/chains/chains.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • typescript/zetachain/zetacore/pkg/chains/chains_pb.d.ts is excluded by !**/*_pb.d.ts
Files selected for processing (32)
  • changelog.md (1 hunks)
  • docs/openapi/openapi.swagger.yaml (3 hunks)
  • docs/releases/v19_breaking_changes.md (2 hunks)
  • docs/releases/v19_observer_migration.md (1 hunks)
  • pkg/chains/chain.go (3 hunks)
  • pkg/chains/chain_test.go (8 hunks)
  • pkg/chains/chains.go (23 hunks)
  • pkg/chains/chains_test.go (1 hunks)
  • proto/zetachain/zetacore/pkg/chains/chains.proto (3 hunks)
  • testutil/keeper/crosschain.go (2 hunks)
  • testutil/sample/sample.go (1 hunks)
  • testutil/testdata/types/chain_info.json (1 hunks)
  • x/authority/client/cli/tx_update_chain_info_test.go (1 hunks)
  • x/authority/types/chain_info_test.go (2 hunks)
  • x/authority/types/genesis_test.go (1 hunks)
  • x/authority/types/message_update_chain_info_test.go (1 hunks)
  • x/crosschain/keeper/cctx_utils.go (2 hunks)
  • x/crosschain/keeper/cctx_utils_test.go (5 hunks)
  • x/crosschain/keeper/msg_server_update_tss_test.go (6 hunks)
  • x/crosschain/migrations/v5/migrate.go (1 hunks)
  • x/fungible/keeper/grpc_query_gas_stability_pool_test.go (2 hunks)
  • zetaclient/chains/base/observer.go (1 hunks)
  • zetaclient/chains/bitcoin/observer/inbound.go (1 hunks)
  • zetaclient/chains/bitcoin/signer/signer.go (4 hunks)
  • zetaclient/chains/evm/observer/inbound.go (3 hunks)
  • zetaclient/context/app.go (1 hunks)
  • zetaclient/context/app_test.go (3 hunks)
  • zetaclient/metrics/telemetry.go (1 hunks)
  • zetaclient/orchestrator/bootstrap.go (5 hunks)
  • zetaclient/orchestrator/orchestrator.go (1 hunks)
  • zetaclient/zetacore/client_query_test.go (1 hunks)
  • zetaclient/zetacore/tx_test.go (1 hunks)
Files skipped from review due to trivial changes (9)
  • docs/releases/v19_observer_migration.md
  • testutil/keeper/crosschain.go
  • x/crosschain/keeper/cctx_utils.go
  • x/crosschain/keeper/cctx_utils_test.go
  • x/crosschain/keeper/msg_server_update_tss_test.go
  • x/crosschain/migrations/v5/migrate.go
  • x/fungible/keeper/grpc_query_gas_stability_pool_test.go
  • zetaclient/chains/base/observer.go
  • zetaclient/context/app_test.go
Additional context used
Path-based instructions (19)
x/authority/client/cli/tx_update_chain_info_test.go (1)

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

x/authority/types/genesis_test.go (1)

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

x/authority/types/chain_info_test.go (1)

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

x/authority/types/message_update_chain_info_test.go (1)

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

proto/zetachain/zetacore/pkg/chains/chains.proto (1)

Pattern **/*.proto: Review the Protobuf definitions, point out issues relative to compatibility, and expressiveness.

pkg/chains/chain.go (1)

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

zetaclient/metrics/telemetry.go (1)

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

pkg/chains/chains_test.go (1)

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

zetaclient/context/app.go (1)

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

zetaclient/orchestrator/bootstrap.go (1)

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

pkg/chains/chain_test.go (1)

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

pkg/chains/chains.go (1)

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

zetaclient/chains/bitcoin/signer/signer.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/zetacore/tx_test.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.

testutil/sample/sample.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.

zetaclient/zetacore/client_query_test.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/metrics/telemetry.go

[warning] 92-92: zetaclient/metrics/telemetry.go#L92
Added line #L92 was not covered by tests

zetaclient/context/app.go

[warning] 339-339: zetaclient/context/app.go#L339
Added line #L339 was not covered by tests

zetaclient/orchestrator/bootstrap.go

[warning] 235-236: zetaclient/orchestrator/bootstrap.go#L235-L236
Added lines #L235 - L236 were not covered by tests


[warning] 265-265: zetaclient/orchestrator/bootstrap.go#L265
Added line #L265 was not covered by tests


[warning] 360-361: zetaclient/orchestrator/bootstrap.go#L360-L361
Added lines #L360 - L361 were not covered by tests


[warning] 390-390: zetaclient/orchestrator/bootstrap.go#L390
Added line #L390 was not covered by tests

zetaclient/chains/bitcoin/signer/signer.go

[warning] 432-432: zetaclient/chains/bitcoin/signer/signer.go#L432
Added line #L432 was not covered by tests


[warning] 444-444: zetaclient/chains/bitcoin/signer/signer.go#L444
Added line #L444 was not covered by tests


[warning] 454-454: zetaclient/chains/bitcoin/signer/signer.go#L454
Added line #L454 was not covered by tests


[warning] 471-471: zetaclient/chains/bitcoin/signer/signer.go#L471
Added line #L471 was not covered by tests

zetaclient/chains/bitcoin/observer/inbound.go

[warning] 242-242: zetaclient/chains/bitcoin/observer/inbound.go#L242
Added line #L242 was not covered by tests

zetaclient/orchestrator/orchestrator.go

[warning] 353-353: zetaclient/orchestrator/orchestrator.go#L353
Added line #L353 was not covered by tests

zetaclient/chains/evm/observer/inbound.go

[warning] 185-185: zetaclient/chains/evm/observer/inbound.go#L185
Added line #L185 was not covered by tests


[warning] 295-295: zetaclient/chains/evm/observer/inbound.go#L295
Added line #L295 was not covered by tests


[warning] 376-376: zetaclient/chains/evm/observer/inbound.go#L376
Added line #L376 was not covered by tests

Additional comments not posted (59)
docs/openapi/openapi.swagger.yaml (2)

Line range hint 10-10:
Deprecation Notice for chain_name.

The deprecation notice for chain_name is clear and correctly indicates that it has been replaced by name.


Line range hint 11-11:
Addition of name Field.

The new name field is correctly defined as a string and provides a clear description.

testutil/testdata/types/chain_info.json (2)

10-11: Addition of name Field for Chain ID 42.

The name field for the chain with chain_id 42 is correctly added and provides a descriptive name "foo".


20-21: Addition of name Field for Chain ID 84.

The name field for the chain with chain_id 84 is correctly added and provides a descriptive name "bar".

x/authority/client/cli/tx_update_chain_info_test.go (2)

28-28: Update Test Case for Chain ID 42.

The test case for the chain with chain_id 42 correctly reflects the updated structure with the Name field.


38-38: Update Test Case for Chain ID 84.

The test case for the chain with chain_id 84 correctly reflects the updated structure with the Name field.

x/authority/types/genesis_test.go (1)

62-62: Ensure consistency with the new Name field.

The change from ChainName to Name appears correct. Ensure that all references to ChainName are updated throughout the codebase to maintain consistency.

x/authority/types/chain_info_test.go (2)

45-45: Ensure consistency with the new Name field.

The change from ChainName to Name appears correct. Ensure that all references to ChainName are updated throughout the codebase to maintain consistency.


62-62: Ensure consistency with the new Name field.

The change from ChainName to Name appears correct. Ensure that all references to ChainName are updated throughout the codebase to maintain consistency.

x/authority/types/message_update_chain_info_test.go (1)

40-40: Ensure consistency with the new Name field.

The change from ChainName to Name appears correct. Ensure that all references to ChainName are updated throughout the codebase to maintain consistency.

proto/zetachain/zetacore/pkg/chains/chains.proto (2)

21-21: Deprecation annotation is appropriate.

The deprecation of the ChainName enum is correctly annotated, guiding users to transition to the new name field.


119-120: Deprecation annotation and new field addition are appropriate.

The deprecation of the chain_name field and the addition of the name field in the Chain message are correctly implemented. This aligns with the objective of simplifying the Chain object.

Also applies to: 140-141

docs/releases/v19_breaking_changes.md (3)

2-2: Versioning header update is appropriate.

The header update from "V17 Breaking Changes" to "V19 Breaking Changes" accurately reflects the new version.


65-65: Renaming enhances consistency.

The renaming of MsgAddBlameVote to MsgVoteBlame aligns with the naming conventions of other voting-related messages, enhancing consistency.


66-68: Deprecation notice is clear and appropriate.

The deprecation notice for Chain.ChainName is clear and guides developers to transition to the Chain.Name field.

pkg/chains/chain.go (1)

35-37: Validation changes are appropriate.

The removal of the ChainName enum check and the addition of a check for the Name field in the Validate method are appropriate. These changes enhance validation robustness.

pkg/chains/chains_test.go (1)

11-17: Good addition!

The new test function TestChain_Name effectively ensures the consistency between the Name field and the ChainName enum.

zetaclient/orchestrator/bootstrap.go (4)

231-237: Ensure proper error handling for missing chain information.

The introduction of chains.GetChainFromChainID improves robustness by checking for valid chain data. Ensure that this pattern is consistently applied across the codebase to prevent potential runtime errors.

Tools
GitHub Check: codecov/patch

[warning] 235-236: zetaclient/orchestrator/bootstrap.go#L235-L236
Added lines #L235 - L236 were not covered by tests


355-362: Ensure proper error handling for missing chain information.

The introduction of chains.GetChainFromChainID improves robustness by checking for valid chain data. Ensure that this pattern is consistently applied across the codebase to prevent potential runtime errors.

Tools
GitHub Check: codecov/patch

[warning] 360-361: zetaclient/orchestrator/bootstrap.go#L360-L361
Added lines #L360 - L361 were not covered by tests


388-390: Add test coverage for database initialization errors.

The error handling for database initialization is crucial. Ensure this scenario is covered by tests to maintain robustness.

Tools
GitHub Check: codecov/patch

[warning] 390-390: zetaclient/orchestrator/bootstrap.go#L390
Added line #L390 was not covered by tests


263-265: Add test coverage for database initialization errors.

The error handling for database initialization is crucial. Ensure this scenario is covered by tests to maintain robustness.

Tools
GitHub Check: codecov/patch

[warning] 265-265: zetaclient/orchestrator/bootstrap.go#L265
Added line #L265 was not covered by tests

pkg/chains/chain_test.go (9)

24-24: Ensure consistency in naming conventions.

The replacement of ChainName with a direct string assignment to the Name field simplifies the structure. Ensure this pattern is consistently applied across all test cases.


36-36: Ensure consistency in naming conventions.

The replacement of ChainName with a direct string assignment to the Name field simplifies the structure. Ensure this pattern is consistently applied across all test cases.


49-49: Ensure consistency in naming conventions.

The replacement of ChainName with a direct string assignment to the Name field simplifies the structure. Ensure this pattern is consistently applied across all test cases.


59-62: Clarify error messages for better readability.

The updated error message specifies that the error occurs when the chain name is empty, enhancing the specificity and readability of the test outputs.


75-75: Ensure consistency in naming conventions.

The replacement of ChainName with a direct string assignment to the Name field simplifies the structure. Ensure this pattern is consistently applied across all test cases.


88-88: Ensure consistency in naming conventions.

The replacement of ChainName with a direct string assignment to the Name field simplifies the structure. Ensure this pattern is consistently applied across all test cases.


101-101: Ensure consistency in naming conventions.

The replacement of ChainName with a direct string assignment to the Name field simplifies the structure. Ensure this pattern is consistently applied across all test cases.


114-114: Ensure consistency in naming conventions.

The replacement of ChainName with a direct string assignment to the Name field simplifies the structure. Ensure this pattern is consistently applied across all test cases.


194-194: Ensure consistency in naming conventions.

The replacement of ChainName with a direct string assignment to the Name field simplifies the structure. Ensure this pattern is consistently applied across all test cases.

pkg/chains/chains.go (17)

20-20: LGTM! Ensure consistency in naming conventions.

The addition of the Name field to the ZetaChainMainnet configuration enhances clarity. Ensure this pattern is consistently applied across all network configurations.


33-33: LGTM! Ensure consistency in naming conventions.

The addition of the Name field to the Ethereum configuration enhances clarity. Ensure this pattern is consistently applied across all network configurations.


46-46: LGTM! Ensure consistency in naming conventions.

The addition of the Name field to the BscMainnet configuration enhances clarity. Ensure this pattern is consistently applied across all network configurations.


59-59: LGTM! Ensure consistency in naming conventions.

The addition of the Name field to the BitcoinMainnet configuration enhances clarity. Ensure this pattern is consistently applied across all network configurations.


72-72: LGTM! Ensure consistency in naming conventions.

The addition of the Name field to the Polygon configuration enhances clarity. Ensure this pattern is consistently applied across all network configurations.


85-85: LGTM! Ensure consistency in naming conventions.

The addition of the Name field to the OptimismMainnet configuration enhances clarity. Ensure this pattern is consistently applied across all network configurations.


98-98: LGTM! Ensure consistency in naming conventions.

The addition of the Name field to the BaseMainnet configuration enhances clarity. Ensure this pattern is consistently applied across all network configurations.


113-113: LGTM! Ensure consistency in naming conventions.

The addition of the Name field to the SolanaMainnet configuration enhances clarity. Ensure this pattern is consistently applied across all network configurations.


130-130: LGTM! Ensure consistency in naming conventions.

The addition of the Name field to the ZetaChainTestnet configuration enhances clarity. Ensure this pattern is consistently applied across all network configurations.


143-143: LGTM! Ensure consistency in naming conventions.

The addition of the Name field to the Sepolia configuration enhances clarity. Ensure this pattern is consistently applied across all network configurations.


156-156: LGTM! Ensure consistency in naming conventions.

The addition of the Name field to the BscTestnet configuration enhances clarity. Ensure this pattern is consistently applied across all network configurations.


169-169: LGTM! Ensure consistency in naming conventions.

The addition of the Name field to the BitcoinTestnet configuration enhances clarity. Ensure this pattern is consistently applied across all network configurations.


182-182: LGTM! Ensure consistency in naming conventions.

The addition of the Name field to the Amoy configuration enhances clarity. Ensure this pattern is consistently applied across all network configurations.


195-195: LGTM! Ensure consistency in naming conventions.

The addition of the Name field to the OptimismSepolia configuration enhances clarity. Ensure this pattern is consistently applied across all network configurations.


208-208: LGTM! Ensure consistency in naming conventions.

The addition of the Name field to the BaseSepolia configuration enhances clarity. Ensure this pattern is consistently applied across all network configurations.


225-225: LGTM! Ensure consistency in naming conventions.

The addition of the Name field to the SolanaDevnet configuration enhances clarity. Ensure this pattern is consistently applied across all network configurations.


243-243: LGTM! Ensure consistency in naming conventions.

The addition of the Name field to the ZetaChainDevnet configuration enhances clarity. Ensure this pattern is consistently applied across all network configurations.

zetaclient/chains/bitcoin/signer/signer.go (1)

454-454: Add test coverage for this log statement.

The log statement referencing chain.Name is not covered by tests. Ensure this scenario is tested to maintain comprehensive test coverage.

Tools
GitHub Check: codecov/patch

[warning] 454-454: zetaclient/chains/bitcoin/signer/signer.go#L454
Added line #L454 was not covered by tests

zetaclient/chains/bitcoin/observer/inbound.go (1)

242-242: Add test coverage for this log statement.

The log statement referencing ob.Chain().Name is not covered by tests. Ensure this scenario is tested to maintain comprehensive test coverage.

Tools
GitHub Check: codecov/patch

[warning] 242-242: zetaclient/chains/bitcoin/observer/inbound.go#L242
Added line #L242 was not covered by tests

zetaclient/zetacore/tx_test.go (2)

287-294: Initialization of Chain objects is clear and correct.

The use of named field initialization enhances readability and maintainability.


297-304: Initialization of Chain objects is clear and correct.

The use of named field initialization enhances readability and maintainability.

zetaclient/orchestrator/orchestrator.go (1)

353-353: Verify the function usage in the codebase.

The code changes are approved.

However, ensure that all function calls to c.Name match the new field and are correctly updated throughout the codebase.

Tools
GitHub Check: codecov/patch

[warning] 353-353: zetaclient/orchestrator/orchestrator.go#L353
Added line #L353 was not covered by tests

testutil/sample/sample.go (1)

136-136: Verify the function usage in the codebase.

The code changes are approved.

However, ensure that all function calls to Chain match the new field and are correctly updated throughout the codebase.

zetaclient/chains/evm/observer/inbound.go (3)

295-295: Verify the function usage in the codebase.

The code changes are approved.

However, ensure that all function calls to ob.Chain().Name match the new field and are correctly updated throughout the codebase.

Tools
GitHub Check: codecov/patch

[warning] 295-295: zetaclient/chains/evm/observer/inbound.go#L295
Added line #L295 was not covered by tests


185-185: Verify the function usage in the codebase.

The code changes are approved.

However, ensure that all function calls to ob.Chain().Name match the new field and are correctly updated throughout the codebase.

Tools
GitHub Check: codecov/patch

[warning] 185-185: zetaclient/chains/evm/observer/inbound.go#L185
Added line #L185 was not covered by tests


376-376: Verify the function usage in the codebase.

The code changes are approved.

However, ensure that all function calls to ob.Chain().Name match the new field and are correctly updated throughout the codebase.

Tools
GitHub Check: codecov/patch

[warning] 376-376: zetaclient/chains/evm/observer/inbound.go#L376
Added line #L376 was not covered by tests

zetaclient/zetacore/client_query_test.go (2)

875-875: Update test expectations to match new schema.

The change correctly updates the expected output to replace ChainName with Name.


884-884: Update test expectations to match new schema.

The change correctly updates the expected output to replace ChainName with Name.

changelog.md (1)

67-67: Changelog entry correctly documents the deprecation.

The entry accurately reflects the changes made in the PR.

Copy link
Contributor

@swift1337 swift1337 left a comment

Choose a reason for hiding this comment

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

Left some comments

@lumtis lumtis requested a review from swift1337 July 24, 2024 14:39
@lumtis lumtis enabled auto-merge July 25, 2024 20:16
@lumtis lumtis added this pull request to the merge queue Jul 26, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jul 26, 2024
@lumtis lumtis added this pull request to the merge queue Jul 26, 2024
Merged via the queue into develop with commit 545896d Jul 26, 2024
27 of 28 checks passed
@lumtis lumtis deleted the refactor/deprecate-chain-name-2 branch July 26, 2024 09:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Consider simplifying or removing Chain object
4 participants