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: use sdk modules #1357

Merged
merged 37 commits into from
Aug 24, 2022
Merged

refactor: use sdk modules #1357

merged 37 commits into from
Aug 24, 2022

Conversation

technicallyty
Copy link
Contributor

@technicallyty technicallyty commented Aug 17, 2022

Description

  • refactors the testing fixture to work with sdk modules and sdk context
  • removes custom modules, custom module keys, and custom context wrapper
  • removes many of the empty setCustom<Attribute> calls from RegenApp
  • updates some broken code that needed to use cosmossdk.io/math package instead of the deprecated types.Math

Closes: #933


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)

Copy link
Member

@ryanchristo ryanchristo left a comment

Choose a reason for hiding this comment

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

Looking like the right direction. A few comments to start. Maybe we can pair on this.

app/app.go Outdated Show resolved Hide resolved
app/app.go Outdated Show resolved Hide resolved
app/app.go Outdated Show resolved Hide resolved
app/export.go Outdated Show resolved Hide resolved
app/utils.go Outdated Show resolved Hide resolved
types/module/server/testutil.go Outdated Show resolved Hide resolved
x/data/server/server.go Outdated Show resolved Hide resolved
@technicallyty technicallyty marked this pull request as ready for review August 20, 2022 23:37
@technicallyty technicallyty requested review from a team and ryanchristo August 20, 2022 23:37
@technicallyty
Copy link
Contributor Author

this is now R4R! @regen-network/ledger-core-dev

Copy link
Member

@ryanchristo ryanchristo left a comment

Choose a reason for hiding this comment

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

tACK (basic manual tests starting a new local chain and creating a class, project, batch, and data resolver). Just a couple nits but otherwise looks good to me. Nice work!

app/app.go Outdated Show resolved Hide resolved
go.mod Outdated Show resolved Hide resolved
Comment on lines +49 to +52
// we append the mock module below in order to bypass the check for validator updates.
// since we are testing with a fixture with no validators, we must inject a mock module and
// force it to inject a validator update.
ff.modules = append(ff.modules, MockModule{})
Copy link
Member

Choose a reason for hiding this comment

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

👍

types/fixture/testutil.go Outdated Show resolved Hide resolved
types/fixture/testutil.go Outdated Show resolved Hide resolved
@ryanchristo ryanchristo requested a review from aleem1314 August 22, 2022 18:34

// WeightedOperations returns all the ecocredit module operations with their respective weights.
// NOTE: This is no longer needed for the modules which uses ADR-33, ecocredit module `WeightedOperations`
// registered in the `x/ecocredit/server` package.
func (Module) WeightedOperations(simState module.SimulationState) []simtypes.WeightedOperation {
return nil
func (a Module) WeightedOperations(simState module.SimulationState) []simtypes.WeightedOperation {
Copy link
Contributor

Choose a reason for hiding this comment

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

can you also update godoc?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

90d3602 👍🏻

func (Module) WeightedOperations(simState module.SimulationState) []simtypes.WeightedOperation {
return nil
func (a Module) WeightedOperations(simState module.SimulationState) []simtypes.WeightedOperation {
return a.keeper.WeightedOperations(simState)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we can directly call simulation.WeightedOperations.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

2306d18 👍🏻

Copy link
Contributor

@aleem1314 aleem1314 left a comment

Choose a reason for hiding this comment

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

LGTM. Nice work 🚀

@ryanchristo ryanchristo merged commit 5f0185e into main Aug 24, 2022
@ryanchristo ryanchristo deleted the ty/933-app_module_refactor branch August 24, 2022 00:43
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.

Remove regen module manager and use SDK App Module
3 participants