Port instructions sysvar and secp256k1 program activation to FeatureSet
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
use crate::{
|
||||
instruction_recorder::InstructionRecorder, log_collector::LogCollector,
|
||||
native_loader::NativeLoader, rent_collector::RentCollector,
|
||||
feature_set::{self, FeatureSet},
|
||||
};
|
||||
use log::*;
|
||||
use serde::{Deserialize, Serialize};
|
||||
@@ -11,7 +12,6 @@ use solana_sdk::{
|
||||
ComputeBudget, ComputeMeter, ErasedProcessInstruction, ErasedProcessInstructionWithContext,
|
||||
Executor, InvokeContext, Logger, ProcessInstruction, ProcessInstructionWithContext,
|
||||
},
|
||||
genesis_config::ClusterType,
|
||||
instruction::{CompiledInstruction, Instruction, InstructionError},
|
||||
message::Message,
|
||||
native_loader,
|
||||
@@ -679,12 +679,11 @@ impl MessageProcessor {
|
||||
executors: Rc<RefCell<Executors>>,
|
||||
instruction_recorder: Option<InstructionRecorder>,
|
||||
instruction_index: usize,
|
||||
cluster_type: ClusterType,
|
||||
epoch: Epoch,
|
||||
feature_set: &FeatureSet,
|
||||
) -> Result<(), InstructionError> {
|
||||
// Fixup the special instructions key if present
|
||||
// before the account pre-values are taken care of
|
||||
if solana_sdk::sysvar::instructions::is_enabled(epoch, cluster_type) {
|
||||
if feature_set.active(&feature_set::instructions_sysvar_enabled::id()) {
|
||||
for (i, key) in message.account_keys.iter().enumerate() {
|
||||
if solana_sdk::sysvar::instructions::check_id(key) {
|
||||
let mut mut_account_ref = accounts[i].borrow_mut();
|
||||
@@ -736,8 +735,7 @@ impl MessageProcessor {
|
||||
log_collector: Option<Rc<LogCollector>>,
|
||||
executors: Rc<RefCell<Executors>>,
|
||||
instruction_recorders: Option<&[InstructionRecorder]>,
|
||||
cluster_type: ClusterType,
|
||||
epoch: Epoch,
|
||||
feature_set: &FeatureSet,
|
||||
) -> Result<(), TransactionError> {
|
||||
for (instruction_index, instruction) in message.instructions.iter().enumerate() {
|
||||
let instruction_recorder = instruction_recorders
|
||||
@@ -753,8 +751,7 @@ impl MessageProcessor {
|
||||
executors.clone(),
|
||||
instruction_recorder,
|
||||
instruction_index,
|
||||
cluster_type,
|
||||
epoch,
|
||||
feature_set,
|
||||
)
|
||||
.map_err(|err| TransactionError::InstructionError(instruction_index as u8, err))?;
|
||||
}
|
||||
@@ -1349,8 +1346,7 @@ mod tests {
|
||||
None,
|
||||
executors.clone(),
|
||||
None,
|
||||
ClusterType::Development,
|
||||
0,
|
||||
&FeatureSet::default(),
|
||||
);
|
||||
assert_eq!(result, Ok(()));
|
||||
assert_eq!(accounts[0].borrow().lamports, 100);
|
||||
@@ -1373,8 +1369,7 @@ mod tests {
|
||||
None,
|
||||
executors.clone(),
|
||||
None,
|
||||
ClusterType::Development,
|
||||
0,
|
||||
&FeatureSet::default(),
|
||||
);
|
||||
assert_eq!(
|
||||
result,
|
||||
@@ -1401,8 +1396,7 @@ mod tests {
|
||||
None,
|
||||
executors,
|
||||
None,
|
||||
ClusterType::Development,
|
||||
0,
|
||||
&FeatureSet::default(),
|
||||
);
|
||||
assert_eq!(
|
||||
result,
|
||||
@@ -1512,8 +1506,7 @@ mod tests {
|
||||
None,
|
||||
executors.clone(),
|
||||
None,
|
||||
ClusterType::Development,
|
||||
0,
|
||||
&FeatureSet::default(),
|
||||
);
|
||||
assert_eq!(
|
||||
result,
|
||||
@@ -1540,8 +1533,7 @@ mod tests {
|
||||
None,
|
||||
executors.clone(),
|
||||
None,
|
||||
ClusterType::Development,
|
||||
0,
|
||||
&FeatureSet::default(),
|
||||
);
|
||||
assert_eq!(result, Ok(()));
|
||||
|
||||
@@ -1565,8 +1557,7 @@ mod tests {
|
||||
None,
|
||||
executors,
|
||||
None,
|
||||
ClusterType::Development,
|
||||
0,
|
||||
&FeatureSet::default(),
|
||||
);
|
||||
assert_eq!(result, Ok(()));
|
||||
assert_eq!(accounts[0].borrow().lamports, 80);
|
||||
|
Reference in New Issue
Block a user