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:
- 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.
- 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.
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:
Sysvartrait intoSysvarId(just the address const) andSysvar: SysvarId(adds thesol_get_sysvarloader). Clock and Rent keep implementing both; new account-data-only sysvars implement onlySysvarId. Non-breaking for existing users via the supertrait.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.