Skip to content

Commit 5d181a7

Browse files
committed
revert errors
1 parent 1df21eb commit 5d181a7

File tree

27 files changed

+122
-182
lines changed

27 files changed

+122
-182
lines changed

Cargo.lock

Lines changed: 3 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

program-libs/account-checks/src/error.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ impl From<AccountError> for solana_program_error::ProgramError {
6868
}
6969
}
7070

71-
// Error conversions for unified error handling
7271
#[cfg(feature = "pinocchio")]
7372
impl From<pinocchio::program_error::ProgramError> for AccountError {
7473
fn from(_: pinocchio::program_error::ProgramError) -> Self {

program-libs/account-checks/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,4 @@ pub mod checks;
33
pub mod discriminator;
44
pub mod error;
55

6-
// Re-export the trait for convenience
76
pub use account_info::account_info_trait::AccountInfoTrait;

program-libs/batched-merkle-tree/src/lib.rs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,4 @@ pub mod rollover_state_tree;
1313

1414
// Use the appropriate BorshDeserialize and BorshSerialize based on feature
1515
use borsh::{BorshDeserialize, BorshSerialize};
16-
// // Pinocchio imports when pinocchio feature is enabled
17-
// #[cfg(feature = "pinocchio")]
18-
// use pinocchio::{msg, sysvars::rent::Rent, sysvars::Sysvar};
19-
// // Solana program imports for non-pinocchio builds (default)
20-
// #[cfg(not(feature = "pinocchio"))]
21-
// pub(crate) use {
22-
// solana_account_info::AccountInfo,
23-
// solana_msg::msg,
24-
// solana_sysvar::{rent::Rent, Sysvar},
25-
// };
26-
27-
// Import the comprehensive AccountInfoTrait from light-account-checks
2816
pub use light_account_checks::AccountInfoTrait;

program-libs/compressed-account/Cargo.toml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ edition = "2021"
88

99
[features]
1010
default = []
11-
solana = ["dep:solana-pubkey"]
11+
solana = ["dep:solana-pubkey", "dep:solana-program-error"]
1212
anchor = ["anchor-lang"]
13-
pinocchio = []
13+
pinocchio = ["dep:pinocchio"]
1414
bytemuck-des = ["bytemuck"]
1515
new-unique = ["dep:solana-pubkey"]
1616

@@ -20,6 +20,8 @@ zerocopy = { workspace = true, features = ["derive"] }
2020
light-hasher = { workspace = true }
2121
light-zero-copy = { workspace = true, features = ["std"] }
2222
light-macros = { workspace = true }
23+
pinocchio = { workspace = true, optional = true }
24+
solana-program-error = { workspace = true, optional = true }
2325

2426
# Feature-gated dependencies
2527
anchor-lang = { workspace = true, optional = true }

program-libs/compressed-account/src/instruction_data/compressed_proof.rs

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -40,42 +40,3 @@ impl<'a> Deserialize<'a> for CompressedProof {
4040
Ok(Ref::<&[u8], CompressedProof>::from_prefix(bytes)?)
4141
}
4242
}
43-
44-
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq, AnchorDeserialize, AnchorSerialize)]
45-
pub struct ValidityProof(pub Option<CompressedProof>);
46-
47-
impl ValidityProof {
48-
pub fn new(proof: Option<CompressedProof>) -> Self {
49-
Self(proof)
50-
}
51-
}
52-
53-
impl From<CompressedProof> for ValidityProof {
54-
fn from(proof: CompressedProof) -> Self {
55-
Self(Some(proof))
56-
}
57-
}
58-
59-
impl From<Option<CompressedProof>> for ValidityProof {
60-
fn from(proof: Option<CompressedProof>) -> Self {
61-
Self(proof)
62-
}
63-
}
64-
impl From<&CompressedProof> for ValidityProof {
65-
fn from(proof: &CompressedProof) -> Self {
66-
Self(Some(*proof))
67-
}
68-
}
69-
70-
impl From<&Option<CompressedProof>> for ValidityProof {
71-
fn from(proof: &Option<CompressedProof>) -> Self {
72-
Self(*proof)
73-
}
74-
}
75-
76-
#[allow(clippy::from_over_into)]
77-
impl Into<Option<CompressedProof>> for ValidityProof {
78-
fn into(self) -> Option<CompressedProof> {
79-
self.0
80-
}
81-
}

program-libs/compressed-account/src/lib.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,20 @@ impl From<CompressedAccountError> for u32 {
7979
}
8080
}
8181

82+
#[cfg(feature = "solana")]
83+
impl From<CompressedAccountError> for solana_program_error::ProgramError {
84+
fn from(e: CompressedAccountError) -> Self {
85+
solana_program_error::ProgramError::Custom(e.into())
86+
}
87+
}
88+
89+
#[cfg(feature = "pinocchio")]
90+
impl From<CompressedAccountError> for pinocchio::program_error::ProgramError {
91+
fn from(e: CompressedAccountError) -> Self {
92+
pinocchio::program_error::ProgramError::Custom(e.into())
93+
}
94+
}
95+
8296
pub const NULLIFIER_QUEUE_TYPE_V1: u64 = 1;
8397
pub const ADDRESS_QUEUE_TYPE_V1: u64 = 2;
8498
pub const INPUT_STATE_QUEUE_TYPE_V2: u64 = 3;

program-libs/hasher/src/errors.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,17 @@ impl From<HasherError> for u32 {
4444
}
4545
}
4646
}
47+
48+
#[cfg(feature = "solana")]
49+
impl From<HasherError> for solana_program_error::ProgramError {
50+
fn from(e: HasherError) -> Self {
51+
solana_program_error::ProgramError::Custom(e.into())
52+
}
53+
}
54+
55+
#[cfg(feature = "pinocchio")]
56+
impl From<HasherError> for pinocchio::program_error::ProgramError {
57+
fn from(e: HasherError) -> Self {
58+
pinocchio::program_error::ProgramError::Custom(e.into())
59+
}
60+
}

program-libs/merkle-tree-metadata/Cargo.toml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,13 @@ default = []
1111
solana = [
1212
"dep:solana-msg",
1313
"dep:solana-sysvar",
14+
"solana-program-error",
1415
"solana-sysvar/bincode",
1516
"light-compressed-account/solana",
1617
"light-compressed-account/bytemuck-des",
1718
]
1819
anchor = ["solana", "anchor-lang"]
19-
pinocchio = [
20-
"dep:pinocchio",
21-
"light-compressed-account/bytemuck-des",
22-
]
20+
pinocchio = ["dep:pinocchio", "light-compressed-account/bytemuck-des"]
2321

2422
[dependencies]
2523
thiserror = { workspace = true }
@@ -28,6 +26,7 @@ zerocopy = { workspace = true, features = ["derive"] }
2826
light-compressed-account = { workspace = true, features = ["bytemuck-des"] }
2927
solana-msg = { workspace = true, optional = true }
3028
solana-sysvar = { workspace = true, optional = true }
29+
solana-program-error = { workspace = true, optional = true }
3130
anchor-lang = { workspace = true, optional = true }
3231
pinocchio = { workspace = true, optional = true }
3332
borsh = { workspace = true }

program-libs/merkle-tree-metadata/src/errors.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,17 @@ impl From<MerkleTreeMetadataError> for u32 {
3737
}
3838
}
3939
}
40+
41+
#[cfg(feature = "solana")]
42+
impl From<MerkleTreeMetadataError> for solana_program_error::ProgramError {
43+
fn from(e: MerkleTreeMetadataError) -> Self {
44+
solana_program_error::ProgramError::Custom(e.into())
45+
}
46+
}
47+
48+
#[cfg(feature = "pinocchio")]
49+
impl From<MerkleTreeMetadataError> for pinocchio::program_error::ProgramError {
50+
fn from(e: MerkleTreeMetadataError) -> Self {
51+
pinocchio::program_error::ProgramError::Custom(e.into())
52+
}
53+
}

0 commit comments

Comments
 (0)