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: add restaking client and invariants #56

Merged
merged 7 commits into from
Jul 26, 2024

Conversation

RiccardoM
Copy link
Contributor

Description

This PR adds the x/restaking CLI client as well as invariants.


Author Checklist

All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.

I have...

  • included the correct type prefix in the PR title
  • added ! to the type prefix if API or client breaking change
  • targeted the correct branch (see PR Targeting)
  • provided a link to the relevant issue or specification
  • followed the guidelines for building modules
  • included the necessary unit and integration tests
  • added a changelog entry to CHANGELOG.md
  • included comments for documenting Go code
  • updated the relevant documentation or specification
  • reviewed "Files changed" and left comments if necessary
  • confirmed all CI checks have passed

Reviewers Checklist

All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.

I have...

  • confirmed the correct type prefix in the PR title
  • confirmed ! in the type prefix if API or client breaking change
  • confirmed all author checklist items have been addressed
  • reviewed state machine logic
  • reviewed API design and naming
  • reviewed documentation is accurate
  • reviewed tests and test coverage
  • manually tested (if applicable)

@RiccardoM RiccardoM requested a review from hallazzang July 23, 2024 15:43
// GetPoolsQueryCmd returns the command allowing to query pools
func GetPoolsQueryCmd() *cobra.Command {
queryCmd := &cobra.Command{
Use: "pools",
Copy link
Contributor

Choose a reason for hiding this comment

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

How about use "pool" instead? That way, the full command will look like:

  • milkywayd tx restaking pool delegations 1
  • milkywayd tx restaking pool delegation 1 init1...

x/restaking/client/cli/query.go Show resolved Hide resolved
x/restaking/client/cli/query.go Show resolved Hide resolved
x/restaking/client/cli/query.go Show resolved Hide resolved
Comment on lines 27 to 30
txCmd.AddCommand(
GetPoolsTxCmd(),
GetOperatorsTxCmd(),
GetServicesTxCmd(),
)
Copy link
Contributor

Choose a reason for hiding this comment

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

I understand it's just a personal preference, but here are my suggestions:

  • milkywayd tx restaking delegate-pool 1000000umilk
  • milkywayd tx restaking delegate-operator 1 1000000umilk
  • milkywayd tx restaking delegate-service 2 1000000umilk

Or

  • milkywayd tx restaking delegate pool 1000000umilk
  • milkywayd tx restaking delegate operator 1 1000000umilk
  • milkywayd tx restaking delegate service 2 1000000umilk

What do you think?

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 for the suggestion, will update it to follow the second one (delegate <pool|operator|service>) 🙏

Comment on lines 90 to 91
poolsBroken := !poolsBalances.Equal(poolsTokens)
operatorsBroken := !operatorsBalances.Equal(operatorsTokens)
servicesBroken := !servicesBalances.Equal(servicesTokens)
Copy link
Contributor

Choose a reason for hiding this comment

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

We should these instead:

Suggested change
poolsBroken := !poolsBalances.Equal(poolsTokens)
operatorsBroken := !operatorsBalances.Equal(operatorsTokens)
servicesBroken := !servicesBalances.Equal(servicesTokens)
poolsBroken := !poolsBalances.IsAllGTE(poolsTokens)
operatorsBroken := !operatorsBalances.IsAllGTE(operatorsTokens)
servicesBroken := !servicesBalances.IsAllGTE(servicesTokens)

Because an attacker can send assets to the module addresses to halt the chain with this invariant.

Copy link
Contributor

Choose a reason for hiding this comment

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

@RiccardoM Can you check this again please?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed. Must've been the rebase that brought it back 🤦

@RiccardoM RiccardoM force-pushed the riccardom/add-restaking-cli branch from 9dfb3a4 to 5d0f213 Compare July 25, 2024 19:56
@RiccardoM RiccardoM requested a review from hallazzang July 25, 2024 19:59
Comment on lines 90 to 91
poolsBroken := !poolsBalances.Equal(poolsTokens)
operatorsBroken := !operatorsBalances.Equal(operatorsTokens)
servicesBroken := !servicesBalances.Equal(servicesTokens)
Copy link
Contributor

Choose a reason for hiding this comment

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

@RiccardoM Can you check this again please?

@RiccardoM RiccardoM requested a review from hallazzang July 26, 2024 17:00
Copy link
Contributor

@hallazzang hallazzang left a comment

Choose a reason for hiding this comment

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

LGTM!

@RiccardoM RiccardoM merged commit dae139e into main Jul 26, 2024
17 checks passed
@RiccardoM RiccardoM deleted the riccardom/add-restaking-cli branch July 26, 2024 18:08
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.

2 participants