Search Apps Documentation Source Content File Folder Download Copy Actions Download State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

core source realm

Readme 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}

Functions 18

func AddRelayer

crossing Action
1func AddRelayer(cur realm, addr address)
source

AddRelayer adds an address to the authorized relayer whitelist. Can only be called by the admin.

func ClientIDs

Action
1func ClientIDs() []string
source

ClientIDs 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

Action
1func ClientLatestHeight(clientID string) string
source

ClientLatestHeight 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

Action
1func ClientStatus(clientID string) string
source

ClientStatus 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 Action
1func CreateClient(cur realm, clientState lightclient.ClientState, consensusState lightclient.ConsensusState) string
source

CreateClient generates a new client identifier and invokes the associated light client module in order to initialize the client.

func RecoverClient

crossing Action
1func RecoverClient(cur realm, subjectClientID, substituteClientID string)
source

RecoverClient recovers a frozen or expired subject client using a healthy substitute client that tracks the same counterparty chain.

func RegisterApp

crossing Action
1func RegisterApp(cur realm, portID string, app app.IBCApp)
source

RegisterApp registers an IBCApp, the portID is determined using the package path of the caller, hence it must an other realm.

func RegisterCounterparty

crossing Action
1func RegisterCounterparty(cur realm, clientID string, counterpartyMerklePrefix [][]byte, counterpartyClientID string)
source

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 Action
1func RemoveRelayer(cur realm, addr address)
source

RemoveRelayer removes an address from the authorized relayer whitelist. Can only be called by the admin.

func SetAdmin

crossing Action
1func SetAdmin(cur realm, newAdmin address)
source

SetAdmin 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 Action
1func Timeout(cur realm, msg types.MsgTimeout) types.ResponseResultType
source

func UpdateClient

crossing Action
1func UpdateClient(cur realm, clientID string, clientMessage lightclient.ClientMessage)
source

UpdateClient 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 Action
1func UpgradeClient(cur realm, clientID string, clientState, consensusState, proofUpgradeClient, proofUpgradeConsensusState any)
source

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.

Types 1

type Store

struct
1type Store struct {
2	clientSeq  seqid.ID
3	clientByID *bptree.BPTree // id:client
4
5	routes map[string]ibcApp
6}
source

Imports 20

Source Files 144