packet_key_test.gno
1.35 Kb · 33 lines
1package host_test
2
3import (
4 "encoding/hex"
5 "testing"
6
7 "gno.land/p/aib/ibc/host"
8 "gno.land/p/nt/urequire/v0"
9)
10
11// TestPacketCommitmentKey is primarily used to document the expected key output
12// so that other implementations (such as the IBC Solidity) can replicate the
13// same key output. But it is also useful to catch any changes in the keys.
14func TestPacketCommitmentKey(t *testing.T) {
15 actual := hex.EncodeToString(host.PacketCommitmentKey("channel-0", 1))
16 urequire.Equal(t, "6368616e6e656c2d30010000000000000001", actual)
17}
18
19// TestPacketReceiptKey is primarily used to document the expected key output
20// so that other implementations (such as the IBC Solidity) can replicate the
21// same key output. But it is also useful to catch any changes in the keys.
22func TestPacketReceiptKey(t *testing.T) {
23 actual := hex.EncodeToString(host.PacketReceiptKey("channel-0", 1))
24 urequire.Equal(t, "6368616e6e656c2d30020000000000000001", actual)
25}
26
27// TestPacketAcknowledgementKey is primarily used to document the expected key output
28// so that other implementations (such as the IBC Solidity) can replicate the
29// same key output. But it is also useful to catch any changes in the keys.
30func TestPacketAcknowledgementKey(t *testing.T) {
31 actual := hex.EncodeToString(host.PacketAcknowledgementKey("channel-0", 1))
32 urequire.Equal(t, "6368616e6e656c2d30030000000000000001", actual)
33}