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

InitialPoolWeights and TargetPoolWeights should not be []PoolAsset #131

Closed
sunnya97 opened this issue May 2, 2021 · 5 comments
Closed
Labels
api-breaking Breaking changes that impact API only (not state machine). C:x/gamm Changes, features and bugs related to the gamm module. genesis-breaking post-launch proto-breaking Protobuf breaking changes: generally don't do this! revisit-someday T:code-hygiene

Comments

@sunnya97
Copy link
Collaborator

sunnya97 commented May 2, 2021

The types for InitialPoolWeights and for TargetPoolWeights in the SmoothWeightChangeParams are both []PoolAsset

type SmoothWeightChangeParams struct {
	StartTime time.Time
	Duration time.Duration
	InitialPoolWeights []PoolAsset
	TargetPoolWeights []PoolAsset
}

But PoolAsset is defined as

type PoolAsset struct {
	Token sdk.Coin
	Weight sdk.Int 
}

But this doesn’t make sense because sdk.Coin includes an amount, but all we want for InitialPoolWeights and TargetPoolWeights is a denom and a weight

I think this comes down to the PoolAsset abstraction just doesn’t make sense

Why are we trying to combine the balance of a pool into the same struct as the weights of the assets? Just to save on storing the denom twice?

A pool’s balances should just be sdk.Coins, and the pool’s weights could be also sdk.Coins, but might make sense to just alias that to a new type called poolWeights (for type safety)

@sunnya97 sunnya97 added api-breaking Breaking changes that impact API only (not state machine). genesis-breaking proto-breaking Protobuf breaking changes: generally don't do this! state-machine-breaking C:x/gamm Changes, features and bugs related to the gamm module. T:code-hygiene labels May 2, 2021
@sunnya97 sunnya97 changed the title InitialPoolWeights and TargetPoolWeights should InitialPoolWeights and TargetPoolWeights should not be []PoolAsset May 2, 2021
@ValarDragon
Copy link
Member

Agreed, I had similar thoughts on the PoolAsset abstraction when going through the proto files earlier. I think this is a refactor we should do, after we hit feature completeness / potentially #post-launch.

@mconcat
Copy link
Collaborator

mconcat commented Jan 13, 2022

Another thing is that the weight is more like the parameter side data, whereas the assets are treasury side of data. If we want to separate asset management from the pool logic(so the new pool models could just provide curve formulas only), we should separate out weights from the PoolAsset.

@sunnya97
Copy link
Collaborator Author

Yeah, that makes sense

@ValarDragon
Copy link
Member

At this point, I'm not sure this is worth the state migration to fix.

At least not in the near future. Going to close for now, and we can re-open if we feel differently later!

@sunnya97
Copy link
Collaborator Author

Is there a way to mark closed issues as "revisit in the future"? Cause if we just close them, I feel we will lose track of them forever.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api-breaking Breaking changes that impact API only (not state machine). C:x/gamm Changes, features and bugs related to the gamm module. genesis-breaking post-launch proto-breaking Protobuf breaking changes: generally don't do this! revisit-someday T:code-hygiene
Projects
Archived in project
Development

No branches or pull requests

3 participants