Make solana-address-lookup-table-program crate bpf compatible (#23700)

This commit is contained in:
Justin Starry
2022-03-17 08:21:07 +08:00
committed by GitHub
parent dda3a463a2
commit b4350a2522
11 changed files with 53 additions and 43 deletions

View File

@ -150,33 +150,3 @@ impl From<SanitizeMessageError> for TransactionError {
Self::SanitizeFailure
}
}
#[derive(Debug, Error, PartialEq, Eq, Clone)]
pub enum AddressLookupError {
/// Attempted to lookup addresses from a table that does not exist
#[error("Attempted to lookup addresses from a table that does not exist")]
LookupTableAccountNotFound,
/// Attempted to lookup addresses from an account owned by the wrong program
#[error("Attempted to lookup addresses from an account owned by the wrong program")]
InvalidAccountOwner,
/// Attempted to lookup addresses from an invalid account
#[error("Attempted to lookup addresses from an invalid account")]
InvalidAccountData,
/// Address lookup contains an invalid index
#[error("Address lookup contains an invalid index")]
InvalidLookupIndex,
}
impl From<AddressLookupError> for TransactionError {
fn from(err: AddressLookupError) -> Self {
match err {
AddressLookupError::LookupTableAccountNotFound => Self::AddressLookupTableNotFound,
AddressLookupError::InvalidAccountOwner => Self::InvalidAddressLookupTableOwner,
AddressLookupError::InvalidAccountData => Self::InvalidAddressLookupTableData,
AddressLookupError::InvalidLookupIndex => Self::InvalidAddressLookupTableIndex,
}
}
}