Add type tag to VSCMatured / SlashPackets #567
Labels
invalid
This doesn't seem right
type: refactoring
Code refactoring
type: tech-debt
Slows down development in the long run
Problem
We do not check the type before unmarshaling packets on the provider. We just try to unmarshal as one type, and if it fails, try as another type. This works for now, but is brittle and error prone.
Closing criteria
A type tag is implemented to distinguish packet types.
Problem details
On lines https://github.com/cosmos/interchain-security/blob/main/x/ccv/provider/ibc_module.go#L175-L189
We unmarshal without really knowing the type of packets on our CCV channel. This works, but is very sketchy.
Our two packet types are
and
The only actual difference between these two types is that SlashPacketData has a Validator field. InfractionType has
omitempty
so could be omitted, and ValsetUpdateId exists on both. It could be very easy for the one of these to parse as the other with some minor code changes.We should come up with a tagging scheme and use it.
TODOs
The text was updated successfully, but these errors were encountered: