Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
segfaultdoc committed Dec 4, 2024
1 parent 6d34bc2 commit 9c8b8ed
Show file tree
Hide file tree
Showing 7 changed files with 64 additions and 18 deletions.
4 changes: 0 additions & 4 deletions Cargo.lock

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

10 changes: 5 additions & 5 deletions bundle-execution/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,22 @@ itertools = { workspace = true }
log = { workspace = true }
serde = { workspace = true }
solana-accounts-db = { workspace = true }
solana-ledger = { workspace = true }
#solana-ledger = { workspace = true }
solana-logger = { workspace = true }
solana-measure = { workspace = true }
solana-poh = { workspace = true }
#solana-poh = { workspace = true }
solana-program-runtime = { workspace = true }
solana-runtime = { workspace = true }
#solana-runtime = { workspace = true }
solana-sdk = { workspace = true }
solana-svm = { workspace = true }
#solana-svm = { workspace = true }
solana-timings = { workspace = true }
solana-transaction-status = { workspace = true }
thiserror = { workspace = true }

[dev-dependencies]
assert_matches = { workspace = true }
solana-logger = { workspace = true }
solana-runtime = { workspace = true, features = ["dev-context-only-utils"] }
#solana-runtime = { workspace = true, features = ["dev-context-only-utils"] }

[lib]
crate-type = ["lib"]
Expand Down
2 changes: 0 additions & 2 deletions bundle-execution/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ use {
thiserror::Error,
};

pub mod bundle_execution;

#[derive(Error, Debug, Clone, Serialize, Deserialize, PartialEq)]
pub enum TipError {
#[error("account is missing from bank: {0}")]
Expand Down
6 changes: 4 additions & 2 deletions core/src/banking_stage/unprocessed_transaction_storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ use {
itertools::Itertools,
min_max_heap::MinMaxHeap,
solana_accounts_db::account_locks::validate_account_locks,
solana_bundle::{bundle_execution::LoadAndExecuteBundleError, BundleExecutionError},
solana_measure::measure_us,
solana_runtime::bank::Bank,
solana_sdk::{
Expand All @@ -34,7 +33,10 @@ use {
saturating_add_assign,
transaction::SanitizedTransaction,
},
solana_svm::transaction_error_metrics::TransactionErrorMetrics,
solana_svm::{
bundle_processor::{BundleExecutionError, LoadAndExecuteBundleError},
transaction_error_metrics::TransactionErrorMetrics,
},
std::{
collections::{HashMap, HashSet, VecDeque},
sync::{atomic::Ordering, Arc},
Expand Down
4 changes: 0 additions & 4 deletions programs/sbf/Cargo.lock

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

Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
use {
anchor_lang::error::Error,
itertools::izip,
log::*,
serde::{Deserialize, Serialize},
solana_ledger::token_balances::collect_token_balances,
solana_measure::{measure::Measure, measure_us},
solana_poh::poh_recorder::PohRecorderError,
solana_runtime::{
account_saver::collect_accounts_to_store,
bank::{Bank, LoadAndExecuteTransactionsOutput, TransactionBalances},
Expand Down Expand Up @@ -38,6 +41,56 @@ use {
thiserror::Error,
};

#[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),
}

#[derive(Clone, Default)]
pub struct BundleExecutionMetrics {
pub num_retries: u64,
Expand Down Expand Up @@ -551,7 +604,7 @@ fn get_account_transactions(
#[cfg(test)]
mod tests {
use {
crate::bundle_execution::{load_and_execute_bundle, LoadAndExecuteBundleError},
crate::bundle_processor::{load_and_execute_bundle, LoadAndExecuteBundleError},
assert_matches::assert_matches,
solana_ledger::genesis_utils::create_genesis_config,
solana_runtime::{bank::Bank, bank_forks::BankForks, genesis_utils::GenesisConfigInfo},
Expand Down
1 change: 1 addition & 0 deletions svm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

pub mod account_loader;
pub mod account_overrides;
pub mod bundle_processor;
pub mod message_processor;
pub mod nonce_info;
pub mod program_loader;
Expand Down

0 comments on commit 9c8b8ed

Please sign in to comment.