Skip to content

x/gamm: Make all internal set functions private#2013

Merged
mergify[bot] merged 10 commits intomainfrom
make-sets-private
Jul 18, 2022
Merged

x/gamm: Make all internal set functions private#2013
mergify[bot] merged 10 commits intomainfrom
make-sets-private

Conversation

@AlpinYukseloglu
Copy link
Copy Markdown
Contributor

@AlpinYukseloglu AlpinYukseloglu commented Jul 10, 2022

Closes: #1945

What is the purpose of the change

I believe these functions were only public because they needed to be for an older SDK version. I think it would be appropriate to make them private now so that they aren't exposed to other modules.

Brief Changelog

  • Made the following functions private:
    SetParams
    SetPool
    SetTotalLiquidity
    SetDenomLiquidity
  • Commented out old upgrade code that prevented SetParams and SetPool from being made private
  • Removed use of SetParams in a superfluid test

Testing and Verifying

This change is a trivial rework / code cleanup without any test coverage.

Documentation and Release Note

  • Does this pull request introduce a new feature or user-facing behavior changes? (no)
  • Is a relevant changelog entry added to the Unreleased section in CHANGELOG.md? (no)
  • How is the feature or change documented? (not documented)

@github-actions github-actions bot added the C:x/gamm Changes, features and bugs related to the gamm module. label Jul 10, 2022
@github-actions github-actions bot added the C:app-wiring Changes to the app folder label Jul 17, 2022
Comment on lines -177 to +181
s.App.GAMMKeeper.SetParams(s.Ctx, gammtypes.Params{
PoolCreationFee: sdk.Coins{},
})

bondDenom := s.App.StakingKeeper.BondDenom(s.Ctx)
// TODO: use sdk crypto instead of tendermint to generate address
acc1 := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address().Bytes())

poolCreationFee := s.App.GAMMKeeper.GetParams(s.Ctx)
s.FundAcc(acc1, poolCreationFee.PoolCreationFee)
params := s.App.GAMMKeeper.GetParams(s.Ctx)
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Context:

The use of SetParams here was unnecessary and was the only thing prevent us from making the function private, so it makes sense to remove it

The rest of the changes here fix the test, which was broken to begin with but was never caught because SetParams would always set the pool creation fee to zero

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Ah nice, this is a good fix!

@AlpinYukseloglu AlpinYukseloglu marked this pull request as ready for review July 17, 2022 06:13
@AlpinYukseloglu AlpinYukseloglu requested review from a team, ValarDragon and alexanderbez July 17, 2022 06:13
Copy link
Copy Markdown
Member

@ValarDragon ValarDragon left a comment

Choose a reason for hiding this comment

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

LGTM, needs changelog entry.

Adding a backport label, if we need more things to be backported to get this through, can you backport them?

@ValarDragon ValarDragon added the A:backport/v10.x backport patches to v10.x branch label Jul 17, 2022
Copy link
Copy Markdown
Member

@p0mvn p0mvn left a comment

Choose a reason for hiding this comment

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

LGTM

@github-actions github-actions bot added the C:docs Improvements or additions to documentation label Jul 18, 2022
@mergify mergify bot merged commit 7fb5f82 into main Jul 18, 2022
@mergify mergify bot deleted the make-sets-private branch July 18, 2022 02:22
mergify bot pushed a commit that referenced this pull request Jul 18, 2022
Closes: #1945

## What is the purpose of the change

I believe these functions were only public because they needed to be for an older SDK version. I think it would be appropriate to make them private now so that they aren't exposed to other modules.

## Brief Changelog

- Made the following functions private:
`SetParams`
`SetPool`
`SetTotalLiquidity`
`SetDenomLiquidity`
- Commented out old upgrade code that prevented `SetParams` and `SetPool` from being made private
- Removed use of `SetParams` in a superfluid test

## Testing and Verifying

This change is a trivial rework / code cleanup without any test coverage.

## Documentation and Release Note

  - Does this pull request introduce a new feature or user-facing behavior changes? (no)
  - Is a relevant changelog entry added to the `Unreleased` section in `CHANGELOG.md`? (no)
  - How is the feature or change documented? (not documented)

(cherry picked from commit 7fb5f82)

# Conflicts:
#	CHANGELOG.md
#	app/upgrades/v4/upgrade_test.go
#	app/upgrades/v4/upgrades.go
#	x/gamm/genesis.go
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A:automerge A:backport/v10.x backport patches to v10.x branch C:app-wiring Changes to the app folder C:docs Improvements or additions to documentation C:x/gamm Changes, features and bugs related to the gamm module.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

x/gamm: Make all internal set functions private

3 participants