From 43d0f1a24ffc1921607a265295d1b028d7e030cb Mon Sep 17 00:00:00 2001 From: Joe Caulfield Date: Tue, 29 Oct 2024 10:47:03 +0400 Subject: [PATCH] bump nightly version --- Cargo.toml | 4 +- clients/js/src/generated/errors/index.ts | 9 ---- clients/js/src/generated/errors/loaderV3.ts | 51 ------------------- clients/js/src/generated/index.ts | 1 - .../rust/src/generated/errors/loader_v3.rs | 20 -------- clients/rust/src/generated/errors/mod.rs | 4 -- program/idl.json | 7 --- program/src/entrypoint.rs | 6 +-- program/src/error.rs | 37 -------------- program/src/lib.rs | 1 - 10 files changed, 3 insertions(+), 137 deletions(-) delete mode 100644 clients/js/src/generated/errors/index.ts delete mode 100644 clients/js/src/generated/errors/loaderV3.ts delete mode 100644 clients/rust/src/generated/errors/loader_v3.rs delete mode 100644 program/src/error.rs diff --git a/Cargo.toml b/Cargo.toml index 1fb6146..0a72822 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,5 +6,5 @@ members = ["clients/rust", "program"] solana = "2.0.2" [workspace.metadata.toolchains] -format = "nightly-2023-10-05" -lint = "nightly-2023-10-05" +format = "nightly-2024-05-02" +lint = "nightly-2024-05-02" diff --git a/clients/js/src/generated/errors/index.ts b/clients/js/src/generated/errors/index.ts deleted file mode 100644 index edc53db..0000000 --- a/clients/js/src/generated/errors/index.ts +++ /dev/null @@ -1,9 +0,0 @@ -/** - * This code was AUTOGENERATED using the kinobi library. - * Please DO NOT EDIT THIS FILE, instead use visitors - * to add features, then rerun kinobi to update it. - * - * @see https://github.com/kinobi-so/kinobi - */ - -export * from './loaderV3'; diff --git a/clients/js/src/generated/errors/loaderV3.ts b/clients/js/src/generated/errors/loaderV3.ts deleted file mode 100644 index 5f97526..0000000 --- a/clients/js/src/generated/errors/loaderV3.ts +++ /dev/null @@ -1,51 +0,0 @@ -/** - * This code was AUTOGENERATED using the kinobi library. - * Please DO NOT EDIT THIS FILE, instead use visitors - * to add features, then rerun kinobi to update it. - * - * @see https://github.com/kinobi-so/kinobi - */ - -import { - isProgramError, - type Address, - type SOLANA_ERROR__INSTRUCTION_ERROR__CUSTOM, - type SolanaError, -} from '@solana/web3.js'; -import { LOADER_V3_PROGRAM_ADDRESS } from '../programs'; - -/** Placeholder: This is a placeholder error */ -export const LOADER_V3_ERROR__PLACEHOLDER = 0x0; // 0 - -export type LoaderV3Error = typeof LOADER_V3_ERROR__PLACEHOLDER; - -let loaderV3ErrorMessages: Record | undefined; -if (process.env.NODE_ENV !== 'production') { - loaderV3ErrorMessages = { - [LOADER_V3_ERROR__PLACEHOLDER]: `This is a placeholder error`, - }; -} - -export function getLoaderV3ErrorMessage(code: LoaderV3Error): string { - if (process.env.NODE_ENV !== 'production') { - return (loaderV3ErrorMessages as Record)[code]; - } - - return 'Error message not available in production bundles.'; -} - -export function isLoaderV3Error( - error: unknown, - transactionMessage: { - instructions: Record; - }, - code?: TProgramErrorCode -): error is SolanaError & - Readonly<{ context: Readonly<{ code: TProgramErrorCode }> }> { - return isProgramError( - error, - transactionMessage, - LOADER_V3_PROGRAM_ADDRESS, - code - ); -} diff --git a/clients/js/src/generated/index.ts b/clients/js/src/generated/index.ts index dad814c..d5f8838 100644 --- a/clients/js/src/generated/index.ts +++ b/clients/js/src/generated/index.ts @@ -6,6 +6,5 @@ * @see https://github.com/kinobi-so/kinobi */ -export * from './errors'; export * from './instructions'; export * from './programs'; diff --git a/clients/rust/src/generated/errors/loader_v3.rs b/clients/rust/src/generated/errors/loader_v3.rs deleted file mode 100644 index a148964..0000000 --- a/clients/rust/src/generated/errors/loader_v3.rs +++ /dev/null @@ -1,20 +0,0 @@ -//! This code was AUTOGENERATED using the kinobi library. -//! Please DO NOT EDIT THIS FILE, instead use visitors -//! to add features, then rerun kinobi to update it. -//! -//! - -use {num_derive::FromPrimitive, thiserror::Error}; - -#[derive(Clone, Debug, Eq, Error, FromPrimitive, PartialEq)] -pub enum LoaderV3Error { - /// 0 - This is a placeholder error - #[error("This is a placeholder error")] - Placeholder = 0x0, -} - -impl solana_program::program_error::PrintProgramError for LoaderV3Error { - fn print(&self) { - solana_program::msg!(&self.to_string()); - } -} diff --git a/clients/rust/src/generated/errors/mod.rs b/clients/rust/src/generated/errors/mod.rs index 0d2faa6..05ea2cd 100644 --- a/clients/rust/src/generated/errors/mod.rs +++ b/clients/rust/src/generated/errors/mod.rs @@ -3,7 +3,3 @@ //! to add features, then rerun kinobi to update it. //! //! - -pub(crate) mod loader_v3; - -pub use self::loader_v3::LoaderV3Error; diff --git a/program/idl.json b/program/idl.json index 28e5cba..94d0ec9 100644 --- a/program/idl.json +++ b/program/idl.json @@ -371,13 +371,6 @@ } } ], - "errors": [ - { - "code": 0, - "name": "Placeholder", - "msg": "This is a placeholder error" - } - ], "metadata": { "origin": "shank", "address": "CoreBPFLoaderUpgradeab1e1111111111111111111", diff --git a/program/src/entrypoint.rs b/program/src/entrypoint.rs index 2f022f4..cd630d5 100644 --- a/program/src/entrypoint.rs +++ b/program/src/entrypoint.rs @@ -15,9 +15,5 @@ fn process_instruction( accounts: &[AccountInfo], input: &[u8], ) -> ProgramResult { - if let Err(error) = processor::process(program_id, accounts, input) { - error.print::(); - return Err(error); - } - Ok(()) + processor::process(program_id, accounts, input) } diff --git a/program/src/error.rs b/program/src/error.rs deleted file mode 100644 index c487ab4..0000000 --- a/program/src/error.rs +++ /dev/null @@ -1,37 +0,0 @@ -//! Program error types. - -use { - num_derive::FromPrimitive, - solana_program::{ - decode_error::DecodeError, - msg, - program_error::{PrintProgramError, ProgramError}, - }, - thiserror::Error, -}; - -/// Errors that can be returned by the Solana BPF Loader v3 program. -#[derive(Error, Clone, Debug, Eq, PartialEq, FromPrimitive)] -pub enum LoaderV3Error { - /// This is a placeholder error. - #[error("This is a placeholder error")] - Placeholder, -} - -impl PrintProgramError for LoaderV3Error { - fn print(&self) { - msg!(&self.to_string()); - } -} - -impl From for ProgramError { - fn from(e: LoaderV3Error) -> Self { - ProgramError::Custom(e as u32) - } -} - -impl DecodeError for LoaderV3Error { - fn type_of() -> &'static str { - "LoaderV3Error" - } -} diff --git a/program/src/lib.rs b/program/src/lib.rs index bf1a749..82b162c 100644 --- a/program/src/lib.rs +++ b/program/src/lib.rs @@ -3,7 +3,6 @@ #[cfg(all(target_os = "solana", feature = "bpf-entrypoint"))] mod entrypoint; -pub mod error; pub mod instruction; pub mod processor; pub mod state;