Skip to content

Commit

Permalink
wip: tbruyelle commits
Browse files Browse the repository at this point in the history
  • Loading branch information
MSalopek committed Nov 3, 2023
1 parent a73a06c commit 49f413a
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 24 deletions.
2 changes: 1 addition & 1 deletion tests/integration/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
49 changes: 26 additions & 23 deletions tests/integration/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package integration
import (
"context"
"fmt"
"sync"
"testing"

storetypes "cosmossdk.io/store/types"
Expand Down Expand Up @@ -172,9 +171,11 @@ func (s *CCVTestSuite) registerPacketSniffer(chain *ibctesting.TestChain) {
s.packetSniffers = make(map[*ibctesting.TestChain]*packetSniffer)
}
p := newPacketSniffer()
listeners := []storetypes.ABCIListener{p}
streamingManager := storetypes.StreamingManager{ABCIListeners: listeners, StopNodeOnErr: true}
chain.App.GetBaseApp().SetStreamingManager(streamingManager)
// listeners := []storetypes.ABCIListener{p}
// streamingManager := storetypes.StreamingManager{ABCIListeners: listeners, StopNodeOnErr: true}
chain.App.GetBaseApp().SetStreamingManager(store.StreamingManager{
ABCIListeners: []store.ABCIListener{p},
})
s.packetSniffers[chain] = p
}

Expand Down Expand Up @@ -381,6 +382,8 @@ func preProposalKeyAssignment(s *CCVTestSuite, chainID string) {
}
}

var _ store.ABCIListener = &packetSniffer{}

// packetSniffer implements the StreamingService interface.
// Implements ListenFinalizeBlock to record packets from events.
type packetSniffer struct {
Expand Down Expand Up @@ -414,25 +417,25 @@ 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 {
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
}
// 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 {
// 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.
Expand Down

0 comments on commit 49f413a

Please sign in to comment.