This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use { | |
bytemuck::{Pod, Zeroable}, | |
pinocchio::{ | |
account_info::AccountInfo, program_entrypoint, | |
pubkey::Pubkey, ProgramResult, program_error::ProgramError, | |
}, | |
}; | |
#[derive(Clone, Copy, Pod, Zeroable)] | |
#[repr(C)] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(()) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//! Program cache index v2 implementation. | |
//! | |
//! Consider a fork graph. | |
//! | |
//! ``` | |
//! | |
//! 0 <- root | |
//! / \ | |
//! 10 5 | |
//! | | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() | |
| | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// 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 |