Skip to content

Instantly share code, notes, and snippets.

@buffalojoec
buffalojoec / stack_frame_gap_accesses.md
Created April 1, 2026 00:43
SIMD-0460: Analysis of Stack Frame Gap Accesses

This report evaluates the potential impact of SIMD-0460 ("Virtual Address Space Adjustments") on existing Solana mainnet-beta programs.

Profiling results were obtained using Blueshift's program-sync tool.

Date: March 31, 2026 Programs profiled: 16,586 (4 failed to parse)

Do Transaction Error Codes Affect Consensus?

Solana contributors and enthusiasts alike have long stated that "error codes don't affect consensus", however, I'm not aware of anywhere this has been empirically explained and tested.

This post aims to describe why error codes are not included in consensus and test the theory definitively.

What Goes Into the Bank Hash

@buffalojoec
buffalojoec / uninit_r2_reads_mb.md
Created February 4, 2026 10:28
SIMD-0321: Analysis of Uninitialized `r2` Reads

SIMD-0321: Analysis of Uninitialized r2 Reads

This report evaluates the impact of SIMD-0321 on existing Solana mainnet-beta programs by attempting to identify existing uninitialized reads of register r2.

Profiling results were generated using Blueshift’s program-sync tool.

@buffalojoec
buffalojoec / loader_v4_redux.md
Created January 10, 2026 12:56
Loader V4 Redux

Loader V4 Redux

After discussions on RFC-0423, it's clear that most contributors prefer to introduce the new BPF Loader account layout under a new program ID. Therefore, we plan to proceed with a BPF Loader V4.

I'd like to consider a new direction on the design for Loader V4. SIMD-0167 is well-specified and addresses several developer pain points. However, I believe it oversteps in some areas and falls short in others.

@buffalojoec
buffalojoec / bytemuck_bench.rs
Created May 9, 2025 08:36
Interpreting account data with bytemuck is cheap
use {
bytemuck::{Pod, Zeroable},
pinocchio::{
account_info::AccountInfo, program_entrypoint,
pubkey::Pubkey, ProgramResult, program_error::ProgramError,
},
};
#[derive(Clone, Copy, Pod, Zeroable)]
#[repr(C)]
@buffalojoec
buffalojoec / transaction_roles.rs
Created May 2, 2025 03:44
Did you know Solana account roles (signer, writable) are transaction-wide?
use solana_program::{account_info::AccountInfo, entrypoint::ProgramResult, msg, pubkey::Pubkey};
solana_program::entrypoint!(process);
fn process(_program_id: &Pubkey, accounts: &[AccountInfo], _input: &[u8]) -> ProgramResult {
let account = accounts.first().unwrap();
msg!("KEY: {}", account.key);
msg!("IS_SIGNER: {}", account.is_signer);
msg!("IS_WRITABLE: {}", account.is_writable);
Ok(())
@buffalojoec
buffalojoec / index_v2.rs
Last active May 16, 2024 09:17
Program cache index v2 design concept.
//! Program cache index v2 implementation.
//!
//! Consider a fork graph.
//!
//! ```
//!
//! 0 <- root
//! / \
//! 10 5
//! | |
@buffalojoec
buffalojoec / call_sites.txt
Last active March 19, 2024 13:45
Runtime `additional_builtins` call sites
runtime::bank::new_from_fields()
|
|-- runtime::serde_snapshot::reconstruct_bank_from_fields()
|
|-- runtime::serde_snapshot::bank_from_streams()
|
|-- runtime::snapshot_bank_utils::rebuild_bank_from_unarchived_snapshots()
| |
| |-- runtime::snapshot_bank_utils::bank_from_snapshot_archives()
| |
@buffalojoec
buffalojoec / lib.rs
Last active August 16, 2023 18:36
Sharing closure-fed library functions across async and sync
/// Scenario #1:
mod not_fut{
/// A lib function designed to take a closure that returns a `String`
fn lib_function<F>(get_account_data_fn: F) -> String
where
F: Fn(u8) -> String,
{
let account_data = get_account_data_fn(42);
println!("Account data: {}", account_data);
account_data