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
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
197afa5
refactor: remove custom module & manager from app
Aug 16, 2022
09d0a7c
wip
Aug 17, 2022
68f938b
more wip
Aug 17, 2022
4f6035d
wip: perhaps this will work...
Aug 18, 2022
3ede59a
fix: fill response with baseapp msg routing
Aug 18, 2022
0b98dd3
chore: add a panic for unexpected msg response results
Aug 18, 2022
7fa0c23
wip: query support
Aug 18, 2022
b77f6a4
fix: route queries through baseapp
Aug 18, 2022
a489275
chore: cleanup todos and deleted code
Aug 18, 2022
3d991b0
fix: use a mock module and force validator updates
Aug 19, 2022
680eaa4
docs: remove dead doc
Aug 19, 2022
4636fca
refactor: expose weighted operations and use in module
Aug 19, 2022
6def4a5
Merge branch 'main' into ty/933-app_module_refactor
Aug 19, 2022
15d92e3
refactor: move weighted operations to module
Aug 20, 2022
e9b0735
refactor: move simulations away from using old configurator keys
Aug 20, 2022
bf4df8c
refactor: simplify msg response check
Aug 20, 2022
8696311
refactor: import alias
Aug 20, 2022
ace2f43
refactor: remove store key from serverImpl struct
Aug 20, 2022
05ceafb
Merge branch 'main' into ty/933-app_module_refactor
Aug 20, 2022
20bc237
fix: data test setup
Aug 20, 2022
c66423b
refactor: simplify package, add events from response to context
Aug 20, 2022
13ea4a0
fix: sdk package errors, remove unused functions
Aug 20, 2022
b126ba5
fix: remove cast to custom context
Aug 20, 2022
d044a8e
refactor: remove last of custom context
Aug 20, 2022
59b6633
fix: remove calls to custom context
Aug 20, 2022
cdbb0cd
fix: setup fixture properly
Aug 20, 2022
e83c725
docs: add changelog
Aug 22, 2022
ed63a0d
Merge branch 'main' into ty/933-app_module_refactor
Aug 22, 2022
35a6b5b
refactor: remove unused codec function
Aug 22, 2022
8e4a094
chore: consolidate require line
Aug 22, 2022
2c90050
chore: apply suggestions from code review
technicallyty Aug 22, 2022
d5d3497
Merge branch 'ty/933-app_module_refactor' of https://github.com/regen…
Aug 22, 2022
11a061b
Merge branch 'main' into ty/933-app_module_refactor
Aug 22, 2022
90d3602
docs: update weighted ops godoc
Aug 23, 2022
2306d18
refactor: move weighted ops into module, remove method from server
Aug 23, 2022
6ab8b61
Merge branch 'main' into ty/933-app_module_refactor
Aug 23, 2022
83a33b5
chore: changelog
Aug 23, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
refactor: expose weighted operations and use in module
  • Loading branch information
tyler authored and tyler committed Aug 19, 2022
commit 4636fca0722fd26ab4d87a12b94829dc33b8084f
4 changes: 2 additions & 2 deletions x/data/module/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,6 @@ func (Module) RegisterStoreDecoder(sdr sdk.StoreDecoderRegistry) {
// WeightedOperations returns all the data module operations with their respective weights.
// NOTE: This is no longer needed for the modules which uses ADR-33, data module `WeightedOperations`
// registered in the `x/data/server` package.
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 👍🏻

}
3 changes: 3 additions & 0 deletions x/data/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import (
"github.com/cosmos/cosmos-sdk/orm/model/ormdb"
storetypes "github.com/cosmos/cosmos-sdk/store/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
simtypes "github.com/cosmos/cosmos-sdk/types/simulation"
"github.com/tendermint/tendermint/abci/types"

api "github.com/regen-network/regen-ledger/api/regen/data/v1"
Expand All @@ -23,6 +25,7 @@ var _ Keeper = serverImpl{}
type Keeper interface {
InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, data json.RawMessage) ([]types.ValidatorUpdate, error)
ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) (json.RawMessage, error)
WeightedOperations(simState module.SimulationState) []simtypes.WeightedOperation
}

type serverImpl struct {
Expand Down
4 changes: 2 additions & 2 deletions x/ecocredit/module/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -254,8 +254,8 @@ func (Module) RegisterStoreDecoder(_ sdk.StoreDecoderRegistry) {}
// 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 👍🏻

return a.Keeper.WeightedOperations(simState)
}

// BeginBlock checks if there are any expired sell or buy orders and removes them from state.
Expand Down
3 changes: 3 additions & 0 deletions x/ecocredit/server/expected_keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import (

"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
simtypes "github.com/cosmos/cosmos-sdk/types/simulation"
"github.com/tendermint/tendermint/abci/types"
)

Expand All @@ -16,4 +18,5 @@ type Keeper interface {
RegisterInvariants(sdk.InvariantRegistry)
InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, data json.RawMessage) ([]types.ValidatorUpdate, error)
ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) (json.RawMessage, error)
WeightedOperations(simState module.SimulationState) []simtypes.WeightedOperation
}