z1g_create_client_filetest.gno
1.11 Kb · 35 lines
1// PKGPATH: gno.land/r/aib/main
2package main
3
4import (
5 "testing"
6 "time"
7
8 tmtesting "gno.land/p/aib/ibc/lightclient/tendermint/testing"
9 "gno.land/p/aib/ibc/types"
10 "gno.land/r/aib/ibc/core"
11)
12
13// CreateClient and RegisterCounterparty have different signer
14func main(cur realm) {
15 var (
16 chainID = "chain-id-2"
17 clientState = tmtesting.NewClientState(chainID, types.NewHeight(2, 2))
18 apphash = tmtesting.Hash("apphash")
19 trustedValset = tmtesting.GenValset()
20 consensusState = tmtesting.GenConsensusState(time.Now(), apphash, trustedValset.Hash())
21 )
22
23 clientID := core.CreateClient(cross(cur), clientState, consensusState)
24
25 // Change OriginCaller for the call to RegisterCounterparty
26 ctx := testing.GetContext()
27 ctx.OriginCaller = "g1wymu47drhr0kuq2098m792lytgtj2nyx77yrsx"
28 testing.SetContext(ctx)
29
30 // RegisterCounterparty on clientID
31 core.RegisterCounterparty(cross(cur), clientID, [][]byte{[]byte("iavlStoreKey"), []byte("prefix2")}, "07-tendermint-2")
32}
33
34// Error:
35// expected same signer as CreateClient submitter g1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm, got g1wymu47drhr0kuq2098m792lytgtj2nyx77yrsx