pub struct SurfnetSvm {Show 55 fields
pub inner: SurfnetLiteSvm,
pub remote_rpc_url: Option<String>,
pub chain_tip: BlockIdentifier,
pub blocks: Box<dyn Storage<u64, BlockHeader>>,
pub transactions: Box<dyn Storage<String, SurfnetTransactionStatus>>,
pub jito_bundles: Box<dyn Storage<String, Vec<String>>>,
pub transactions_queued_for_confirmation: VecDeque<(VersionedTransaction, Sender<TransactionStatusEvent>, Option<TransactionError>)>,
pub transactions_queued_for_finalization: VecDeque<(Slot, VersionedTransaction, Sender<TransactionStatusEvent>, Option<TransactionError>)>,
pub perf_samples: VecDeque<RpcPerfSample>,
pub transactions_processed: u64,
pub latest_epoch_info: EpochInfo,
pub simnet_events_tx: Sender<SimnetEvent>,
pub geyser_events_tx: Sender<GeyserEvent>,
pub signature_subscriptions: HashMap<Signature, Vec<SignatureSubscriptionData>>,
pub account_subscriptions: AccountSubscriptionData,
pub program_subscriptions: ProgramSubscriptionData,
pub slot_subscriptions: Vec<Sender<SlotInfo>>,
pub slots_updates_subscriptions: Vec<SlotsUpdatesSubscriptionData>,
pub profile_tag_map: Box<dyn Storage<String, Vec<UuidOrSignature>>>,
pub simulated_transaction_profiles: Box<dyn Storage<String, KeyedProfileResult>>,
pub executed_transaction_profiles: Box<dyn Storage<String, KeyedProfileResult>>,
pub logs_subscriptions: Vec<LogsSubscriptionData>,
pub snapshot_subscriptions: Vec<SnapshotSubscriptionData>,
pub updated_at: u64,
pub slot_time: u64,
pub start_time: SystemTime,
pub accounts_by_owner: Box<dyn Storage<String, Vec<String>>>,
pub account_associated_data: Box<dyn Storage<String, SerializableAccountAdditionalData>>,
pub token_accounts: Box<dyn Storage<String, TokenAccount>>,
pub token_mints: Box<dyn Storage<String, MintAccount>>,
pub token_accounts_by_owner: Box<dyn Storage<String, Vec<String>>>,
pub token_accounts_by_delegate: Box<dyn Storage<String, Vec<String>>>,
pub token_accounts_by_mint: Box<dyn Storage<String, Vec<String>>>,
pub total_supply: u64,
pub circulating_supply: u64,
pub non_circulating_supply: u64,
pub non_circulating_accounts: Vec<String>,
pub genesis_config: GenesisConfig,
pub inflation: Inflation,
pub write_version: u64,
pub registered_idls: Box<dyn Storage<String, Vec<VersionedIdl>>>,
pub feature_set: FeatureSet,
pub instruction_profiling_enabled: bool,
pub max_profiles: usize,
pub skip_blockhash_check: bool,
pub runbook_executions: Vec<RunbookExecutionStatusReport>,
pub account_update_slots: HashMap<Pubkey, Slot>,
pub streamed_accounts: Box<dyn Storage<String, bool>>,
pub recent_blockhashes: VecDeque<(SyntheticBlockhash, i64)>,
pub scheduled_overrides: Box<dyn Storage<u64, Vec<OverrideInstance>>>,
pub offline_accounts: Box<dyn Storage<String, OfflineAccountConfig>>,
pub genesis_slot: Slot,
pub genesis_updated_at: u64,
pub slot_checkpoint: Box<dyn Storage<String, u64>>,
pub last_checkpoint_slot: u64,
}Expand description
SurfnetSvm provides a lightweight Solana Virtual Machine (SVM) for testing and simulation.
It supports a local in-memory blockchain state, remote RPC connections, transaction processing, and account management.
It also exposes channels to listen for simulation events (SimnetEvent) and Geyser plugin events (GeyserEvent).
Fields§
§inner: SurfnetLiteSvm§remote_rpc_url: Option<String>§chain_tip: BlockIdentifier§blocks: Box<dyn Storage<u64, BlockHeader>>§transactions: Box<dyn Storage<String, SurfnetTransactionStatus>>§jito_bundles: Box<dyn Storage<String, Vec<String>>>§transactions_queued_for_confirmation: VecDeque<(VersionedTransaction, Sender<TransactionStatusEvent>, Option<TransactionError>)>§transactions_queued_for_finalization: VecDeque<(Slot, VersionedTransaction, Sender<TransactionStatusEvent>, Option<TransactionError>)>§perf_samples: VecDeque<RpcPerfSample>§transactions_processed: u64§latest_epoch_info: EpochInfo§simnet_events_tx: Sender<SimnetEvent>§geyser_events_tx: Sender<GeyserEvent>§signature_subscriptions: HashMap<Signature, Vec<SignatureSubscriptionData>>§account_subscriptions: AccountSubscriptionData§program_subscriptions: ProgramSubscriptionData§slot_subscriptions: Vec<Sender<SlotInfo>>§slots_updates_subscriptions: Vec<SlotsUpdatesSubscriptionData>Senders fed by Self::subscribe_for_slots_updates. Each sender
delivers tagged SlotUpdate events (the wire format consumed by
slotsUpdatesSubscribe clients).
profile_tag_map: Box<dyn Storage<String, Vec<UuidOrSignature>>>§simulated_transaction_profiles: Box<dyn Storage<String, KeyedProfileResult>>§executed_transaction_profiles: Box<dyn Storage<String, KeyedProfileResult>>§logs_subscriptions: Vec<LogsSubscriptionData>§snapshot_subscriptions: Vec<SnapshotSubscriptionData>§updated_at: u64§slot_time: u64§start_time: SystemTime§accounts_by_owner: Box<dyn Storage<String, Vec<String>>>§account_associated_data: Box<dyn Storage<String, SerializableAccountAdditionalData>>§token_accounts: Box<dyn Storage<String, TokenAccount>>§token_mints: Box<dyn Storage<String, MintAccount>>§token_accounts_by_owner: Box<dyn Storage<String, Vec<String>>>§token_accounts_by_delegate: Box<dyn Storage<String, Vec<String>>>§token_accounts_by_mint: Box<dyn Storage<String, Vec<String>>>§total_supply: u64§circulating_supply: u64§non_circulating_supply: u64§non_circulating_accounts: Vec<String>§genesis_config: GenesisConfig§inflation: Inflation§write_version: u64A global monotonically increasing atomic number, which can be used to tell the order of the account update. For example, when an account is updated in the same slot multiple times, the update with higher write_version should supersede the one with lower write_version.
registered_idls: Box<dyn Storage<String, Vec<VersionedIdl>>>§feature_set: FeatureSet§instruction_profiling_enabled: bool§max_profiles: usize§skip_blockhash_check: bool§runbook_executions: Vec<RunbookExecutionStatusReport>§account_update_slots: HashMap<Pubkey, Slot>§streamed_accounts: Box<dyn Storage<String, bool>>§recent_blockhashes: VecDeque<(SyntheticBlockhash, i64)>§scheduled_overrides: Box<dyn Storage<u64, Vec<OverrideInstance>>>§offline_accounts: Box<dyn Storage<String, OfflineAccountConfig>>Tracks accounts that should not be downloaded from the remote RPC.
This includes accounts explicitly closed locally and accounts marked offline via cheatcodes.
The key is the account pubkey as a string. If include_owned_accounts is true,
accounts owned by this pubkey are also marked offline and excluded from remote download.
genesis_slot: SlotThe slot at which this surfnet instance started (may be non-zero when connected to remote). Used as the lower bound for block reconstruction.
genesis_updated_at: u64The updated_at timestamp when this surfnet started at genesis_slot.
Used to reconstruct block_time: genesis_updated_at + ((slot - genesis_slot) * slot_time)
slot_checkpoint: Box<dyn Storage<String, u64>>Storage for persisting the latest slot checkpoint. Used for recovery on restart with sparse block storage.
last_checkpoint_slot: u64Tracks the slot at which we last persisted the checkpoint.
Implementations§
Source§impl SurfnetSvm
impl SurfnetSvm
pub fn default() -> (Self, Receiver<SimnetEvent>, Receiver<GeyserEvent>)
pub fn new( config: SurfnetSvmConfig, ) -> SurfpoolResult<(Self, Receiver<SimnetEvent>, Receiver<GeyserEvent>)>
pub fn new_with_db( database_url: Option<&str>, config: SurfnetSvmConfig, ) -> SurfpoolResult<(Self, Receiver<SimnetEvent>, Receiver<GeyserEvent>)>
Sourcepub fn shutdown(&self)
pub fn shutdown(&self)
Explicitly shutdown the SVM, performing cleanup like WAL checkpoint for SQLite. This should be called before the application exits to ensure data is persisted.
Sourcepub fn clone_for_profiling(&self) -> Self
pub fn clone_for_profiling(&self) -> Self
Creates a clone of the SVM with overlay storage wrappers for all database-backed fields. This allows profiling transactions without affecting the underlying database. All storage writes are buffered in memory and discarded when the clone is dropped.
Subscription registries (signature_subscriptions, account_subscriptions, etc)
are all replaced with empty containers on the sandbox so that any notification
dispatched during sandbox execution cannot reach live WebSocket clients. Although
HashMap::clone() of the original maps is a deep copy of the container, each contained
crossbeam_channel::Sender is a handle to the same channel held by live subscriber
receivers — re-firing them from the sandbox would leak notifications even on bundle
abort. Emptying the containers closes that leak.
Event channels (simnet_events_tx, geyser_events_tx) are replaced with internal
buffered channels whose receivers are kept on the sandbox under sandbox_simnet_events_rx
and sandbox_geyser_events_rx. Bundle commit code can drain these to replay the events
on the original VM’s channels.
Sourcepub fn clone_for_bundle_sandbox(&self) -> BundleSandbox
pub fn clone_for_bundle_sandbox(&self) -> BundleSandbox
Creates a sandbox tailored for atomic Jito-style bundle execution. Behavior matches
Self::clone_for_profiling (all storage fields are overlay-wrapped; subscription
containers are emptied so live WS subscribers cannot be notified from the sandbox),
but the simnet_events_tx and geyser_events_tx channels are replaced with
unbounded buffered channels whose receivers are returned alongside the sandbox.
The atomic-commit phase (Self::commit_sandbox) drains those receivers to replay
the captured events onto the original VM’s real event channels on bundle success.
On bundle failure, simply dropping the returned BundleSandbox discards every
buffered event, every overlay write, and the cloned LiteSVM state — the original
VM is left byte-identical to its pre-bundle state.
Sourcepub fn commit_sandbox(
&mut self,
sandbox: BundleSandbox,
bundle_status_tx: Sender<TransactionStatusEvent>,
) -> SurfpoolResult<Vec<Signature>>
pub fn commit_sandbox( &mut self, sandbox: BundleSandbox, bundle_status_tx: Sender<TransactionStatusEvent>, ) -> SurfpoolResult<Vec<Signature>>
Atomically commit the outcome of a fully-successful bundle sandbox onto self.
This is the second half of the atomic Jito bundle pipeline. It must be invoked only
after every transaction in the bundle succeeded inside the sandbox. The caller must
hold an exclusive writer guard on self’s SurfnetSvmLocker so that no other RPC
path can observe a half-committed state.
Order of operations is state mutations first, side-effects second:
- Drain every overlay-wrapped storage field from the sandbox onto
self’s corresponding underlying storage. This is the first moment any SQLite/Postgres handle is touched on behalf of the bundle. - Move the sandbox’s
LiteSVM(the in-memory accounts DB) ontoself, replacingself.inner.svmwith the post-bundle account state. - Drain the sandbox’s account-DB overlay (
inner.db) ontoself.inner.dbso any SQLite-backed account persistence reflects the bundle’s mutations. - Pull forward counters (
write_version,transactions_processed), per-account update slots, pending confirmation/finalization queues, perf samples, and the recent-blockhash deque from the sandbox. - Drain the sandbox’s buffered geyser events; replay each onto
self.geyser_events_tx. For eachUpdateAccountevent, also firenotify_account_subscribers/notify_program_subscribersonself(the sandbox’s registries were emptied, so those notifications could not have been delivered during sandbox execution). - Drain the sandbox’s buffered simnet events; replay each onto
self.simnet_events_tx. - For each transaction committed by the bundle, fire signature and logs subscribers
at
Processedcommitment onself’s subscription registries, and send aTransactionStatusEvent::Success(Processed)on the per-tx status channel that is now part ofself.transactions_queued_for_confirmation(so the existing confirmation/finalization runloop will promote bundle txs through the commitment ladder identically to txs submitted viasendTransaction).
Returns the ordered list of signatures committed by the bundle.
pub fn increment_write_version(&mut self) -> u64
Sourcepub fn initialize(
&mut self,
epoch_info: EpochInfo,
epoch_schedule: EpochSchedule,
)
pub fn initialize( &mut self, epoch_info: EpochInfo, epoch_schedule: EpochSchedule, )
Initializes the SVM with the provided epoch info and epoch schedule.
This is reserved for remote-derived startup data that is not known until the runloop is ready to connect to a remote RPC.
§Arguments
epoch_info- The epoch information to initialize with.
pub fn set_profile_instructions(&mut self, do_profile_instructions: bool)
Sourcepub fn airdrop(
&mut self,
pubkey: &Pubkey,
lamports: u64,
) -> Result<TransactionResult, AirdropError>
pub fn airdrop( &mut self, pubkey: &Pubkey, lamports: u64, ) -> Result<TransactionResult, AirdropError>
Airdrops a specified amount of lamports to a single public key.
Validates the amount before doing anything observable: an airdrop of 0 lamports, or an amount below the rent-exempt minimum for an empty account, is rejected up front so no synthetic transaction is written and no balances are captured. The underlying SVM would not persist a sub-rent-exempt recipient account, and a follow-up account lookup would then panic on the missing account.
§Arguments
pubkey- The recipient public key.lamports- The amount of lamports to airdrop.
Sourcepub fn airdrop_pubkeys(&mut self, lamports: u64, addresses: &[Pubkey])
pub fn airdrop_pubkeys(&mut self, lamports: u64, addresses: &[Pubkey])
Airdrops a specified amount of lamports to a list of public keys.
Defers the zero-amount and below-rent-exemption checks to
Self::airdrop; on either of those variants the whole batch is
abandoned after a single info/error event, since the rejection
depends only on lamports and would otherwise repeat per recipient.
§Arguments
lamports- The amount of lamports to airdrop.addresses- Slice of recipient public keys.
Sourcepub const fn get_latest_absolute_slot(&self) -> Slot
pub const fn get_latest_absolute_slot(&self) -> Slot
Returns the latest known absolute slot from the local epoch info.
Sourcepub fn latest_blockhash(&self) -> Hash
pub fn latest_blockhash(&self) -> Hash
Returns the latest blockhash known by the SVM.
Sourcepub fn latest_epoch_info(&self) -> EpochInfo
pub fn latest_epoch_info(&self) -> EpochInfo
Returns the latest epoch info known by the SurfnetSvm.
Sourcepub fn calculate_block_time_for_slot(&self, slot: Slot) -> u64
pub fn calculate_block_time_for_slot(&self, slot: Slot) -> u64
Calculates the block time for a given slot based on genesis timestamp. Returns the time in milliseconds since genesis.
Sourcepub fn is_slot_in_valid_range(&self, slot: Slot) -> bool
pub fn is_slot_in_valid_range(&self, slot: Slot) -> bool
Sourcepub fn get_block_or_reconstruct(
&self,
slot: Slot,
) -> SurfpoolResult<Option<BlockHeader>>
pub fn get_block_or_reconstruct( &self, slot: Slot, ) -> SurfpoolResult<Option<BlockHeader>>
Gets a block from storage, or reconstructs an empty block if the slot is within the valid range (sparse block storage).
§Arguments
slot- The slot number to retrieve.
§Returns
Ok(Some(BlockHeader))- If the block exists or can be reconstructedOk(None)- If the slot is outside the valid rangeErr(_)- If there was an error accessing storage
Sourcepub fn reconstruct_empty_block(&self, slot: Slot) -> BlockHeader
pub fn reconstruct_empty_block(&self, slot: Slot) -> BlockHeader
Reconstructs an empty block header for a slot that wasn’t stored. This is used for sparse block storage where empty blocks are not persisted.
Sourcepub fn reconstruct_sysvars(&mut self)
pub fn reconstruct_sysvars(&mut self)
Reconstructs RecentBlockhashes, SlotHashes, and Clock sysvars deterministically from the current slot. Called on startup and after garbage collection to ensure consistent sysvar state without requiring database persistence.
Note: SyntheticBlockhash uses chain_tip.index (relative index), while SlotHashes and Clock use absolute slots (chain_tip.index + genesis_slot).
Sourcepub fn check_blockhash_is_recent(&self, recent_blockhash: &Hash) -> bool
pub fn check_blockhash_is_recent(&self, recent_blockhash: &Hash) -> bool
Sourcepub fn validate_transaction_blockhash(&self, tx: &VersionedTransaction) -> bool
pub fn validate_transaction_blockhash(&self, tx: &VersionedTransaction) -> bool
Validates the blockhash of a transaction, considering nonce accounts if present. If the transaction uses a nonce account, the blockhash is validated against the nonce account’s stored blockhash. Otherwise, it is validated against the RecentBlockhashes sysvar.
§Arguments
tx- The transaction to validate.
§Returns
true if the transaction blockhash is valid, false otherwise.
Sourcepub fn sigverify(
&self,
tx: &VersionedTransaction,
) -> Result<(), FailedTransactionMetadata>
pub fn sigverify( &self, tx: &VersionedTransaction, ) -> Result<(), FailedTransactionMetadata>
Verifies the signature of a transaction and validates that it hasn’t already been processed.
§Note
LiteSVM also can do this for our transactions, but we disable it. If sigverify is enabled at the LiteSVM level, the transaction simulations are always verified as well. So, if the user is trying to skip signature verification for a simulation, we’d need to unset and set this value, requiring a mutable reference to the SVM, which we don’t have/want in the simulation path. Additionally, having this function internally lets us do this check before we start fetching accounts from mainnet.
Sourcepub fn set_account(
&mut self,
pubkey: &Pubkey,
account: Account,
) -> SurfpoolResult<()>
pub fn set_account( &mut self, pubkey: &Pubkey, account: Account, ) -> SurfpoolResult<()>
pub fn update_account_registries( &mut self, pubkey: &Pubkey, account: &Account, ) -> SurfpoolResult<()>
pub fn reset_network( &mut self, epoch_info: EpochInfo, epoch_schedule: EpochSchedule, ) -> SurfpoolResult<()>
pub fn reset_account( &mut self, pubkey: &Pubkey, include_owned_accounts: bool, ) -> SurfpoolResult<()>
Sourcepub fn restore_from_snapshot(
&mut self,
snapshot_path: &str,
) -> SurfpoolResult<usize>
pub fn restore_from_snapshot( &mut self, snapshot_path: &str, ) -> SurfpoolResult<usize>
Restores account state from a snapshot file.
The snapshot should be a JSON file containing a map of pubkey strings to AccountSnapshot objects,
as generated by the surfnet_exportSnapshot RPC method.
§Arguments
snapshot_path- Path to the snapshot JSON file
§Returns
The number of accounts restored, or an error if the operation fails.
Sourcepub fn send_transaction(
&mut self,
tx: VersionedTransaction,
cu_analysis_enabled: bool,
sigverify: bool,
) -> TransactionResult
pub fn send_transaction( &mut self, tx: VersionedTransaction, cu_analysis_enabled: bool, sigverify: bool, ) -> TransactionResult
Sends a transaction to the system for execution.
This function attempts to send a transaction to the blockchain. It first increments the transactions_processed counter.
Then it sends the transaction to the system and updates its status. If the transaction is successfully processed, it is
cached locally, and a “transaction processed” event is sent. If the transaction fails, the error is recorded and an event
is sent indicating the failure.
§Arguments
tx- The transaction to send.cu_analysis_enabled- Whether compute unit analysis is enabled.
§Returns
Ok(res) if processed successfully, or Err(tx_failure) if failed.
Sourcepub fn estimate_compute_units(
&self,
transaction: &VersionedTransaction,
) -> ComputeUnitsEstimationResult
pub fn estimate_compute_units( &self, transaction: &VersionedTransaction, ) -> ComputeUnitsEstimationResult
Sourcepub fn simulate_transaction(
&self,
tx: VersionedTransaction,
sigverify: bool,
) -> Result<SimulatedTransactionInfo, FailedTransactionMetadata>
pub fn simulate_transaction( &self, tx: VersionedTransaction, sigverify: bool, ) -> Result<SimulatedTransactionInfo, FailedTransactionMetadata>
Sourcepub fn write_account_update(&mut self, account_update: GetAccountResult)
pub fn write_account_update(&mut self, account_update: GetAccountResult)
Writes account updates to the SVM state based on the provided account update result.
§Arguments
account_update- The account update result to process.
pub fn confirm_current_block(&mut self) -> SurfpoolResult<()>
Sourcepub async fn materialize_overrides(
&mut self,
remote_ctx: &Option<(SurfnetRemoteClient, CommitmentConfig)>,
) -> SurfpoolResult<()>
pub async fn materialize_overrides( &mut self, remote_ctx: &Option<(SurfnetRemoteClient, CommitmentConfig)>, ) -> SurfpoolResult<()>
Materializes scheduled overrides for the current slot
This function:
- Dequeues overrides scheduled for the current slot
- Resolves account addresses (Pubkey or PDA)
- Optionally fetches fresh account data from remote if
fetch_before_useis enabled - Applies the overrides to the account data
- Updates the SVM state
Sourcepub async fn materialize_overrides_for_slot(
&mut self,
remote_ctx: &Option<(SurfnetRemoteClient, CommitmentConfig)>,
target_slot: Slot,
) -> SurfpoolResult<()>
pub async fn materialize_overrides_for_slot( &mut self, remote_ctx: &Option<(SurfnetRemoteClient, CommitmentConfig)>, target_slot: Slot, ) -> SurfpoolResult<()>
Materializes scheduled overrides for a specific slot
Sourcepub fn get_forged_account_data(
&self,
account_pubkey: &Pubkey,
account_data: &[u8],
idl: &Idl,
overrides: &HashMap<String, Value>,
) -> SurfpoolResult<Vec<u8>>
pub fn get_forged_account_data( &self, account_pubkey: &Pubkey, account_data: &[u8], idl: &Idl, overrides: &HashMap<String, Value>, ) -> SurfpoolResult<Vec<u8>>
Forges account data by applying overrides to existing account data
This function:
- Validates account data size (must be at least 8 bytes for discriminator)
- Splits discriminator and serialized data
- Finds the account type in the IDL using the discriminator
- Deserializes the account data
- Applies field overrides using dot notation
- Re-serializes the modified data
- Reconstructs the account data with the original discriminator
§Arguments
account_pubkey- The account address (for error messages)account_data- The original account data bytesidl- The IDL for the account’s programoverrides- Map of field paths to new values
§Returns
The forged account data as bytes, or an error
Sourcepub fn subscribe_for_signature_updates(
&mut self,
signature: &Signature,
subscription_type: SignatureSubscriptionType,
) -> Receiver<(Slot, Option<TransactionError>)>
pub fn subscribe_for_signature_updates( &mut self, signature: &Signature, subscription_type: SignatureSubscriptionType, ) -> Receiver<(Slot, Option<TransactionError>)>
pub fn subscribe_for_account_updates( &mut self, account_pubkey: &Pubkey, encoding: Option<UiAccountEncoding>, ) -> Receiver<UiAccount>
pub fn subscribe_for_program_updates( &mut self, program_id: &Pubkey, encoding: Option<UiAccountEncoding>, filters: Option<Vec<RpcFilterType>>, ) -> Receiver<RpcKeyedAccount>
Sourcepub fn notify_signature_subscribers(
&mut self,
status: SignatureSubscriptionType,
signature: &Signature,
slot: Slot,
err: Option<TransactionError>,
)
pub fn notify_signature_subscribers( &mut self, status: SignatureSubscriptionType, signature: &Signature, slot: Slot, err: Option<TransactionError>, )
Notifies signature subscribers of a status update, sending slot and error info.
§Arguments
status- The subscription type (confirmed/finalized).signature- The transaction signature.slot- The slot number.err- Optional transaction error.
pub fn notify_account_subscribers( &mut self, account_updated_pubkey: &Pubkey, account: &Account, )
pub fn notify_program_subscribers( &mut self, account_pubkey: &Pubkey, account: &Account, )
Sourcepub fn get_block_at_slot(
&self,
slot: Slot,
config: &RpcBlockConfig,
) -> SurfpoolResult<Option<UiConfirmedBlock>>
pub fn get_block_at_slot( &self, slot: Slot, config: &RpcBlockConfig, ) -> SurfpoolResult<Option<UiConfirmedBlock>>
Sourcepub fn blockhash_for_slot(&self, slot: Slot) -> Option<Hash>
pub fn blockhash_for_slot(&self, slot: Slot) -> Option<Hash>
Returns the blockhash for a given slot, if available.
Sourcepub fn get_account_owned_by(
&self,
program_id: &Pubkey,
) -> SurfpoolResult<Vec<(Pubkey, Account)>>
pub fn get_account_owned_by( &self, program_id: &Pubkey, ) -> SurfpoolResult<Vec<(Pubkey, Account)>>
pub fn account_to_rpc_keyed_account<T: ReadableAccount>( &self, pubkey: &Pubkey, account: &T, config: &RpcAccountInfoConfig, token_mint: Option<Pubkey>, ) -> RpcKeyedAccount
Sourcepub fn get_token_accounts_by_delegate(
&self,
delegate: &Pubkey,
) -> Vec<(Pubkey, TokenAccount)>
pub fn get_token_accounts_by_delegate( &self, delegate: &Pubkey, ) -> Vec<(Pubkey, TokenAccount)>
Sourcepub fn get_parsed_token_accounts_by_owner(
&self,
owner: &Pubkey,
) -> Vec<(Pubkey, TokenAccount)>
pub fn get_parsed_token_accounts_by_owner( &self, owner: &Pubkey, ) -> Vec<(Pubkey, TokenAccount)>
pub fn get_token_accounts_by_owner( &self, owner: &Pubkey, ) -> SurfpoolResult<Vec<(Pubkey, Account)>>
Sourcepub fn get_token_accounts_by_mint(
&self,
mint: &Pubkey,
) -> Vec<(Pubkey, TokenAccount)>
pub fn get_token_accounts_by_mint( &self, mint: &Pubkey, ) -> Vec<(Pubkey, TokenAccount)>
pub fn subscribe_for_slot_updates(&mut self) -> Receiver<SlotInfo>
pub fn notify_slot_subscribers(&mut self, slot: Slot, parent: Slot, root: Slot)
Sourcepub fn subscribe_for_slots_updates(&mut self) -> Receiver<Arc<SlotUpdate>>
pub fn subscribe_for_slots_updates(&mut self) -> Receiver<Arc<SlotUpdate>>
Registers a new sender for slotsUpdatesSubscribe notifications and
returns the matching receiver.
The returned channel will receive every tagged SlotUpdate produced
by Self::notify_slots_updates_subscribers until the receiver is
dropped (at which point the SVM will self-prune the sender on the
next notification).
Sourcepub fn notify_slots_updates_subscribers(&mut self, update: SlotUpdate)
pub fn notify_slots_updates_subscribers(&mut self, update: SlotUpdate)
Fan-out a tagged SlotUpdate to every active
slotsUpdatesSubscribe subscriber. The update is allocated once and
shared via Arc across all senders. Disconnected receivers cause
their sender to be pruned, mirroring the cleanup pattern used by
Self::notify_slot_subscribers.
pub fn write_simulated_profile_result( &mut self, uuid: Uuid, tag: Option<String>, profile_result: KeyedProfileResult, ) -> SurfpoolResult<()>
pub fn write_executed_profile_result( &mut self, signature: Signature, profile_result: KeyedProfileResult, ) -> SurfpoolResult<()>
pub fn subscribe_for_logs_updates( &mut self, commitment_level: &CommitmentLevel, filter: &RpcTransactionLogsFilter, ) -> Receiver<(Slot, RpcLogsResponse)>
pub fn notify_logs_subscribers( &mut self, signature: &Signature, err: Option<TransactionError>, logs: Vec<String>, commitment_level: CommitmentLevel, )
Sourcepub fn register_snapshot_subscription(
&mut self,
) -> (Sender<SnapshotImportNotification>, Receiver<SnapshotImportNotification>)
pub fn register_snapshot_subscription( &mut self, ) -> (Sender<SnapshotImportNotification>, Receiver<SnapshotImportNotification>)
Registers a snapshot subscription and returns a sender and receiver for notifications. The actual import logic should be handled by the caller (SurfnetSvmLocker).
pub async fn fetch_snapshot_from_url( snapshot_url: &str, ) -> Result<BTreeMap<String, Option<AccountSnapshot>>, Box<dyn Error + Send + Sync>>
pub fn register_idl( &mut self, idl: Idl, slot: Option<Slot>, ) -> SurfpoolResult<()>
pub fn encode_ui_keyed_profile_result( &self, keyed_profile_result: KeyedProfileResult, config: &RpcProfileResultConfig, ) -> UiKeyedProfileResult
pub fn encode_ui_account<T: ReadableAccount>( &self, pubkey: &Pubkey, account: &T, encoding: UiAccountEncoding, additional_data: Option<AccountAdditionalDataV3>, data_slice_config: Option<UiDataSliceConfig>, ) -> UiAccount
pub fn get_account(&self, pubkey: &Pubkey) -> SurfpoolResult<Option<Account>>
pub fn get_all_accounts( &self, ) -> SurfpoolResult<Vec<(Pubkey, AccountSharedData)>>
pub fn get_transaction( &self, signature: &Signature, ) -> SurfpoolResult<Option<SurfnetTransactionStatus>>
pub fn start_runbook_execution(&mut self, runbook_id: String)
pub fn complete_runbook_execution( &mut self, runbook_id: &str, error: Option<Vec<String>>, )
Sourcepub fn export_snapshot(
&self,
config: ExportSnapshotConfig,
) -> SurfpoolResult<BTreeMap<String, AccountSnapshot>>
pub fn export_snapshot( &self, config: ExportSnapshotConfig, ) -> SurfpoolResult<BTreeMap<String, AccountSnapshot>>
Sourcepub fn register_scenario(
&mut self,
scenario: Scenario,
slot: Option<Slot>,
) -> SurfpoolResult<()>
pub fn register_scenario( &mut self, scenario: Scenario, slot: Option<Slot>, ) -> SurfpoolResult<()>
Registers a scenario for execution by scheduling its overrides
The slot parameter is the base slot from which relative override slot heights are calculated.
If not provided, uses the current slot.
Trait Implementations§
Source§impl Clone for SurfnetSvm
impl Clone for SurfnetSvm
Source§fn clone(&self) -> SurfnetSvm
fn clone(&self) -> SurfnetSvm
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for SurfnetSvm
impl !UnwindSafe for SurfnetSvm
impl Freeze for SurfnetSvm
impl Send for SurfnetSvm
impl Sync for SurfnetSvm
impl Unpin for SurfnetSvm
impl UnsafeUnpin for SurfnetSvm
Blanket Implementations§
Source§impl<T> AggregateExpressionMethods for T
impl<T> AggregateExpressionMethods for T
Source§fn aggregate_distinct(self) -> Self::Outputwhere
Self: DistinctDsl,
fn aggregate_distinct(self) -> Self::Outputwhere
Self: DistinctDsl,
DISTINCT modifier for aggregate functions Read moreSource§fn aggregate_all(self) -> Self::Outputwhere
Self: AllDsl,
fn aggregate_all(self) -> Self::Outputwhere
Self: AllDsl,
ALL modifier for aggregate functions Read moreSource§fn aggregate_filter<P>(self, f: P) -> Self::Output
fn aggregate_filter<P>(self, f: P) -> Self::Output
Source§fn aggregate_order<O>(self, o: O) -> Self::Outputwhere
Self: OrderAggregateDsl<O>,
fn aggregate_order<O>(self, o: O) -> Self::Outputwhere
Self: OrderAggregateDsl<O>,
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoSql for T
impl<T> IntoSql for T
Source§fn into_sql<T>(self) -> Self::Expression
fn into_sql<T>(self) -> Self::Expression
self to an expression for Diesel’s query builder. Read moreSource§fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression
fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression
&self to an expression for Diesel’s query builder. Read moreSource§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.