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: removed uncessary panics in zetaclientd process #2210

Merged
merged 9 commits into from
May 21, 2024

Conversation

ws4charlie
Copy link
Contributor

@ws4charlie ws4charlie commented May 17, 2024

Description

  1. Removed all panics in zetaclientd process, leaving the only one in start.go when zetaclientd fails to start telemetry server.
  2. Removed duplicate code in the ObserveInTx function of bitcoin.

Closes: 2024

Type of change

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

How Has This Been Tested?

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

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

Checklist:

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

Copy link

!!!WARNING!!!
nosec detected in the following files: zetaclient/chains/bitcoin/observer/inbound.go

Be very careful about using #nosec in code. It can be a quick way to suppress security warnings and move forward with development, it should be employed with caution. Suppressing warnings with #nosec can hide potentially serious vulnerabilities. Only use #nosec when you're absolutely certain that the security issue is either a false positive or has been mitigated in another way.

Only suppress a single rule (or a specific set of rules) within a section of code, while continuing to scan for other problems. To do this, you can list the rule(s) to be suppressed within the #nosec annotation, e.g: /* #nosec G401 */ or //#nosec G201 G202 G203
Broad #nosec annotations should be avoided, as they can hide other vulnerabilities. The CI will block you from merging this PR until you remove #nosec annotations that do not target specific rules.

Pay extra attention to the way #nosec is being used in the files listed above.

@github-actions github-actions bot added the nosec label May 17, 2024
@ws4charlie ws4charlie added zetaclient Issues related to ZetaClient codebase-quality Quality of the codebase and removed breaking:cli nosec labels May 18, 2024
Copy link

codecov bot commented May 18, 2024

Codecov Report

Attention: Patch coverage is 19.64286% with 45 lines in your changes are missing coverage. Please review.

Project coverage is 68.20%. Comparing base (ca15dc2) to head (f0c0bb9).

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #2210      +/-   ##
===========================================
+ Coverage    68.07%   68.20%   +0.12%     
===========================================
  Files          259      259              
  Lines        14982    14960      -22     
===========================================
+ Hits         10199    10203       +4     
+ Misses        4321     4298      -23     
+ Partials       462      459       -3     
Files Coverage Δ
zetaclient/chains/bitcoin/observer/inbound.go 16.37% <ø> (+1.68%) ⬆️
zetaclient/context/zetacore_context.go 86.29% <100.00%> (ø)
zetaclient/zetacore/broadcast.go 57.25% <100.00%> (ø)
zetaclient/zetacore/query.go 67.57% <100.00%> (+0.29%) ⬆️
zetaclient/chains/evm/observer/observer.go 32.67% <33.33%> (+0.08%) ⬆️
zetaclient/keys/keys.go 47.87% <20.00%> (+2.12%) ⬆️
zetaclient/chains/bitcoin/signer/signer.go 21.52% <0.00%> (-0.30%) ⬇️
zetaclient/supplychecker/zeta_supply_checker.go 0.00% <0.00%> (ø)
zetaclient/chains/bitcoin/observer/observer.go 14.95% <0.00%> (+0.25%) ⬆️
zetaclient/orchestrator/orchestrator.go 27.31% <0.00%> (-0.37%) ⬇️
... and 1 more

Copy link
Member

@lumtis lumtis left a comment

Choose a reason for hiding this comment

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

We have this test in zetacore_context:

		assertPanic(t, func() {
			zetaContext.GetBTCChainParams()
		}, "BTCChain is missing for chainID 0")

Can't this be removed now? Do we still get panic on wrong Bitcoin params ?

Copy link
Contributor

@skosito skosito left a comment

Choose a reason for hiding this comment

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

looks good, just some minor comments

@ws4charlie
Copy link
Contributor Author

We have this test in zetacore_context:

		assertPanic(t, func() {
			zetaContext.GetBTCChainParams()
		}, "BTCChain is missing for chainID 0")

Can't this be removed now? Do we still get panic on wrong Bitcoin params ?

removed in 4286a09

@gartnera gartnera merged commit 297baea into develop May 21, 2024
20 of 21 checks passed
@gartnera gartnera deleted the remove-zetaclient-panics branch May 21, 2024 04:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking:cli codebase-quality Quality of the codebase nosec zetaclient Issues related to ZetaClient
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Removing panic in zetaclient
4 participants