Search Apps Documentation Source Content File Folder Download Copy Actions Download

z1k_create_client_filetest.gno

1.19 Kb · 34 lines
 1// PKGPATH: gno.land/r/aib/main
 2package main
 3
 4import (
 5	"time"
 6
 7	"gno.land/p/aib/ibc/lightclient/tendermint"
 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 with non-empty whitelist (only whitelisted relayers allowed)
14func main(cur realm) {
15	core.SetAdmin(cross(cur), "g1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm")
16	core.AddRelayer(cross(cur), "g1someother00000000000000000000000000")
17	// Note: caller is not in the whitelist
18
19	var (
20		chainID        = "chain-id-1"
21		clientState    = tmtesting.NewClientState(chainID, types.NewHeight(1, 2))
22		apphash        = tmtesting.Hash("apphash")
23		val1           = tendermint.NewValidator("9DIBYr64rywKO3Kk6+743xDHcEU=",
24			"VMpO0RzmZu4OMVvsniYdeO/2eP+h1xeoAcHBTZC7Gfw=", 1)
25		val2           = tendermint.NewValidator("y+naL3ubs9q1bXrY9+uRxY9c+J8=",
26			"NeGV1CqewGUTpH5SxVRfkgYOMCVX84MyCslqtw9Ouvo=", 1)
27		trustedValset  = tendermint.NewValset(val1, val2)
28		consensusState = tmtesting.GenConsensusState(time.Now(), apphash, trustedValset.Hash())
29	)
30	core.CreateClient(cross(cur), clientState, consensusState)
31}
32
33// Error:
34// unauthorized relayer g1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm