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

chore(tests): add restaking simulation tests #212

Merged
merged 14 commits into from
Dec 12, 2024

Conversation

manu0466
Copy link
Contributor

@manu0466 manu0466 commented Dec 5, 2024

Description

Closes: MILK-150


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)

@manu0466 manu0466 self-assigned this Dec 5, 2024
@manu0466 manu0466 marked this pull request as ready for review December 5, 2024 18:03
@RiccardoM RiccardoM changed the title test: add restaking simulation tests chore(tests): add restaking simulation tests Dec 6, 2024
x/restaking/simulation/decoder.go Outdated Show resolved Hide resolved
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

@manu0466 manu0466 force-pushed the manuel/restaking-simulation-tests branch from 37123c0 to e623ddb Compare December 6, 2024 10:03
Comment on lines 139 to 140
operatorsKeeper := opk.(*operatorskeeper.Keeper)
servicesKeeper := sk.(*serviceskeeper.Keeper)
Copy link
Contributor

Choose a reason for hiding this comment

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

What's the point of using interfaces as the params type, if you are going to cast them anyway? I think it's better to either:

  1. Require non-interface types directly as params, or
  2. Use interfaces everywhere

This way you don't have to downcast anything and it's easier to manage everything

operator, found := operatorssimulation.GetRandomExistingOperator(r, ctx, operatorsKeeper, func(o operatorstypes.Operator) bool {
// Search a service that the operator has joined
for _, s := range services {
hasJoined, _ := k.HasOperatorJoinedService(ctx, o.ID, s.ID)
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of o and s I would suggest using names as operator and service to make it easier to read

return simtypes.NoOpMsg(types.ModuleName, sdk.MsgTypeURL(msg), "could not get operators"), nil, nil
}

// Get a service and an operator that is not allowed
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
// Get a service and an operator that is not allowed
// Get a service and an operator that is inside the allow list

testutils/simtesting/utils.go Outdated Show resolved Hide resolved
@manu0466 manu0466 requested a review from hallazzang December 11, 2024 16:03
@manu0466 manu0466 force-pushed the manuel/restaking-simulation-tests branch from d06d6bc to 34b6ab0 Compare December 12, 2024 07:59
@RiccardoM RiccardoM merged commit fccb49b into main Dec 12, 2024
17 checks passed
@RiccardoM RiccardoM deleted the manuel/restaking-simulation-tests branch December 12, 2024 08:10
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.

3 participants