-
Notifications
You must be signed in to change notification settings - Fork 342
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(delayedack): added efficient query for pending packets by addr (#…
- Loading branch information
Showing
28 changed files
with
595 additions
and
1,096 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package apptesting | ||
|
||
import ( | ||
"testing" | ||
|
||
transfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" | ||
channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" | ||
"github.com/stretchr/testify/require" | ||
|
||
commontypes "github.com/dymensionxyz/dymension/v3/x/common/types" | ||
) | ||
|
||
const ( | ||
TestPacketReceiver = "testReceiver" | ||
TestPacketSender = "testSender" | ||
) | ||
|
||
func GenerateTestPacketData(t *testing.T) []byte { | ||
t.Helper() | ||
data := &transfertypes.FungibleTokenPacketData{ | ||
Receiver: TestPacketReceiver, | ||
Sender: TestPacketSender, | ||
} | ||
pd, err := transfertypes.ModuleCdc.MarshalJSON(data) | ||
require.NoError(t, err) | ||
return pd | ||
} | ||
|
||
func GenerateTestPacket(t *testing.T, sequence uint64) *channeltypes.Packet { | ||
t.Helper() | ||
return &channeltypes.Packet{ | ||
SourcePort: "testSourcePort", | ||
SourceChannel: "testSourceChannel", | ||
DestinationPort: "testDestinationPort", | ||
DestinationChannel: "testDestinationChannel", | ||
Data: GenerateTestPacketData(t), | ||
Sequence: sequence, | ||
} | ||
} | ||
|
||
func GenerateRollappPackets(t *testing.T, rollappId string, num uint64) []commontypes.RollappPacket { | ||
t.Helper() | ||
var packets []commontypes.RollappPacket | ||
for i := uint64(0); i < num; i++ { | ||
packets = append(packets, commontypes.RollappPacket{ | ||
RollappId: rollappId, | ||
Packet: GenerateTestPacket(t, i), | ||
Status: commontypes.Status_PENDING, | ||
ProofHeight: i, | ||
}) | ||
} | ||
return packets | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.