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 unused code and unified tx signing logic #2306

Merged
merged 6 commits into from
Jun 5, 2024

Conversation

ws4charlie
Copy link
Contributor

@ws4charlie ws4charlie commented Jun 3, 2024

Description

The PR is a minimum refactor to prepare for EIP-1559 outbound transaction

  • removed unused method SignWhitelistTx
  • unified different tx signing (onReceive, on Revert, erc20 withdraw, gas token withdraw) to use a common method Sign.
  • unified the tx verification logic in unit tests; added missing unit tests for SignCancelTx and TestSigner_SignMigrateTssFundsCmd
  • fix 'amount' issue in SignMigrateTssFundsCmd

Closes:

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 Jun 3, 2024

Codecov Report

Attention: Patch coverage is 89.74359% with 4 lines in your changes missing coverage. Please review.

Project coverage is 69.68%. Comparing base (26b4f69) to head (7493354).

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #2306      +/-   ##
===========================================
+ Coverage    69.44%   69.68%   +0.23%     
===========================================
  Files          281      281              
  Lines        16654    16644      -10     
===========================================
+ Hits         11565    11598      +33     
+ Misses        4604     4570      -34     
+ Partials       485      476       -9     
Files Coverage Δ
zetaclient/chains/evm/signer/signer.go 53.97% <89.74%> (+7.66%) ⬆️

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.

This looks legit to me. Some few comments.

Wondering if we could think about a further refactoring with a declarative approach?
We have a single sign function and an array containing the different values depending on the tx to sign.
Then to support a new tx that can be signed, you only need to add an entry in this array

@ws4charlie
Copy link
Contributor Author

This looks legit to me. Some few comments.

Wondering if we could think about a further refactoring with a declarative approach? We have a single sign function and an array containing the different values depending on the tx to sign. Then to support a new tx that can be signed, you only need to add an entry in this array

I think we can create a issue to track this: #2318

@lumtis lumtis merged commit 00006b5 into develop Jun 5, 2024
19 checks passed
@lumtis lumtis deleted the unified-sign-tx-outbound branch June 5, 2024 07:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants