z3d_send_packet_filetest.gno
1.17 Kb · 39 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/r/aib/ibc/core"
10)
11
12// SendPacket fails timeout not after block time.
13func main(cur realm) {
14 var (
15 chainID = "chain-id-2"
16 clientState = tmtesting.NewClientState(chainID, types.NewHeight(2, 2))
17 apphash = tmtesting.Hash("apphash")
18 trustedValset = tmtesting.GenValset()
19 consensusState = tmtesting.GenConsensusState(time.Now(), apphash, trustedValset.Hash())
20 )
21 clientID := core.CreateClient(cross(cur), clientState, consensusState)
22 core.RegisterCounterparty(cross(cur), clientID, [][]byte{[]byte("iavlStoreKey"), []byte("prefix2")}, "07-tendermint-2")
23
24 packet := types.MsgSendPacket{
25 SourceClient: clientID,
26 TimeoutTimestamp: uint64(time.Now().Unix()),
27 Payloads: []types.Payload{{
28 SourcePort: "transfer",
29 DestinationPort: "transfer",
30 Encoding: "application/json",
31 Value: []byte("{}"),
32 Version: "v1",
33 }},
34 }
35 core.SendPacket(cross(cur), packet)
36}
37
38// Error:
39// timeout is less than or equal the current block timestamp, 1234567890 <= 1234567890