* Fix ed25519 builtin program handling (#23182)
* Fix ed25519 builtin program handling
* Fix tests
* Add integration tests for processing transactions with ed25519 ixs
* Fix another test
* fix formatting
(cherry picked from commit 813725dfec
)
* fix tests
Co-authored-by: Justin Starry <justin@solana.com>
Co-authored-by: Jack May <jack@solana.com>
This commit is contained in:
@ -25,6 +25,7 @@ use {
|
||||
account_info::AccountInfo,
|
||||
clock::Slot,
|
||||
entrypoint::{ProgramResult, SUCCESS},
|
||||
feature_set::FEATURE_NAMES,
|
||||
fee_calculator::{FeeCalculator, FeeRateGovernor},
|
||||
genesis_config::{ClusterType, GenesisConfig},
|
||||
hash::Hash,
|
||||
@ -41,7 +42,7 @@ use {
|
||||
solana_vote_program::vote_state::{VoteState, VoteStateVersions},
|
||||
std::{
|
||||
cell::RefCell,
|
||||
collections::HashMap,
|
||||
collections::{HashMap, HashSet},
|
||||
convert::TryFrom,
|
||||
fs::File,
|
||||
io::{self, Read},
|
||||
@ -58,7 +59,10 @@ use {
|
||||
tokio::task::JoinHandle,
|
||||
};
|
||||
// Export types so test clients can limit their solana crate dependencies
|
||||
pub use {solana_banks_client::BanksClient, solana_program_runtime::invoke_context::InvokeContext};
|
||||
pub use {
|
||||
solana_banks_client::{BanksClient, BanksClientError},
|
||||
solana_program_runtime::invoke_context::InvokeContext,
|
||||
};
|
||||
|
||||
pub mod programs;
|
||||
|
||||
@ -469,6 +473,7 @@ pub struct ProgramTest {
|
||||
compute_max_units: Option<u64>,
|
||||
prefer_bpf: bool,
|
||||
use_bpf_jit: bool,
|
||||
deactivate_feature_set: HashSet<Pubkey>,
|
||||
}
|
||||
|
||||
impl Default for ProgramTest {
|
||||
@ -499,6 +504,7 @@ impl Default for ProgramTest {
|
||||
compute_max_units: None,
|
||||
prefer_bpf,
|
||||
use_bpf_jit: false,
|
||||
deactivate_feature_set: HashSet::default(),
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -728,6 +734,13 @@ impl ProgramTest {
|
||||
.push(Builtin::new(program_name, program_id, process_instruction));
|
||||
}
|
||||
|
||||
/// Deactivate a runtime feature.
|
||||
///
|
||||
/// Note that all features are activated by default.
|
||||
pub fn deactivate_feature(&mut self, feature_id: Pubkey) {
|
||||
self.deactivate_feature_set.insert(feature_id);
|
||||
}
|
||||
|
||||
fn setup_bank(
|
||||
&self,
|
||||
) -> (
|
||||
@ -767,6 +780,25 @@ impl ProgramTest {
|
||||
ClusterType::Development,
|
||||
vec![],
|
||||
);
|
||||
|
||||
// Remove features tagged to deactivate
|
||||
for deactivate_feature_pk in &self.deactivate_feature_set {
|
||||
if FEATURE_NAMES.contains_key(deactivate_feature_pk) {
|
||||
match genesis_config.accounts.remove(deactivate_feature_pk) {
|
||||
Some(_) => debug!("Feature for {:?} deactivated", deactivate_feature_pk),
|
||||
None => warn!(
|
||||
"Feature {:?} set for deactivation not found in genesis_config account list, ignored.",
|
||||
deactivate_feature_pk
|
||||
),
|
||||
}
|
||||
} else {
|
||||
warn!(
|
||||
"Feature {:?} set for deactivation is not a known Feature public key",
|
||||
deactivate_feature_pk
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
let target_tick_duration = Duration::from_micros(100);
|
||||
genesis_config.poh_config = PohConfig::new_sleep(target_tick_duration);
|
||||
debug!("Payer address: {}", mint_keypair.pubkey());
|
||||
|
Reference in New Issue
Block a user