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: outboud vote #1886

Merged
merged 12 commits into from
Mar 18, 2024
Merged

Conversation

kingpinXD
Copy link
Contributor

@kingpinXD kingpinXD commented Mar 13, 2024

Description

  • Refactor MsgVoteOnObservedOutboundTxResponse , to break it down into smaller functions
  • Add unit tests to improve coverage
  • Remove cli tests for crosschian module .

Closes:#1801

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: x/crosschain/keeper/cctx_utils_outbound.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 13, 2024
return nil
}

func (k Keeper) FundStabiltityPool(ctx sdk.Context, cctx *types.CrossChainTx) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
func (k Keeper) FundStabiltityPool(ctx sdk.Context, cctx *types.CrossChainTx) {
func (k Keeper) FundStabilityPool(ctx sdk.Context, cctx *types.CrossChainTx) {


func (k Keeper) FundStabiltityPool(ctx sdk.Context, cctx *types.CrossChainTx) {
// Fund the gas stability pool with the remaining funds
if err := k.FundGasStabilityPoolFromRemainingFees(ctx, *cctx.GetCurrentOutTxParam(), cctx.GetCurrentOutTxParam().ReceiverChainId); err != nil {
Copy link
Contributor

@ws4charlie ws4charlie Mar 13, 2024

Choose a reason for hiding this comment

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

Is msg.OutTxChain (used before refactor) equal to cctx.GetCurrentOutTxParam().ReceiverChainId) in all cases.

Copy link
Contributor Author

@kingpinXD kingpinXD Mar 14, 2024

Choose a reason for hiding this comment

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

the pending nonces is set using the receiver chain ID
https://github.com/zeta-chain/zeta-node/blob/75580e7726f421b40be995f3a17de1cce28e338a/x/crosschain/keeper/cctx_utils.go#L105-L118

and the client uses that to query and process outbounds .
https://github.com/zeta-chain/zeta-node/blob/75580e7726f421b40be995f3a17de1cce28e338a/zetaclient/zetacore_observer.go#L145-L149 ,
it should be the same , I can however add an additional check in the outbound message to be safe

@kingpinXD kingpinXD marked this pull request as ready for review March 18, 2024 18:05
@kingpinXD kingpinXD merged commit 152a3de into refactor-inbound-vote Mar 18, 2024
6 of 11 checks passed
@kingpinXD kingpinXD deleted the refactor-outbound-vote branch March 18, 2024 18:06
lumtis added a commit that referenced this pull request Apr 2, 2024
* refactor inbound vote

* add unit tests for ProcessZEVMDeposit

* creating mocking functions for test refactor

* add tests for Process message passing

* move cointype to cctx struct and refactor tests to accomodate the change

* add defer to recover from panic if config is already set

* add more unit tests

* add validate

* add validate function for cctx

* add validate function for cctx

* add validate unit tests

* add migration test

* set module version

* fix unit tests

* remove unnecessary test

* update upgrade docker file

* generate files

* modify logs

* ignore address validation for zetachain

* ignore address validation for zetachain

* ignore tx hash check

* refactor: outboud vote (#1886)

* remove changes to cctx struct

* modify changelog

* add tests for types package

* add comments

* resolve comments

* modify comments based on suggestions

* add error message for add revert

* replace broken eth rpc

* directly modify fungible state in SetupStateForProcessLogsZetaSent

* set withdrawals to pending outbound

* append status message if not empty

* Update changelog.md

Co-authored-by: Lucas Bertrand <[email protected]>

* add issue #1951

* adjust changelog

---------

Co-authored-by: Lucas Bertrand <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants