From ad3ea6932b647ebb520004464df566f1c9492182 Mon Sep 17 00:00:00 2001 From: Thomas Bruyelle Date: Mon, 9 Oct 2023 15:37:17 +0200 Subject: [PATCH 1/3] upgrade packetSniffer to latest ABCIListener API --- tests/integration/setup.go | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/tests/integration/setup.go b/tests/integration/setup.go index f3cc6ae7f7..6b30742286 100644 --- a/tests/integration/setup.go +++ b/tests/integration/setup.go @@ -3,7 +3,6 @@ package integration import ( "context" "fmt" - "sync" "testing" transfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" @@ -167,7 +166,9 @@ func (s *CCVTestSuite) registerPacketSniffer(chain *ibctesting.TestChain) { s.packetSniffers = make(map[*ibctesting.TestChain]*packetSniffer) } p := newPacketSniffer() - chain.App.GetBaseApp().SetStreamingManager(p) + chain.App.GetBaseApp().SetStreamingManager(store.StreamingManager{ + ABCIListeners: []store.ABCIListener{p}, + }) s.packetSniffers[chain] = p } @@ -380,8 +381,7 @@ type packetSniffer struct { packets map[string]channeltypes.Packet } -// TODO: @MSalopek this was deprecated, figure out how to use it or ask @tbruyelle -// var _ baseapp.StreamingService = &packetSniffer{} +var _ store.ABCIListener = &packetSniffer{} func newPacketSniffer() *packetSniffer { return &packetSniffer{ @@ -408,10 +408,6 @@ func (*packetSniffer) ListenCommit(ctx context.Context, res abci.ResponseCommit, return nil } -func (*packetSniffer) Close() error { return nil } -func (*packetSniffer) Listeners() map[store.StoreKey][]store.ABCIListener { return nil } -func (*packetSniffer) Stream(wg *sync.WaitGroup) error { return nil } - // [legacy simibc method] // ABCIToSDKEvents converts a list of ABCI events to Cosmos SDK events. func ABCIToSDKEvents(abciEvents []abci.Event) sdk.Events { From 031c625bf349e68d78ab8dfd6b0dc38d50943ae4 Mon Sep 17 00:00:00 2001 From: Thomas Bruyelle Date: Mon, 9 Oct 2023 16:45:12 +0200 Subject: [PATCH 2/3] remove unused func ABCIToSDKEvents --- tests/integration/setup.go | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/tests/integration/setup.go b/tests/integration/setup.go index 6b30742286..91a6e9a500 100644 --- a/tests/integration/setup.go +++ b/tests/integration/setup.go @@ -390,7 +390,6 @@ func newPacketSniffer() *packetSniffer { } func (ps *packetSniffer) ListenFinalizeBlock(ctx context.Context, req abci.RequestFinalizeBlock, res abci.ResponseFinalizeBlock) error { - // TODO: @MSalopek this was deprecated, figure out how to use it packets := ParsePacketsFromEvents(res.GetEvents()) for _, packet := range packets { ps.packets[getSentPacketKey(packet.Sequence, packet.SourceChannel)] = packet @@ -408,25 +407,7 @@ func (*packetSniffer) ListenCommit(ctx context.Context, res abci.ResponseCommit, return nil } -// [legacy simibc method] -// ABCIToSDKEvents converts a list of ABCI events to Cosmos SDK events. -func ABCIToSDKEvents(abciEvents []abci.Event) sdk.Events { - var events sdk.Events - for _, evt := range abciEvents { - var attributes []sdk.Attribute - for _, attr := range evt.GetAttributes() { - attributes = append(attributes, sdk.NewAttribute(attr.Key, attr.Value)) - } - - events = events.AppendEvent(sdk.NewEvent(evt.GetType(), attributes...)) - } - - return events -} - -// [legacy simibc method] // ParsePacketsFromEvents returns all packets found in events. -// func ParsePacketsFromEvents(events []sdk.Event) (packets []channeltypes.Packet) { func ParsePacketsFromEvents(events []abci.Event) (packets []channeltypes.Packet) { for i, ev := range events { if ev.Type == channeltypes.EventTypeSendPacket { From 5c531379b85eaac8f927fb9f3598d97578940887 Mon Sep 17 00:00:00 2001 From: Thomas Bruyelle Date: Wed, 18 Oct 2023 14:29:59 +0200 Subject: [PATCH 3/3] fix missing arg --- tests/integration/common.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/integration/common.go b/tests/integration/common.go index 13488bd7e6..66fd79c6eb 100644 --- a/tests/integration/common.go +++ b/tests/integration/common.go @@ -373,7 +373,7 @@ func checkRedelegationEntryCompletionTime( func getStakingUnbondingDelegationEntry(ctx sdk.Context, k testutil.TestStakingKeeper, id uint64) (stakingUnbondingOp stakingtypes.UnbondingDelegationEntry, found bool) { stakingUbd, err := k.GetUnbondingDelegationByUnbondingID(ctx, id) if err != nil { - panic(fmt.Sprintf("could not get unbonding delegation", err)) + panic(fmt.Sprintf("could not get unbonding delegation: %v", err)) } found = false