Skip to content

feat (lang): Support Instruction sysvar #184

@dhruvja

Description

@dhruvja

Use case

Several common on-chain patterns require reading the current transaction's instruction list which on solana is only exposed through the instructions sysvar (Sysvar1nstructions1111111111111111111111111). Quasar currently has no typed wrapper for this sysvar, so any program that needs introspection has to drop to UncheckedAccount and hand-roll ~80 lines of unsafe pointer math, forfeiting the framework's safety guarantees and duplicating the parser across every such program.

Proposed Solution

Two moving parts, both minimal:

  1. Split the existing Sysvar trait into SysvarId (just the address const) and Sysvar: SysvarId (adds the sol_get_sysvar loader). Clock and Rent keep implementing both; new account-data-only sysvars implement only SysvarId. Non-breaking for existing users via the supertrait.
  2. Add a zero-copy Sysvar<Instructions> wrapper exposing num_instructions, current_index, load(idx), load_current, load_relative(delta), returning a bounded IntrospectedInstruction view with program_id, data, and per-account-meta accessors.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions