Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SVM] Move RuntimeConfig to program-runtime #96

Merged
merged 1 commit into from
Mar 7, 2024
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
4 changes: 1 addition & 3 deletions 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 core/src/validator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ use {
poh_recorder::PohRecorder,
poh_service::{self, PohService},
},
solana_program_runtime::runtime_config::RuntimeConfig,
solana_rpc::{
max_slots::MaxSlots,
optimistically_confirmed_bank_tracker::{
Expand Down Expand Up @@ -116,7 +117,6 @@ use {
},
solana_send_transaction_service::send_transaction_service,
solana_streamer::{socket::SocketAddrSpace, streamer::StakedNodes},
solana_svm::runtime_config::RuntimeConfig,
solana_turbine::{self, broadcast_stage::BroadcastStageType},
solana_unified_scheduler_pool::DefaultSchedulerPool,
solana_vote_program::vote_state,
Expand Down
2 changes: 1 addition & 1 deletion core/tests/epoch_accounts_hash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ use {
snapshot_packager_service::SnapshotPackagerService,
},
solana_gossip::{cluster_info::ClusterInfo, contact_info::ContactInfo},
solana_program_runtime::runtime_config::RuntimeConfig,
solana_runtime::{
accounts_background_service::{
AbsRequestHandlers, AbsRequestSender, AccountsBackgroundService, DroppedSlotsReceiver,
Expand All @@ -39,7 +40,6 @@ use {
timing::timestamp,
},
solana_streamer::socket::SocketAddrSpace,
solana_svm::runtime_config::RuntimeConfig,
std::{
mem::ManuallyDrop,
sync::{
Expand Down
2 changes: 1 addition & 1 deletion core/tests/snapshots.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ use {
snapshot_packager_service::SnapshotPackagerService,
},
solana_gossip::{cluster_info::ClusterInfo, contact_info::ContactInfo},
solana_program_runtime::runtime_config::RuntimeConfig,
solana_runtime::{
accounts_background_service::{
AbsRequestHandlers, AbsRequestSender, AccountsBackgroundService,
Expand Down Expand Up @@ -50,7 +51,6 @@ use {
timing::timestamp,
},
solana_streamer::socket::SocketAddrSpace,
solana_svm::runtime_config::RuntimeConfig,
std::{
collections::HashSet,
fs,
Expand Down
1 change: 0 additions & 1 deletion ledger-tool/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ solana-sdk = { workspace = true }
solana-stake-program = { workspace = true }
solana-storage-bigtable = { workspace = true }
solana-streamer = { workspace = true }
solana-svm = { workspace = true }
solana-transaction-status = { workspace = true }
solana-unified-scheduler-pool = { workspace = true }
solana-version = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion ledger-tool/src/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ use {
blockstore_processor::ProcessOptions,
use_snapshot_archives_at_startup::{self, UseSnapshotArchivesAtStartup},
},
solana_program_runtime::runtime_config::RuntimeConfig,
solana_sdk::clock::Slot,
solana_svm::runtime_config::RuntimeConfig,
std::{
collections::HashSet,
path::{Path, PathBuf},
Expand Down
12 changes: 6 additions & 6 deletions ledger/src/blockstore_processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ use {
},
solana_measure::{measure, measure::Measure},
solana_metrics::datapoint_error,
solana_program_runtime::timings::{ExecuteTimingType, ExecuteTimings, ThreadExecuteTimings},
solana_program_runtime::{
runtime_config::RuntimeConfig,
timings::{ExecuteTimingType, ExecuteTimings, ThreadExecuteTimings},
},
solana_rayon_threadlimit::{get_max_thread_count, get_thread_count},
solana_runtime::{
accounts_background_service::{AbsRequestSender, SnapshotRequestKind},
Expand All @@ -54,11 +57,8 @@ use {
VersionedTransaction,
},
},
solana_svm::{
runtime_config::RuntimeConfig,
transaction_results::{
TransactionExecutionDetails, TransactionExecutionResult, TransactionResults,
},
solana_svm::transaction_results::{
TransactionExecutionDetails, TransactionExecutionResult, TransactionResults,
},
solana_transaction_status::token_balances::TransactionTokenBalancesSet,
solana_vote::{vote_account::VoteAccountsHashMap, vote_sender_types::ReplayVoteSender},
Expand Down
1 change: 1 addition & 0 deletions program-runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ pub mod loaded_programs;
pub mod log_collector;
pub mod message_processor;
pub mod prioritization_fee;
pub mod runtime_config;
pub mod stable_log;
pub mod sysvar_cache;
pub mod timings;
17 changes: 17 additions & 0 deletions program-runtime/src/runtime_config.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
use crate::compute_budget::ComputeBudget;

#[cfg(RUSTC_WITH_SPECIALIZATION)]
impl ::solana_frozen_abi::abi_example::AbiExample for RuntimeConfig {
fn example() -> Self {
// RuntimeConfig is not Serialize so just rely on Default.
RuntimeConfig::default()
}
}

/// Encapsulates flags that can be used to tweak the runtime behavior.
#[derive(Debug, Default, Clone)]
pub struct RuntimeConfig {
pub compute_budget: Option<ComputeBudget>,
pub log_messages_bytes_limit: Option<usize>,
pub transaction_account_lock_limit: Option<usize>,
}
4 changes: 2 additions & 2 deletions program-test/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ use {
solana_bpf_loader_program::serialization::serialize_parameters,
solana_program_runtime::{
compute_budget::ComputeBudget, ic_msg, invoke_context::BuiltinFunctionWithContext,
loaded_programs::LoadedProgram, stable_log, timings::ExecuteTimings,
loaded_programs::LoadedProgram, runtime_config::RuntimeConfig, stable_log,
timings::ExecuteTimings,
},
solana_runtime::{
accounts_background_service::{AbsRequestSender, SnapshotRequestKind},
Expand Down Expand Up @@ -45,7 +46,6 @@ use {
stable_layout::stable_instruction::StableInstruction,
sysvar::{Sysvar, SysvarId},
},
solana_svm::runtime_config::RuntimeConfig,
solana_vote_program::vote_state::{self, VoteState, VoteStateVersions},
std::{
cell::RefCell,
Expand Down
3 changes: 1 addition & 2 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 runtime/src/bank.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ use {
compute_budget_processor::process_compute_budget_instructions,
invoke_context::BuiltinFunctionWithContext,
loaded_programs::{LoadedProgram, LoadedProgramType, LoadedPrograms},
runtime_config::RuntimeConfig,
timings::{ExecuteTimingType, ExecuteTimings},
},
solana_sdk::{
Expand Down Expand Up @@ -163,7 +164,6 @@ use {
solana_svm::{
account_loader::{TransactionCheckResult, TransactionLoadResult},
account_overrides::AccountOverrides,
runtime_config::RuntimeConfig,
transaction_error_metrics::TransactionErrorMetrics,
transaction_processor::{
TransactionBatchProcessor, TransactionLogMessages, TransactionProcessingCallback,
Expand Down
2 changes: 1 addition & 1 deletion runtime/src/bank/serde_snapshot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ mod tests {
epoch_accounts_hash::EpochAccountsHash,
stake_rewards::StakeReward,
},
solana_program_runtime::runtime_config::RuntimeConfig,
solana_sdk::{
epoch_schedule::EpochSchedule,
genesis_config::create_genesis_config,
hash::Hash,
pubkey::Pubkey,
signature::{Keypair, Signer},
},
solana_svm::runtime_config::RuntimeConfig,
std::{
io::{Cursor, Read, Write},
num::NonZeroUsize,
Expand Down
2 changes: 1 addition & 1 deletion runtime/src/serde_snapshot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ use {
epoch_accounts_hash::EpochAccountsHash,
},
solana_measure::measure::Measure,
solana_program_runtime::runtime_config::RuntimeConfig,
solana_sdk::{
clock::{Epoch, Slot, UnixTimestamp},
deserialize_utils::default_on_eof,
Expand All @@ -39,7 +40,6 @@ use {
pubkey::Pubkey,
rent_collector::RentCollector,
},
solana_svm::runtime_config::RuntimeConfig,
std::{
collections::{HashMap, HashSet},
io::{self, BufReader, BufWriter, Read, Write},
Expand Down
2 changes: 1 addition & 1 deletion runtime/src/snapshot_bank_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ use {
utils::delete_contents_of_path,
},
solana_measure::{measure, measure::Measure},
solana_program_runtime::runtime_config::RuntimeConfig,
solana_sdk::{
clock::Slot,
feature_set,
Expand All @@ -45,7 +46,6 @@ use {
pubkey::Pubkey,
slot_history::{Check, SlotHistory},
},
solana_svm::runtime_config::RuntimeConfig,
std::{
collections::HashSet,
fs,
Expand Down
1 change: 0 additions & 1 deletion svm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
pub mod account_loader;
pub mod account_overrides;
pub mod account_rent_state;
pub mod runtime_config;
pub mod transaction_account_state_info;
pub mod transaction_error_metrics;
pub mod transaction_processor;
Expand Down
9 changes: 0 additions & 9 deletions svm/src/runtime_config.rs

This file was deleted.

2 changes: 1 addition & 1 deletion svm/src/transaction_processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ use {
load_accounts, LoadedTransaction, TransactionCheckResult, TransactionLoadResult,
},
account_overrides::AccountOverrides,
runtime_config::RuntimeConfig,
transaction_account_state_info::TransactionAccountStateInfo,
transaction_error_metrics::TransactionErrorMetrics,
transaction_results::{
Expand All @@ -23,6 +22,7 @@ use {
},
log_collector::LogCollector,
message_processor::MessageProcessor,
runtime_config::RuntimeConfig,
sysvar_cache::SysvarCache,
timings::{ExecuteDetailsTimings, ExecuteTimingType, ExecuteTimings},
},
Expand Down
1 change: 0 additions & 1 deletion test-validator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ solana-rpc-client = { workspace = true }
solana-runtime = { workspace = true }
solana-sdk = { workspace = true }
solana-streamer = { workspace = true }
solana-svm = { workspace = true }
solana-tpu-client = { workspace = true }
tokio = { workspace = true, features = ["full"] }

Expand Down
3 changes: 1 addition & 2 deletions test-validator/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ use {
create_new_tmp_ledger,
},
solana_net_utils::PortRange,
solana_program_runtime::compute_budget::ComputeBudget,
solana_program_runtime::{compute_budget::ComputeBudget, runtime_config::RuntimeConfig},
solana_rpc::{rpc::JsonRpcConfig, rpc_pubsub_service::PubSubConfig},
solana_rpc_client::{nonblocking, rpc_client::RpcClient},
solana_runtime::{
Expand All @@ -54,7 +54,6 @@ use {
signature::{read_keypair_file, write_keypair_file, Keypair, Signer},
},
solana_streamer::socket::SocketAddrSpace,
solana_svm::runtime_config::RuntimeConfig,
solana_tpu_client::tpu_client::{
DEFAULT_TPU_CONNECTION_POOL_SIZE, DEFAULT_TPU_ENABLE_UDP, DEFAULT_TPU_USE_QUIC,
},
Expand Down
2 changes: 1 addition & 1 deletion validator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ solana-metrics = { workspace = true }
solana-net-utils = { workspace = true }
solana-perf = { workspace = true }
solana-poh = { workspace = true }
solana-program-runtime = { workspace = true }
solana-rpc = { workspace = true }
solana-rpc-client = { workspace = true }
solana-rpc-client-api = { workspace = true }
Expand All @@ -57,7 +58,6 @@ solana-sdk = { workspace = true }
solana-send-transaction-service = { workspace = true }
solana-storage-bigtable = { workspace = true }
solana-streamer = { workspace = true }
solana-svm = { workspace = true }
solana-test-validator = { workspace = true }
solana-tpu-client = { workspace = true }
solana-unified-scheduler-pool = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion validator/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ use {
},
solana_perf::recycler::enable_recycler_warming,
solana_poh::poh_service,
solana_program_runtime::runtime_config::RuntimeConfig,
solana_rpc::{
rpc::{JsonRpcConfig, RpcBigtableConfig},
rpc_pubsub_service::PubSubConfig,
Expand All @@ -67,7 +68,6 @@ use {
},
solana_send_transaction_service::send_transaction_service,
solana_streamer::socket::SocketAddrSpace,
solana_svm::runtime_config::RuntimeConfig,
solana_tpu_client::tpu_client::DEFAULT_TPU_ENABLE_UDP,
std::{
collections::{HashSet, VecDeque},
Expand Down
Loading