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

feat: state data for aborted tx amount #1395

Closed
wants to merge 17 commits into from
Closed

Conversation

kingpinXD
Copy link
Contributor

@kingpinXD kingpinXD commented Nov 14, 2023

Description

  • Adds new state data to track the total amount of zeta tokens that have been aborted
  • This value is accounted for the zeta supply checker

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

github-actions bot commented Nov 14, 2023

!!!WARNING!!!
nosec detected in the following files: x/crosschain/keeper/grpc_query_cctx.go, x/crosschain/keeper/keeper_cross_chain_tx.go, x/crosschain/types/keys.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 Nov 14, 2023
@kingpinXD kingpinXD changed the title feat : state data for aborted tx amount feat: state data for aborted tx amount Nov 14, 2023
@kingpinXD kingpinXD marked this pull request as ready for review November 15, 2023 05:34
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.

It looks good to me.
I'm just wondering, for future-proofing purposes, maybe we could use a more general state variable ZetaAccounting instead AbortedZetaAmount and add abortedAmount in this state variable. It would reduce complexity and refactoring work in case we want to add a new variable for accounting purpose in the store in the future.
What do you think?

app/setup_handlers.go Outdated Show resolved Hide resolved
proto/crosschain/cross_chain_tx.proto Outdated Show resolved Hide resolved
proto/crosschain/query.proto Outdated Show resolved Hide resolved
zetaclient/zeta_supply_checker.go Outdated Show resolved Hide resolved
@@ -51,6 +47,9 @@ func (k Keeper) SetCctxAndNonceToCctxAndInTxHashToCctx(ctx sdk.Context, send typ
Tss: tss.TssPubkey,
})
}
if send.CctxStatus.Status == types.CctxStatus_Aborted {
k.AddZetaAccounting(ctx, send.GetCurrentOutTxParam().Amount)
Copy link
Collaborator

Choose a reason for hiding this comment

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

  1. The function name AddZetaAccounting can be more specific.
  2. Do you need to test whether the outbound is supposed to be ZETA token transfer, not some other tokens?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks , good catch !

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.

Just a typo in a file name: x/crosschain/keeper/zeta_accountin.go

@kingpinXD kingpinXD closed this Nov 21, 2023
This was referenced Jan 18, 2024
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.

None yet

4 participants