Documentation
¶
Index ¶
- Constants
- Variables
- func X_deriveStorageDepositAddr(pkgPath string) string
- func X_emit(m *gno.Machine, typ string, attrs []string)
- func X_packageAddress(pkgPath string) string
- func X_pubKeyAddress(bech32PubKey string) (addr string, errStr string)
- type Event
- type EventAttribute
- type StorageDepositEvent
- type StorageUnlockEvent
Constants ¶
View Source
const ( // MaxEventPairs caps the number of (key,value) pairs per emitted event. // `attrs` arrives as a flat slice of alternating keys/values, so the // flat length cap is 2× this. The bound exists so chargeNativeGas can // safely walk attrs to compute per-byte gas without becoming a DoS // vector itself, and so downstream amino+JSON encoding is bounded. MaxEventPairs = 64 // MaxEventAttrLen caps each attribute's byte length. The event type, // every key, AND every value that exceeds this makes emit panic — it // fails loudly instead of silently truncating. A silent cap would be a // hidden invariant: each realm would have to pre-check its own value // lengths to guarantee protocol correctness, and a truncated value // (e.g. a hex-encoded IBC ack or membership proof) would corrupt // downstream consumers with no on-chain signal. // // Sized to hold a realistic binary payload after hex/base64 expansion // (~2 KB of raw bytes once hex-encoded as 0x... doubles the length) — // e.g. an IBC packet acknowledgement, membership proof, or packet-data // chunk emitted by an on-chain bridge realm — while still bounding the // downstream amino+JSON encoding amplification per attr at ~4 KB. MaxEventAttrLen = 4096 )
Variables ¶
View Source
var Package = amino.RegisterPackage(amino.NewPackage( "github.com/gnolang/gno/gnovm/stdlibs/chain", "tm", amino.GetCallersDirname(), ). WithDependencies( abci.Package, ). WithTypes( EventAttribute{}, Event{}, StorageDepositEvent{}, StorageUnlockEvent{}, ))
Functions ¶
func X_packageAddress ¶
func X_pubKeyAddress ¶
X_pubKeyAddress derives the bech32 address from a bech32-encoded public key. Returns ("", errStr) on error — the gno wrapper translates to a Go-side error or address cast.
Used by r/sys/params.GetValsetEntries to parse "<bech32-pubkey>:<power>" entries from valset:current. The function is narrow on purpose: bech32 decode + amino unmarshal + Address() derivation are not safely doable in pure gno (amino-decode is not exposed to gno), so this is the only chain-side primitive needed for that use case.
Types ¶
type Event ¶
type Event struct {
Type string `json:"type"`
Attributes []EventAttribute `json:"attrs"`
PkgPath string `json:"pkg_path"`
}
func (Event) AssertABCIEvent ¶
func (e Event) AssertABCIEvent()
type EventAttribute ¶
type StorageDepositEvent ¶
type StorageDepositEvent struct {
BytesDelta int64 `json:"bytes_delta"`
FeeDelta std.Coin `json:"fee_delta"`
PkgPath string `json:"pkg_path"`
}
StorageDepositEvent is emitted when a storage deposit fee is locked.
func (StorageDepositEvent) AssertABCIEvent ¶
func (e StorageDepositEvent) AssertABCIEvent()
type StorageUnlockEvent ¶
type StorageUnlockEvent struct {
// For unlock, BytesDelta is negative
BytesDelta int64 `json:"bytes_delta"`
FeeRefund std.Coin `json:"fee_refund"`
PkgPath string `json:"pkg_path"`
// RefundWithheld is true if the refund was retained because of token lock
RefundWithheld bool `json:"refund_withheld"`
}
StorageUnlockEvent is emitted when a storage deposit fee is unlocked.
func (StorageUnlockEvent) AssertABCIEvent ¶
func (e StorageUnlockEvent) AssertABCIEvent()
Click to show internal directories.
Click to hide internal directories.