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

Cleanup - Feature gate of delay_visibility_of_program_deployment #34087

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
1 change: 0 additions & 1 deletion accounts-db/src/accounts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1459,7 +1459,6 @@ mod tests {
accounts_data_len_delta: 0,
},
programs_modified_by_tx: Box::<LoadedProgramsForTxBatch>::default(),
programs_updated_only_for_global_cache: Box::<LoadedProgramsForTxBatch>::default(),
}
}

Expand Down
1 change: 0 additions & 1 deletion accounts-db/src/transaction_results.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ pub enum TransactionExecutionResult {
Executed {
details: TransactionExecutionDetails,
programs_modified_by_tx: Box<LoadedProgramsForTxBatch>,
programs_updated_only_for_global_cache: Box<LoadedProgramsForTxBatch>,
},
NotExecuted(TransactionError),
}
Expand Down
4 changes: 0 additions & 4 deletions ledger-tool/src/program.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ use {
account::AccountSharedData,
account_utils::StateMut,
bpf_loader_upgradeable::{self, UpgradeableLoaderState},
feature_set,
pubkey::Pubkey,
slot_history::Slot,
transaction_context::{IndexOfAccount, InstructionAccount},
Expand Down Expand Up @@ -358,9 +357,6 @@ fn load_program<'a>(
#[allow(unused_mut)]
let mut verified_executable = if is_elf {
let result = load_program_from_bytes(
invoke_context
.feature_set
.is_active(&feature_set::delay_visibility_of_program_deployment::id()),
log_collector,
&mut load_program_metrics,
&contents,
Expand Down
5 changes: 0 additions & 5 deletions program-runtime/src/invoke_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,6 @@ pub struct InvokeContext<'a> {
accounts_data_meter: AccountsDataMeter,
pub programs_loaded_for_tx_batch: &'a LoadedProgramsForTxBatch,
pub programs_modified_by_tx: &'a mut LoadedProgramsForTxBatch,
pub programs_updated_only_for_global_cache: &'a mut LoadedProgramsForTxBatch,
pub feature_set: Arc<FeatureSet>,
pub timings: ExecuteDetailsTimings,
pub blockhash: Hash,
Expand All @@ -185,7 +184,6 @@ impl<'a> InvokeContext<'a> {
compute_budget: ComputeBudget,
programs_loaded_for_tx_batch: &'a LoadedProgramsForTxBatch,
programs_modified_by_tx: &'a mut LoadedProgramsForTxBatch,
programs_updated_only_for_global_cache: &'a mut LoadedProgramsForTxBatch,
feature_set: Arc<FeatureSet>,
blockhash: Hash,
lamports_per_signature: u64,
Expand All @@ -201,7 +199,6 @@ impl<'a> InvokeContext<'a> {
accounts_data_meter: AccountsDataMeter::new(prev_accounts_data_len),
programs_loaded_for_tx_batch,
programs_modified_by_tx,
programs_updated_only_for_global_cache,
feature_set,
timings: ExecuteDetailsTimings::default(),
blockhash,
Expand Down Expand Up @@ -688,15 +685,13 @@ macro_rules! with_mock_invoke_context {
});
let programs_loaded_for_tx_batch = LoadedProgramsForTxBatch::default();
let mut programs_modified_by_tx = LoadedProgramsForTxBatch::default();
let mut programs_updated_only_for_global_cache = LoadedProgramsForTxBatch::default();
let mut $invoke_context = InvokeContext::new(
&mut $transaction_context,
&sysvar_cache,
Some(LogCollector::new_ref()),
compute_budget,
&programs_loaded_for_tx_batch,
&mut programs_modified_by_tx,
&mut programs_updated_only_for_global_cache,
Arc::new(FeatureSet::all_enabled()),
Hash::default(),
0,
Expand Down
16 changes: 0 additions & 16 deletions program-runtime/src/message_processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ impl MessageProcessor {
log_collector: Option<Rc<RefCell<LogCollector>>>,
programs_loaded_for_tx_batch: &LoadedProgramsForTxBatch,
programs_modified_by_tx: &mut LoadedProgramsForTxBatch,
programs_updated_only_for_global_cache: &mut LoadedProgramsForTxBatch,
feature_set: Arc<FeatureSet>,
compute_budget: ComputeBudget,
timings: &mut ExecuteTimings,
Expand All @@ -73,7 +72,6 @@ impl MessageProcessor {
compute_budget,
programs_loaded_for_tx_batch,
programs_modified_by_tx,
programs_updated_only_for_global_cache,
feature_set,
blockhash,
lamports_per_signature,
Expand Down Expand Up @@ -302,15 +300,13 @@ mod tests {
)));
let sysvar_cache = SysvarCache::default();
let mut programs_modified_by_tx = LoadedProgramsForTxBatch::default();
let mut programs_updated_only_for_global_cache = LoadedProgramsForTxBatch::default();
let result = MessageProcessor::process_message(
&message,
&program_indices,
&mut transaction_context,
None,
&programs_loaded_for_tx_batch,
&mut programs_modified_by_tx,
&mut programs_updated_only_for_global_cache,
Arc::new(FeatureSet::all_enabled()),
ComputeBudget::default(),
&mut ExecuteTimings::default(),
Expand Down Expand Up @@ -354,15 +350,13 @@ mod tests {
]),
)));
let mut programs_modified_by_tx = LoadedProgramsForTxBatch::default();
let mut programs_updated_only_for_global_cache = LoadedProgramsForTxBatch::default();
let result = MessageProcessor::process_message(
&message,
&program_indices,
&mut transaction_context,
None,
&programs_loaded_for_tx_batch,
&mut programs_modified_by_tx,
&mut programs_updated_only_for_global_cache,
Arc::new(FeatureSet::all_enabled()),
ComputeBudget::default(),
&mut ExecuteTimings::default(),
Expand Down Expand Up @@ -396,15 +390,13 @@ mod tests {
]),
)));
let mut programs_modified_by_tx = LoadedProgramsForTxBatch::default();
let mut programs_updated_only_for_global_cache = LoadedProgramsForTxBatch::default();
let result = MessageProcessor::process_message(
&message,
&program_indices,
&mut transaction_context,
None,
&programs_loaded_for_tx_batch,
&mut programs_modified_by_tx,
&mut programs_updated_only_for_global_cache,
Arc::new(FeatureSet::all_enabled()),
ComputeBudget::default(),
&mut ExecuteTimings::default(),
Expand Down Expand Up @@ -528,15 +520,13 @@ mod tests {
)));
let sysvar_cache = SysvarCache::default();
let mut programs_modified_by_tx = LoadedProgramsForTxBatch::default();
let mut programs_updated_only_for_global_cache = LoadedProgramsForTxBatch::default();
let result = MessageProcessor::process_message(
&message,
&program_indices,
&mut transaction_context,
None,
&programs_loaded_for_tx_batch,
&mut programs_modified_by_tx,
&mut programs_updated_only_for_global_cache,
Arc::new(FeatureSet::all_enabled()),
ComputeBudget::default(),
&mut ExecuteTimings::default(),
Expand Down Expand Up @@ -564,15 +554,13 @@ mod tests {
Some(transaction_context.get_key_of_account_at_index(0).unwrap()),
)));
let mut programs_modified_by_tx = LoadedProgramsForTxBatch::default();
let mut programs_updated_only_for_global_cache = LoadedProgramsForTxBatch::default();
let result = MessageProcessor::process_message(
&message,
&program_indices,
&mut transaction_context,
None,
&programs_loaded_for_tx_batch,
&mut programs_modified_by_tx,
&mut programs_updated_only_for_global_cache,
Arc::new(FeatureSet::all_enabled()),
ComputeBudget::default(),
&mut ExecuteTimings::default(),
Expand All @@ -597,15 +585,13 @@ mod tests {
Some(transaction_context.get_key_of_account_at_index(0).unwrap()),
)));
let mut programs_modified_by_tx = LoadedProgramsForTxBatch::default();
let mut programs_updated_only_for_global_cache = LoadedProgramsForTxBatch::default();
let result = MessageProcessor::process_message(
&message,
&program_indices,
&mut transaction_context,
None,
&programs_loaded_for_tx_batch,
&mut programs_modified_by_tx,
&mut programs_updated_only_for_global_cache,
Arc::new(FeatureSet::all_enabled()),
ComputeBudget::default(),
&mut ExecuteTimings::default(),
Expand Down Expand Up @@ -687,15 +673,13 @@ mod tests {
Arc::new(LoadedProgram::new_builtin(0, 0, MockBuiltin::vm)),
);
let mut programs_modified_by_tx = LoadedProgramsForTxBatch::default();
let mut programs_updated_only_for_global_cache = LoadedProgramsForTxBatch::default();
let result = MessageProcessor::process_message(
&message,
&[vec![0], vec![1]],
&mut transaction_context,
None,
&programs_loaded_for_tx_batch,
&mut programs_modified_by_tx,
&mut programs_updated_only_for_global_cache,
Arc::new(FeatureSet::all_enabled()),
ComputeBudget::default(),
&mut ExecuteTimings::default(),
Expand Down
45 changes: 11 additions & 34 deletions programs/bpf_loader/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,9 @@ use {
clock::Slot,
entrypoint::{MAX_PERMITTED_DATA_INCREASE, SUCCESS},
feature_set::{
bpf_account_data_direct_mapping, delay_visibility_of_program_deployment,
enable_bpf_loader_extend_program_ix, enable_bpf_loader_set_authority_checked_ix,
enable_program_redeployment_cooldown, native_programs_consume_cu,
remove_bpf_loader_incorrect_program_id,
bpf_account_data_direct_mapping, enable_bpf_loader_extend_program_ix,
enable_bpf_loader_set_authority_checked_ix, enable_program_redeployment_cooldown,
native_programs_consume_cu, remove_bpf_loader_incorrect_program_id,
},
instruction::{AccountMeta, InstructionError},
loader_instruction::LoaderInstruction,
Expand Down Expand Up @@ -66,7 +65,6 @@ pub const UPGRADEABLE_LOADER_COMPUTE_UNITS: u64 = 2_370;

#[allow(clippy::too_many_arguments)]
pub fn load_program_from_bytes(
delay_visibility_of_program_deployment: bool,
log_collector: Option<Rc<RefCell<LogCollector>>>,
load_program_metrics: &mut LoadProgramMetrics,
programdata: &[u8],
Expand All @@ -76,11 +74,7 @@ pub fn load_program_from_bytes(
program_runtime_environment: Arc<BuiltinProgram<InvokeContext<'static>>>,
reloading: bool,
) -> Result<LoadedProgram, InstructionError> {
let effective_slot = if delay_visibility_of_program_deployment {
deployment_slot.saturating_add(DELAY_VISIBILITY_SLOT_OFFSET)
} else {
deployment_slot
};
let effective_slot = deployment_slot.saturating_add(DELAY_VISIBILITY_SLOT_OFFSET);
let loaded_program = if reloading {
// Safety: this is safe because the program is being reloaded in the cache.
unsafe {
Expand Down Expand Up @@ -150,7 +144,6 @@ macro_rules! deploy_program {
load_program_metrics.verify_code_us = verify_code_time.as_us();
// Reload but with environments.program_runtime_v1
let executor = load_program_from_bytes(
$invoke_context.feature_set.is_active(&delay_visibility_of_program_deployment::id()),
$invoke_context.get_log_collector(),
&mut load_program_metrics,
$new_programdata,
Expand Down Expand Up @@ -1228,28 +1221,13 @@ fn process_loader_upgradeable_instruction(
&log_collector,
)?;
let clock = invoke_context.get_sysvar_cache().get_clock()?;
if invoke_context
.feature_set
.is_active(&delay_visibility_of_program_deployment::id())
{
invoke_context.programs_modified_by_tx.replenish(
program_key,
Arc::new(LoadedProgram::new_tombstone(
clock.slot,
LoadedProgramType::Closed,
)),
);
} else {
invoke_context
.programs_updated_only_for_global_cache
.replenish(
program_key,
Arc::new(LoadedProgram::new_tombstone(
clock.slot,
LoadedProgramType::Closed,
)),
);
}
invoke_context.programs_modified_by_tx.replenish(
program_key,
Arc::new(LoadedProgram::new_tombstone(
clock.slot,
LoadedProgramType::Closed,
)),
);
}
_ => {
ic_logger_msg!(log_collector, "Invalid Program account");
Expand Down Expand Up @@ -1711,7 +1689,6 @@ pub mod test_utils {
.expect("Failed to get account key");

if let Ok(loaded_program) = load_program_from_bytes(
true,
None,
&mut load_program_metrics,
account.data(),
Expand Down
15 changes: 0 additions & 15 deletions runtime/src/bank.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4733,8 +4733,6 @@ impl Bank {

ProgramAccountLoadResult::ProgramOfLoaderV1orV2(program_account) => {
solana_bpf_loader_program::load_program_from_bytes(
self.feature_set
.is_active(&feature_set::delay_visibility_of_program_deployment::id()),
None,
&mut load_program_metrics,
program_account.data(),
Expand All @@ -4756,8 +4754,6 @@ impl Bank {
.ok_or(InstructionError::InvalidAccountData)
.and_then(|programdata| {
solana_bpf_loader_program::load_program_from_bytes(
self.feature_set
.is_active(&feature_set::delay_visibility_of_program_deployment::id()),
None,
&mut load_program_metrics,
programdata,
Expand Down Expand Up @@ -4915,10 +4911,6 @@ impl Bank {
self.slot,
programs_loaded_for_tx_batch.environments.clone(),
);
let mut programs_updated_only_for_global_cache = LoadedProgramsForTxBatch::new(
self.slot,
programs_loaded_for_tx_batch.environments.clone(),
);
let mut process_message_time = Measure::start("process_message_time");
let process_result = MessageProcessor::process_message(
tx.message(),
Expand All @@ -4927,7 +4919,6 @@ impl Bank {
log_collector.clone(),
programs_loaded_for_tx_batch,
&mut programs_modified_by_tx,
&mut programs_updated_only_for_global_cache,
self.feature_set.clone(),
compute_budget,
timings,
Expand Down Expand Up @@ -5027,9 +5018,6 @@ impl Bank {
accounts_data_len_delta,
},
programs_modified_by_tx: Box::new(programs_modified_by_tx),
programs_updated_only_for_global_cache: Box::new(
programs_updated_only_for_global_cache,
),
}
}

Expand Down Expand Up @@ -5312,7 +5300,6 @@ impl Bank {
if let TransactionExecutionResult::Executed {
details,
programs_modified_by_tx,
programs_updated_only_for_global_cache: _,
} = &result
{
// Update batch specific cache of the loaded programs with the modifications
Expand Down Expand Up @@ -5689,13 +5676,11 @@ impl Bank {
if let TransactionExecutionResult::Executed {
details,
programs_modified_by_tx,
programs_updated_only_for_global_cache,
} = execution_result
{
if details.status.is_ok() {
let mut cache = self.loaded_programs_cache.write().unwrap();
cache.merge(programs_modified_by_tx);
cache.merge(programs_updated_only_for_global_cache);
}
}
}
Expand Down
1 change: 0 additions & 1 deletion runtime/src/bank/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,6 @@ fn new_execution_result(
accounts_data_len_delta: 0,
},
programs_modified_by_tx: Box::<LoadedProgramsForTxBatch>::default(),
programs_updated_only_for_global_cache: Box::<LoadedProgramsForTxBatch>::default(),
}
}

Expand Down