z1e_create_client_filetest.gno
0.80 Kb · 28 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// CreateClient with Status Expired
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 // consensusState.Timestamp is older than now + clientState.TrustingPeriod
22 consensusState.Timestamp = time.Now().Add(-clientState.TrustingPeriod)
23
24 core.CreateClient(cross(cur), clientState, consensusState)
25}
26
27// Error:
28// cannot create client (07-tendermint-1) with status Expired