-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Infraction enum changed in cosmos-sdk v0.47.x with respect to v0.45.x-ics #16740
Comments
This was referenced Jun 28, 2023
i wouldnt consider this a bug since the pr that added this went through review cycles and this wasnt brought up, since this is already part of a release im inclined to leave it as is. I dont think |
tac0turtle
changed the title
[Bug]: Infraction enum changed in cosmos-sdk v0.47.x with respect to v0.45.x-ics
Infraction enum changed in cosmos-sdk v0.47.x with respect to v0.45.x-ics
Jun 29, 2023
20 tasks
This was referenced Jun 30, 2023
slashing types incompatibility between v45 provider and v47 consumer
cosmos/interchain-security#1092
Closed
discussed and closed the pr. we can close this issue now |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Summary of Bug
Changes required for the ICS protocol were introduced to the cosmos-sdk
v0.47.0
.Previously, the changes were only available in
cosmos-sdk v0.45.X-ics
releases.The
Infraction
andInfractionTypes
enums available incosmos-sdk v0.45.X-ics
andcosmos-sdk v0.47.x
are not 100% compatible.The issue:
When storing the
Infraction
type the issue will not be manifested, because the data is usually stored as proto bytes and the underlying enum values are the same between versions.However, when marshalling the protos into JSON (using
ModuleCdc.MustMarshalJSON()
) the types are not compatible due to how JSON marshalling works in cosmos-sdk.When marshalling the
Infraction
from v47 to JSON we get the following structure:When marshalling the
InfractionType
from v45 we get the following output:Generated proto enum value maps are different
v47
v45
The issue with parsing the
Infraction
can manifest when 2 chains running different versions of cosmos-sdk are communicating over IBC.In ICS it manifests because a
SlashPacket
can be sent between chains that use different cosmos-sdk versions.Context & Example:
When we send data packets containing infractions in v45 vs v47 we get the following:
Due to how JSON Marshal/Unmarshal works in cosmos-sdk, these 2 types are not compatible. One type cannot be parsed into another because the enum tags don't match.
v45
Last ICS version
https://github.com/cosmos/cosmos-sdk/blob/v0.45.16-ics/proto/cosmos/staking/v1beta1/staking.proto#L356
First ICS version
https://github.com/cosmos/cosmos-sdk/blob/v0.45.11-ics/proto/cosmos/staking/v1beta1/staking.proto#L356
The
InfractionType
is unchangedv46
Not affected,
InfractionType
is not available.v47
https://github.com/cosmos/cosmos-sdk/blob/v0.47.3/proto/cosmos/staking/v1beta1/staking.proto#L392C18-L392C18
InfractionType
got renamed toInfraction
.Enum tags were renamed:
Unfortunately the enum tag is used in JSON format, instead of the enum value.
Possible solution
Change the
Infraction
enum in such a way that it is the same "over the wire" between different cosmos-sdk versions.The changes should not be state breaking. As far as we can tell, the issue is isolated to sending the types "over the wire" since the strings are different in JSON format.
Temporary solution implemented in ICS
We have temporarily created shims that ensure that
v45
andv47
chains remain compatible when parsing data that containsInfraction
.Version
https://github.com/cosmos/cosmos-sdk/releases/tag/v0.47.3 (
v0.47.x
)Steps to Reproduce
The text was updated successfully, but these errors were encountered: