core source realm
View source
r/aib/ibc
Because most of the functions in this realm take complex args, it is required
to call them using MsgRun (maketx run with the CLI) instead of the more
commonly used MsgCall.
Here is an exemple of the command:
$ gnokey maketx run -gas-fee 1000000ugnot -gas-wanted 90000000 \
-broadcast -chainid "dev" -remote "tcp://127.0.0.1:26657" \
ADDRESS run.gno
run.gno content depends on the called function, see the following sections
for examples.
CreateClient
See zz_create_client_example_filetest.gno
Emitted event:
1{
2 "type": "create_client",
3 "attrs": [
4 {
5 "key": "client_id",
6 "value": "07-tendermint-1"
7 },
8 {
9 "key": "client_type",
10 "value": "07-tendermint"
11 },
12 {
13 "key": "consensus_heights",
14 "value": "2/2"
15 }
16 ],
17 "pkg_path": "gno.land/r/aib/ibc/core"
18}
RegisterCounterparty
See zz_register_counterparty_example_filetest.gno
UpdateClient
See zz_update_client_example_filetest.gno
Emitted event:
1{
2 "type": "update_client",
3 "attrs": [
4 {
5 "key": "client_id",
6 "value": "07-tendermint-1"
7 },
8 {
9 "key": "client_type",
10 "value": "07-tendermint"
11 },
12 {
13 "key": "consensus_heights",
14 "value": "2/5"
15 }
16 ],
17 "pkg_path": "gno.land/r/aib/ibc/core"
18}
SendPacket
See zz_send_packet_example_filetest.gno
Emitted event:
1[
2 {
3 "type": "send_packet",
4 "attrs": [
5 {
6 "key": "packet_source_client",
7 "value": "07-tendermint-1"
8 },
9 {
10 "key": "packet_dest_client",
11 "value": "counter-party-id"
12 },
13 {
14 "key": "packet_sequence",
15 "value": "1"
16 },
17 {
18 "key": "packet_timeout_timestamp",
19 "value": "1234571490"
20 },
21 {
22 "key": "encoded_packet_hex",
23 "value": "0801120f30372d74656e6465726d696e742d311a10636f756e7465722d70617274792d696420e2a1d8cc042a3f0a12676e6f2e6c616e645f725f69626361707031120f64657374696e6174696f6e506f72741a02763122106170706c69636174696f6e2f6a736f6e2a027b7d2a3f0a12676e6f2e6c616e645f725f69626361707032120f64657374696e6174696f6e506f72741a02763122106170706c69636174696f6e2f6a736f6e2a027b7d"
24 }
25 ],
26 "pkg_path": "gno.land/r/aib/ibc/core"
27 },
28]
WriteAcknowledgement
For the standard synchronous flow, RecvPacket writes the application
acknowledgement itself. An application may instead return
PacketStatus_Async from OnRecvPacket, in which case the ack is deferred
until the application calls WriteAcknowledgement later (typically from a
subsequent OnAcknowledgementPacket or OnTimeoutPacket callback while
forwarding the parent packet). Async acks only support single-payload
packets, and only the realm whose OnRecvPacket returned async is
authorized to write the ack.
See z10a_async_ack_filetest.gno for the
full A → B → C forward-and-ack call graph.
Emitted event:
1{
2 "type": "write_acknowledgement",
3 "attrs": [
4 {
5 "key": "packet_source_client",
6 "value": "07-tendermint-42"
7 },
8 {
9 "key": "packet_dest_client",
10 "value": "07-tendermint-1"
11 },
12 {
13 "key": "packet_sequence",
14 "value": "1"
15 },
16 {
17 "key": "packet_timeout_timestamp",
18 "value": "1234571490"
19 },
20 {
21 "key": "encoded_packet_hex",
22 "value": "0801121030372d74656e6465726d696e742d34321a0f30372d74656e6465726d696e742d3120e2a1d8cc042a280a056170704944120561707049441a02763122106170706c69636174696f6e2f6a736f6e2a027b7d"
23 },
24 {
25 "key": "encoded_acknowledgement_hex",
26 "value": "0a0101"
27 }
28 ],
29 "pkg_path": "gno.land/r/aib/ibc/core"
30}
Acknowledgement
See zz_acknowledgement_example_filetest.gno
Emitted event:
1[
2 {
3 "type": "acknowledge_packet",
4 "attrs": [
5 {
6 "key": "packet_source_client",
7 "value": "07-tendermint-1"
8 },
9 {
10 "key": "packet_dest_client",
11 "value": "07-tendermint-42"
12 },
13 {
14 "key": "packet_sequence",
15 "value": "1"
16 },
17 {
18 "key": "packet_timeout_timestamp",
19 "value": "1234571490"
20 },
21 {
22 "key": "encoded_packet_hex",
23 "value": "0801120f30372d74656e6465726d696e742d311a1030372d74656e6465726d696e742d343220e2a1d8cc042a300a03617070120f64657374696e6174696f6e506f72741a02763122106170706c69636174696f6e2f6a736f6e2a027b7d"
24 }
25 ],
26 "pkg_path": "gno.land/r/aib/ibc/core"
27 }
28]
RecoverClient
See zz_recover_client_example_filetest.gno
See recover-client.md for the end-to-end flow and
which parameters can be adjusted during recovery.
Emitted event:
1{
2 "type": "recover_client",
3 "attrs": [
4 {
5 "key": "subject_client_id",
6 "value": "07-tendermint-1"
7 },
8 {
9 "key": "substitute_client_id",
10 "value": "07-tendermint-2"
11 },
12 {
13 "key": "client_type",
14 "value": "07-tendermint"
15 }
16 ],
17 "pkg_path": "gno.land/r/aib/ibc/core"
18}
UpgradeClient
See zz_upgrade_client_example_filetest.gno
See upgrade-client.md for the lifecycle, the
proof shape, and the field mapping between the current client and the
upgraded client.
Emitted event:
1{
2 "type": "upgrade_client",
3 "attrs": [
4 {
5 "key": "client_id",
6 "value": "07-tendermint-1"
7 },
8 {
9 "key": "client_type",
10 "value": "07-tendermint"
11 },
12 {
13 "key": "consensus_height",
14 "value": "1-100"
15 }
16 ],
17 "pkg_path": "gno.land/r/aib/ibc/core"
18}
18
func AddRelayer
crossing ActionAddRelayer adds an address to the authorized relayer whitelist. Can only be called by the admin.
func ClientIDs
ActionClientIDs returns the list of known client identifiers, sorted lexically by id (the underlying b+tree order). Intended for read-only callers (UIs, other realms building txlinks).
func ClientLatestHeight
ActionClientLatestHeight returns the latest (highest) consensus height the given client has been updated to, formatted as "<revision>/<height>". This is the client's latest trusted height. Returns "" if the client is unknown. Intended for read-only callers (UIs) that want to surface how up-to-date a client is.
func ClientStatus
ActionClientStatus returns the status of the given client (Active, Expired, Frozen, ...). Returns "" if the client is unknown. Intended for read-only callers (UIs) that want to surface whether a client is usable.
func CreateClient
crossing Action1func CreateClient(cur realm, clientState lightclient.ClientState, consensusState lightclient.ConsensusState) stringCreateClient generates a new client identifier and invokes the associated light client module in order to initialize the client.
func RecoverClient
crossing ActionRecoverClient recovers a frozen or expired subject client using a healthy substitute client that tracks the same counterparty chain.
func RecvPacket
crossing Actionfunc RegisterApp
crossing ActionRegisterApp registers an IBCApp, the portID is determined using the package path of the caller, hence it must an other realm.
func RegisterCounterparty
crossing Action1func RegisterCounterparty(cur realm, clientID string, counterpartyMerklePrefix [][]byte, counterpartyClientID string)RegisterCounterparty will register the IBC v2 counterparty info for the given clientID. It must be called by the same relayer that called CreateClient.
func RemoveRelayer
crossing ActionRemoveRelayer removes an address from the authorized relayer whitelist. Can only be called by the admin.
func Render
func SendPacket
crossing Actionfunc SetAdmin
crossing ActionSetAdmin sets or transfers the admin role. If no admin is currently set (admin was not initialized in init, e.g. in tests), the first caller becomes admin. Once set, only the current admin can change it.
func Timeout
crossing Actionfunc UpdateClient
crossing ActionUpdateClient will update the given IBC v2 light client with a new header. Can also be used to submit a misbehavior (clientMessage can be a header or a misbehavior, maybe split into 2 functions would make more sense here).
func UpgradeClient
crossing Action1func UpgradeClient(cur realm, clientID string, clientState, consensusState, proofUpgradeClient, proofUpgradeConsensusState any)UpgradeClient upgrades the client to a new client and consensus state, verified by proofs that the counterparty chain committed to those states at its UpgradePath under the current client's latest consensus root.
func WriteAcknowledgement
crossing Action1
20
- bytes stdlib
- chain stdlib
- chain/params stdlib
- chain/runtime/unsafe stdlib
- encoding/base64 stdlib
- encoding/hex stdlib
- gno.land/p/aib/ibc/app package
- gno.land/p/aib/ibc/host package
- gno.land/p/aib/ibc/lightclient package
- gno.land/p/aib/ibc/lightclient/tendermint package
- gno.land/p/aib/ibc/types package
- gno.land/p/aib/jsonpage package
- gno.land/p/nt/bptree/v0 package
- gno.land/p/nt/mux/v0 package
- gno.land/p/nt/seqid/v0 package
- gno.land/p/nt/ufmt/v0 package
- gno.land/p/onbloc/json package
- strconv stdlib
- strings stdlib
- time stdlib