Skip to content

Commit 512d1b2

Browse files
Merge branch 'release/v10.0.x' into 08-wasm/release/v0.6.x+ibc-go-v10.0.x-wasmvm-v2.2.x
2 parents d9f2f88 + 0b45a17 commit 512d1b2

File tree

7 files changed

+132
-5
lines changed

7 files changed

+132
-5
lines changed

Makefile

+3
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,9 @@ clean:
139139
build-docker-wasm:
140140
./scripts/build-wasm-simapp-docker.sh $(tag)
141141

142+
build-docker-local:
143+
docker build -t ghcr.io/cosmos/ibc-go-simd:local --build-arg IBC_GO_VERSION=local .
144+
142145
.PHONY: build-docker-wasm
143146

144147
###############################################################################

e2e/testsuite/query/queries.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import (
2121
ibcexported "github.com/cosmos/ibc-go/v10/modules/core/exported"
2222
)
2323

24-
const queryPathTransferDenoms = "/ibc.applications.transfer.v2.QueryV2/Denoms"
24+
const queryPathTransferDenoms = "/ibc.applications.transfer.v1.Query/Denoms"
2525

2626
// ModuleAccountAddress returns the address of the given module on the given chain.
2727
// Added because interchaintest's method doesn't work.

modules/apps/transfer/ibc_module.go

+6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package transfer
22

33
import (
4+
"bytes"
45
"fmt"
56
"math"
67
"slices"
@@ -231,6 +232,11 @@ func (im IBCModule) OnAcknowledgementPacket(
231232
return err
232233
}
233234

235+
bz := types.ModuleCdc.MustMarshalJSON(&ack)
236+
if !bytes.Equal(bz, acknowledgement) {
237+
return errorsmod.Wrapf(ibcerrors.ErrInvalidType, "acknowledgement did not marshal to expected bytes: %X ≠ %X", bz, acknowledgement)
238+
}
239+
234240
if err := im.keeper.OnAcknowledgementPacket(ctx, packet.SourcePort, packet.SourceChannel, data, ack); err != nil {
235241
return err
236242
}

modules/apps/transfer/ibc_module_test.go

+118
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,124 @@ func (suite *TransferTestSuite) TestOnRecvPacket() {
348348
}
349349
}
350350

351+
func (suite *TransferTestSuite) TestOnAcknowledgePacket() {
352+
var (
353+
path *ibctesting.Path
354+
packet channeltypes.Packet
355+
ack []byte
356+
)
357+
358+
testCases := []struct {
359+
name string
360+
malleate func()
361+
expError error
362+
expRefund bool
363+
}{
364+
{
365+
"success",
366+
func() {},
367+
nil,
368+
false,
369+
},
370+
{
371+
"success: refund coins",
372+
func() {
373+
ack = channeltypes.NewErrorAcknowledgement(ibcerrors.ErrInsufficientFunds).Acknowledgement()
374+
},
375+
nil,
376+
true,
377+
},
378+
{
379+
"cannot refund ack on non-existent channel",
380+
func() {
381+
ack = channeltypes.NewErrorAcknowledgement(ibcerrors.ErrInsufficientFunds).Acknowledgement()
382+
383+
packet.SourceChannel = "channel-100"
384+
},
385+
errors.New("unable to unescrow tokens"),
386+
false,
387+
},
388+
{
389+
"invalid packet data",
390+
func() {
391+
packet.Data = []byte("invalid data")
392+
},
393+
ibcerrors.ErrInvalidType,
394+
false,
395+
},
396+
{
397+
"invalid acknowledgement",
398+
func() {
399+
ack = []byte("invalid ack")
400+
},
401+
ibcerrors.ErrUnknownRequest,
402+
false,
403+
},
404+
{
405+
"cannot refund already acknowledged packet",
406+
func() {
407+
ack = channeltypes.NewErrorAcknowledgement(ibcerrors.ErrInsufficientFunds).Acknowledgement()
408+
409+
cbs, ok := suite.chainA.App.GetIBCKeeper().PortKeeper.Route(ibctesting.TransferPort)
410+
suite.Require().True(ok)
411+
412+
suite.Require().NoError(cbs.OnAcknowledgementPacket(suite.chainA.GetContext(), path.EndpointA.GetChannel().Version, packet, ack, suite.chainA.SenderAccount.GetAddress()))
413+
},
414+
errors.New("unable to unescrow tokens"),
415+
false,
416+
},
417+
}
418+
419+
for _, tc := range testCases {
420+
tc := tc
421+
suite.Run(tc.name, func() {
422+
suite.SetupTest() // reset
423+
424+
path = ibctesting.NewTransferPath(suite.chainA, suite.chainB)
425+
path.Setup()
426+
427+
timeoutHeight := suite.chainA.GetTimeoutHeight()
428+
msg := types.NewMsgTransfer(
429+
path.EndpointA.ChannelConfig.PortID,
430+
path.EndpointA.ChannelID,
431+
ibctesting.TestCoin,
432+
suite.chainA.SenderAccount.GetAddress().String(),
433+
suite.chainB.SenderAccount.GetAddress().String(),
434+
timeoutHeight,
435+
0,
436+
"",
437+
)
438+
res, err := suite.chainA.SendMsgs(msg)
439+
suite.Require().NoError(err) // message committed
440+
441+
packet, err = ibctesting.ParsePacketFromEvents(res.Events)
442+
suite.Require().NoError(err)
443+
444+
cbs, ok := suite.chainA.App.GetIBCKeeper().PortKeeper.Route(ibctesting.TransferPort)
445+
suite.Require().True(ok)
446+
447+
ack = channeltypes.NewResultAcknowledgement([]byte{byte(1)}).Acknowledgement()
448+
449+
tc.malleate() // change fields in packet
450+
451+
err = cbs.OnAcknowledgementPacket(suite.chainA.GetContext(), path.EndpointA.GetChannel().Version, packet, ack, suite.chainA.SenderAccount.GetAddress())
452+
453+
if tc.expError == nil {
454+
suite.Require().NoError(err)
455+
456+
if tc.expRefund {
457+
escrowAddress := types.GetEscrowAddress(packet.GetSourcePort(), packet.GetSourceChannel())
458+
escrowBalanceAfter := suite.chainA.GetSimApp().BankKeeper.GetBalance(suite.chainA.GetContext(), escrowAddress, sdk.DefaultBondDenom)
459+
suite.Require().Equal(sdkmath.NewInt(0), escrowBalanceAfter.Amount)
460+
}
461+
} else {
462+
suite.Require().Error(err)
463+
suite.Require().Contains(err.Error(), tc.expError.Error())
464+
}
465+
})
466+
}
467+
}
468+
351469
func (suite *TransferTestSuite) TestOnTimeoutPacket() {
352470
var path *ibctesting.Path
353471
var packet channeltypes.Packet

modules/apps/transfer/types/packet.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ func UnmarshalPacketData(bz []byte, ics20Version string, encoding string) (Inter
252252
return InternalTransferRepresentation{}, errorsmod.Wrapf(ibcerrors.ErrInvalidType, failedUnmarshalingErrorMsg, errorMsgVersion, err.Error())
253253
}
254254
default:
255-
return InternalTransferRepresentation{}, errorsmod.Wrapf(ibcerrors.ErrInvalidType, "invalid encoding provided, must be either empty or one of [%q, %q], got %s", EncodingJSON, EncodingProtobuf, encoding)
255+
return InternalTransferRepresentation{}, errorsmod.Wrapf(ibcerrors.ErrInvalidType, "invalid encoding provided, must be either empty or one of [%q, %q, %q], got %s", EncodingJSON, EncodingProtobuf, EncodingABI, encoding)
256256
}
257257

258258
// When the unmarshaling is done, we want to retrieve the underlying data type based on the value of ics20Version

modules/light-clients/08-wasm/go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ require (
2525
github.com/cosmos/cosmos-sdk v0.50.11
2626
github.com/cosmos/gogoproto v1.7.0
2727
github.com/cosmos/ibc-go/modules/light-clients/08-wasm/blsverifier v0.0.0-20250221115439-3e6d5f597fc4
28-
github.com/cosmos/ibc-go/v10 v10.0.0-beta.1
28+
github.com/cosmos/ibc-go/v10 v10.0.0-beta.2
2929
github.com/golang/protobuf v1.5.4
3030
github.com/grpc-ecosystem/grpc-gateway v1.16.0
3131
github.com/spf13/cast v1.7.1

modules/light-clients/08-wasm/go.sum

+2-2
Original file line numberDiff line numberDiff line change
@@ -372,8 +372,8 @@ github.com/cosmos/iavl v1.2.2 h1:qHhKW3I70w+04g5KdsdVSHRbFLgt3yY3qTMd4Xa4rC8=
372372
github.com/cosmos/iavl v1.2.2/go.mod h1:GiM43q0pB+uG53mLxLDzimxM9l/5N9UuSY3/D0huuVw=
373373
github.com/cosmos/ibc-go/modules/light-clients/08-wasm/blsverifier v0.0.0-20250221115439-3e6d5f597fc4 h1:BkEGLjjtXTKYSz15vdjZi++sOaxuBI5zjVW6gdKR+Yc=
374374
github.com/cosmos/ibc-go/modules/light-clients/08-wasm/blsverifier v0.0.0-20250221115439-3e6d5f597fc4/go.mod h1:G22E25VpQ6ctcDNeZYY7F2k+yR/4eLDUSO0Lxb5WjA0=
375-
github.com/cosmos/ibc-go/v10 v10.0.0-beta.1 h1:IPAKp0ySxpkBCwzhaaVhbwTGZFnIm2Qq6owD6LW2Dvo=
376-
github.com/cosmos/ibc-go/v10 v10.0.0-beta.1/go.mod h1:ikF0o+cl0V7jwwe74fceRD5N2T7yfpRZju2fVJDdcu8=
375+
github.com/cosmos/ibc-go/v10 v10.0.0-beta.2 h1:klst7EqzGK5LVuZxTn6Vcj7GD+H1hKuSzj78VVPvo44=
376+
github.com/cosmos/ibc-go/v10 v10.0.0-beta.2/go.mod h1:ikF0o+cl0V7jwwe74fceRD5N2T7yfpRZju2fVJDdcu8=
377377
github.com/cosmos/ics23/go v0.11.0 h1:jk5skjT0TqX5e5QJbEnwXIS2yI2vnmLOgpQPeM5RtnU=
378378
github.com/cosmos/ics23/go v0.11.0/go.mod h1:A8OjxPE67hHST4Icw94hOxxFEJMBG031xIGF/JHNIY0=
379379
github.com/cosmos/ledger-cosmos-go v0.13.3 h1:7ehuBGuyIytsXbd4MP43mLeoN2LTOEnk5nvue4rK+yM=

0 commit comments

Comments
 (0)