Skip to content
This repository has been archived by the owner on Jan 22, 2025. It is now read-only.

Removes native loader entrypoints from the SDK #21185

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 26 additions & 3 deletions program-runtime/src/native_loader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ use serde::Serialize;
use solana_sdk::{
account::ReadableAccount,
decode_error::DecodeError,
entrypoint_native::ProgramEntrypoint,
instruction::InstructionError,
keyed_account::keyed_account_at_index,
keyed_account::{keyed_account_at_index, KeyedAccount},
native_loader,
process_instruction::{InvokeContext, LoaderEntrypoint},
process_instruction::InvokeContext,
pubkey::Pubkey,
};
use std::{
collections::HashMap,
Expand All @@ -24,6 +24,29 @@ use std::{
};
use thiserror::Error;

/// Prototype of a native loader entry point
///
/// program_id: Program ID of the currently executing program
/// keyed_accounts: Accounts passed as part of the instruction
/// instruction_data: Instruction data
/// invoke_context: Invocation context
pub type LoaderEntrypoint = unsafe extern "C" fn(
program_id: &Pubkey,
instruction_data: &[u8],
invoke_context: &dyn InvokeContext,
) -> Result<(), InstructionError>;

// Prototype of a native program entry point
///
/// program_id: Program ID of the currently executing program
/// keyed_accounts: Accounts passed as part of the instruction
/// instruction_data: Instruction data
pub type ProgramEntrypoint = unsafe extern "C" fn(
program_id: &Pubkey,
keyed_accounts: &[KeyedAccount],
instruction_data: &[u8],
) -> Result<(), InstructionError>;

#[derive(Error, Debug, Serialize, Clone, PartialEq, FromPrimitive, ToPrimitive)]
pub enum NativeLoaderError {
#[error("Entrypoint name in the account data is not a valid UTF-8 string")]
Expand Down
163 changes: 0 additions & 163 deletions sdk/src/entrypoint_native.rs

This file was deleted.

1 change: 0 additions & 1 deletion sdk/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ pub mod deserialize_utils;
pub mod ed25519_instruction;
pub mod entrypoint;
pub mod entrypoint_deprecated;
pub mod entrypoint_native;
pub mod epoch_info;
pub mod exit;
pub mod feature;
Expand Down
12 changes: 0 additions & 12 deletions sdk/src/process_instruction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,6 @@ use solana_sdk::{
};
use std::{cell::RefCell, fmt::Debug, rc::Rc, sync::Arc};

/// Prototype of a native loader entry point
///
/// program_id: Program ID of the currently executing program
/// keyed_accounts: Accounts passed as part of the instruction
/// instruction_data: Instruction data
/// invoke_context: Invocation context
pub type LoaderEntrypoint = unsafe extern "C" fn(
program_id: &Pubkey,
instruction_data: &[u8],
invoke_context: &dyn InvokeContext,
) -> Result<(), InstructionError>;

pub type ProcessInstructionWithContext =
fn(usize, &[u8], &mut dyn InvokeContext) -> Result<(), InstructionError>;

Expand Down