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(zetaclient)!: remove hsm signer #3118

Merged
merged 3 commits into from
Nov 6, 2024
Merged

Conversation

gartnera
Copy link
Member

@gartnera gartnera commented Nov 6, 2024

Description

Remove zetaclient hsm signer mode as it is not used by any of the observer signers.

Closes #3111

How Has This Been Tested?

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

Summary by CodeRabbit

Release Notes

  • New Features

    • Simplified client initialization by removing the HSM-related parameters and configurations.
    • Streamlined transaction signing process by eliminating HSM dependency.
  • Bug Fixes

    • Improved error handling in transaction broadcasting.
  • Chores

    • Restructured dependencies in the project, updating the Go toolchain and removing unused libraries.
  • Documentation

    • Updated comments and documentation to reflect changes in client initialization and transaction signing processes.

@gartnera gartnera added the UPGRADE_LIGHT_TESTS Run make start-upgrade-test-light label Nov 6, 2024
Copy link
Contributor

coderabbitai bot commented Nov 6, 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
📝 Walkthrough
📝 Walkthrough

Walkthrough

The pull request implements significant changes by removing all references to Hardware Security Module (HSM) functionality across multiple files. This includes the deletion of HSM-related commands, parameters, and configurations in the Makefile, cmd/zetaclientd, and zetaclient directories. The modifications streamline the codebase by eliminating unnecessary complexity associated with HSM, thereby focusing on other functionalities without the overhead of HSM dependencies.

Changes

File Path Change Summary
Makefile Removed test-hsm target and HSM_BUILD_FLAGS variable.
cmd/zetaclientd/debug.go Removed boolean parameter from zetacore.NewClient instantiation.
cmd/zetaclientd/hsm.go Deleted file containing HSM command functionalities and related types.
cmd/zetaclientd/init.go Removed HsmMode and HsmHotKey fields from initArguments struct and command flags.
cmd/zetaclientd/utils.go Removed conditional check for cfg.HsmMode in CreateZetacoreClient function.
go.mod Removed dependencies on crypto11 and keystone, added new dependencies, and updated Go toolchain.
zetaclient/config/types.go Removed HsmMode and HsmHotKey fields from ClientConfiguration and Config structs.
zetaclient/hsm/hsm_signer.go Deleted file containing HSM signing functions.
zetaclient/hsm/hsm_signer_test.go Deleted file containing tests for HSM signing functionalities.
zetaclient/zetacore/broadcast.go Removed HSM signing logic from SignTx method.
zetaclient/zetacore/client.go Removed hsmMode parameter from NewClient function.
zetaclient/zetacore/client_test.go Updated setupZetacoreClient to remove boolean parameter in NewClient call.

Assessment against linked issues

Objective Addressed Explanation
Drop support for HSM (#3111)

Possibly related PRs

Suggested labels

breaking:cli, nosec, no-changelog

Suggested reviewers

  • fbac
  • kingpinXD
  • skosito
  • lumtis
  • brewmaster012
  • swift1337

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>, please review it.
    • 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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @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 using 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.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

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

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (1)
go.mod (1)

Line range hint 3-5: Fix Go toolchain version inconsistency.

The module declaration specifies go 1.22.7 but the toolchain directive specifies go1.22.8. This inconsistency should be resolved.

Apply this diff to align the versions:

-go 1.22.7
+go 1.22.8

toolchain go1.22.8
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between a1fe36d and 0081a4c.

⛔ Files ignored due to path filters (1)
  • go.sum is excluded by !**/*.sum
📒 Files selected for processing (12)
  • Makefile (0 hunks)
  • cmd/zetaclientd/debug.go (0 hunks)
  • cmd/zetaclientd/hsm.go (0 hunks)
  • cmd/zetaclientd/init.go (0 hunks)
  • cmd/zetaclientd/utils.go (1 hunks)
  • go.mod (1 hunks)
  • zetaclient/config/types.go (0 hunks)
  • zetaclient/hsm/hsm_signer.go (0 hunks)
  • zetaclient/hsm/hsm_signer_test.go (0 hunks)
  • zetaclient/zetacore/broadcast.go (0 hunks)
  • zetaclient/zetacore/client.go (0 hunks)
  • zetaclient/zetacore/client_test.go (0 hunks)
💤 Files with no reviewable changes (10)
  • Makefile
  • cmd/zetaclientd/debug.go
  • cmd/zetaclientd/hsm.go
  • cmd/zetaclientd/init.go
  • zetaclient/config/types.go
  • zetaclient/hsm/hsm_signer.go
  • zetaclient/hsm/hsm_signer_test.go
  • zetaclient/zetacore/broadcast.go
  • zetaclient/zetacore/client.go
  • zetaclient/zetacore/client_test.go
🧰 Additional context used
📓 Path-based instructions (1)
cmd/zetaclientd/utils.go (1)

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

🔇 Additional comments (3)
cmd/zetaclientd/utils.go (2)

34-34: LGTM! Changes align with HSM removal objective.

The simplified client initialization without HSM mode parameter is consistent with the PR's goal of removing HSM support.


34-34: Verify complete removal of HSM references.

Let's ensure all HSM-related code has been consistently removed across the codebase.

✅ Verification successful

HSM references have been successfully removed from the codebase

Our comprehensive analysis shows no remaining traces of HSM-related code, including imports, struct definitions, configuration fields, function parameters, variables, or comments. The codebase appears to be clean of any HSM references.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Search for any remaining HSM references in the codebase
# Expect: No matches as HSM support should be completely removed

echo "Searching for HSM-related code..."
rg -i "hsm" --type go

echo "Searching for Hardware Security Module references..."
rg -i "hardware.?security.?module" --type go

echo "Checking for any remaining HSM-related configuration..."
rg -i "hsmmode|hsmhotkey" --type go

Length of output: 419


Script:

#!/bin/bash
# Let's try a more comprehensive search for HSM-related code
# Search for specific HSM-related terms and patterns

# Search for any HSM-related imports
echo "Checking for HSM-related imports..."
rg -i "import.*hsm" --type go -A 5

# Search for HSM-related struct fields and type definitions
echo "Checking for HSM-related structs and types..."
ast-grep --pattern 'type $_ struct {
  $$$
  HSM$_
  $$$
}'

# Search for HSM-related configuration fields
echo "Checking for HSM configuration..."
rg -i "hsm.*=|hsm.*:" --type go

# Search for HSM-related function parameters and variables
echo "Checking for HSM-related functions and variables..."
ast-grep --pattern 'func $_($_ HSM$_)'

# Check for any remaining HSM-related comments
echo "Checking for HSM-related comments..."
rg -i "//.*hsm|/\*.*hsm" --type go

Length of output: 665

go.mod (1)

336-344: LGTM: Dependencies align with project objectives.

The changes appropriately remove HSM-related dependencies while adding necessary new ones. The modifications align well with the PR objective of removing HSM signer mode.

Copy link

codecov bot commented Nov 6, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 63.54%. Comparing base (a1fe36d) to head (775c1f5).
Report is 1 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #3118      +/-   ##
===========================================
+ Coverage    63.30%   63.54%   +0.24%     
===========================================
  Files          422      421       -1     
  Lines        29954    29838     -116     
===========================================
- Hits         18963    18962       -1     
+ Misses       10150    10036     -114     
+ Partials       841      840       -1     
Files with missing lines Coverage Δ
zetaclient/config/types.go 50.00% <ø> (ø)
zetaclient/zetacore/broadcast.go 58.82% <100.00%> (+1.44%) ⬆️
zetaclient/zetacore/client.go 52.80% <ø> (-0.19%) ⬇️

@gartnera gartnera force-pushed the remove-zetaclient-hsm branch from 0081a4c to ca4d250 Compare November 6, 2024 17:44
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.

LGTM

@swift1337
Copy link
Contributor

@gartnera shouldn't we regenerate cli docs?

@gartnera
Copy link
Member Author

gartnera commented Nov 6, 2024

shouldn't we regenerate cli docs?

I don't think we generate zetaclient cli docs do we? Only zetacored?

swift1337 added a commit that referenced this pull request Nov 6, 2024
@gartnera gartnera enabled auto-merge November 6, 2024 22:31
@gartnera gartnera added this pull request to the merge queue Nov 6, 2024
Merged via the queue into develop with commit 38fea4a Nov 6, 2024
39 checks passed
@gartnera gartnera deleted the remove-zetaclient-hsm branch November 6, 2024 23:08
github-merge-queue bot pushed a commit that referenced this pull request Nov 7, 2024
* Consolidate files and logic within zetaclientd cli

* Update `init` command

* Consolidate TSS commands

* Drop HSM cli (#3118)

* Move p2p diagnostic to tss package

* Refactor relayer commands

* Rename init config

* Restructure inbound cmd

* Update changelog

* Drop p2p diagnostics

* lint & pr comments [1]

* Address pr comments [2]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking:cli UPGRADE_LIGHT_TESTS Run make start-upgrade-test-light
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Drop support for HSM
3 participants