diff --git a/CHANGELOG.md b/CHANGELOG.md index b937ec675f9..d9c0639a97a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -52,6 +52,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### State Compatible +* [#8398](https://github.com/osmosis-labs/osmosis/pull/8398) Lower JSON unmarshalling overhead in IBC packet logic. + ## v25.0.3 * [#8329](https://github.com/osmosis-labs/osmosis/pull/8329) Overwrite `flush_throttle_timeout` to 80ms instead of 10ms diff --git a/x/ibc-rate-limit/ibc_module.go b/x/ibc-rate-limit/ibc_module.go index cdc12880fcd..dd4b9c40470 100644 --- a/x/ibc-rate-limit/ibc_module.go +++ b/x/ibc-rate-limit/ibc_module.go @@ -11,7 +11,6 @@ import ( sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" - transfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" porttypes "github.com/cosmos/ibc-go/v8/modules/core/05-port/types" @@ -110,12 +109,17 @@ func (im *IBCModule) OnChanCloseConfirm( return im.app.OnChanCloseConfirm(ctx, portID, channelID) } +type receiverParser struct { + Receiver string `protobuf:"bytes,4,opt,name=receiver,proto3" json:"receiver,omitempty"` +} + func ValidateReceiverAddress(packet exported.PacketI) error { - var packetData transfertypes.FungibleTokenPacketData - if err := json.Unmarshal(packet.GetData(), &packetData); err != nil { + var receiverObj receiverParser + + if err := json.Unmarshal(packet.GetData(), &receiverObj); err != nil { return err } - if len(packetData.Receiver) >= 4096 { + if len(receiverObj.Receiver) >= 4096 { return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "IBC Receiver address too long. Max supported length is %d", 4096) } return nil