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: simply the IsSendOutTxProcessed func #1989

Merged
merged 10 commits into from
Apr 16, 2024

Conversation

ws4charlie
Copy link
Contributor

@ws4charlie ws4charlie commented Apr 5, 2024

Description

  1. Reorganize and simplified the EVM IsSendOutTxProcessed method by splitting into smaller/meaningful sub functions, removing duplicate logics.
  2. Added unit tests against each split sub function.

Closes: 1534

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

codecov bot commented Apr 5, 2024

Codecov Report

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

Project coverage is 70.00%. Comparing base (58a1b23) to head (f9cb534).

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #1989      +/-   ##
===========================================
+ Coverage    68.54%   70.00%   +1.45%     
===========================================
  Files          236      237       +1     
  Lines        13620    13502     -118     
===========================================
+ Hits          9336     9452     +116     
+ Misses        3834     3598     -236     
- Partials       450      452       +2     
Files Coverage Δ
zetaclient/zetabridge/zetacore_bridge.go 38.66% <100.00%> (-0.41%) ⬇️
zetaclient/evm/inbounds.go 69.32% <85.71%> (ø)
zetaclient/evm/outbound_transaction_data.go 69.33% <50.00%> (ø)
zetaclient/zetabridge/tx.go 52.42% <33.33%> (-0.24%) ⬇️
zetaclient/evm/outbounds.go 96.85% <96.85%> (ø)
zetaclient/zetacore_observer.go 17.91% <0.00%> (ø)
zetaclient/bitcoin/bitcoin_client.go 23.07% <0.00%> (ø)
zetaclient/evm/evm_client.go 20.09% <22.22%> (+5.01%) ⬆️

@ws4charlie ws4charlie marked this pull request as ready for review April 10, 2024 22:15
zetaclient/bitcoin/bitcoin_client.go Outdated Show resolved Hide resolved
zetaclient/evm/evm_client.go Show resolved Hide resolved
zetaclient/evm/inbounds.go Show resolved Hide resolved
zetaclient/testdata/cctx/cctx_1337_14.json Outdated Show resolved Hide resolved
zetaclient/evm/outbounds.go Outdated Show resolved Hide resolved
zetaclient/evm/outbounds.go Outdated Show resolved Hide resolved
zetaclient/evm/outbounds.go Outdated Show resolved Hide resolved
zetaclient/evm/outbounds.go Show resolved Hide resolved
zetaclient/evm/outbounds.go Show resolved Hide resolved
Copy link

!!!WARNING!!!
nosec detected in the following files: zetaclient/evm/evm_client.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 Apr 11, 2024
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.

Looks good to me @kevinssgh can you check sometimes?

Copy link
Contributor

@kevinssgh kevinssgh left a comment

Choose a reason for hiding this comment

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

Looks pretty good, left some comments.

zetaclient/evm/outbounds.go Show resolved Hide resolved
zetaclient/evm/outbounds.go Show resolved Hide resolved
zetaclient/evm/outbounds.go Show resolved Hide resolved
@lumtis lumtis merged commit 62ec009 into develop Apr 16, 2024
21 checks passed
@lumtis lumtis deleted the simplified-evm-IsSendOutTxProcessed branch April 16, 2024 11:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants