Remove legacy_system_instruction_processor0
This commit is contained in:
parent
3f6f1adb5b
commit
7db144c5da
|
@ -3127,7 +3127,6 @@ mod tests {
|
|||
use super::*;
|
||||
use crate::{
|
||||
accounts_index::{AccountMap, Ancestors},
|
||||
builtin_programs::new_system_program_activation_epoch,
|
||||
genesis_utils::{
|
||||
create_genesis_config_with_leader, GenesisConfigInfo, BOOTSTRAP_VALIDATOR_LAMPORTS,
|
||||
},
|
||||
|
@ -7504,77 +7503,6 @@ mod tests {
|
|||
assert_eq!(bank.capitalization(), pre_capitalization - burn_amount);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_legacy_system_instruction_processor0_stable() {
|
||||
let (mut genesis_config, mint_keypair) = create_genesis_config(1_000_000);
|
||||
genesis_config.operating_mode = OperatingMode::Stable;
|
||||
let bank0 = Arc::new(Bank::new(&genesis_config));
|
||||
|
||||
let activation_epoch = new_system_program_activation_epoch(bank0.operating_mode());
|
||||
assert!(activation_epoch > bank0.epoch());
|
||||
|
||||
// Transfer to self is not supported by legacy_system_instruction_processor0
|
||||
bank0
|
||||
.transfer(1, &mint_keypair, &mint_keypair.pubkey())
|
||||
.unwrap_err();
|
||||
|
||||
// Activate system_instruction_processor
|
||||
let bank = Bank::new_from_parent(
|
||||
&bank0,
|
||||
&Pubkey::default(),
|
||||
genesis_config
|
||||
.epoch_schedule
|
||||
.get_first_slot_in_epoch(activation_epoch),
|
||||
);
|
||||
|
||||
// Transfer to self is supported by system_instruction_processor
|
||||
bank.transfer(2, &mint_keypair, &mint_keypair.pubkey())
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_legacy_system_instruction_processor0_preview() {
|
||||
let (mut genesis_config, mint_keypair) = create_genesis_config(1_000_000);
|
||||
genesis_config.operating_mode = OperatingMode::Preview;
|
||||
let bank0 = Arc::new(Bank::new(&genesis_config));
|
||||
|
||||
let activation_epoch = new_system_program_activation_epoch(bank0.operating_mode());
|
||||
assert!(activation_epoch > bank0.epoch());
|
||||
|
||||
// Transfer to self is not supported by legacy_system_instruction_processor0
|
||||
bank0
|
||||
.transfer(1, &mint_keypair, &mint_keypair.pubkey())
|
||||
.unwrap_err();
|
||||
|
||||
// Activate system_instruction_processor
|
||||
let bank = Bank::new_from_parent(
|
||||
&bank0,
|
||||
&Pubkey::default(),
|
||||
genesis_config
|
||||
.epoch_schedule
|
||||
.get_first_slot_in_epoch(activation_epoch),
|
||||
);
|
||||
|
||||
// Transfer to self is supported by system_instruction_processor
|
||||
bank.transfer(2, &mint_keypair, &mint_keypair.pubkey())
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_legacy_system_instruction_processor0_development() {
|
||||
let (mut genesis_config, mint_keypair) = create_genesis_config(1_000_000);
|
||||
genesis_config.operating_mode = OperatingMode::Development;
|
||||
let bank0 = Arc::new(Bank::new(&genesis_config));
|
||||
|
||||
let activation_epoch = new_system_program_activation_epoch(bank0.operating_mode());
|
||||
assert!(activation_epoch == bank0.epoch());
|
||||
|
||||
// Transfer to self is supported by system_instruction_processor
|
||||
bank0
|
||||
.transfer(2, &mint_keypair, &mint_keypair.pubkey())
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_duplicate_account_key() {
|
||||
solana_logger::setup();
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use crate::{legacy_system_instruction_processor0, system_instruction_processor};
|
||||
use crate::system_instruction_processor;
|
||||
use solana_sdk::{
|
||||
clock::Epoch, entrypoint_native::ProcessInstruction, genesis_config::OperatingMode,
|
||||
pubkey::Pubkey, system_program,
|
||||
|
@ -19,30 +19,14 @@ impl BuiltinProgram {
|
|||
}
|
||||
}
|
||||
|
||||
pub(crate) fn new_system_program_activation_epoch(operating_mode: OperatingMode) -> Epoch {
|
||||
match operating_mode {
|
||||
OperatingMode::Development => 0,
|
||||
OperatingMode::Preview => 60,
|
||||
OperatingMode::Stable => 40,
|
||||
}
|
||||
}
|
||||
|
||||
/// All builtin programs that should be active at the given (operating_mode, epoch)
|
||||
pub fn get_builtin_programs(operating_mode: OperatingMode, epoch: Epoch) -> Vec<BuiltinProgram> {
|
||||
pub fn get_builtin_programs(_operating_mode: OperatingMode, _epoch: Epoch) -> Vec<BuiltinProgram> {
|
||||
vec![
|
||||
if epoch < new_system_program_activation_epoch(operating_mode) {
|
||||
BuiltinProgram::new(
|
||||
"system_program",
|
||||
system_program::id(),
|
||||
legacy_system_instruction_processor0::process_instruction,
|
||||
)
|
||||
} else {
|
||||
BuiltinProgram::new(
|
||||
"system_program",
|
||||
system_program::id(),
|
||||
system_instruction_processor::process_instruction,
|
||||
)
|
||||
},
|
||||
BuiltinProgram::new(
|
||||
"system_program",
|
||||
system_program::id(),
|
||||
system_instruction_processor::process_instruction,
|
||||
),
|
||||
BuiltinProgram::new(
|
||||
"config_program",
|
||||
solana_config_program::id(),
|
||||
|
@ -63,16 +47,8 @@ pub fn get_builtin_programs(operating_mode: OperatingMode, epoch: Epoch) -> Vec<
|
|||
|
||||
/// Builtin programs that activate at the given (operating_mode, epoch)
|
||||
pub fn get_epoch_activated_builtin_programs(
|
||||
operating_mode: OperatingMode,
|
||||
epoch: Epoch,
|
||||
_operating_mode: OperatingMode,
|
||||
_epoch: Epoch,
|
||||
) -> Option<Vec<BuiltinProgram>> {
|
||||
if epoch == new_system_program_activation_epoch(operating_mode) {
|
||||
Some(vec![BuiltinProgram::new(
|
||||
"system_program",
|
||||
system_program::id(),
|
||||
system_instruction_processor::process_instruction,
|
||||
)])
|
||||
} else {
|
||||
None
|
||||
}
|
||||
None
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -14,7 +14,6 @@ pub mod commitment;
|
|||
pub mod epoch_stakes;
|
||||
pub mod genesis_utils;
|
||||
pub mod hardened_unpack;
|
||||
mod legacy_system_instruction_processor0;
|
||||
pub mod loader_utils;
|
||||
pub mod log_collector;
|
||||
pub mod message_processor;
|
||||
|
|
Loading…
Reference in New Issue