-
Notifications
You must be signed in to change notification settings - Fork 169
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Backports sim_bundle improvements (#407)
- Loading branch information
1 parent
4b6b869
commit 114bacc
Showing
24 changed files
with
354 additions
and
210 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,60 @@ | ||
use { | ||
crate::bundle_execution::LoadAndExecuteBundleError, | ||
anchor_lang::error::Error, | ||
serde::{Deserialize, Serialize}, | ||
solana_poh::poh_recorder::PohRecorderError, | ||
solana_sdk::pubkey::Pubkey, | ||
thiserror::Error, | ||
}; | ||
|
||
pub mod bundle_execution; | ||
|
||
#[derive(Error, Debug, Clone, Serialize, Deserialize, PartialEq)] | ||
pub enum TipError { | ||
#[error("account is missing from bank: {0}")] | ||
AccountMissing(Pubkey), | ||
|
||
#[error("Anchor error: {0}")] | ||
AnchorError(String), | ||
|
||
#[error("Lock error")] | ||
LockError, | ||
|
||
#[error("Error executing initialize programs")] | ||
InitializeProgramsError, | ||
|
||
#[error("Error cranking tip programs")] | ||
CrankTipError, | ||
} | ||
|
||
impl From<anchor_lang::error::Error> for TipError { | ||
fn from(anchor_err: Error) -> Self { | ||
match anchor_err { | ||
Error::AnchorError(e) => Self::AnchorError(e.error_msg), | ||
Error::ProgramError(e) => Self::AnchorError(e.to_string()), | ||
} | ||
} | ||
} | ||
|
||
pub type BundleExecutionResult<T> = Result<T, BundleExecutionError>; | ||
|
||
#[derive(Error, Debug, Clone)] | ||
pub enum BundleExecutionError { | ||
#[error("The bank has hit the max allotted time for processing transactions")] | ||
BankProcessingTimeLimitReached, | ||
|
||
#[error("The bundle exceeds the cost model")] | ||
ExceedsCostModel, | ||
|
||
#[error("Runtime error while executing the bundle: {0}")] | ||
TransactionFailure(#[from] LoadAndExecuteBundleError), | ||
|
||
#[error("Error locking bundle because a transaction is malformed")] | ||
LockError, | ||
|
||
#[error("PoH record error: {0}")] | ||
PohRecordError(#[from] PohRecorderError), | ||
|
||
#[error("Tip payment error {0}")] | ||
TipError(#[from] TipError), | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.