z9f_recover_client_filetest.gno
0.91 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// RecoverClient failure: caller is not the admin.
13func main(cur realm) {
14 // Admin is set to a different address than the test caller.
15 core.SetAdmin(cross(cur), "g1somebodyelse00000000000000000000000000")
16 var (
17 clientState = tmtesting.NewClientState("chain-id-2", types.NewHeight(2, 2))
18 trustedValset = tmtesting.GenValset()
19 consensusState = tmtesting.GenConsensusState(time.Now(), tmtesting.Hash("apphash"), trustedValset.Hash())
20 )
21 subjectID := core.CreateClient(cross(cur), clientState, consensusState)
22 substituteID := core.CreateClient(cross(cur), clientState, consensusState)
23
24 core.RecoverClient(cross(cur), subjectID, substituteID)
25}
26
27// Error:
28// unauthorized: caller g1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm is not the admin