z7c_recv_packet_filetest.gno
1.41 Kb · 53 lines
1// PKGPATH: gno.land/r/aib/main
2package main
3
4import (
5 "time"
6
7 tmtesting "gno.land/p/aib/ibc/lightclient/tendermint/testing"
8 "gno.land/p/aib/ibc/types"
9 "gno.land/p/aib/ics23"
10 "gno.land/r/aib/ibc/core"
11)
12
13// RecvPacket fails client not found
14func main(cur realm) {
15 var (
16 chainID = "chain-id-2"
17 trustedHeight = types.NewHeight(2, 2)
18 clientState = tmtesting.NewClientState(chainID, trustedHeight)
19 apphash = tmtesting.Hash("apphash")
20 trustedValset = tmtesting.GenValset()
21 consensusState = tmtesting.GenConsensusState(time.Now(), apphash, trustedValset.Hash())
22 )
23 clientID := core.CreateClient(cross(cur), clientState, consensusState)
24 core.RegisterCounterparty(cross(cur), clientID, [][]byte{[]byte("iavlStoreKey"), []byte("prefix2")}, "07-tendermint-2")
25
26 // Receive the packet
27 recvPacket := types.MsgRecvPacket{
28 Packet: types.Packet{
29 Sequence: 1,
30 SourceClient: "source",
31 DestinationClient: "unknown",
32 TimeoutTimestamp: 1,
33 Payloads: []types.Payload{{
34 SourcePort: "appID",
35 DestinationPort: "destinationPort",
36 Encoding: "application/json",
37 Value: []byte("{}"),
38 Version: "v1",
39 }},
40 },
41 ProofCommitment: []ics23.CommitmentProof{
42 ics23.CommitmentProof_Exist{
43 Exist: &ics23.ExistenceProof{},
44 },
45 },
46 ProofHeight: trustedHeight,
47 }
48
49 core.RecvPacket(cross(cur), recvPacket)
50}
51
52// Error:
53// client unknown not found