z2d_update_client_filetest.gno
1.10 Kb · 41 lines
1// PKGPATH: gno.land/r/aib/main
2package main
3
4import (
5 "time"
6
7 "gno.land/p/aib/ibc/lightclient"
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
13type SoloMachine struct{}
14
15func (SoloMachine) ClientType() string {
16 return lightclient.Solomachine
17}
18
19func (SoloMachine) ValidateBasic() error {
20 return nil
21}
22
23// UpdateClient client type mismatch
24func main(cur realm) {
25 // CreateClient and RegisterCounterparty
26 var (
27 chainID = "chain-id-2"
28 clientState = tmtesting.NewClientState(chainID, types.NewHeight(2, 2))
29 apphash = tmtesting.Hash("apphash")
30 trustedValset = tmtesting.GenValset()
31 consensusState = tmtesting.GenConsensusState(time.Now(), apphash, trustedValset.Hash())
32 )
33 clientID := core.CreateClient(cross(cur), clientState, consensusState)
34 core.RegisterCounterparty(cross(cur), clientID, [][]byte{[]byte("iavlStoreKey"), []byte("prefix2")}, "07-tendermint-2")
35
36 // Update clientID
37 core.UpdateClient(cross(cur), clientID, SoloMachine{})
38}
39
40// Error:
41// client type for client state and client message do not match