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

fix[CL]: codec changes #3811

Merged
merged 5 commits into from
Jan 9, 2023
Merged

fix[CL]: codec changes #3811

merged 5 commits into from
Jan 9, 2023

Conversation

czarcas7ic
Copy link
Member

Closes: #XXX

What is the purpose of the change

Small codec change I left out. It is needed for pool queries

@czarcas7ic czarcas7ic changed the title codec changes fix[CL]: codec changes Dec 21, 2022
@czarcas7ic czarcas7ic marked this pull request as ready for review December 21, 2022 02:32
@czarcas7ic czarcas7ic requested a review from a team December 21, 2022 02:32
Copy link
Member

@mattverse mattverse left a comment

Choose a reason for hiding this comment

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

Left some minor questions and comments please take a look!

x/concentrated-liquidity/types/codec.go Outdated Show resolved Hide resolved
x/concentrated-liquidity/model/codec.go Outdated Show resolved Hide resolved
@czarcas7ic czarcas7ic changed the base branch from concentrated-liquidity-main to main December 30, 2022 05:12
@czarcas7ic czarcas7ic added the V:state/breaking State machine breaking PR label Dec 30, 2022
Comment on lines +18 to +22
registry.RegisterInterface(
"osmosis.swaprouter.v1beta1.PoolI",
(*swaproutertypes.PoolI)(nil),
&Pool{},
)
Copy link
Member

Choose a reason for hiding this comment

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

Why do we marshal an interface though? I think this could have been avoided if we marshaled a pool struct directly

Copy link
Member

Choose a reason for hiding this comment

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

The reason we marshal an interface in gamm is that there are 2 implementations - balancer and stableswap. Here, we only have one pool model. So we should be able to marshal its concrete type directly

Copy link
Member

@mattverse mattverse Jan 2, 2023

Choose a reason for hiding this comment

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

@p0mvn wdym by marshalling a pool struct directly?

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm pretty sure he means not marshaling into proto any and instead directly marshaling into the struct itself, but sometimes this isnt possible due to circular dependencies in the proto files

Copy link
Member

Choose a reason for hiding this comment

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

Hrmm, it potentially makes sense to register this, if we wanted a swaprouter query for underlying structs as an interface tho

Copy link
Member

Choose a reason for hiding this comment

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

FWIW, I don't really care if we serialize into state as concrete struct vs interface.

Concrete is slightly more space efficient, but I doubt this efficiency ever matters. Interface could plausibly give more ease of switching in the future, but if we didn't do an interface I don't think it'd be that hard to change in the future either.

Comment on lines +13 to +14
cdc.RegisterConcrete(&Pool{}, "osmosis/cl-pool", nil)
cdc.RegisterConcrete(&MsgCreateConcentratedPool{}, "osmosis/cl-create-pool", nil)
Copy link
Member

Choose a reason for hiding this comment

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

did we hit the 40 char limit before or smth?

Copy link
Member Author

Choose a reason for hiding this comment

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

Matt was just telling me to be weary of the lengths of these, so I made it as short as possible to get the point across

@ValarDragon
Copy link
Member

Agreed, I think we need this for generalized pool queries, even if we do concrete serialization within CL

@czarcas7ic czarcas7ic merged commit e799202 into main Jan 9, 2023
@czarcas7ic czarcas7ic deleted the adam/codec-changes branch January 9, 2023 15:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

5 participants