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

Modify UnmarshalPacketData interface to allow additional args #6341

Merged
merged 6 commits into from
May 22, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ func (im IBCMiddleware) GetAppVersion(ctx sdk.Context, portID, channelID string)
// UnmarshalPacketData attempts to unmarshal the provided packet data bytes
// into an InterchainAccountPacketData. This function implements the optional
// PacketDataUnmarshaler interface required for ADR 008 support.
func (IBCMiddleware) UnmarshalPacketData(bz []byte) (interface{}, error) {
func (IBCMiddleware) UnmarshalPacketData(_ sdk.Context, _, _ string, bz []byte) (interface{}, error) {
var data icatypes.InterchainAccountPacketData
err := data.UnmarshalJSON(bz)
if err != nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1276,13 +1276,15 @@ func (suite *InterchainAccountsTestSuite) TestPacketDataUnmarshalerInterface() {
Memo: "",
}

packetData, err := controller.IBCMiddleware{}.UnmarshalPacketData(expPacketData.GetBytes())
// Context, port identifier and channel identifier are unused for controller.
packetData, err := controller.IBCMiddleware{}.UnmarshalPacketData(suite.chainA.GetContext(), "", "", expPacketData.GetBytes())
suite.Require().NoError(err)
suite.Require().Equal(expPacketData, packetData)

// test invalid packet data
invalidPacketData := []byte("invalid packet data")
packetData, err = controller.IBCMiddleware{}.UnmarshalPacketData(invalidPacketData)
// Context, port identifier and channel identifier are not used for controller.
packetData, err = controller.IBCMiddleware{}.UnmarshalPacketData(suite.chainA.GetContext(), "", "", invalidPacketData)
suite.Require().Error(err)
suite.Require().Nil(packetData)
}
2 changes: 1 addition & 1 deletion modules/apps/27-interchain-accounts/host/ibc_module.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ func (IBCModule) OnChanUpgradeOpen(ctx sdk.Context, portID, channelID string, pr
// UnmarshalPacketData attempts to unmarshal the provided packet data bytes
// into an InterchainAccountPacketData. This function implements the optional
// PacketDataUnmarshaler interface required for ADR 008 support.
func (IBCModule) UnmarshalPacketData(bz []byte) (interface{}, error) {
func (IBCModule) UnmarshalPacketData(_ sdk.Context, _, _ string, bz []byte) (interface{}, error) {
var data icatypes.InterchainAccountPacketData
err := data.UnmarshalJSON(bz)
if err != nil {
Expand Down
6 changes: 4 additions & 2 deletions modules/apps/27-interchain-accounts/host/ibc_module_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -883,13 +883,15 @@ func (suite *InterchainAccountsTestSuite) TestPacketDataUnmarshalerInterface() {
Memo: "",
}

packetData, err := icahost.IBCModule{}.UnmarshalPacketData(expPacketData.GetBytes())
// Context, port identifier and channel identifier are unused for host.
packetData, err := icahost.IBCModule{}.UnmarshalPacketData(suite.chainA.GetContext(), "", "", expPacketData.GetBytes())
suite.Require().NoError(err)
suite.Require().Equal(expPacketData, packetData)

// test invalid packet data
invalidPacketData := []byte("invalid packet data")
packetData, err = icahost.IBCModule{}.UnmarshalPacketData(invalidPacketData)
// Context, port identifier and channel identifier are unused for host.
packetData, err = icahost.IBCModule{}.UnmarshalPacketData(suite.chainA.GetContext(), "", "", invalidPacketData)
suite.Require().Error(err)
suite.Require().Nil(packetData)
}
4 changes: 2 additions & 2 deletions modules/apps/29-fee/ibc_middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -472,11 +472,11 @@ func (im IBCMiddleware) GetAppVersion(ctx sdk.Context, portID, channelID string)
// UnmarshalPacketData attempts to use the underlying app to unmarshal the packet data.
// If the underlying app does not support the PacketDataUnmarshaler interface, an error is returned.
// This function implements the optional PacketDataUnmarshaler interface required for ADR 008 support.
func (im IBCMiddleware) UnmarshalPacketData(bz []byte) (interface{}, error) {
func (im IBCMiddleware) UnmarshalPacketData(ctx sdk.Context, portID, channelID string, bz []byte) (interface{}, error) {
unmarshaler, ok := im.app.(porttypes.PacketDataUnmarshaler)
if !ok {
return nil, errorsmod.Wrapf(types.ErrUnsupportedAction, "underlying app does not implement %T", (*porttypes.PacketDataUnmarshaler)(nil))
}

return unmarshaler.UnmarshalPacketData(bz)
return unmarshaler.UnmarshalPacketData(ctx, portID, channelID, bz)
}
5 changes: 3 additions & 2 deletions modules/apps/29-fee/ibc_middleware_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1573,7 +1573,7 @@ func (suite *FeeTestSuite) TestPacketDataUnmarshalerInterface() {
feeModule, ok := cbs.(porttypes.PacketDataUnmarshaler)
suite.Require().True(ok)

packetData, err := feeModule.UnmarshalPacketData(ibcmock.MockPacketData)
packetData, err := feeModule.UnmarshalPacketData(suite.chainA.GetContext(), "", "", ibcmock.MockPacketData)
DimitrisJim marked this conversation as resolved.
Show resolved Hide resolved
suite.Require().NoError(err)
suite.Require().Equal(ibcmock.MockPacketData, packetData)
}
Expand All @@ -1582,7 +1582,8 @@ func (suite *FeeTestSuite) TestPacketDataUnmarshalerInterfaceError() {
// test the case when the underlying application cannot be casted to a PacketDataUnmarshaler
mockFeeMiddleware := ibcfee.NewIBCMiddleware(nil, feekeeper.Keeper{})

_, err := mockFeeMiddleware.UnmarshalPacketData(ibcmock.MockPacketData)
// Context, port identifier, channel identifier are not used in mockFeeMiddleware.
_, err := mockFeeMiddleware.UnmarshalPacketData(suite.chainA.GetContext(), "", "", ibcmock.MockPacketData)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

can add mock values in all of these if people prefer

Copy link
Contributor

Choose a reason for hiding this comment

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

think it's fine, we can make sure to add good tests in transfer with the different values instead.

Copy link
Contributor

Choose a reason for hiding this comment

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

no preference, happy as is

expError := errorsmod.Wrapf(types.ErrUnsupportedAction, "underlying app does not implement %T", (*porttypes.PacketDataUnmarshaler)(nil))
suite.Require().ErrorIs(err, expError)
}
15 changes: 12 additions & 3 deletions modules/apps/callbacks/callbacks_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (

"cosmossdk.io/log"
sdkmath "cosmossdk.io/math"
storetypes "cosmossdk.io/store/types"

simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims"
sdk "github.com/cosmos/cosmos-sdk/types"
Expand All @@ -24,6 +25,7 @@ import (
icatypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/types"
feetypes "github.com/cosmos/ibc-go/v8/modules/apps/29-fee/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"
ibctesting "github.com/cosmos/ibc-go/v8/testing"
Expand Down Expand Up @@ -291,17 +293,24 @@ func (s *CallbacksTestSuite) AssertHasExecutedExpectedCallbackWithFee(

// GetExpectedEvent returns the expected event for a callback.
func GetExpectedEvent(
packetDataUnmarshaler porttypes.PacketDataUnmarshaler, remainingGas uint64, data []byte, srcPortID,
ctx sdk.Context, packetDataUnmarshaler porttypes.PacketDataUnmarshaler, remainingGas uint64, data []byte, srcPortID,
eventPortID, eventChannelID string, seq uint64, callbackType types.CallbackType, expError error,
) (abci.Event, bool) {
var (
callbackData types.CallbackData
err error
)

// Set up gas meter with remainingGas.
gasMeter := storetypes.NewGasMeter(remainingGas)
ctx = ctx.WithGasMeter(gasMeter)

// Mock packet.
packet := channeltypes.NewPacket(data, 0, srcPortID, "", "", "", clienttypes.ZeroHeight(), 0)
if callbackType == types.CallbackTypeReceivePacket {
callbackData, err = types.GetDestCallbackData(packetDataUnmarshaler, data, srcPortID, remainingGas, maxCallbackGas)
callbackData, err = types.GetDestCallbackData(ctx, packetDataUnmarshaler, packet, maxCallbackGas)
} else {
callbackData, err = types.GetSourceCallbackData(packetDataUnmarshaler, data, srcPortID, remainingGas, maxCallbackGas)
callbackData, err = types.GetSourceCallbackData(ctx, packetDataUnmarshaler, packet, maxCallbackGas)
}
if err != nil {
return abci.Event{}, false
Expand Down
20 changes: 13 additions & 7 deletions modules/apps/callbacks/ibc_middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@ func (im IBCMiddleware) SendPacket(
return 0, err
}

callbackData, err := types.GetSourceCallbackData(im.app, data, sourcePort, ctx.GasMeter().GasRemaining(), im.maxCallbackGas)
packet := channeltypes.NewPacket(data, seq, sourcePort, sourceChannel, "", "", timeoutHeight, timeoutTimestamp)
DimitrisJim marked this conversation as resolved.
Show resolved Hide resolved
callbackData, err := types.GetSourceCallbackData(ctx, im.app, packet, im.maxCallbackGas)
// SendPacket is not blocked if the packet does not opt-in to callbacks
if err != nil {
return seq, nil
Expand Down Expand Up @@ -138,7 +139,7 @@ func (im IBCMiddleware) OnAcknowledgementPacket(
}

callbackData, err := types.GetSourceCallbackData(
im.app, packet.GetData(), packet.GetSourcePort(), ctx.GasMeter().GasRemaining(), im.maxCallbackGas,
ctx, im.app, packet, im.maxCallbackGas,
)
// OnAcknowledgementPacket is not blocked if the packet does not opt-in to callbacks
if err != nil {
Expand Down Expand Up @@ -172,7 +173,7 @@ func (im IBCMiddleware) OnTimeoutPacket(ctx sdk.Context, packet channeltypes.Pac
}

callbackData, err := types.GetSourceCallbackData(
im.app, packet.GetData(), packet.GetSourcePort(), ctx.GasMeter().GasRemaining(), im.maxCallbackGas,
ctx, im.app, packet, im.maxCallbackGas,
)
// OnTimeoutPacket is not blocked if the packet does not opt-in to callbacks
if err != nil {
Expand Down Expand Up @@ -208,7 +209,7 @@ func (im IBCMiddleware) OnRecvPacket(ctx sdk.Context, packet channeltypes.Packet
}

callbackData, err := types.GetDestCallbackData(
im.app, packet.GetData(), packet.GetSourcePort(), ctx.GasMeter().GasRemaining(), im.maxCallbackGas,
ctx, im.app, packet, im.maxCallbackGas,
)
// OnRecvPacket is not blocked if the packet does not opt-in to callbacks
if err != nil {
Expand Down Expand Up @@ -245,8 +246,13 @@ func (im IBCMiddleware) WriteAcknowledgement(
return err
}

chanPacket, ok := packet.(channeltypes.Packet)
if !ok {
panic(fmt.Errorf("expected type %T, got %T", &channeltypes.Packet{}, packet))
}

callbackData, err := types.GetDestCallbackData(
im.app, packet.GetData(), packet.GetSourcePort(), ctx.GasMeter().GasRemaining(), im.maxCallbackGas,
ctx, im.app, chanPacket, im.maxCallbackGas,
)
// WriteAcknowledgement is not blocked if the packet does not opt-in to callbacks
if err != nil {
Expand Down Expand Up @@ -417,6 +423,6 @@ func (im IBCMiddleware) GetAppVersion(ctx sdk.Context, portID, channelID string)

// UnmarshalPacketData defers to the underlying app to unmarshal the packet data.
// This function implements the optional PacketDataUnmarshaler interface.
func (im IBCMiddleware) UnmarshalPacketData(bz []byte) (interface{}, error) {
return im.app.UnmarshalPacketData(bz)
func (im IBCMiddleware) UnmarshalPacketData(ctx sdk.Context, portID, channelID string, bz []byte) (interface{}, error) {
return im.app.UnmarshalPacketData(ctx, portID, channelID, bz)
}
14 changes: 7 additions & 7 deletions modules/apps/callbacks/ibc_middleware_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ func (s *CallbacksTestSuite) TestSendPacket() {
s.Require().Equal(uint64(1), seq)

expEvent, exists := GetExpectedEvent(
transferICS4Wrapper.(porttypes.PacketDataUnmarshaler), gasLimit, packetData.GetBytes(), s.path.EndpointA.ChannelConfig.PortID,
ctx, transferICS4Wrapper.(porttypes.PacketDataUnmarshaler), gasLimit, packetData.GetBytes(), s.path.EndpointA.ChannelConfig.PortID,
s.path.EndpointA.ChannelConfig.PortID, s.path.EndpointA.ChannelID, seq, types.CallbackTypeSendPacket, nil,
)
if exists {
Expand Down Expand Up @@ -381,7 +381,7 @@ func (s *CallbacksTestSuite) TestOnAcknowledgementPacket() {
s.Require().Equal(uint8(1), sourceStatefulCounter)

expEvent, exists := GetExpectedEvent(
transferStack.(porttypes.PacketDataUnmarshaler), gasLimit, packet.Data, packet.SourcePort,
ctx, transferStack.(porttypes.PacketDataUnmarshaler), gasLimit, packet.Data, packet.SourcePort,
packet.SourcePort, packet.SourceChannel, packet.Sequence, types.CallbackTypeAcknowledgementPacket, nil,
)
s.Require().True(exists)
Expand Down Expand Up @@ -543,7 +543,7 @@ func (s *CallbacksTestSuite) TestOnTimeoutPacket() {
s.Require().Equal(uint8(2), sourceStatefulCounter)

expEvent, exists := GetExpectedEvent(
transferStack.(porttypes.PacketDataUnmarshaler), gasLimit, packet.Data, packet.SourcePort,
ctx, transferStack.(porttypes.PacketDataUnmarshaler), gasLimit, packet.Data, packet.SourcePort,
packet.SourcePort, packet.SourceChannel, packet.Sequence, types.CallbackTypeTimeoutPacket, nil,
)
s.Require().True(exists)
Expand Down Expand Up @@ -712,7 +712,7 @@ func (s *CallbacksTestSuite) TestOnRecvPacket() {
s.Require().Equal(uint8(1), destStatefulCounter)

expEvent, exists := GetExpectedEvent(
transferStack.(porttypes.PacketDataUnmarshaler), gasLimit, packet.Data, packet.SourcePort,
ctx, transferStack.(porttypes.PacketDataUnmarshaler), gasLimit, packet.Data, packet.SourcePort,
packet.DestinationPort, packet.DestinationChannel, packet.Sequence, types.CallbackTypeReceivePacket, nil,
)
s.Require().True(exists)
Expand Down Expand Up @@ -814,7 +814,7 @@ func (s *CallbacksTestSuite) TestWriteAcknowledgement() {
s.Require().NoError(err)

expEvent, exists := GetExpectedEvent(
transferICS4Wrapper.(porttypes.PacketDataUnmarshaler), gasLimit, packet.Data, packet.SourcePort,
ctx, transferICS4Wrapper.(porttypes.PacketDataUnmarshaler), gasLimit, packet.Data, packet.SourcePort,
packet.DestinationPort, packet.DestinationChannel, packet.Sequence, types.CallbackTypeReceivePacket, nil,
)
if exists {
Expand Down Expand Up @@ -1005,13 +1005,13 @@ func (s *CallbacksTestSuite) TestUnmarshalPacketData() {

// Unmarshal ICS20 v1 packet data
data := expPacketDataICS20V1.GetBytes()
packetData, err := unmarshalerStack.UnmarshalPacketData(data)
packetData, err := unmarshalerStack.UnmarshalPacketData(s.chainA.GetContext(), "", "", data)
DimitrisJim marked this conversation as resolved.
Show resolved Hide resolved
s.Require().NoError(err)
s.Require().Equal(expPacketDataICS20V2, packetData)

// Unmarshal ICS20 v1 packet data
data = expPacketDataICS20V2.GetBytes()
packetData, err = unmarshalerStack.UnmarshalPacketData(data)
packetData, err = unmarshalerStack.UnmarshalPacketData(s.chainA.GetContext(), "", "", data)
s.Require().NoError(err)
s.Require().Equal(expPacketDataICS20V2, packetData)
}
Expand Down
35 changes: 23 additions & 12 deletions modules/apps/callbacks/types/callbacks.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ import (

errorsmod "cosmossdk.io/errors"

sdk "github.com/cosmos/cosmos-sdk/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"
ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported"
)
Expand Down Expand Up @@ -67,35 +70,43 @@ type CallbackData struct {

// GetSourceCallbackData parses the packet data and returns the source callback data.
func GetSourceCallbackData(
ctx sdk.Context,
packetDataUnmarshaler porttypes.PacketDataUnmarshaler,
data []byte, srcPortID string, remainingGas uint64, maxGas uint64,
packet channeltypes.Packet,
maxGas uint64,
) (CallbackData, error) {
return getCallbackData(packetDataUnmarshaler, data, srcPortID, remainingGas, maxGas, SourceCallbackKey)
packetData, err := packetDataUnmarshaler.UnmarshalPacketData(ctx, packet.GetSourcePort(), packet.GetSourceChannel(), packet.GetData())
if err != nil {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

took liberty of moving these out of getCallbackData so as to not have additional if there that seemed messier. It also made the sig a bit easier to parse imo.

return CallbackData{}, errorsmod.Wrap(ErrCannotUnmarshalPacketData, err.Error())
}

return getCallbackData(packetData, packet.GetSourcePort(), ctx.GasMeter().GasRemaining(), maxGas, SourceCallbackKey)
}

// GetDestCallbackData parses the packet data and returns the destination callback data.
func GetDestCallbackData(
ctx sdk.Context,
packetDataUnmarshaler porttypes.PacketDataUnmarshaler,
data []byte, srcPortID string, remainingGas, maxGas uint64,
packet channeltypes.Packet, maxGas uint64,
) (CallbackData, error) {
return getCallbackData(packetDataUnmarshaler, data, srcPortID, remainingGas, maxGas, DestinationCallbackKey)
packetData, err := packetDataUnmarshaler.UnmarshalPacketData(ctx, packet.GetDestPort(), packet.GetDestChannel(), packet.GetData())
if err != nil {
return CallbackData{}, errorsmod.Wrap(ErrCannotUnmarshalPacketData, err.Error())
}

return getCallbackData(packetData, packet.GetSourcePort(), ctx.GasMeter().GasRemaining(), maxGas, DestinationCallbackKey)
}

// getCallbackData parses the packet data and returns the callback data.
// It also checks that the remaining gas is greater than the gas limit specified in the packet data.
// The addressGetter and gasLimitGetter functions are used to retrieve the callback
// address and gas limit from the callback data.
func getCallbackData(
packetDataUnmarshaler porttypes.PacketDataUnmarshaler,
data []byte, srcPortID string, remainingGas,
packetData interface{},
srcPortID string,
remainingGas,
maxGas uint64, callbackKey string,
) (CallbackData, error) {
// unmarshal packet data
packetData, err := packetDataUnmarshaler.UnmarshalPacketData(data)
if err != nil {
return CallbackData{}, errorsmod.Wrap(ErrCannotUnmarshalPacketData, err.Error())
}

packetDataProvider, ok := packetData.(ibcexported.PacketDataProvider)
if !ok {
return CallbackData{}, ErrNotPacketDataProvider
Expand Down
24 changes: 21 additions & 3 deletions modules/apps/callbacks/types/callbacks_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,17 @@ package types_test
import (
"fmt"

storetypes "cosmossdk.io/store/types"

sdk "github.com/cosmos/cosmos-sdk/types"

"github.com/cometbft/cometbft/crypto/secp256k1"

"github.com/cosmos/ibc-go/modules/apps/callbacks/types"
"github.com/cosmos/ibc-go/v8/modules/apps/transfer"
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"
ibctesting "github.com/cosmos/ibc-go/v8/testing"
ibcmock "github.com/cosmos/ibc-go/v8/testing/mock"
Expand Down Expand Up @@ -277,7 +281,12 @@ func (s *CallbacksTypesTestSuite) TestGetCallbackData() {

tc.malleate()

callbackData, err := types.GetCallbackData(packetDataUnmarshaler, packetData, ibcmock.PortID, remainingGas, uint64(1_000_000), callbackKey)
// Set up gas meter for context.
gasMeter := storetypes.NewGasMeter(remainingGas)
ctx := s.chain.GetContext().WithGasMeter(gasMeter)

packet := channeltypes.NewPacket(packetData, 0, ibcmock.PortID, "", "", "", clienttypes.ZeroHeight(), 0)
callbackData, err := types.GetCallbackData(ctx, packetDataUnmarshaler, packet, remainingGas, uint64(1_000_000), callbackKey)

expPass := tc.expError == nil
if expPass {
Expand Down Expand Up @@ -315,7 +324,12 @@ func (s *CallbacksTypesTestSuite) TestGetSourceCallbackDataTransfer() {

packetUnmarshaler := transfer.IBCModule{}

callbackData, err := types.GetSourceCallbackData(packetUnmarshaler, packetDataBytes, ibcmock.PortID, 2_000_000, 1_000_000)
// Set up gas meter for context.
gasMeter := storetypes.NewGasMeter(2_000_000)
ctx := s.chain.GetContext().WithGasMeter(gasMeter)

packet := channeltypes.NewPacket(packetDataBytes, 0, ibcmock.PortID, "", "", "", clienttypes.ZeroHeight(), 0)
callbackData, err := types.GetSourceCallbackData(ctx, packetUnmarshaler, packet, 1_000_000)
s.Require().NoError(err)
s.Require().Equal(expCallbackData, callbackData)
}
Expand All @@ -342,7 +356,11 @@ func (s *CallbacksTypesTestSuite) TestGetDestCallbackDataTransfer() {

packetUnmarshaler := transfer.IBCModule{}

callbackData, err := types.GetDestCallbackData(packetUnmarshaler, packetDataBytes, ibcmock.PortID, 2_000_000, 1_000_000)
gasMeter := storetypes.NewGasMeter(2_000_000)
ctx := s.chain.GetContext().WithGasMeter(gasMeter)

packet := channeltypes.NewPacket(packetDataBytes, 0, ibcmock.PortID, "", "", "", clienttypes.ZeroHeight(), 0)
callbackData, err := types.GetDestCallbackData(ctx, packetUnmarshaler, packet, 1_000_000)
s.Require().NoError(err)
s.Require().Equal(expCallbackData, callbackData)
}
Expand Down
Loading
Loading