Skip to content

v0.1.2 — Message account helpers

Choose a tag to compare

@cloakd cloakd released this 20 Aug 11:20
· 11 commits to main since this release
8627574

Message account helpers

Gagliardetto-compatible helpers on the static account keys, added for downstream migration (first consumer: alphabatem/rpc_shard):

  • Message.Account(index uint16) (PublicKey, error)
  • Message.AccountMetaList() (AccountMetaSlice, error) — returns the new ErrAddressTablesNotSet sentinel for versioned messages that reference address table lookups (this package carries no lookup-table resolution)
  • Message.IsWritableStatic(PublicKey) bool — implements the message account-ordering rule with saturating arithmetic, same as upstream Rust
  • Message.UnmarshalBase64(string) error
  • PublicKeySlice.ToBase58() []string

Base58 interning on the String paths

PublicKey.String and Hash.String now serve repeated keys from base58.EncodeCached32's lock-free intern table — these APIs allocate a string regardless, so a cache hit erases the allocation entirely (program IDs, mints, hot accounts and blockhashes repeat constantly in Solana workloads). The hand-built JSON writers are unchanged and keep encoding directly into the output buffer; JSON output is byte-identical.