core.gno
2.70 Kb · 69 lines
1package core
2
3import (
4 "gno.land/p/onbloc/ibc/union/types"
5 "gno.land/r/onbloc/ibc/union/access"
6)
7
8// core.gno is the packet-lifecycle entrypoint surface. Each function delegates
9// its logic to the installed impl; the admin-gated entrypoints keep their admin
10// gate on the proxy. SendPacket and WriteAcknowledgement are caller/port-owner
11// authorized inside the mustGetImpl().
12
13// SendPacket commits a packet for the caller's port.
14func SendPacket(cur realm, sourceChannelId types.ChannelId, timeoutTimestamp types.Timestamp, data []byte) types.Packet {
15 return mustGetImpl().SendPacket(0, cur, sourceChannelId, timeoutTimestamp, data)
16}
17
18// PacketRecv proves and dispatches a batch of received packets.
19func PacketRecv(cur realm, msg types.MsgPacketRecv) {
20 access.AssertCanCall(0, cur, SelectorPacketRecv)
21 mustGetImpl().PacketRecv(0, cur, msg)
22}
23
24// IntentPacketRecv settles packets on the proofless market-maker fast path.
25func IntentPacketRecv(cur realm, msg types.MsgIntentPacketRecv) {
26 access.AssertCanCall(0, cur, SelectorIntentPacketRecv)
27 mustGetImpl().IntentPacketRecv(0, cur, msg)
28}
29
30// PacketAcknowledgement proves the counterparty acks and notifies the app.
31func PacketAcknowledgement(cur realm, msg types.MsgPacketAcknowledgement) {
32 access.AssertCanCall(0, cur, SelectorPacketAck)
33 mustGetImpl().PacketAcknowledgement(0, cur, msg)
34}
35
36// PacketTimeout proves a packet was never received and notifies the app.
37func PacketTimeout(cur realm, msg types.MsgPacketTimeout) {
38 access.AssertCanCall(0, cur, SelectorPacketTimeout)
39 mustGetImpl().PacketTimeout(0, cur, msg)
40}
41
42// CommitMembershipProof verifies and records a membership proof.
43func CommitMembershipProof(cur realm, msg types.MsgCommitMembershipProof) {
44 access.AssertCanCall(0, cur, SelectorCommitMembershipProof)
45 mustGetImpl().CommitMembershipProof(0, cur, msg)
46}
47
48// CommitNonMembershipProof verifies and records a non-membership proof.
49func CommitNonMembershipProof(cur realm, msg types.MsgCommitNonMembershipProof) {
50 access.AssertCanCall(0, cur, SelectorCommitNonMembershipProof)
51 mustGetImpl().CommitNonMembershipProof(0, cur, msg)
52}
53
54// BatchSend aggregates already-committed packets into a batch commitment.
55func BatchSend(cur realm, msg types.MsgBatchSend) {
56 access.AssertCanCall(0, cur, SelectorBatchSend)
57 mustGetImpl().BatchSend(0, cur, msg)
58}
59
60// BatchAcks aggregates the acks of received packets into a batch receipt.
61func BatchAcks(cur realm, msg types.MsgBatchAcks) {
62 access.AssertCanCall(0, cur, SelectorBatchAcks)
63 mustGetImpl().BatchAcks(0, cur, msg)
64}
65
66// WriteAcknowledgement commits a deferred acknowledgement for a received packet.
67func WriteAcknowledgement(cur realm, msg types.MsgWriteAcknowledgement) {
68 mustGetImpl().WriteAcknowledgement(0, cur, msg)
69}