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: inbound and outbound vote processing #1853

Merged
merged 44 commits into from
Apr 2, 2024
Merged

Conversation

kingpinXD
Copy link
Contributor

@kingpinXD kingpinXD commented Mar 7, 2024

Description

  • Refactor VoteOnObservedInboundTx, to break it down into smaller functions.
  • Refactor VoteOnObservedOutboundTx, to break it down into smaller functions
  • Add unit tests to improve coverage
  • Remove cli tests for crosschian module .
  • Add a validate function for cctx
  • Modify the code base to use only InboundParams.Cointype everywhere.

Closes: #1800
#1180
#1801
#1802

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

github-actions bot commented Mar 11, 2024

!!!WARNING!!!
nosec detected in the following files: x/crosschain/types/outbound_params_test.go, x/crosschain/keeper/msg_server_vote_inbound_tx.go, x/crosschain/keeper/msg_server_vote_outbound_tx.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 Mar 11, 2024
@kingpinXD kingpinXD marked this pull request as ready for review March 11, 2024 07:12
Copy link

codecov bot commented Mar 11, 2024

Codecov Report

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

Project coverage is 54.00%. Comparing base (1e0d859) to head (a89f2ba).

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #1853      +/-   ##
===========================================
+ Coverage    52.01%   54.00%   +1.99%     
===========================================
  Files          235      241       +6     
  Lines        13382    13535     +153     
===========================================
+ Hits          6960     7309     +349     
+ Misses        5987     5779     -208     
- Partials       435      447      +12     
Files Coverage Δ
x/crosschain/keeper/cctx.go 86.27% <100.00%> (-3.84%) ⬇️
x/crosschain/keeper/events.go 83.33% <100.00%> (+26.66%) ⬆️
x/crosschain/keeper/gas_payment.go 80.64% <100.00%> (+1.07%) ⬆️
.../crosschain/keeper/msg_server_migrate_tss_funds.go 72.35% <ø> (ø)
x/crosschain/keeper/msg_server_whitelist_erc20.go 82.14% <ø> (ø)
x/crosschain/migrations/v4/migrate.go 92.00% <100.00%> (ø)
x/crosschain/types/authz.go 100.00% <100.00%> (ø)
x/crosschain/types/inbound_params.go 100.00% <100.00%> (ø)
x/crosschain/types/message_abort_stuck_cctx.go 100.00% <100.00%> (ø)
x/crosschain/types/message_refund_aborted.go 100.00% <100.00%> (ø)
... and 15 more

... and 1 file with indirect coverage changes

x/crosschain/keeper/evm_hooks_test.go Outdated Show resolved Hide resolved
x/crosschain/keeper/evm_hooks_test.go Outdated Show resolved Hide resolved
x/authority/types/policies_test.go Outdated Show resolved Hide resolved
x/crosschain/keeper/evm_deposit.go Show resolved Hide resolved
x/crosschain/keeper/evm_deposit.go Show resolved Hide resolved
x/crosschain/keeper/msg_server_vote_outbound_tx.go Outdated Show resolved Hide resolved
x/crosschain/keeper/msg_server_vote_outbound_tx.go Outdated Show resolved Hide resolved
x/crosschain/types/cctx.go Outdated Show resolved Hide resolved
x/crosschain/types/cctx.go Outdated Show resolved Hide resolved
x/crosschain/types/utils.go Outdated Show resolved Hide resolved
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.

just some minor comments

e2e/runner/logger.go Outdated Show resolved Hide resolved
testutil/sample/common.go Outdated Show resolved Hide resolved
x/crosschain/keeper/cctx.go Outdated Show resolved Hide resolved
x/crosschain/keeper/cctx_utils.go Outdated Show resolved Hide resolved
x/crosschain/keeper/events.go Outdated Show resolved Hide resolved
x/crosschain/types/utils.go Outdated Show resolved Hide resolved
zetaclient/bitcoin/bitcoin_client.go Outdated Show resolved Hide resolved
x/crosschain/types/cctx.go Outdated Show resolved Hide resolved
x/crosschain/types/cctx.go Show resolved Hide resolved
x/crosschain/keeper/msg_server_vote_inbound_tx.go Outdated Show resolved Hide resolved
@kingpinXD kingpinXD requested review from lumtis and skosito March 22, 2024 04:32
@lumtis
Copy link
Member

lumtis commented Mar 22, 2024

@kingpinXD I think the PR title is misleading, we're refactoring the inbound/outbound processing logic, not the voting logic although this logic is part of the vote messages

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.

Answered some of the comments in discussions

@kingpinXD kingpinXD changed the title refactor: inbound and outbound votes refactor: inbound and outbound vote processing Mar 23, 2024
proto/crosschain/cross_chain_tx.proto Show resolved Hide resolved
changelog.md Outdated Show resolved Hide resolved
changelog.md Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

VoteOnObservedInboundTx: separate cctx state transition logic from the message into new functions
4 participants