Skip to content
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
6 changes: 6 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions cli-output/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ solana-sysvar = { workspace = true }
solana-transaction = { workspace = true, features = ["verify"] }
solana-transaction-error = { workspace = true }
solana-transaction-status = { workspace = true }
solana-transaction-status-client-types = { workspace = true }
solana-vote-program = { workspace = true }
spl-memo = { workspace = true, features = ["no-entrypoint"] }

Expand Down
6 changes: 3 additions & 3 deletions cli-output/src/cli_output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ use {
solana_stake_interface::state::{Authorized, Lockup},
solana_sysvar::stake_history::StakeHistoryEntry,
solana_transaction::{versioned::VersionedTransaction, Transaction},
solana_transaction_error::TransactionError,
solana_transaction_status::{
EncodedConfirmedBlock, EncodedTransaction, TransactionConfirmationStatus,
UiTransactionStatusMeta,
},
solana_transaction_status_client_types::UiTransactionError,
solana_vote_program::{
authorized_voters::AuthorizedVoters,
vote_state::{BlockTimestamp, LandedVote, MAX_EPOCH_CREDITS_HISTORY, MAX_LOCKOUT_HISTORY},
Expand Down Expand Up @@ -876,7 +876,7 @@ impl fmt::Display for CliHistorySignature {
pub struct CliHistoryVerbose {
pub slot: Slot,
pub block_time: Option<UnixTimestamp>,
pub err: Option<TransactionError>,
pub err: Option<UiTransactionError>,
pub confirmation_status: Option<TransactionConfirmationStatus>,
pub memo: Option<String>,
}
Expand Down Expand Up @@ -2925,7 +2925,7 @@ pub struct CliTransactionConfirmation {
#[serde(skip_serializing)]
pub get_transaction_error: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub err: Option<TransactionError>,
pub err: Option<UiTransactionError>,
}

impl QuietDisplay for CliTransactionConfirmation {}
Expand Down
4 changes: 2 additions & 2 deletions cli-output/src/display.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ use {
solana_signature::Signature,
solana_stake_interface as stake,
solana_transaction::versioned::{TransactionVersion, VersionedTransaction},
solana_transaction_error::TransactionError,
solana_transaction_status::{
Rewards, UiReturnDataEncoding, UiTransactionReturnData, UiTransactionStatusMeta,
},
solana_transaction_status_client_types::UiTransactionError,
spl_memo::{id as spl_memo_id, v1::id as spl_memo_v1_id},
std::{collections::HashMap, fmt, io, time::Duration},
};
Expand Down Expand Up @@ -541,7 +541,7 @@ fn write_rewards<W: io::Write>(

fn write_status<W: io::Write>(
w: &mut W,
transaction_status: &Result<(), TransactionError>,
transaction_status: &Result<(), UiTransactionError>,
prefix: &str,
) -> io::Result<()> {
writeln!(
Expand Down
1 change: 1 addition & 0 deletions cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ solana-tpu-client = { workspace = true, features = ["default"] }
solana-transaction = "=2.2.3"
solana-transaction-error = "=2.2.1"
solana-transaction-status = { workspace = true }
solana-transaction-status-client-types = { workspace = true }
solana-udp-client = { workspace = true }
solana-version = { workspace = true }
solana-vote-program = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion cli/src/wallet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -793,7 +793,7 @@ pub fn process_confirm(
confirmation_status: Some(transaction_status.confirmation_status()),
transaction,
get_transaction_error,
err: transaction_status.err.clone(),
err: transaction_status.err.clone().map(Into::into),
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we're making breaking changes with 3.0, it might be worth having rpc-client return the new error type in follow-up work

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we? I think people interacting with the rpc-client want to feed the TransactionError they get into {some code} where it's appropriate to feed it the ‘raw’ thing. UiTransactionError really just exists as a wrapper in which to locate stupid serialization logic like ‘you have to produce exactly this JSON for {reasons}.’ I think it's fine and appropriate to keep the Rust RPC client speaking in the base Rust types?

}
} else {
CliTransactionConfirmation {
Expand Down
1 change: 1 addition & 0 deletions client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ solana-time-utils = { workspace = true }
solana-tpu-client = { workspace = true, features = ["default"] }
solana-transaction = { workspace = true }
solana-transaction-error = { workspace = true }
solana-transaction-status-client-types = { workspace = true }
solana-udp-client = { workspace = true }
thiserror = { workspace = true }
tokio = { workspace = true, features = ["full"] }
Expand Down
32 changes: 16 additions & 16 deletions client/src/send_and_confirm_transactions_in_parallel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -284,32 +284,32 @@ async fn send_transaction_with_rpc_fallback(
ErrorKind::Io(_) | ErrorKind::Reqwest(_) => {
// fall through on io error, we will retry the transaction
}
ErrorKind::TransactionError(TransactionError::BlockhashNotFound)
| ErrorKind::RpcError(RpcError::RpcResponseError {
data:
RpcResponseErrorData::SendTransactionPreflightFailure(
RpcSimulateTransactionResult {
err: Some(TransactionError::BlockhashNotFound),
..
},
),
..
}) => {
ErrorKind::TransactionError(TransactionError::BlockhashNotFound) => {
// fall through so that we will resend with another blockhash
}
ErrorKind::TransactionError(transaction_error)
| ErrorKind::RpcError(RpcError::RpcResponseError {
ErrorKind::TransactionError(transaction_error) => {
// if we get other than blockhash not found error the transaction is invalid
context.error_map.insert(index, transaction_error.clone());
}
ErrorKind::RpcError(RpcError::RpcResponseError {
data:
RpcResponseErrorData::SendTransactionPreflightFailure(
RpcSimulateTransactionResult {
err: Some(transaction_error),
err: Some(ui_transaction_error),
..
},
),
..
}) => {
// if we get other than blockhash not found error the transaction is invalid
context.error_map.insert(index, transaction_error.clone());
match TransactionError::from(ui_transaction_error.clone()) {
TransactionError::BlockhashNotFound => {
// fall through so that we will resend with another blockhash
}
err => {
// if we get other than blockhash not found error the transaction is invalid
context.error_map.insert(index, err);
}
}
}
_ => {
return Err(TpuSenderError::from(e));
Expand Down
2 changes: 1 addition & 1 deletion ledger-tool/src/bigtable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@ async fn confirm(
confirmation_status: Some(transaction_status.confirmation_status()),
transaction,
get_transaction_error,
err: transaction_status.err.clone(),
err: transaction_status.err.clone().map(Into::into),
};
println!("{}", output_format.formatted_string(&cli_transaction));
Ok(())
Expand Down
4 changes: 4 additions & 0 deletions programs/sbf/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion rpc-client-api/src/client_error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ impl ErrorKind {
},
),
..
}) => Some(tx_err.clone()),
}) => Some(tx_err.clone().into()),
Self::TransactionError(tx_err) => Some(tx_err.clone()),
_ => None,
}
Expand Down
14 changes: 7 additions & 7 deletions rpc-client-types/src/response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ use {
solana_clock::{Epoch, Slot, UnixTimestamp},
solana_fee_calculator::{FeeCalculator, FeeRateGovernor},
solana_inflation::Inflation,
solana_transaction_error::{TransactionError, TransactionResult as Result},
solana_transaction_error::TransactionResult as Result,
solana_transaction_status_client_types::{
ConfirmedTransactionStatusWithSignature, TransactionConfirmationStatus, UiConfirmedBlock,
UiInnerInstructions, UiTransactionReturnData,
UiInnerInstructions, UiTransactionError, UiTransactionReturnData,
},
std::{collections::HashMap, fmt, net::SocketAddr, str::FromStr},
thiserror::Error,
Expand Down Expand Up @@ -240,14 +240,14 @@ pub enum RpcSignatureResult {
#[serde(rename_all = "camelCase")]
pub struct RpcLogsResponse {
pub signature: String, // Signature as base58 string
pub err: Option<TransactionError>,
pub err: Option<UiTransactionError>,
pub logs: Vec<String>,
}

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq)]
#[serde(rename_all = "camelCase")]
pub struct ProcessedSignatureResult {
pub err: Option<TransactionError>,
pub err: Option<UiTransactionError>,
}

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq)]
Expand Down Expand Up @@ -397,7 +397,7 @@ pub struct RpcSignatureConfirmation {
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq)]
#[serde(rename_all = "camelCase")]
pub struct RpcSimulateTransactionResult {
pub err: Option<TransactionError>,
pub err: Option<UiTransactionError>,
pub logs: Option<Vec<String>>,
pub accounts: Option<Vec<Option<UiAccount>>>,
pub units_consumed: Option<u64>,
Expand Down Expand Up @@ -452,7 +452,7 @@ pub struct RpcTokenAccountBalance {
pub struct RpcConfirmedTransactionStatusWithSignature {
pub signature: String,
pub slot: Slot,
pub err: Option<TransactionError>,
pub err: Option<UiTransactionError>,
pub memo: Option<String>,
pub block_time: Option<UnixTimestamp>,
pub confirmation_status: Option<TransactionConfirmationStatus>,
Expand Down Expand Up @@ -507,7 +507,7 @@ impl From<ConfirmedTransactionStatusWithSignature> for RpcConfirmedTransactionSt
Self {
signature: signature.to_string(),
slot,
err,
err: err.map(Into::into),
memo,
block_time,
confirmation_status: None,
Expand Down
38 changes: 19 additions & 19 deletions rpc/src/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3924,7 +3924,7 @@ pub mod rpc_full {
return Err(RpcCustomError::SendTransactionPreflightFailure {
message: format!("Transaction simulation failed: {err}"),
result: RpcSimulateTransactionResult {
err: Some(err),
err: Some(err.into()),
logs: Some(logs),
accounts: None,
units_consumed: Some(units_consumed),
Expand Down Expand Up @@ -4073,7 +4073,7 @@ pub mod rpc_full {
Ok(new_response(
bank,
RpcSimulateTransactionResult {
err: result.err(),
err: result.err().map(Into::into),
logs: Some(logs),
accounts,
units_consumed: Some(units_consumed),
Expand Down Expand Up @@ -7276,17 +7276,17 @@ pub mod tests {
let meta = meta.unwrap();
assert_eq!(
meta.err,
Some(TransactionError::InstructionError(
0,
InstructionError::Custom(1)
))
Some(
TransactionError::InstructionError(0, InstructionError::Custom(1))
.into()
)
);
assert_eq!(
meta.status,
Err(TransactionError::InstructionError(
0,
InstructionError::Custom(1)
))
Err(
TransactionError::InstructionError(0, InstructionError::Custom(1))
.into()
),
);
} else {
assert_eq!(meta, None);
Expand Down Expand Up @@ -7322,17 +7322,17 @@ pub mod tests {
let meta = meta.unwrap();
assert_eq!(
meta.err,
Some(TransactionError::InstructionError(
0,
InstructionError::Custom(1)
))
Some(
TransactionError::InstructionError(0, InstructionError::Custom(1))
.into()
)
);
assert_eq!(
meta.status,
Err(TransactionError::InstructionError(
0,
InstructionError::Custom(1)
))
Err(
TransactionError::InstructionError(0, InstructionError::Custom(1))
.into()
),
);
} else {
assert_eq!(meta, None);
Expand Down Expand Up @@ -8533,7 +8533,7 @@ pub mod tests {
},
]);
}
assert_eq!(result["result"]["value"]["data"], expected_value);
assert_eq!(result["result"]["value"]["data"], expected_value,);

// Test Mint
let req = format!(
Expand Down
6 changes: 4 additions & 2 deletions rpc/src/rpc_subscriptions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,9 @@ fn filter_signature_result(
) -> (Option<RpcSignatureResult>, Slot) {
(
result.map(|result| {
RpcSignatureResult::ProcessedSignature(ProcessedSignatureResult { err: result.err() })
RpcSignatureResult::ProcessedSignature(ProcessedSignatureResult {
err: result.err().map(Into::into),
})
}),
last_notified_slot,
)
Expand Down Expand Up @@ -446,7 +448,7 @@ fn filter_logs_results(
) -> (impl Iterator<Item = RpcLogsResponse>, Slot) {
let responses = logs.into_iter().flatten().map(|log| RpcLogsResponse {
signature: log.signature.to_string(),
err: log.result.err(),
err: log.result.err().map(Into::into),
logs: log.log_messages,
});
(responses, last_notified_slot)
Expand Down
4 changes: 4 additions & 0 deletions svm/examples/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading