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: MsgUpdateCrosschainFlags into MsgEnableCCTXFlags, MsgDisableCCTXFlags and MsgUpdateGasPriceIncreaseFlags #2269

Merged
merged 19 commits into from
May 29, 2024

Conversation

kingpinXD
Copy link
Contributor

Description

Refactor MsgUpdateCrosschainFlags to break it down into the following messages which are controlled by the mentioned admin polices

MsgEnableCCTXFlags: PolicyType_groupOperational
MsgDisableCCTXFlags : PolicyType_groupEmegency
MsgUpdateGasPriceIncreaseFlags : PolicyType_groupOperational

Closes: #2245

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 May 27, 2024

Codecov Report

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

Project coverage is 69.07%. Comparing base (42fe69c) to head (bf20c06).
Report is 1 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #2269      +/-   ##
===========================================
+ Coverage    68.94%   69.07%   +0.13%     
===========================================
  Files          265      269       +4     
  Lines        16344    16436      +92     
===========================================
+ Hits         11268    11353      +85     
- Misses        4594     4599       +5     
- Partials       482      484       +2     
Files Coverage Δ
x/observer/types/message_disable_cctx_flags.go 100.00% <100.00%> (ø)
x/observer/types/message_enable_cctx_flags.go 100.00% <100.00%> (ø)
...r/types/message_update_gas_price_increase_flags.go 100.00% <100.00%> (ø)
x/observer/keeper/msg_server_disable_cctx_flags.go 91.30% <91.30%> (ø)
x/observer/keeper/msg_server_enable_cctx_flags.go 91.30% <91.30%> (ø)
...eper/msg_server_update_gas_price_increase_flags.go 91.30% <91.30%> (ø)

... and 1 file with indirect coverage changes

Copy link

!!!WARNING!!!
nosec detected in the following files: x/observer/client/cli/tx_update_gas_price_increase_flags.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 May 27, 2024
@kingpinXD kingpinXD marked this pull request as ready for review May 28, 2024 00:03
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.

I propose we rename:
MsgDisableCCTXFlags -> MsgPauseCCTX
MsgEnableCCTXFlags -> MsgUnpauseCCTX

To keep consistency with PauseZRC20 for example.
Then we can use the pause/unpause terminology for all messages pausing functionalities in emergency

@kingpinXD
Copy link
Contributor Author

MsgPauseCCTX

I dont mind changing it but note

  • The zrc20 pause and unpause affects the paused value , for the zrc20 data structure directly , whereas here , we do not touch the CCTX struct at all .
  • This would also make it inconsistent with MsgUpdateGasPriceIncreaseFlags even though they all modify the same data structure .
  • The values it affects are called IsInboundEnabled and IsOutboundEnabled and not IsInboundPaused and IsOutboundPaused.

@lumtis
Copy link
Member

lumtis commented May 28, 2024

MsgPauseCCTX

I dont mind changing it but note

  • The zrc20 pause and unpause affects the paused value , for the zrc20 data structure directly , whereas here , we do not touch the CCTX struct at all .
  • This would also make it inconsistent with MsgUpdateGasPriceIncreaseFlags even though they all modify the same data structure .
  • The values it affects are called IsInboundEnabled and IsOutboundEnabled and not IsInboundPaused and IsOutboundPaused.

Ok, let's keep it as is then

@kingpinXD kingpinXD requested review from lumtis and skosito May 28, 2024 17:28
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 for the code.

I agree on keeping the Enable/Disable terminology. However, it seems we can remove Flags in the name. We are disable the inbounds or outbounds, not the flags, we interact with the flags

MsgEnableCCTX
MsgDisableCCTX

@kingpinXD
Copy link
Contributor Author

MsgEnableCCTX
MsgDisableCCTX

The two values are under the CrossChainFlags struct, so verbally, does it make sense to treat them as flags?

@lumtis
Copy link
Member

lumtis commented May 29, 2024

MsgEnableCCTX
MsgDisableCCTX

The two values are under the CrossChainFlags struct, so verbally, does it make sense to treat them as flags?

We will remove CrossChainFlags in the future since this structure pertain to the crosschain module.

And the enable/disable action is not performed to the flags but the CCTXs, flags is the structure that hold the information

@lumtis
Copy link
Member

lumtis commented May 29, 2024

Looks like we need to rerun make generate

@kingpinXD kingpinXD merged commit 85861be into develop May 29, 2024
19 checks passed
@kingpinXD kingpinXD deleted the refactor-MsgUpdateCrosschainFlags branch May 29, 2024 17:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants