forked from cosmos/cosmos-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add domain separation between port and channel (cosmos#7960)
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
- Loading branch information
1 parent
a7435d0
commit 03c8fb3
Showing
2 changed files
with
27 additions
and
1 deletion.
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
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,24 @@ | ||
package types_test | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/require" | ||
|
||
"github.com/cosmos/cosmos-sdk/x/ibc/applications/transfer/types" | ||
) | ||
|
||
// Test that there is domain separation between the port id and the channel id otherwise an | ||
// escrow address may overlap with another channel end | ||
func TestGetEscrowAddress(t *testing.T) { | ||
var ( | ||
port1 = "transfer" | ||
channel1 = "channel" | ||
port2 = "transfercha" | ||
channel2 = "nnel" | ||
) | ||
|
||
escrow1 := types.GetEscrowAddress(port1, channel1) | ||
escrow2 := types.GetEscrowAddress(port2, channel2) | ||
require.NotEqual(t, escrow1, escrow2) | ||
} |